Commit e1a994bc authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

PROG:Added removeView slot to remove a view, and check for modified active control.

parent d578d392
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -227,10 +227,6 @@ namespace Isis {
      if ( QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ) ) {
        mdiArea->addSubWindow(newWidget);
        newWidget->show();
        QMdiSubWindow *window = qobject_cast<QMdiSubWindow *>(newWidget);
        qDebug()<<"IpceMainWindow::addView new subwindow = "<<window<<" widget = "<<newWidget;
        mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow *>(newWidget));
        setActiveView(qobject_cast<AbstractProjectItemView *>(newWidget));
      }
    }
  }
@@ -246,14 +242,12 @@ namespace Isis {
   */
  void IpceMainWindow::removeView(QWidget *view) {

    qDebug()<<"IpceMainWindow::removeView active view = "<<view;
    QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() );
    if (mdiArea){
      // Get all QMdiSubWindows, then find subwindow that hold widget
      QList<QMdiSubWindow *> subWindowList = mdiArea->subWindowList();
      foreach (QMdiSubWindow *sub, subWindowList) {
        if (sub->widget() == view) {
          qDebug()<<"                    active view FOUND";
          sub->close();
          break;
        }
@@ -873,7 +867,11 @@ namespace Isis {
   * state information before forwarding the event to the QMainWindow.
   */
  void IpceMainWindow::closeEvent(QCloseEvent *event) {
    if (!m_directory->project()->isClean()) {

    // The active control is checked here for modification because this was the simplest solution
    // vs changing the project clean state every time the control is modified or saved.
    if (!m_directory->project()->isClean() || (m_directory->project()->activeControl() &&
                                               m_directory->project()->activeControl()->isModified())) {
      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);
+4 −1
Original line number Diff line number Diff line
@@ -124,7 +124,10 @@ namespace Isis {
   *   @history 2018-03-02 Tracie Sucharski - added static keyword to the m_maxRecentProject member
   *                           variable, fixes OSX compile warning.  References #5341.
   *   @history 2018-04-04 Tracie Sucharski - Added removeView slot which removes the view
   *                           containing the given widget.
   *                           containing the given widget. In the closeEvent method check whether
   *                           there is an active control and if it has been modified as additional
   *                           test to determine whether project needs saving.
   *  
   */
  class IpceMainWindow : public QMainWindow {
      Q_OBJECT