Commit b4e97615 authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

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

parents 195e4b57 66d7bd3d
Loading
Loading
Loading
Loading
+25 −21
Original line number Diff line number Diff line
@@ -95,11 +95,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() ) );
    }
@@ -165,9 +168,6 @@ namespace Isis {
    createMenus();
    createToolBars();

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

@@ -207,11 +207,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
@@ -231,22 +244,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();
  }

@@ -497,7 +501,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) {
@@ -709,7 +713,7 @@ namespace Isis {
        m_directory->project()->save();
      }
    }
    writeSettings(m_directory->project());
    //writeSettings(m_directory->project());
    m_directory->project()->clear();

    QMainWindow::closeEvent(event);
+3 −2
Original line number Diff line number Diff line
@@ -137,9 +137,9 @@ 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 - Removed code adding the save active control net button and
   *                           the toolpad, since control nets can be saved with the project save button.
   *
   */
  class IpceMainWindow : public QMainWindow {
      Q_OBJECT
@@ -154,6 +154,7 @@ namespace Isis {
      void removeAllViews();

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

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

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

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

      void writeSettings(const Project *project) const;

    private:
      /**
+5 −3
Original line number Diff line number Diff line
@@ -219,8 +219,6 @@ namespace Isis {
    saveMeasureLayout->insertStretch(-1);

    m_cnetFileNameLabel = new QLabel("Control Network: " + m_cnetFileName);
    m_cnetFileNameLabel->setToolTip("Name of opened control network file.");
    m_cnetFileNameLabel->setWhatsThis("Name of opened control network file.");

    m_templateFileNameLabel = new QLabel("Template File: " +
        m_measureEditor->templateFileName());
@@ -589,7 +587,11 @@ namespace Isis {
    m_controlNet = control->controlNet();
    m_cnetFileName = control->fileName();

    m_cnetFileNameLabel->setText("Control Network: " + m_cnetFileName);
    QStringList cnetDirs = m_cnetFileName.split('/');
    QString strippedCnetFilename = cnetDirs.value(cnetDirs.length() -1);
    m_cnetFileNameLabel->setText("Control Network: " + strippedCnetFilename);
    m_cnetFileNameLabel->setToolTip(m_cnetFileName);
    m_cnetFileNameLabel->setWhatsThis(m_cnetFileName);
    setWindowTitle("Control Point Editor- Control Network File: " + m_cnetFileName);

    emit newControlNetwork(m_controlNet);
+2 −0
Original line number Diff line number Diff line
@@ -90,6 +90,8 @@ namespace Isis {
   *                           Fixes #5399.
   *   @history 2018-05-02 Tracie Sucharski - Colorize save buttons properly when creating new
   *                           control point and loading a different control point. 
   *   @history 2018-06-11 Summer Stapleton - Stripped path from displayed filename of Control 
   *                           Network and set the tooltip to the full path for easier access.
   */
  class ControlPointEditWidget : public QWidget {
    Q_OBJECT
+3 −3
Original line number Diff line number Diff line
@@ -200,7 +200,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()));

@@ -211,7 +211,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];
Loading