Unverified Commit a77b761c authored by Kristin's avatar Kristin Committed by GitHub
Browse files

Merge pull request #339 from kdl222/qsettings

Fixed misplaced warning/history tabs when a project is opened in ipce. Fixes #5175
parents b914aeea 0af24e81
Loading
Loading
Loading
Loading
+14 −1
Original line number Original line Diff line number Diff line
@@ -80,7 +80,7 @@ namespace Isis {


    QWidget *centralWidget = new QWidget;
    QWidget *centralWidget = new QWidget;
    setCentralWidget(centralWidget);
    setCentralWidget(centralWidget);
    setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
    setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::South);
    //setDockOptions(GroupedDragging | AllowTabbedDocks);
    //setDockOptions(GroupedDragging | AllowTabbedDocks);
    //centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    //centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    //centralWidget->hide();
    //centralWidget->hide();
@@ -590,6 +590,9 @@ namespace Isis {
   *                           References #4358.
   *                           References #4358.
   *   @history 2017-10-17 Tyler Wilson Added a [recent projects] group for the saving and
   *   @history 2017-10-17 Tyler Wilson Added a [recent projects] group for the saving and
   *                           restoring of recently opened projects.  References #4492.
   *                           restoring of recently opened projects.  References #4492.
   *   @history Kaitlyn Lee 2018-07-09 - Added the value "maximized" in the project settings
   *                           so that a project remembers if it was in fullscreen when saved.
   *                           Fixes #5175.
   */
   */
  void IpceMainWindow::writeSettings(Project *project) {
  void IpceMainWindow::writeSettings(Project *project) {


@@ -603,6 +606,7 @@ namespace Isis {


    projectSettings.setValue("geometry", QVariant(geometry()));
    projectSettings.setValue("geometry", QVariant(geometry()));
    projectSettings.setValue("windowState", saveState());
    projectSettings.setValue("windowState", saveState());
    projectSettings.setValue("maximized", isMaximized());
    projectSettings.sync();
    projectSettings.sync();
  }
  }


@@ -625,6 +629,10 @@ namespace Isis {
   *                Fixes #5075.
   *                Fixes #5075.
   *   @history Makayla Shepherd 2018-06-10 - Settings are read from the project root ipce.config.
   *   @history Makayla Shepherd 2018-06-10 - Settings are read from the project root ipce.config.
   *                If that does not exist then we read from .Isis/ipce/ipce.config.
   *                If that does not exist then we read from .Isis/ipce/ipce.config.
   *   @history Kaitlyn Lee 2018-07-09 - Added the call showNormal() so when a project is
   *                not saved in fullscreen, the window will resize to the project's
   *                window size. This also fixes the history/warning tabs being misplaced
   *                when opening a project. Fixes #5175.
   */
   */
  void IpceMainWindow::readSettings(Project *project) {
  void IpceMainWindow::readSettings(Project *project) {
    // Ensure that the Project pointer is not NULL
    // Ensure that the Project pointer is not NULL
@@ -658,7 +666,12 @@ namespace Isis {
    QSettings projectSettings(FileName(filePath).expanded(), QSettings::NativeFormat);
    QSettings projectSettings(FileName(filePath).expanded(), QSettings::NativeFormat);


    if (!isFullScreen) {
    if (!isFullScreen) {
      // If a project was not in fullscreen when saved, restore the project's window size.
      if (!projectSettings.value("maximized").toBool()) {
        showNormal();
      }
      setGeometry(projectSettings.value("geometry").value<QRect>());
      setGeometry(projectSettings.value("geometry").value<QRect>());

      if (!project->isTemporaryProject()) {
      if (!project->isTemporaryProject()) {
        restoreState(projectSettings.value("windowState").toByteArray());
        restoreState(projectSettings.value("windowState").toByteArray());
      }
      }
+4 −2
Original line number Original line Diff line number Diff line
@@ -159,8 +159,6 @@ namespace Isis {
   *                           state can be reset after the IpceMainWindow::show() causes resize and
   *                           state can be reset after the IpceMainWindow::show() causes resize and
   *                           move events which in turn cause the project clean flag to be false
   *                           move events which in turn cause the project clean flag to be false
   *                           even though the project has just opened.
   *                           even though the project has just opened.
   *   @history 2018-07-05 Kaitlyn Lee - Added tilViews() and the menu option to tile all docked/undocked
   *                           and tabbed/untabbed views.
   *   @history 2018-07-07 Summer Stapleton - Added check in the closeEvent() for changes to any 
   *   @history 2018-07-07 Summer Stapleton - Added check in the closeEvent() for changes to any 
   *                           TemplateEditorWidget currently open to create a pop-up warning/
   *                           TemplateEditorWidget currently open to create a pop-up warning/
   *                           option to save.
   *                           option to save.
@@ -168,6 +166,10 @@ namespace Isis {
   *                           and tabbed/untabbed views. Changed removeView() to delete the parent dock widget.
   *                           and tabbed/untabbed views. Changed removeView() to delete the parent dock widget.
   *                           If we do not delete the dock widget, an empty dock widget will remain where the
   *                           If we do not delete the dock widget, an empty dock widget will remain where the
   *                           view used to be.
   *                           view used to be.
   *   @history 2018-07-11 Kaitlyn Lee - Added a value in the project settings that stores whether a
   *                           project was in fullscreen or not when saved. If not, we call showNormal()
   *                           to restore the poject's window size. This also fixes the warning/history tabs
   *                           being misplaced when opening a project. Fixes #5175.
   */
   */
  class IpceMainWindow : public QMainWindow {
  class IpceMainWindow : public QMainWindow {
      Q_OBJECT
      Q_OBJECT