Commit 4ad7af99 authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

Made it so users can save a nonactive control and fixed the seg fault that...

Made it so users can save a nonactive control and fixed the seg fault that happened when a user tried to edit a cnet with no imported images.
parent ba193d07
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ namespace Isis {
    connect(CnetDisplayProperties::getInstance(), SIGNAL(compositionFinished()),
        this, SLOT(rebuildModels()));

    connect(this, SIGNAL(cnetModified()), this, SLOT(setCnetModified()));
    m_settingsPath = new QString(pathForSettings);

    QBoxLayout *mainLayout = createMainLayout();
@@ -1050,4 +1051,12 @@ namespace Isis {
      m_connectionModel->setFrozen(false);
    }
  }


  /**
   * Connected to cnetModified(). Sets the modification of m_control when the cnet is modified.
   */
  void CnetEditorWidget::setCnetModified() {
    m_control->setModified(true);
  }
}
+10 −0
Original line number Diff line number Diff line
@@ -76,6 +76,14 @@ namespace Isis {
   *                           CnetEditorView class for ipce.
   *   @history 2018-06-12 Kaitlyn Lee - Added m_sortDialog to keep track if a dialog exists
   *                           so only one instance can be open at a time.
   *   @history 2018-07-12 Kaitlyn Lee - Added setCnetModified() and the connection with
   *                           cnetModified() to call setModified(true) on a control when a user
   *                           edits a cnet. cnetModified() was only connected to a slot in
   *                           Directory, and this was connected to a slot in Project called
   *                           activeControlModified() that would call setModified(true) on the
   *                           active control. So, when a user changed any cnets, the only cnet that
   *                           was recognized as being modified was the active. Adding this allows
   *                           a user to save changes made to a nonactive cnet. Fixes #5414.
   */
  class CnetEditorWidget : public QWidget {
      Q_OBJECT
@@ -141,6 +149,8 @@ namespace Isis {
      void handlePointTableFilterCountsChanged(int visibleRows, int totalRows);
      void handleMeasureTableFilterCountsChanged(int visibleRows,
          int totalRows);
      void setCnetModified();


    private:
      //methods
+2 −2
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ namespace Isis {
    connect( m_project, SIGNAL(projectLoaded(Project *) ),
              this, SLOT(updateRecentProjects(Project *) ) );

    connect(this, SIGNAL(cnetModified()), m_project, SLOT(activeControlModified()));
    connect(this, SIGNAL(cnetModified()), m_project, SLOT(cnetModified()));

    connect(m_project, SIGNAL(activeControlSet(bool)), this, SLOT(newActiveControl(bool)));
    connect(m_project, SIGNAL(discardActiveControlEdits()),
+4 −1
Original line number Diff line number Diff line
@@ -259,6 +259,9 @@ namespace Isis {
   *                           objectName needs to be created.
   *   @history 2018-07-09 Kaitlyn Lee - Uncommented code that closes a ControlPointEditView when a new
   *                           active control is set.
   *   @history 2018-07-12 Kaitlyn Lee - Changed connection between cnetModified() and project's
   *                           activeControlModified() to cnetModified() and project's renamed
   *                           method cnetModified(). Fixes #5414.
   */
  class Directory : public QObject {
    Q_OBJECT
+30 −21
Original line number Diff line number Diff line
@@ -1907,8 +1907,10 @@ namespace Isis {
  }


  void Project::activeControlModified() {
    m_activeControl->setModified(true);
  /**
   * When a cnet is modified, set the project state to not clean.
   */
  void Project::cnetModified() {
    setClean(false);
  }

@@ -2337,6 +2339,13 @@ namespace Isis {
      //  Save current active control if it has been modified. If "Save As" is being processed,
      //  the active control is written in the Control::copyToNewProjectRoot so the control in
      //  current project is not modified.
      foreach (ControlList *controlList, *m_controls) {
        foreach (Control *control, *controlList) {
          if (control->isModified()) {
            control->write();
          }
        }
      }
      if (activeControl() && activeControl()->isModified()) {
        activeControl()->write();
      }
Loading