Merge with feature
--HG-- branch : develop
This commit is contained in:
commit
0485489b22
|
@ -16,22 +16,19 @@ include(core/core.pri)
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/main.cpp \
|
$$PWD/main.cpp \
|
||||||
$$PWD/mainwindow.cpp \
|
$$PWD/mainwindow.cpp \
|
||||||
$$PWD/tablewindow.cpp \
|
|
||||||
$$PWD/stable.cpp \
|
$$PWD/stable.cpp \
|
||||||
$$PWD/version.cpp \
|
$$PWD/version.cpp \
|
||||||
$$PWD/options.cpp
|
$$PWD/options.cpp \
|
||||||
|
$$PWD/mainwindowsnogui.cpp
|
||||||
|
|
||||||
# Some header files
|
# Some header files
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/mainwindow.h \
|
$$PWD/mainwindow.h \
|
||||||
$$PWD/options.h \
|
$$PWD/options.h \
|
||||||
$$PWD/tablewindow.h \
|
|
||||||
$$PWD/stable.h \
|
$$PWD/stable.h \
|
||||||
$$PWD/version.h
|
$$PWD/version.h \
|
||||||
|
$$PWD/mainwindowsnogui.h
|
||||||
|
|
||||||
# Main forms
|
# Main forms
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/mainwindow.ui \
|
$$PWD/mainwindow.ui
|
||||||
$$PWD/tablewindow.ui
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2068,14 +2068,14 @@ VSettings *VApplication::getSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VMainGraphicsScene *VApplication::getCurrentScene() const
|
QGraphicsScene *VApplication::getCurrentScene() const
|
||||||
{
|
{
|
||||||
SCASSERT(currentScene != nullptr);
|
SCASSERT(currentScene != nullptr);
|
||||||
return currentScene;
|
return currentScene;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VApplication::setCurrentScene(VMainGraphicsScene *value)
|
void VApplication::setCurrentScene(QGraphicsScene *value)
|
||||||
{
|
{
|
||||||
currentScene = value;
|
currentScene = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
class VApplication;// used in define
|
class VApplication;// used in define
|
||||||
class QUndoStack;
|
class QUndoStack;
|
||||||
class VMainGraphicsView;
|
class VMainGraphicsView;
|
||||||
class VMainGraphicsScene;
|
|
||||||
class VPattern;
|
class VPattern;
|
||||||
class QFile;
|
class QFile;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
|
@ -110,8 +109,8 @@ public:
|
||||||
void OpenSettings();
|
void OpenSettings();
|
||||||
VSettings *getSettings();
|
VSettings *getSettings();
|
||||||
|
|
||||||
VMainGraphicsScene *getCurrentScene() const;
|
QGraphicsScene *getCurrentScene() const;
|
||||||
void setCurrentScene(VMainGraphicsScene *value);
|
void setCurrentScene(QGraphicsScene *value);
|
||||||
|
|
||||||
void setCurrentDocument(VPattern *doc);
|
void setCurrentDocument(VPattern *doc);
|
||||||
VPattern *getCurrentDocument()const;
|
VPattern *getCurrentDocument()const;
|
||||||
|
@ -151,7 +150,7 @@ private:
|
||||||
QMap<QString, qmu::QmuTranslation> stDescriptions;
|
QMap<QString, qmu::QmuTranslation> stDescriptions;
|
||||||
QUndoStack *undoStack;
|
QUndoStack *undoStack;
|
||||||
VMainGraphicsView *sceneView;
|
VMainGraphicsView *sceneView;
|
||||||
VMainGraphicsScene *currentScene;
|
QGraphicsScene *currentScene;
|
||||||
QTimer *autoSaveTimer;
|
QTimer *autoSaveTimer;
|
||||||
/**
|
/**
|
||||||
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
|
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
|
||||||
|
|
|
@ -117,7 +117,8 @@ void DialogAlongLine::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolAlongLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolAlongLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -225,7 +225,8 @@ void DialogArc::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||||
scene->addItem(path);
|
scene->addItem(path);
|
||||||
path->RefreshGeometry();
|
path->RefreshGeometry();
|
||||||
|
|
|
@ -126,7 +126,8 @@ void DialogBisector::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolBisector::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolBisector::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -166,7 +166,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
|
||||||
if (click)
|
if (click)
|
||||||
{
|
{
|
||||||
/*We will ignore click if poinet is in point circle*/
|
/*We will ignore click if poinet is in point circle*/
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||||
|
@ -258,7 +258,8 @@ void DialogCurveIntersectAxis::ShowVisualization()
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
//TODO move to parent class!
|
//TODO move to parent class!
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolCurveIntersectAxis::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolCurveIntersectAxis::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -92,7 +92,8 @@ void DialogCutArc::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||||
scene->addItem(path);
|
scene->addItem(path);
|
||||||
path->RefreshGeometry();
|
path->RefreshGeometry();
|
||||||
|
|
|
@ -196,7 +196,8 @@ void DialogCutSpline::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||||
scene->addItem(path);
|
scene->addItem(path);
|
||||||
path->RefreshGeometry();
|
path->RefreshGeometry();
|
||||||
|
|
|
@ -196,7 +196,8 @@ void DialogCutSplinePath::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||||
scene->addItem(path);
|
scene->addItem(path);
|
||||||
path->RefreshGeometry();
|
path->RefreshGeometry();
|
||||||
|
|
|
@ -261,7 +261,7 @@ void DialogEndLine::ShowDialog(bool click)
|
||||||
if (click)
|
if (click)
|
||||||
{
|
{
|
||||||
/*We will ignore click if poinet is in point circle*/
|
/*We will ignore click if poinet is in point circle*/
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||||
|
@ -287,7 +287,8 @@ void DialogEndLine::ShowVisualization()
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
//TODO move to parent class!
|
//TODO move to parent class!
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolEndLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolEndLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -254,7 +254,8 @@ void DialogHeight::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -145,7 +145,8 @@ void DialogLine::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -229,7 +229,8 @@ void DialogLineIntersect::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -187,7 +187,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
|
||||||
if (click)
|
if (click)
|
||||||
{
|
{
|
||||||
/*We will ignore click if poinet is in point circle*/
|
/*We will ignore click if poinet is in point circle*/
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||||
|
@ -322,7 +322,8 @@ void DialogLineIntersectAxis::ShowVisualization()
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
//TODO move to parent class!
|
//TODO move to parent class!
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolLineIntersectAxis::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolLineIntersectAxis::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -116,7 +116,8 @@ void DialogNormal::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -133,7 +133,8 @@ void DialogPointOfContact::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -161,7 +161,8 @@ void DialogPointOfIntersection::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,8 @@ void DialogShoulderPoint::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -185,7 +185,8 @@ void DialogSpline::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||||
scene->addItem(path);
|
scene->addItem(path);
|
||||||
path->RefreshGeometry();
|
path->RefreshGeometry();
|
||||||
|
|
|
@ -267,7 +267,8 @@ void DialogSplinePath::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visPath, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visPath, &Visualization::SetFactor);
|
||||||
scene->addItem(visPath);
|
scene->addItem(visPath);
|
||||||
visPath->setMode(Mode::Show);
|
visPath->setMode(Mode::Show);
|
||||||
|
|
|
@ -200,7 +200,8 @@ void DialogTriangle::ShowVisualization()
|
||||||
{
|
{
|
||||||
if (prepare == false)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
scene->addItem(line);
|
scene->addItem(line);
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "core/vapplication.h"
|
#include "core/vapplication.h"
|
||||||
#include "core/vsettings.h"
|
#include "core/vsettings.h"
|
||||||
#include "tablewindow.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
@ -118,9 +117,6 @@ int main(int argc, char *argv[])
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));
|
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));
|
||||||
app.setMainWindow(&w);
|
app.setMainWindow(&w);
|
||||||
TableWindow table;
|
|
||||||
QObject::connect(&w, &MainWindow::ModelChosen, &table, &TableWindow::ModelChosen);
|
|
||||||
QObject::connect(&table, &TableWindow::closed, &w, &MainWindow::tableClosed);
|
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription(QCoreApplication::translate("main", "Pattern making program."));
|
parser.setApplicationDescription(QCoreApplication::translate("main", "Pattern making program."));
|
||||||
|
|
|
@ -73,10 +73,10 @@ Q_LOGGING_CATEGORY(vMainWindow, "v.mainwindow")
|
||||||
* @param parent parent widget.
|
* @param parent parent widget.
|
||||||
*/
|
*/
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), currentTool(Tool::Arrow),
|
:MainWindowsNoGUI(parent), ui(new Ui::MainWindow), currentTool(Tool::Arrow),
|
||||||
lastUsedTool(Tool::Arrow), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr),
|
lastUsedTool(Tool::Arrow), sceneDraw(nullptr), sceneDetails(nullptr),
|
||||||
mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), dialogTable(nullptr), dialogTool(nullptr),
|
mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), dialogTable(nullptr), dialogTool(nullptr),
|
||||||
dialogHistory(nullptr), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0),
|
dialogHistory(nullptr), comboBoxDraws(nullptr), mode(Draw::Calculation), currentDrawIndex(0),
|
||||||
currentToolBoxIndex(0), drawMode(true), recentFileActs(),
|
currentToolBoxIndex(0), drawMode(true), recentFileActs(),
|
||||||
separatorAct(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr),
|
separatorAct(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr),
|
||||||
gradationSizes(nullptr),
|
gradationSizes(nullptr),
|
||||||
|
@ -95,33 +95,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
CreateMenus();
|
CreateMenus();
|
||||||
ToolBarDraws();
|
ToolBarDraws();
|
||||||
InitToolButtons();
|
InitToolButtons();
|
||||||
|
InitScenes();
|
||||||
sceneDraw = new VMainGraphicsScene();
|
|
||||||
currentScene = sceneDraw;
|
|
||||||
qApp->setCurrentScene(currentScene);
|
|
||||||
connect(this, &MainWindow::EnableItemMove, sceneDraw, &VMainGraphicsScene::EnableItemMove);
|
|
||||||
connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
|
||||||
sceneDetails = new VMainGraphicsScene();
|
|
||||||
connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
|
||||||
|
|
||||||
ui->view->setScene(currentScene);
|
|
||||||
|
|
||||||
sceneDraw->setTransform(ui->view->transform());
|
|
||||||
sceneDetails->setTransform(ui->view->transform());
|
|
||||||
|
|
||||||
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
|
||||||
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
||||||
policy.setHorizontalStretch(12);
|
|
||||||
ui->view->setSizePolicy(policy);
|
|
||||||
qApp->setSceneView(ui->view);
|
|
||||||
|
|
||||||
helpLabel = new QLabel(QObject::tr("Create new pattern piece to start working."));
|
helpLabel = new QLabel(QObject::tr("Create new pattern piece to start working."));
|
||||||
ui->statusBar->addWidget(helpLabel);
|
ui->statusBar->addWidget(helpLabel);
|
||||||
|
|
||||||
ToolBarTools();
|
ToolBarTools();
|
||||||
|
|
||||||
pattern = new VContainer();
|
|
||||||
|
|
||||||
doc = new VPattern(pattern, &mode, sceneDraw, sceneDetails);
|
doc = new VPattern(pattern, &mode, sceneDraw, sceneDetails);
|
||||||
connect(doc, &VPattern::ClearMainWindow, this, &MainWindow::Clear);
|
connect(doc, &VPattern::ClearMainWindow, this, &MainWindow::Clear);
|
||||||
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
|
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
|
||||||
|
@ -151,6 +131,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
ui->toolBarStages->setIconSize(QSize(24, 24));
|
ui->toolBarStages->setIconSize(QSize(24, 24));
|
||||||
ui->toolBarTools->setIconSize(QSize(24, 24));
|
ui->toolBarTools->setIconSize(QSize(24, 24));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &MainWindow::ShowPaper);
|
||||||
|
ui->dockWidgetLayoutPages->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -221,6 +204,29 @@ void MainWindow::AddPP(const QString &PPName, const QString &path)
|
||||||
ui->actionNewDraw->setEnabled(true);
|
ui->actionNewDraw->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::InitScenes()
|
||||||
|
{
|
||||||
|
sceneDraw = new VMainGraphicsScene();
|
||||||
|
currentScene = sceneDraw;
|
||||||
|
qApp->setCurrentScene(currentScene);
|
||||||
|
connect(this, &MainWindow::EnableItemMove, sceneDraw, &VMainGraphicsScene::EnableItemMove);
|
||||||
|
connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
||||||
|
sceneDetails = new VMainGraphicsScene();
|
||||||
|
connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
||||||
|
|
||||||
|
ui->view->setScene(currentScene);
|
||||||
|
|
||||||
|
sceneDraw->setTransform(ui->view->transform());
|
||||||
|
sceneDetails->setTransform(ui->view->transform());
|
||||||
|
|
||||||
|
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||||
|
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
policy.setHorizontalStretch(12);
|
||||||
|
ui->view->setSizePolicy(policy);
|
||||||
|
qApp->setSceneView(ui->view);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief OptionDraw help change name of pattern piece.
|
* @brief OptionDraw help change name of pattern piece.
|
||||||
|
@ -261,7 +267,11 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
||||||
helpLabel->setText(toolTip);
|
helpLabel->setText(toolTip);
|
||||||
ui->view->setShowToolOptions(false);
|
ui->view->setShowToolOptions(false);
|
||||||
dialogTool = new Dialog(pattern, 0, this);
|
dialogTool = new Dialog(pattern, 0, this);
|
||||||
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
|
|
||||||
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
|
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
|
||||||
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
||||||
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
||||||
ui->view->itemClicked(nullptr);
|
ui->view->itemClicked(nullptr);
|
||||||
|
@ -270,7 +280,6 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
||||||
{
|
{
|
||||||
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
||||||
{
|
{
|
||||||
SCASSERT(tButton != nullptr);
|
|
||||||
tButton->setChecked(true);
|
tButton->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +310,11 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
|
||||||
ui->view->setShowToolOptions(false);
|
ui->view->setShowToolOptions(false);
|
||||||
helpLabel->setText(toolTip);
|
helpLabel->setText(toolTip);
|
||||||
dialogTool = new Dialog(pattern, 0, this);
|
dialogTool = new Dialog(pattern, 0, this);
|
||||||
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
|
|
||||||
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
|
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
|
||||||
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
||||||
connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot);
|
connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot);
|
||||||
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
||||||
|
@ -312,7 +325,6 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
|
||||||
{
|
{
|
||||||
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
||||||
{
|
{
|
||||||
SCASSERT(tButton != nullptr);
|
|
||||||
tButton->setChecked(true);
|
tButton->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,7 +340,10 @@ void MainWindow::ClosedDialog(int result)
|
||||||
SCASSERT(dialogTool != nullptr);
|
SCASSERT(dialogTool != nullptr);
|
||||||
if (result == QDialog::Accepted)
|
if (result == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, currentScene, doc, pattern));
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
|
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, scene, doc, pattern));
|
||||||
ui->view->itemClicked(tool);
|
ui->view->itemClicked(tool);
|
||||||
}
|
}
|
||||||
ArrowTool();
|
ArrowTool();
|
||||||
|
@ -348,8 +363,11 @@ void MainWindow::ClosedDialogWithApply(int result)
|
||||||
// Only create tool if not already created with apply
|
// Only create tool if not already created with apply
|
||||||
if (dialogTool->GetAssociatedTool() == nullptr)
|
if (dialogTool->GetAssociatedTool() == nullptr)
|
||||||
{
|
{
|
||||||
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
dialogTool->SetAssociatedTool(
|
dialogTool->SetAssociatedTool(
|
||||||
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Or update associated tool with data
|
{ // Or update associated tool with data
|
||||||
|
@ -379,8 +397,11 @@ void MainWindow::ApplyDialog()
|
||||||
// Only create tool if not already created with apply
|
// Only create tool if not already created with apply
|
||||||
if (dialogTool->GetAssociatedTool() == nullptr)
|
if (dialogTool->GetAssociatedTool() == nullptr)
|
||||||
{
|
{
|
||||||
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
dialogTool->SetAssociatedTool(
|
dialogTool->SetAssociatedTool(
|
||||||
static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Or update associated tool with data
|
{ // Or update associated tool with data
|
||||||
|
@ -704,16 +725,6 @@ void MainWindow::ShowToolTip(const QString &toolTip)
|
||||||
helpLabel->setText(toolTip);
|
helpLabel->setText(toolTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief tableClosed handle after close layout window.
|
|
||||||
*/
|
|
||||||
void MainWindow::tableClosed()
|
|
||||||
{
|
|
||||||
ui->actionDetails->setChecked(true);
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::OpenRecentFile()
|
void MainWindow::OpenRecentFile()
|
||||||
{
|
{
|
||||||
|
@ -799,6 +810,33 @@ void MainWindow::customEvent(QEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::ClearLayout()
|
||||||
|
{
|
||||||
|
qDeleteAll (scenes);
|
||||||
|
scenes.clear();
|
||||||
|
shadows.clear();
|
||||||
|
papers.clear();
|
||||||
|
ui->listWidget->clear();
|
||||||
|
SetLayoutModeActions(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::PrepareSceneList()
|
||||||
|
{
|
||||||
|
for (int i=1; i<=scenes.size(); ++i)
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(ScenePreview(i-1), QString::number(i));
|
||||||
|
ui->listWidget->addItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not scenes.isEmpty())
|
||||||
|
{
|
||||||
|
ui->listWidget->setCurrentRow(0);
|
||||||
|
SetLayoutModeActions(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ToolBarOption enable option toolbar.
|
* @brief ToolBarOption enable option toolbar.
|
||||||
|
@ -951,6 +989,7 @@ void MainWindow::InitToolButtons()
|
||||||
connect(ui->toolButtonLineIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolLineIntersectAxis);
|
connect(ui->toolButtonLineIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolLineIntersectAxis);
|
||||||
connect(ui->toolButtonCurveIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
connect(ui->toolButtonCurveIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||||
connect(ui->toolButtonArcIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
connect(ui->toolButtonArcIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||||
|
connect(ui->toolButtonLayoutSettings, &QToolButton::clicked, this, &MainWindow::ToolLayoutSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1125,13 +1164,19 @@ void MainWindow::keyPressEvent ( QKeyEvent * event )
|
||||||
*/
|
*/
|
||||||
void MainWindow::SaveCurrentScene()
|
void MainWindow::SaveCurrentScene()
|
||||||
{
|
{
|
||||||
/*Save transform*/
|
if (mode == Draw::Calculation || mode == Draw::Modeling)
|
||||||
currentScene->setTransform(ui->view->transform());
|
{
|
||||||
/*Save scroll bars value for previous scene.*/
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
QScrollBar *horScrollBar = ui->view->horizontalScrollBar();
|
SCASSERT(scene != nullptr);
|
||||||
currentScene->setHorScrollBar(horScrollBar->value());
|
|
||||||
QScrollBar *verScrollBar = ui->view->verticalScrollBar();
|
/*Save transform*/
|
||||||
currentScene->setVerScrollBar(verScrollBar->value());
|
scene->setTransform(ui->view->transform());
|
||||||
|
/*Save scroll bars value for previous scene.*/
|
||||||
|
QScrollBar *horScrollBar = ui->view->horizontalScrollBar();
|
||||||
|
scene->setHorScrollBar(horScrollBar->value());
|
||||||
|
QScrollBar *verScrollBar = ui->view->verticalScrollBar();
|
||||||
|
scene->setVerScrollBar(verScrollBar->value());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1140,13 +1185,16 @@ void MainWindow::SaveCurrentScene()
|
||||||
*/
|
*/
|
||||||
void MainWindow::RestoreCurrentScene()
|
void MainWindow::RestoreCurrentScene()
|
||||||
{
|
{
|
||||||
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||||
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
/*Set transform for current scene*/
|
/*Set transform for current scene*/
|
||||||
ui->view->setTransform(currentScene->transform());
|
ui->view->setTransform(scene->transform());
|
||||||
/*Set value for current scene scroll bar.*/
|
/*Set value for current scene scroll bar.*/
|
||||||
QScrollBar *horScrollBar = ui->view->horizontalScrollBar();
|
QScrollBar *horScrollBar = ui->view->horizontalScrollBar();
|
||||||
horScrollBar->setValue(currentScene->getHorScrollBar());
|
horScrollBar->setValue(scene->getHorScrollBar());
|
||||||
QScrollBar *verScrollBar = ui->view->verticalScrollBar();
|
QScrollBar *verScrollBar = ui->view->verticalScrollBar();
|
||||||
verScrollBar->setValue(currentScene->getVerScrollBar());
|
verScrollBar->setValue(scene->getVerScrollBar());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1160,11 +1208,13 @@ void MainWindow::ActionDraw(bool checked)
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Show draw scene");
|
qCDebug(vMainWindow, "Show draw scene");
|
||||||
ui->actionDetails->setChecked(false);
|
ui->actionDetails->setChecked(false);
|
||||||
|
ui->actionLayout->setChecked(false);
|
||||||
SaveCurrentScene();
|
SaveCurrentScene();
|
||||||
|
|
||||||
currentScene = sceneDraw;
|
currentScene = sceneDraw;
|
||||||
ui->view->setScene(currentScene);
|
ui->view->setScene(currentScene);
|
||||||
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor,
|
||||||
|
Qt::UniqueConnection);
|
||||||
RestoreCurrentScene();
|
RestoreCurrentScene();
|
||||||
|
|
||||||
mode = Draw::Calculation;
|
mode = Draw::Calculation;
|
||||||
|
@ -1179,7 +1229,20 @@ void MainWindow::ActionDraw(bool checked)
|
||||||
ui->actionHistory->setEnabled(true);
|
ui->actionHistory->setEnabled(true);
|
||||||
ui->actionOptionDraw->setEnabled(true);
|
ui->actionOptionDraw->setEnabled(true);
|
||||||
ui->actionNewDraw->setEnabled(true);
|
ui->actionNewDraw->setEnabled(true);
|
||||||
|
ui->actionTable->setEnabled(true);
|
||||||
|
ui->actionArrowTool->setEnabled(true);
|
||||||
|
ui->actionShowCurveDetails->setEnabled(true);
|
||||||
|
actionDockWidgetToolOptions->setEnabled(true);
|
||||||
|
undoAction->setEnabled(true);
|
||||||
|
redoAction->setEnabled(true);
|
||||||
|
|
||||||
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
|
{
|
||||||
|
ui->toolBarOption->setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->dockWidgetLayoutPages->setVisible(false);
|
||||||
|
ui->dockWidgetToolOptions->setVisible(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1198,11 +1261,12 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Show details scene");
|
qCDebug(vMainWindow, "Show details scene");
|
||||||
ui->actionDraw->setChecked(false);
|
ui->actionDraw->setChecked(false);
|
||||||
|
ui->actionLayout->setChecked(false);
|
||||||
SaveCurrentScene();
|
SaveCurrentScene();
|
||||||
|
|
||||||
currentScene = sceneDetails;
|
currentScene = sceneDetails;
|
||||||
ui->view->itemClicked(nullptr);
|
ui->view->itemClicked(nullptr);
|
||||||
ui->view->setScene(sceneDetails);
|
ui->view->setScene(currentScene);
|
||||||
disconnect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
disconnect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||||
RestoreCurrentScene();
|
RestoreCurrentScene();
|
||||||
|
|
||||||
|
@ -1211,16 +1275,33 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
comboBoxDraws->setCurrentIndex(comboBoxDraws->count()-1);
|
comboBoxDraws->setCurrentIndex(comboBoxDraws->count()-1);
|
||||||
comboBoxDraws->setEnabled(false);
|
comboBoxDraws->setEnabled(false);
|
||||||
|
|
||||||
|
if (mode == Draw::Calculation)
|
||||||
|
{
|
||||||
|
currentToolBoxIndex = ui->toolBox->currentIndex();
|
||||||
|
}
|
||||||
mode = Draw::Modeling;
|
mode = Draw::Modeling;
|
||||||
SetEnableTool(true);
|
SetEnableTool(true);
|
||||||
currentToolBoxIndex = ui->toolBox->currentIndex();
|
|
||||||
ui->toolBox->setCurrentIndex(4);
|
ui->toolBox->setCurrentIndex(4);
|
||||||
|
|
||||||
ui->actionHistory->setEnabled(false);
|
ui->actionHistory->setEnabled(false);
|
||||||
ui->actionOptionDraw->setEnabled(false);
|
ui->actionOptionDraw->setEnabled(false);
|
||||||
ui->actionNewDraw->setEnabled(false);
|
ui->actionNewDraw->setEnabled(false);
|
||||||
|
ui->actionTable->setEnabled(false);
|
||||||
|
ui->actionArrowTool->setEnabled(true);
|
||||||
|
ui->actionShowCurveDetails->setEnabled(false);
|
||||||
|
actionDockWidgetToolOptions->setEnabled(true);
|
||||||
|
undoAction->setEnabled(true);
|
||||||
|
redoAction->setEnabled(true);
|
||||||
|
|
||||||
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
|
{
|
||||||
|
ui->toolBarOption->setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->dockWidgetLayoutPages->setVisible(false);
|
||||||
|
ui->dockWidgetToolOptions->setVisible(true);
|
||||||
|
|
||||||
|
helpLabel->setText("");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1228,6 +1309,81 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ActionLayout begin creation layout.
|
||||||
|
* @param checked true - button checked.
|
||||||
|
*/
|
||||||
|
void MainWindow::ActionLayout(bool checked)
|
||||||
|
{
|
||||||
|
if (checked)
|
||||||
|
{
|
||||||
|
qCDebug(vMainWindow, "Show layout scene");
|
||||||
|
ui->actionDraw->setChecked(false);
|
||||||
|
ui->actionDetails->setChecked(false);
|
||||||
|
SaveCurrentScene();
|
||||||
|
|
||||||
|
const QHash<quint32, VDetail> *details = pattern->DataDetails();
|
||||||
|
if (details->count() == 0)
|
||||||
|
{
|
||||||
|
Layout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrepareDetailsForLayout(details);
|
||||||
|
|
||||||
|
currentScene = tempSceneLayout;
|
||||||
|
ui->view->itemClicked(nullptr);
|
||||||
|
ui->view->setScene(currentScene);
|
||||||
|
disconnect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||||
|
|
||||||
|
drawMode = false;
|
||||||
|
currentDrawIndex = comboBoxDraws->currentIndex();//save current pattern peace
|
||||||
|
comboBoxDraws->setCurrentIndex(-1);
|
||||||
|
comboBoxDraws->setEnabled(false);
|
||||||
|
|
||||||
|
if (mode == Draw::Calculation)
|
||||||
|
{
|
||||||
|
currentToolBoxIndex = ui->toolBox->currentIndex();
|
||||||
|
}
|
||||||
|
mode = Draw::Layout;
|
||||||
|
SetEnableTool(true);
|
||||||
|
ui->toolBox->setCurrentIndex(5);
|
||||||
|
|
||||||
|
ui->actionHistory->setEnabled(false);
|
||||||
|
ui->actionOptionDraw->setEnabled(false);
|
||||||
|
ui->actionNewDraw->setEnabled(false);
|
||||||
|
ui->actionArrowTool->setEnabled(false);
|
||||||
|
ui->actionTable->setEnabled(false);
|
||||||
|
ui->actionShowCurveDetails->setEnabled(false);
|
||||||
|
actionDockWidgetToolOptions->setEnabled(false);
|
||||||
|
undoAction->setEnabled(false);
|
||||||
|
redoAction->setEnabled(false);
|
||||||
|
mouseCoordinate->setText("");
|
||||||
|
|
||||||
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
|
{
|
||||||
|
ui->toolBarOption->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->dockWidgetLayoutPages->setVisible(true);
|
||||||
|
ui->dockWidgetToolOptions->setVisible(false);
|
||||||
|
|
||||||
|
ShowPaper(ui->listWidget->currentRow());
|
||||||
|
|
||||||
|
if (scenes.isEmpty())
|
||||||
|
{
|
||||||
|
ui->toolButtonLayoutSettings->click();
|
||||||
|
}
|
||||||
|
|
||||||
|
helpLabel->setText("");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->actionLayout->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief SaveAs save as pattern file.
|
* @brief SaveAs save as pattern file.
|
||||||
|
@ -1644,16 +1800,19 @@ void MainWindow::ClickEndVisualization()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::Layout()
|
void MainWindow::Layout()
|
||||||
{
|
{
|
||||||
const QHash<quint32, VDetail> *details = pattern->DataDetails();
|
if (pattern->DataDetails()->size() > 0)
|
||||||
if (details->size() > 0)
|
|
||||||
{
|
{
|
||||||
ui->actionDetails->setEnabled(true);
|
ui->actionDetails->setEnabled(true);
|
||||||
ui->actionLayout->setEnabled(true);
|
ui->actionLayout->setEnabled(true);
|
||||||
|
SetLayoutModeActions(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
listDetails.clear();
|
||||||
ui->actionDetails->setEnabled(false);
|
ui->actionDetails->setEnabled(false);
|
||||||
ui->actionLayout->setEnabled(false);
|
ui->actionLayout->setEnabled(false);
|
||||||
|
ui->actionDraw->setChecked(true);
|
||||||
|
SetLayoutModeActions(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1813,6 +1972,7 @@ void MainWindow::PatternWasModified(bool saved)
|
||||||
{
|
{
|
||||||
setWindowModified(!saved);
|
setWindowModified(!saved);
|
||||||
ui->actionSave->setEnabled(!saved);
|
ui->actionSave->setEnabled(!saved);
|
||||||
|
isLayoutStale = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1898,41 +2058,6 @@ void MainWindow::ActionCurveDetailsMode(bool checked)
|
||||||
sceneDraw->EnableDetailsMode(checked);
|
sceneDraw->EnableDetailsMode(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief ActionLayout begin creation layout.
|
|
||||||
* @param checked true - button checked.
|
|
||||||
*/
|
|
||||||
void MainWindow::ActionLayout(bool checked)
|
|
||||||
{
|
|
||||||
Q_UNUSED(checked);
|
|
||||||
ActionDetails(true);//Get all list of details.
|
|
||||||
QVector<VLayoutDetail> listDetails;
|
|
||||||
const QHash<quint32, VDetail> *details = pattern->DataDetails();
|
|
||||||
if (details->count() == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
hide();//Now we can hide window
|
|
||||||
QHashIterator<quint32, VDetail> idetail(*details);
|
|
||||||
while (idetail.hasNext())
|
|
||||||
{
|
|
||||||
idetail.next();
|
|
||||||
VLayoutDetail det = VLayoutDetail();
|
|
||||||
det.SetCountourPoints(idetail.value().ContourPoints(pattern));
|
|
||||||
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern), idetail.value().getSeamAllowance());
|
|
||||||
det.setName(idetail.value().getName());
|
|
||||||
det.setWidth(qApp->toPixel(idetail.value().getWidth()));
|
|
||||||
|
|
||||||
listDetails.append(det);
|
|
||||||
}
|
|
||||||
QString description = doc->GetDescription();
|
|
||||||
|
|
||||||
QString fileName;
|
|
||||||
curFile.isEmpty() ? fileName = "unnamed" : fileName = curFile;
|
|
||||||
emit ModelChosen(listDetails, fileName, description);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ClosedActionHistory actions after closing history window with variables.
|
* @brief ClosedActionHistory actions after closing history window with variables.
|
||||||
|
@ -1952,14 +2077,23 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
{
|
{
|
||||||
bool drawTools = false;
|
bool drawTools = false;
|
||||||
bool modelingTools = false;
|
bool modelingTools = false;
|
||||||
if (mode == Draw::Calculation)
|
bool layoutTools = false;
|
||||||
|
|
||||||
|
switch (mode)
|
||||||
{
|
{
|
||||||
drawTools = enable;
|
case Draw::Calculation:
|
||||||
}
|
drawTools = enable;
|
||||||
else
|
break;
|
||||||
{
|
case Draw::Modeling:
|
||||||
modelingTools = enable;
|
modelingTools = enable;
|
||||||
|
break;
|
||||||
|
case Draw::Layout:
|
||||||
|
layoutTools = enable;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Drawing Tools
|
//Drawing Tools
|
||||||
ui->toolButtonEndLine->setEnabled(drawTools);
|
ui->toolButtonEndLine->setEnabled(drawTools);
|
||||||
ui->toolButtonLine->setEnabled(drawTools);
|
ui->toolButtonLine->setEnabled(drawTools);
|
||||||
|
@ -1987,6 +2121,26 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
|
|
||||||
//Modeling Tools
|
//Modeling Tools
|
||||||
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
||||||
|
|
||||||
|
//Layout tools
|
||||||
|
ui->toolButtonLayoutSettings->setEnabled(layoutTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::SetLayoutModeActions(bool enable)
|
||||||
|
{
|
||||||
|
bool value = enable;
|
||||||
|
if (scenes.isEmpty())
|
||||||
|
{
|
||||||
|
value = false;
|
||||||
|
}
|
||||||
|
ui->actionExportAs->setEnabled(value);
|
||||||
|
ui->actionPrintPreview->setEnabled(value);
|
||||||
|
ui->actionPrintPreviewTailed->setEnabled(value);
|
||||||
|
ui->actionSaveAsPDF->setEnabled(value);
|
||||||
|
ui->actionSaveAsTiledPDF->setEnabled(value);
|
||||||
|
ui->actionPrint->setEnabled(value);
|
||||||
|
ui->actionPrintTiled->setEnabled(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2126,6 +2280,8 @@ void MainWindow::ReadSettings()
|
||||||
*/
|
*/
|
||||||
void MainWindow::WriteSettings()
|
void MainWindow::WriteSettings()
|
||||||
{
|
{
|
||||||
|
ActionDraw(true);
|
||||||
|
|
||||||
qApp->getSettings()->SetGeometry(saveGeometry());
|
qApp->getSettings()->SetGeometry(saveGeometry());
|
||||||
qApp->getSettings()->SetWindowState(saveState());
|
qApp->getSettings()->SetWindowState(saveState());
|
||||||
qApp->getSettings()->SetToolbarsState(saveState(APP_VERSION));
|
qApp->getSettings()->SetToolbarsState(saveState(APP_VERSION));
|
||||||
|
@ -2191,13 +2347,13 @@ void MainWindow::CreateMenus()
|
||||||
UpdateRecentFileActions();
|
UpdateRecentFileActions();
|
||||||
|
|
||||||
//Add Undo/Redo actions.
|
//Add Undo/Redo actions.
|
||||||
QAction *undoAction = qApp->getUndoStack()->createUndoAction(this, tr("&Undo"));
|
undoAction = qApp->getUndoStack()->createUndoAction(this, tr("&Undo"));
|
||||||
undoAction->setShortcuts(QKeySequence::Undo);
|
undoAction->setShortcuts(QKeySequence::Undo);
|
||||||
undoAction->setIcon(QIcon::fromTheme("edit-undo"));
|
undoAction->setIcon(QIcon::fromTheme("edit-undo"));
|
||||||
ui->menuPatternPiece->insertAction(ui->actionLast_tool, undoAction);
|
ui->menuPatternPiece->insertAction(ui->actionLast_tool, undoAction);
|
||||||
ui->toolBarTools->addAction(undoAction);
|
ui->toolBarTools->addAction(undoAction);
|
||||||
|
|
||||||
QAction *redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo"));
|
redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo"));
|
||||||
redoAction->setShortcuts(QKeySequence::Redo);
|
redoAction->setShortcuts(QKeySequence::Redo);
|
||||||
redoAction->setIcon(QIcon::fromTheme("edit-redo"));
|
redoAction->setIcon(QIcon::fromTheme("edit-redo"));
|
||||||
ui->menuPatternPiece->insertAction(ui->actionLast_tool, redoAction);
|
ui->menuPatternPiece->insertAction(ui->actionLast_tool, redoAction);
|
||||||
|
@ -2208,7 +2364,8 @@ void MainWindow::CreateMenus()
|
||||||
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, separatorAct);
|
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, separatorAct);
|
||||||
|
|
||||||
//Add dock
|
//Add dock
|
||||||
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, ui->dockWidgetToolOptions->toggleViewAction());
|
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
|
||||||
|
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions);
|
||||||
|
|
||||||
separatorAct = new QAction(this);
|
separatorAct = new QAction(this);
|
||||||
separatorAct->setSeparator(true);
|
separatorAct->setSeparator(true);
|
||||||
|
@ -2387,6 +2544,14 @@ void MainWindow::CreateActions()
|
||||||
connect(ui->actionEdit_pattern_code, &QAction::triggered, this, &MainWindow::EditPatternCode);
|
connect(ui->actionEdit_pattern_code, &QAction::triggered, this, &MainWindow::EditPatternCode);
|
||||||
connect(ui->actionCloseWindow, &QAction::triggered, this, &MainWindow::ResetWindow);
|
connect(ui->actionCloseWindow, &QAction::triggered, this, &MainWindow::ResetWindow);
|
||||||
connect(ui->actionShowCurveDetails, &QAction::triggered, this, &MainWindow::ActionCurveDetailsMode);
|
connect(ui->actionShowCurveDetails, &QAction::triggered, this, &MainWindow::ActionCurveDetailsMode);
|
||||||
|
|
||||||
|
connect(ui->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
|
||||||
|
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
|
||||||
|
connect(ui->actionPrintPreviewTailed, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);
|
||||||
|
connect(ui->actionSaveAsPDF, &QAction::triggered, this, &MainWindow::SaveAsPDF);
|
||||||
|
connect(ui->actionSaveAsTiledPDF, &QAction::triggered, this, &MainWindow::SaveAsTiledPDF);
|
||||||
|
connect(ui->actionPrint, &QAction::triggered, this, &MainWindow::PrintOrigin);
|
||||||
|
connect(ui->actionPrintTiled, &QAction::triggered, this, &MainWindow::PrintTiled);
|
||||||
ui->actionEdit_pattern_code->setEnabled(false);
|
ui->actionEdit_pattern_code->setEnabled(false);
|
||||||
|
|
||||||
//Actions for recent files loaded by a main window application.
|
//Actions for recent files loaded by a main window application.
|
||||||
|
@ -2452,11 +2617,11 @@ QString MainWindow::PatternPieceName(const QString &text)
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
CancelTool();
|
CancelTool();
|
||||||
|
ClearLayout();
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||||
delete lock; // Unlock pattern file
|
delete lock; // Unlock pattern file
|
||||||
#endif
|
#endif
|
||||||
delete pattern;
|
|
||||||
delete doc;
|
delete doc;
|
||||||
delete sceneDetails;
|
delete sceneDetails;
|
||||||
delete sceneDraw;
|
delete sceneDraw;
|
||||||
|
@ -2644,6 +2809,23 @@ void MainWindow::ToolBarStyles()
|
||||||
ToolBarStyle(ui->mainToolBar);
|
ToolBarStyle(ui->mainToolBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::ShowPaper(int index)
|
||||||
|
{
|
||||||
|
if (index < 0 || index >= scenes.size())
|
||||||
|
{
|
||||||
|
ui->view->setScene(tempSceneLayout);
|
||||||
|
SetLayoutModeActions(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->view->setScene(scenes.at(index));
|
||||||
|
SetLayoutModeActions(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ToolBarStyle(QToolBar *bar)
|
void MainWindow::ToolBarStyle(QToolBar *bar)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,15 +29,12 @@
|
||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include "mainwindowsnogui.h"
|
||||||
#include "widgets/vmaingraphicsscene.h"
|
|
||||||
#include "widgets/vmaingraphicsview.h"
|
#include "widgets/vmaingraphicsview.h"
|
||||||
#include "dialogs/dialogs.h"
|
#include "dialogs/dialogs.h"
|
||||||
#include "tools/vtooldetail.h"
|
#include "tools/vtooldetail.h"
|
||||||
#include "tools/vtooluniondetails.h"
|
#include "tools/vtooluniondetails.h"
|
||||||
#include "tools/drawTools/drawtools.h"
|
#include "tools/drawTools/drawtools.h"
|
||||||
#include "xml/vdomdocument.h"
|
|
||||||
#include "../libs/vlayout/vlayoutdetail.h"
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -49,7 +46,7 @@ class VToolOptionsPropertyBrowser;
|
||||||
/**
|
/**
|
||||||
* @brief The MainWindow class main windows.
|
* @brief The MainWindow class main windows.
|
||||||
*/
|
*/
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public MainWindowsNoGUI
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -70,7 +67,6 @@ public slots:
|
||||||
void ActionCurveDetailsMode(bool checked);
|
void ActionCurveDetailsMode(bool checked);
|
||||||
void DrawOption();
|
void DrawOption();
|
||||||
|
|
||||||
void tableClosed();
|
|
||||||
void ClosedActionTable();
|
void ClosedActionTable();
|
||||||
void ClosedActionHistory();
|
void ClosedActionHistory();
|
||||||
|
|
||||||
|
@ -140,14 +136,9 @@ public slots:
|
||||||
void GlobalChangePP(const QString &patternPiece);
|
void GlobalChangePP(const QString &patternPiece);
|
||||||
void WindowsLocale();
|
void WindowsLocale();
|
||||||
void ToolBarStyles();
|
void ToolBarStyles();
|
||||||
|
|
||||||
|
void ShowPaper(int index);
|
||||||
signals:
|
signals:
|
||||||
/**
|
|
||||||
* @brief ModelChosen emit after calculation all details.
|
|
||||||
* @param listDetails list of details.
|
|
||||||
* @param description pattern description.
|
|
||||||
*/
|
|
||||||
void ModelChosen(QVector<VLayoutDetail> listDetails, const QString &curFile,
|
|
||||||
const QString &description);
|
|
||||||
void RefreshHistory();
|
void RefreshHistory();
|
||||||
void EnableItemMove(bool move);
|
void EnableItemMove(bool move);
|
||||||
protected:
|
protected:
|
||||||
|
@ -155,16 +146,15 @@ protected:
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
virtual void closeEvent(QCloseEvent *event);
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
virtual void customEvent(QEvent * event);
|
virtual void customEvent(QEvent * event);
|
||||||
|
|
||||||
|
virtual void ClearLayout();
|
||||||
|
virtual void PrepareSceneList();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(MainWindow)
|
Q_DISABLE_COPY(MainWindow)
|
||||||
/** @brief ui keeps information about user interface */
|
/** @brief ui keeps information about user interface */
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
||||||
/** @brief pattern container with data (points, arcs, splines, spline paths, variables) */
|
|
||||||
VContainer *pattern;
|
|
||||||
|
|
||||||
/** @brief doc dom document container */
|
|
||||||
VPattern *doc;
|
|
||||||
|
|
||||||
/** @brief tool current tool */
|
/** @brief tool current tool */
|
||||||
Tool currentTool;
|
Tool currentTool;
|
||||||
|
@ -172,9 +162,6 @@ private:
|
||||||
/** @brief tool last used tool */
|
/** @brief tool last used tool */
|
||||||
Tool lastUsedTool;
|
Tool lastUsedTool;
|
||||||
|
|
||||||
/** @brief currentScene pointer to current scene. */
|
|
||||||
VMainGraphicsScene *currentScene;
|
|
||||||
|
|
||||||
/** @brief sceneDraw draw scene. */
|
/** @brief sceneDraw draw scene. */
|
||||||
VMainGraphicsScene *sceneDraw;
|
VMainGraphicsScene *sceneDraw;
|
||||||
|
|
||||||
|
@ -197,9 +184,6 @@ private:
|
||||||
/** @brief comboBoxDraws comboc who show name of pattern peaces. */
|
/** @brief comboBoxDraws comboc who show name of pattern peaces. */
|
||||||
QComboBox *comboBoxDraws;
|
QComboBox *comboBoxDraws;
|
||||||
|
|
||||||
/** @brief fileName name current pattern file. */
|
|
||||||
QString curFile;
|
|
||||||
|
|
||||||
/** @brief mode keep current draw mode. */
|
/** @brief mode keep current draw mode. */
|
||||||
Draw mode;
|
Draw mode;
|
||||||
|
|
||||||
|
@ -232,6 +216,7 @@ private:
|
||||||
|
|
||||||
void SetEnableWidgets(bool enable);
|
void SetEnableWidgets(bool enable);
|
||||||
void SetEnableTool(bool enable);
|
void SetEnableTool(bool enable);
|
||||||
|
void SetLayoutModeActions(bool enable);
|
||||||
|
|
||||||
void SaveCurrentScene();
|
void SaveCurrentScene();
|
||||||
void RestoreCurrentScene();
|
void RestoreCurrentScene();
|
||||||
|
@ -284,6 +269,8 @@ private:
|
||||||
void ToolBarStyle(QToolBar *bar);
|
void ToolBarStyle(QToolBar *bar);
|
||||||
|
|
||||||
void AddPP(const QString &PPName, const QString &path);
|
void AddPP(const QString &PPName, const QString &path);
|
||||||
|
|
||||||
|
void InitScenes();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolBox" name="toolBox">
|
<widget class="QToolBox" name="toolBox">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
<horstretch>2</horstretch>
|
<horstretch>2</horstretch>
|
||||||
|
@ -685,6 +688,9 @@
|
||||||
<layout class="QFormLayout" name="formLayout_5">
|
<layout class="QFormLayout" name="formLayout_5">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QToolButton" name="toolButtonNewDetail">
|
<widget class="QToolButton" name="toolButtonNewDetail">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Seam allowance tool</string>
|
<string>Seam allowance tool</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -734,6 +740,45 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="page_6">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>105</width>
|
||||||
|
<height>380</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<attribute name="label">
|
||||||
|
<string>Layout</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QFormLayout" name="formLayout_6">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QToolButton" name="toolButtonLayoutSettings">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="emblem-system">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -770,11 +815,27 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&File</string>
|
<string>&File</string>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menuLayout">
|
||||||
|
<property name="title">
|
||||||
|
<string>Layout</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionSaveAsPDF"/>
|
||||||
|
<addaction name="actionPrintPreview"/>
|
||||||
|
<addaction name="actionPrint"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionSaveAsTiledPDF"/>
|
||||||
|
<addaction name="actionPrintPreviewTailed"/>
|
||||||
|
<addaction name="actionPrintTiled"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionExportAs"/>
|
||||||
|
</widget>
|
||||||
<addaction name="actionNew"/>
|
<addaction name="actionNew"/>
|
||||||
<addaction name="actionOpen"/>
|
<addaction name="actionOpen"/>
|
||||||
<addaction name="actionSave"/>
|
<addaction name="actionSave"/>
|
||||||
<addaction name="actionSaveAs"/>
|
<addaction name="actionSaveAs"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="menuLayout"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="actionPreferences"/>
|
<addaction name="actionPreferences"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionExit"/>
|
<addaction name="actionExit"/>
|
||||||
|
@ -990,6 +1051,67 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<addaction name="actionArrowTool"/>
|
<addaction name="actionArrowTool"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QDockWidget" name="dockWidgetLayoutPages">
|
||||||
|
<property name="features">
|
||||||
|
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||||
|
</property>
|
||||||
|
<property name="allowedAreas">
|
||||||
|
<set>Qt::RightDockWidgetArea</set>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Layout pages</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>2</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="tabKeyNavigation">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="showDropIndicator" stdset="0">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="movement">
|
||||||
|
<enum>QListView::Static</enum>
|
||||||
|
</property>
|
||||||
|
<property name="flow">
|
||||||
|
<enum>QListView::TopToBottom</enum>
|
||||||
|
</property>
|
||||||
|
<property name="resizeMode">
|
||||||
|
<enum>QListView::Adjust</enum>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="viewMode">
|
||||||
|
<enum>QListView::IconMode</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
<action name="actionNew">
|
<action name="actionNew">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="document-new">
|
<iconset theme="document-new">
|
||||||
|
@ -1202,6 +1324,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionLayout">
|
<action name="actionLayout">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1375,6 +1500,9 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionLast_tool">
|
<action name="actionLast_tool">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Last Tool</string>
|
<string>Last Tool</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1402,6 +1530,115 @@
|
||||||
<string>F2</string>
|
<string>F2</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSaveAsPDF">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/pdf.png</normaloff>:/icon/32x32/pdf.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save as PDF</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Save original layout</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionSaveAsTiledPDF">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/pdf.png</normaloff>:/icon/32x32/pdf.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save as tiled PDF</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Split and save a layout into smaller pages</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPrint">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-print">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Print</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Print original a layout</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPrintTiled">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-print">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Print tiled</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Split and print a layout into smaller pages (for regular printers)</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPrintPreview">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-print-preview">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Print preview</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Print preview original layout</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPrintPreviewTailed">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="document-print-preview">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Print preview tailed</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Print preview tailed layout</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionExportAs">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/32x32/export_to_picture_document.png</normaloff>:/icon/32x32/export_to_picture_document.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Export As...</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Export original layout</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file tablewindow.cpp
|
** @file mainwindowsnogui.cpp
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
** @date November 15, 2013
|
** @date 12 5, 2015
|
||||||
**
|
**
|
||||||
** @brief
|
** @brief
|
||||||
** @copyright
|
** @copyright
|
||||||
** This source code is part of the Valentine project, a pattern making
|
** This source code is part of the Valentine project, a pattern making
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
** Copyright (C) 2013-2015 Valentina project
|
** Copyright (C) 2015 Valentina project
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
**
|
**
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
@ -26,11 +26,9 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "tablewindow.h"
|
#include "mainwindowsnogui.h"
|
||||||
#include "ui_tablewindow.h"
|
#include "../core/vapplication.h"
|
||||||
#include "widgets/vtablegraphicsview.h"
|
#include "../container/vcontainer.h"
|
||||||
#include "core/vapplication.h"
|
|
||||||
#include "core/vsettings.h"
|
|
||||||
#include "../../libs/vobj/vobjpaintdevice.h"
|
#include "../../libs/vobj/vobjpaintdevice.h"
|
||||||
#include "../dialogs/app/dialoglayoutsettings.h"
|
#include "../dialogs/app/dialoglayoutsettings.h"
|
||||||
#include "../../libs/vlayout/vlayoutgenerator.h"
|
#include "../../libs/vlayout/vlayoutgenerator.h"
|
||||||
|
@ -38,13 +36,16 @@
|
||||||
#include "../dialogs/app/dialogsavelayout.h"
|
#include "../dialogs/app/dialogsavelayout.h"
|
||||||
#include "../../libs/vlayout/vposter.h"
|
#include "../../libs/vlayout/vposter.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QToolButton>
|
||||||
#include <QtSvg>
|
#include <QtSvg>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QGraphicsScene>
|
|
||||||
#include <QPrintPreviewDialog>
|
#include <QPrintPreviewDialog>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
#include <QtPrintSupport>
|
|
||||||
#include <QtCore/qmath.h>
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# define PDFTOPS "pdftops.exe"
|
# define PDFTOPS "pdftops.exe"
|
||||||
|
@ -53,135 +54,91 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
||||||
* @brief TableWindow constructor.
|
: QMainWindow(parent), listDetails(QVector<VLayoutDetail>()), currentScene(nullptr), tempSceneLayout(nullptr),
|
||||||
* @param parent parent widget.
|
pattern(new VContainer()), doc(nullptr), papers(QList<QGraphicsItem *>()), shadows(QList<QGraphicsItem *>()),
|
||||||
*/
|
scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()), undoAction(nullptr),
|
||||||
TableWindow::TableWindow(QWidget *parent)
|
redoAction(nullptr), actionDockWidgetToolOptions(nullptr), curFile(QString()), isLayoutStale(true), isTiled(false)
|
||||||
:QMainWindow(parent), ui(new Ui::TableWindow),
|
|
||||||
listDetails(QVector<VLayoutDetail>()), papers(QList<QGraphicsItem *>()), shadows(QList<QGraphicsItem *>()),
|
|
||||||
scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()), fileName(QString()),
|
|
||||||
description(QString()), tempScene(nullptr)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
InitTempLayoutScene();
|
||||||
|
|
||||||
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
|
||||||
|
|
||||||
tempScene = new QGraphicsScene(QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm)));
|
|
||||||
QBrush brush;
|
|
||||||
brush.setStyle( Qt::SolidPattern );
|
|
||||||
brush.setColor( QColor( Qt::gray ) );
|
|
||||||
tempScene->setBackgroundBrush( brush );
|
|
||||||
|
|
||||||
ui->view->setScene(tempScene);
|
|
||||||
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
|
||||||
ui->horizontalLayout->addWidget(ui->view);
|
|
||||||
connect(ui->actionZoomIn, &QAction::triggered, ui->view, &VTableGraphicsView::ZoomIn);
|
|
||||||
connect(ui->actionZoomOut, &QAction::triggered, ui->view, &VTableGraphicsView::ZoomOut);
|
|
||||||
connect(ui->actionStop, &QAction::triggered, this, &TableWindow::StopTable);
|
|
||||||
connect(ui->actionSave, &QAction::triggered, this, &TableWindow::SaveLayout);
|
|
||||||
connect(ui->actionLayout, &QAction::triggered, this, &TableWindow::Layout);
|
|
||||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &TableWindow::ShowPaper);
|
|
||||||
connect(ui->actionPrint_pre_view, &QAction::triggered, this, &TableWindow::PrintPreview);
|
|
||||||
connect(ui->action_Print, &QAction::triggered, this, &TableWindow::LayoutPrint);
|
|
||||||
connect(ui->actionSave_to_p_df, &QAction::triggered, this, &TableWindow::PrintToPdf);
|
|
||||||
|
|
||||||
ReadSettings();
|
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
// On Mac deafault icon size is 32x32.
|
|
||||||
ui->toolBar->setIconSize(QSize(24, 24));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TableWindow::~TableWindow()
|
MainWindowsNoGUI::~MainWindowsNoGUI()
|
||||||
{
|
{
|
||||||
ClearLayout();
|
delete tempSceneLayout;
|
||||||
delete ui;
|
delete pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
void MainWindowsNoGUI::ToolLayoutSettings(bool checked)
|
||||||
* @brief ModelChosen show window when user want create new layout.
|
|
||||||
* @param listDetails list of details.
|
|
||||||
* @param description pattern description.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* Get details for creation layout.
|
|
||||||
*/
|
|
||||||
void TableWindow::ModelChosen(QVector<VLayoutDetail> listDetails, const QString &fileName, const QString &description)
|
|
||||||
{
|
{
|
||||||
this->description = description;
|
QToolButton *tButton = qobject_cast< QToolButton * >(this->sender());
|
||||||
|
SCASSERT(tButton != nullptr)
|
||||||
|
|
||||||
QString file;
|
if (checked)
|
||||||
if (fileName.isEmpty())
|
|
||||||
{
|
{
|
||||||
file = tr("untitled");
|
VLayoutGenerator lGenerator(this);
|
||||||
|
lGenerator.SetDetails(listDetails);
|
||||||
|
|
||||||
|
DialogLayoutSettings layout(&lGenerator, this);
|
||||||
|
if (layout.exec() == QDialog::Rejected)
|
||||||
|
{
|
||||||
|
tButton->setChecked(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DialogLayoutProgress progress(listDetails.count(), this);
|
||||||
|
|
||||||
|
connect(&lGenerator, &VLayoutGenerator::Start, &progress, &DialogLayoutProgress::Start);
|
||||||
|
connect(&lGenerator, &VLayoutGenerator::Arranged, &progress, &DialogLayoutProgress::Arranged);
|
||||||
|
connect(&lGenerator, &VLayoutGenerator::Error, &progress, &DialogLayoutProgress::Error);
|
||||||
|
connect(&lGenerator, &VLayoutGenerator::Finished, &progress, &DialogLayoutProgress::Finished);
|
||||||
|
connect(&progress, &DialogLayoutProgress::Abort, &lGenerator, &VLayoutGenerator::Abort);
|
||||||
|
|
||||||
|
lGenerator.Generate();
|
||||||
|
|
||||||
|
switch (lGenerator.State())
|
||||||
|
{
|
||||||
|
case LayoutErrors::NoError:
|
||||||
|
ClearLayout();
|
||||||
|
papers = lGenerator.GetPapersItems();// Blank sheets
|
||||||
|
details = lGenerator.GetAllDetails();// All details
|
||||||
|
CreateShadows();
|
||||||
|
CreateScenes();
|
||||||
|
PrepareSceneList();
|
||||||
|
isLayoutStale = false;
|
||||||
|
break;
|
||||||
|
case LayoutErrors::ProcessStoped:
|
||||||
|
break;
|
||||||
|
case LayoutErrors::PrepareLayoutError:
|
||||||
|
case LayoutErrors::PaperSizeError:
|
||||||
|
case LayoutErrors::EmptyPaperError:
|
||||||
|
ClearLayout();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tButton->setChecked(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
file = fileName;
|
tButton->setChecked(true);
|
||||||
}
|
}
|
||||||
QFileInfo fi( file );
|
|
||||||
this->fileName = fi.baseName();
|
|
||||||
|
|
||||||
this->listDetails = listDetails;
|
|
||||||
show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
void MainWindowsNoGUI::ExportLayoutAs()
|
||||||
* @brief closeEvent handle after close window.
|
|
||||||
* @param event close event.
|
|
||||||
*/
|
|
||||||
void TableWindow::closeEvent(QCloseEvent *event)
|
|
||||||
{
|
|
||||||
event->ignore();
|
|
||||||
StopTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief moveToCenter move screen to the center of window.
|
|
||||||
*/
|
|
||||||
void TableWindow::moveToCenter()
|
|
||||||
{
|
|
||||||
QRect rect = frameGeometry();
|
|
||||||
rect.moveCenter(QDesktopWidget().availableGeometry().center());
|
|
||||||
move(rect.topLeft());
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief showEvent handle after show window.
|
|
||||||
* @param event show event.
|
|
||||||
*/
|
|
||||||
void TableWindow::showEvent ( QShowEvent * event )
|
|
||||||
{
|
|
||||||
QMainWindow::showEvent(event);
|
|
||||||
moveToCenter();
|
|
||||||
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief StopTable stop creation layout.
|
|
||||||
*/
|
|
||||||
void TableWindow::StopTable()
|
|
||||||
{
|
|
||||||
hide();
|
|
||||||
ClearLayout();
|
|
||||||
emit closed();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief saveScene save created layout.
|
|
||||||
*/
|
|
||||||
void TableWindow::SaveLayout()
|
|
||||||
{
|
{
|
||||||
|
if (isLayoutStale)
|
||||||
|
{
|
||||||
|
if (ContinueIfLayoutStale() == QMessageBox::No)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
QMap<QString, QString> extByMessage = InitFormates();
|
QMap<QString, QString> extByMessage = InitFormates();
|
||||||
DialogSaveLayout dialog(extByMessage, scenes.size(), fileName, this);
|
DialogSaveLayout dialog(extByMessage, scenes.size(), FileName(), this);
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Rejected)
|
if (dialog.exec() == QDialog::Rejected)
|
||||||
{
|
{
|
||||||
|
@ -206,7 +163,7 @@ void TableWindow::SaveLayout()
|
||||||
scenes[i]->setBackgroundBrush( *brush );
|
scenes[i]->setBackgroundBrush( *brush );
|
||||||
shadows[i]->setVisible(false);
|
shadows[i]->setVisible(false);
|
||||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||||
QStringList suffix = QStringList() << "svg" << "png" << "pdf" << "eps" << "ps" << "obj";
|
const QStringList suffix = QStringList() << "svg" << "png" << "pdf" << "eps" << "ps" << "obj";
|
||||||
switch (suffix.indexOf(suf))
|
switch (suffix.indexOf(suf))
|
||||||
{
|
{
|
||||||
case 0: //svg
|
case 0: //svg
|
||||||
|
@ -246,55 +203,27 @@ void TableWindow::SaveLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::ShowPaper(int index)
|
void MainWindowsNoGUI::SaveAsPDF()
|
||||||
{
|
{
|
||||||
if (index < 0 || index > scenes.size())
|
if (not isPagesUniform())
|
||||||
{
|
{
|
||||||
ui->view->setScene(tempScene);
|
qCritical()<<tr("For saving multypage document all sheet should have the same size. Use export "
|
||||||
EnableActions(false);
|
"function instead.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
isTiled = false;
|
||||||
{
|
SaveLayoutAs();
|
||||||
ui->view->setScene(scenes.at(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::PrintPreview()
|
void MainWindowsNoGUI::SaveAsTiledPDF()
|
||||||
{
|
{
|
||||||
QPrinterInfo def = QPrinterInfo::defaultPrinter();
|
isTiled = true;
|
||||||
|
SaveLayoutAs();
|
||||||
//if there is no default printer set the print preview won't show
|
|
||||||
if(def.isNull() || def.printerName().isEmpty())
|
|
||||||
{
|
|
||||||
if(QPrinterInfo::availablePrinters().isEmpty())
|
|
||||||
{
|
|
||||||
QMessageBox::critical(this, tr("Print error"),
|
|
||||||
tr("Cannot proceed because there are no available printers in your system."),
|
|
||||||
QMessageBox::Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
def = QPrinterInfo::availablePrinters().first();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QPrinter printer(def, QPrinter::ScreenResolution);
|
|
||||||
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
|
|
||||||
printer.setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion());
|
|
||||||
printer.setDocName(fileName);
|
|
||||||
|
|
||||||
// display print preview dialog
|
|
||||||
QPrintPreviewDialog preview(&printer);
|
|
||||||
connect(&preview, &QPrintPreviewDialog::paintRequested, this, &TableWindow::Print);
|
|
||||||
preview.exec();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::Print(QPrinter *printer)
|
void MainWindowsNoGUI::PrintPages(QPrinter *printer)
|
||||||
{
|
{
|
||||||
if (printer == nullptr)
|
if (printer == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -303,11 +232,18 @@ void TableWindow::Print(QPrinter *printer)
|
||||||
|
|
||||||
const QVector<QImage> images = AllSheets();
|
const QVector<QImage> images = AllSheets();
|
||||||
|
|
||||||
VPoster posterazor(printer);
|
|
||||||
QVector<QImage> poster;
|
QVector<QImage> poster;
|
||||||
for (int i=0; i < images.size(); i++)
|
if (isTiled)
|
||||||
{
|
{
|
||||||
poster += posterazor.Generate(images.at(i), i+1, images.size());
|
VPoster posterazor(printer);
|
||||||
|
for (int i=0; i < images.size(); i++)
|
||||||
|
{
|
||||||
|
poster += posterazor.Generate(images.at(i), i+1, images.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
poster = images;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
@ -370,92 +306,180 @@ void TableWindow::Print(QPrinter *printer)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::LayoutPrint()
|
void MainWindowsNoGUI::PrintPreviewOrigin()
|
||||||
{
|
{
|
||||||
// display print dialog and if accepted print
|
if (not isPagesUniform())
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
|
||||||
printer.setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion());
|
|
||||||
printer.setDocName(fileName);
|
|
||||||
QPrintDialog dialog( &printer, this );
|
|
||||||
// If only user couldn't change page margins we could use method setMinMax();
|
|
||||||
dialog.setOption(QPrintDialog::PrintCurrentPage, false);
|
|
||||||
if ( dialog.exec() == QDialog::Accepted )
|
|
||||||
{
|
{
|
||||||
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
|
qCritical()<<tr("For previewing multypage document all sheet should have the same size.");
|
||||||
Print( &printer );
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isTiled = false;
|
||||||
|
PrintPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindowsNoGUI::PrintPreviewTiled()
|
||||||
|
{
|
||||||
|
isTiled = true;
|
||||||
|
PrintPreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindowsNoGUI::PrintOrigin()
|
||||||
|
{
|
||||||
|
if (not isPagesUniform())
|
||||||
|
{
|
||||||
|
qCritical()<<tr("For printing multypages document all sheet should have the same size.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isTiled = false;
|
||||||
|
LayoutPrint();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindowsNoGUI::PrintTiled()
|
||||||
|
{
|
||||||
|
isTiled = false;
|
||||||
|
LayoutPrint();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *details)
|
||||||
|
{
|
||||||
|
SCASSERT(details != nullptr)
|
||||||
|
if (details->count() == 0)
|
||||||
|
{
|
||||||
|
listDetails.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
listDetails.clear();
|
||||||
|
QHashIterator<quint32, VDetail> idetail(*details);
|
||||||
|
while (idetail.hasNext())
|
||||||
|
{
|
||||||
|
idetail.next();
|
||||||
|
VLayoutDetail det = VLayoutDetail();
|
||||||
|
det.SetCountourPoints(idetail.value().ContourPoints(pattern));
|
||||||
|
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern),
|
||||||
|
idetail.value().getSeamAllowance());
|
||||||
|
det.setName(idetail.value().getName());
|
||||||
|
det.setWidth(qApp->toPixel(idetail.value().getWidth()));
|
||||||
|
|
||||||
|
listDetails.append(det);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::PrintToPdf()
|
void MainWindowsNoGUI::InitTempLayoutScene()
|
||||||
{
|
{
|
||||||
QPrinter printer;
|
tempSceneLayout = new QGraphicsScene();
|
||||||
printer.setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion());
|
tempSceneLayout->setBackgroundBrush( QBrush(QColor(Qt::gray), Qt::SolidPattern) );
|
||||||
printer.setDocName(fileName);
|
}
|
||||||
|
|
||||||
QPageSetupDialog dialog(&printer, this);
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
if ( dialog.exec() == QDialog::Accepted )
|
QIcon MainWindowsNoGUI::ScenePreview(int i) const
|
||||||
|
{
|
||||||
|
QImage image;
|
||||||
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
|
if (paper)
|
||||||
{
|
{
|
||||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
const QRectF r = paper->rect();
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
// Create the image with the exact size of the shrunk scene
|
||||||
QDir::homePath()+"/"+this->fileName+".pdf",
|
image = QImage(QSize(static_cast<qint32>(r.width()), static_cast<qint32>(r.height())), QImage::Format_RGB32);
|
||||||
tr("PDF file (*.pdf)"));
|
|
||||||
if (not fileName.isEmpty())
|
|
||||||
{
|
|
||||||
if(QFileInfo(fileName).suffix().isEmpty())
|
|
||||||
{
|
|
||||||
fileName.append(".pdf");
|
|
||||||
}
|
|
||||||
|
|
||||||
printer.setOutputFileName(fileName);
|
if (not image.isNull())
|
||||||
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
|
{
|
||||||
Print( &printer );
|
image.fill(Qt::white);
|
||||||
|
QPainter painter(&image);
|
||||||
|
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||||
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
|
painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap,
|
||||||
|
Qt::RoundJoin));
|
||||||
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
|
scenes.at(i)->render(&painter);
|
||||||
|
painter.end();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning()<<"Cannot create image. Size too big";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
image = QImage(QSize(101, 146), QImage::Format_RGB32);
|
||||||
|
image.fill(Qt::white);
|
||||||
|
}
|
||||||
|
return QIcon(QBitmap::fromImage(image));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindowsNoGUI::CreateShadows()
|
||||||
|
{
|
||||||
|
for (int i=0; i< papers.size(); ++i)
|
||||||
|
{
|
||||||
|
qreal x1=0, y1=0, x2=0, y2=0;
|
||||||
|
QGraphicsRectItem *item = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
item->rect().getCoords(&x1, &y1, &x2, &y2);
|
||||||
|
QGraphicsRectItem *shadowPaper = new QGraphicsRectItem(QRectF(x1+4, y1+4, x2+4, y2+4));
|
||||||
|
shadowPaper->setBrush(QBrush(Qt::black));
|
||||||
|
shadows.append(shadowPaper);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shadows.append(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::Layout()
|
void MainWindowsNoGUI::CreateScenes()
|
||||||
{
|
{
|
||||||
VLayoutGenerator lGenerator(this);
|
for (int i=0; i<papers.size(); ++i)
|
||||||
lGenerator.SetDetails(listDetails);
|
|
||||||
|
|
||||||
DialogLayoutSettings layout(&lGenerator, this);
|
|
||||||
if (layout.exec() == QDialog::Rejected)
|
|
||||||
{
|
{
|
||||||
return;
|
QGraphicsScene *scene = new QGraphicsScene();
|
||||||
|
scene->setBackgroundBrush(QBrush(QColor(Qt::gray), Qt::SolidPattern));
|
||||||
|
scene->addItem(shadows.at(i));
|
||||||
|
scene->addItem(papers.at(i));
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> paperDetails = details.at(i);
|
||||||
|
for (int i=0; i < paperDetails.size(); ++i)
|
||||||
|
{
|
||||||
|
scene->addItem(paperDetails.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
scenes.append(scene);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DialogLayoutProgress progress(listDetails.count(), this);
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QMap<QString, QString> MainWindowsNoGUI::InitFormates() const
|
||||||
|
{
|
||||||
|
QMap<QString, QString> extByMessage;
|
||||||
|
extByMessage[ tr("Svg files (*.svg)") ] = ".svg";
|
||||||
|
extByMessage[ tr("PDF files (*.pdf)") ] = ".pdf";
|
||||||
|
extByMessage[ tr("Images (*.png)") ] = ".png";
|
||||||
|
extByMessage[ tr("Wavefront OBJ (*.obj)") ] = ".obj";
|
||||||
|
|
||||||
connect(&lGenerator, &VLayoutGenerator::Start, &progress, &DialogLayoutProgress::Start);
|
QProcess proc;
|
||||||
connect(&lGenerator, &VLayoutGenerator::Arranged, &progress, &DialogLayoutProgress::Arranged);
|
#if defined(Q_OS_WIN) || defined(Q_OS_OSX)
|
||||||
connect(&lGenerator, &VLayoutGenerator::Error, &progress, &DialogLayoutProgress::Error);
|
proc.start(qApp->applicationDirPath()+"/"+PDFTOPS); // Seek pdftops in app bundle or near valentin.exe
|
||||||
connect(&lGenerator, &VLayoutGenerator::Finished, &progress, &DialogLayoutProgress::Finished);
|
#else
|
||||||
connect(&progress, &DialogLayoutProgress::Abort, &lGenerator, &VLayoutGenerator::Abort);
|
proc.start(PDFTOPS); // Seek pdftops in standard path
|
||||||
|
#endif
|
||||||
lGenerator.Generate();
|
if (proc.waitForFinished(15000))
|
||||||
|
|
||||||
switch (lGenerator.State())
|
|
||||||
{
|
{
|
||||||
case LayoutErrors::NoError:
|
extByMessage[ tr("PS files (*.ps)") ] = ".ps";
|
||||||
ClearLayout();
|
extByMessage[ tr("EPS files (*.eps)") ] = ".eps";
|
||||||
papers = lGenerator.GetPapersItems();// Blank sheets
|
|
||||||
details = lGenerator.GetAllDetails();// All details
|
|
||||||
CreateShadows();
|
|
||||||
CreateScenes();
|
|
||||||
PrepareSceneList();
|
|
||||||
break;
|
|
||||||
case LayoutErrors::ProcessStoped:
|
|
||||||
break;
|
|
||||||
case LayoutErrors::PrepareLayoutError:
|
|
||||||
case LayoutErrors::PaperSizeError:
|
|
||||||
case LayoutErrors::EmptyPaperError:
|
|
||||||
ClearLayout();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug()<<PDFTOPS<<"error"<<proc.error()<<proc.errorString();
|
||||||
|
}
|
||||||
|
return extByMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -463,7 +487,7 @@ void TableWindow::Layout()
|
||||||
* @brief SvgFile save layout to svg file.
|
* @brief SvgFile save layout to svg file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void TableWindow::SvgFile(const QString &name, int i) const
|
void MainWindowsNoGUI::SvgFile(const QString &name, int i) const
|
||||||
{
|
{
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
if (paper)
|
if (paper)
|
||||||
|
@ -473,7 +497,7 @@ void TableWindow::SvgFile(const QString &name, int i) const
|
||||||
generator.setSize(paper->rect().size().toSize());
|
generator.setSize(paper->rect().size().toSize());
|
||||||
generator.setViewBox(paper->rect());
|
generator.setViewBox(paper->rect());
|
||||||
generator.setTitle("Valentina. Pattern layout");
|
generator.setTitle("Valentina. Pattern layout");
|
||||||
generator.setDescription(description);
|
generator.setDescription(doc->GetDescription());
|
||||||
generator.setResolution(static_cast<int>(qApp->PrintDPI));
|
generator.setResolution(static_cast<int>(qApp->PrintDPI));
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
painter.begin(&generator);
|
painter.begin(&generator);
|
||||||
|
@ -492,7 +516,7 @@ void TableWindow::SvgFile(const QString &name, int i) const
|
||||||
* @brief PngFile save layout to png file.
|
* @brief PngFile save layout to png file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void TableWindow::PngFile(const QString &name, int i) const
|
void MainWindowsNoGUI::PngFile(const QString &name, int i) const
|
||||||
{
|
{
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
if (paper)
|
if (paper)
|
||||||
|
@ -517,16 +541,27 @@ void TableWindow::PngFile(const QString &name, int i) const
|
||||||
* @brief PdfFile save layout to pdf file.
|
* @brief PdfFile save layout to pdf file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void TableWindow::PdfFile(const QString &name, int i) const
|
void MainWindowsNoGUI::PdfFile(const QString &name, int i) const
|
||||||
{
|
{
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
if (paper)
|
if (paper)
|
||||||
{
|
{
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
|
printer.setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion());
|
||||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
printer.setOutputFileName(name);
|
printer.setOutputFileName(name);
|
||||||
|
printer.setDocName(FileName());
|
||||||
const QRectF r = paper->rect();
|
const QRectF r = paper->rect();
|
||||||
printer.setResolution(static_cast<int>(qApp->PrintDPI));
|
printer.setResolution(static_cast<int>(qApp->PrintDPI));
|
||||||
|
// Set orientation
|
||||||
|
if (paper->rect().height()>= paper->rect().width())
|
||||||
|
{
|
||||||
|
printer.setOrientation(QPrinter::Portrait);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printer.setOrientation(QPrinter::Landscape);
|
||||||
|
}
|
||||||
printer.setPaperSize ( QSizeF(qApp->fromPixel(r.width(), Unit::Mm), qApp->fromPixel(r.height(), Unit::Mm)),
|
printer.setPaperSize ( QSizeF(qApp->fromPixel(r.width(), Unit::Mm), qApp->fromPixel(r.height(), Unit::Mm)),
|
||||||
QPrinter::Millimeter );
|
QPrinter::Millimeter );
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
@ -550,7 +585,7 @@ void TableWindow::PdfFile(const QString &name, int i) const
|
||||||
* @brief EpsFile save layout to eps file.
|
* @brief EpsFile save layout to eps file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void TableWindow::EpsFile(const QString &name, int i) const
|
void MainWindowsNoGUI::EpsFile(const QString &name, int i) const
|
||||||
{
|
{
|
||||||
QTemporaryFile tmp;
|
QTemporaryFile tmp;
|
||||||
if (tmp.open())
|
if (tmp.open())
|
||||||
|
@ -566,7 +601,7 @@ void TableWindow::EpsFile(const QString &name, int i) const
|
||||||
* @brief PsFile save layout to ps file.
|
* @brief PsFile save layout to ps file.
|
||||||
* @param name name layout file.
|
* @param name name layout file.
|
||||||
*/
|
*/
|
||||||
void TableWindow::PsFile(const QString &name, int i) const
|
void MainWindowsNoGUI::PsFile(const QString &name, int i) const
|
||||||
{
|
{
|
||||||
QTemporaryFile tmp;
|
QTemporaryFile tmp;
|
||||||
if (tmp.open())
|
if (tmp.open())
|
||||||
|
@ -583,7 +618,7 @@ void TableWindow::PsFile(const QString &name, int i) const
|
||||||
* @param params string with parameter for tool. Parameters have format: "-eps input_file out_file". Use -eps when
|
* @param params string with parameter for tool. Parameters have format: "-eps input_file out_file". Use -eps when
|
||||||
* need create eps file.
|
* need create eps file.
|
||||||
*/
|
*/
|
||||||
void TableWindow::PdfToPs(const QStringList ¶ms) const
|
void MainWindowsNoGUI::PdfToPs(const QStringList ¶ms) const
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
@ -605,7 +640,7 @@ void TableWindow::PdfToPs(const QStringList ¶ms) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::ObjFile(const QString &name, int i) const
|
void MainWindowsNoGUI::ObjFile(const QString &name, int i) const
|
||||||
{
|
{
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
if (paper)
|
if (paper)
|
||||||
|
@ -622,7 +657,7 @@ void TableWindow::ObjFile(const QString &name, int i) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QImage> TableWindow::AllSheets()
|
QVector<QImage> MainWindowsNoGUI::AllSheets()
|
||||||
{
|
{
|
||||||
QVector<QImage> images;
|
QVector<QImage> images;
|
||||||
for (int i=0; i < scenes.size(); ++i)
|
for (int i=0; i < scenes.size(); ++i)
|
||||||
|
@ -665,172 +700,174 @@ QVector<QImage> TableWindow::AllSheets()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::ClearLayout()
|
void MainWindowsNoGUI::SaveLayoutAs()
|
||||||
{
|
{
|
||||||
qDeleteAll (scenes);
|
if (isLayoutStale)
|
||||||
scenes.clear();
|
{
|
||||||
shadows.clear();
|
if (ContinueIfLayoutStale() == QMessageBox::No)
|
||||||
papers.clear();
|
{
|
||||||
ui->listWidget->clear();
|
return;
|
||||||
EnableActions(false);
|
}
|
||||||
|
}
|
||||||
|
QPrinter printer;
|
||||||
|
SetPrinterSettings(&printer);
|
||||||
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||||
|
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Print to pdf"),
|
||||||
|
qApp->getSettings()->GetPathLayout()+"/"+FileName()+".pdf",
|
||||||
|
tr("PDF file (*.pdf)"));
|
||||||
|
if (not fileName.isEmpty())
|
||||||
|
{
|
||||||
|
QFileInfo f( fileName );
|
||||||
|
if(f.suffix().isEmpty())
|
||||||
|
{
|
||||||
|
fileName.append(".pdf");
|
||||||
|
}
|
||||||
|
qApp->getSettings()->SetPathLayout(f.absolutePath());
|
||||||
|
|
||||||
|
printer.setOutputFileName(fileName);
|
||||||
|
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
|
||||||
|
PrintPages( &printer );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::CreateShadows()
|
void MainWindowsNoGUI::PrintPreview()
|
||||||
{
|
{
|
||||||
for (int i=0; i< papers.size(); ++i)
|
if (isLayoutStale)
|
||||||
{
|
{
|
||||||
qreal x1=0, y1=0, x2=0, y2=0;
|
if (ContinueIfLayoutStale() == QMessageBox::No)
|
||||||
QGraphicsRectItem *item = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
|
||||||
if (item)
|
|
||||||
{
|
{
|
||||||
item->rect().getCoords(&x1, &y1, &x2, &y2);
|
return;
|
||||||
QGraphicsRectItem *shadowPaper = new QGraphicsRectItem(QRectF(x1+4, y1+4, x2+4, y2+4));
|
}
|
||||||
shadowPaper->setBrush(QBrush(Qt::black));
|
}
|
||||||
shadows.append(shadowPaper);
|
QPrinterInfo def = QPrinterInfo::defaultPrinter();
|
||||||
|
|
||||||
|
//if there is no default printer set the print preview won't show
|
||||||
|
if(def.isNull() || def.printerName().isEmpty())
|
||||||
|
{
|
||||||
|
if(QPrinterInfo::availablePrinters().isEmpty())
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("Print error"),
|
||||||
|
tr("Cannot proceed because there are no available printers in your system."),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shadows.append(nullptr);
|
def = QPrinterInfo::availablePrinters().first();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPrinter printer(def, QPrinter::ScreenResolution);
|
||||||
|
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
|
||||||
|
SetPrinterSettings(&printer);
|
||||||
|
// display print preview dialog
|
||||||
|
QPrintPreviewDialog preview(&printer);
|
||||||
|
connect(&preview, &QPrintPreviewDialog::paintRequested, this, &MainWindowsNoGUI::PrintPages);
|
||||||
|
preview.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::CreateScenes()
|
void MainWindowsNoGUI::LayoutPrint()
|
||||||
{
|
{
|
||||||
QBrush brush;
|
if (isLayoutStale)
|
||||||
brush.setStyle( Qt::SolidPattern );
|
|
||||||
brush.setColor( QColor( Qt::gray ) );
|
|
||||||
|
|
||||||
for (int i=0; i<papers.size(); ++i)
|
|
||||||
{
|
{
|
||||||
QGraphicsScene *scene = new QGraphicsScene();
|
if (ContinueIfLayoutStale() == QMessageBox::No)
|
||||||
scene->setBackgroundBrush(brush);
|
|
||||||
scene->addItem(shadows.at(i));
|
|
||||||
scene->addItem(papers.at(i));
|
|
||||||
|
|
||||||
QList<QGraphicsItem *> paperDetails = details.at(i);
|
|
||||||
for (int i=0; i < paperDetails.size(); ++i)
|
|
||||||
{
|
{
|
||||||
scene->addItem(paperDetails.at(i));
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
scenes.append(scene);
|
// display print dialog and if accepted print
|
||||||
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
|
SetPrinterSettings(&printer);
|
||||||
|
QPrintDialog dialog( &printer, this );
|
||||||
|
// If only user couldn't change page margins we could use method setMinMax();
|
||||||
|
dialog.setOption(QPrintDialog::PrintCurrentPage, false);
|
||||||
|
if ( dialog.exec() == QDialog::Accepted )
|
||||||
|
{
|
||||||
|
printer.setResolution(static_cast<int>(VApplication::PrintDPI));
|
||||||
|
PrintPages( &printer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::PrepareSceneList()
|
void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer)
|
||||||
{
|
{
|
||||||
for (int i=1; i<=scenes.size(); ++i)
|
SCASSERT(printer != nullptr)
|
||||||
{
|
printer->setCreator(qApp->applicationDisplayName()+" "+qApp->applicationVersion());
|
||||||
QListWidgetItem *item = new QListWidgetItem(ScenePreview(i-1), QString::number(i));
|
|
||||||
ui->listWidget->addItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (not scenes.isEmpty())
|
// Set orientation
|
||||||
|
if (papers.size() > 0)
|
||||||
{
|
{
|
||||||
ui->listWidget->setCurrentRow(0);
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
||||||
EnableActions(true);
|
SCASSERT(paper != nullptr)
|
||||||
}
|
if (paper->rect().height()>= paper->rect().width())
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QIcon TableWindow::ScenePreview(int i) const
|
|
||||||
{
|
|
||||||
QImage image;
|
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
|
||||||
if (paper)
|
|
||||||
{
|
|
||||||
const QRectF r = paper->rect();
|
|
||||||
// Create the image with the exact size of the shrunk scene
|
|
||||||
image = QImage(QSize(static_cast<qint32>(r.width()), static_cast<qint32>(r.height())), QImage::Format_RGB32);
|
|
||||||
|
|
||||||
if (not image.isNull())
|
|
||||||
{
|
{
|
||||||
image.fill(Qt::white);
|
printer->setOrientation(QPrinter::Portrait);
|
||||||
QPainter painter(&image);
|
|
||||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
|
||||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
|
||||||
painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap,
|
|
||||||
Qt::RoundJoin));
|
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
|
||||||
scenes.at(i)->render(&painter);
|
|
||||||
painter.end();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning()<<"Cannot create image. Size too big";
|
printer->setOrientation(QPrinter::Landscape);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (not isTiled && papers.size() > 0)
|
||||||
{
|
{
|
||||||
image = QImage(QSize(101, 146), QImage::Format_RGB32);
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
||||||
image.fill(Qt::white);
|
SCASSERT(paper != nullptr)
|
||||||
|
printer->setPaperSize ( QSizeF(qApp->fromPixel(paper->rect().width(), Unit::Mm),
|
||||||
|
qApp->fromPixel(paper->rect().height(), Unit::Mm)), QPrinter::Millimeter );
|
||||||
}
|
}
|
||||||
return QIcon(QBitmap::fromImage(image));
|
|
||||||
|
printer->setDocName(FileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<QString, QString> TableWindow::InitFormates() const
|
bool MainWindowsNoGUI::isPagesUniform() const
|
||||||
{
|
{
|
||||||
QMap<QString, QString> extByMessage;
|
if (papers.size() < 2)
|
||||||
extByMessage[ tr("Svg files (*.svg)") ] = ".svg";
|
|
||||||
extByMessage[ tr("PDF files (*.pdf)") ] = ".pdf";
|
|
||||||
extByMessage[ tr("Images (*.png)") ] = ".png";
|
|
||||||
extByMessage[ tr("Wavefront OBJ (*.obj)") ] = ".obj";
|
|
||||||
|
|
||||||
QProcess proc;
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_OSX)
|
|
||||||
proc.start(qApp->applicationDirPath()+"/"+PDFTOPS); // Seek pdftops in app bundle or near valentin.exe
|
|
||||||
#else
|
|
||||||
proc.start(PDFTOPS); // Seek pdftops in standard path
|
|
||||||
#endif
|
|
||||||
if (proc.waitForFinished(15000))
|
|
||||||
{
|
{
|
||||||
extByMessage[ tr("PS files (*.ps)") ] = ".ps";
|
return true;
|
||||||
extByMessage[ tr("EPS files (*.eps)") ] = ".eps";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug()<<PDFTOPS<<"error"<<proc.error()<<proc.errorString();
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
|
||||||
|
SCASSERT(paper != nullptr)
|
||||||
|
for (int i=1; i < papers.size(); ++i)
|
||||||
|
{
|
||||||
|
QGraphicsRectItem *p = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(i));
|
||||||
|
SCASSERT(p != nullptr)
|
||||||
|
if (paper->rect() != p->rect())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return extByMessage;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::EnableActions(bool enable)
|
QString MainWindowsNoGUI::FileName() const
|
||||||
{
|
{
|
||||||
ui->actionSave->setEnabled(enable);
|
QString fileName;
|
||||||
ui->actionSave_to_p_df->setEnabled(enable);
|
curFile.isEmpty() ? fileName = tr("unnamed") : fileName = curFile;
|
||||||
ui->actionPrint_pre_view->setEnabled(enable);
|
return QFileInfo(fileName).baseName();
|
||||||
ui->action_Print->setEnabled(enable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::ToolBarStyle(QToolBar *bar)
|
int MainWindowsNoGUI::ContinueIfLayoutStale()
|
||||||
{
|
{
|
||||||
if (qApp->getSettings()->GetToolBarStyle())
|
QMessageBox msgBox(this);
|
||||||
{
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
msgBox.setWindowTitle(tr("The layout is stale."));
|
||||||
}
|
msgBox.setText(tr("The layout was not updated since last pattern modification. Do you want to continue?"));
|
||||||
else
|
msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
|
||||||
{
|
msgBox.setDefaultButton(QMessageBox::No);
|
||||||
bar->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
}
|
QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout());
|
||||||
}
|
SCASSERT(layout != nullptr);
|
||||||
|
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
msgBox.exec();
|
||||||
void TableWindow::ReadSettings()
|
return msgBox.result();
|
||||||
{
|
|
||||||
// Text under tool buton icon
|
|
||||||
ToolBarStyles();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TableWindow::ToolBarStyles()
|
|
||||||
{
|
|
||||||
ToolBarStyle(ui->toolBar);
|
|
||||||
ToolBarStyle(ui->toolBar_2);
|
|
||||||
}
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file tablewindow.h
|
** @file mainwindowsnogui.h
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
** @date November 15, 2013
|
** @date 12 5, 2015
|
||||||
**
|
**
|
||||||
** @brief
|
** @brief
|
||||||
** @copyright
|
** @copyright
|
||||||
** This source code is part of the Valentine project, a pattern making
|
** This source code is part of the Valentine project, a pattern making
|
||||||
** program, whose allow create and modeling patterns of clothing.
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
** Copyright (C) 2013-2015 Valentina project
|
** Copyright (C) 2015 Valentina project
|
||||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
**
|
**
|
||||||
** Valentina is free software: you can redistribute it and/or modify
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
@ -26,74 +26,80 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifndef TABLEWINDOW_H
|
#ifndef MAINWINDOWSNOGUI_H
|
||||||
#define TABLEWINDOW_H
|
#define MAINWINDOWSNOGUI_H
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
#include "../../libs/vlayout/vlayoutdetail.h"
|
#include "../geometry/vdetail.h"
|
||||||
#include "../../libs/vlayout/vbank.h"
|
#include "../libs/vlayout/vlayoutdetail.h"
|
||||||
|
#include "xml/vpattern.h"
|
||||||
namespace Ui
|
|
||||||
{
|
|
||||||
class TableWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
class QGraphicsRectItem;
|
|
||||||
class QPrinter;
|
class QPrinter;
|
||||||
|
|
||||||
/**
|
class MainWindowsNoGUI : public QMainWindow
|
||||||
* @brief TableWindow class layout window.
|
|
||||||
*/
|
|
||||||
class TableWindow : public QMainWindow
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TableWindow(QWidget *parent = nullptr);
|
MainWindowsNoGUI(QWidget *parent = nullptr);
|
||||||
~TableWindow();
|
virtual ~MainWindowsNoGUI();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ModelChosen(QVector<VLayoutDetail> listDetails, const QString &fileName, const QString &description);
|
void ToolLayoutSettings(bool checked);
|
||||||
void Layout();
|
void ExportLayoutAs();
|
||||||
void StopTable();
|
void SaveAsPDF();
|
||||||
void SaveLayout();
|
void SaveAsTiledPDF();
|
||||||
void ShowPaper(int index);
|
void PrintPages (QPrinter *printer);
|
||||||
void PrintPreview();
|
void PrintPreviewOrigin();
|
||||||
void Print (QPrinter *printer);
|
void PrintPreviewTiled();
|
||||||
void LayoutPrint();
|
void PrintOrigin();
|
||||||
void PrintToPdf();
|
void PrintTiled();
|
||||||
|
|
||||||
signals:
|
|
||||||
/** @brief closed emit if window is closing. */
|
|
||||||
void closed();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
|
||||||
void moveToCenter();
|
|
||||||
void showEvent ( QShowEvent * event );
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(TableWindow)
|
|
||||||
/** @brief ui keeps information about user interface */
|
|
||||||
Ui::TableWindow* ui;
|
|
||||||
|
|
||||||
/** @brief listDetails list of details. */
|
|
||||||
QVector<VLayoutDetail> listDetails;
|
QVector<VLayoutDetail> 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<QGraphicsItem *> papers;
|
QList<QGraphicsItem *> papers;
|
||||||
QList<QGraphicsItem *> shadows;
|
QList<QGraphicsItem *> shadows;
|
||||||
QList<QGraphicsScene *> scenes;
|
QList<QGraphicsScene *> scenes;
|
||||||
QList<QList<QGraphicsItem *> > details;
|
QList<QList<QGraphicsItem *> > details;
|
||||||
|
|
||||||
/** @brief fileName keep name of pattern file. */
|
QAction *undoAction;
|
||||||
QString fileName;
|
QAction *redoAction;
|
||||||
|
QAction *actionDockWidgetToolOptions;
|
||||||
|
|
||||||
/** @brief description pattern description */
|
/** @brief fileName name current pattern file. */
|
||||||
QString description;
|
QString curFile;
|
||||||
|
|
||||||
QGraphicsScene* tempScene;
|
bool isLayoutStale;
|
||||||
|
|
||||||
|
void PrepareDetailsForLayout(const QHash<quint32, VDetail> *details);
|
||||||
|
|
||||||
|
void InitTempLayoutScene();
|
||||||
|
virtual void ClearLayout()=0;
|
||||||
|
virtual void PrepareSceneList()=0;
|
||||||
|
QIcon ScenePreview(int i) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(MainWindowsNoGUI)
|
||||||
|
|
||||||
|
bool isTiled;
|
||||||
|
|
||||||
|
void CreateShadows();
|
||||||
|
void CreateScenes();
|
||||||
|
|
||||||
|
QMap<QString, QString> InitFormates() const;
|
||||||
|
|
||||||
void SvgFile(const QString &name, int i)const;
|
void SvgFile(const QString &name, int i)const;
|
||||||
void PngFile(const QString &name, int i)const;
|
void PngFile(const QString &name, int i)const;
|
||||||
|
@ -105,17 +111,16 @@ private:
|
||||||
|
|
||||||
QVector<QImage> AllSheets();
|
QVector<QImage> AllSheets();
|
||||||
|
|
||||||
void ClearLayout();
|
void SaveLayoutAs();
|
||||||
void CreateShadows();
|
void PrintPreview();
|
||||||
void CreateScenes();
|
void LayoutPrint();
|
||||||
void PrepareSceneList();
|
|
||||||
QIcon ScenePreview(int i) const;
|
|
||||||
QMap<QString, QString> InitFormates() const;
|
|
||||||
|
|
||||||
void EnableActions(bool enable);
|
void SetPrinterSettings(QPrinter *printer);
|
||||||
void ToolBarStyle(QToolBar *bar);
|
|
||||||
void ReadSettings();
|
bool isPagesUniform() const;
|
||||||
void ToolBarStyles();
|
QString FileName() const;
|
||||||
|
|
||||||
|
int ContinueIfLayoutStale();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TABLEWINDOW_H
|
#endif // MAINWINDOWSNOGUI_H
|
|
@ -60,5 +60,6 @@
|
||||||
<file>icon/16x16/fx.png</file>
|
<file>icon/16x16/fx.png</file>
|
||||||
<file>icon/16x16/roll.png</file>
|
<file>icon/16x16/roll.png</file>
|
||||||
<file>icon/16x16/progress.gif</file>
|
<file>icon/16x16/progress.gif</file>
|
||||||
|
<file>icon/32x32/export_to_picture_document.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -5,7 +5,7 @@ Inherits=gnome,hicolor
|
||||||
Example=x-directory-normal
|
Example=x-directory-normal
|
||||||
|
|
||||||
#Directories
|
#Directories
|
||||||
Directories=16x16/actions,24x24/actions,32x32/actions
|
Directories=16x16/actions,24x24/actions,32x32/actions,32x32/emblems
|
||||||
|
|
||||||
[16x16/actions]
|
[16x16/actions]
|
||||||
Size=16
|
Size=16
|
||||||
|
@ -22,4 +22,8 @@ Size=32
|
||||||
Context=Actions
|
Context=Actions
|
||||||
Type=Fixed
|
Type=Fixed
|
||||||
|
|
||||||
|
[32x32/emblemss]
|
||||||
|
Size=32
|
||||||
|
Context=Emblems
|
||||||
|
Type=Fixed
|
||||||
|
|
||||||
|
|
|
@ -67,5 +67,6 @@
|
||||||
<file alias="16x16/actions/document-print-preview.png">icons/win.icon.theme/16x16/actions/document-print-preview.png</file>
|
<file alias="16x16/actions/document-print-preview.png">icons/win.icon.theme/16x16/actions/document-print-preview.png</file>
|
||||||
<file alias="24x24/actions/document-print-preview.png">icons/win.icon.theme/24x24/actions/document-print-preview.png</file>
|
<file alias="24x24/actions/document-print-preview.png">icons/win.icon.theme/24x24/actions/document-print-preview.png</file>
|
||||||
<file alias="32x32/actions/document-print-preview.png">icons/win.icon.theme/32x32/actions/document-print-preview.png</file>
|
<file alias="32x32/actions/document-print-preview.png">icons/win.icon.theme/32x32/actions/document-print-preview.png</file>
|
||||||
|
<file alias="32x32/emblems/emblem-system.png">icons/win.icon.theme/32x32/emblems/emblem-system.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -1,328 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>TableWindow</class>
|
|
||||||
<widget class="QMainWindow" name="TableWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>1000</width>
|
|
||||||
<height>730</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Create a layout</string>
|
|
||||||
</property>
|
|
||||||
<property name="windowIcon">
|
|
||||||
<iconset resource="share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="locale">
|
|
||||||
<locale language="English" country="UnitedStates"/>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralwidget">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="VTableGraphicsView" name="view">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>20</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="resizeAnchor">
|
|
||||||
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolBar" name="toolBar">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Main toolbar</string>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>24</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>TopToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<addaction name="actionSave"/>
|
|
||||||
<addaction name="actionZoomIn"/>
|
|
||||||
<addaction name="actionZoomOut"/>
|
|
||||||
<addaction name="actionStop"/>
|
|
||||||
<addaction name="actionLayout"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
|
||||||
<widget class="QDockWidget" name="dockWidget">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>187</width>
|
|
||||||
<height>121</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>187</width>
|
|
||||||
<height>524287</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="features">
|
|
||||||
<set>QDockWidget::DockWidgetMovable</set>
|
|
||||||
</property>
|
|
||||||
<property name="allowedAreas">
|
|
||||||
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Layout pages</string>
|
|
||||||
</property>
|
|
||||||
<attribute name="dockWidgetArea">
|
|
||||||
<number>1</number>
|
|
||||||
</attribute>
|
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>150</width>
|
|
||||||
<height>200</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="movement">
|
|
||||||
<enum>QListView::Static</enum>
|
|
||||||
</property>
|
|
||||||
<property name="flow">
|
|
||||||
<enum>QListView::TopToBottom</enum>
|
|
||||||
</property>
|
|
||||||
<property name="isWrapping" stdset="0">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="resizeMode">
|
|
||||||
<enum>QListView::Adjust</enum>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<property name="viewMode">
|
|
||||||
<enum>QListView::IconMode</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenuBar" name="menuBar">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>1000</width>
|
|
||||||
<height>25</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<widget class="QMenu" name="menuFile">
|
|
||||||
<property name="title">
|
|
||||||
<string>File</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionSave"/>
|
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="actionPrint_pre_view"/>
|
|
||||||
<addaction name="action_Print"/>
|
|
||||||
<addaction name="actionSave_to_p_df"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="menuEdit">
|
|
||||||
<property name="title">
|
|
||||||
<string>Edit</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionZoomIn"/>
|
|
||||||
<addaction name="actionZoomOut"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenu" name="menuLayout">
|
|
||||||
<property name="title">
|
|
||||||
<string>Layout</string>
|
|
||||||
</property>
|
|
||||||
<addaction name="actionLayout"/>
|
|
||||||
</widget>
|
|
||||||
<addaction name="menuFile"/>
|
|
||||||
<addaction name="menuEdit"/>
|
|
||||||
<addaction name="menuLayout"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QToolBar" name="toolBar_2">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>10</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Toolbar print</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolButtonStyle">
|
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="toolBarArea">
|
|
||||||
<enum>TopToolBarArea</enum>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="toolBarBreak">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<addaction name="actionSave_to_p_df"/>
|
|
||||||
<addaction name="actionPrint_pre_view"/>
|
|
||||||
<addaction name="action_Print"/>
|
|
||||||
</widget>
|
|
||||||
<action name="actionSave">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="document-save-as">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Save As...</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Save layout</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+S</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionStop">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="process-stop">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Back</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Back to main window</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionZoomIn">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="zoom-in">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Zoom In</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Zoom In</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionZoomOut">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="zoom-out">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Zoom Out</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Zoom Out</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionLayout">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Create Layout</string>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Create Layout</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionPrint_pre_view">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="document-print-preview">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Print pre&view...</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="action_Print">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="document-print">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Print...</string>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+P</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionSave_to_p_df">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="share/resources/icon.qrc">
|
|
||||||
<normaloff>:/icon/32x32/pdf.png</normaloff>:/icon/32x32/pdf.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Print to p&df</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>VTableGraphicsView</class>
|
|
||||||
<extends>QGraphicsView</extends>
|
|
||||||
<header>vtablegraphicsview.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources>
|
|
||||||
<include location="share/resources/icon.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
|
@ -189,7 +189,8 @@ void VToolAlongLine::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolAlongLine *visual = new VisToolAlongLine(getData());
|
VisToolAlongLine *visual = new VisToolAlongLine(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,8 @@ void VToolArc::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolArc * visual = new VisToolArc(getData());
|
VisToolArc * visual = new VisToolArc(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -347,7 +347,8 @@ void VToolBisector::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolBisector * visual = new VisToolBisector(getData());
|
VisToolBisector * visual = new VisToolBisector(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,8 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolCurveIntersectAxis * visual = new VisToolCurveIntersectAxis(getData());
|
VisToolCurveIntersectAxis * visual = new VisToolCurveIntersectAxis(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,8 @@ void VToolCutArc::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolCutArc * visual = new VisToolCutArc(getData());
|
VisToolCutArc * visual = new VisToolCutArc(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,8 @@ void VToolCutSpline::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolCutSpline * visual = new VisToolCutSpline(getData());
|
VisToolCutSpline * visual = new VisToolCutSpline(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,8 @@ void VToolCutSplinePath::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolCutSplinePath *visual = new VisToolCutSplinePath(getData());
|
VisToolCutSplinePath *visual = new VisToolCutSplinePath(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,8 @@ void VToolEndLine::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolEndLine * visual = new VisToolEndLine(getData());
|
VisToolEndLine * visual = new VisToolEndLine(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,8 @@ void VToolHeight::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolHeight * visual = new VisToolHeight(getData());
|
VisToolHeight * visual = new VisToolHeight(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -428,7 +428,8 @@ void VToolLine::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolLine * visual = new VisToolLine(getData());
|
VisToolLine * visual = new VisToolLine(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,8 @@ void VToolLineIntersect::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolLineIntersect * visual = new VisToolLineIntersect(getData());
|
VisToolLineIntersect * visual = new VisToolLineIntersect(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,8 @@ void VToolLineIntersectAxis::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolLineIntersectAxis * visual = new VisToolLineIntersectAxis(getData());
|
VisToolLineIntersectAxis * visual = new VisToolLineIntersectAxis(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,8 @@ void VToolNormal::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolNormal * visual = new VisToolNormal(getData());
|
VisToolNormal * visual = new VisToolNormal(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,8 @@ void VToolPointOfContact::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolPointOfContact * visual = new VisToolPointOfContact(getData());
|
VisToolPointOfContact * visual = new VisToolPointOfContact(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,8 @@ void VToolPointOfIntersection::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolPointOfIntersection * visual = new VisToolPointOfIntersection(getData());
|
VisToolPointOfIntersection * visual = new VisToolPointOfIntersection(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -353,7 +353,8 @@ void VToolShoulderPoint::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolShoulderPoint * visual = new VisToolShoulderPoint(getData());
|
VisToolShoulderPoint * visual = new VisToolShoulderPoint(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,8 @@ void VToolSpline::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolSpline *visual = new VisToolSpline(getData(), this);
|
VisToolSpline *visual = new VisToolSpline(getData(), this);
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
|
|
||||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||||
|
|
|
@ -318,7 +318,8 @@ void VToolSplinePath::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolSplinePath *visual = new VisToolSplinePath(getData(), this);
|
VisToolSplinePath *visual = new VisToolSplinePath(getData(), this);
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
|
|
||||||
QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||||
|
|
|
@ -325,7 +325,8 @@ void VToolTriangle::ShowVisualization(bool show)
|
||||||
if (vis == nullptr)
|
if (vis == nullptr)
|
||||||
{
|
{
|
||||||
VisToolTriangle * visual = new VisToolTriangle(getData());
|
VisToolTriangle * visual = new VisToolTriangle(getData());
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
|
SCASSERT(scene != nullptr)
|
||||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||||
scene->addItem(visual);
|
scene->addItem(visual);
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ void Visualization::setScenePos(const QPointF &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void Visualization::VisualMode(const quint32 &pointId)
|
void Visualization::VisualMode(const quint32 &pointId)
|
||||||
{
|
{
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
this->point1Id = pointId;
|
this->point1Id = pointId;
|
||||||
|
|
|
@ -87,7 +87,7 @@ protected:
|
||||||
void AddItem(Item *item)
|
void AddItem(Item *item)
|
||||||
{
|
{
|
||||||
SCASSERT(item != nullptr);
|
SCASSERT(item != nullptr);
|
||||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
|
|
||||||
scene->addItem(item);
|
scene->addItem(item);
|
||||||
|
|
|
@ -1,255 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vtablegraphicsview.cpp
|
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @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) 2013-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/>.
|
|
||||||
**
|
|
||||||
*************************************************************************/
|
|
||||||
|
|
||||||
#include "vtablegraphicsview.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QGraphicsItem>
|
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QWheelEvent>
|
|
||||||
#include <QScrollBar>
|
|
||||||
#include "../options.h"
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
VTableGraphicsView::VTableGraphicsView(QWidget *parent)
|
|
||||||
:QGraphicsView(parent)
|
|
||||||
{
|
|
||||||
QGraphicsView::setResizeAnchor(QGraphicsView::AnchorUnderMouse);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief selectionChanged handle selection change.
|
|
||||||
*/
|
|
||||||
// cppcheck-suppress unusedFunction
|
|
||||||
void VTableGraphicsView::selectionChanged()
|
|
||||||
{
|
|
||||||
QList<QGraphicsItem *> listSelectedItems = scene()->selectedItems();
|
|
||||||
if ( listSelectedItems.isEmpty() == true )
|
|
||||||
{
|
|
||||||
qDebug() << tr("can't find detail");
|
|
||||||
emit itemChect(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug() << tr("detail found");
|
|
||||||
emit itemChect(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief MirrorItem mirror detail.
|
|
||||||
*/
|
|
||||||
// cppcheck-suppress unusedFunction
|
|
||||||
void VTableGraphicsView::MirrorItem()
|
|
||||||
{
|
|
||||||
QList<QGraphicsItem *> list = scene()->selectedItems();
|
|
||||||
if (list.size()>0)
|
|
||||||
{
|
|
||||||
for ( qint32 i = 0; i < list.count(); ++i )
|
|
||||||
{
|
|
||||||
QGraphicsItem *item = list.at(i);
|
|
||||||
SCASSERT(item != nullptr);
|
|
||||||
QRectF itemRectOld = item->sceneBoundingRect();
|
|
||||||
//Get the current transform
|
|
||||||
QTransform transform(item->transform());
|
|
||||||
|
|
||||||
qreal m11 = transform.m11(); // Horizontal scaling
|
|
||||||
qreal m12 = transform.m12(); // Vertical shearing
|
|
||||||
qreal m13 = transform.m13(); // Horizontal Projection
|
|
||||||
qreal m21 = transform.m21(); // Horizontal shearing
|
|
||||||
qreal m22 = transform.m22(); // vertical scaling
|
|
||||||
qreal m23 = transform.m23(); // Vertical Projection
|
|
||||||
qreal m31 = transform.m31(); // Horizontal Position (DX)
|
|
||||||
qreal m32 = transform.m32(); // Vertical Position (DY)
|
|
||||||
qreal m33 = transform.m33(); // Addtional Projection Factor
|
|
||||||
|
|
||||||
// Horizontal flip
|
|
||||||
m11 = -m11;
|
|
||||||
|
|
||||||
// Write back to the matrix
|
|
||||||
transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);
|
|
||||||
|
|
||||||
// Set the items transformation
|
|
||||||
item->setTransform(transform);
|
|
||||||
QRectF itemRectNew = item->sceneBoundingRect();
|
|
||||||
qreal dx, dy;
|
|
||||||
dx = itemRectOld.center().x()-itemRectNew.center().x();
|
|
||||||
dy = itemRectOld.center().y()-itemRectNew.center().y();
|
|
||||||
item->moveBy(dx, dy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief wheelEvent handle wheel events.
|
|
||||||
* @param event wheel event.
|
|
||||||
*/
|
|
||||||
// cppcheck-suppress unusedFunction
|
|
||||||
void VTableGraphicsView::wheelEvent(QWheelEvent *event)
|
|
||||||
{
|
|
||||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
|
|
||||||
{
|
|
||||||
// If was pressed button CTRL this code will execute
|
|
||||||
if ((event->delta())>0)
|
|
||||||
{
|
|
||||||
ZoomIn();
|
|
||||||
}
|
|
||||||
else if ((event->delta())<0)
|
|
||||||
{
|
|
||||||
ZoomOut();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->value()-event->delta());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief mousePressEvent handle mouse press events.
|
|
||||||
* @param mousePress mouse press event.
|
|
||||||
*/
|
|
||||||
void VTableGraphicsView::mousePressEvent(QMouseEvent *mousePress)
|
|
||||||
{
|
|
||||||
if (mousePress->button() & Qt::LeftButton)
|
|
||||||
{
|
|
||||||
switch (QGuiApplication::keyboardModifiers())
|
|
||||||
{
|
|
||||||
case Qt::ControlModifier:
|
|
||||||
QGraphicsView::setDragMode(QGraphicsView::ScrollHandDrag);
|
|
||||||
QGraphicsView::mousePressEvent(mousePress);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
QGraphicsView::mousePressEvent(mousePress);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief mouseReleaseEvent handle mouse release events.
|
|
||||||
* @param event mouse release event.
|
|
||||||
*/
|
|
||||||
void VTableGraphicsView::mouseReleaseEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
QGraphicsView::mouseReleaseEvent ( event );
|
|
||||||
QGraphicsView::setDragMode( QGraphicsView::RubberBandDrag );
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief keyPressEvent handle key press events.
|
|
||||||
* @param event key press event.
|
|
||||||
*/
|
|
||||||
void VTableGraphicsView::keyPressEvent(QKeyEvent *event)
|
|
||||||
{
|
|
||||||
switch (event->key())
|
|
||||||
{
|
|
||||||
case Qt::Key_Space:
|
|
||||||
rotateIt();
|
|
||||||
break;
|
|
||||||
case Qt::Key_Left:
|
|
||||||
MoveItem(VTableGraphicsView::Left);
|
|
||||||
break;
|
|
||||||
case Qt::Key_Right:
|
|
||||||
MoveItem(VTableGraphicsView::Right);
|
|
||||||
break;
|
|
||||||
case Qt::Key_Up:
|
|
||||||
MoveItem(VTableGraphicsView::Up);
|
|
||||||
break;
|
|
||||||
case Qt::Key_Down:
|
|
||||||
MoveItem(VTableGraphicsView::Down);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
QGraphicsView::keyPressEvent ( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief rotateIt rotate selected details on 180 degree.
|
|
||||||
*/
|
|
||||||
void VTableGraphicsView::rotateIt()
|
|
||||||
{
|
|
||||||
QList<QGraphicsItem *> list = scene()->selectedItems();
|
|
||||||
if (list.size()>0)
|
|
||||||
{
|
|
||||||
for ( qint32 i = 0; i < list.count(); ++i )
|
|
||||||
{
|
|
||||||
QGraphicsItem *item = list.at(i);
|
|
||||||
SCASSERT(item != nullptr);
|
|
||||||
item->setTransformOriginPoint(item->boundingRect().center());
|
|
||||||
item->setRotation(item->rotation() + 90);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief MoveItem move selected detail.
|
|
||||||
* @param move type of move.
|
|
||||||
*/
|
|
||||||
void VTableGraphicsView::MoveItem(VTableGraphicsView::typeMove_e move)
|
|
||||||
{
|
|
||||||
qreal dx = 0, dy = 0;
|
|
||||||
switch (move)
|
|
||||||
{
|
|
||||||
case VTableGraphicsView::Left:
|
|
||||||
dx = -3;
|
|
||||||
dy = 0;
|
|
||||||
break;
|
|
||||||
case VTableGraphicsView::Right:
|
|
||||||
dx = 3;
|
|
||||||
dy = 0;
|
|
||||||
break;
|
|
||||||
case VTableGraphicsView::Up:
|
|
||||||
dx = 0;
|
|
||||||
dy = -3;
|
|
||||||
break;
|
|
||||||
case VTableGraphicsView::Down:
|
|
||||||
dx = 0;
|
|
||||||
dy = 3;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
QList<QGraphicsItem *> listSelectedItems = scene()->selectedItems();
|
|
||||||
if (listSelectedItems.size()>0)
|
|
||||||
{
|
|
||||||
for ( qint32 i = 0; i < listSelectedItems.count(); ++i )
|
|
||||||
{
|
|
||||||
listSelectedItems.at(i)->moveBy(dx, dy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,95 +0,0 @@
|
||||||
/************************************************************************
|
|
||||||
**
|
|
||||||
** @file vtablegraphicsview.h
|
|
||||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
||||||
** @date November 15, 2013
|
|
||||||
**
|
|
||||||
** @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) 2013-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 VTABLEGRAPHICSVIEW_H
|
|
||||||
#define VTABLEGRAPHICSVIEW_H
|
|
||||||
|
|
||||||
#include <QGraphicsView>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The VTableGraphicsView class table layout view.
|
|
||||||
*/
|
|
||||||
class VTableGraphicsView : public QGraphicsView
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief The typeMove_e enum type items moves.
|
|
||||||
*/
|
|
||||||
enum typeMove_e { Left, Right, Up, Down };
|
|
||||||
|
|
||||||
VTableGraphicsView(QWidget *parent = nullptr);
|
|
||||||
signals:
|
|
||||||
/**
|
|
||||||
* @brief itemChect emit after change selection state detail.
|
|
||||||
* @param flag false - selected, true - don't selected.
|
|
||||||
*/
|
|
||||||
void itemChect( bool flag );
|
|
||||||
public slots:
|
|
||||||
void selectionChanged();
|
|
||||||
void rotateItems();
|
|
||||||
void MirrorItem();
|
|
||||||
void ZoomIn();
|
|
||||||
void ZoomOut();
|
|
||||||
protected:
|
|
||||||
void wheelEvent ( QWheelEvent * event );
|
|
||||||
void mousePressEvent(QMouseEvent *mousePress);
|
|
||||||
void mouseReleaseEvent ( QMouseEvent * event );
|
|
||||||
void keyPressEvent ( QKeyEvent * event );
|
|
||||||
void rotateIt();
|
|
||||||
void MoveItem( VTableGraphicsView::typeMove_e move );
|
|
||||||
};
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief rotateItems handle rotatation detail.
|
|
||||||
*/
|
|
||||||
inline void VTableGraphicsView::rotateItems()
|
|
||||||
{
|
|
||||||
rotateIt();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief ZoomIn zoom in paper scale.
|
|
||||||
*/
|
|
||||||
inline void VTableGraphicsView::ZoomIn()
|
|
||||||
{
|
|
||||||
scale(1.1, 1.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* @brief ZoomOut zoom out paper scale.
|
|
||||||
*/
|
|
||||||
inline void VTableGraphicsView::ZoomOut()
|
|
||||||
{
|
|
||||||
scale(1/1.1, 1/1.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // VTABLEGRAPHICSVIEW_H
|
|
|
@ -2,7 +2,6 @@
|
||||||
# This need for corect working file translations.pro
|
# This need for corect working file translations.pro
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/vtablegraphicsview.h \
|
|
||||||
$$PWD/vmaingraphicsview.h \
|
$$PWD/vmaingraphicsview.h \
|
||||||
$$PWD/vmaingraphicsscene.h \
|
$$PWD/vmaingraphicsscene.h \
|
||||||
$$PWD/doubledelegate.h \
|
$$PWD/doubledelegate.h \
|
||||||
|
@ -13,7 +12,6 @@ HEADERS += \
|
||||||
$$PWD/vwidgetpopup.h
|
$$PWD/vwidgetpopup.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/vtablegraphicsview.cpp \
|
|
||||||
$$PWD/vmaingraphicsview.cpp \
|
$$PWD/vmaingraphicsview.cpp \
|
||||||
$$PWD/vmaingraphicsscene.cpp \
|
$$PWD/vmaingraphicsscene.cpp \
|
||||||
$$PWD/doubledelegate.cpp \
|
$$PWD/doubledelegate.cpp \
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
enum class Draw : char { Calculation, Modeling };
|
enum class Draw : char { Calculation, Modeling, Layout };
|
||||||
enum class GOType : char { Point, Arc, Spline, SplinePath, Unknown };
|
enum class GOType : char { Point, Arc, Spline, SplinePath, Unknown };
|
||||||
enum class SplinePointPosition : char { FirstPoint, LastPoint };
|
enum class SplinePointPosition : char { FirstPoint, LastPoint };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user