Unverified Commit 4be2a7db authored by Kaitlyn Lee's avatar Kaitlyn Lee Committed by GitHub
Browse files

Merge branch 'ipceDocks' into savePoint

parents 0cea60ce c48b8344
Loading
Loading
Loading
Loading
+26 −18
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);
@@ -363,6 +356,10 @@ namespace Isis {
    connect( tabViewsAction, SIGNAL(triggered()), this, SLOT(tabViews()) );
    m_viewMenuActions.append(tabViewsAction);

    QAction *tileViewsAction = new QAction("Tile Views", this);
    connect( tileViewsAction, SIGNAL(triggered()), this, SLOT(tileViews()) );
    m_viewMenuActions.append(tileViewsAction);

    QAction *undoAction = m_directory->undoAction();
    undoAction->setShortcut(Qt::Key_Z | Qt::CTRL);

@@ -372,17 +369,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()));
@@ -834,6 +820,28 @@ namespace Isis {
  }


  /**
   * Tile all open attached/detached views
   */
  void IpceMainWindow::tileViews() {
    // splitDockWidget() takes two widgets and tiles them, so an easy way to do
    // this is to grab the first view and tile the rest with the first.
    QDockWidget *firstView = m_viewDocks.first();

    foreach (QDockWidget *currentView, m_viewDocks) {
      // We have to reattach a view before it can be tiled. If it is attached,
      // this will have no affect. We have to call addDockWidget() to untab any views.
      currentView->setFloating(false);
      addDockWidget(Qt::LeftDockWidgetArea, currentView, Qt::Horizontal);

      if (currentView == firstView) {
        continue;
      }
      splitDockWidget(firstView, currentView, Qt::Horizontal);
    }
  }


/**
 * Raises the warningWidget to the front of the tabs. Connected to warning signal from directory.
 */
+4 −2
Original line number Diff line number Diff line
@@ -159,8 +159,9 @@ namespace Isis {
   *                           state can be reset after the IpceMainWindow::show() causes resize and
   *                           move events which in turn cause the project clean flag to be false
   *                           even though the project has just opened.
   *   @history 2018-07-09 Kaitlyn Lee - Changed removeView() to delete the parent dock widget. If we do
   *                           not delete the dock widget, an empty dock widget will remain where the
   *   @history 2018-07-09 Kaitlyn Lee - Added tilViews() and the menu option to tile all docked/undocked
   *                           and tabbed/untabbed views. Changed removeView() to delete the parent dock widget. 
                               If we do not delete the dock widget, an empty dock widget will remain where the
   *                           view used to be.
   */
  class IpceMainWindow : public QMainWindow {
@@ -189,6 +190,7 @@ namespace Isis {
      void enterWhatsThisMode();

      void tabViews();
      void tileViews();

      void raiseWarningTab();
      void cleanupViewDockList(QObject *obj);
+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();
  }
}
Loading