Added list "Details in layout".
--HG-- branch : feature
This commit is contained in:
parent
93836ddf35
commit
1608599795
|
@ -18,7 +18,8 @@ HEADERS += \
|
||||||
$$PWD/dialoglayoutsettings.h \
|
$$PWD/dialoglayoutsettings.h \
|
||||||
$$PWD/dialoglayoutprogress.h \
|
$$PWD/dialoglayoutprogress.h \
|
||||||
$$PWD/dialogsavelayout.h \
|
$$PWD/dialogsavelayout.h \
|
||||||
$$PWD/vwidgetgroups.h
|
$$PWD/vwidgetgroups.h \
|
||||||
|
$$PWD/vwidgetdetails.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/dialogincrements.cpp \
|
$$PWD/dialogincrements.cpp \
|
||||||
|
@ -35,7 +36,8 @@ SOURCES += \
|
||||||
$$PWD/dialoglayoutsettings.cpp \
|
$$PWD/dialoglayoutsettings.cpp \
|
||||||
$$PWD/dialoglayoutprogress.cpp \
|
$$PWD/dialoglayoutprogress.cpp \
|
||||||
$$PWD/dialogsavelayout.cpp \
|
$$PWD/dialogsavelayout.cpp \
|
||||||
$$PWD/vwidgetgroups.cpp
|
$$PWD/vwidgetgroups.cpp \
|
||||||
|
$$PWD/vwidgetdetails.cpp
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
$$PWD/dialogincrements.ui \
|
$$PWD/dialogincrements.ui \
|
||||||
|
@ -47,4 +49,5 @@ FORMS += \
|
||||||
$$PWD/dialoglayoutsettings.ui \
|
$$PWD/dialoglayoutsettings.ui \
|
||||||
$$PWD/dialoglayoutprogress.ui \
|
$$PWD/dialoglayoutprogress.ui \
|
||||||
$$PWD/dialogsavelayout.ui \
|
$$PWD/dialogsavelayout.ui \
|
||||||
$$PWD/vwidgetgroups.ui
|
$$PWD/vwidgetgroups.ui \
|
||||||
|
$$PWD/vwidgetdetails.ui
|
||||||
|
|
125
src/app/valentina/dialogs/vwidgetdetails.cpp
Normal file
125
src/app/valentina/dialogs/vwidgetdetails.cpp
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vwidgetdetails.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 6, 2016
|
||||||
|
**
|
||||||
|
** @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) 2016 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 "vwidgetdetails.h"
|
||||||
|
#include "ui_vwidgetdetails.h"
|
||||||
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
#include "../vmisc/vabstractapplication.h"
|
||||||
|
#include "../vtools/undocommands/toggledetailinlayout.h"
|
||||||
|
|
||||||
|
#include <QUndoStack>
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VWidgetDetails::VWidgetDetails(VContainer *data, VAbstractPattern *doc, QWidget *parent)
|
||||||
|
: QWidget(parent),
|
||||||
|
ui(new Ui::VWidgetDetails),
|
||||||
|
m_doc(doc),
|
||||||
|
m_data(data)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
FillTable(m_data->DataDetails());
|
||||||
|
|
||||||
|
connect(ui->tableWidget, &QTableWidget::cellClicked, this, &VWidgetDetails::InLayoutStateChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VWidgetDetails::~VWidgetDetails()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VWidgetDetails::UpdateList()
|
||||||
|
{
|
||||||
|
FillTable(m_data->DataDetails());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
||||||
|
{
|
||||||
|
if (column != 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableWidgetItem *item = ui->tableWidget->item(row, column);
|
||||||
|
const quint32 id = item->data(Qt::UserRole).toUInt();
|
||||||
|
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
|
||||||
|
const bool inLayout = not allDetails->value(id).IsInLayout();
|
||||||
|
|
||||||
|
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, inLayout, m_data, m_doc);
|
||||||
|
connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree);
|
||||||
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VWidgetDetails::FillTable(const QHash<quint32, VDetail> *details)
|
||||||
|
{
|
||||||
|
const int selectedRow = ui->tableWidget->currentRow();
|
||||||
|
ui->tableWidget->clear();
|
||||||
|
|
||||||
|
ui->tableWidget->setColumnCount(2);
|
||||||
|
ui->tableWidget->setRowCount(details->size());
|
||||||
|
qint32 currentRow = -1;
|
||||||
|
auto i = details->constBegin();
|
||||||
|
while (i != details->constEnd())
|
||||||
|
{
|
||||||
|
++currentRow;
|
||||||
|
const VDetail det = i.value();
|
||||||
|
|
||||||
|
QTableWidgetItem *item = new QTableWidgetItem();
|
||||||
|
item->setTextAlignment(Qt::AlignHCenter);
|
||||||
|
if (det.IsInLayout())
|
||||||
|
{
|
||||||
|
item->setIcon(QIcon("://icon/16x16/allow_detail.png"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item->setIcon(QIcon("://icon/16x16/forbid_detail.png"));
|
||||||
|
}
|
||||||
|
item->setData(Qt::UserRole, i.key());
|
||||||
|
ui->tableWidget->setItem(currentRow, 0, item);
|
||||||
|
|
||||||
|
QString name = det.getName();
|
||||||
|
if (name.isEmpty())
|
||||||
|
{
|
||||||
|
name = tr("Unnamed");
|
||||||
|
}
|
||||||
|
|
||||||
|
item = new QTableWidgetItem(name);
|
||||||
|
item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
ui->tableWidget->setItem(currentRow, 1, item);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
ui->tableWidget->resizeColumnsToContents();
|
||||||
|
ui->tableWidget->resizeRowsToContents();
|
||||||
|
|
||||||
|
ui->tableWidget->setCurrentCell(selectedRow, 0);
|
||||||
|
}
|
66
src/app/valentina/dialogs/vwidgetdetails.h
Normal file
66
src/app/valentina/dialogs/vwidgetdetails.h
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vwidgetdetails.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 6, 2016
|
||||||
|
**
|
||||||
|
** @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) 2016 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 VWIDGETDETAILS_H
|
||||||
|
#define VWIDGETDETAILS_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class VAbstractPattern;
|
||||||
|
class VContainer;
|
||||||
|
class VDetail;
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class VWidgetDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
class VWidgetDetails : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit VWidgetDetails(VContainer *data, VAbstractPattern *doc, QWidget *parent = nullptr);
|
||||||
|
virtual ~VWidgetDetails();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void UpdateList();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void InLayoutStateChanged(int row, int column);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VWidgetDetails)
|
||||||
|
Ui::VWidgetDetails *ui;
|
||||||
|
VAbstractPattern *m_doc;
|
||||||
|
VContainer *m_data;
|
||||||
|
|
||||||
|
void FillTable(const QHash<quint32, VDetail> *details);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VWIDGETDETAILS_H
|
58
src/app/valentina/dialogs/vwidgetdetails.ui
Normal file
58
src/app/valentina/dialogs/vwidgetdetails.ui
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>VWidgetDetails</class>
|
||||||
|
<widget class="QWidget" name="VWidgetDetails">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTableWidget" name="tableWidget">
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sortingEnabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderMinimumSectionSize">
|
||||||
|
<number>16</number>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderHighlightSections">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderMinimumSectionSize">
|
||||||
|
<number>10</number>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -11,7 +11,11 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="../../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
@ -53,6 +57,8 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../../../libs/vmisc/share/resources/icon.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include "dialogs/dialogs.h"
|
#include "dialogs/dialogs.h"
|
||||||
#include "dialogs/vwidgetgroups.h"
|
#include "dialogs/vwidgetgroups.h"
|
||||||
#include "../vtools/undocommands/addgroup.h"
|
#include "../vtools/undocommands/addgroup.h"
|
||||||
|
#include "dialogs/vwidgetdetails.h"
|
||||||
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -122,6 +123,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
gradationHeights(nullptr), gradationSizes(nullptr), gradationHeightsLabel(nullptr), gradationSizesLabel(nullptr),
|
gradationHeights(nullptr), gradationSizes(nullptr), gradationHeightsLabel(nullptr), gradationSizesLabel(nullptr),
|
||||||
toolOptions(nullptr),
|
toolOptions(nullptr),
|
||||||
groupsWidget(nullptr),
|
groupsWidget(nullptr),
|
||||||
|
detailsWidget(nullptr),
|
||||||
lock(nullptr)
|
lock(nullptr)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MaxRecentFiles; ++i)
|
for (int i = 0; i < MaxRecentFiles; ++i)
|
||||||
|
@ -137,7 +139,12 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
|
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
|
||||||
connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile);
|
connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile);
|
||||||
connect(doc, &VPattern::SetEnabledGUI, this, &MainWindow::SetEnabledGUI);
|
connect(doc, &VPattern::SetEnabledGUI, this, &MainWindow::SetEnabledGUI);
|
||||||
connect(doc, &VPattern::CheckLayout, this, &MainWindow::Layout);
|
connect(doc, &VPattern::CheckLayout, [this](){
|
||||||
|
if (pattern->DataDetails()->count() == 0)
|
||||||
|
{
|
||||||
|
ActionDraw(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(doc, &VPattern::SetCurrentPP, this, &MainWindow::GlobalChangePP);
|
connect(doc, &VPattern::SetCurrentPP, this, &MainWindow::GlobalChangePP);
|
||||||
qApp->setCurrentDocument(doc);
|
qApp->setCurrentDocument(doc);
|
||||||
|
|
||||||
|
@ -1320,7 +1327,8 @@ void MainWindow::CleanLayout()
|
||||||
shadows.clear();
|
shadows.clear();
|
||||||
papers.clear();
|
papers.clear();
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
SetLayoutModeActions(false);
|
listDetails.clear();
|
||||||
|
SetLayoutModeActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1335,7 +1343,7 @@ void MainWindow::PrepareSceneList()
|
||||||
if (not scenes.isEmpty())
|
if (not scenes.isEmpty())
|
||||||
{
|
{
|
||||||
ui->listWidget->setCurrentRow(0);
|
ui->listWidget->setCurrentRow(0);
|
||||||
SetLayoutModeActions(true);
|
SetLayoutModeActions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2109,7 +2117,10 @@ void MainWindow::ActionDraw(bool checked)
|
||||||
|
|
||||||
ui->dockWidgetLayoutPages->setVisible(false);
|
ui->dockWidgetLayoutPages->setVisible(false);
|
||||||
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
|
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
|
||||||
|
|
||||||
|
ui->dockWidgetGroups->setWidget(groupsWidget);
|
||||||
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
|
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
|
||||||
|
ui->dockWidgetGroups->setToolTip(tr("Contains all visibility groups"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2149,11 +2160,13 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
QMessageBox::information(this, tr("Detail mode"), tr("You can't use now the Detail mode. "
|
QMessageBox::information(this, tr("Detail mode"), tr("You can't use now the Detail mode. "
|
||||||
"Please, create at least one workpiece."),
|
"Please, create at least one workpiece."),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
Layout();
|
ActionDraw(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detailsWidget->UpdateList();
|
||||||
|
|
||||||
qCDebug(vMainWindow, "Show details scene");
|
qCDebug(vMainWindow, "Show details scene");
|
||||||
SaveCurrentScene();
|
SaveCurrentScene();
|
||||||
|
|
||||||
|
@ -2179,7 +2192,10 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
|
|
||||||
ui->dockWidgetLayoutPages->setVisible(false);
|
ui->dockWidgetLayoutPages->setVisible(false);
|
||||||
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
|
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
|
||||||
|
|
||||||
|
ui->dockWidgetGroups->setWidget(detailsWidget);
|
||||||
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
|
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
|
||||||
|
ui->dockWidgetGroups->setToolTip(tr("Show which details will go in layout"));
|
||||||
|
|
||||||
helpLabel->setText("");
|
helpLabel->setText("");
|
||||||
}
|
}
|
||||||
|
@ -2214,17 +2230,39 @@ void MainWindow::ActionLayout(bool checked)
|
||||||
ui->actionDetails->setChecked(false);
|
ui->actionDetails->setChecked(false);
|
||||||
ui->actionLayout->setChecked(true);
|
ui->actionLayout->setChecked(true);
|
||||||
|
|
||||||
const QHash<quint32, VDetail> *details = pattern->DataDetails();
|
QHash<quint32, VDetail> details;
|
||||||
if(not qApp->getOpeningPattern())
|
if(not qApp->getOpeningPattern())
|
||||||
{
|
{
|
||||||
if (details->count() == 0)
|
const QHash<quint32, VDetail> *allDetails = pattern->DataDetails();
|
||||||
|
if (allDetails->count() == 0)
|
||||||
{
|
{
|
||||||
QMessageBox::information(this, tr("Layout mode"), tr("You can't use now the Layout mode. "
|
QMessageBox::information(this, tr("Layout mode"), tr("You can't use now the Layout mode. "
|
||||||
"Please, create at least one workpiece."),
|
"Please, create at least one workpiece."),
|
||||||
QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
Layout();
|
ActionDraw(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QHash<quint32, VDetail>::const_iterator i = allDetails->constBegin();
|
||||||
|
while (i != allDetails->constEnd())
|
||||||
|
{
|
||||||
|
if (i.value().IsInLayout())
|
||||||
|
{
|
||||||
|
details.insert(i.key(), i.value());
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (details.count() == 0)
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, tr("Layout mode"), tr("You can't use now the Layout mode. Please, "
|
||||||
|
"include at least one detail in layout."),
|
||||||
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
mode == Draw::Calculation ? ActionDraw(true) : ActionDetails(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
comboBoxDraws->setCurrentIndex(-1);// Hide pattern pieces
|
comboBoxDraws->setCurrentIndex(-1);// Hide pattern pieces
|
||||||
|
@ -2233,7 +2271,7 @@ void MainWindow::ActionLayout(bool checked)
|
||||||
|
|
||||||
SaveCurrentScene();
|
SaveCurrentScene();
|
||||||
|
|
||||||
PrepareDetailsForLayout(details);
|
PrepareDetailsForLayout(&details);
|
||||||
|
|
||||||
currentScene = tempSceneLayout;
|
currentScene = tempSceneLayout;
|
||||||
ui->view->itemClicked(nullptr);
|
ui->view->itemClicked(nullptr);
|
||||||
|
@ -2514,7 +2552,7 @@ void MainWindow::Clear()
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
#endif
|
#endif
|
||||||
Layout();
|
CleanLayout();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
qt_ntfs_permission_lookup--; // turn it off again
|
qt_ntfs_permission_lookup--; // turn it off again
|
||||||
|
@ -2781,29 +2819,6 @@ void MainWindow::ClickEndVisualization()
|
||||||
EndVisualization(true);
|
EndVisualization(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void MainWindow::Layout()
|
|
||||||
{
|
|
||||||
if (pattern->DataDetails()->size() > 0)
|
|
||||||
{
|
|
||||||
SetLayoutModeActions(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listDetails.clear();
|
|
||||||
if (not ui->actionDraw->isChecked())
|
|
||||||
{
|
|
||||||
ActionDraw(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->actionDetails->setChecked(false);
|
|
||||||
ui->actionLayout->setChecked(false);
|
|
||||||
}
|
|
||||||
SetLayoutModeActions(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::UpdateGradation()
|
void MainWindow::UpdateGradation()
|
||||||
{
|
{
|
||||||
|
@ -3154,19 +3169,16 @@ void MainWindow::SetEnableTool(bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::SetLayoutModeActions(bool enable)
|
void MainWindow::SetLayoutModeActions()
|
||||||
{
|
{
|
||||||
bool value = enable;
|
const bool enabled = not scenes.isEmpty();
|
||||||
if (scenes.isEmpty())
|
|
||||||
{
|
ui->actionExportAs->setEnabled(enabled);
|
||||||
value = false;
|
ui->actionPrintPreview->setEnabled(enabled);
|
||||||
}
|
ui->actionPrintPreviewTiled->setEnabled(enabled);
|
||||||
ui->actionExportAs->setEnabled(value);
|
ui->actionSaveAsTiledPDF->setEnabled(enabled);
|
||||||
ui->actionPrintPreview->setEnabled(value);
|
ui->actionPrint->setEnabled(enabled);
|
||||||
ui->actionPrintPreviewTiled->setEnabled(value);
|
ui->actionPrintTiled->setEnabled(enabled);
|
||||||
ui->actionSaveAsTiledPDF->setEnabled(value);
|
|
||||||
ui->actionPrint->setEnabled(value);
|
|
||||||
ui->actionPrintTiled->setEnabled(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3625,6 +3637,10 @@ void MainWindow::InitDocksContain()
|
||||||
qCDebug(vMainWindow, "Initialization groups dock.");
|
qCDebug(vMainWindow, "Initialization groups dock.");
|
||||||
groupsWidget = new VWidgetGroups(doc, this);
|
groupsWidget = new VWidgetGroups(doc, this);
|
||||||
ui->dockWidgetGroups->setWidget(groupsWidget);
|
ui->dockWidgetGroups->setWidget(groupsWidget);
|
||||||
|
|
||||||
|
detailsWidget = new VWidgetDetails(pattern, doc, this);
|
||||||
|
connect(doc, &VPattern::FullUpdateFromFile, detailsWidget, &VWidgetDetails::UpdateList);
|
||||||
|
detailsWidget->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3983,12 +3999,10 @@ void MainWindow::ShowPaper(int index)
|
||||||
if (index < 0 || index >= scenes.size())
|
if (index < 0 || index >= scenes.size())
|
||||||
{
|
{
|
||||||
ui->view->setScene(tempSceneLayout);
|
ui->view->setScene(tempSceneLayout);
|
||||||
SetLayoutModeActions(false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->view->setScene(scenes.at(index));
|
ui->view->setScene(scenes.at(index));
|
||||||
SetLayoutModeActions(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
||||||
|
|
|
@ -49,6 +49,7 @@ class DialogIncrements;
|
||||||
class DialogTool;
|
class DialogTool;
|
||||||
class DialogHistory;
|
class DialogHistory;
|
||||||
class VWidgetGroups;
|
class VWidgetGroups;
|
||||||
|
class VWidgetDetails;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The MainWindow class main windows.
|
* @brief The MainWindow class main windows.
|
||||||
|
@ -152,7 +153,6 @@ public slots:
|
||||||
void SetEnabledGUI(bool enabled);
|
void SetEnabledGUI(bool enabled);
|
||||||
|
|
||||||
void ClickEndVisualization();
|
void ClickEndVisualization();
|
||||||
void Layout();
|
|
||||||
void UpdateGradation();
|
void UpdateGradation();
|
||||||
void GlobalChangePP(const QString &patternPiece);
|
void GlobalChangePP(const QString &patternPiece);
|
||||||
void WindowsLocale();
|
void WindowsLocale();
|
||||||
|
@ -277,6 +277,7 @@ private:
|
||||||
QPointer<QLabel> gradationSizesLabel;
|
QPointer<QLabel> gradationSizesLabel;
|
||||||
VToolOptionsPropertyBrowser *toolOptions;
|
VToolOptionsPropertyBrowser *toolOptions;
|
||||||
VWidgetGroups *groupsWidget;
|
VWidgetGroups *groupsWidget;
|
||||||
|
VWidgetDetails *detailsWidget;
|
||||||
std::shared_ptr<VLockGuard<char>> lock;
|
std::shared_ptr<VLockGuard<char>> lock;
|
||||||
|
|
||||||
void SetDefaultHeight();
|
void SetDefaultHeight();
|
||||||
|
@ -291,7 +292,7 @@ private:
|
||||||
|
|
||||||
void SetEnableWidgets(bool enable);
|
void SetEnableWidgets(bool enable);
|
||||||
void SetEnableTool(bool enable);
|
void SetEnableTool(bool enable);
|
||||||
void SetLayoutModeActions(bool enable);
|
void SetLayoutModeActions();
|
||||||
|
|
||||||
void SaveCurrentScene();
|
void SaveCurrentScene();
|
||||||
void RestoreCurrentScene();
|
void RestoreCurrentScene();
|
||||||
|
|
|
@ -1518,8 +1518,11 @@
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Groups</string>
|
<string>Group</string>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="dockWidgetArea">
|
<attribute name="dockWidgetArea">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
|
|
|
@ -590,6 +590,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
|
detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
|
||||||
detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
|
detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
|
||||||
detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
|
detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
|
||||||
|
detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
||||||
|
|
||||||
QStringList types = QStringList() << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline
|
QStringList types = QStringList() << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline
|
||||||
<< VToolDetail::NodeSplinePath;
|
<< VToolDetail::NodeSplinePath;
|
||||||
|
|
|
@ -130,6 +130,7 @@ const QString AttrCRadius = QStringLiteral("cRadius");
|
||||||
const QString AttrArc = QStringLiteral("arc");
|
const QString AttrArc = QStringLiteral("arc");
|
||||||
const QString AttrSuffix = QStringLiteral("suffix");
|
const QString AttrSuffix = QStringLiteral("suffix");
|
||||||
const QString AttrIdObject = QStringLiteral("idObject");
|
const QString AttrIdObject = QStringLiteral("idObject");
|
||||||
|
const QString AttrInLayout = QStringLiteral("inLayout");
|
||||||
|
|
||||||
const QString TypeLineNone = QStringLiteral("none");
|
const QString TypeLineNone = QStringLiteral("none");
|
||||||
const QString TypeLineLine = QStringLiteral("hair");
|
const QString TypeLineLine = QStringLiteral("hair");
|
||||||
|
|
|
@ -132,6 +132,7 @@ extern const QString AttrCRadius;
|
||||||
extern const QString AttrArc;
|
extern const QString AttrArc;
|
||||||
extern const QString AttrSuffix;
|
extern const QString AttrSuffix;
|
||||||
extern const QString AttrIdObject;
|
extern const QString AttrIdObject;
|
||||||
|
extern const QString AttrInLayout;
|
||||||
|
|
||||||
extern const QString TypeLineNone;
|
extern const QString TypeLineNone;
|
||||||
extern const QString TypeLineLine;
|
extern const QString TypeLineLine;
|
||||||
|
|
|
@ -61,5 +61,9 @@
|
||||||
<file>icon/16x16/closed_eye@2x.png</file>
|
<file>icon/16x16/closed_eye@2x.png</file>
|
||||||
<file>icon/16x16/open_eye.png</file>
|
<file>icon/16x16/open_eye.png</file>
|
||||||
<file>icon/16x16/open_eye@2x.png</file>
|
<file>icon/16x16/open_eye@2x.png</file>
|
||||||
|
<file>icon/16x16/allow_detail.png</file>
|
||||||
|
<file>icon/16x16/allow_detail@2x.png</file>
|
||||||
|
<file>icon/16x16/forbid_detail.png</file>
|
||||||
|
<file>icon/16x16/forbid_detail@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/libs/vmisc/share/resources/icon/16x16/allow_detail.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/16x16/allow_detail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
src/libs/vmisc/share/resources/icon/16x16/allow_detail@2x.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/16x16/allow_detail@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
BIN
src/libs/vmisc/share/resources/icon/16x16/forbid_detail.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/16x16/forbid_detail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
src/libs/vmisc/share/resources/icon/16x16/forbid_detail@2x.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/16x16/forbid_detail@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
|
@ -175,6 +175,18 @@ void VDetail::setId(const quint32 &id)
|
||||||
d->_id = id;
|
d->_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VDetail::IsInLayout() const
|
||||||
|
{
|
||||||
|
return d->inLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VDetail::SetInLayout(bool inLayout)
|
||||||
|
{
|
||||||
|
d->inLayout = inLayout;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief OnEdge checks if two poins located on the edge. Edge is line between two points. If between two points
|
* @brief OnEdge checks if two poins located on the edge. Edge is line between two points. If between two points
|
||||||
|
|
|
@ -67,6 +67,9 @@ public:
|
||||||
quint32 id() const;
|
quint32 id() const;
|
||||||
void setId(const quint32 &id);
|
void setId(const quint32 &id);
|
||||||
|
|
||||||
|
bool IsInLayout() const;
|
||||||
|
void SetInLayout(bool inLayout);
|
||||||
|
|
||||||
QVector<VNodeDetail> getNodes() const;
|
QVector<VNodeDetail> getNodes() const;
|
||||||
void setNodes(const QVector<VNodeDetail> &value);
|
void setNodes(const QVector<VNodeDetail> &value);
|
||||||
|
|
||||||
|
|
|
@ -42,15 +42,15 @@ class VDetailData : public QSharedData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VDetailData()
|
VDetailData()
|
||||||
:_id(NULL_ID), nodes(QVector<VNodeDetail>()), mx(0), my(0)
|
:_id(NULL_ID), nodes(QVector<VNodeDetail>()), mx(0), my(0), inLayout(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit VDetailData(const QVector<VNodeDetail> &nodes)
|
explicit VDetailData(const QVector<VNodeDetail> &nodes)
|
||||||
:_id(NULL_ID), nodes(nodes), mx(0), my(0)
|
:_id(NULL_ID), nodes(nodes), mx(0), my(0), inLayout(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VDetailData(const VDetailData &detail)
|
VDetailData(const VDetailData &detail)
|
||||||
:QSharedData(detail), _id(NULL_ID), nodes(detail.nodes), mx(detail.mx), my(detail.my)
|
:QSharedData(detail), _id(NULL_ID), nodes(detail.nodes), mx(detail.mx), my(detail.my), inLayout(detail.inLayout)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~VDetailData() {}
|
~VDetailData() {}
|
||||||
|
@ -67,6 +67,8 @@ public:
|
||||||
/** @brief my bias y axis. */
|
/** @brief my bias y axis. */
|
||||||
qreal my;
|
qreal my;
|
||||||
|
|
||||||
|
bool inLayout;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VDetailData &operator=(const VDetailData &) Q_DECL_EQ_DELETE;
|
VDetailData &operator=(const VDetailData &) Q_DECL_EQ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
132
src/libs/vtools/undocommands/toggledetailinlayout.cpp
Normal file
132
src/libs/vtools/undocommands/toggledetailinlayout.cpp
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file toggledetailinlayout.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 6, 2016
|
||||||
|
**
|
||||||
|
** @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) 2016 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 "toggledetailinlayout.h"
|
||||||
|
#include "../vpatterndb/vdetail.h"
|
||||||
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
ToggleDetailInLayout::ToggleDetailInLayout(quint32 id, bool state, VContainer *data, VAbstractPattern *doc,
|
||||||
|
QUndoCommand *parent)
|
||||||
|
: VUndoCommand(QDomElement(), doc, parent),
|
||||||
|
m_id(id),
|
||||||
|
m_data(data),
|
||||||
|
m_oldState(m_data->DataDetails()->value(m_id).IsInLayout()),
|
||||||
|
m_newState(state)
|
||||||
|
{
|
||||||
|
setText(tr("detail in layout list"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
ToggleDetailInLayout::~ToggleDetailInLayout()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ToggleDetailInLayout::undo()
|
||||||
|
{
|
||||||
|
qCDebug(vUndo, "ToggleDetailInLayout::undo().");
|
||||||
|
|
||||||
|
if (m_newState != m_oldState)
|
||||||
|
{
|
||||||
|
Do(m_oldState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ToggleDetailInLayout::redo()
|
||||||
|
{
|
||||||
|
qCDebug(vUndo, "ToggleDetailInLayout::redo().");
|
||||||
|
|
||||||
|
if (m_newState != m_oldState)
|
||||||
|
{
|
||||||
|
Do(m_newState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool ToggleDetailInLayout::mergeWith(const QUndoCommand *command)
|
||||||
|
{
|
||||||
|
const ToggleDetailInLayout *stateCommand = static_cast<const ToggleDetailInLayout *>(command);
|
||||||
|
SCASSERT(stateCommand != nullptr);
|
||||||
|
const quint32 id = stateCommand->getDetId();
|
||||||
|
|
||||||
|
if (id != m_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_newState = stateCommand->getNewState();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int ToggleDetailInLayout::id() const
|
||||||
|
{
|
||||||
|
return static_cast<int>(UndoCommand::ToggleDetailInLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
quint32 ToggleDetailInLayout::getDetId() const
|
||||||
|
{
|
||||||
|
return m_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool ToggleDetailInLayout::getNewState() const
|
||||||
|
{
|
||||||
|
return m_newState;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ToggleDetailInLayout::Do(bool state)
|
||||||
|
{
|
||||||
|
QDomElement detail = doc->elementById(m_id);
|
||||||
|
if (detail.isElement())
|
||||||
|
{
|
||||||
|
if (state == false)
|
||||||
|
{
|
||||||
|
doc->SetAttribute(detail, AttrInLayout, state);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
detail.removeAttribute(AttrInLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
VDetail det = m_data->DataDetails()->value(m_id);
|
||||||
|
det.SetInLayout(state);
|
||||||
|
m_data->UpdateDetail(m_id, det);
|
||||||
|
|
||||||
|
emit NeedLiteParsing(Document::LiteParse);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("Can't get detail by id = %u.", m_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
57
src/libs/vtools/undocommands/toggledetailinlayout.h
Normal file
57
src/libs/vtools/undocommands/toggledetailinlayout.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file toggledetailinlayout.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 6, 2016
|
||||||
|
**
|
||||||
|
** @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) 2016 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 TOGGLEDETAILINLAYOUT_H
|
||||||
|
#define TOGGLEDETAILINLAYOUT_H
|
||||||
|
|
||||||
|
#include "vundocommand.h"
|
||||||
|
|
||||||
|
class ToggleDetailInLayout : public VUndoCommand
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ToggleDetailInLayout(quint32 id, bool state, VContainer *data, VAbstractPattern *doc,
|
||||||
|
QUndoCommand *parent = nullptr);
|
||||||
|
virtual ~ToggleDetailInLayout();
|
||||||
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
|
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
|
||||||
|
virtual int id() const Q_DECL_OVERRIDE;
|
||||||
|
quint32 getDetId() const;
|
||||||
|
bool getNewState() const;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(ToggleDetailInLayout)
|
||||||
|
quint32 m_id;
|
||||||
|
VContainer *m_data;
|
||||||
|
bool m_oldState;
|
||||||
|
bool m_newState;
|
||||||
|
|
||||||
|
void Do(bool state);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TOGGLEDETAILINLAYOUT_H
|
|
@ -22,7 +22,8 @@ HEADERS += \
|
||||||
$$PWD/addgroup.h \
|
$$PWD/addgroup.h \
|
||||||
$$PWD/delgroup.h \
|
$$PWD/delgroup.h \
|
||||||
$$PWD/label/rotationmovelabel.h \
|
$$PWD/label/rotationmovelabel.h \
|
||||||
undocommands/label/moveabstractlabel.h
|
$$PWD/label/moveabstractlabel.h \
|
||||||
|
$$PWD/toggledetailinlayout.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/addtocalc.cpp \
|
$$PWD/addtocalc.cpp \
|
||||||
|
@ -45,4 +46,5 @@ SOURCES += \
|
||||||
$$PWD/addgroup.cpp \
|
$$PWD/addgroup.cpp \
|
||||||
$$PWD/delgroup.cpp \
|
$$PWD/delgroup.cpp \
|
||||||
$$PWD/label/rotationmovelabel.cpp \
|
$$PWD/label/rotationmovelabel.cpp \
|
||||||
undocommands/label/moveabstractlabel.cpp
|
$$PWD/label/moveabstractlabel.cpp \
|
||||||
|
$$PWD/toggledetailinlayout.cpp
|
||||||
|
|
|
@ -50,7 +50,8 @@ enum class UndoCommand: char { AddPatternPiece,
|
||||||
RenamePP,
|
RenamePP,
|
||||||
MoveLabel,
|
MoveLabel,
|
||||||
MoveDoubleLabel,
|
MoveDoubleLabel,
|
||||||
RotationMoveLabel
|
RotationMoveLabel,
|
||||||
|
ToggleDetailInLayout
|
||||||
};
|
};
|
||||||
|
|
||||||
class VPattern;
|
class VPattern;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user