First step to unite Layout and main windows.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-05-12 15:42:19 +03:00
parent 641e718a04
commit 3cb7e5a393
11 changed files with 350 additions and 114 deletions

View File

@ -19,7 +19,8 @@ SOURCES += \
$$PWD/tablewindow.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 += \
@ -27,7 +28,8 @@ HEADERS += \
$$PWD/options.h \ $$PWD/options.h \
$$PWD/tablewindow.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 += \

View File

@ -118,9 +118,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."));

View File

@ -73,8 +73,8 @@ 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), doc(nullptr), 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), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0),
currentToolBoxIndex(0), drawMode(true), recentFileActs(), currentToolBoxIndex(0), drawMode(true), recentFileActs(),
@ -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);
@ -221,6 +201,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.
@ -704,16 +707,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()
{ {
@ -1124,6 +1117,8 @@ void MainWindow::keyPressEvent ( QKeyEvent * event )
* @brief SaveCurrentScene save scene options before set another. * @brief SaveCurrentScene save scene options before set another.
*/ */
void MainWindow::SaveCurrentScene() void MainWindow::SaveCurrentScene()
{
if (mode == Draw::Calculation || mode == Draw::Modeling)
{ {
/*Save transform*/ /*Save transform*/
currentScene->setTransform(ui->view->transform()); currentScene->setTransform(ui->view->transform());
@ -1133,6 +1128,7 @@ void MainWindow::SaveCurrentScene()
QScrollBar *verScrollBar = ui->view->verticalScrollBar(); QScrollBar *verScrollBar = ui->view->verticalScrollBar();
currentScene->setVerScrollBar(verScrollBar->value()); currentScene->setVerScrollBar(verScrollBar->value());
} }
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -1160,11 +1156,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;
@ -1180,6 +1178,8 @@ void MainWindow::ActionDraw(bool checked)
ui->actionOptionDraw->setEnabled(true); ui->actionOptionDraw->setEnabled(true);
ui->actionNewDraw->setEnabled(true); ui->actionNewDraw->setEnabled(true);
ui->dockWidgetLayoutPages->setVisible(false);
ui->dockWidgetToolOptions->setVisible(true);
} }
else else
{ {
@ -1198,11 +1198,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 +1212,20 @@ 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->dockWidgetLayoutPages->setVisible(false);
ui->dockWidgetToolOptions->setVisible(true);
} }
else else
{ {
@ -1228,6 +1233,60 @@ 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->dockWidgetLayoutPages->setVisible(true);
ui->dockWidgetToolOptions->setVisible(false);
}
else
{
ui->actionLayout->setChecked(true);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief SaveAs save as pattern file. * @brief SaveAs save as pattern file.
@ -1644,16 +1703,17 @@ 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);
} }
else else
{ {
listDetails.clear();
ui->actionDetails->setEnabled(false); ui->actionDetails->setEnabled(false);
ui->actionLayout->setEnabled(false); ui->actionLayout->setEnabled(false);
ui->actionDraw->setChecked(true);
} }
} }
@ -1898,41 +1958,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 +1977,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)
{ {
case Draw::Calculation:
drawTools = enable; drawTools = enable;
} break;
else 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 +2021,9 @@ void MainWindow::SetEnableTool(bool enable)
//Modeling Tools //Modeling Tools
ui->toolButtonUnionDetails->setEnabled(modelingTools); ui->toolButtonUnionDetails->setEnabled(modelingTools);
//Layout tools
ui->toolButtonLayoutSettings->setEnabled(layoutTools);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -2456,7 +2493,6 @@ MainWindow::~MainWindow()
#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;

View File

@ -29,15 +29,14 @@
#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 "xml/vdomdocument.h"
#include "../libs/vlayout/vlayoutdetail.h"
namespace Ui namespace Ui
{ {
@ -49,7 +48,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 +69,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();
@ -141,13 +139,6 @@ public slots:
void WindowsLocale(); void WindowsLocale();
void ToolBarStyles(); void ToolBarStyles();
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:
@ -160,9 +151,6 @@ private:
/** @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 */ /** @brief doc dom document container */
VPattern *doc; VPattern *doc;
@ -172,9 +160,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;
@ -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

View File

@ -40,7 +40,7 @@
<string/> <string/>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>5</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<property name="geometry"> <property name="geometry">
@ -734,6 +734,32 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="page_6">
<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="text">
<string>Settings</string>
</property>
<property name="icon">
<iconset theme="emblem-system"/>
</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>
@ -990,6 +1016,40 @@
</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="iconSize">
<size>
<width>150</width>
<height>200</height>
</size>
</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 +1262,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>

View File

@ -0,0 +1,81 @@
/************************************************************************
**
** @file mainwindowsnogui.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 12 5, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "mainwindowsnogui.h"
#include "../core/vapplication.h"
#include "../container/vcontainer.h"
#include <QGraphicsScene>
//---------------------------------------------------------------------------------------------------------------------
MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
: QMainWindow(parent), listDetails(QVector<VLayoutDetail>()), currentScene(nullptr), tempSceneLayout(nullptr),
pattern(new VContainer())
{
InitTempLayoutScene();
}
//---------------------------------------------------------------------------------------------------------------------
MainWindowsNoGUI::~MainWindowsNoGUI()
{
delete tempSceneLayout;
delete pattern;
}
//---------------------------------------------------------------------------------------------------------------------
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 MainWindowsNoGUI::InitTempLayoutScene()
{
tempSceneLayout = new VMainGraphicsScene();
tempSceneLayout->setBackgroundBrush( QBrush(QColor(Qt::gray), Qt::SolidPattern) );
}

View File

@ -0,0 +1,65 @@
/************************************************************************
**
** @file mainwindowsnogui.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 12 5, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef MAINWINDOWSNOGUI_H
#define MAINWINDOWSNOGUI_H
#include <QMainWindow>
#include "../geometry/vdetail.h"
#include "../libs/vlayout/vlayoutdetail.h"
#include "../widgets/vmaingraphicsscene.h"
class MainWindowsNoGUI : public QMainWindow
{
Q_OBJECT
public:
MainWindowsNoGUI(QWidget *parent = nullptr);
virtual ~MainWindowsNoGUI();
protected:
QVector<VLayoutDetail> listDetails;
/** @brief currentScene pointer to current scene. */
VMainGraphicsScene *currentScene;
VMainGraphicsScene *tempSceneLayout;
/** @brief pattern container with data (points, arcs, splines, spline paths, variables) */
VContainer *pattern;
void PrepareDetailsForLayout(const QHash<quint32, VDetail> *details);
void InitTempLayoutScene();
private:
Q_DISABLE_COPY(MainWindowsNoGUI)
};
#endif // MAINWINDOWSNOGUI_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -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

View File

@ -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>

View File

@ -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 };