Menu File->Export pattern (layout).

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-23 16:13:08 +03:00
parent fdc8031880
commit ba7f8f0507
5 changed files with 22 additions and 4 deletions

View File

@ -106,6 +106,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified); connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile); connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile);
connect(doc, &VPattern::SetEnabledGUI, this, &MainWindow::SetEnabledGUI); connect(doc, &VPattern::SetEnabledGUI, this, &MainWindow::SetEnabledGUI);
connect(doc, &VPattern::CheckLayout, this, &MainWindow::Layout);
connect(qApp->getUndoStack(), &QUndoStack::cleanChanged, this, &MainWindow::PatternWasModified); connect(qApp->getUndoStack(), &QUndoStack::cleanChanged, this, &MainWindow::PatternWasModified);
@ -1355,7 +1356,6 @@ void MainWindow::ActionDraw(bool checked)
ui->toolBox->setCurrentIndex(currentToolBoxIndex); ui->toolBox->setCurrentIndex(currentToolBoxIndex);
ui->actionHistory->setEnabled(true); ui->actionHistory->setEnabled(true);
ui->actionLayout->setEnabled(false);
ui->actionOptionDraw->setEnabled(true); ui->actionOptionDraw->setEnabled(true);
ui->actionNewDraw->setEnabled(true); ui->actionNewDraw->setEnabled(true);
} }
@ -1394,7 +1394,6 @@ void MainWindow::ActionDetails(bool checked)
ui->toolBox->setCurrentIndex(4); ui->toolBox->setCurrentIndex(4);
ui->actionHistory->setEnabled(false); ui->actionHistory->setEnabled(false);
ui->actionLayout->setEnabled(true);
ui->actionOptionDraw->setEnabled(false); ui->actionOptionDraw->setEnabled(false);
ui->actionNewDraw->setEnabled(false); ui->actionNewDraw->setEnabled(false);
} }
@ -1521,6 +1520,7 @@ void MainWindow::Clear()
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
#endif #endif
Layout();
} }
void MainWindow::FullParseFile() void MainWindow::FullParseFile()
@ -1674,6 +1674,20 @@ void MainWindow::ClickEndVisualization()
EndVisualization(true); EndVisualization(true);
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::Layout()
{
const QHash<quint32, VDetail> *details = pattern->DataDetails();
if (details->size() > 0)
{
ui->actionLayout->setEnabled(true);
}
else
{
ui->actionLayout->setEnabled(false);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief NewPattern create new empty pattern. * @brief NewPattern create new empty pattern.

View File

@ -145,6 +145,7 @@ public slots:
void FullParseFile(); void FullParseFile();
void SetEnabledGUI(bool enabled); void SetEnabledGUI(bool enabled);
void ClickEndVisualization(); void ClickEndVisualization();
void Layout();
signals: signals:
/** /**
* @brief ModelChosen emit after calculation all details. * @brief ModelChosen emit after calculation all details.

View File

@ -676,6 +676,8 @@
<addaction name="actionSave"/> <addaction name="actionSave"/>
<addaction name="actionSaveAs"/> <addaction name="actionSaveAs"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionLayout"/>
<addaction name="separator"/>
<addaction name="actionPreferences"/> <addaction name="actionPreferences"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
@ -694,7 +696,6 @@
<addaction name="actionNewDraw"/> <addaction name="actionNewDraw"/>
<addaction name="actionOptionDraw"/> <addaction name="actionOptionDraw"/>
<addaction name="actionHistory"/> <addaction name="actionHistory"/>
<addaction name="actionLayout"/>
<addaction name="actionZoomIn"/> <addaction name="actionZoomIn"/>
<addaction name="actionZoomOut"/> <addaction name="actionZoomOut"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -987,7 +988,7 @@
<normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset> <normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Layout</string> <string>Export pattern (layout)</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Create layout</string> <string>Create layout</string>

View File

@ -308,6 +308,7 @@ void VPattern::Parse(const Document &parse)
} }
domNode = domNode.nextSibling(); domNode = domNode.nextSibling();
} }
emit CheckLayout();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -150,6 +150,7 @@ signals:
void ClearMainWindow(); void ClearMainWindow();
void UndoCommand(); void UndoCommand();
void SetEnabledGUI(bool enabled); void SetEnabledGUI(bool enabled);
void CheckLayout();
public slots: public slots:
void LiteParseTree(); void LiteParseTree();
void haveLiteChange(); void haveLiteChange();