/************************************************************************ ** ** @file mainwindowsnogui.h ** @author Roman Telezhynskyi ** @date 12 5, 2015 ** ** @brief ** @copyright ** This source code is part of the Valentina 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 #include #include "../vlayout/vlayoutpiece.h" #include "xml/vpattern.h" #include "dialogs/dialogsavelayout.h" #include "../vlayout/vlayoutgenerator.h" #include "../vwidgets/vabstractmainwindow.h" #include "../vlayout/vtextmanager.h" #include "../vlayout/vprintlayout.h" class QGraphicsScene; struct PosterData; class QGraphicsRectItem; class VMeasurements; #if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) class QWinTaskbarButton; class QWinTaskbarProgress; #endif QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Weffc++") struct DetailForLayout { DetailForLayout() = default; DetailForLayout(quint32 id, const VPiece &piece) : id(id), piece(piece) {} quint32 id{NULL_ID}; VPiece piece; }; QT_WARNING_POP enum class PreviewQuatilty : bool {Fast = true, Slow = false}; class MainWindowsNoGUI : public VAbstractMainWindow { Q_OBJECT public: explicit MainWindowsNoGUI(QWidget *parent = nullptr); virtual ~MainWindowsNoGUI() override; public slots: void ToolLayoutSettings(bool checked); void PrintPreviewOrigin(); void PrintPreviewTiled(); void PrintOrigin(); void PrintTiled(); protected slots: void ExportFMeasurementsToCSV(); protected: QVector listDetails{}; /** @brief currentScene pointer to current scene. */ QGraphicsScene *currentScene{nullptr}; QGraphicsScene *tempSceneLayout{nullptr}; /** @brief pattern container with data (points, arcs, splines, spline paths, variables) */ VContainer *pattern; /** @brief doc dom document container */ VPattern *doc{nullptr}; QList gcontours{}; QVector > detailsOnLayout{}; QAction *undoAction{nullptr}; QAction *redoAction{nullptr}; QAction *actionDockWidgetToolOptions{nullptr}; QAction *actionDockWidgetGroups{nullptr}; bool isNoScaling{false}; bool isNeedAutosave{false}; VPrintLayout *m_layoutSettings{new VPrintLayout(this)}; /** @brief mouseCoordinate pointer to label who show mouse coordinate. */ QPointer m_mouseCoordinate{nullptr}; QPointer m_unreadPatternMessage{nullptr}; QSharedPointer m_dialogSaveLayout{}; #if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) QWinTaskbarButton *m_taskbarButton; QWinTaskbarProgress *m_taskbarProgress{nullptr}; #endif static QVector PrepareDetailsForLayout(const QVector &details); void ExportData(const QVector &listDetails); void InitTempLayoutScene(); virtual void CleanLayout()=0; virtual void PrepareSceneList(PreviewQuatilty quality)=0; virtual QStringList RecentFileList() const override; QIcon ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const; bool GenerateLayout(VLayoutGenerator& lGenerator); QString FileName() const; bool ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) const; QSharedPointer OpenMeasurementFile(const QString &path) const; void CheckRequiredMeasurements(const VMeasurements *m) const; private: Q_DISABLE_COPY(MainWindowsNoGUI) static QList CreateShadows(const QList &papers); static QList CreateScenes(const QList &papers, const QList &shadows, const QList > &details); void PdfTiledFile(const QString &name); void ExportScene(const QList &scenes, const QList &papers, const QList &shadows, const QList > &details, bool ignorePrinterFields, const QMarginsF &margins) const; void ExportApparelLayout(const QVector &details, const QString &name, const QSize &size) const; void ExportDetailsAsApparelLayout(QVector listDetails); void ExportFlatLayout(const QList &scenes, const QList &papers, const QList &shadows, const QList > &details, bool ignorePrinterFields, const QMarginsF &margins); void ExportDetailsAsFlatLayout(const QVector &listDetails); void ShowLayoutError(const LayoutErrors &state); }; #endif // MAINWINDOWSNOGUI_H