Loading isis/src/qisis/apps/ipce/IpceMainWindow.cpp +74 −43 Original line number Diff line number Diff line Loading @@ -207,12 +207,10 @@ namespace Isis { addDockWidget(area, dock, orientation); } // Connections for cleanup in both directions to make sure both views and docks are cleaned up connect(newWidget, SIGNAL(destroyed(QObject *)), dock, SLOT(deleteLater())); // When dock widget is destroyed, make sure the view it holds is also destroyed connect(dock, SIGNAL(destroyed(QObject *)), newWidget, SLOT(deleteLater())); // The list of dock widgets needs cleanup as each view is destroyed connect(dock, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupViewDockList(QObject *))); connect(dock, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupViewDockList(QObject *))); // Save view docks for cleanup during a project close m_viewDocks.append(dock); Loading Loading @@ -263,6 +261,22 @@ namespace Isis { } /** * This is needed so that the project clean flag is not set to false when move and resize events * are emitted from ipce.cpp when IpceMainWindow::show() is called. * The non-spontaneous or internal QShowEvent is only emitted once from ipce.cpp, so the project * clean flag can be reset. * * @param event QShowEvent* * */ void IpceMainWindow::showEvent(QShowEvent *event) { if (!event->spontaneous()) { m_directory->project()->setClean(true); } } /** * Filters out events from views so they can be handled by the main * window. Filters out DragEnter Drop and ContextMenu events from Loading Loading @@ -484,50 +498,18 @@ namespace Isis { } /** * Write the window positioning and state information out to a * config file. This allows us to restore the settings when we * create another main window (the next time this program is run). * * The state will be saved according to the currently loaded project and its name. * * When no project is loaded (i.e. the default "Project" is open), the config file used is * $HOME/.Isis/$APPNAME/$APPNAME_Project.config. * When a project, ProjectName, is loaded, the config file used is * $HOME/.Isis/$APPNAME/$APPNAME_ProjectName.config. * * @param[in] project Pointer to the project that is currently loaded (default is "Project") * * @internal * @history 2016-11-09 Ian Humphrey - Settings are now written according to the loaded project. * References #4358. * @history 2017-10-17 Tyler Wilson Added a [recent projects] group for the saving and * restoring of recently opened projects. References #4492. */ void IpceMainWindow::writeSettings(Project *project) { void IpceMainWindow::writeGlobalSettings(Project *project) { // Ensure that we are not using a NULL pointer if (!project) { QString msg = "Cannot write settings with a NULL Project pointer."; throw IException(IException::Programmer, msg, _FILEINFO_); } QString appName = QApplication::applicationName(); QSettings projectSettings( FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + project->name() + ".config") .expanded(), QSettings::NativeFormat); QSettings globalSettings( FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + "Project.config") .expanded(), QSettings::NativeFormat); projectSettings.setValue("geometry", QVariant(geometry())); projectSettings.setValue("windowState", saveState()); // projectSettings.setValue("size", size()); // projectSettings.setValue("pos", pos()); projectSettings.setValue("maxThreadCount", m_maxThreadCount); // If temporary project open same geometry of mainwindow if (project->projectRoot().contains("tmpProject")) { globalSettings.setValue("geometry", QVariant(geometry())); } globalSettings.setValue("maxThreadCount", m_maxThreadCount); globalSettings.setValue("maxRecentProjects",m_maxRecentProjects); Loading Loading @@ -598,6 +580,48 @@ namespace Isis { } /** * Write the window positioning and state information out to a * config file. This allows us to restore the settings when we * create another main window (the next time this program is run). * * The state will be saved according to the currently loaded project and its name. * * When no project is loaded (i.e. the default "Project" is open), the config file used is * $HOME/.Isis/$APPNAME/$APPNAME_Project.config. * When a project, ProjectName, is loaded, the config file used is * $HOME/.Isis/$APPNAME/$APPNAME_ProjectName.config. * * @param[in] project Pointer to the project that is currently loaded (default is "Project") * * @internal * @history 2016-11-09 Ian Humphrey - Settings are now written according to the loaded project. * References #4358. * @history 2017-10-17 Tyler Wilson Added a [recent projects] group for the saving and * restoring of recently opened projects. References #4492. */ void IpceMainWindow::writeSettings(Project *project) { // Ensure that we are not using a NULL pointer if (!project) { QString msg = "Cannot write settings with a NULL Project pointer."; throw IException(IException::Programmer, msg, _FILEINFO_); } QString appName = QApplication::applicationName(); QSettings projectSettings( FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + project->name() + ".config") .expanded(), QSettings::NativeFormat); projectSettings.setValue("geometry", QVariant(geometry())); projectSettings.setValue("windowState", saveState()); // projectSettings.setValue("size", size()); // projectSettings.setValue("pos", pos()); projectSettings.setValue("maxThreadCount", m_maxThreadCount); } /** * Read the window positioning and state information from the config file. * Loading Loading @@ -632,6 +656,11 @@ namespace Isis { if (project->name() == "Project") { setWindowTitle("ipce"); // Read generic geometry if (settings.contains("geometry")) { setGeometry(settings.value("geometry").value<QRect>()); } QStringList projectNameList; QStringList projectPathList; settings.beginGroup("recent_projects"); Loading Loading @@ -688,6 +717,7 @@ namespace Isis { move(settings.value("pos").toPoint()); } } // m_directory->project()->setClean(true); } Loading Loading @@ -717,7 +747,8 @@ namespace Isis { m_directory->project()->save(); } } writeSettings(m_directory->project()); // Write global settings, for now this is for the project "Project" writeGlobalSettings(m_directory->project()); m_directory->project()->clear(); QMainWindow::closeEvent(event); Loading isis/src/qisis/apps/ipce/IpceMainWindow.h +10 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ */ #include "ViewSubWindow.h" #include <QEvent> #include <QMainWindow> #include <QPointer> #include <QProgressBar> Loading Loading @@ -152,6 +153,13 @@ namespace Isis { * type of a view will randomly change and setting its type has no effect. * Use windowType() to get the type. Also added the toolbar title in the * permanent toolbar constructor. * @history 2018-06-22 Tracie Sucharski - Cleanup destruction of dock widgets and the views they * hold. Extra destroy slots were causing double deletion of memory. * @history 2018-06-22 Tracie Sucharski - Added a showEvent handler so that the project clean * state can be reset after the IpceMainWindow::show() causes resize and * move events which in turn cause the project clean flag to be false * even though the project has just opened. * * * */ Loading @@ -169,8 +177,10 @@ namespace Isis { void readSettings(Project *); void writeSettings(Project *project); void writeGlobalSettings(Project *project); protected: void showEvent(QShowEvent *event); void closeEvent(QCloseEvent *event); bool eventFilter(QObject *watched, QEvent *event); Loading Loading
isis/src/qisis/apps/ipce/IpceMainWindow.cpp +74 −43 Original line number Diff line number Diff line Loading @@ -207,12 +207,10 @@ namespace Isis { addDockWidget(area, dock, orientation); } // Connections for cleanup in both directions to make sure both views and docks are cleaned up connect(newWidget, SIGNAL(destroyed(QObject *)), dock, SLOT(deleteLater())); // When dock widget is destroyed, make sure the view it holds is also destroyed connect(dock, SIGNAL(destroyed(QObject *)), newWidget, SLOT(deleteLater())); // The list of dock widgets needs cleanup as each view is destroyed connect(dock, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupViewDockList(QObject *))); connect(dock, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupViewDockList(QObject *))); // Save view docks for cleanup during a project close m_viewDocks.append(dock); Loading Loading @@ -263,6 +261,22 @@ namespace Isis { } /** * This is needed so that the project clean flag is not set to false when move and resize events * are emitted from ipce.cpp when IpceMainWindow::show() is called. * The non-spontaneous or internal QShowEvent is only emitted once from ipce.cpp, so the project * clean flag can be reset. * * @param event QShowEvent* * */ void IpceMainWindow::showEvent(QShowEvent *event) { if (!event->spontaneous()) { m_directory->project()->setClean(true); } } /** * Filters out events from views so they can be handled by the main * window. Filters out DragEnter Drop and ContextMenu events from Loading Loading @@ -484,50 +498,18 @@ namespace Isis { } /** * Write the window positioning and state information out to a * config file. This allows us to restore the settings when we * create another main window (the next time this program is run). * * The state will be saved according to the currently loaded project and its name. * * When no project is loaded (i.e. the default "Project" is open), the config file used is * $HOME/.Isis/$APPNAME/$APPNAME_Project.config. * When a project, ProjectName, is loaded, the config file used is * $HOME/.Isis/$APPNAME/$APPNAME_ProjectName.config. * * @param[in] project Pointer to the project that is currently loaded (default is "Project") * * @internal * @history 2016-11-09 Ian Humphrey - Settings are now written according to the loaded project. * References #4358. * @history 2017-10-17 Tyler Wilson Added a [recent projects] group for the saving and * restoring of recently opened projects. References #4492. */ void IpceMainWindow::writeSettings(Project *project) { void IpceMainWindow::writeGlobalSettings(Project *project) { // Ensure that we are not using a NULL pointer if (!project) { QString msg = "Cannot write settings with a NULL Project pointer."; throw IException(IException::Programmer, msg, _FILEINFO_); } QString appName = QApplication::applicationName(); QSettings projectSettings( FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + project->name() + ".config") .expanded(), QSettings::NativeFormat); QSettings globalSettings( FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + "Project.config") .expanded(), QSettings::NativeFormat); projectSettings.setValue("geometry", QVariant(geometry())); projectSettings.setValue("windowState", saveState()); // projectSettings.setValue("size", size()); // projectSettings.setValue("pos", pos()); projectSettings.setValue("maxThreadCount", m_maxThreadCount); // If temporary project open same geometry of mainwindow if (project->projectRoot().contains("tmpProject")) { globalSettings.setValue("geometry", QVariant(geometry())); } globalSettings.setValue("maxThreadCount", m_maxThreadCount); globalSettings.setValue("maxRecentProjects",m_maxRecentProjects); Loading Loading @@ -598,6 +580,48 @@ namespace Isis { } /** * Write the window positioning and state information out to a * config file. This allows us to restore the settings when we * create another main window (the next time this program is run). * * The state will be saved according to the currently loaded project and its name. * * When no project is loaded (i.e. the default "Project" is open), the config file used is * $HOME/.Isis/$APPNAME/$APPNAME_Project.config. * When a project, ProjectName, is loaded, the config file used is * $HOME/.Isis/$APPNAME/$APPNAME_ProjectName.config. * * @param[in] project Pointer to the project that is currently loaded (default is "Project") * * @internal * @history 2016-11-09 Ian Humphrey - Settings are now written according to the loaded project. * References #4358. * @history 2017-10-17 Tyler Wilson Added a [recent projects] group for the saving and * restoring of recently opened projects. References #4492. */ void IpceMainWindow::writeSettings(Project *project) { // Ensure that we are not using a NULL pointer if (!project) { QString msg = "Cannot write settings with a NULL Project pointer."; throw IException(IException::Programmer, msg, _FILEINFO_); } QString appName = QApplication::applicationName(); QSettings projectSettings( FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + project->name() + ".config") .expanded(), QSettings::NativeFormat); projectSettings.setValue("geometry", QVariant(geometry())); projectSettings.setValue("windowState", saveState()); // projectSettings.setValue("size", size()); // projectSettings.setValue("pos", pos()); projectSettings.setValue("maxThreadCount", m_maxThreadCount); } /** * Read the window positioning and state information from the config file. * Loading Loading @@ -632,6 +656,11 @@ namespace Isis { if (project->name() == "Project") { setWindowTitle("ipce"); // Read generic geometry if (settings.contains("geometry")) { setGeometry(settings.value("geometry").value<QRect>()); } QStringList projectNameList; QStringList projectPathList; settings.beginGroup("recent_projects"); Loading Loading @@ -688,6 +717,7 @@ namespace Isis { move(settings.value("pos").toPoint()); } } // m_directory->project()->setClean(true); } Loading Loading @@ -717,7 +747,8 @@ namespace Isis { m_directory->project()->save(); } } writeSettings(m_directory->project()); // Write global settings, for now this is for the project "Project" writeGlobalSettings(m_directory->project()); m_directory->project()->clear(); QMainWindow::closeEvent(event); Loading
isis/src/qisis/apps/ipce/IpceMainWindow.h +10 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ */ #include "ViewSubWindow.h" #include <QEvent> #include <QMainWindow> #include <QPointer> #include <QProgressBar> Loading Loading @@ -152,6 +153,13 @@ namespace Isis { * type of a view will randomly change and setting its type has no effect. * Use windowType() to get the type. Also added the toolbar title in the * permanent toolbar constructor. * @history 2018-06-22 Tracie Sucharski - Cleanup destruction of dock widgets and the views they * hold. Extra destroy slots were causing double deletion of memory. * @history 2018-06-22 Tracie Sucharski - Added a showEvent handler so that the project clean * state can be reset after the IpceMainWindow::show() causes resize and * move events which in turn cause the project clean flag to be false * even though the project has just opened. * * * */ Loading @@ -169,8 +177,10 @@ namespace Isis { void readSettings(Project *); void writeSettings(Project *project); void writeGlobalSettings(Project *project); protected: void showEvent(QShowEvent *event); void closeEvent(QCloseEvent *event); bool eventFilter(QObject *watched, QEvent *event); Loading