1 /* 2 PosteRazor - Make your own poster! 3 Copyright (C) 2005-2018 by Alessandro Portale 4 http://posterazor.sourceforge.net/ 5 6 This file is part of PosteRazor 7 8 PosteRazor is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation, either version 3 of the License, or 11 (at your option) any later version. 12 13 PosteRazor is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with PosteRazor; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 */ 22 23 #pragma once 24 25 #include "ui_mainwindow.h" 26 27 QT_BEGIN_NAMESPACE 28 class QSettings; 29 QT_END_NAMESPACE 30 31 class PosteRazorCore; 32 33 class MainWindow : public QMainWindow, private Ui::MainWindow 34 { 35 Q_OBJECT 36 37 public: 38 MainWindow(QWidget *parent = nullptr); 39 40 void retranslateUi(); 41 void retranslateUiWithDimensionUnit(); 42 void changeEvent(QEvent *event) override; 43 void dragEnterEvent(QDragEnterEvent *event) override; 44 void dropEvent(QDropEvent *event) override; 45 46 public slots: 47 void setPaperFormat(const QString &format); 48 void setPaperOrientation(QPrinter::Orientation orientation); 49 void setPaperBorderTop(qreal border); 50 void setPaperBorderRight(qreal border); 51 void setPaperBorderBottom(qreal border); 52 void setPaperBorderLeft(qreal border); 53 void setCustomPaperSize(const QSizeF &size); 54 void setUseCustomPaperSize(bool useIt); 55 void setOverlappingWidth(qreal width); 56 void setOverlappingHeight(qreal height); 57 void setOverlappingPosition(Qt::Alignment position); 58 void setPosterWidthAbsolute(qreal width); 59 void setPosterHeightAbsolute(qreal height); 60 void setPosterWidthPages(qreal width); 61 void setPosterHeightPages(qreal height); 62 void setPosterSizePercentual(qreal percent); 63 void setPosterSizeMode(Types::PosterSizeModes mode); 64 void setPosterAlignment(Qt::Alignment alignment); 65 void setLaunchPDFApplication(bool launch); 66 void updatePreview(); 67 void showImageFileName(const QString &fileName); 68 void updateImageInfoFields(const QSize &inputImageSizeInPixels, const QSizeF &imageSize, qreal verticalDpi, qreal horizontalDpi, Types::ColorTypes colorType, int bitsPerPixel); 69 void setCurrentTranslation(const QString &translation); // Only to set the right menu entry to checked 70 void setCurrentUnitOfLength(const QString &unit); 71 void addAboutDialogAction(QAction *action); 72 void readSettings(const QSettings *settings); 73 void writeSettings(QSettings *settings) const; 74 void setPreviewImage(const QImage &image); 75 void setPrevButtonEnabled(bool enabled); 76 void setNextButtonEnabled(bool enabled); 77 void setPosterSavingEnabled(bool enabled); 78 void setWizardStep(int step); 79 void setWizardStepDescription(const QString &number, const QString &description); 80 void setPreviewState(const QString &state); 81 void showWizardStepHelp(const QString &title, const QString &text); 82 void showManual(const QString &title, const QString &text); 83 84 private: 85 PosteRazorCore *m_posteRazor = nullptr; 86 QString m_currentUnitOfLength; 87 QActionGroup *m_unitOfLengthActions = nullptr; 88 QHash<QString, QAction*> m_translationActions; 89 90 void createConnections(); 91 void populateUI(); 92 93 signals: 94 void paperFormatChanged(const QString &format) const; 95 void useCustomPaperSizeChanged(bool useIt) const; 96 void paperOrientationChanged(QPrinter::Orientation orientation) const; 97 void paperCustomWidthChanged(qreal width) const; 98 void paperCustomHeightChanged(qreal height) const; 99 void paperBorderTopChanged(qreal border) const; 100 void paperBorderRightChanged(qreal border) const; 101 void paperBorderBottomChanged(qreal border) const; 102 void paperBorderLeftChanged(qreal border) const; 103 void overlappingWidthChanged(qreal width) const; 104 void overlappingHeightChanged(qreal height) const; 105 void overlappingPositionChanged(Qt::Alignment position) const; 106 void posterWidthAbsoluteChanged(qreal width) const; 107 void posterHeightAbsoluteChanged(qreal height) const; 108 void posterWidthPagesChanged(qreal width) const; 109 void posterHeightPagesChanged(qreal height) const; 110 void posterSizePercentualChanged(qreal percent) const; 111 void posterAlignmentChanged(Qt::Alignment alignment) const; 112 void savePosterSelected() const; 113 void launchPDFApplicationChanged(bool launch) const; 114 void nextButtonPressed() const; 115 void prevButtonPressed() const; 116 void wizardStepHelpSignal() const; 117 void manualSignal() const; 118 void savePosterSignal() const; 119 void loadImageSignal() const; 120 void loadImageSignal(const QString &fileName) const; 121 void needsPaint(PaintCanvasInterface *paintDevice, const QVariant &options) const; 122 void imageLoaded() const; 123 void translationChanged(const QString &localeName = QString()) const; 124 void unitOfLengthChanged(const QString &unit) const; 125 void openPosteRazorWebsiteSignal() const; 126 void imageSuffixSupportedSignal(const QString &suffix, bool &outIsSupported) const; 127 128 private slots: 129 void handleTranslationAction(QAction *action) const; 130 void handleUnitOfLengthAction(QAction *action) const; 131 void showAboutQtDialog() const; 132 void showAboutPosteRazorDialog(); 133 }; 134