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

Merge branch 'ipceDocks' of github.com:USGS-Astrogeology/ISIS3 into ipceDocks

parents 280cada9 a80cd0be
Loading
Loading
Loading
Loading
+1 −19
Original line number Diff line number Diff line
@@ -78,13 +78,6 @@ namespace Isis {
      QMainWindow(parent) {
    m_maxThreadCount = -1;

//  QMdiArea *centralWidget = new QMdiArea;
//  centralWidget->setActivationOrder(QMdiArea::StackingOrder);

//  connect(centralWidget, SIGNAL( subWindowActivated(QMdiSubWindow *) ),
//          this, SLOT( onSubWindowActivated(QMdiSubWindow *) ) );


    QWidget *centralWidget = new QWidget;
    setCentralWidget(centralWidget);
    setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
@@ -370,17 +363,6 @@ namespace Isis {
    m_editMenuActions.append(undoAction);
    m_editMenuActions.append(redoAction);

//  m_cascadeViewsAction = new QAction("Cascade Views", this);
//  connect(m_cascadeViewsAction, SIGNAL( triggered() ),
//          centralWidget(), SLOT( cascadeSubWindows() ) );
//  m_viewMenuActions.append(m_cascadeViewsAction);
//
//  m_tileViewsAction = new QAction("Tile Views", this);
//  connect(m_tileViewsAction, SIGNAL( triggered() ),
//          centralWidget(), SLOT( tileSubWindows() ) );
//  m_viewMenuActions.append(m_tileViewsAction);


    QAction *threadLimitAction = new QAction("Set Thread &Limit", this);
    connect(threadLimitAction, SIGNAL(triggered()),
            this, SLOT(configureThreadLimit()));
+43 −6
Original line number Diff line number Diff line
@@ -45,9 +45,6 @@ namespace Isis {
  AbstractProjectItemView::AbstractProjectItemView(QWidget *parent) : QMainWindow(parent) {

    setWindowFlags(Qt::Widget);



    m_internalModel = new ProjectItemProxyModel(this);
    setAcceptDrops(true);
  }
@@ -163,6 +160,46 @@ namespace Isis {
  }


  /**
   * Enables actions when cursor enters the view
   *
   * @param event The enter event
   */
  void AbstractProjectItemView::enterEvent(QEvent *event) {
    enableActions();
  }


  /**
   * Disables actions when cursor leaves the view.
   *
   * @param event The leave event
   */
  void AbstractProjectItemView::leaveEvent(QEvent *event) {
    disableActions();
  }


  /**
   * Disables toolbars and toolpad actions
   */
  void AbstractProjectItemView::disableActions() {
    foreach (QAction *action, actions()) {
      action->setDisabled(true);
    }
  }


  /**
   * Enables toolbars and toolpad actions
   */
  void AbstractProjectItemView::enableActions() {
    foreach (QAction *action, actions()) {
      action->setEnabled(true);
    }
  }


  /**
   * Returns a list of actions appropriate for a context menu.
   *
+15 −7
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ namespace Isis {

  class ProjectItem;
  class ProjectItemModel;

  /**
   * AbstractProjectItemView is a base class for views of a
   * ProjectItemModel in Qt's model-view
@@ -43,11 +44,6 @@ namespace Isis {
   * ProjectItemProxyModel that represents the items appropriately for
   * the view.
   *
   * An AbstractProjectItemView may provide QActions for manipulating
   * the view. These actions can be accessed in different contexts
   * through toolBarActions(), menuActions(), and
   * contextMenuActions().
   *
   * When mime data is dropped on a view the view adds the selected
   * items from the source model to the view.
   *
@@ -71,6 +67,13 @@ namespace Isis {
   *   @History 2018-06-18 Summer Stapleton - Overloaded moveEvent and resizeEvent and added a
   *                           windowChangeEvent signal to allow project to recognize a new save
   *                           state. Fixes #5114
   *   @history 2018-06-25 Kaitlyn Lee - When multiple views are open, there is a possibility of getting
   *                           ambiguous shortcut errors. To counter this, we need a way to focus on one
   *                           widget. Giving the views focus did not work completely. Instead,
   *                           enabling/disabling actions was the best option. Added enableActions(),
   *                           disableActions(), enterEvent(), and leaveEvent(). On default, a view's
   *                           actions are disabled. To enable the actions, move the cursor over the view.
   *                           When a user moves the cursor outside of the view, the actions are disabled.
   */
  class AbstractProjectItemView : public QMainWindow {

@@ -89,6 +92,10 @@ namespace Isis {
      virtual void moveEvent(QMoveEvent *event);
      virtual void resizeEvent(QResizeEvent *event);

      virtual void enterEvent(QEvent *event);
      virtual void leaveEvent(QEvent *event);
      virtual void enableActions();

      virtual QList<QAction *> contextMenuActions();

      virtual ProjectItem *currentItem();
@@ -107,10 +114,11 @@ namespace Isis {
      virtual void removeItem(ProjectItem *item);
      virtual void removeItems(QList<ProjectItem *> items);

      virtual void disableActions();

    private:
      ProjectItemModel *m_internalModel; //!< The internal model used by the view
  };

}

#endif
+37 −0
Original line number Diff line number Diff line
/**
 * @file
 * $Date$
 * $Revision$
 *
 *   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 "ProjectItemViewMenu.h"

namespace Isis {


  /**
   * Overrides the closeEvent to emit the signal menuClosed().
   * menuClosed() is connected to the slot disableActions() in a view.
   *
   * @param event The close event
   */
  void ProjectItemViewMenu::closeEvent(QCloseEvent *event) {
    emit menuClosed();
  }
}
+54 −0
Original line number Diff line number Diff line
#ifndef ProjectItemViewMenu_h
#define ProjectItemViewMenu_h
/**
 * @file
 * $Date$
 * $Revision$
 *
 *   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 <QMenu>

namespace Isis {

  /**
   * QMenu subclass that overrides the closeEvent. Used in views to disable
   * actions when a menu is visible and a user clicks outside of a view.
   *
   * @author 2018-06-27 Kaitlyn Lee
   *
   * @internal
   *   @history 2018-06-27 Kaitlyn Lee - Original version.
   */

  class ProjectItemViewMenu : public QMenu {
    Q_OBJECT

    public:
      ProjectItemViewMenu(const QString &title, QWidget *parent = 0) : QMenu(title, parent){};

    signals:
      void menuClosed();

    private:
      void closeEvent(QCloseEvent *event);
  };
}

#endif
Loading