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);
listDetails.append(new VItem(path, listDetails.size()));
}
emit ModelChosen(listDetails, curFile);
QString description = doc->UniqueTagText("description");
emit ModelChosen(listDetails, curFile, description);
}
void MainWindow::ClosedActionHistory()

View File

@ -367,8 +367,9 @@ 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.

View File

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

View File

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