3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/video/rtabmap/0001-remove-printer-support.patch
2022-02-13 10:28:14 +02:00

140 lines
4.9 KiB
Diff

From c04ce502d29f7769efbff730d1f9060b8c24629a Mon Sep 17 00:00:00 2001
From: ckie <git-525ff67@ckie.dev>
Date: Tue, 8 Feb 2022 19:18:49 +0200
Subject: [PATCH] remove printer support
---
app/src/CMakeLists.txt | 4 ++--
guilib/src/CMakeLists.txt | 4 ++--
guilib/src/GraphViewer.cpp | 12 +-----------
guilib/src/ImageView.cpp | 16 ----------------
guilib/src/utilite/UPlot.cpp | 9 ---------
5 files changed, 5 insertions(+), 40 deletions(-)
diff --git a/app/src/CMakeLists.txt b/app/src/CMakeLists.txt
index b20a07d4..2cad8c1e 100644
--- a/app/src/CMakeLists.txt
+++ b/app/src/CMakeLists.txt
@@ -63,9 +63,9 @@ ENDIF()
TARGET_LINK_LIBRARIES(rtabmap rtabmap_core rtabmap_gui rtabmap_utilite ${LIBRARIES})
IF(Qt5_FOUND)
IF(Qt5Svg_FOUND)
- QT5_USE_MODULES(rtabmap Widgets Core Gui Svg PrintSupport)
+ QT5_USE_MODULES(rtabmap Widgets Core Gui Svg)
ELSE()
- QT5_USE_MODULES(rtabmap Widgets Core Gui PrintSupport)
+ QT5_USE_MODULES(rtabmap Widgets Core Gui)
ENDIF()
ENDIF(Qt5_FOUND)
diff --git a/guilib/src/CMakeLists.txt b/guilib/src/CMakeLists.txt
index 3711205b..a393aa25 100644
--- a/guilib/src/CMakeLists.txt
+++ b/guilib/src/CMakeLists.txt
@@ -208,9 +208,9 @@ ADD_LIBRARY(rtabmap_gui ${SRC_FILES})
TARGET_LINK_LIBRARIES(rtabmap_gui rtabmap_core rtabmap_utilite ${LIBRARIES})
IF(Qt5_FOUND)
IF(Qt5Svg_FOUND)
- QT5_USE_MODULES(rtabmap_gui Widgets Core Gui Svg PrintSupport)
+ QT5_USE_MODULES(rtabmap_gui Widgets Core Gui Svg)
ELSE()
- QT5_USE_MODULES(rtabmap_gui Widgets Core Gui PrintSupport)
+ QT5_USE_MODULES(rtabmap_gui Widgets Core Gui)
ENDIF()
ENDIF(Qt5_FOUND)
diff --git a/guilib/src/GraphViewer.cpp b/guilib/src/GraphViewer.cpp
index 58907c34..7b41061f 100644
--- a/guilib/src/GraphViewer.cpp
+++ b/guilib/src/GraphViewer.cpp
@@ -38,7 +38,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QtGui/QDesktopServices>
#include <QtGui/QContextMenuEvent>
#include <QColorDialog>
-#include <QPrinter>
#include <QFileDialog>
#ifdef QT_SVG_LIB
#include <QtSvg/QSvgGenerator>
@@ -2011,16 +2010,7 @@ void GraphViewer::contextMenuEvent(QContextMenuEvent * event)
this->scene()->setSceneRect(this->scene()->itemsBoundingRect()); // Re-shrink the scene to it's bounding contents
QSize sceneSize = this->scene()->sceneRect().size().toSize();
- if(QFileInfo(filePath).suffix().compare("pdf") == 0)
- {
- QPrinter printer(QPrinter::HighResolution);
- printer.setOrientation(QPrinter::Portrait);
- printer.setOutputFileName( filePath );
- QPainter p(&printer);
- scene()->render(&p);
- p.end();
- }
- else if(QFileInfo(filePath).suffix().compare("svg") == 0)
+ if(QFileInfo(filePath).suffix().compare("svg") == 0)
{
#ifdef QT_SVG_LIB
QSvgGenerator svgGen;
diff --git a/guilib/src/ImageView.cpp b/guilib/src/ImageView.cpp
index 714f2d36..887e7bdc 100644
--- a/guilib/src/ImageView.cpp
+++ b/guilib/src/ImageView.cpp
@@ -37,7 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QInputDialog>
#include <QVBoxLayout>
#include <QColorDialog>
-#include <QPrinter>
#include <QGraphicsRectItem>
#include "rtabmap/utilite/ULogger.h"
#include "rtabmap/gui/KeypointItem.h"
@@ -843,21 +842,6 @@ void ImageView::contextMenuEvent(QContextMenuEvent * e)
}
_savedFileName = text;
- if(QFileInfo(text).suffix().compare("pdf") == 0)
- {
- QPrinter printer(QPrinter::HighResolution);
- printer.setOrientation(QPrinter::Portrait);
- printer.setOutputFileName( text );
- QPainter p(&printer);
- p.begin(&printer);
- double xscale = printer.pageRect().width()/double(_graphicsView->sceneRect().width());
- double yscale = printer.pageRect().height()/double(_graphicsView->sceneRect().height());
- double scale = qMin(xscale, yscale);
- p.scale(scale, scale);
- _graphicsView->scene()->render(&p, _graphicsView->sceneRect(), _graphicsView->sceneRect());
- p.end();
- }
- else
{
QImage img(_graphicsView->sceneRect().width(), _graphicsView->sceneRect().height(), QImage::Format_ARGB32_Premultiplied);
QPainter p(&img);
diff --git a/guilib/src/utilite/UPlot.cpp b/guilib/src/utilite/UPlot.cpp
index 1b11c65e..8bf94841 100644
--- a/guilib/src/utilite/UPlot.cpp
+++ b/guilib/src/utilite/UPlot.cpp
@@ -42,7 +42,6 @@
#include <QFileDialog>
#include <QtGui/QClipboard>
#include <QApplication>
-#include <QPrinter>
#include <QColorDialog>
#include <QToolTip>
#ifdef QT_SVG_LIB
@@ -2849,14 +2848,6 @@ void UPlot::contextMenuEvent(QContextMenuEvent * event)
else
{
#endif
- if(QFileInfo(text).suffix().compare("pdf") == 0)
- {
- QPrinter printer;
- printer.setOutputFormat(QPrinter::PdfFormat);
- printer.setOutputFileName(text);
- this->render(&printer);
- }
- else
{
QPixmap figure = QPixmap::grabWidget(this);
figure.save(text);
--
2.34.1