Commit 33883f33 authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

Merge branch 'ipceDocks' of https://github.com/USGS-Astrogeology/ISIS3 into ipceDocks

parents d2ee5f6d 5dd4f0e7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42,3 +42,4 @@ print.prt
*/tsts/*/input/*
*/tsts/*/truth/*
*/tsts/*/output/*
data/
+65 −54
Original line number Diff line number Diff line
@@ -498,16 +498,17 @@ namespace Isis {
  }


  /**
   * Writes the global settings like recent projects and thread count.
   */
  void IpceMainWindow::writeGlobalSettings(Project *project) {

    QString appName = QApplication::applicationName();
    QSettings globalSettings(
        FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + "Project.config")
          .expanded(),

    QSettings globalSettings(FileName("$HOME/.Isis/" + appName + "/ipce.config").expanded(),
        QSettings::NativeFormat);

    //  If temporary project open same geometry of mainwindow
    if (project->projectRoot().contains("tmpProject")) {
    if (project->isTemporaryProject()) {
      globalSettings.setValue("geometry", QVariant(geometry()));
    }

@@ -571,12 +572,13 @@ namespace Isis {
      QString projName = project->name();
      QString t0String=QString::number(t0);

      if (!project->projectRoot().contains("tmpProject") &&
      if (!project->isTemporaryProject() &&
          !projectPaths.contains( project->projectRoot())) {
        globalSettings.setValue(t0String+"%%%%%"+projName,project->projectRoot());
      }
    }
    globalSettings.endGroup();
    globalSettings.sync();
  }


@@ -588,9 +590,9 @@ namespace Isis {
   * 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.
   * $HOME/.Isis/$APPNAME/ipce.config.
   * When a project, ProjectName, is loaded, the config file used is
   * $HOME/.Isis/$APPNAME/$APPNAME_ProjectName.config.
   * project->projectRoot()/ipce.config.
   *
   * @param[in] project Pointer to the project that is currently loaded (default is "Project")
   *
@@ -607,18 +609,12 @@ namespace Isis {
      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 projectSettings(FileName(project->newProjectRoot() + "/ipce.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);
    projectSettings.sync();
  }


@@ -626,9 +622,9 @@ namespace Isis {
   * Read the window positioning and state information from the config file.
   *
   * When running ipce without opening a project, the config file read is
   * $HOME/.Isis/$APPNAME/$APPNAME_Project.config
   * Otherwise, when running ipce and opening a project (ProjectName), the config file read is
   * $HOME/.Isis/$APPNAME/$APPNAME_ProjectName.config
   * $HOME/.Isis/$APPNAME/ipce.config
   * When running ipce and opening a project (ProjectName), the config file read is
   * project->projectRoot()/ipce.config
   *
   * @param[in] project (Project *) The project that was loaded.
   *
@@ -636,8 +632,10 @@ namespace Isis {
   *   @history Ian Humphrey - Settings are now read on a project name basis. References #4358.
   *   @history Tyler Wilson 2017-11-02 - Settings now read recent projects.  References #4492.
   *   @history Tyler Wilson 2017-11-13 - Commented out a resize call near the end because it
   *                                      was messing with the positions of widgets after a
   *                                      project was loaded.  Fixes #5075.
   *                was messing with the positions of widgets after a project was loaded.  
   *                Fixes #5075.
   *   @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.
   */
  void IpceMainWindow::readSettings(Project *project) {
    // Ensure that the Project pointer is not NULL
@@ -646,36 +644,59 @@ namespace Isis {
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    
    // Set the path of the settings file
    // The default is to assume that the project has an ipce.config in it
    // If the file does not exist then we read settings from .Isis/ipce/ipce.config
    QString appName = QApplication::applicationName();
    QString filePath = project->projectRoot() + "/ipce.config";
    bool isFullScreen = false;
    if (!FileName(filePath).fileExists()) {
      filePath = "$HOME/.Isis/" + appName + "/ipce.config";
      // If the $HOME/.Isis/ipce/ipce.config does not exist then we want ipce to show up in 
      // in full screen. In other words the default geometry is full screen
      if (!FileName(filePath).fileExists()) {
        isFullScreen = true;
      }
    }
    
    QSettings settings(
        FileName("$HOME/.Isis/" + appName + "/" + appName + "_" + project->name() + ".config")
          .expanded(), QSettings::NativeFormat);

    // General settings
    if (project->name() == "Project") {
      setWindowTitle("ipce");
    }
    else {
      setWindowTitle( project->name() );
    }

    QSettings projectSettings(FileName(filePath).expanded(), QSettings::NativeFormat);
    
      //  Read  generic geometry
      if (settings.contains("geometry")) {
        setGeometry(settings.value("geometry").value<QRect>()); 
    if (!isFullScreen) {
      setGeometry(projectSettings.value("geometry").value<QRect>());
      if (!project->isTemporaryProject()) {
        restoreState(projectSettings.value("windowState").toByteArray());
      }
    }
    else {
      this->showMaximized();
    }

    if (project->name() == "Project") {
      QSettings globalSettings(FileName("$HOME/.Isis/" + appName + "/ipce.config").expanded(), 
                              QSettings::NativeFormat);

      QStringList projectNameList;
      QStringList projectPathList;
      settings.beginGroup("recent_projects");
      QStringList keys = settings.allKeys();
      globalSettings.beginGroup("recent_projects");
      QStringList keys = globalSettings.allKeys();
      QRegExp underscore("%%%%%");

      foreach (QString key, keys) {
        QString childKey = "recent_projects/"+key;
        QString projectPath = settings.value(key).toString();
        QString projectPath = globalSettings.value(key).toString();
        QString projectName = projectPath.split("/").last();
        projectPathList.append(projectPath) ;
        projectNameList.append(projectName);
      }

      settings.endGroup();
      globalSettings.endGroup();

      QStringList projectPathReverseList;
      for (int i = projectPathList.count() - 1; i >= 0; i--) {
@@ -697,25 +718,15 @@ namespace Isis {

      m_directory->setRecentProjectsList(projectPathListTruncated);
      m_directory->updateRecentProjects();
      m_maxThreadCount = settings.value("maxThreadCount", m_maxThreadCount).toInt();
      m_maxThreadCount = globalSettings.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()) {
        move(settings.value("pos").toPoint());
      }
    if (!projectSettings.value("pos").toPoint().isNull()) {
      move(projectSettings.value("pos").toPoint());
    }
//    m_directory->project()->setClean(true);
  }
+1 −4
Original line number Diff line number Diff line
@@ -159,9 +159,6 @@ namespace Isis {
   *                           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.
   *  
   *
   *
   */
  class IpceMainWindow : public QMainWindow {
      Q_OBJECT
@@ -192,6 +189,7 @@ namespace Isis {

      void raiseWarningTab();
      void cleanupViewDockList(QObject *obj);

    private:
      Q_DISABLE_COPY(IpceMainWindow);

@@ -201,7 +199,6 @@ namespace Isis {
      void createMenus();
      void createToolBars();


    private:
      /**
       * The directory stores all of the work orders that this program is capable of doing. This
+7 −10
Original line number Diff line number Diff line
@@ -152,21 +152,18 @@ namespace Isis {
        if (!m_projectPath.isEmpty()) {
          QUndoCommand::setText(tr("Open Project [%1]").arg(m_projectPath));
        }
        else {
          success = false;
        }
      }
      else {

        m_projectPath = toolTip();

          //We are dealing with a recent project

      }

    }
    else {
      success = false;
    }


    return success;
  }

+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ namespace Isis {
   *   @history 2017-11-09 Tyler Wilson - Made changes to isExecutable() to import functionality
   *                           needed in OpenRecentProjectWorkOrder into OpenProjectWorkOrder
   *                           since OpenRecentProjectWorker is being deleted.  Fixes #5220.
   *   @history 2018-06-14 Makayla Shepherd - Added an else so that when someone cancels the dialog
   *                           it will cancel properly.
   */
  class OpenProjectWorkOrder : public WorkOrder {
      Q_OBJECT
Loading