From ba7f8f05070f26a661231bd896827f657fc9c9fd Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 23 Jul 2014 16:13:08 +0300 Subject: [PATCH] Menu File->Export pattern (layout). --HG-- branch : develop --- src/app/mainwindow.cpp | 18 ++++++++++++++++-- src/app/mainwindow.h | 1 + src/app/mainwindow.ui | 5 +++-- src/app/xml/vpattern.cpp | 1 + src/app/xml/vpattern.h | 1 + 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 207496c20..b4cdc7f5d 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -106,6 +106,7 @@ MainWindow::MainWindow(QWidget *parent) connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified); connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile); connect(doc, &VPattern::SetEnabledGUI, this, &MainWindow::SetEnabledGUI); + connect(doc, &VPattern::CheckLayout, this, &MainWindow::Layout); connect(qApp->getUndoStack(), &QUndoStack::cleanChanged, this, &MainWindow::PatternWasModified); @@ -1355,7 +1356,6 @@ void MainWindow::ActionDraw(bool checked) ui->toolBox->setCurrentIndex(currentToolBoxIndex); ui->actionHistory->setEnabled(true); - ui->actionLayout->setEnabled(false); ui->actionOptionDraw->setEnabled(true); ui->actionNewDraw->setEnabled(true); } @@ -1394,7 +1394,6 @@ void MainWindow::ActionDetails(bool checked) ui->toolBox->setCurrentIndex(4); ui->actionHistory->setEnabled(false); - ui->actionLayout->setEnabled(true); ui->actionOptionDraw->setEnabled(false); ui->actionNewDraw->setEnabled(false); } @@ -1521,6 +1520,7 @@ void MainWindow::Clear() #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif + Layout(); } void MainWindow::FullParseFile() @@ -1674,6 +1674,20 @@ void MainWindow::ClickEndVisualization() EndVisualization(true); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::Layout() +{ + const QHash *details = pattern->DataDetails(); + if (details->size() > 0) + { + ui->actionLayout->setEnabled(true); + } + else + { + ui->actionLayout->setEnabled(false); + } +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief NewPattern create new empty pattern. diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index 6a5107336..acd8d915e 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -145,6 +145,7 @@ public slots: void FullParseFile(); void SetEnabledGUI(bool enabled); void ClickEndVisualization(); + void Layout(); signals: /** * @brief ModelChosen emit after calculation all details. diff --git a/src/app/mainwindow.ui b/src/app/mainwindow.ui index 099170174..230000bc6 100644 --- a/src/app/mainwindow.ui +++ b/src/app/mainwindow.ui @@ -676,6 +676,8 @@ + + @@ -694,7 +696,6 @@ - @@ -987,7 +988,7 @@ :/icon/32x32/layout.png:/icon/32x32/layout.png - Layout + Export pattern (layout) Create layout diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index 98b1c4ce2..0205c083f 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -308,6 +308,7 @@ void VPattern::Parse(const Document &parse) } domNode = domNode.nextSibling(); } + emit CheckLayout(); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/xml/vpattern.h b/src/app/xml/vpattern.h index 9880aeda4..4ca4eac61 100644 --- a/src/app/xml/vpattern.h +++ b/src/app/xml/vpattern.h @@ -150,6 +150,7 @@ signals: void ClearMainWindow(); void UndoCommand(); void SetEnabledGUI(bool enabled); + void CheckLayout(); public slots: void LiteParseTree(); void haveLiteChange();