#4410 Dock Window State : Restore dock widgets when opening main window

This commit is contained in:
Magne Sjaastad 2019-05-15 13:54:05 +02:00
parent a52afd7b34
commit bfe8e7176a
3 changed files with 35 additions and 24 deletions

View File

@ -18,6 +18,8 @@
#include "RiaImportEclipseCaseTools.h" #include "RiaImportEclipseCaseTools.h"
#include "ApplicationCommands/RicShowMainWindowFeature.h"
#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h" #include "SummaryPlotCommands/RicNewSummaryPlotFeature.h"
#include "SummaryPlotCommands/RicNewSummaryCurveFeature.h" #include "SummaryPlotCommands/RicNewSummaryCurveFeature.h"
@ -275,7 +277,10 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr
return false; return false;
} }
RiuMainWindow::instance()->show(); if (RiaGuiApplication::isRunning())
{
RicShowMainWindowFeature::showMainWindow();
}
analysisModels->cases.push_back(rimResultReservoir); analysisModels->cases.push_back(rimResultReservoir);

View File

@ -1,17 +1,17 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2016 Statoil ASA // Copyright (C) 2016 Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -27,24 +27,12 @@
CAF_CMD_SOURCE_INIT(RicShowMainWindowFeature, "RicShowMainWindowFeature"); CAF_CMD_SOURCE_INIT(RicShowMainWindowFeature, "RicShowMainWindowFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicShowMainWindowFeature::isCommandEnabled() void RicShowMainWindowFeature::showMainWindow()
{ {
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowMainWindowFeature::onActionTriggered(bool isChecked)
{
this->disableModelChangeContribution();
RiuMainWindow* mainWnd = RiuMainWindow::instance(); RiuMainWindow* mainWnd = RiuMainWindow::instance();
bool triggerReloadOfDockWindowVisibilities = !mainWnd->isVisible();
if (mainWnd->isMinimized()) if (mainWnd->isMinimized())
{ {
mainWnd->showNormal(); mainWnd->showNormal();
@ -57,14 +45,29 @@ void RicShowMainWindowFeature::onActionTriggered(bool isChecked)
mainWnd->raise(); mainWnd->raise();
if (triggerReloadOfDockWindowVisibilities) mainWnd->restoreDockWidgetVisibilities();
{
mainWnd->restoreDockWidgetVisibilities();
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//--------------------------------------------------------------------------------------------------
bool RicShowMainWindowFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowMainWindowFeature::onActionTriggered(bool isChecked)
{
this->disableModelChangeContribution();
RicShowMainWindowFeature::showMainWindow();
}
//--------------------------------------------------------------------------------------------------
///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicShowMainWindowFeature::setupActionLook(QAction* actionToSetup) void RicShowMainWindowFeature::setupActionLook(QAction* actionToSetup)
{ {

View File

@ -28,6 +28,9 @@ class RicShowMainWindowFeature : public caf::CmdFeature
{ {
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public:
static void showMainWindow();
protected: protected:
// Overrides // Overrides
bool isCommandEnabled() override; bool isCommandEnabled() override;