diff --git a/README b/README
index ae3363403..e0155f143 100644
--- a/README
+++ b/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.
diff --git a/Valentina.pro b/Valentina.pro
index b5500b1b6..f13d13f7b 100644
--- a/Valentina.pro
+++ b/Valentina.pro
@@ -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)
}
diff --git a/dist/debian/control b/dist/debian/control
index 2a545b20f..9ea5418ac 100644
--- a/dist/debian/control
+++ b/dist/debian/control
@@ -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.
diff --git a/share/resources/icon/logo.svg b/share/resources/icon/logo.svg
new file mode 100644
index 000000000..9c099f2a7
--- /dev/null
+++ b/share/resources/icon/logo.svg
@@ -0,0 +1,28855 @@
+
+
+
+
diff --git a/share/resources/schema/pattern.xsd b/share/resources/schema/pattern.xsd
index 76237f457..8c8394d6a 100644
--- a/share/resources/schema/pattern.xsd
+++ b/share/resources/schema/pattern.xsd
@@ -3,7 +3,10 @@
-
+
+
+
+
diff --git a/src/dialogs/dialogpatternproperties.cpp b/src/dialogs/dialogpatternproperties.cpp
new file mode 100644
index 000000000..82527f731
--- /dev/null
+++ b/src/dialogs/dialogpatternproperties.cpp
@@ -0,0 +1,114 @@
+/************************************************************************
+ **
+ ** @file dialogpatternproperties.cpp
+ ** @author Roman Telezhinsky
+ ** @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
+ ** 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 .
+ **
+ *************************************************************************/
+
+#include "dialogpatternproperties.h"
+#include "ui_dialogpatternproperties.h"
+#include
+
+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).
+ //
+ //
+ // -->place for new tag<--
+ //
+ 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);
+ }
+ }
+}
diff --git a/src/dialogs/dialogpatternproperties.h b/src/dialogs/dialogpatternproperties.h
new file mode 100644
index 000000000..d65c834d8
--- /dev/null
+++ b/src/dialogs/dialogpatternproperties.h
@@ -0,0 +1,56 @@
+/************************************************************************
+ **
+ ** @file dialogpatternproperties.h
+ ** @author Roman Telezhinsky
+ ** @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
+ ** 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 .
+ **
+ *************************************************************************/
+
+#ifndef DIALOGPATTERNPROPERTIES_H
+#define DIALOGPATTERNPROPERTIES_H
+
+#include
+#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
diff --git a/src/dialogs/dialogpatternproperties.ui b/src/dialogs/dialogpatternproperties.ui
new file mode 100644
index 000000000..a30244f29
--- /dev/null
+++ b/src/dialogs/dialogpatternproperties.ui
@@ -0,0 +1,110 @@
+
+
+ DialogPatternProperties
+
+
+
+ 0
+ 0
+ 646
+ 605
+
+
+
+ Pattern properties
+
+
+ -
+
+
-
+
+
+ Author name
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+ Pattern description
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ For technical notes.
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ DialogPatternProperties
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DialogPatternProperties
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h
index ace57ca71..42bc0aa48 100644
--- a/src/dialogs/dialogs.h
+++ b/src/dialogs/dialogs.h
@@ -52,5 +52,6 @@
#include "dialogtriangle.h"
#include "dialogpointofintersection.h"
#include "configdialog.h"
+#include "dialogpatternproperties.h"
#endif // DIALOGS_H
diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri
index 747b7005a..8796a0c47 100644
--- a/src/dialogs/dialogs.pri
+++ b/src/dialogs/dialogs.pri
@@ -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
diff --git a/src/main.cpp b/src/main.cpp
index a1d245f40..f64c4174b 100644
--- a/src/main.cpp
+++ b/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"));
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 9ff71597e..4bdadaddb 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -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)
{
diff --git a/src/mainwindow.h b/src/mainwindow.h
index c37f23667..75c4f7f81 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -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 listDetails, const QString &curFile);
+ void ModelChosen(QVector listDetails, const QString &curFile, const QString &description);
protected:
/**
* @brief keyPressEvent handle key press events.
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 5d5d63a7d..f983b2945 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -302,7 +302,7 @@
0
0
- 100
+ 137
58
@@ -378,7 +378,7 @@
0
0
- 100
+ 137
104
@@ -579,7 +579,7 @@
0
0
- 100
+ 137
58
@@ -695,6 +695,7 @@
+
@@ -993,6 +994,11 @@
Options...
+
+
+ Pattern properties
+
+
diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp
index 3eaf9abf2..3af48a8e4 100644
--- a/src/tablewindow.cpp
+++ b/src/tablewindow.cpp
@@ -37,7 +37,7 @@ TableWindow::TableWindow(QWidget *parent)
:QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow),
listDetails(QVector()), outItems(false), collidingItems(false), tableScene(0),
paper(0), shadowPaper(0), listOutItems(0), listCollidingItems(QList()),
- 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 listDetails, const QString &fileName)
+void TableWindow::ModelChosen(QVector 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"<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();
+ }
}
diff --git a/src/tablewindow.h b/src/tablewindow.h
index 519867258..00e6a6a0c 100644
--- a/src/tablewindow.h
+++ b/src/tablewindow.h
@@ -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 listDetails, const QString &fileName);
+ void ModelChosen(QVector 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
diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp
index ae80d59f1..2af908437 100644
--- a/src/xml/vdomdocument.cpp
+++ b/src/xml/vdomdocument.cpp
@@ -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)
{
diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h
index 91180195a..e808e614e 100644
--- a/src/xml/vdomdocument.h
+++ b/src/xml/vdomdocument.h
@@ -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.