Commit 1264cb75 authored by Cole Neubauer's avatar Cole Neubauer
Browse files

A new project can now be opened at any time Fixes #4969 #4997

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@7874 41f8697f-d340-4b68-9986-7bafba869bb8
parent 2c3c57f8
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ namespace Isis {
      m_directory = new Directory(this);
      connect(m_directory, SIGNAL( newWidgetAvailable(QWidget *) ),
              this, SLOT( addView(QWidget *) ) );
      connect(m_directory, SIGNAL( directoryCleaned() ),
              this, SLOT( removeAllViews() ) );
      connect(m_directory->project(), SIGNAL(projectLoaded(Project *)),
              this, SLOT(readSettings(Project *)));
      connect(m_directory, SIGNAL( newWarning() ),
@@ -217,7 +219,35 @@ namespace Isis {
      }
    }
  }
  /**
   * Removes All Views in main window, connected to directory signal directoryCleaned()
   */
  void IpceMainWindow::removeAllViews() {
    setWindowTitle("ipce");
    QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() );
    if (mdiArea){
      QMdiSubWindow* window = new QMdiSubWindow();
      window->show();
      window->activateWindow();
      mdiArea->addSubWindow(window);
      mdiArea->closeAllSubWindows();
      delete window;
    }
    if(!m_detachedViews.isEmpty()) {
      foreach(QMainWindow* view, m_detachedViews) {
        view->close();
      }
    }

    QList<QDockWidget *> docks = tabifiedDockWidgets(m_projectDock);
    if(docks.count() > 1) {
      foreach(QDockWidget* widget, docks) {
        if(widget != m_projectDock) {
          delete widget;
        }
      }
    }
  }

  /**
   * Cleans up the directory.
@@ -766,6 +796,7 @@ namespace Isis {
    }

    QMainWindow *newWindow = new QMainWindow(this, Qt::Window);
    m_detachedViews.append(newWindow);
    newWindow->setCentralWidget(view);
    newWindow->setWindowTitle( view->windowTitle() );

+6 −0
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ namespace Isis {
   *                           (which indicates why it is disabled by default). Fixes #4749.
   *   @history 2017-06-22 Tracie Sucharski - Renamed from CNetSuiteMainWindow when application was
   *                           renamed to ipce from cnetsuite.
   *   @history 2017-07-12 Cole Neubauer - Added removeAllViews function and m_detachedViews member
   *                           variable. Needed to clear out an old projects views from the window
   *                           when opening a new project. Fixes #4969
   *  @history 2017-07-14 Cole Neubauer - Added private slot raiseWarningTab to be able to raise
   *                           the warning tab when a new warning happens.
   *                           Fixes #5041 
@@ -99,6 +102,8 @@ namespace Isis {

    public slots:
      void addView(QWidget *newWidget);
      void removeAllViews();

      void setActiveView(AbstractProjectItemView *view);
      void updateMenuActions();
      void updateToolBarActions();
@@ -138,6 +143,7 @@ namespace Isis {
      QPointer<Directory> m_directory;

      QDockWidget *m_projectDock;
      QList<QMainWindow *> m_detachedViews; //!< List to keep track of any detached main windows
      QDockWidget *m_warningsDock;
      /**
       * This is the "goal" or "estimated" maximum number of active threads running in this program
+22 −21
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ namespace Isis {

    //ProjectItem * selectedItem = project()->directory()->model()->selectedItems();
    project()->directory()->addBundleObservationView(fileItem());
    project()->setClean(false);
  }

}
+3 −3
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ namespace Isis {
   * @author 2017-05-04 Tracie Sucharski
   *
   * @internal
   *  @history 2017-07-25 Cole Neubauer - Added project()->setClean call #4969
   */
  class BundleObservationViewWorkOrder : public WorkOrder {
      Q_OBJECT
@@ -58,4 +59,3 @@ namespace Isis {
  };
}
#endif
+1 −1
Original line number Diff line number Diff line
@@ -91,10 +91,10 @@ namespace Isis {
      //project()->directory()->addCnetEditorView(controlList().first());
      project()->directory()->addCnetEditorView(controlList()->at(i));
    }
    project()->setClean(false);
  }

  void CnetEditorViewWorkOrder::undoExecution() {
    delete project()->directory()->cnetEditorViews().last();
  }
}
Loading