2015-05-12 14:42:19 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file mainwindowsnogui.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @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
|
|
|
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef MAINWINDOWSNOGUI_H
|
|
|
|
#define MAINWINDOWSNOGUI_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
2015-07-10 11:24:47 +02:00
|
|
|
#include "../vpatterndb/vdetail.h"
|
|
|
|
#include "../vlayout/vlayoutdetail.h"
|
2015-05-14 14:27:04 +02:00
|
|
|
#include "xml/vpattern.h"
|
2015-05-12 17:15:10 +02:00
|
|
|
|
|
|
|
class QGraphicsScene;
|
2015-05-14 14:27:04 +02:00
|
|
|
class QPrinter;
|
2015-05-12 14:42:19 +02:00
|
|
|
|
|
|
|
class MainWindowsNoGUI : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
MainWindowsNoGUI(QWidget *parent = nullptr);
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual ~MainWindowsNoGUI() Q_DECL_OVERRIDE;
|
2015-05-12 14:42:19 +02:00
|
|
|
|
2015-05-12 17:15:10 +02:00
|
|
|
public slots:
|
|
|
|
void ToolLayoutSettings(bool checked);
|
2015-05-14 14:27:04 +02:00
|
|
|
void ExportLayoutAs();
|
|
|
|
void SaveAsPDF();
|
|
|
|
void SaveAsTiledPDF();
|
|
|
|
void PrintPages (QPrinter *printer);
|
|
|
|
void PrintPreviewOrigin();
|
|
|
|
void PrintPreviewTiled();
|
|
|
|
void PrintOrigin();
|
|
|
|
void PrintTiled();
|
2015-05-12 17:15:10 +02:00
|
|
|
|
2015-05-12 14:42:19 +02:00
|
|
|
protected:
|
|
|
|
QVector<VLayoutDetail> listDetails;
|
|
|
|
|
|
|
|
/** @brief currentScene pointer to current scene. */
|
2015-05-12 17:15:10 +02:00
|
|
|
QGraphicsScene *currentScene;
|
2015-05-12 14:42:19 +02:00
|
|
|
|
2015-05-12 17:15:10 +02:00
|
|
|
QGraphicsScene *tempSceneLayout;
|
2015-05-12 14:42:19 +02:00
|
|
|
|
|
|
|
/** @brief pattern container with data (points, arcs, splines, spline paths, variables) */
|
|
|
|
VContainer *pattern;
|
|
|
|
|
2015-05-14 14:27:04 +02:00
|
|
|
/** @brief doc dom document container */
|
|
|
|
VPattern *doc;
|
|
|
|
|
2015-05-12 17:15:10 +02:00
|
|
|
QList<QGraphicsItem *> papers;
|
|
|
|
QList<QGraphicsItem *> shadows;
|
|
|
|
QList<QGraphicsScene *> scenes;
|
|
|
|
QList<QList<QGraphicsItem *> > details;
|
|
|
|
|
2015-05-13 12:23:57 +02:00
|
|
|
QAction *undoAction;
|
|
|
|
QAction *redoAction;
|
|
|
|
QAction *actionDockWidgetToolOptions;
|
|
|
|
|
2015-05-14 14:27:04 +02:00
|
|
|
/** @brief fileName name current pattern file. */
|
|
|
|
QString curFile;
|
|
|
|
|
|
|
|
bool isLayoutStale;
|
|
|
|
|
2015-05-12 14:42:19 +02:00
|
|
|
void PrepareDetailsForLayout(const QHash<quint32, VDetail> *details);
|
|
|
|
|
|
|
|
void InitTempLayoutScene();
|
2015-05-17 17:51:51 +02:00
|
|
|
virtual void CleanLayout()=0;
|
2015-05-12 17:15:10 +02:00
|
|
|
virtual void PrepareSceneList()=0;
|
|
|
|
QIcon ScenePreview(int i) const;
|
2015-05-12 14:42:19 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(MainWindowsNoGUI)
|
|
|
|
|
2015-05-14 14:27:04 +02:00
|
|
|
bool isTiled;
|
|
|
|
|
2015-05-12 17:15:10 +02:00
|
|
|
void CreateShadows();
|
|
|
|
void CreateScenes();
|
|
|
|
|
2015-05-14 14:27:04 +02:00
|
|
|
QMap<QString, QString> InitFormates() const;
|
|
|
|
|
|
|
|
void SvgFile(const QString &name, int i)const;
|
|
|
|
void PngFile(const QString &name, int i)const;
|
|
|
|
void PdfFile(const QString &name, int i)const;
|
|
|
|
void EpsFile(const QString &name, int i)const;
|
|
|
|
void PsFile(const QString &name, int i)const;
|
|
|
|
void PdfToPs(const QStringList ¶ms)const;
|
|
|
|
void ObjFile(const QString &name, int i)const;
|
|
|
|
|
|
|
|
QVector<QImage> AllSheets();
|
|
|
|
|
|
|
|
void SaveLayoutAs();
|
|
|
|
void PrintPreview();
|
|
|
|
void LayoutPrint();
|
|
|
|
|
|
|
|
void SetPrinterSettings(QPrinter *printer);
|
|
|
|
|
|
|
|
bool isPagesUniform() const;
|
|
|
|
QString FileName() const;
|
|
|
|
|
|
|
|
int ContinueIfLayoutStale();
|
2015-05-18 13:26:37 +02:00
|
|
|
|
|
|
|
void UnitePages();
|
|
|
|
QList<QGraphicsItem *> MoveDetails(qreal length, const QList<QGraphicsItem *> &details);
|
|
|
|
void UnitePapers(int j, QList<QGraphicsItem *> &nPapers, qreal width, qreal length);
|
|
|
|
void UniteDetails(int j, QList<QList<QGraphicsItem *> > &nDetails, qreal length, int i);
|
2015-05-12 14:42:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOWSNOGUI_H
|