From e302432474793e9e4ad342ca8ff8523822f72660 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 19 Feb 2014 15:50:43 +0200 Subject: [PATCH] Fixed issue #17. --HG-- branch : develop --- src/mainwindow.cpp | 3 ++- src/mainwindow.h | 3 ++- src/tablewindow.cpp | 17 +++++++++-------- src/tablewindow.h | 7 ++++++- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 422ce942d..ebfa78881 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1092,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() diff --git a/src/mainwindow.h b/src/mainwindow.h index 9aa9233a9..75c4f7f81 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -367,8 +367,9 @@ 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/tablewindow.cpp b/src/tablewindow.cpp index c56707309..f5d82e68e 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(); @@ -422,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 ) ); diff --git a/src/tablewindow.h b/src/tablewindow.h index fea934939..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.