Unverified Commit 0af24e81 authored by Kristin's avatar Kristin Committed by GitHub
Browse files

Merge branch 'ipceDocks' into qsettings

parents 80eeabe2 b914aeea
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -225,8 +225,11 @@ namespace Isis {
   * @param view QWidget* The view to close.
   */
  void IpceMainWindow::removeView(QWidget *view) {
    view->close();
    QDockWidget *parentDock = qobject_cast<QDockWidget *>(view->parent());
    removeDockWidget(parentDock);
    m_viewDocks.removeAll(parentDock);
    delete view;
    delete parentDock;
  }


@@ -737,6 +740,9 @@ namespace Isis {
   */
  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
    // vs changing the project clean state every time the control is modified or saved.
    if (!m_directory->project()->isClean() || (m_directory->project()->activeControl() &&
+7 −0
Original line number Diff line number Diff line
@@ -159,6 +159,13 @@ 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.
   *   @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-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
+1 −0
Original line number Diff line number Diff line
@@ -1592,6 +1592,7 @@ namespace Isis {
          m_templateFileName, _FILEINFO_);
      QString message = fullError.toString();
      QMessageBox::information((QWidget *)parent(), "Error", message);
      emit setTemplateFailed(m_templateFileName);
      return false;
    }
  }
+2 −1
Original line number Diff line number Diff line
@@ -167,7 +167,6 @@ namespace Isis {
      QString templateFileName() {
        return m_templateFileName;
      };
      bool setTemplateFile(QString);
      void allowLeftMouse(bool allowMouse);

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

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

    connect(this, 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_templateFileNameLabel = new QLabel("Template File: " +
        m_measureEditor->templateFileName());
    m_templateFileNameLabel->setToolTip("Sub-pixel registration template File.");
    m_templateFileNameLabel->setWhatsThis("FileName of the sub-pixel "
    // Create a combobox to allow user to select either the default registration file or one of the
    // imported registration files.
    m_templateComboBox = new QComboBox();
    m_templateComboBox->setToolTip("Choose a template file");
    m_templateComboBox->setWhatsThis("FileName of the sub-pixel "
                  "registration template.  Refer to $ISISROOT/doc/documents/"
                  "PatternMatch/PatternMatch.html for a description of the "
                  "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;

    centralLayout->addWidget(m_cnetFileNameLabel);
    centralLayout->addWidget(m_templateFileNameLabel);
    centralLayout->addLayout(templateFileLayout);
    centralLayout->addWidget(createTopSplitter());
    centralLayout->addStretch();
    centralLayout->addWidget(m_measureEditor);
@@ -803,7 +824,6 @@ namespace Isis {
    //  to m_editPoint, otherwise create copy.  It will not be saved to net until "Save Point"
    //  is selected
    if (controlPoint->Parent() == NULL) {

      m_editPoint = controlPoint;
      // New point in editor, so colorize all save buttons
      colorizeAllSaveButtons("red");
@@ -812,8 +832,8 @@ namespace Isis {
      m_editPoint = controlPoint;
      // New point loaded, make sure all save button's text is default black color
      colorizeAllSaveButtons("black");

    }
    
    loadPoint(serialNumber);
    loadTemplateFile(m_measureEditor->templateFileName());
  }
@@ -1993,7 +2013,9 @@ namespace Isis {
      m_leftMeasure = NULL;
    }

    m_leftMeasure = ((*m_editPoint)[serial]);
    m_leftMeasure = new ControlMeasure();
    //  Find measure for each file    
    *m_leftMeasure = *((*m_editPoint)[serial]);
    
    //  If m_leftCube is not null, delete before creating new one
    m_leftCube.reset(new Cube(file, "r"));
@@ -2040,7 +2062,10 @@ namespace Isis {
      delete m_rightMeasure;
      m_rightMeasure = NULL;
    }
    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
    m_rightCube.reset(new Cube(file, "r"));
@@ -2239,7 +2264,6 @@ namespace Isis {

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


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

@@ -2386,6 +2409,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
   *
Loading