Fixed GUI issue. After full parse some widgets was incorrectly reseted.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-04-03 19:29:52 +03:00
parent e8eaac4064
commit c2fad3cde4
2 changed files with 37 additions and 57 deletions

View File

@ -1,4 +1,5 @@
# Version 0.4.4 # Version 0.4.4
- Fixed GUI issue. After full parse some widgets was incorrectly reseted.
- [#464] Crash. Issue with modeling node objects. - [#464] Crash. Issue with modeling node objects.
- [#463] Wrong export to DXF format. - [#463] Wrong export to DXF format.
- Fixed issue with deleting detail nodes. - Fixed issue with deleting detail nodes.

View File

@ -1855,30 +1855,14 @@ void MainWindow::ActionDraw(bool checked)
RestoreCurrentScene(); RestoreCurrentScene();
mode = Draw::Calculation; mode = Draw::Calculation;
comboBoxDraws->setEnabled(true);
comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace
drawMode = true; drawMode = true;
SetEnableTool(true); SetEnableTool(true);
SetEnableWidgets(true);
doc->setCurrentData(); doc->setCurrentData();
ui->toolBox->setCurrentIndex(currentToolBoxIndex); ui->toolBox->setCurrentIndex(currentToolBoxIndex);
ui->actionHistory->setEnabled(true);
ui->actionOptionDraw->setEnabled(true);
ui->actionNewDraw->setEnabled(true);
ui->actionTable->setEnabled(true);
ui->actionArrowTool->setEnabled(true);
ui->actionShowCurveDetails->setEnabled(true);
actionDockWidgetToolOptions->setEnabled(true);
if (qApp->getUndoStack()->canUndo())
{
undoAction->setEnabled(true);
}
if (qApp->getUndoStack()->canRedo())
{
redoAction->setEnabled(true);
}
if (qApp->patternType() == MeasurementsType::Standard) if (qApp->patternType() == MeasurementsType::Standard)
{ {
ui->toolBarOption->setVisible(true); ui->toolBarOption->setVisible(true);
@ -1938,7 +1922,6 @@ void MainWindow::ActionDetails(bool checked)
drawMode = false; drawMode = false;
} }
comboBoxDraws->setCurrentIndex(comboBoxDraws->count()-1); comboBoxDraws->setCurrentIndex(comboBoxDraws->count()-1);
comboBoxDraws->setEnabled(false);
if (mode == Draw::Calculation) if (mode == Draw::Calculation)
{ {
@ -1946,24 +1929,9 @@ void MainWindow::ActionDetails(bool checked)
} }
mode = Draw::Modeling; mode = Draw::Modeling;
SetEnableTool(true); SetEnableTool(true);
SetEnableWidgets(true);
ui->toolBox->setCurrentIndex(4); ui->toolBox->setCurrentIndex(4);
ui->actionHistory->setEnabled(false);
ui->actionOptionDraw->setEnabled(false);
ui->actionNewDraw->setEnabled(false);
ui->actionTable->setEnabled(false);
ui->actionArrowTool->setEnabled(true);
ui->actionShowCurveDetails->setEnabled(false);
actionDockWidgetToolOptions->setEnabled(true);
if (qApp->getUndoStack()->canUndo())
{
undoAction->setEnabled(true);
}
if (qApp->getUndoStack()->canRedo())
{
redoAction->setEnabled(true);
}
if (qApp->patternType() == MeasurementsType::Standard) if (qApp->patternType() == MeasurementsType::Standard)
{ {
ui->toolBarOption->setVisible(true); ui->toolBarOption->setVisible(true);
@ -2026,7 +1994,6 @@ void MainWindow::ActionLayout(bool checked)
drawMode = false; drawMode = false;
} }
comboBoxDraws->setCurrentIndex(-1); comboBoxDraws->setCurrentIndex(-1);
comboBoxDraws->setEnabled(false);
if (mode == Draw::Calculation) if (mode == Draw::Calculation)
{ {
@ -2034,17 +2001,9 @@ void MainWindow::ActionLayout(bool checked)
} }
mode = Draw::Layout; mode = Draw::Layout;
SetEnableTool(true); SetEnableTool(true);
SetEnableWidgets(true);
ui->toolBox->setCurrentIndex(5); ui->toolBox->setCurrentIndex(5);
ui->actionHistory->setEnabled(false);
ui->actionOptionDraw->setEnabled(false);
ui->actionNewDraw->setEnabled(false);
ui->actionArrowTool->setEnabled(false);
ui->actionTable->setEnabled(false);
ui->actionShowCurveDetails->setEnabled(false);
actionDockWidgetToolOptions->setEnabled(false);
undoAction->setEnabled(false);
redoAction->setEnabled(false);
mouseCoordinate->setText(""); mouseCoordinate->setText("");
if (qApp->patternType() == MeasurementsType::Standard) if (qApp->patternType() == MeasurementsType::Standard)
@ -2414,7 +2373,7 @@ void MainWindow::FullParseFile()
return; return;
} }
QString patternPiece = QString(); QString patternPiece;
if (comboBoxDraws->currentIndex() != -1) if (comboBoxDraws->currentIndex() != -1)
{ {
patternPiece = comboBoxDraws->itemText(comboBoxDraws->currentIndex()); patternPiece = comboBoxDraws->itemText(comboBoxDraws->currentIndex());
@ -2422,6 +2381,18 @@ void MainWindow::FullParseFile()
comboBoxDraws->blockSignals(true); comboBoxDraws->blockSignals(true);
comboBoxDraws->clear(); comboBoxDraws->clear();
comboBoxDraws->addItems(doc->getPatternPieces()); comboBoxDraws->addItems(doc->getPatternPieces());
if (not drawMode)
{
comboBoxDraws->setCurrentIndex(comboBoxDraws->count()-1);
}
else
{
const qint32 index = comboBoxDraws->findText(patternPiece);
if ( index != -1 )
{
comboBoxDraws->setCurrentIndex(index);
}
}
comboBoxDraws->blockSignals(false); comboBoxDraws->blockSignals(false);
ui->actionPattern_properties->setEnabled(true); ui->actionPattern_properties->setEnabled(true);
@ -2499,30 +2470,38 @@ void MainWindow::SetEnabledGUI(bool enabled)
*/ */
void MainWindow::SetEnableWidgets(bool enable) void MainWindow::SetEnableWidgets(bool enable)
{ {
comboBoxDraws->setEnabled(enable); const bool drawStage = (mode == Draw::Calculation);
ui->actionOptionDraw->setEnabled(enable); const bool designStage = (drawStage || mode == Draw::Modeling);
comboBoxDraws->setEnabled(enable && drawStage);
ui->actionOptionDraw->setEnabled(enable && drawStage);
if (enable && not curFile.isEmpty()) if (enable && not curFile.isEmpty())
{ {
ui->actionSave->setEnabled(enable); ui->actionSave->setEnabled(enable);
} }
ui->actionSaveAs->setEnabled(enable); ui->actionSaveAs->setEnabled(enable);
ui->actionPattern_properties->setEnabled(enable); ui->actionPattern_properties->setEnabled(enable && designStage);
ui->actionEdit_pattern_code->setEnabled(enable); ui->actionEdit_pattern_code->setEnabled(enable && designStage);
ui->actionZoomIn->setEnabled(enable); ui->actionZoomIn->setEnabled(enable);
ui->actionZoomOut->setEnabled(enable); ui->actionZoomOut->setEnabled(enable);
ui->actionArrowTool->setEnabled(enable); ui->actionArrowTool->setEnabled(enable && designStage);
ui->actionHistory->setEnabled(enable); ui->actionHistory->setEnabled(enable && drawStage);
ui->actionNewDraw->setEnabled(enable); ui->actionNewDraw->setEnabled(enable && drawStage);
ui->actionDraw->setEnabled(enable); ui->actionDraw->setEnabled(enable);
ui->actionDetails->setEnabled(enable); ui->actionDetails->setEnabled(enable);
ui->actionLayout->setEnabled(enable); ui->actionLayout->setEnabled(enable);
ui->actionTable->setEnabled(enable); ui->actionTable->setEnabled(enable && drawStage);
ui->actionZoomFitBest->setEnabled(enable); ui->actionZoomFitBest->setEnabled(enable);
ui->actionZoomOriginal->setEnabled(enable); ui->actionZoomOriginal->setEnabled(enable);
ui->actionShowCurveDetails->setEnabled(enable); ui->actionShowCurveDetails->setEnabled(enable && drawStage);
ui->actionLoadIndividual->setEnabled(enable); ui->actionLoadIndividual->setEnabled(enable && designStage);
ui->actionLoadStandard->setEnabled(enable); ui->actionLoadStandard->setEnabled(enable && designStage);
ui->actionUnloadMeasurements->setEnabled(enable); ui->actionUnloadMeasurements->setEnabled(enable && designStage);
actionDockWidgetToolOptions->setEnabled(enable && designStage);
undoAction->setEnabled(enable && designStage && qApp->getUndoStack()->canUndo());
redoAction->setEnabled(enable && designStage && qApp->getUndoStack()->canRedo());
//Now we don't want allow user call context menu //Now we don't want allow user call context menu
sceneDraw->SetDisableTools(!enable, doc->GetNameActivPP()); sceneDraw->SetDisableTools(!enable, doc->GetNameActivPP());