mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4173 Fix problems with saving state when closing 3d Window before closing plot window
This commit is contained in:
parent
0dbd3e8ad4
commit
fd01871202
@ -80,6 +80,7 @@
|
|||||||
#include "Riu3dSelectionManager.h"
|
#include "Riu3dSelectionManager.h"
|
||||||
#include "RiuDockWidgetTools.h"
|
#include "RiuDockWidgetTools.h"
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RiuMessagePanel.h"
|
||||||
#include "RiuPlotMainWindow.h"
|
#include "RiuPlotMainWindow.h"
|
||||||
#include "RiuProcessMonitor.h"
|
#include "RiuProcessMonitor.h"
|
||||||
#include "RiuRecentFileActionProvider.h"
|
#include "RiuRecentFileActionProvider.h"
|
||||||
@ -224,9 +225,18 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
|||||||
|
|
||||||
m_runningWorkerProcess = false;
|
m_runningWorkerProcess = false;
|
||||||
|
|
||||||
|
m_mainWindow = nullptr;
|
||||||
m_mainPlotWindow = nullptr;
|
m_mainPlotWindow = nullptr;
|
||||||
|
|
||||||
m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider);
|
m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider);
|
||||||
|
|
||||||
|
// Create main windows
|
||||||
|
// The plot window is created to be able to set expanded state on created objects, but hidden by default
|
||||||
|
getOrCreateAndShowMainWindow();
|
||||||
|
getOrCreateMainPlotWindow();
|
||||||
|
|
||||||
|
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(m_mainWindow->messagePanel()));
|
||||||
|
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -237,8 +247,11 @@ RiaApplication::~RiaApplication()
|
|||||||
RiuDockWidgetTools::instance()->saveDockWidgetsState();
|
RiuDockWidgetTools::instance()->saveDockWidgetsState();
|
||||||
|
|
||||||
deleteMainPlotWindow();
|
deleteMainPlotWindow();
|
||||||
|
deleteMainWindow();
|
||||||
|
|
||||||
delete m_preferences;
|
delete m_preferences;
|
||||||
|
|
||||||
|
RiaLogging::deleteLoggerInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -283,8 +296,7 @@ int RiaApplication::parseArgumentsAndRunUnitTestsIfRequested()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::setWindowCaptionFromAppState()
|
void RiaApplication::setWindowCaptionFromAppState()
|
||||||
{
|
{
|
||||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
if (!m_mainWindow) return;
|
||||||
if (!mainWnd) return;
|
|
||||||
|
|
||||||
// The stuff being done here should really be handled by Qt automatically as a result of
|
// The stuff being done here should really be handled by Qt automatically as a result of
|
||||||
// setting applicationName and windowFilePath
|
// setting applicationName and windowFilePath
|
||||||
@ -302,7 +314,7 @@ void RiaApplication::setWindowCaptionFromAppState()
|
|||||||
capt = projFileName + QString("[*]") + QString(" - ") + capt;
|
capt = projFileName + QString("[*]") + QString(" - ") + capt;
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWnd->setWindowTitle(capt);
|
m_mainWindow->setWindowTitle(capt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -382,8 +394,7 @@ bool RiaApplication::loadProject(const QString& projectFileName,
|
|||||||
QString("Unknown project file version detected in file \n%1\n\nCould not open project.").arg(fullPathProjectFileName);
|
QString("Unknown project file version detected in file \n%1\n\nCould not open project.").arg(fullPathProjectFileName);
|
||||||
QMessageBox::warning(nullptr, "Error when opening project file", tmp);
|
QMessageBox::warning(nullptr, "Error when opening project file", tmp);
|
||||||
|
|
||||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
m_mainWindow->setPdmRoot(nullptr);
|
||||||
mainWnd->setPdmRoot(nullptr);
|
|
||||||
|
|
||||||
// Delete all object possibly generated by readFile()
|
// Delete all object possibly generated by readFile()
|
||||||
delete m_project;
|
delete m_project;
|
||||||
@ -396,11 +407,11 @@ bool RiaApplication::loadProject(const QString& projectFileName,
|
|||||||
|
|
||||||
if (m_project->show3DWindow())
|
if (m_project->show3DWindow())
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->show();
|
m_mainWindow->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->hide();
|
m_mainWindow->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_project->showPlotWindow())
|
if (m_project->showPlotWindow())
|
||||||
@ -785,7 +796,7 @@ void RiaApplication::storeTreeViewState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
caf::PdmUiTreeView* projectTreeView = RiuMainWindow::instance()->projectTreeView();
|
caf::PdmUiTreeView* projectTreeView = m_mainWindow->projectTreeView();
|
||||||
if (projectTreeView)
|
if (projectTreeView)
|
||||||
{
|
{
|
||||||
QString treeViewState;
|
QString treeViewState;
|
||||||
@ -871,7 +882,7 @@ void RiaApplication::addWellLogsToModel(const QList<QString>& wellLogFilePaths)
|
|||||||
|
|
||||||
oilField->wellPathCollection->updateConnectedEditors();
|
oilField->wellPathCollection->updateConnectedEditors();
|
||||||
|
|
||||||
RiuMainWindow::instance()->selectAsCurrentItem(wellLogFile);
|
m_mainWindow->selectAsCurrentItem(wellLogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1018,15 +1029,13 @@ void RiaApplication::closeProject()
|
|||||||
RicHoloLensSessionManager::instance()->terminateSession();
|
RicHoloLensSessionManager::instance()->terminateSession();
|
||||||
RicHoloLensSessionManager::refreshToolbarState();
|
RicHoloLensSessionManager::refreshToolbarState();
|
||||||
|
|
||||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
|
||||||
|
|
||||||
RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate();
|
RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate();
|
||||||
|
|
||||||
terminateProcess();
|
terminateProcess();
|
||||||
|
|
||||||
RiaApplication::clearAllSelections();
|
RiaApplication::clearAllSelections();
|
||||||
|
|
||||||
mainWnd->cleanupGuiBeforeProjectClose();
|
m_mainWindow->cleanupGuiBeforeProjectClose();
|
||||||
|
|
||||||
if (m_mainPlotWindow)
|
if (m_mainPlotWindow)
|
||||||
{
|
{
|
||||||
@ -1049,10 +1058,9 @@ void RiaApplication::closeProject()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::onProjectOpenedOrClosed()
|
void RiaApplication::onProjectOpenedOrClosed()
|
||||||
{
|
{
|
||||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
if (m_mainWindow)
|
||||||
if (mainWnd)
|
|
||||||
{
|
{
|
||||||
mainWnd->initializeGuiNewProjectLoaded();
|
m_mainWindow->initializeGuiNewProjectLoaded();
|
||||||
}
|
}
|
||||||
if (m_mainPlotWindow)
|
if (m_mainPlotWindow)
|
||||||
{
|
{
|
||||||
@ -1157,7 +1165,7 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName, bool applyTime
|
|||||||
|
|
||||||
m_project->updateConnectedEditors();
|
m_project->updateConnectedEditors();
|
||||||
|
|
||||||
RiuMainWindow::instance()->selectAsCurrentItem(riv->cellResult());
|
m_mainWindow->selectAsCurrentItem(riv->cellResult());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1366,6 +1374,26 @@ int RiaApplication::launchUnitTestsWithConsole()
|
|||||||
return launchUnitTests();
|
return launchUnitTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuMainWindow* RiaApplication::getOrCreateAndShowMainWindow()
|
||||||
|
{
|
||||||
|
if (!m_mainWindow)
|
||||||
|
{
|
||||||
|
createMainWindow();
|
||||||
|
}
|
||||||
|
return m_mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuMainWindow* RiaApplication::mainWindow()
|
||||||
|
{
|
||||||
|
return m_mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1380,6 +1408,33 @@ RiuPlotMainWindow* RiaApplication::getOrCreateMainPlotWindow()
|
|||||||
return m_mainPlotWindow;
|
return m_mainPlotWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiaApplication::createMainWindow()
|
||||||
|
{
|
||||||
|
CVF_ASSERT(m_mainWindow == nullptr);
|
||||||
|
m_mainWindow = new RiuMainWindow;
|
||||||
|
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
|
||||||
|
m_mainWindow->setWindowTitle("ResInsight " + platform);
|
||||||
|
m_mainWindow->setDefaultWindowSize();
|
||||||
|
m_mainWindow->setDefaultToolbarVisibility();
|
||||||
|
m_mainWindow->loadWinGeoAndDockToolBarLayout();
|
||||||
|
m_mainWindow->showWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiaApplication::deleteMainWindow()
|
||||||
|
{
|
||||||
|
if (m_mainWindow)
|
||||||
|
{
|
||||||
|
delete m_mainWindow;
|
||||||
|
m_mainWindow = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1447,7 +1502,7 @@ RiuPlotMainWindow* RiaApplication::mainPlotWindow()
|
|||||||
RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID)
|
RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID)
|
||||||
{
|
{
|
||||||
if (mainWindowID == 0)
|
if (mainWindowID == 0)
|
||||||
return RiuMainWindow::instance();
|
return m_mainWindow;
|
||||||
else if (mainWindowID == 1)
|
else if (mainWindowID == 1)
|
||||||
return m_mainPlotWindow;
|
return m_mainPlotWindow;
|
||||||
else
|
else
|
||||||
@ -1486,7 +1541,7 @@ RimViewWindow* RiaApplication::activeViewWindow()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiaApplication::isMain3dWindowVisible() const
|
bool RiaApplication::isMain3dWindowVisible() const
|
||||||
{
|
{
|
||||||
return RiuMainWindow::instance()->isVisible();
|
return m_mainWindow && m_mainWindow->isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1494,45 +1549,29 @@ bool RiaApplication::isMain3dWindowVisible() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiaApplication::isMainPlotWindowVisible() const
|
bool RiaApplication::isMainPlotWindowVisible() const
|
||||||
{
|
{
|
||||||
if (!m_mainPlotWindow) return false;
|
return m_mainPlotWindow && m_mainPlotWindow->isVisible();
|
||||||
|
|
||||||
return m_mainPlotWindow->isVisible();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiaApplication::tryCloseMainWindow()
|
void RiaApplication::closeMainWindowIfOpenButHidden()
|
||||||
{
|
{
|
||||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
if (m_mainWindow && !m_mainWindow->isVisible())
|
||||||
if (mainWindow && !mainWindow->isVisible())
|
|
||||||
{
|
{
|
||||||
mainWindow->close();
|
m_mainWindow->close();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RiaApplication::tryClosePlotWindow()
|
void RiaApplication::closeMainPlotWindowIfOpenButHidden()
|
||||||
{
|
{
|
||||||
if (!m_mainPlotWindow)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_mainPlotWindow && !m_mainPlotWindow->isVisible())
|
if (m_mainPlotWindow && !m_mainPlotWindow->isVisible())
|
||||||
{
|
{
|
||||||
m_mainPlotWindow->close();
|
m_mainPlotWindow->close();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1540,6 +1579,7 @@ bool RiaApplication::tryClosePlotWindow()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::addToRecentFiles(const QString& fileName)
|
void RiaApplication::addToRecentFiles(const QString& fileName)
|
||||||
{
|
{
|
||||||
|
CVF_ASSERT(m_recentFileActionProvider && "The provider needs to be created before any attempts to use the recent file actions");
|
||||||
m_recentFileActionProvider->addFileName(fileName);
|
m_recentFileActionProvider->addFileName(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1548,6 +1588,7 @@ void RiaApplication::addToRecentFiles(const QString& fileName)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
std::vector<QAction*> RiaApplication::recentFileActions() const
|
std::vector<QAction*> RiaApplication::recentFileActions() const
|
||||||
{
|
{
|
||||||
|
CVF_ASSERT(m_recentFileActionProvider && "The provider needs to be created before any attempts to use the recent file actions");
|
||||||
return m_recentFileActionProvider->actions();
|
return m_recentFileActionProvider->actions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1608,19 +1649,24 @@ void RiaApplication::waitUntilCommandObjectsHasBeenProcessed()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::saveWinGeoAndDockToolBarLayout()
|
void RiaApplication::saveMainWinGeoAndDockToolBarLayout()
|
||||||
{
|
{
|
||||||
if (m_mainPlotWindow)
|
if (isMain3dWindowVisible())
|
||||||
|
{
|
||||||
|
m_mainWindow->saveWinGeoAndDockToolBarLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiaApplication::savePlotWinGeoAndDockToolBarLayout()
|
||||||
|
{
|
||||||
|
if (isMainPlotWindowVisible())
|
||||||
{
|
{
|
||||||
m_mainPlotWindow->saveWinGeoAndDockToolBarLayout();
|
m_mainPlotWindow->saveWinGeoAndDockToolBarLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RiuMainWindow::instance())
|
|
||||||
{
|
|
||||||
RiuMainWindow::instance()->saveWinGeoAndDockToolBarLayout();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1696,7 +1742,7 @@ QStringList RiaApplication::octaveArguments() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
|
m_mainWindow->processMonitor()->stopMonitorWorkProcess();
|
||||||
|
|
||||||
// Execute delete later so that other slots that are hooked up
|
// Execute delete later so that other slots that are hooked up
|
||||||
// get a chance to run before we delete the object
|
// get a chance to run before we delete the object
|
||||||
@ -1794,7 +1840,7 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
|
|||||||
SIGNAL(finished(int, QProcess::ExitStatus)),
|
SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||||
SLOT(slotWorkerProcessFinished(int, QProcess::ExitStatus)));
|
SLOT(slotWorkerProcessFinished(int, QProcess::ExitStatus)));
|
||||||
|
|
||||||
RiuMainWindow::instance()->processMonitor()->startMonitorWorkProcess(m_workerProcess);
|
m_mainWindow->processMonitor()->startMonitorWorkProcess(m_workerProcess);
|
||||||
|
|
||||||
m_workerProcess->start(program, arguments);
|
m_workerProcess->start(program, arguments);
|
||||||
if (!m_workerProcess->waitForStarted(1000))
|
if (!m_workerProcess->waitForStarted(1000))
|
||||||
@ -1803,10 +1849,10 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
|
|||||||
m_workerProcess = nullptr;
|
m_workerProcess = nullptr;
|
||||||
m_runningWorkerProcess = false;
|
m_runningWorkerProcess = false;
|
||||||
|
|
||||||
RiuMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
|
m_mainWindow->processMonitor()->stopMonitorWorkProcess();
|
||||||
|
|
||||||
QMessageBox::warning(
|
QMessageBox::warning(
|
||||||
RiuMainWindow::instance(), "Script execution", "Failed to start script executable located at\n" + program);
|
m_mainWindow, "Script execution", "Failed to start script executable located at\n" + program);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1866,9 +1912,9 @@ void RiaApplication::applyPreferences()
|
|||||||
caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::FIXED_FUNCTION);
|
caf::EffectGenerator::setRenderingMode(caf::EffectGenerator::FIXED_FUNCTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView())
|
if (m_mainWindow && m_mainWindow->projectTreeView())
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(
|
m_mainWindow->projectTreeView()->enableAppendOfClassNameToUiItemText(
|
||||||
m_preferences->appendClassNameToUiText());
|
m_preferences->appendClassNameToUiText());
|
||||||
if (mainPlotWindow())
|
if (mainPlotWindow())
|
||||||
mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
||||||
@ -2030,10 +2076,9 @@ void RiaApplication::runMultiCaseSnapshots(const QString& templateProjectF
|
|||||||
std::vector<QString> gridFileNames,
|
std::vector<QString> gridFileNames,
|
||||||
const QString& snapshotFolderName)
|
const QString& snapshotFolderName)
|
||||||
{
|
{
|
||||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
if (!m_mainWindow) return;
|
||||||
if (!mainWnd) return;
|
|
||||||
|
|
||||||
mainWnd->hideAllDockWindows();
|
m_mainWindow->hideAllDockWindows();
|
||||||
|
|
||||||
const size_t numGridFiles = gridFileNames.size();
|
const size_t numGridFiles = gridFileNames.size();
|
||||||
for (size_t i = 0; i < numGridFiles; i++)
|
for (size_t i = 0; i < numGridFiles; i++)
|
||||||
@ -2050,7 +2095,7 @@ void RiaApplication::runMultiCaseSnapshots(const QString& templateProjectF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
m_mainWindow->loadWinGeoAndDockToolBarLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -58,6 +58,7 @@ class RimViewWindow;
|
|||||||
class RimWellLogPlot;
|
class RimWellLogPlot;
|
||||||
class RimWellAllocationPlot;
|
class RimWellAllocationPlot;
|
||||||
|
|
||||||
|
class RiuMainWindow;
|
||||||
class RiuMainWindowBase;
|
class RiuMainWindowBase;
|
||||||
class RiuPlotMainWindow;
|
class RiuPlotMainWindow;
|
||||||
class RiuRecentFileActionProvider;
|
class RiuRecentFileActionProvider;
|
||||||
@ -183,6 +184,9 @@ public:
|
|||||||
int launchUnitTests();
|
int launchUnitTests();
|
||||||
int launchUnitTestsWithConsole();
|
int launchUnitTestsWithConsole();
|
||||||
|
|
||||||
|
RiuMainWindow* getOrCreateAndShowMainWindow();
|
||||||
|
RiuMainWindow* mainWindow();
|
||||||
|
|
||||||
RiuPlotMainWindow* getOrCreateMainPlotWindow();
|
RiuPlotMainWindow* getOrCreateMainPlotWindow();
|
||||||
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
|
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
|
||||||
RiuPlotMainWindow* mainPlotWindow();
|
RiuPlotMainWindow* mainPlotWindow();
|
||||||
@ -193,8 +197,8 @@ public:
|
|||||||
bool isMain3dWindowVisible() const;
|
bool isMain3dWindowVisible() const;
|
||||||
bool isMainPlotWindowVisible() const;
|
bool isMainPlotWindowVisible() const;
|
||||||
|
|
||||||
bool tryCloseMainWindow();
|
void closeMainWindowIfOpenButHidden();
|
||||||
bool tryClosePlotWindow();
|
void closeMainPlotWindowIfOpenButHidden();
|
||||||
|
|
||||||
void addToRecentFiles(const QString& fileName);
|
void addToRecentFiles(const QString& fileName);
|
||||||
std::vector<QAction*> recentFileActions() const;
|
std::vector<QAction*> recentFileActions() const;
|
||||||
@ -204,7 +208,8 @@ public:
|
|||||||
static std::vector<QString> readFileListFromTextFile(QString listFileName);
|
static std::vector<QString> readFileListFromTextFile(QString listFileName);
|
||||||
|
|
||||||
void waitUntilCommandObjectsHasBeenProcessed();
|
void waitUntilCommandObjectsHasBeenProcessed();
|
||||||
void saveWinGeoAndDockToolBarLayout();
|
void saveMainWinGeoAndDockToolBarLayout();
|
||||||
|
void savePlotWinGeoAndDockToolBarLayout();
|
||||||
|
|
||||||
static bool enableDevelopmentFeatures();
|
static bool enableDevelopmentFeatures();
|
||||||
static void clearAllSelections();
|
static void clearAllSelections();
|
||||||
@ -213,6 +218,9 @@ private:
|
|||||||
void onProjectOpenedOrClosed();
|
void onProjectOpenedOrClosed();
|
||||||
void setWindowCaptionFromAppState();
|
void setWindowCaptionFromAppState();
|
||||||
|
|
||||||
|
void createMainWindow();
|
||||||
|
void deleteMainWindow();
|
||||||
|
|
||||||
void createMainPlotWindow();
|
void createMainPlotWindow();
|
||||||
void deleteMainPlotWindow();
|
void deleteMainPlotWindow();
|
||||||
|
|
||||||
@ -258,6 +266,7 @@ private:
|
|||||||
|
|
||||||
bool m_runningWorkerProcess;
|
bool m_runningWorkerProcess;
|
||||||
|
|
||||||
|
RiuMainWindow* m_mainWindow;
|
||||||
RiuPlotMainWindow* m_mainPlotWindow;
|
RiuPlotMainWindow* m_mainPlotWindow;
|
||||||
|
|
||||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaLogging.h"
|
#include "RiaLogging.h"
|
||||||
|
|
||||||
#include "RiuMainWindow.h"
|
|
||||||
#include "RiuMessagePanel.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||||
@ -37,23 +34,8 @@ int main(int argc, char *argv[])
|
|||||||
return unitTestResult;
|
return unitTestResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
RiuMainWindow window;
|
|
||||||
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
|
|
||||||
window.setWindowTitle("ResInsight " + platform);
|
|
||||||
window.setDefaultWindowSize();
|
|
||||||
window.setDefaultToolbarVisibility();
|
|
||||||
window.loadWinGeoAndDockToolBarLayout();
|
|
||||||
window.showWindow();
|
|
||||||
|
|
||||||
// Create plot main window to be able to set expanded state on created objects
|
|
||||||
// The plot window is hidden by default
|
|
||||||
RiaApplication::instance()->getOrCreateMainPlotWindow();
|
|
||||||
|
|
||||||
if (app.parseArguments())
|
if (app.parseArguments())
|
||||||
{
|
{
|
||||||
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(window.messagePanel()));
|
|
||||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
|
||||||
|
|
||||||
int exitCode = 0;
|
int exitCode = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -70,13 +52,9 @@ int main(int argc, char *argv[])
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
RiaLogging::deleteLoggerInstance();
|
|
||||||
|
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RiaLogging::deleteLoggerInstance();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,9 +108,6 @@
|
|||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
|
|
||||||
RiuMainWindow* RiuMainWindow::sm_mainWindowInstance = nullptr;
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -123,8 +120,6 @@ RiuMainWindow::RiuMainWindow()
|
|||||||
m_blockSlotSubWindowActivated(false),
|
m_blockSlotSubWindowActivated(false),
|
||||||
m_holoLensToolBar(nullptr)
|
m_holoLensToolBar(nullptr)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(sm_mainWindowInstance == nullptr);
|
|
||||||
|
|
||||||
m_mdiArea = new QMdiArea;
|
m_mdiArea = new QMdiArea;
|
||||||
m_mdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation, true);
|
m_mdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation, true);
|
||||||
connect(m_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), SLOT(slotSubWindowActivated(QMdiSubWindow*)));
|
connect(m_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), SLOT(slotSubWindowActivated(QMdiSubWindow*)));
|
||||||
@ -140,8 +135,6 @@ RiuMainWindow::RiuMainWindow()
|
|||||||
// Store the layout so we can offer reset option
|
// Store the layout so we can offer reset option
|
||||||
m_initialDockAndToolbarLayout = saveState(0);
|
m_initialDockAndToolbarLayout = saveState(0);
|
||||||
|
|
||||||
sm_mainWindowInstance = this;
|
|
||||||
|
|
||||||
m_dragDropInterface = std::unique_ptr<caf::PdmUiDragDropInterface>(new RiuDragDrop());
|
m_dragDropInterface = std::unique_ptr<caf::PdmUiDragDropInterface>(new RiuDragDrop());
|
||||||
|
|
||||||
initializeGuiNewProjectLoaded();
|
initializeGuiNewProjectLoaded();
|
||||||
@ -175,7 +168,7 @@ RiuMainWindow::RiuMainWindow()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuMainWindow* RiuMainWindow::instance()
|
RiuMainWindow* RiuMainWindow::instance()
|
||||||
{
|
{
|
||||||
return sm_mainWindowInstance;
|
return RiaApplication::instance()->mainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -267,6 +260,8 @@ void RiuMainWindow::closeEvent(QCloseEvent* event)
|
|||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
|
||||||
|
app->saveMainWinGeoAndDockToolBarLayout();
|
||||||
|
|
||||||
if (app->isMainPlotWindowVisible())
|
if (app->isMainPlotWindowVisible())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -278,9 +273,7 @@ void RiuMainWindow::closeEvent(QCloseEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
app->saveWinGeoAndDockToolBarLayout();
|
app->closeMainPlotWindowIfOpenButHidden();
|
||||||
|
|
||||||
if (!app->tryClosePlotWindow()) return;
|
|
||||||
|
|
||||||
app->closeProject();
|
app->closeProject();
|
||||||
}
|
}
|
||||||
|
@ -165,6 +165,8 @@ void RiuPlotMainWindow::closeEvent(QCloseEvent* event)
|
|||||||
{
|
{
|
||||||
RiaApplication* app = RiaApplication::instance();
|
RiaApplication* app = RiaApplication::instance();
|
||||||
|
|
||||||
|
app->savePlotWinGeoAndDockToolBarLayout();
|
||||||
|
|
||||||
if (app->isMain3dWindowVisible())
|
if (app->isMain3dWindowVisible())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -176,9 +178,7 @@ void RiuPlotMainWindow::closeEvent(QCloseEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
app->saveWinGeoAndDockToolBarLayout();
|
app->closeMainWindowIfOpenButHidden();
|
||||||
|
|
||||||
if (!app->tryCloseMainWindow()) return;
|
|
||||||
|
|
||||||
app->closeProject();
|
app->closeProject();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user