Commit c6d589ed authored by Cole Neubauer's avatar Cole Neubauer
Browse files

Project now knows if changes have been made and acts accordingly on exit Fixes #4960

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@7910 41f8697f-d340-4b68-9986-7bafba869bb8
parent 796ab7e8
Loading
Loading
Loading
Loading
+24 −5
Original line number Diff line number Diff line
@@ -670,8 +670,26 @@ namespace Isis {
   * state information before forwarding the event to the QMainWindow.
   */
  void IpceMainWindow::closeEvent(QCloseEvent *event) {
    if (!m_directory->project()->isClean()) {
      QMessageBox *box = new QMessageBox(QMessageBox::NoIcon, QString("Current Project Has Unsaved Changes"),
                             QString("Would you like to save your current project?"),
                             NULL, qobject_cast<QWidget *>(parent()), Qt::Dialog);
      QPushButton *save = box->addButton("Save", QMessageBox::AcceptRole);
      box->addButton("Don't Save", QMessageBox::RejectRole);
      QPushButton *cancel = box->addButton("Cancel", QMessageBox::NoRole);
      box->exec();

      if (box->clickedButton() == (QAbstractButton*)cancel) {
        event->ignore();
        return;
      }
      else if (box->clickedButton() == (QAbstractButton*)save) {
        m_directory->project()->save();
      }
    }
    writeSettings(m_directory->project());
    QMainWindow::closeEvent(event);

  }


@@ -915,6 +933,7 @@ namespace Isis {
    addView(view);
  }


/**
 * Raises the warningWidget to the front of the tabs. Connected to warning signal from directory.
 */
+3 −0
Original line number Diff line number Diff line
@@ -95,6 +95,9 @@ namespace Isis {
   *                           Fixes #5041
   *  @history 2017-07-14 Cole Neubauer - Set Object name for Target/Sensor Widgets in addView
   *                           Fixes #5059 
   *                           Fixes #5041
   *  @history 2017-07-26 Cole Neubauer - Changed the closevent funtion to check if a project is
   *                           and prompt user accordingly Fixes #4960
   */
  class IpceMainWindow : public QMainWindow {
      Q_OBJECT
+1 −2
Original line number Diff line number Diff line
@@ -87,8 +87,7 @@ namespace Isis {
   */
  bool CloseProjectWorkOrder::setupExecution() {
    bool success = WorkOrder::setupExecution();

    if (success && !project()->isClean() && project()->isOpen() ) {
    if (success && !project()->isClean()) {
      QMessageBox *box = new QMessageBox(QMessageBox::NoIcon,
              QString("Current Project Has Unsaved Changes"),
              QString("Would you like to save your current project?"),
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ namespace Isis {
   *                          Fixes #2146.
   *   @history 2017-07-18 Cole Neubauer - Finished implementing Close Project work order.
   *                          Fixes #4521
   *   @history 2017-07-18 Cole Neubauer - Updated if statment to check if something is open
   *                          Fixes #4960
   *   @history 2017-07-24 Cole Neuabuer - Set m_isSavedToHistory to false on construction
   *                           Fixes #4715
   */
+1 −0
Original line number Diff line number Diff line
@@ -337,6 +337,7 @@ namespace Isis {
    QAction *saveAction = m_saveProjectWorkOrder->clone();
    saveAction->setShortcut(Qt::Key_S | Qt::CTRL);
    saveAction->setIcon( QIcon(":save") );
    saveAction->setDisabled(true);
    connect( project()->undoStack(), SIGNAL( cleanChanged(bool) ),
             saveAction, SLOT( setDisabled(bool) ) );
    fileMenu->addAction(saveAction);
Loading