Unverified Commit e150d935 authored by Tracie Sucharski's avatar Tracie Sucharski Committed by GitHub
Browse files

Merge branch 'ipceDocks' into ipceDocks

parents 7be1a1dd a77b761c
Loading
Loading
Loading
Loading
+42 −0
Original line number Original line Diff line number Diff line
@@ -387,6 +387,10 @@ namespace Isis {
    connect( tabViewsAction, SIGNAL(triggered()), this, SLOT(tabViews()) );
    connect( tabViewsAction, SIGNAL(triggered()), this, SLOT(tabViews()) );
    m_viewMenuActions.append(tabViewsAction);
    m_viewMenuActions.append(tabViewsAction);


    QAction *tileViewsAction = new QAction("Tile Views", this);
    connect( tileViewsAction, SIGNAL(triggered()), this, SLOT(tileViews()) );
    m_viewMenuActions.append(tileViewsAction);

    QAction *undoAction = m_directory->undoAction();
    QAction *undoAction = m_directory->undoAction();
    undoAction->setShortcut(Qt::Key_Z | Qt::CTRL);
    undoAction->setShortcut(Qt::Key_Z | Qt::CTRL);


@@ -617,6 +621,9 @@ namespace Isis {
   *                           References #4358.
   *                           References #4358.
   *   @history 2017-10-17 Tyler Wilson Added a [recent projects] group for the saving and
   *   @history 2017-10-17 Tyler Wilson Added a [recent projects] group for the saving and
   *                           restoring of recently opened projects.  References #4492.
   *                           restoring of recently opened projects.  References #4492.
   *   @history Kaitlyn Lee 2018-07-09 - Added the value "maximized" in the project settings
   *                           so that a project remembers if it was in fullscreen when saved.
   *                           Fixes #5175.
   */
   */
  void IpceMainWindow::writeSettings(Project *project) {
  void IpceMainWindow::writeSettings(Project *project) {


@@ -630,6 +637,7 @@ namespace Isis {


    projectSettings.setValue("geometry", QVariant(geometry()));
    projectSettings.setValue("geometry", QVariant(geometry()));
    projectSettings.setValue("windowState", saveState());
    projectSettings.setValue("windowState", saveState());
    projectSettings.setValue("maximized", isMaximized());
    projectSettings.sync();
    projectSettings.sync();
  }
  }


@@ -652,6 +660,10 @@ namespace Isis {
   *                Fixes #5075.
   *                Fixes #5075.
   *   @history Makayla Shepherd 2018-06-10 - Settings are read from the project root ipce.config.
   *   @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.
   *                If that does not exist then we read from .Isis/ipce/ipce.config.
   *   @history Kaitlyn Lee 2018-07-09 - Added the call showNormal() so when a project is
   *                not saved in fullscreen, the window will resize to the project's
   *                window size. This also fixes the history/warning tabs being misplaced
   *                when opening a project. Fixes #5175.
   */
   */
  void IpceMainWindow::readSettings(Project *project) {
  void IpceMainWindow::readSettings(Project *project) {
    // Ensure that the Project pointer is not NULL
    // Ensure that the Project pointer is not NULL
@@ -685,7 +697,12 @@ namespace Isis {
    QSettings projectSettings(FileName(filePath).expanded(), QSettings::NativeFormat);
    QSettings projectSettings(FileName(filePath).expanded(), QSettings::NativeFormat);


    if (!isFullScreen) {
    if (!isFullScreen) {
      // If a project was not in fullscreen when saved, restore the project's window size.
      if (!projectSettings.value("maximized").toBool()) {
        showNormal();
      }
      setGeometry(projectSettings.value("geometry").value<QRect>());
      setGeometry(projectSettings.value("geometry").value<QRect>());

      if (!project->isTemporaryProject()) {
      if (!project->isTemporaryProject()) {
        restoreState(projectSettings.value("windowState").toByteArray());
        restoreState(projectSettings.value("windowState").toByteArray());
      }
      }
@@ -754,6 +771,9 @@ namespace Isis {
   */
   */
  void IpceMainWindow::closeEvent(QCloseEvent *event) {
  void IpceMainWindow::closeEvent(QCloseEvent *event) {


    foreach(TemplateEditorWidget *templateEditor, m_directory->templateEditorViews()) {
      templateEditor->saveOption();
    }
    // The active control is checked here for modification because this was the simplest solution
    // The active control is checked here for modification because this was the simplest solution
    // vs changing the project clean state every time the control is modified or saved.
    // vs changing the project clean state every time the control is modified or saved.
    if (!m_directory->project()->isClean() || (m_directory->project()->activeControl() &&
    if (!m_directory->project()->isClean() || (m_directory->project()->activeControl() &&
@@ -847,6 +867,28 @@ namespace Isis {
  }
  }




  /**
   * Tile all open attached/detached views
   */
  void IpceMainWindow::tileViews() {
    // splitDockWidget() takes two widgets and tiles them, so an easy way to do
    // this is to grab the first view and tile the rest with the first.
    QDockWidget *firstView = m_viewDocks.first();

    foreach (QDockWidget *currentView, m_viewDocks) {
      // We have to reattach a view before it can be tiled. If it is attached,
      // this will have no affect. We have to call addDockWidget() to untab any views.
      currentView->setFloating(false);
      addDockWidget(Qt::LeftDockWidgetArea, currentView, Qt::Horizontal);

      if (currentView == firstView) {
        continue;
      }
      splitDockWidget(firstView, currentView, Qt::Horizontal);
    }
  }


/**
/**
 * Raises the warningWidget to the front of the tabs. Connected to warning signal from directory.
 * Raises the warningWidget to the front of the tabs. Connected to warning signal from directory.
 */
 */
+13 −1
Original line number Original line Diff line number Diff line
@@ -161,10 +161,21 @@ namespace Isis {
   *                           state can be reset after the IpceMainWindow::show() causes resize and
   *                           state can be reset after the IpceMainWindow::show() causes resize and
   *                           move events which in turn cause the project clean flag to be false
   *                           move events which in turn cause the project clean flag to be false
   *                           even though the project has just opened.
   *                           even though the project has just opened.
   *   @history 2018-07-07 Summer Stapleton - Added check in the closeEvent() for changes to any 
   *                           TemplateEditorWidget currently open to create a pop-up warning/
   *                           option to save.
   *   @history 2018-07-09 Kaitlyn Lee - Added tileViews() and the menu option to tile all docked/undocked
   *                           and tabbed/untabbed views. Changed removeView() to delete the parent dock widget.
   *                           If we do not delete the dock widget, an empty dock widget will remain where the
   *                           view used to be.
   *   @history 2018-07-10 Tracie Sucharski - Change initial interface of views to tabbed view.
   *   @history 2018-07-10 Tracie Sucharski - Change initial interface of views to tabbed view.
   *                           Changed the QMainWindow separator to a different color and wider size
   *                           Changed the QMainWindow separator to a different color and wider size
   *                           for ease of use.  Create the QMainWindow initial size to prevent the
   *                           for ease of use.  Create the QMainWindow initial size to prevent the
   *                           Viewports in CubeDnView from being created as a small size.
   *                           Viewports in CubeDnView from being created as a small size.
   *   @history 2018-07-11 Kaitlyn Lee - Added a value in the project settings that stores whether a
   *                           project was in fullscreen or not when saved. If not, we call showNormal()
   *                           to restore the poject's window size. This also fixes the warning/history tabs
   *                           being misplaced when opening a project. Fixes #5175.
   */
   */
  class IpceMainWindow : public QMainWindow {
  class IpceMainWindow : public QMainWindow {
      Q_OBJECT
      Q_OBJECT
@@ -192,6 +203,7 @@ namespace Isis {
      void enterWhatsThisMode();
      void enterWhatsThisMode();


      void tabViews();
      void tabViews();
      void tileViews();


      void raiseWarningTab();
      void raiseWarningTab();


+1 −0
Original line number Original line Diff line number Diff line
@@ -1592,6 +1592,7 @@ namespace Isis {
          m_templateFileName, _FILEINFO_);
          m_templateFileName, _FILEINFO_);
      QString message = fullError.toString();
      QString message = fullError.toString();
      QMessageBox::information((QWidget *)parent(), "Error", message);
      QMessageBox::information((QWidget *)parent(), "Error", message);
      emit setTemplateFailed(m_templateFileName);
      return false;
      return false;
    }
    }
  }
  }
+2 −1
Original line number Original line Diff line number Diff line
@@ -167,7 +167,6 @@ namespace Isis {
      QString templateFileName() {
      QString templateFileName() {
        return m_templateFileName;
        return m_templateFileName;
      };
      };
      bool setTemplateFile(QString);
      void allowLeftMouse(bool allowMouse);
      void allowLeftMouse(bool allowMouse);


    signals:
    signals:
@@ -175,9 +174,11 @@ namespace Isis {
      void updateRightView(double sample, double line);
      void updateRightView(double sample, double line);
      void measureSaved();
      void measureSaved();
      void newControlNetwork(ControlNet *);
      void newControlNetwork(ControlNet *);
      void setTemplateFailed(QString);
      void stretchChipViewport(Stretch *, CubeViewport *);
      void stretchChipViewport(Stretch *, CubeViewport *);


    public slots:
    public slots:
      bool setTemplateFile(QString);
      void setPoint(ControlPoint *editPoint, SerialNumberList *snList);
      void setPoint(ControlPoint *editPoint, SerialNumberList *snList);
      void setLeftMeasure(ControlMeasure *leftMeasure,
      void setLeftMeasure(ControlMeasure *leftMeasure,
                          Cube *leftCube, QString pointId);
                          Cube *leftCube, QString pointId);
+83 −7
Original line number Original line Diff line number Diff line
@@ -52,6 +52,7 @@
#include "Shape.h"
#include "Shape.h"
#include "ShapeList.h"
#include "ShapeList.h"
#include "SpecialPixel.h"
#include "SpecialPixel.h"
#include "TemplateList.h"
#include "ToolPad.h"
#include "ToolPad.h"
#include "UniversalGroundMap.h"
#include "UniversalGroundMap.h"
#include "ViewportMainWindow.h"
#include "ViewportMainWindow.h"
@@ -85,6 +86,9 @@ namespace Isis {


    connect(this, SIGNAL(newControlNetwork(ControlNet *)),
    connect(this, SIGNAL(newControlNetwork(ControlNet *)),
            m_measureEditor, SIGNAL(newControlNetwork(ControlNet *)));
            m_measureEditor, SIGNAL(newControlNetwork(ControlNet *)));

    connect(m_directory->project(), SIGNAL(templatesAdded(TemplateList *)),
            this, SLOT(addTemplates(TemplateList *)));
  }
  }




@@ -218,18 +222,35 @@ namespace Isis {


    m_cnetFileNameLabel = new QLabel("Control Network: " + m_cnetFileName);
    m_cnetFileNameLabel = new QLabel("Control Network: " + m_cnetFileName);


    m_templateFileNameLabel = new QLabel("Template File: " +
    // Create a combobox to allow user to select either the default registration file or one of the
        m_measureEditor->templateFileName());
    // imported registration files.
    m_templateFileNameLabel->setToolTip("Sub-pixel registration template File.");
    m_templateComboBox = new QComboBox();
    m_templateFileNameLabel->setWhatsThis("FileName of the sub-pixel "
    m_templateComboBox->setToolTip("Choose a template file");
    m_templateComboBox->setWhatsThis("FileName of the sub-pixel "
                  "registration template.  Refer to $ISISROOT/doc/documents/"
                  "registration template.  Refer to $ISISROOT/doc/documents/"
                  "PatternMatch/PatternMatch.html for a description of the "
                  "PatternMatch/PatternMatch.html for a description of the "
                  "contents of this file.");
                  "contents of this file.");
    m_templateComboBox->addItem(m_measureEditor->templateFileName());
    QList <TemplateList *> regTemplates = m_directory->project()->regTemplates();
    foreach(TemplateList *templateList, regTemplates) {
      foreach(Template *templateFile, *templateList){
        m_templateComboBox->addItem(templateFile->importName() 
                                    + "/" + FileName(templateFile->fileName()).name());
      }
    }
    QFormLayout *templateFileLayout = new QFormLayout();
    templateFileLayout->addRow("Template File:", m_templateComboBox);

    // Set-up connections to give registration combobox functionality
    connect(m_templateComboBox, SIGNAL(activated(QString)), 
            this, SLOT(setTemplateFile(QString)));
    connect(m_measureEditor, SIGNAL(setTemplateFailed(QString)), 
            this, SLOT(resetTemplateComboBox(QString)));


    QVBoxLayout * centralLayout = new QVBoxLayout;
    QVBoxLayout * centralLayout = new QVBoxLayout;


    centralLayout->addWidget(m_cnetFileNameLabel);
    centralLayout->addWidget(m_cnetFileNameLabel);
    centralLayout->addWidget(m_templateFileNameLabel);
    centralLayout->addLayout(templateFileLayout);
    centralLayout->addWidget(createTopSplitter());
    centralLayout->addWidget(createTopSplitter());
    centralLayout->addStretch();
    centralLayout->addStretch();
    centralLayout->addWidget(m_measureEditor);
    centralLayout->addWidget(m_measureEditor);
@@ -2049,6 +2070,10 @@ namespace Isis {
    //  Find measure for each file
    //  Find measure for each file
    *m_rightMeasure = *((*m_editPoint)[serial]);
    *m_rightMeasure = *((*m_editPoint)[serial]);


    m_rightMeasure = new ControlMeasure();
    //  Find measure for each file
    *m_rightMeasure = *((*m_editPoint)[serial]);
    
    //  If m_rightCube is not null, delete before creating new one
    //  If m_rightCube is not null, delete before creating new one
    m_rightCube.reset(new Cube(file, "r"));
    m_rightCube.reset(new Cube(file, "r"));


@@ -2246,7 +2271,6 @@ namespace Isis {


    m_templateModified = false;
    m_templateModified = false;
    m_saveTemplateFile->setEnabled(false);
    m_saveTemplateFile->setEnabled(false);
    m_templateFileNameLabel->setText("Template File: " + fn);
  }
  }




@@ -2332,7 +2356,6 @@ namespace Isis {
    if (m_measureEditor->setTemplateFile(fn)) {
    if (m_measureEditor->setTemplateFile(fn)) {
      m_templateModified = false;
      m_templateModified = false;
      m_saveTemplateFile->setEnabled(false);
      m_saveTemplateFile->setEnabled(false);
      m_templateFileNameLabel->setText("Template File: " + fn);
    }
    }
  }
  }


@@ -2393,6 +2416,59 @@ namespace Isis {
  }
  }




  /**
  * Add registration TemplateList to combobox when imported to project
  *
  * @param templateList Reference to TemplateList that was imported
  */
  void ControlPointEditWidget::addTemplates(TemplateList *templateList) {
    if(templateList->type() == "registrations") {
      for(int i = 0; i < templateList->size(); i++) {
        m_templateComboBox->addItem(templateList->at(i)->importName()
                                    + "/" + FileName(templateList->at(i)->fileName()).name());
      }
    }
  }
  
  
  /**
  * Appends the filename to the registrations path (unless this is the default template) and calls 
  * setTemplateFile for the control measure
  *
  * @param filename This is the import directory and the filename of the template file selected from
  *                 the QComboBox.
  */
  void ControlPointEditWidget::setTemplateFile(QString filename) {
    QString expandedFileName = filename;
    if(!filename.startsWith("$base")){
      expandedFileName = m_directory->project()->templateRoot() 
                                 + "/registrations/" + filename;
    }
    if (m_measureEditor->setTemplateFile(expandedFileName)) {
      loadTemplateFile(expandedFileName);
    }
  }
  
  
  /**
  * Reset the selected template in the template combobox if the template selected by the user does 
  * not satisfy requirements for the control measure.
  *
  * @param fileName The filename that was previously selected in the template combo box
  */
  void ControlPointEditWidget::resetTemplateComboBox(QString fileName) {
    if(fileName.startsWith("$base")) {
      m_templateComboBox->setCurrentIndex(0);
    }
    QList<QString> components = fileName.split("/");
    int size = components.size();
    int index = m_templateComboBox->findText(components[size - 2] + "/" + components[size - 1]);
    if (index != -1) {
      m_templateComboBox->setCurrentIndex(index);
    }
  }


  /**
  /**
   * Update the current editPoint information in the Point Editor labels
   * Update the current editPoint information in the Point Editor labels
   *
   *
Loading