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

Changed connections that alerted views to redraw themselves when any cnet was modified.

parent 70967aa0
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -1288,6 +1288,7 @@ namespace Isis {
      }

      // emit a signal to alert user to save when exiting
      m_control->setModified(true);
      emit cnetModified();
      emit saveControlNet();

@@ -1682,6 +1683,7 @@ namespace Isis {

    // At exit, or when opening new net, use for prompting user for a save
    m_cnetModified = true;
    m_control->setModified(true);
    emit cnetModified();
    //   Refresh chipViewports to show new positions of controlPoints
    m_measureEditor->refreshChips();
+3 −1
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@ namespace Isis {
   *   @history 2018-06-28 Kaitlyn Lee - Removed shortcut from reload point button.
   *   @history 2018-07-07 Summer Stapleton - Added a QComboBox to the widget to allow for changing
   *                           the active registration template from the widget itself.
   *   @history 2018-07-13 Kaitlyn Lee - Added calls to setModified(true) when a cnet is modified.
   *                           References #5396.
   */
  class ControlPointEditWidget : public QWidget {
    Q_OBJECT
+18 −17
Original line number Diff line number Diff line
@@ -138,7 +138,14 @@ namespace Isis {
    connect( m_project, SIGNAL(projectLoaded(Project *) ),
              this, SLOT(updateRecentProjects(Project *) ) );

    // Send cnetModified() to project, so that we can set the project's clean state.
    // In the slot cnetModified(), it checks if the active was modified and then emits
    // activeControlModified(). This signal is connected below to this activeControlModified(),
    // which connects to views that use the active cnet to redraw themselves.
    // Ultimately, cnetModified() allows us to save changes made to any cnet, and
    // activeControlModified() allows other views to be redrawn. 
    connect(this, SIGNAL(cnetModified()), m_project, SLOT(cnetModified()));
    connect(project(), SIGNAL(activeControlModified()), this, SIGNAL(activeControlModified()));

    connect(m_project, SIGNAL(activeControlSet(bool)), this, SLOT(newActiveControl(bool)));
    connect(m_project, SIGNAL(discardActiveControlEdits()),
@@ -676,15 +683,8 @@ namespace Isis {
    connect(result->cnetEditorWidget(), SIGNAL(editControlPoint(ControlPoint *, QString)),
            this, SLOT(modifyControlPoint(ControlPoint *, QString)));

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // IMPORTANT TODO::  The following connections seem recursive
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    //
    // Connection between cneteditor view & other views
    // If a cnet is modified, we have to set the clean state in project and redraw measures.
    connect(result->cnetEditorWidget(), SIGNAL(cnetModified()), this, SIGNAL(cnetModified()));

    // ControlPointEditWidget is only object that emits cnetModified when ControlPoint is
    // deleted or saved
    connect(this, SIGNAL(cnetModified()), result->cnetEditorWidget(), SLOT(rebuildModels()));

    m_cnetEditorViewWidgets.append(result);
@@ -747,7 +747,9 @@ namespace Isis {
    //  ControlNetTool::paintAllViewports().  ControlNetTool always redraws all control points, so
    //  both signals go to the same slot.
    connect(this, SIGNAL(redrawMeasures()), result, SIGNAL(redrawMeasures()));
    connect(this, SIGNAL(cnetModified()), result, SIGNAL(redrawMeasures()));

    // If the active cnet is modified, redraw the measures
    connect(this, SIGNAL(activeControlModified()), result, SIGNAL(redrawMeasures()));

    connect (project(), SIGNAL(activeControlSet(bool)),
             result, SLOT(enableControlNetTool(bool)));
@@ -795,8 +797,9 @@ namespace Isis {
            this, SLOT(createControlPoint(double, double)));

    // The ControlPointEditWidget is only object that emits cnetModified when ControlPoint is
    // deleted or saved.  This requires the footprint view ControlNetGraphicsItems to be re-built.
    connect(this, SIGNAL(cnetModified()), result->mosaicSceneWidget(), SIGNAL(cnetModified()));
    // deleted or saved.  This requires the footprint view ControlNetGraphicsItems to be re-built
    // when the active cnet is modified.
    connect(this, SIGNAL(activeControlModified()), result->mosaicSceneWidget(), SIGNAL(cnetModified()));

    //  This signal is connected to the MosaicGraphicsScene::update(), which eventually calls
    //  ControlNetGraphicsItem::paint(), then ControlPointGraphicsItem::paint().  This should only
@@ -884,12 +887,10 @@ namespace Isis {

      // Create connections between signals from control point edit view and equivalent directory
      // signals that can then be connected to other views that display control nets.
//      connect(mainWidget, SIGNAL(cnetModified()),
//              this, SIGNAL(cnetModified()));
      // If the active was modified, this will be signaled in project's cnetModified() and
      // connected to other views to redraw themselves.
      connect(result->controlPointEditWidget(), SIGNAL(cnetModified()),
              this, SIGNAL(cnetModified()));
      connect(result->controlPointEditWidget(), SIGNAL(cnetModified()),
              m_project, SLOT(activeControlModified()));

      connect(result->controlPointEditWidget(), SIGNAL(saveControlNet()),
              this, SLOT(makeBackupActiveControl()));
+8 −0
Original line number Diff line number Diff line
@@ -262,6 +262,12 @@ namespace Isis {
   *   @history 2018-07-12 Kaitlyn Lee - Changed connection between cnetModified() and project's
   *                           activeControlModified() to cnetModified() and project's renamed
   *                           method cnetModified(). Fixes #5414.
   *   @history 2018-07-13 Kaitlyn Lee - Added signal activeControlModified() and changed
   *                           connections that alerted views to redraw themselves when a cnet was
   *                           modified. Now, views will only be redrawn when
   *                           activeControlModified() is signaled, instead of cnetModified(). This
   *                           stops views from being redrawn when any cnet is modified, but still
   *                           occurs when the active is modified. Fixes #5396.
   */
  class Directory : public QObject {
    Q_OBJECT
@@ -392,6 +398,8 @@ namespace Isis {
      void viewClosed(QWidget *widget);

      void cnetModified();
      void activeControlModified();

      void redrawMeasures();

      void cleanProject(bool);
+7 −0
Original line number Diff line number Diff line
@@ -1909,8 +1909,15 @@ namespace Isis {

  /**
   * When a cnet is modified, set the project state to not clean.
   * If the active control was modified, send a signal back to Directory
   * so that other views know that the active was modified. This allows
   * for CubeDnView and Footprint2DView to be redrawn.
   * Currently, this was the easiest place to emit this signal.
   */
  void Project::cnetModified() {
    if (m_activeControl->isModified()) {
      emit activeControlModified();
    }
    setClean(false);
  }

Loading