Unverified Commit c1959fea authored by kledmundson's avatar kledmundson Committed by GitHub
Browse files

Merge pull request #242 from TracieSucharski/ipceDocks

Fixed recent projects. 
parents 66d7bd3d e081211a
Loading
Loading
Loading
Loading
+58 −56
Original line number Diff line number Diff line
@@ -164,13 +164,14 @@ namespace Isis {
      statusBar()->addWidget(progressBar);
    }

    // Read default app settings.  NOTE: This must be completed before initializing actions in order
    // to read the recent projects from the config file.
    readSettings(m_directory->project() );

    initializeActions();
    createMenus();
    createToolBars();

    // Read default app settings
    readSettings(m_directory->project() );

    QStringList args = QCoreApplication::arguments();

    if (args.count() == 2) {
@@ -660,28 +661,21 @@ namespace Isis {
      QString msg = "Cannot read settings with a NULL Project pointer.";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    if (project->name() == "Project") {
      setWindowTitle("ipce");
    }
    else {
      setWindowTitle( project->name() );
      QString projName = project->name();
      setWindowTitle(projName );
    }

    QString appName = QApplication::applicationName();

    QSettings settings(
        FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + project->name() + ".config")
          .expanded(), QSettings::NativeFormat);

    setGeometry(settings.value("geometry").value<QRect>());
    restoreState(settings.value("windowState").toByteArray());
    // General settings
    if (project->name() == "Project") {
      setWindowTitle("ipce");

      QStringList projectNameList;
      QStringList projectPathList;
      settings.beginGroup("recent_projects");
      QStringList keys = settings.allKeys();

      QRegExp underscore("%%%%%");

      foreach (QString key, keys) {
@@ -695,7 +689,6 @@ namespace Isis {
      settings.endGroup();

      QStringList projectPathReverseList;

      for (int i = projectPathList.count()-1;i>=0;i--) {
        projectPathReverseList.append(projectPathList[i]);
      }
@@ -713,19 +706,28 @@ namespace Isis {
          break;
       }


      m_directory->setRecentProjectsList(projectPathListTruncated);
      m_directory->updateRecentProjects();
      m_maxThreadCount = settings.value("maxThreadCount", m_maxThreadCount).toInt();
      applyMaxThreadCount();
    }
    //  Project specific settings
    else {
      setWindowTitle( project->name() );
      if (settings.contains("geometry")) {
        setGeometry(settings.value("geometry").value<QRect>()); 
      }
      if (settings.contains("windowState")) {
        restoreState(settings.value("windowState").toByteArray()); 
      }

      // The geom/state isn't enough for main windows to correctly remember
      //   their position and size, so let's restore those on top of
      //   the geom and state.
    if (!settings.value("pos").toPoint().isNull())
      if (!settings.value("pos").toPoint().isNull()) {
        move(settings.value("pos").toPoint());

    m_maxThreadCount = settings.value("maxThreadCount", m_maxThreadCount).toInt();
    applyMaxThreadCount();

      }
    }
  }


@@ -755,7 +757,7 @@ namespace Isis {
        m_directory->project()->save();
      }
    }
    //writeSettings(m_directory->project());
    writeSettings(m_directory->project());
    m_directory->project()->clear();

    QMainWindow::closeEvent(event);
+4 −1
Original line number Diff line number Diff line
@@ -138,6 +138,9 @@ namespace Isis {
   *                           Cleanup connections are made for the views and the docks to ensure
   *                           that cleanup happens for both.  Fixes #5433.
   *   @history 2018-06-13 Tracie Sucharski - Fixed cleanup of views and QDockWidgets.
   *   @history 2018-06-15 Tracie Sucharski - Fixed break to recent projects.  The readSettings
   *                           must be called before initializeActions to get the recent projects
   *                           from the config file.
   *  
   */
  class IpceMainWindow : public QMainWindow {