1 /* 2 For general Scribus (>=1.3.2) copyright and licensing information please refer 3 to the COPYING file provided with the program. Following this notice may exist 4 a copyright and/or license notice that predates the release of Scribus 1.3.2 5 for which a new license (GPL+exception) is in place. 6 */ 7 #ifndef NEWDOCDIALOG_H 8 #define NEWDOCDIALOG_H 9 10 #include <QDialog> 11 #include <QDropEvent> 12 #include <QDragEnterEvent> 13 #include <QDragLeaveEvent> 14 #include <QDragMoveEvent> 15 #include <QListWidget> 16 17 class QCheckBox; 18 class QComboBox; 19 class QGridLayout; 20 class QHBoxLayout; 21 class QVBoxLayout; 22 class QFrame; 23 class QGroupBox; 24 class QLabel; 25 class QListWidgetItem; 26 class QPushButton; 27 class QSpinBox; 28 29 #include "scribusapi.h" 30 #include "scribusstructs.h" 31 32 #include "ui/customfdialog.h" 33 #include "ui/nftwidget.h" 34 35 class PrefsManager; 36 class MarginWidget; 37 class ScrSpinBox; 38 class QFileDialog; 39 40 class SCRIBUS_API PageLayoutsWidget : public QListWidget 41 { 42 Q_OBJECT 43 44 public: 45 PageLayoutsWidget(QWidget* parent); 46 ~PageLayoutsWidget() = default; 47 void arrangeIcons(); 48 QSize minimumSizeHint() const override; 49 int maxX {0}; 50 int maxY {0}; 51 }; 52 53 54 class SCRIBUS_API NewDocDialog : public QDialog 55 { 56 Q_OBJECT 57 58 public: 59 60 //! \brief Indexes of the dialog's tabs. 61 enum { 62 NewDocumentTab = 0, 63 NewFromTemplateTab, 64 OpenExistingTab, 65 OpenRecentTab 66 } ActionSelected; 67 68 NewDocDialog( QWidget* parent, const QStringList& recentDocs, bool startUp = false, const QString& lang = ""); 69 ~NewDocDialog() = default; 70 71 void createNewDocPage(); 72 void createNewFromTempPage(); 73 void createOpenDocPage(); 74 void createRecentDocPage(); 75 void setSize(const QString& gr); 76 77 QTabWidget* tabWidget {nullptr}; 78 QFrame* newDocFrame {nullptr}; 79 PageLayoutsWidget* layoutsView {nullptr}; 80 QLabel* layoutLabel1 {nullptr}; 81 QComboBox* firstPage {nullptr}; 82 QGroupBox* pageSizeGroupBox {nullptr}; 83 MarginWidget* marginGroup {nullptr}; 84 QGroupBox* optionsGroupBox {nullptr}; 85 QLabel* TextLabel1 {nullptr}; 86 QLabel* TextLabel2 {nullptr}; 87 QLabel* TextLabel3 {nullptr}; 88 QLabel* TextLabel4 {nullptr}; 89 QLabel* TextLabel1_2 {nullptr}; 90 QLabel* TextLabel1_3 {nullptr}; 91 QLabel* pageCountLabel {nullptr}; 92 QLabel* TextLabel2_2 {nullptr}; 93 QLabel* unitOfMeasureLabel {nullptr}; 94 QComboBox* pageSizeComboBox {nullptr}; 95 QComboBox* pageOrientationComboBox {nullptr}; 96 QComboBox* unitOfMeasureComboBox {nullptr}; 97 QCheckBox* startUpDialog {nullptr}; 98 QCheckBox* autoTextFrame {nullptr}; 99 QCheckBox* startDocSetup {nullptr}; 100 ScrSpinBox* Distance {nullptr}; 101 QSpinBox* numberOfCols {nullptr}; 102 QSpinBox* pageCountSpinBox {nullptr}; 103 ScrSpinBox* widthSpinBox {nullptr}; 104 ScrSpinBox* heightSpinBox {nullptr}; 105 QFrame* openDocFrame {nullptr}; 106 QFileDialog *fileDialog {nullptr}; 107 QFrame* newFromTempFrame {nullptr}; 108 nftwidget *nftGui {nullptr}; 109 QFrame* recentDocFrame {nullptr}; 110 QListWidget* recentDocListBox {nullptr}; 111 QPushButton* OKButton {nullptr}; 112 QPushButton* CancelB {nullptr}; 113 onStartup()114 bool onStartup() const { return m_onStartup;} tabSelected()115 int tabSelected() const { return m_tabSelected;} selectedFile()116 QString selectedFile() const { return m_selectedFile; } 117 unitIndex()118 int unitIndex() const { return m_unitIndex;} unitSuffix()119 QString unitSuffix() const { return m_unitSuffix;} unitRatio()120 double unitRatio() const { return m_unitRatio; } 121 orientation()122 int orientation() const { return m_orientation;} choosenLayout()123 int choosenLayout() const { return m_choosenLayout;} pageWidth()124 double pageWidth() const { return m_pageWidth;} pageHeight()125 double pageHeight() const { return m_pageHeight;} distance()126 double distance() const { return m_distance;} bleedBottom()127 double bleedBottom() const { return m_bleedBottom;} bleedTop()128 double bleedTop() const { return m_bleedTop;} bleedLeft()129 double bleedLeft() const { return m_bleedLeft;} bleedRight()130 double bleedRight() const { return m_bleedRight;} 131 132 public slots: 133 void setHeight(double v); 134 void setWidth(double v); 135 void selectItem(uint nr); 136 void itemSelected(QListWidgetItem* ic); 137 void handleAutoFrame(); 138 void setDistance(double v); 139 void setUnit(int u); 140 void ExitOK(); 141 void setOrientation(int ori); 142 void setPageSize(const QString &); 143 void setDocLayout(int layout); 144 /*! Opens document on doubleclick 145 \author Petr Vanek <petr@yarpen.cz> 146 */ 147 void recentDocListBox_doubleClicked(); 148 void openFile(); 149 void adjustTitles(int tab); 150 void locationDropped(const QString& fileUrl); 151 void gotoParentDirectory(); 152 void gotoSelectedDirectory(); 153 void gotoDesktopDirectory(); 154 void gotoHomeDirectory(); 155 void openFileDialogFileClicked(const QString &path); 156 157 protected: 158 QVBoxLayout* TabbedNewDocLayout {nullptr}; 159 QHBoxLayout* Layout1 {nullptr}; 160 QGridLayout* NewDocLayout {nullptr}; 161 QGridLayout* pageSizeGroupBoxLayout {nullptr}; 162 QGridLayout* optionsGroupBoxLayout {nullptr}; 163 QVBoxLayout* openDocLayout {nullptr}; 164 QVBoxLayout* recentDocLayout {nullptr}; 165 QVBoxLayout *verticalLayout {nullptr}; 166 PrefsManager& prefsManager; 167 QStringList recentDocList; 168 169 double m_unitRatio { 1.0 }; 170 int m_orientation { 0 }; 171 int m_choosenLayout { 0 }; 172 double m_pageWidth; 173 double m_pageHeight; 174 double m_distance { 11.0 }; 175 QString m_unitSuffix; 176 QString m_selectedFile; 177 int m_unitIndex { 0 }; 178 int m_tabSelected { 0 }; 179 bool m_onStartup; 180 double m_bleedBottom { 0.0 }; 181 double m_bleedTop { 0.0 }; 182 double m_bleedLeft { 0.0 }; 183 double m_bleedRight { 0.0 }; 184 }; 185 186 #endif // NEWDOC_H 187