Remember docks settings.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-04-06 14:40:44 +03:00
parent 9c63c4f794
commit fe3bd88c17
5 changed files with 69 additions and 12 deletions

View File

@ -112,7 +112,10 @@ MainWindow::MainWindow(QWidget *parent)
dialogTable(nullptr),
dialogTool(nullptr),
dialogHistory(nullptr), comboBoxDraws(nullptr), patternPieceLabel(nullptr), mode(Draw::Calculation),
currentDrawIndex(0), currentToolBoxIndex(0), drawMode(true), recentFileActs(),
currentDrawIndex(0), currentToolBoxIndex(0),
isDockToolOptionsVisible(true),
isDockGroupsVisible(true),
drawMode(true), recentFileActs(),
separatorAct(nullptr),
leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true),
gradationHeights(nullptr), gradationSizes(nullptr), gradationHeightsLabel(nullptr), gradationSizesLabel(nullptr),
@ -2061,7 +2064,8 @@ void MainWindow::ActionDraw(bool checked)
}
ui->dockWidgetLayoutPages->setVisible(false);
ui->dockWidgetToolOptions->setVisible(true);
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
}
else
{
@ -2130,7 +2134,8 @@ void MainWindow::ActionDetails(bool checked)
}
ui->dockWidgetLayoutPages->setVisible(false);
ui->dockWidgetToolOptions->setVisible(true);
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
helpLabel->setText("");
}
@ -2207,7 +2212,14 @@ void MainWindow::ActionLayout(bool checked)
}
ui->dockWidgetLayoutPages->setVisible(true);
ui->dockWidgetToolOptions->blockSignals(true);
ui->dockWidgetToolOptions->setVisible(false);
ui->dockWidgetToolOptions->blockSignals(false);
ui->dockWidgetGroups->blockSignals(true);
ui->dockWidgetGroups->setVisible(false);
ui->dockWidgetGroups->blockSignals(false);
ShowPaper(ui->listWidget->currentRow());
@ -2704,6 +2716,7 @@ void MainWindow::SetEnableWidgets(bool enable)
ui->actionUnloadMeasurements->setEnabled(enable && designStage);
actionDockWidgetToolOptions->setEnabled(enable && designStage);
actionDockWidgetGroups->setEnabled(enable && designStage);
undoAction->setEnabled(enable && designStage && qApp->getUndoStack()->canUndo());
redoAction->setEnabled(enable && designStage && qApp->getUndoStack()->canRedo());
@ -2911,6 +2924,18 @@ void MainWindow::ChangedHeight(const QString &text)
}
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::DockToolOptionsVisibilityChanged(bool visible)
{
isDockToolOptionsVisible = visible;
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::DockGropsVisibilityChanged(bool visible)
{
isDockGroupsVisible = visible;
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetDefaultHeight()
{
@ -3229,6 +3254,9 @@ void MainWindow::ReadSettings()
// Text under tool buton icon
ToolBarStyles();
isDockToolOptionsVisible = ui->dockWidgetToolOptions->isVisible();
isDockGroupsVisible = ui->dockWidgetGroups->isVisible();
}
//---------------------------------------------------------------------------------------------------------------------
@ -3335,13 +3363,6 @@ void MainWindow::CreateMenus()
separatorAct->setSeparator(true);
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, separatorAct);
//Add dock
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions);
separatorAct = new QAction(this);
separatorAct->setSeparator(true);
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, separatorAct);
AddDocks();
}
@ -3514,7 +3535,15 @@ void MainWindow::LastUsedTool()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::AddDocks()
{
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, ui->dockWidgetToolOptions->toggleViewAction());
//Add dock
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions);
connect(ui->dockWidgetToolOptions, &QDockWidget::visibilityChanged, this,
&MainWindow::DockToolOptionsVisibilityChanged);
actionDockWidgetGroups = ui->dockWidgetGroups->toggleViewAction();
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetGroups);
connect(ui->dockWidgetGroups, &QDockWidget::visibilityChanged, this, &MainWindow::DockGropsVisibilityChanged);
separatorAct = new QAction(this);
separatorAct->setSeparator(true);

View File

@ -204,6 +204,9 @@ private slots:
void ChangedSize(const QString &text);
void ChangedHeight(const QString & text);
void DockToolOptionsVisibilityChanged(bool visible);
void DockGropsVisibilityChanged(bool visible);
private:
Q_DISABLE_COPY(MainWindow)
/** @brief ui keeps information about user interface */
@ -255,6 +258,9 @@ private:
/** @brief currentToolBoxIndex save current set of tools. */
qint32 currentToolBoxIndex;
bool isDockToolOptionsVisible;
bool isDockGroupsVisible;
/** @brief drawMode true if we current draw scene. */
bool drawMode;

View File

@ -938,6 +938,14 @@
</layout>
</widget>
<widget class="QWidget" name="page_7">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<height>356</height>
</rect>
</property>
<attribute name="icon">
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
<normaloff>:/icon/16x16/operations.png</normaloff>:/icon/16x16/operations.png</iconset>
@ -1455,6 +1463,18 @@
</layout>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidgetGroups">
<property name="enabled">
<bool>true</bool>
</property>
<property name="windowTitle">
<string>Groups</string>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents_2"/>
</widget>
<action name="actionNew">
<property name="icon">
<iconset theme="document-new">

View File

@ -60,7 +60,8 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
: QMainWindow(parent), listDetails(QVector<VLayoutDetail>()), currentScene(nullptr), tempSceneLayout(nullptr),
pattern(new VContainer(qApp->TrVars(), qApp->patternUnitP())), doc(nullptr), papers(QList<QGraphicsItem *>()),
shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()),
undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), curFile(QString()),
undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr),
curFile(QString()),
isLayoutStale(true), margins(), paperSize(), isTiled(false)
{
InitTempLayoutScene();

View File

@ -83,6 +83,7 @@ protected:
QAction *undoAction;
QAction *redoAction;
QAction *actionDockWidgetToolOptions;
QAction *actionDockWidgetGroups;
/** @brief fileName name current pattern file. */
QString curFile;