Commit 9c6d7fc2 authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

New dialog to prompt for the ground source location.

parent dfe8e3e3
Loading
Loading
Loading
Loading
+83 −0
Original line number Diff line number Diff line
#include "NewGroundSourceLocationDialog.h"

#include <iostream>

#include <QButtonGroup>
#include <QLayout>
#include <QPushButton>

using namespace std;

namespace Isis {

  /**
   * Dialog to determine new ground source location
   * 
   * @param title      - Dialog Title
   * @param filterList - Dialog Filter list 
   * @param dir        - Current Directory 
   * @param parent     - Parent widget
   */
  NewGroundSourceLocationDialog::NewGroundSourceLocationDialog(QString title, QString &directory,
                                                               QWidget *parent) :
                                 QFileDialog(parent, title, directory) {

    setFileMode(QFileDialog::Directory);
//  setOptions(QFileDialog::ShowDirsOnly);
//  // This returns a list of all the buttons in QFileDialog
//  QList<QPushButton *> allButtons = this->findChildren<QPushButton *>();
//  // Edit the first (Open) button title.
//  allButtons[0]->setText("&Save");
//
//  /// Edit the second (Cancel) button title.
//  allButtons[1]->setText("Cancel");

    QVBoxLayout *vertBoxLayout = new QVBoxLayout;
//  hBoxLayout->setAlignment(Qt::AlignLeft);
//  hBoxLayout->setSpacing(25);
//  hBoxLayout->setContentsMargins (25, 11, 25, 11 );
    
    // Button Group
//  QButtonGroup *optionsButtonGroup = new QButtonGroup();

    m_changeAllGround = new QCheckBox("Change location of all subsequent ground points loaded",
                                      this);
//  m_changeAllGround->setWhatsThis("Save the Image As Viewed with Full Resoultion");
    
    m_changeControlNet = new QCheckBox("Change location of ground source in control net."
                                           "  Note:  If above box is checked, all locations will"
                                           " be changed.", this);

//  optionsButtonGroup->addButton(m_changeAllGround);
//  optionsButtonGroup->addButton(m_changeControlNet);

    vertBoxLayout->addWidget(m_changeAllGround);
    vertBoxLayout->addWidget(m_changeControlNet);
    
    //  Get parent's layout (FileDialog), then add new buttons
    QLayout *dialogLayout = layout();
    dialogLayout->addItem(vertBoxLayout);
//  setLayout(dialogLayout);
  }


  /**
   * Indicates whether all subsequent ground source files should be found in new source directory. 
   * 
   */
  bool NewGroundSourceLocationDialog::changeAllGroundSourceLocation() {

    return m_changeAllGround->isChecked();
  }
  

  /**
   * Indicates whether the control network should be changed to reflect new ground source location.
   * 
   */
  bool NewGroundSourceLocationDialog::changeControlNet() {

    return m_changeControlNet->isChecked();
  }
}
+60 −0
Original line number Diff line number Diff line
#ifndef NewGroundSourceLocationDialog_h
#define NewGroundSourceLocationDialog_h

/**
 *   Unless noted otherwise, the portions of Isis written by the USGS are public
 *   domain. See individual third-party library and package descriptions for
 *   intellectual property information,user agreements, and related information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or implied,
 *   is made by the USGS as to the accuracy and functioning of such software
 *   and related material nor shall the fact of distribution constitute any such
 *   warranty, and no responsibility is assumed by the USGS in connection
 *   therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html in a browser or see
 *   the Privacy &amp; Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */
 

#include <QCheckBox>
#include <QDir>
#include <QFileDialog>
#include <QPointer>
#include <QString>
#include <QWidget>

namespace Isis {

  /**
  * @brief Dialog used by ControlPointEditWidget to select a new location for ground source files. 
  * Gives option of using new location for all subsequent ground points and whether to update the 
  * control net to reflect the new location.
  *
  * @ingroup Visualization Tools
  *
  * @author 2017-01-05 Tracie Sucharski
  *
  * @internal
  *   @history 2017-01-05 Tracie Sucharski - Initial Version
  */
  class NewGroundSourceLocationDialog : public QFileDialog {
      Q_OBJECT
    public:
      NewGroundSourceLocationDialog(QString title, QString &directory, QWidget *parent = 0);
      
//    QDir newGroundSourceLocation();
      bool changeAllGroundSourceLocation();
      bool changeControlNet();
      
    private:
      QPointer<QCheckBox> m_changeAllGround;   //!< Change location of all subsequent ground control points
      QPointer<QCheckBox> m_changeControlNet;  //!< Change location of ground source in the control network
  };
};

#endif