Fixed issue #17.

--HG--
branch : develop
This commit is contained in:
dismine 2014-02-19 15:50:43 +02:00
parent 827dc1f77e
commit e302432474
4 changed files with 19 additions and 11 deletions

View File

@ -1092,7 +1092,8 @@ void MainWindow::ActionLayout(bool checked)
QPainterPath path = VEquidistant().ContourPath(idetail.key(), pattern); QPainterPath path = VEquidistant().ContourPath(idetail.key(), pattern);
listDetails.append(new VItem(path, listDetails.size())); listDetails.append(new VItem(path, listDetails.size()));
} }
emit ModelChosen(listDetails, curFile); QString description = doc->UniqueTagText("description");
emit ModelChosen(listDetails, curFile, description);
} }
void MainWindow::ClosedActionHistory() void MainWindow::ClosedActionHistory()

View File

@ -367,8 +367,9 @@ signals:
/** /**
* @brief ModelChosen emit after calculation all details. * @brief ModelChosen emit after calculation all details.
* @param listDetails list of 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: protected:
/** /**
* @brief keyPressEvent handle key press events. * @brief keyPressEvent handle key press events.

View File

@ -37,7 +37,7 @@ TableWindow::TableWindow(QWidget *parent)
:QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow), :QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow),
listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), tableScene(0), listDetails(QVector<VItem*>()), outItems(false), collidingItems(false), tableScene(0),
paper(0), shadowPaper(0), listOutItems(0), listCollidingItems(QList<QGraphicsItem*>()), 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); ui->setupUi(this);
numberDetal = new QLabel(tr("0 details left."), this); numberDetal = new QLabel(tr("0 details left."), this);
@ -118,10 +118,13 @@ void TableWindow::AddDetail()
/* /*
* Get details for creation layout. * 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->description = description;
this->fileName.remove(this->fileName.size()-4, 4);
QFileInfo fi( fileName );
this->fileName = fi.baseName();
this->listDetails = listDetails; this->listDetails = listDetails;
listOutItems = new QBitArray(this->listDetails.count()); listOutItems = new QBitArray(this->listDetails.count());
AddPaper(); AddPaper();
@ -422,11 +425,9 @@ void TableWindow::SvgFile(const QString &name) const
QSvgGenerator generator; QSvgGenerator generator;
generator.setFileName(name); generator.setFileName(name);
generator.setSize(paper->rect().size().toSize()); generator.setSize(paper->rect().size().toSize());
generator.setTitle(tr("SVG Generator Example Drawing")); generator.setTitle("Valentina pattern");
generator.setDescription(tr("An SVG drawing created by the SVG Generator " generator.setDescription(description);
"Example provided with Qt."));
generator.setResolution(PrintDPI); generator.setResolution(PrintDPI);
qDebug()<<"resolution is" << generator.resolution();
QPainter painter; QPainter painter;
painter.begin(&generator); painter.begin(&generator);
painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setFont( QFont( "Arial", 8, QFont::Normal ) );

View File

@ -63,8 +63,9 @@ public slots:
/** /**
* @brief ModelChosen show window when user want create new layout. * @brief ModelChosen show window when user want create new layout.
* @param listDetails list of details. * @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. * @brief StopTable stop creation layout.
*/ */
@ -193,6 +194,10 @@ private:
* @brief fileName keep name of pattern file. * @brief fileName keep name of pattern file.
*/ */
QString fileName; QString fileName;
/**
* @brief description pattern description
*/
QString description;
/** /**
* @brief SvgFile save layout to svg file. * @brief SvgFile save layout to svg file.
* @param name name layout file. * @param name name layout file.