/************************************************************************ ** ** @file mainwindowsnogui.h ** @author Roman Telezhynskyi ** @date 12 5, 2015 ** ** @brief ** @copyright ** This source code is part of the Valentine project, a pattern making ** program, whose allow create and modeling patterns of clothing. ** Copyright (C) 2015 Valentina project ** All Rights Reserved. ** ** Valentina is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Valentina. If not, see . ** *************************************************************************/ #ifndef MAINWINDOWSNOGUI_H #define MAINWINDOWSNOGUI_H #include #include #include "../vlayout/vlayoutpiece.h" #include "xml/vpattern.h" #include "dialogs/dialogsavelayout.h" #include "../vlayout/vlayoutgenerator.h" #include "../vwidgets/vabstractmainwindow.h" class QGraphicsScene; struct PosterData; class QGraphicsRectItem; class MainWindowsNoGUI : public VAbstractMainWindow { Q_OBJECT public: explicit MainWindowsNoGUI(QWidget *parent = nullptr); virtual ~MainWindowsNoGUI() Q_DECL_OVERRIDE; public slots: void ToolLayoutSettings(bool checked); void PrintPreviewOrigin(); void PrintPreviewTiled(); void PrintOrigin(); void PrintTiled(); void RefreshDetailsLabel(); protected: QVector listDetails; /** @brief currentScene pointer to current scene. */ QGraphicsScene *currentScene; QGraphicsScene *tempSceneLayout; /** @brief pattern container with data (points, arcs, splines, spline paths, variables) */ VContainer *pattern; /** @brief doc dom document container */ VPattern *doc; QList papers; QList shadows; QList scenes; QList > details; QVector > detailsOnLayout; QAction *undoAction; QAction *redoAction; QAction *actionDockWidgetToolOptions; QAction *actionDockWidgetGroups; bool isNoScaling; bool isLayoutStale; bool ignorePrinterFields; QMarginsF margins; QSizeF paperSize; static QVector PrepareDetailsForLayout(const QHash &details); void ExportData(const QVector &listDetails, const DialogSaveLayout &dialog); void InitTempLayoutScene(); virtual void CleanLayout()=0; virtual void PrepareSceneList()=0; QIcon ScenePreview(int i) const; bool LayoutSettings(VLayoutGenerator& lGenerator); int ContinueIfLayoutStale(); QString FileName() const; void SetSizeHeightForIndividualM() const; private slots: void PrintPages (QPrinter *printer); void ErrorConsoleMode(const LayoutErrors &state); private: Q_DISABLE_COPY(MainWindowsNoGUI) bool isTiled; bool isAutoCrop; bool isUnitePages; QString layoutPrinterName; static QList CreateShadows(const QList &papers); static QList CreateScenes(const QList &papers, const QList &shadows, const QList > &details); void SvgFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene)const; void PngFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene)const; void PdfFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignorePrinterFields, const QMarginsF &margins)const; void PdfTiledFile(const QString &name); void EpsFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignorePrinterFields, const QMarginsF &margins)const; void PsFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene, bool ignorePrinterFields, const QMarginsF &margins)const; void PdfToPs(const QStringList ¶ms)const; void ObjFile(const QString &name, QGraphicsRectItem *paper, QGraphicsScene *scene)const; void FlatDxfFile(const QString &name, int version, bool binary, QGraphicsRectItem *paper, QGraphicsScene *scene, const QList > &details)const; void AAMADxfFile(const QString &name, int version, bool binary, const QSize &size, const QVector &details) const; void PreparePaper(int index) const; void RestorePaper(int index) const; void PrepareTextForDXF(const QString &placeholder, const QList > &details) const; void RestoreTextAfterDXF(const QString &placeholder, const QList > &details) const; void PrintPreview(); void LayoutPrint(); enum class PrintType : char {PrintPDF, PrintPreview, PrintNative}; void SetPrinterSettings(QPrinter *printer, const PrintType &printType); bool IsLayoutGrayscale() const; QPrinter::PaperSize FindTemplate(const QSizeF &size) const; bool isPagesUniform() const; bool IsPagesFit(const QSizeF &printPaper) const; void ExportScene(const DialogSaveLayout &dialog, const QList &scenes, const QList &papers, const QList &shadows, const QList > &details, bool ignorePrinterFields, const QMarginsF &margins) const; void ExportApparelLayout(const DialogSaveLayout &dialog, const QVector &details, const QString &name, const QSize &size) const; void ExportDetailsAsApparelLayout(const DialogSaveLayout &dialog, QVector listDetails); void ExportFlatLayout(const DialogSaveLayout &dialog, const QList &scenes, const QList &papers, const QList &shadows, const QList > &details, bool ignorePrinterFields, const QMarginsF &margins); void ExportDetailsAsFlatLayout(const DialogSaveLayout &dialog, const QVector &listDetails); }; #endif // MAINWINDOWSNOGUI_H