summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-12-13 13:32:40 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-12-17 13:03:56 -0800
commitfa6eb6144bc756380c4148d05a67a99b0ac25ef3 (patch)
tree2b8090561e1ad3e7c982cd6af56d2b08dbf4b8cf
parent2239ffe13c1babcae7a0822c83ab8d0f23317358 (diff)
downloadsubsurface-fa6eb6144bc756380c4148d05a67a99b0ac25ef3.tar.gz
printing: move #includes from headers to source files
To decrease include-file interdependencies. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--desktop-widgets/mainwindow.cpp3
-rw-r--r--desktop-widgets/printdialog.cpp6
-rw-r--r--desktop-widgets/printdialog.h6
-rw-r--r--desktop-widgets/printer.cpp5
-rw-r--r--desktop-widgets/printer.h14
-rw-r--r--desktop-widgets/printoptions.cpp1
-rw-r--r--desktop-widgets/templateedit.cpp3
-rw-r--r--desktop-widgets/templateedit.h2
-rw-r--r--desktop-widgets/templatelayout.cpp7
-rw-r--r--desktop-widgets/templatelayout.h13
10 files changed, 39 insertions, 21 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 201ac1fd8..e56384540 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -55,9 +55,12 @@
#include "profile-widget/profilewidget2.h"
#ifndef NO_PRINTING
+#include <QPrinter>
#include <QPrintDialog>
#include <QBuffer>
#include "desktop-widgets/printdialog.h"
+#include "desktop-widgets/printer.h"
+#include "desktop-widgets/templatelayout.h"
#endif
#include "qt-models/cylindermodel.h"
diff --git a/desktop-widgets/printdialog.cpp b/desktop-widgets/printdialog.cpp
index 29cf4fe54..8187dda6e 100644
--- a/desktop-widgets/printdialog.cpp
+++ b/desktop-widgets/printdialog.cpp
@@ -1,10 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
#include "printdialog.h"
-#include "printoptions.h"
-#include "mainwindow.h"
+#include "printer.h"
+#include "core/pref.h"
+#include "core/dive.h" // for existing_filename
#ifndef NO_PRINTING
#include <QProgressBar>
+#include <QPrinter>
#include <QPrintPreviewDialog>
#include <QPrintDialog>
#include <QFileDialog>
diff --git a/desktop-widgets/printdialog.h b/desktop-widgets/printdialog.h
index 19473544d..6e34ca7cb 100644
--- a/desktop-widgets/printdialog.h
+++ b/desktop-widgets/printdialog.h
@@ -4,11 +4,11 @@
#ifndef NO_PRINTING
#include <QDialog>
-#include <QPrinter>
-#include "printoptions.h"
-#include "printer.h"
#include "templateedit.h"
+#include "printoptions.h"
+class Printer;
+class QPrinter;
class QProgressBar;
class PrintOptions;
class PrintLayout;
diff --git a/desktop-widgets/printer.cpp b/desktop-widgets/printer.cpp
index 05f82d688..93155daa3 100644
--- a/desktop-widgets/printer.cpp
+++ b/desktop-widgets/printer.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "printer.h"
+#include "mainwindow.h"
#include "templatelayout.h"
#include "core/statistics.h"
#include "core/qthelper.h"
@@ -7,6 +8,7 @@
#include <algorithm>
#include <QPainter>
+#include <QPrinter>
#include <QtWebKitWidgets>
#include <QWebElementCollection>
#include <QWebElement>
@@ -28,7 +30,8 @@ Printer::~Printer()
delete webView;
}
-void Printer::putProfileImage(QRect profilePlaceholder, QRect viewPort, QPainter *painter, struct dive *dive, QPointer<ProfileWidget2> profile)
+void Printer::putProfileImage(const QRect &profilePlaceholder, const QRect &viewPort, QPainter *painter,
+ struct dive *dive, QPointer<ProfileWidget2> profile)
{
int x = profilePlaceholder.x() - viewPort.x();
int y = profilePlaceholder.y() - viewPort.y();
diff --git a/desktop-widgets/printer.h b/desktop-widgets/printer.h
index c95700684..5c9fc661b 100644
--- a/desktop-widgets/printer.h
+++ b/desktop-widgets/printer.h
@@ -2,14 +2,15 @@
#ifndef PRINTER_H
#define PRINTER_H
-#include <QPrinter>
-#include <QWebView>
-#include <QRect>
-#include <QPainter>
-
#include "printoptions.h"
#include "templateedit.h"
+class ProfileWidget2;
+class QPainter;
+class QPaintDevice;
+class QRect;
+class QWebView;
+
class Printer : public QObject {
Q_OBJECT
@@ -30,7 +31,8 @@ private:
int dpi;
void render(int Pages);
void flowRender();
- void putProfileImage(QRect box, QRect viewPort, QPainter *painter, struct dive *dive, QPointer<ProfileWidget2> profile);
+ void putProfileImage(const QRect &box, const QRect &viewPort, QPainter *painter,
+ struct dive *dive, QPointer<ProfileWidget2> profile);
private slots:
void templateProgessUpdated(int value);
diff --git a/desktop-widgets/printoptions.cpp b/desktop-widgets/printoptions.cpp
index bebfb732f..e36351443 100644
--- a/desktop-widgets/printoptions.cpp
+++ b/desktop-widgets/printoptions.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "printoptions.h"
#include "templateedit.h"
+#include "templatelayout.h"
#include "core/qthelper.h"
#include <QDebug>
diff --git a/desktop-widgets/templateedit.cpp b/desktop-widgets/templateedit.cpp
index d96ebdeef..e7d81f8d9 100644
--- a/desktop-widgets/templateedit.cpp
+++ b/desktop-widgets/templateedit.cpp
@@ -1,12 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
#include "templateedit.h"
-#include "printoptions.h"
+#include "templatelayout.h"
#include "printer.h"
#include "ui_templateedit.h"
#include <QMessageBox>
#include <QButtonGroup>
#include <QColorDialog>
+#include <QDir>
TemplateEdit::TemplateEdit(QWidget *parent, const print_options &printOptions, template_options &templateOptions) :
QDialog(parent),
diff --git a/desktop-widgets/templateedit.h b/desktop-widgets/templateedit.h
index 5c4c7cd96..c4ebe7969 100644
--- a/desktop-widgets/templateedit.h
+++ b/desktop-widgets/templateedit.h
@@ -3,7 +3,7 @@
#define TEMPLATEEDIT_H
#include <QDialog>
-#include "templatelayout.h"
+#include "printoptions.h"
namespace Ui {
class TemplateEdit;
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp
index 7d29b20dd..b7da29294 100644
--- a/desktop-widgets/templatelayout.cpp
+++ b/desktop-widgets/templatelayout.cpp
@@ -1,11 +1,16 @@
// SPDX-License-Identifier: GPL-2.0
#include <QFileDevice>
#include <QRegularExpression>
-#include <list>
+#include <QTextStream>
#include "templatelayout.h"
+#include "mainwindow.h"
+#include "printoptions.h"
#include "core/divelist.h"
#include "core/selection.h"
+#include "core/qthelper.h"
+#include "core/subsurface-qt/diveobjecthelper.h"
+#include "core/subsurface-qt/cylinderobjecthelper.h" // TODO: remove once grantlee supports Q_GADGET objects
QList<QString> grantlee_templates, grantlee_statistics_templates;
diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h
index e1c51eb0c..c7e3537aa 100644
--- a/desktop-widgets/templatelayout.h
+++ b/desktop-widgets/templatelayout.h
@@ -2,13 +2,14 @@
#ifndef TEMPLATELAYOUT_H
#define TEMPLATELAYOUT_H
-#include <QStringList>
-#include "mainwindow.h"
-#include "printoptions.h"
#include "core/statistics.h"
-#include "core/qthelper.h"
-#include "core/subsurface-qt/diveobjecthelper.h"
-#include "core/subsurface-qt/cylinderobjecthelper.h" // TODO: remove once grantlee supports Q_GADGET objects
+#include <QStringList>
+
+class DiveObjectHelperGrantlee;
+class CylinderObjectHelper;
+struct print_options;
+struct template_options;
+class QTextStream;
int getTotalWork(const print_options &printOptions);
void find_all_templates();