Merged dismine/valentina into develop
--HG-- branch : develop
This commit is contained in:
commit
d4a12cced8
6
README
6
README
|
@ -24,8 +24,12 @@ Prerequisites:
|
|||
* On Unix:
|
||||
- ccache
|
||||
- g++ (at least GCC 4.6 is needed and GCC 4.8 is recommended)
|
||||
- xpdf package (tool pdftops).
|
||||
* On Windows:
|
||||
- MinGW or Visual Studio
|
||||
- MinGW or Visual Studio
|
||||
- Xpdf is an open source viewer for Portable Document Format (PDF)
|
||||
files. Website http://www.foolabs.com/xpdf/. Put tool pdftops.exe
|
||||
in the same directory with Valentina's binary file.
|
||||
|
||||
The installed toolchains have to match the one Qt was compiled with.
|
||||
|
||||
|
|
|
@ -124,6 +124,13 @@ QMAKE_DISTCLEAN += $${DESTDIR}/* \
|
|||
$${RCC_DIR}/* \
|
||||
$$PWD/share/translations/valentina_*.qm
|
||||
|
||||
INSTALL_TRANSLATIONS += share/translations/valentina_ru.qm \
|
||||
share/translations/valentina_uk.qm \
|
||||
share/translations/valentina_de.qm \
|
||||
share/translations/valentina_cs.qm \
|
||||
share/translations/valentina_he_IL.qm \
|
||||
share/translations/valentina_fr.qm
|
||||
|
||||
unix {
|
||||
#VARIABLES
|
||||
isEmpty(PREFIX) {
|
||||
|
@ -138,12 +145,6 @@ desktop.path = $$DATADIR/applications/
|
|||
desktop.files += dist/$${TARGET}.desktop
|
||||
pixmaps.path = $$DATADIR/pixmaps/
|
||||
pixmaps.files += dist/$${TARGET}.png
|
||||
INSTALL_TRANSLATIONS += share/translations/valentina_ru.qm \
|
||||
share/translations/valentina_uk.qm \
|
||||
share/translations/valentina_de.qm \
|
||||
share/translations/valentina_cs.qm \
|
||||
share/translations/valentina_he_IL.qm \
|
||||
share/translations/valentina_fr.qm
|
||||
translations.path = $$DATADIR/$${TARGET}/translations/
|
||||
translations.files = $$INSTALL_TRANSLATIONS
|
||||
INSTALLS += target \
|
||||
|
@ -169,9 +170,10 @@ defineTest(copyToDestdir) {
|
|||
for(FILE, files) {
|
||||
|
||||
# Replace slashes in paths with backslashes for Windows
|
||||
win32:FILE ~= s,/,\\,g
|
||||
win32:DDIR ~= s,/,\\,g
|
||||
|
||||
win32{
|
||||
FILE ~= s,/,\\,g
|
||||
DDIR ~= s,/,\\,g
|
||||
}
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
|
||||
}
|
||||
|
||||
|
|
2
dist/debian/control
vendored
2
dist/debian/control
vendored
|
@ -8,7 +8,7 @@ Homepage: https://bitbucket.org/dismine/valentina
|
|||
|
||||
Package: valentina
|
||||
Architecture: i386 amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, xpdf
|
||||
Description: Pattern making program.
|
||||
Open source project of creating a pattern making program, whose allow
|
||||
create and modeling patterns of clothing.
|
||||
|
|
28855
share/resources/icon/logo.svg
Normal file
28855
share/resources/icon/logo.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 2.5 MiB |
|
@ -3,7 +3,10 @@
|
|||
<!-- XML Schema Generated from XML Document-->
|
||||
<xs:element name="pattern">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<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="increments" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
|
|
114
src/dialogs/dialogpatternproperties.cpp
Normal file
114
src/dialogs/dialogpatternproperties.cpp
Normal file
|
@ -0,0 +1,114 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpatternproperties.cpp
|
||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||
** @date 18 2, 2014
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013 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 "dialogpatternproperties.h"
|
||||
#include "ui_dialogpatternproperties.h"
|
||||
#include <QSettings>
|
||||
|
||||
DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *parent) :
|
||||
QDialog(parent), ui(new Ui::DialogPatternProperties), doc(doc)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
Q_CHECK_PTR(doc);
|
||||
|
||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
||||
QApplication::applicationName());
|
||||
#ifdef Q_OS_WIN32
|
||||
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString();
|
||||
#else
|
||||
QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USER").constData())).toString();
|
||||
#endif
|
||||
|
||||
ui->lineEditAuthor->setText(this->doc->UniqueTagText("author", user));
|
||||
ui->plainTextEditDescription->setPlainText(this->doc->UniqueTagText("description"));
|
||||
ui->plainTextEditTechNotes->setPlainText(this->doc->UniqueTagText("notes"));
|
||||
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
Q_CHECK_PTR(bOk);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogPatternProperties::Apply);
|
||||
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
Q_CHECK_PTR(bCansel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close);
|
||||
|
||||
connect(this, &DialogPatternProperties::haveChange, this->doc, &VDomDocument::haveLiteChange);
|
||||
}
|
||||
|
||||
DialogPatternProperties::~DialogPatternProperties()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DialogPatternProperties::Apply()
|
||||
{
|
||||
Write("notes", ui->plainTextEditTechNotes->document()->toPlainText());
|
||||
Write("description", ui->plainTextEditDescription->document()->toPlainText());
|
||||
Write("author", ui->lineEditAuthor->text());
|
||||
emit haveChange();
|
||||
close();
|
||||
}
|
||||
|
||||
void DialogPatternProperties::Write(const QString &tagName, const QString &text) const
|
||||
{
|
||||
QDomNodeList nodeList = doc->elementsByTagName(tagName);
|
||||
if (nodeList.isEmpty())
|
||||
{
|
||||
QDomElement pattern = doc->documentElement();
|
||||
|
||||
QDomElement tag = doc->createElement(tagName);
|
||||
QDomText domText = doc->createTextNode(text);
|
||||
tag.appendChild(domText);
|
||||
//Old pattern file doesn't have comment. But here we try insert tag after first child (comment).
|
||||
// <pattern>
|
||||
// <!--Valentina pattern format.-->
|
||||
// -->place for new tag<--
|
||||
// </pattern>
|
||||
if (pattern.firstChild().isComment())
|
||||
{
|
||||
pattern.insertAfter(tag, pattern.firstChild());
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern.insertBefore(tag, pattern.firstChild());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QDomElement oldTag = nodeList.at(0).toElement();
|
||||
if (oldTag.isElement())
|
||||
{
|
||||
QDomElement newTag = doc->createElement(tagName);
|
||||
QDomText domText = doc->createTextNode(text);
|
||||
newTag.appendChild(domText);
|
||||
|
||||
QDomElement pattern = doc->documentElement();
|
||||
pattern.replaceChild(newTag, oldTag);
|
||||
}
|
||||
}
|
||||
}
|
56
src/dialogs/dialogpatternproperties.h
Normal file
56
src/dialogs/dialogpatternproperties.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpatternproperties.h
|
||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||
** @date 18 2, 2014
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013 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 DIALOGPATTERNPROPERTIES_H
|
||||
#define DIALOGPATTERNPROPERTIES_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "../xml/vdomdocument.h"
|
||||
|
||||
namespace Ui {
|
||||
class DialogPatternProperties;
|
||||
}
|
||||
|
||||
class DialogPatternProperties : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DialogPatternProperties(VDomDocument *doc, QWidget *parent = 0);
|
||||
virtual ~DialogPatternProperties();
|
||||
signals:
|
||||
void haveChange();
|
||||
public slots:
|
||||
void Apply();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPatternProperties)
|
||||
Ui::DialogPatternProperties *ui;
|
||||
VDomDocument *doc;
|
||||
void Write(const QString &tagName, const QString &text) const;
|
||||
};
|
||||
|
||||
#endif // DIALOGPATTERNPROPERTIES_H
|
110
src/dialogs/dialogpatternproperties.ui
Normal file
110
src/dialogs/dialogpatternproperties.ui
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogPatternProperties</class>
|
||||
<widget class="QDialog" name="DialogPatternProperties">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>646</width>
|
||||
<height>605</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Pattern properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Author name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditAuthor"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Pattern description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditDescription">
|
||||
<property name="documentTitle">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>For technical notes.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="plainTextEditTechNotes"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogPatternProperties</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogPatternProperties</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -52,5 +52,6 @@
|
|||
#include "dialogtriangle.h"
|
||||
#include "dialogpointofintersection.h"
|
||||
#include "configdialog.h"
|
||||
#include "dialogpatternproperties.h"
|
||||
|
||||
#endif // DIALOGS_H
|
||||
|
|
|
@ -24,7 +24,8 @@ HEADERS += \
|
|||
src/dialogs/dialoguniondetails.h \
|
||||
src/dialogs/dialogcutarc.h \
|
||||
src/dialogs/configdialog.h \
|
||||
src/dialogs/pages.h
|
||||
src/dialogs/pages.h \
|
||||
src/dialogs/dialogpatternproperties.h
|
||||
|
||||
SOURCES += \
|
||||
src/dialogs/dialogtriangle.cpp \
|
||||
|
@ -51,7 +52,8 @@ SOURCES += \
|
|||
src/dialogs/dialoguniondetails.cpp \
|
||||
src/dialogs/dialogcutarc.cpp \
|
||||
src/dialogs/configdialog.cpp \
|
||||
src/dialogs/pages.cpp
|
||||
src/dialogs/pages.cpp \
|
||||
src/dialogs/dialogpatternproperties.cpp
|
||||
|
||||
FORMS += \
|
||||
src/dialogs/dialogtriangle.ui \
|
||||
|
@ -75,4 +77,5 @@ FORMS += \
|
|||
src/dialogs/dialogcutspline.ui \
|
||||
src/dialogs/dialogcutsplinepath.ui \
|
||||
src/dialogs/dialoguniondetails.ui \
|
||||
src/dialogs/dialogcutarc.ui
|
||||
src/dialogs/dialogcutarc.ui \
|
||||
src/dialogs/dialogpatternproperties.ui
|
||||
|
|
20
src/main.cpp
20
src/main.cpp
|
@ -94,9 +94,27 @@ int main(int argc, char *argv[])
|
|||
app.installTranslator(&qtTranslator);
|
||||
|
||||
QTranslator appTranslator;
|
||||
appTranslator.load("valentina_" + checkedLocale, translationsPath);
|
||||
#ifdef Q_OS_WIN32
|
||||
appTranslator.load("valentina_" + checkedLocale, "."+translationsPath);
|
||||
#else
|
||||
#ifdef QT_DEBUG
|
||||
appTranslator.load("valentina_" + checkedLocale, "."+translationsPath);
|
||||
#else
|
||||
appTranslator.load("valentina_" + checkedLocale, translationsPath);
|
||||
#endif
|
||||
#endif
|
||||
app.installTranslator(&appTranslator);
|
||||
|
||||
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
||||
if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
|
||||
{
|
||||
//If there is no default working icon theme then we should
|
||||
//use an icon theme that we provide via a .qrc file
|
||||
//This case happens under Windows and Mac OS X
|
||||
//This does not happen under GNOME or KDE
|
||||
QIcon::setThemeName("win.icon.theme");
|
||||
}
|
||||
|
||||
MainWindow w;
|
||||
w.setWindowState(w.windowState() ^ Qt::WindowMaximized);
|
||||
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));
|
||||
|
|
|
@ -545,6 +545,12 @@ void MainWindow::OpenRecentFile()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::PatternProperties()
|
||||
{
|
||||
DialogPatternProperties proper(doc, this);
|
||||
proper.exec();
|
||||
}
|
||||
|
||||
void MainWindow::showEvent( QShowEvent *event )
|
||||
{
|
||||
QMainWindow::showEvent( event );
|
||||
|
@ -988,6 +994,7 @@ void MainWindow::Clear()
|
|||
comboBoxDraws->clear();
|
||||
ui->actionOptionDraw->setEnabled(false);
|
||||
ui->actionSave->setEnabled(false);
|
||||
ui->actionPattern_properties->setEnabled(false);
|
||||
SetEnableTool(false);
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1092,8 @@ void MainWindow::ActionLayout(bool checked)
|
|||
QPainterPath path = VEquidistant().ContourPath(idetail.key(), pattern);
|
||||
listDetails.append(new VItem(path, listDetails.size()));
|
||||
}
|
||||
emit ModelChosen(listDetails, curFile);
|
||||
QString description = doc->UniqueTagText("description");
|
||||
emit ModelChosen(listDetails, curFile, description);
|
||||
}
|
||||
|
||||
void MainWindow::ClosedActionHistory()
|
||||
|
@ -1374,19 +1382,6 @@ void MainWindow::CreateMenus()
|
|||
void MainWindow::CreateActions()
|
||||
{
|
||||
ui->setupUi(this);
|
||||
static const char * GENERIC_ICON_TO_CHECK = "document-open";
|
||||
if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false)
|
||||
{
|
||||
//If there is no default working icon theme then we should
|
||||
//use an icon theme that we provide via a .qrc file
|
||||
//This case happens under Windows and Mac OS X
|
||||
//This does not happen under GNOME or KDE
|
||||
QIcon::setThemeName("win.icon.theme");
|
||||
ui->actionNew->setIcon(QIcon::fromTheme("document-new"));
|
||||
ui->actionOpen->setIcon(QIcon::fromTheme("document-open"));
|
||||
ui->actionSave->setIcon(QIcon::fromTheme("document-save"));
|
||||
ui->actionSaveAs->setIcon(QIcon::fromTheme("document-save-as"));
|
||||
}
|
||||
|
||||
connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::ActionAroowTool);
|
||||
connect(ui->actionDraw, &QAction::triggered, this, &MainWindow::ActionDraw);
|
||||
|
@ -1402,6 +1397,8 @@ void MainWindow::CreateActions()
|
|||
connect(ui->actionAbout_Valentina, &QAction::triggered, this, &MainWindow::About);
|
||||
connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close);
|
||||
connect(ui->actionOptions, &QAction::triggered, this, &MainWindow::Options);
|
||||
connect(ui->actionPattern_properties, &QAction::triggered, this, &MainWindow::PatternProperties);
|
||||
ui->actionPattern_properties->setEnabled(false);
|
||||
|
||||
//Actions for recent files loaded by a main window application.
|
||||
for (int i = 0; i < MaxRecentFiles; ++i)
|
||||
|
@ -1475,6 +1472,7 @@ void MainWindow::LoadPattern(const QString &fileName)
|
|||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
ui->actionPattern_properties->setEnabled(true);
|
||||
}
|
||||
catch (const VExceptionObjectError &e)
|
||||
{
|
||||
|
|
|
@ -362,12 +362,14 @@ public slots:
|
|||
*/
|
||||
void tableClosed();
|
||||
void OpenRecentFile();
|
||||
void PatternProperties();
|
||||
signals:
|
||||
/**
|
||||
* @brief ModelChosen emit after calculation all details.
|
||||
* @param listDetails list of details.
|
||||
* @param description pattern description.
|
||||
*/
|
||||
void ModelChosen(QVector<VItem*> listDetails, const QString &curFile);
|
||||
void ModelChosen(QVector<VItem*> listDetails, const QString &curFile, const QString &description);
|
||||
protected:
|
||||
/**
|
||||
* @brief keyPressEvent handle key press events.
|
||||
|
|
|
@ -302,7 +302,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<width>137</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -378,7 +378,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<width>137</width>
|
||||
<height>104</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -579,7 +579,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<width>137</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -695,6 +695,7 @@
|
|||
<addaction name="actionHistory"/>
|
||||
<addaction name="actionLayout"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPattern_properties"/>
|
||||
<addaction name="actionOptions"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
|
@ -993,6 +994,11 @@
|
|||
<string>Options...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPattern_properties">
|
||||
<property name="text">
|
||||
<string>Pattern properties</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<tabstops>
|
||||
|
|
|
@ -37,7 +37,7 @@ TableWindow::TableWindow(QWidget *parent)
|
|||
:QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow),
|
||||
listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), tableScene(0),
|
||||
paper(0), shadowPaper(0), listOutItems(0), listCollidingItems(QList<QGraphicsItem*>()),
|
||||
indexDetail(0), sceneRect(QRectF()), fileName(QString())
|
||||
indexDetail(0), sceneRect(QRectF()), fileName(QString()), description(QString())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
numberDetal = new QLabel(tr("0 details left."), this);
|
||||
|
@ -118,10 +118,13 @@ void TableWindow::AddDetail()
|
|||
/*
|
||||
* Get details for creation layout.
|
||||
*/
|
||||
void TableWindow::ModelChosen(QVector<VItem*> listDetails, const QString &fileName)
|
||||
void TableWindow::ModelChosen(QVector<VItem*> listDetails, const QString &fileName, const QString &description)
|
||||
{
|
||||
this->fileName = fileName;
|
||||
this->fileName.remove(this->fileName.size()-4, 4);
|
||||
this->description = description;
|
||||
|
||||
QFileInfo fi( fileName );
|
||||
this->fileName = fi.baseName();
|
||||
|
||||
this->listDetails = listDetails;
|
||||
listOutItems = new QBitArray(this->listDetails.count());
|
||||
AddPaper();
|
||||
|
@ -183,7 +186,7 @@ void TableWindow::saveScene()
|
|||
|
||||
QString sf;
|
||||
// the save function
|
||||
QString dir = QDir::homePath()+fileName;
|
||||
QString dir = QDir::homePath()+"/"+fileName;
|
||||
QString name = QFileDialog::getSaveFileName(this, tr("Save layout"), dir, saveMessage, &sf);
|
||||
|
||||
if (name.isEmpty())
|
||||
|
@ -207,34 +210,35 @@ void TableWindow::saveScene()
|
|||
QFileInfo fi( name );
|
||||
QStringList suffix;
|
||||
suffix << "svg" << "png" << "pdf" << "eps" << "ps";
|
||||
switch (suffix.indexOf(fi.suffix())) {
|
||||
case 0:
|
||||
switch (suffix.indexOf(fi.suffix()))
|
||||
{
|
||||
case 0: //svg
|
||||
paper->setVisible(false);
|
||||
SvgFile(name);
|
||||
paper->setVisible(true);
|
||||
break;
|
||||
case 1:
|
||||
case 1: //png
|
||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||
PngFile(name);
|
||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||
break;
|
||||
case 2:
|
||||
case 2: //pdf
|
||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||
PdfFile(name);
|
||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||
break;
|
||||
case 3:
|
||||
case 3: //eps
|
||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||
EpsFile(name);
|
||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||
break;
|
||||
case 4:
|
||||
case 4: //ps
|
||||
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
|
||||
PsFile(name);
|
||||
paper->setPen(QPen(Qt::black, widthMainLine));
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Bad file suffix in TableWindow::saveScene().";
|
||||
qWarning() << "Bad file suffix"<<Q_FUNC_INFO;
|
||||
break;
|
||||
}
|
||||
brush->setColor( QColor( Qt::gray ) );
|
||||
|
@ -421,11 +425,9 @@ void TableWindow::SvgFile(const QString &name) const
|
|||
QSvgGenerator generator;
|
||||
generator.setFileName(name);
|
||||
generator.setSize(paper->rect().size().toSize());
|
||||
generator.setTitle(tr("SVG Generator Example Drawing"));
|
||||
generator.setDescription(tr("An SVG drawing created by the SVG Generator "
|
||||
"Example provided with Qt."));
|
||||
generator.setTitle("Valentina pattern");
|
||||
generator.setDescription(description);
|
||||
generator.setResolution(PrintDPI);
|
||||
qDebug()<<"resolution is" << generator.resolution();
|
||||
QPainter painter;
|
||||
painter.begin(&generator);
|
||||
painter.setFont( QFont( "Arial", 8, QFont::Normal ) );
|
||||
|
@ -480,75 +482,58 @@ void TableWindow::PdfFile(const QString &name) const
|
|||
void TableWindow::EpsFile(const QString &name) const
|
||||
{
|
||||
QTemporaryFile tmp;
|
||||
if (tmp.open()) {
|
||||
QProcess proc;
|
||||
QString program;
|
||||
QStringList params;
|
||||
|
||||
if (tmp.open())
|
||||
{
|
||||
PdfFile(tmp.fileName());
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
program = "pdftops.exe";
|
||||
#else
|
||||
program = "pdftops";
|
||||
#endif
|
||||
QStringList params;
|
||||
params << "-eps" << tmp.fileName() << name;
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
proc.start(program, params);
|
||||
proc.waitForFinished(15000);
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
qDebug() << proc.errorString();
|
||||
|
||||
QFile F(name);
|
||||
if(!F.exists())
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Critical, "Critical error!",
|
||||
"Creating file '"+name+"' failed!",
|
||||
QMessageBox::Ok | QMessageBox::Default);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
PdfToPs(name, params);
|
||||
}
|
||||
}
|
||||
|
||||
void TableWindow::PsFile(const QString &name) const
|
||||
{
|
||||
QTemporaryFile tmp;
|
||||
if (tmp.open()) {
|
||||
QProcess proc;
|
||||
QString program;
|
||||
QStringList params;
|
||||
|
||||
if (tmp.open())
|
||||
{
|
||||
PdfFile(tmp.fileName());
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
program = "pdftops.exe";
|
||||
#else
|
||||
program = "pdftops";
|
||||
#endif
|
||||
QStringList params;
|
||||
params << tmp.fileName() << name;
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
proc.start(program, params);
|
||||
proc.waitForFinished(15000);
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
qDebug() << proc.errorString();
|
||||
|
||||
QFile F(name);
|
||||
if(!F.exists())
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Critical, "Critical error!",
|
||||
"Creating file '"+name+"' failed!",
|
||||
QMessageBox::Ok | QMessageBox::Default);
|
||||
msgBox.exec();
|
||||
}
|
||||
}
|
||||
|
||||
PdfToPs(name, params);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO delete parametr name and use last parameter in string list instead.
|
||||
void TableWindow::PdfToPs(const QString &name, const QStringList ¶ms) const
|
||||
{
|
||||
QProcess proc;
|
||||
QString program;
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
program = "pdftops.exe";
|
||||
#else
|
||||
program = "pdftops";
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
#endif
|
||||
proc.start(program, params);
|
||||
proc.waitForFinished(15000);
|
||||
#ifndef QT_NO_CURSOR
|
||||
QApplication::restoreOverrideCursor();
|
||||
#endif
|
||||
qDebug() << proc.errorString();
|
||||
|
||||
QFile f(name);
|
||||
if (!f.exists())
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Critical, "Critical error!", "Creating file '"+name+"' failed!",
|
||||
QMessageBox::Ok | QMessageBox::Default);
|
||||
msgBox.exec();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,9 @@ public slots:
|
|||
/**
|
||||
* @brief ModelChosen show window when user want create new layout.
|
||||
* @param listDetails list of details.
|
||||
* @param description pattern description.
|
||||
*/
|
||||
void ModelChosen(QVector<VItem*> listDetails, const QString &fileName);
|
||||
void ModelChosen(QVector<VItem*> listDetails, const QString &fileName, const QString &description);
|
||||
/**
|
||||
* @brief StopTable stop creation layout.
|
||||
*/
|
||||
|
@ -193,6 +194,10 @@ private:
|
|||
* @brief fileName keep name of pattern file.
|
||||
*/
|
||||
QString fileName;
|
||||
/**
|
||||
* @brief description pattern description
|
||||
*/
|
||||
QString description;
|
||||
/**
|
||||
* @brief SvgFile save layout to svg file.
|
||||
* @param name name layout file.
|
||||
|
@ -218,6 +223,13 @@ private:
|
|||
* @param name name layout file.
|
||||
*/
|
||||
void PsFile(const QString &name)const;
|
||||
/**
|
||||
* @brief PdfToPs use external tool "pdftops" for converting pdf too eps or ps format.
|
||||
* @param name name output file.
|
||||
* @param params string with parameter for tool. Parameters have format: "-eps input_file out_file". Use -eps when
|
||||
* need create eps file.
|
||||
*/
|
||||
void PdfToPs(const QString &name, const QStringList ¶ms)const;
|
||||
};
|
||||
|
||||
#endif // TABLEWINDOW_H
|
||||
|
|
|
@ -125,15 +125,25 @@ bool VDomDocument::find(const QDomElement &node, const QString& id)
|
|||
|
||||
void VDomDocument::CreateEmptyFile()
|
||||
{
|
||||
QDomElement domElement = this->createElement("pattern");
|
||||
QDomElement patternElement = this->createElement("pattern");
|
||||
this->appendChild(patternElement);
|
||||
|
||||
this->appendChild(domElement);
|
||||
QDomComment info = this->createComment("Valentina pattern format.");
|
||||
domElement.appendChild(info);
|
||||
patternElement.appendChild(info);
|
||||
QDomNode xmlNode = this->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"");
|
||||
this->insertBefore(xmlNode, this->firstChild());
|
||||
|
||||
QDomElement authorElement = this->createElement("author");
|
||||
patternElement.appendChild(authorElement);
|
||||
|
||||
QDomElement descElement = this->createElement("description");
|
||||
patternElement.appendChild(descElement);
|
||||
|
||||
QDomElement notesElement = this->createElement("notes");
|
||||
patternElement.appendChild(notesElement);
|
||||
|
||||
QDomElement incrElement = this->createElement("increments");
|
||||
domElement.appendChild(incrElement);
|
||||
patternElement.appendChild(incrElement);
|
||||
}
|
||||
|
||||
bool VDomDocument::CheckNameDraw(const QString& name) const
|
||||
|
@ -1364,6 +1374,28 @@ void VDomDocument::setPatternModified(bool value)
|
|||
patternModified = value;
|
||||
}
|
||||
|
||||
QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal)
|
||||
{
|
||||
QDomNodeList nodeList = this->elementsByTagName(tagName);
|
||||
if (nodeList.isEmpty())
|
||||
{
|
||||
return defVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
QDomNode domNode = nodeList.at(0);
|
||||
if (domNode.isNull() == false && domNode.isElement())
|
||||
{
|
||||
QDomElement domElement = domNode.toElement();
|
||||
if (domElement.isNull() == false)
|
||||
{
|
||||
return domElement.text();
|
||||
}
|
||||
}
|
||||
}
|
||||
return defVal;
|
||||
}
|
||||
|
||||
|
||||
void VDomDocument::setCursor(const qint64 &value)
|
||||
{
|
||||
|
|
|
@ -241,6 +241,7 @@ public:
|
|||
qint64 SPointActiveDraw();
|
||||
bool isPatternModified() const;
|
||||
void setPatternModified(bool value);
|
||||
QString UniqueTagText(const QString &tagName, const QString &defVal = QString());
|
||||
signals:
|
||||
/**
|
||||
* @brief ChangedActivDraw change active pattern peace.
|
||||
|
|
Loading…
Reference in New Issue
Block a user