1 /************************************************************************ 2 ** 3 ** @file dialogsavelayout.h 4 ** @author Roman Telezhynskyi <dismine(at)gmail.com> 5 ** @date 22 1, 2015 6 ** 7 ** @brief 8 ** @copyright 9 ** This source code is part of the Valentina project, a pattern making 10 ** program, whose allow create and modeling patterns of clothing. 11 ** Copyright (C) 2013-2015 Valentina project 12 ** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved. 13 ** 14 ** Valentina is free software: you can redistribute it and/or modify 15 ** it under the terms of the GNU General Public License as published by 16 ** the Free Software Foundation, either version 3 of the License, or 17 ** (at your option) any later version. 18 ** 19 ** Valentina is distributed in the hope that it will be useful, 20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 ** GNU General Public License for more details. 23 ** 24 ** You should have received a copy of the GNU General Public License 25 ** along with Valentina. If not, see <http://www.gnu.org/licenses/>. 26 ** 27 *************************************************************************/ 28 29 #ifndef DIALOGSAVELAYOUT_H 30 #define DIALOGSAVELAYOUT_H 31 32 #include "../vgeometry/vgeometrydef.h" 33 #include "../vlayout/dialogs/vabstractlayoutdialog.h" 34 #include "../vlayout/vlayoutdef.h" 35 36 namespace Ui 37 { 38 class DialogSaveLAyout; 39 } 40 41 class DialogSaveLayout : public VAbstractLayoutDialog 42 { 43 Q_OBJECT 44 45 public: 46 explicit DialogSaveLayout(int count, Draw mode = Draw::Layout, const QString &fileName = QString(), 47 QWidget *parent = nullptr); 48 virtual ~DialogSaveLayout(); 49 50 QString Path() const; 51 QString FileName() const; 52 53 LayoutExportFormats Format() const; 54 void SelectFormat(LayoutExportFormats format); 55 56 void SetBinaryDXFFormat(bool binary); 57 bool IsBinaryDXFFormat() const; 58 59 static QString MakeHelpFormatList(); 60 void SetDestinationPath(const QString& cmdDestinationPath); 61 62 Draw Mode() const; 63 64 static QString ExportFormatDescription(LayoutExportFormats format); 65 static QString ExportFormatSuffix(LayoutExportFormats format); 66 67 bool IsTextAsPaths() const; 68 void SetTextAsPaths(bool textAsPaths); 69 70 void SetTiledExportMode(bool tiledExportMode); 71 72 void SetTiledMargins(QMarginsF margins); 73 QMarginsF GetTiledMargins() const; 74 75 void SetTiledPageFormat(PaperSizeTemplate format); 76 PaperSizeTemplate GetTiledPageFormat() const; 77 78 void SetTiledPageOrientation(PageOrientation orientation); 79 PageOrientation GetTiledPageOrientation() const; 80 81 void SetXScale(qreal scale); 82 qreal GetXScale() const; 83 84 void SetYScale(qreal scale); 85 qreal GetYScale() const; 86 87 protected: 88 virtual void showEvent(QShowEvent *event) override; 89 void InitTemplates(QComboBox *comboBoxTemplates); 90 91 private slots: 92 void Save(); 93 void PathChanged(const QString &text); 94 void ShowExample(); 95 void ToggleScaleConnection(); 96 void HorizontalScaleChanged(double d); 97 void VerticalScaleChanged(double d); 98 private: 99 Q_DISABLE_COPY(DialogSaveLayout) 100 Ui::DialogSaveLAyout *ui; 101 int count; 102 bool isInitialized; 103 Draw m_mode; 104 bool m_tiledExportMode; 105 bool m_scaleConnected{true}; 106 107 static bool havePdf; 108 static bool tested; 109 static bool SupportPSTest(); 110 static QVector<std::pair<QString, LayoutExportFormats> > InitFormats(); 111 112 void RemoveFormatFromList(LayoutExportFormats format); 113 114 void ReadSettings(); 115 void WriteSettings() const; 116 }; 117 118 #endif // DIALOGSAVELAYOUT_H 119