Commit 6d58758f authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Colorize the save buttons properly when creating new control point and loading...

Colorize the save buttons properly when creating new control point and loading a different control point.
parent fdad2af8
Loading
Loading
Loading
Loading
+31 −7
Original line number Diff line number Diff line
@@ -804,17 +804,35 @@ namespace Isis {
    //  is selected
    if (controlPoint->Parent() == NULL) {
      m_editPoint = controlPoint;
      // New point in editor, so colorize all save buttons
      colorizeAllSaveButtons("red");
    }
    else {
      m_editPoint = new ControlPoint;
      *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());
  }


  void ControlPointEditWidget::colorizeAllSaveButtons(QString color) {

    // New point loaded, make sure Save Measure Button text is default
    if (color == "black") {
      // Don't need to colorize save measure button, when loading new measure, the measure editor
      // will set back to default palette.
      m_savePoint->setPalette(m_saveDefaultPalette); 
      m_saveNet->setPalette(m_saveDefaultPalette);
    }
    else if (color == "red") {
      m_measureEditor->colorizeSaveButton(); 
      colorizeSavePointButton();
      colorizeSaveNetButton();
    }
  }


@@ -2466,12 +2484,18 @@ namespace Isis {
   *
   * @author 2014-07-11 Tracie Sucharski
   */
  void ControlPointEditWidget::colorizeSaveNetButton() {
  void ControlPointEditWidget::colorizeSaveNetButton(bool reset) {

    if (reset) {
      //  Change Save Net button text back to default black
      m_saveNet->setPalette(m_saveDefaultPalette);
    }
    else {
      QColor qc = Qt::red; 
      QPalette p = m_savePoint->palette();
      p.setColor(QPalette::ButtonText,qc);
      m_saveNet->setPalette(p);
    }

  }

+9 −2
Original line number Diff line number Diff line
@@ -88,6 +88,8 @@ namespace Isis {
   *   @history 2018-04-25 Tracie Sucharski - Fix bug when creating a control point from CubeDnView
   *                           or FootprintView if a ground source exists in the serial number list.
   *                           Fixes #5399.
   *   @history 2018-05-02 Tracie Sucharski - Colorize save buttons properly when creating new
   *                           control point and loading a different control point. 
   */
  class ControlPointEditWidget : public QWidget {
    Q_OBJECT
@@ -123,6 +125,11 @@ namespace Isis {
                              bool isGroundSource = false);

      void updatePointInfo(ControlPoint &updatedPoint);
      // Changed colorizeSaveNetButton to public slot so it could be called from
      // Directory::saveActiveControl().  This should be temporary until the modify/save functionality
      // of active control is re-factored. Also added reset parameter, defaulting to false so button
      // is red. This default was used so that current calls did not need to be changed.
      void colorizeSaveNetButton(bool reset = false);

    protected:
      bool eventFilter(QObject *o,QEvent *e);
@@ -150,6 +157,8 @@ namespace Isis {
      void measureSaved();
      void checkReference();
      void savePoint();

      void colorizeAllSaveButtons(QString color);
      void colorizeSavePointButton();

      void openTemplateFile();
@@ -162,8 +171,6 @@ namespace Isis {
      void writeTemplateFile(QString);
      void clearEditPoint();

      void colorizeSaveNetButton();

    private:
      void createActions();