Commit 984af3fc authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

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

parents bc016b90 66d7bd3d
Loading
Loading
Loading
Loading
+25 −21
Original line number Diff line number Diff line
@@ -93,11 +93,14 @@ namespace Isis {
      m_directory = new Directory(this);
      connect(m_directory, SIGNAL( newWidgetAvailable(QWidget *) ),
              this, SLOT( addView(QWidget *) ) );
      connect(m_directory, SIGNAL(viewClosed(QWidget *)), this, SLOT(removeView(QWidget *)));
      connect(m_directory, SIGNAL(viewClosed(QWidget *)),
              this, SLOT(removeView(QWidget *)));
      connect(m_directory, SIGNAL( directoryCleaned() ),
              this, SLOT( removeAllViews() ) );
      connect(m_directory->project(), SIGNAL(projectLoaded(Project *)),
              this, SLOT(readSettings(Project *)));
      connect(m_directory->project(), SIGNAL(projectSaved(Project *)),
              this, SLOT(writeSettings(Project *)));
      connect(m_directory, SIGNAL( newWarning() ),
              this, SLOT( raiseWarningTab() ) );
    }
@@ -163,9 +166,6 @@ namespace Isis {
    createMenus();
    createToolBars();

//  setTabbedViewMode();
//  centralWidget->setTabsMovable(true);
//  centralWidget->setTabsClosable(true);
    // Read default app settings
    readSettings(m_directory->project() );

@@ -205,11 +205,24 @@ namespace Isis {
    // Connections for cleanup in both directions to make sure both views and docks are cleaned up
    connect(newWidget, SIGNAL(destroyed(QObject *)), dock, SLOT(deleteLater()));
    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 *)));

    // Save view docks for cleanup during a project close
    m_viewDocks.append(dock);
  }


  void IpceMainWindow::cleanupViewDockList(QObject *obj) {

    QDockWidget *dock = static_cast<QDockWidget *>(obj);
    if (dock) {
      m_viewDocks.removeAll(dock);
    }
  }


  /**
   * @description This slot is connected from Directory::viewClosed(QWidget *) signal.  It will
   * close the given view and delete the view. This was written to handle
@@ -229,22 +242,13 @@ namespace Isis {
   */
  void IpceMainWindow::removeAllViews() {
    setWindowTitle("ipce");
//  qDebug()<<"IpceMainWindow::removeAllViews  directory footprint count = "<<m_directory->footprint2DViews().count();
//  qDebug()<<"                                directory cube disp count = "<<m_directory->cubeDnViews().count();

    // Find all children of IpceMainWindow and close
    QList<QDockWidget *> dockedWidgets = findChildren<QDockWidget *>();
//  qDebug()<<"           # docks before removal = "<<dockedWidgets.count();
    foreach (QDockWidget *dock, m_viewDocks) {
      if (dock) {
        removeDockWidget(dock);
        m_viewDocks.removeAll(dock);
        delete dock;
      }

    QList<QDockWidget *> dockedWidgets2 = findChildren<QDockWidget *>();
//  qDebug()<<"           any docks left"<<dockedWidgets2.count();
//  qDebug()<<"IpceMainWindow::removeAllViews  directory footprint count = "<<m_directory->footprint2DViews().count();
//  qDebug()<<"                                directory cube disp count = "<<m_directory->cubeDnViews().count();
    }
    m_viewDocks.clear();
  }

@@ -525,7 +529,7 @@ namespace Isis {
   *   @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(const Project *project) const {
  void IpceMainWindow::writeSettings(Project *project) {

    // Ensure that we are not using a NULL pointer
    if (!project) {
@@ -737,7 +741,7 @@ namespace Isis {
        m_directory->project()->save();
      }
    }
    writeSettings(m_directory->project());
    //writeSettings(m_directory->project());
    m_directory->project()->clear();

    QMainWindow::closeEvent(event);
+3 −1
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ namespace Isis {
   *                           for cleanup because there is no way to get the dock from the view.
   *                           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-13 Kaitlyn Lee - Since views now inherit from QMainWindow, each individual
   *                           view has its own toolbar, so having an active toolbar and tool pad is
   *                           not needed.
@@ -154,6 +155,7 @@ namespace Isis {
      void removeAllViews();

      void readSettings(Project *);
      void writeSettings(Project *project);

    protected:
      void closeEvent(QCloseEvent *event);
@@ -166,6 +168,7 @@ namespace Isis {
      void tabAllViews();

      void raiseWarningTab();
      void cleanupViewDockList(QObject *obj);
    private:
      Q_DISABLE_COPY(IpceMainWindow);

@@ -175,7 +178,6 @@ namespace Isis {
      void createMenus();
      void createToolBars();

      void writeSettings(const Project *project) const;

    private:
      /**
+2 −2
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ namespace Isis {
    tools->append(new HistogramTool(this));
    tools->append(new StatisticsTool(this));
    tools->append(new StereoTool(this));
    tools->append(new HelpTool(this));
    //tools->append(new HelpTool(this));

    tools->append(new TrackTool(statusBar()));

@@ -200,7 +200,7 @@ namespace Isis {
    m_viewMenu = menuBar()->addMenu("&View");
    m_optionsMenu = menuBar()->addMenu("&Options");
    m_windowMenu = menuBar()->addMenu("&Window");
    m_helpMenu = menuBar()->addMenu("&Help");
    //m_helpMenu = menuBar()->addMenu("&Help");

    for (int i = 0; i < tools->count(); i++) {
      Tool *tool = (*tools)[i];
+2 −0
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@ namespace Isis {
   *                           AbstractProjectItemView now inherits from QMainWindow, so the
   *                           Workspace of this view is the centralWidget. This needs further work
   *                           to cleanup and fit in with the new docked view interface.git
   *   @history 2018-06-12 Kaitlyn Lee - Removed help menu and the "What's This?" action because the
   *                           ipce help menu has this action.
   *   @history 2018-06-13 Kaitlyn Lee - Since views now inherit from QMainWindow, each individual
   *                           view has its own toolbar, so having getters that return toolbar
   *                           actions to fill the toolbar of the IpceMainWindow are unnecessary.
+2 −0
Original line number Diff line number Diff line
@@ -2429,6 +2429,8 @@ namespace Isis {

    directoryStateWriter.writeEndDocument();
    m_isOpen = true;

    emit projectSaved(this);
  }


Loading