Resolved issue #496. Selector for selecting which pieces to print.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-06-26 14:52:02 +03:00
commit 2bdd0258a5
29 changed files with 1103 additions and 85 deletions

View File

@ -32,6 +32,7 @@
- [#180] New feature: Search field in tape app and dialog Increments. - [#180] New feature: Search field in tape app and dialog Increments.
- [#514] Read only setting not working properly. - [#514] Read only setting not working properly.
- [#480] New tool: Midpoint between two points. - [#480] New tool: Midpoint between two points.
- [#496] Selector for selecting which pieces to print.
# Version 0.4.5 # Version 0.4.5
- [#435] Valentina doesn't change the cursor. - [#435] Valentina doesn't change the cursor.

View File

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

View File

@ -0,0 +1,131 @@
/************************************************************************
**
** @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);
// set the item non-editable (view only), and non-selectable
Qt::ItemFlags flags = item->flags();
flags &= ~(Qt::ItemIsEditable); // reset/clear the flag
item->setFlags(flags);
ui->tableWidget->setItem(currentRow, 1, item);
++i;
}
ui->tableWidget->resizeColumnsToContents();
ui->tableWidget->resizeRowsToContents();
ui->tableWidget->setCurrentCell(selectedRow, 0);
}

View 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

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

View File

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

View File

@ -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()
{ {
@ -2973,18 +2988,6 @@ void MainWindow::ChangedHeight(const QString &text)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::DockToolOptionsVisibilityChanged(bool visible)
{
isDockToolOptionsVisible = visible;
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::DockGropsVisibilityChanged(bool visible)
{
isDockGroupsVisible = visible;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetDefaultHeight() void MainWindow::SetDefaultHeight()
{ {
@ -3166,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);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -3610,12 +3610,15 @@ void MainWindow::AddDocks()
//Add dock //Add dock
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction(); actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions); ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions);
connect(ui->dockWidgetToolOptions, &QDockWidget::visibilityChanged, this, connect(ui->dockWidgetToolOptions, &QDockWidget::visibilityChanged, [this](bool visible){
&MainWindow::DockToolOptionsVisibilityChanged); isDockToolOptionsVisible = visible;
});
actionDockWidgetGroups = ui->dockWidgetGroups->toggleViewAction(); actionDockWidgetGroups = ui->dockWidgetGroups->toggleViewAction();
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetGroups); ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetGroups);
connect(ui->dockWidgetGroups, &QDockWidget::visibilityChanged, this, &MainWindow::DockGropsVisibilityChanged); connect(ui->dockWidgetGroups, &QDockWidget::visibilityChanged, [this](bool visible){
isDockGroupsVisible = visible;
});
separatorAct = new QAction(this); separatorAct = new QAction(this);
separatorAct->setSeparator(true); separatorAct->setSeparator(true);
@ -3634,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);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -3992,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);

View File

@ -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();
@ -207,9 +207,6 @@ private slots:
void ChangedSize(const QString &text); void ChangedSize(const QString &text);
void ChangedHeight(const QString & text); void ChangedHeight(const QString & text);
void DockToolOptionsVisibilityChanged(bool visible);
void DockGropsVisibilityChanged(bool visible);
private: private:
Q_DISABLE_COPY(MainWindow) Q_DISABLE_COPY(MainWindow)
/** @brief ui keeps information about user interface */ /** @brief ui keeps information about user interface */
@ -280,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();
@ -294,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();

View File

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

View File

@ -457,25 +457,25 @@ void MainWindowsNoGUI::PrintTiled()
void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *details) void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash<quint32, VDetail> *details)
{ {
SCASSERT(details != nullptr) SCASSERT(details != nullptr)
if (details->count() == 0) if (details->count() == 0)
{ {
listDetails.clear(); listDetails.clear();
return; return;
} }
listDetails.clear(); listDetails.clear();
QHashIterator<quint32, VDetail> idetail(*details); QHash<quint32, VDetail>::const_iterator i = details->constBegin();
while (idetail.hasNext()) while (i != details->constEnd())
{ {
idetail.next();
VLayoutDetail det = VLayoutDetail(); VLayoutDetail det = VLayoutDetail();
const VDetail &d = idetail.value(); const VDetail d = i.value();
det.SetCountourPoints(d.ContourPoints(pattern)); det.SetCountourPoints(d.ContourPoints(pattern));
det.SetSeamAllowencePoints(d.SeamAllowancePoints(pattern), d.getSeamAllowance(), d.getClosed()); det.SetSeamAllowencePoints(d.SeamAllowancePoints(pattern), d.getSeamAllowance(), d.getClosed());
det.setName(d.getName()); det.setName(d.getName());
det.setWidth(qApp->toPixel(d.getWidth())); det.setWidth(qApp->toPixel(d.getWidth()));
listDetails.append(det); listDetails.append(det);
++i;
} }
} }

View File

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

View File

@ -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");

View File

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

View File

@ -15,6 +15,7 @@
<file>schema/pattern/v0.2.7.xsd</file> <file>schema/pattern/v0.2.7.xsd</file>
<file>schema/pattern/v0.3.0.xsd</file> <file>schema/pattern/v0.3.0.xsd</file>
<file>schema/pattern/v0.3.1.xsd</file> <file>schema/pattern/v0.3.1.xsd</file>
<file>schema/pattern/v0.3.2.xsd</file>
<file>schema/standard_measurements/v0.3.0.xsd</file> <file>schema/standard_measurements/v0.3.0.xsd</file>
<file>schema/standard_measurements/v0.4.0.xsd</file> <file>schema/standard_measurements/v0.4.0.xsd</file>
<file>schema/standard_measurements/v0.4.1.xsd</file> <file>schema/standard_measurements/v0.4.1.xsd</file>

View File

@ -0,0 +1,516 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- XML Schema Generated from XML Document-->
<xs:element name="pattern">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="version" type="formatVersion"></xs:element>
<xs:element name="unit" type="units"></xs:element>
<xs:element name="image" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="extension" type="imageExtension"></xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
<xs:element name="gradation" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="heights">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="h92" type="xs:boolean"></xs:attribute>
<xs:attribute name="h98" type="xs:boolean"></xs:attribute>
<xs:attribute name="h104" type="xs:boolean"></xs:attribute>
<xs:attribute name="h110" type="xs:boolean"></xs:attribute>
<xs:attribute name="h116" type="xs:boolean"></xs:attribute>
<xs:attribute name="h122" type="xs:boolean"></xs:attribute>
<xs:attribute name="h128" type="xs:boolean"></xs:attribute>
<xs:attribute name="h134" type="xs:boolean"></xs:attribute>
<xs:attribute name="h140" type="xs:boolean"></xs:attribute>
<xs:attribute name="h146" type="xs:boolean"></xs:attribute>
<xs:attribute name="h152" type="xs:boolean"></xs:attribute>
<xs:attribute name="h158" type="xs:boolean"></xs:attribute>
<xs:attribute name="h164" type="xs:boolean"></xs:attribute>
<xs:attribute name="h170" type="xs:boolean"></xs:attribute>
<xs:attribute name="h176" type="xs:boolean"></xs:attribute>
<xs:attribute name="h182" type="xs:boolean"></xs:attribute>
<xs:attribute name="h188" type="xs:boolean"></xs:attribute>
<xs:attribute name="h194" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="sizes">
<xs:complexType>
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
<xs:attribute name="s22" type="xs:boolean"></xs:attribute>
<xs:attribute name="s24" type="xs:boolean"></xs:attribute>
<xs:attribute name="s26" type="xs:boolean"></xs:attribute>
<xs:attribute name="s28" type="xs:boolean"></xs:attribute>
<xs:attribute name="s30" type="xs:boolean"></xs:attribute>
<xs:attribute name="s32" type="xs:boolean"></xs:attribute>
<xs:attribute name="s34" type="xs:boolean"></xs:attribute>
<xs:attribute name="s36" type="xs:boolean"></xs:attribute>
<xs:attribute name="s38" type="xs:boolean"></xs:attribute>
<xs:attribute name="s40" type="xs:boolean"></xs:attribute>
<xs:attribute name="s42" type="xs:boolean"></xs:attribute>
<xs:attribute name="s44" type="xs:boolean"></xs:attribute>
<xs:attribute name="s46" type="xs:boolean"></xs:attribute>
<xs:attribute name="s48" type="xs:boolean"></xs:attribute>
<xs:attribute name="s50" type="xs:boolean"></xs:attribute>
<xs:attribute name="s52" type="xs:boolean"></xs:attribute>
<xs:attribute name="s54" type="xs:boolean"></xs:attribute>
<xs:attribute name="s56" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="custom" type="xs:boolean"></xs:attribute>
<xs:attribute name="defHeight" type="baseHeight"></xs:attribute>
<xs:attribute name="defSize" type="baseSize"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="measurements" type="xs:string"></xs:element>
<xs:element name="increments" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="description" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="name" type="shortName" use="required"></xs:attribute>
<xs:attribute name="formula" type="xs:string" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="incrementName">
<xs:selector xpath="increment"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="x" type="xs:double"></xs:attribute>
<xs:attribute name="y" type="xs:double"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="name" type="shortName"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="thirdPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="basePoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="pShoulder" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="splinePath" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="spline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p1Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="p2Line2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="axisP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="curve2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="firstArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondArc" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="crossPoint" type="crossType"></xs:attribute>
<xs:attribute name="vCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="hCrossPoint" type="crossType"></xs:attribute>
<xs:attribute name="c1Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c2Center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="c1Radius" type="xs:string"></xs:attribute>
<xs:attribute name="c2Radius" type="xs:string"></xs:attribute>
<xs:attribute name="cRadius" type="xs:string"></xs:attribute>
<xs:attribute name="tangent" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="cCenter" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="name1" type="shortName"></xs:attribute>
<xs:attribute name="mx1" type="xs:double"></xs:attribute>
<xs:attribute name="my1" type="xs:double"></xs:attribute>
<xs:attribute name="name2" type="shortName"></xs:attribute>
<xs:attribute name="mx2" type="xs:double"></xs:attribute>
<xs:attribute name="my2" type="xs:double"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="dartP3" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="baseLineP1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="baseLineP2" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
<xs:attribute name="lineColor" type="colors"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="operation" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="source" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="destination" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="item" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="idObject" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="suffix" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string" use="required"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="radius" type="xs:string"></xs:attribute>
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="length" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="kAsm2" type="xs:string"></xs:attribute>
<xs:attribute name="pSpline" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="angle" type="xs:string"></xs:attribute>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="length1" type="xs:string"></xs:attribute>
<xs:attribute name="length2" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="kCurve" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="kAsm1" type="xs:double"></xs:attribute>
<xs:attribute name="kAsm2" type="xs:double"></xs:attribute>
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
<xs:attribute name="length1" type="xs:string"></xs:attribute>
<xs:attribute name="length2" type="xs:string"></xs:attribute>
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point3" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="point4" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="color" type="colors"></xs:attribute>
<xs:attribute name="duplicate" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="det" minOccurs="2" maxOccurs="2">
<xs:complexType>
<xs:sequence>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="children" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="child" type="xs:unsignedInt" minOccurs="1" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="indexD1" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="indexD2" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inUse" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="details" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="type" type="xs:string"></xs:attribute>
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="supplement" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="mx" type="xs:double"></xs:attribute>
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="width" type="xs:double"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="closed" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="inLayout" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="groups" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="group" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="object" type="xs:unsignedInt"></xs:attribute>
<xs:attribute name="tool" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="visible" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="readOnly" type="xs:boolean"></xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name="shortName">
<xs:restriction base="xs:string">
<xs:pattern value="^([^0-9*/^+\-=\s()?%:;!.,`'\&quot;]){1,1}([^*/^+\-=\s()?%:;!.,`'\&quot;]){0,}$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="units">
<xs:restriction base="xs:string">
<xs:enumeration value="mm"/>
<xs:enumeration value="cm"/>
<xs:enumeration value="inch"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="measurementsTypes">
<xs:restriction base="xs:string">
<xs:enumeration value="standard"/>
<xs:enumeration value="individual"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="formatVersion">
<xs:restriction base="xs:string">
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="imageExtension">
<xs:restriction base="xs:string">
<xs:enumeration value="PNG"/>
<xs:enumeration value="JPG"/>
<xs:enumeration value="BMP"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="colors">
<xs:restriction base="xs:string">
<xs:enumeration value="black"/>
<xs:enumeration value="green"/>
<xs:enumeration value="blue"/>
<xs:enumeration value="darkRed"/>
<xs:enumeration value="darkGreen"/>
<xs:enumeration value="darkBlue"/>
<xs:enumeration value="yellow"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseHeight">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="92"/>
<xs:enumeration value="98"/>
<xs:enumeration value="104"/>
<xs:enumeration value="110"/>
<xs:enumeration value="116"/>
<xs:enumeration value="122"/>
<xs:enumeration value="128"/>
<xs:enumeration value="134"/>
<xs:enumeration value="140"/>
<xs:enumeration value="146"/>
<xs:enumeration value="152"/>
<xs:enumeration value="158"/>
<xs:enumeration value="164"/>
<xs:enumeration value="170"/>
<xs:enumeration value="176"/>
<xs:enumeration value="182"/>
<xs:enumeration value="188"/>
<xs:enumeration value="194"/>
<xs:enumeration value="920"/>
<xs:enumeration value="980"/>
<xs:enumeration value="1040"/>
<xs:enumeration value="1100"/>
<xs:enumeration value="1160"/>
<xs:enumeration value="1220"/>
<xs:enumeration value="1280"/>
<xs:enumeration value="1340"/>
<xs:enumeration value="1400"/>
<xs:enumeration value="1460"/>
<xs:enumeration value="1520"/>
<xs:enumeration value="1580"/>
<xs:enumeration value="1640"/>
<xs:enumeration value="1700"/>
<xs:enumeration value="1760"/>
<xs:enumeration value="1820"/>
<xs:enumeration value="1880"/>
<xs:enumeration value="1940"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="baseSize">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="22"/>
<xs:enumeration value="24"/>
<xs:enumeration value="26"/>
<xs:enumeration value="28"/>
<xs:enumeration value="30"/>
<xs:enumeration value="32"/>
<xs:enumeration value="34"/>
<xs:enumeration value="36"/>
<xs:enumeration value="38"/>
<xs:enumeration value="40"/>
<xs:enumeration value="42"/>
<xs:enumeration value="44"/>
<xs:enumeration value="46"/>
<xs:enumeration value="48"/>
<xs:enumeration value="50"/>
<xs:enumeration value="52"/>
<xs:enumeration value="54"/>
<xs:enumeration value="56"/>
<xs:enumeration value="220"/>
<xs:enumeration value="240"/>
<xs:enumeration value="260"/>
<xs:enumeration value="280"/>
<xs:enumeration value="300"/>
<xs:enumeration value="320"/>
<xs:enumeration value="340"/>
<xs:enumeration value="360"/>
<xs:enumeration value="380"/>
<xs:enumeration value="400"/>
<xs:enumeration value="420"/>
<xs:enumeration value="440"/>
<xs:enumeration value="460"/>
<xs:enumeration value="480"/>
<xs:enumeration value="500"/>
<xs:enumeration value="520"/>
<xs:enumeration value="540"/>
<xs:enumeration value="560"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="crossType">
<xs:restriction base="xs:unsignedInt">
<xs:enumeration value="1"/>
<xs:enumeration value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@ -43,8 +43,8 @@
*/ */
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.1"); const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.2");
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.1.xsd"); const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.2.xsd");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPatternConverter::VPatternConverter(const QString &fileName) VPatternConverter::VPatternConverter(const QString &fileName)
@ -115,6 +115,8 @@ QString VPatternConverter::XSDSchema(int ver) const
case (0x000300): case (0x000300):
return QStringLiteral("://schema/pattern/v0.3.0.xsd"); return QStringLiteral("://schema/pattern/v0.3.0.xsd");
case (0x000301): case (0x000301):
return QStringLiteral("://schema/pattern/v0.3.1.xsd");
case (0x000302):
return CurrentSchema; return CurrentSchema;
default: default:
InvalidVersion(ver); InvalidVersion(ver);
@ -186,6 +188,10 @@ void VPatternConverter::ApplyPatches()
ValidateXML(XSDSchema(0x000301), fileName); ValidateXML(XSDSchema(0x000301), fileName);
V_FALLTHROUGH V_FALLTHROUGH
case (0x000301): case (0x000301):
ToV0_3_2();
ValidateXML(XSDSchema(0x000302), fileName);
V_FALLTHROUGH
case (0x000302):
break; break;
default: default:
break; break;
@ -322,6 +328,13 @@ void VPatternConverter::ToV0_3_1()
Save(); Save();
} }
//---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::ToV0_3_2()
{
SetVersion(QStringLiteral("0.3.2"));
Save();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPatternConverter::TagUnitToV0_2_0() void VPatternConverter::TagUnitToV0_2_0()
{ {

View File

@ -70,6 +70,7 @@ private:
void ToV0_2_7(); void ToV0_2_7();
void ToV0_3_0(); void ToV0_3_0();
void ToV0_3_1(); void ToV0_3_1();
void ToV0_3_2();
void TagUnitToV0_2_0(); void TagUnitToV0_2_0();
void TagIncrementToV0_2_0(); void TagIncrementToV0_2_0();

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

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

View File

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

View File

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

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

View 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

View File

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

View File

@ -50,7 +50,8 @@ enum class UndoCommand: char { AddPatternPiece,
RenamePP, RenamePP,
MoveLabel, MoveLabel,
MoveDoubleLabel, MoveDoubleLabel,
RotationMoveLabel RotationMoveLabel,
ToggleDetailInLayout
}; };
class VPattern; class VPattern;