Unverified Commit c27fb8d1 authored by Kristin's avatar Kristin Committed by GitHub
Browse files

Merge pull request #276 from USGS-Astrogeology/ipceDocks

Merge ipceDocks into ipceCnetHealth
parents f9120520 7baff3e1
Loading
Loading
Loading
Loading
+217 −588

File changed.

Preview size limit exceeded, changes collapsed.

+37 −23
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
 */

#include "ViewSubWindow.h"
#include <QMainWindow>
#include <QPointer>
#include <QProgressBar>
#include <QMdiSubWindow>
@@ -129,6 +130,29 @@ namespace Isis {
   *                           test to determine whether project needs saving.
   *   @history 2018-05-01 Tracie Sucharski - Code accidently left commented from previous checking.
   *                           Fixes #5412.
   *   @history 2018-05-30 Tracie Sucharski - Fix to handle the re-factored docked views.
   *                           Changed from MDI to SDI, changing the centralWidget to a dumy, unused
   *                           widget. Remove all methods having to do with MDI sub-windows,
   *                           detached views.  The dock widgets holding the views are saved off
   *                           for cleanup because there is no way to get the dock from the view.
   *                           Cleanup connections are made for the views and the docks to ensure
   *                           that cleanup happens for both.  Fixes #5433.
   *   @history 2018-06-13 Tracie Sucharski - Fixed cleanup of views and QDockWidgets.
   *   @history 2018-06-13 Kaitlyn Lee - Since views now inherit from QMainWindow, each individual
   *                           view has its own toolbar, so having an active toolbar and tool pad is
   *                           not needed. Removed code adding the save active control net button and
   *                           the toolpad, since control nets can be saved with the project save button.
   *   @history 2018-06-15 Tracie Sucharski - Fixed break to recent projects.  The readSettings
   *                           must be called before initializeActions to get the recent projects
   *                           from the config file.
   *   @history 2018-06-19 Kaitlyn Lee - Added tabViews() and the menu option under the View menu to
   *                           tab the views. Currently, this can tab all attached/detached views. I
   *                           left the line setting dock options to allow grouped dragging, but tabbing
   *                           views does not always work with this enabled. With this option enabled, the
   *                           type of a view will randomly change and setting its type has no effect.
   *                           Use windowType() to get the type. Also added the toolbar title in the
   *                           permanent toolbar constructor. 
   *
   *
   */
  class IpceMainWindow : public QMainWindow {
@@ -138,14 +162,13 @@ namespace Isis {
      ~IpceMainWindow();

    public slots:
      void addView(QWidget *newWidget);
      void addView(QWidget *newWidget, Qt::DockWidgetArea area = Qt::LeftDockWidgetArea,
                   Qt::Orientation orientation = Qt::Horizontal);
      void removeView(QWidget *view);
      void removeAllViews();

      void setActiveView(AbstractProjectItemView *view);
      void updateMenuActions();
      void updateToolBarActions();
      void readSettings(Project *);
      void writeSettings(Project *project);

    protected:
      void closeEvent(QCloseEvent *event);
@@ -154,25 +177,20 @@ namespace Isis {
    private slots:
      void configureThreadLimit();
      void enterWhatsThisMode();
      void onSubWindowActivated(QMdiSubWindow *);

      void toggleViewMode();
      void setTabbedViewMode();
      void setSubWindowViewMode();

      void closeDetachedView();
      void detachActiveView();
      void reattachView();
      void tabViews();

      void raiseWarningTab();
      void cleanupViewDockList(QObject *obj);
    private:
      Q_DISABLE_COPY(IpceMainWindow);

      void applyMaxThreadCount();
      void createMenus();
      void writeSettings(const Project *project) const;

      void initializeActions();
      void createMenus();
      void createToolBars();


    private:
      /**
@@ -182,8 +200,10 @@ namespace Isis {
      QPointer<Directory> m_directory;

      QDockWidget *m_projectDock;
      QList<ViewSubWindow *> m_detachedViews; //!< List to keep track of any detached main windows
      QDockWidget *m_warningsDock;

      QList<QDockWidget *> m_viewDocks; //!< QDockWidgets holding the views

      /**
       * This is the "goal" or "estimated" maximum number of active threads running in this program
       *   at once. For now, the GUI consumes 1 thread and QtConcurrent
@@ -194,8 +214,6 @@ namespace Isis {
      static const int m_maxRecentProjects = 5;

      QToolBar *m_permToolBar; //!< The toolbar for actions that rarely need to be changed.
      QToolBar *m_activeToolBar; //<! The toolbar for the actions of the current tool.
      QToolBar *m_toolPad; //<! The toolbar for the actions that activate tools.

      QMenu *m_fileMenu; //!< Menu for the file actions
      QMenu *m_projectMenu; //!< Menu for the project actions
@@ -212,13 +230,9 @@ namespace Isis {
      QList<QAction *> m_helpMenuActions;//!< Internal list of help actions

      QList<QAction *> m_permToolBarActions;//!< Internal list of permanent toolbar actions
      QList<QAction *> m_activeToolBarActions;//!< Internal list of active toolbar actions
      QList<QAction *> m_toolPadActions;//!< Internal list of toolpad actions

      QAction *m_cascadeViewsAction; //!< Action that cascades the mdi area
      QAction *m_tileViewsAction; //!< Action that tiles the mdi area

      AbstractProjectItemView *m_activeView; //!< The active view
  };
}

+23 −93
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QList>
#include <QMainWindow>
#include <QWidget>

#include "ProjectItem.h"
@@ -39,9 +40,14 @@ namespace Isis {
  /**
   * Constructs the AbstractProjectItemView.
   *
   * @param[in] parent (QWidget *) The parent widget
   * @param[in] parent (QMainWindow *) The parent widget
   */
  AbstractProjectItemView::AbstractProjectItemView(QWidget *parent) : QWidget(parent) {
  AbstractProjectItemView::AbstractProjectItemView(QWidget *parent) : QMainWindow(parent) {

    setWindowFlags(Qt::Widget);



    m_internalModel = new ProjectItemProxyModel(this);
    setAcceptDrops(true);
  }
@@ -143,33 +149,17 @@ namespace Isis {
  }


  /**
   * Returns a list of actions appropriate for the permanent tool bar.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::permToolBarActions() {
    return QList<QAction *>();
  }

  void AbstractProjectItemView::moveEvent(QMoveEvent *event) {
    QMainWindow::moveEvent(event);
    
  /**
   * Returns a list of actions appropriate for the active tool bar.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::activeToolBarActions() {
    return QList<QAction *>();
    emit windowChangeEvent(false);
  }


  /**
   * Returns a list of actions appropriate for the tool pad.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::toolPadActions() {
    return QList<QAction *>();
  void AbstractProjectItemView::resizeEvent(QResizeEvent *event) {
    QMainWindow::resizeEvent(event);
    
    emit windowChangeEvent(false);
  }

  
@@ -183,66 +173,6 @@ namespace Isis {
  }


  /**
   * Returns a list of actions appropriate for a file menu.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::fileMenuActions() {
    return QList<QAction *>();
  }


  /**
   * Returns a list of actions appropriate for a project menu.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::projectMenuActions() {
    return QList<QAction *>();
  }


  /**
   * Returns a list of actions appropriate for an edit menu.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::editMenuActions() {
    return QList<QAction *>();
  }


  /**
   * Returns a list of actions appropriate for a view menu.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::viewMenuActions() {
    return QList<QAction *>();
  }

  
  /**
   * Returns a list of actions appropriate for a settings menu.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::settingsMenuActions() {
    return QList<QAction *>();
  }


  /**
   * Returns a list of actions appropriate for a help menu.
   *
   * @return @b QList<QAction *> The actions
   */
  QList<QAction *> AbstractProjectItemView::helpMenuActions() {
    return QList<QAction *>();
  }

  
  /**
   * Returns the current item of the model.
   *
+21 −15
Original line number Diff line number Diff line
@@ -23,10 +23,11 @@
 *   http://www.usgs.gov/privacy.html.
 */

#include <QWidget>
#include <QMainWindow>

class QAction;
class QDragEnterEvent;
class QWidget;
template <typename T> class QList;

namespace Isis {
@@ -60,8 +61,18 @@ namespace Isis {
   *   @history 2016-07-28 Tracie Sucharski - Implemented removeItem and removeItems methods.
   *   @history 2016-08-25 Adam Paquette - Minor updates to documentation.
   *                           Fixes #4299.
   *   @history 2018-05-29 Tracie Sucharski & Summer Stapleton - updated to inherit from QMainWindow
   *                           instead of QWidget. This updates all views in the ipce main window
   *                           to be main windows themselves, changing from an mdi interface to an
   *                           sdi interface.
   *   @history 2018-05-30 Tracie Sucharski - Added the WindowFlag to set this as a Widget.
   *   @history 2018-06-15 Kaitlyn Lee - Removed methods returing toolbar and menu actions because each
   *                            individual has its own toolbar. These methods are not needed anymore.
   *   @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
   */
  class AbstractProjectItemView : public QWidget {
  class AbstractProjectItemView : public QMainWindow {

    Q_OBJECT

@@ -75,25 +86,20 @@ namespace Isis {
      virtual void dragMoveEvent(QDragMoveEvent *event);
      virtual void dropEvent(QDropEvent *event);

      virtual QList<QAction *> permToolBarActions();
      virtual QList<QAction *> activeToolBarActions();
      virtual QList<QAction *> toolPadActions();
      virtual void moveEvent(QMoveEvent *event);
      virtual void resizeEvent(QResizeEvent *event);

      virtual QList<QAction *> contextMenuActions();

      virtual QList<QAction *> fileMenuActions();
      virtual QList<QAction *> projectMenuActions();
      virtual QList<QAction *> editMenuActions();
      virtual QList<QAction *> viewMenuActions();
      virtual QList<QAction *> settingsMenuActions();
      virtual QList<QAction *> helpMenuActions();
      
      virtual ProjectItem *currentItem();
      virtual QList<ProjectItem *> selectedItems();

      virtual ProjectItemModel *internalModel();
      virtual void setInternalModel(ProjectItemModel *model);
      
    signals:
      void windowChangeEvent(bool event);

    public slots:
      virtual void addItem(ProjectItem *item);
      virtual void addItems(QList<ProjectItem *> items);
+4 −12
Original line number Diff line number Diff line
@@ -156,9 +156,7 @@ namespace Isis {
    // NOTE: QHeaderView::ResizeToContents does not allow user to resize by dragging column divider
    qtable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);

    QVBoxLayout *layout = new QVBoxLayout;
    setLayout(layout);
    layout->addWidget(qtable);
    setCentralWidget(qtable);

    QSizePolicy policy = sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Expanding);
@@ -198,10 +196,7 @@ namespace Isis {

    file.close();

    QVBoxLayout *layout = new QVBoxLayout;
    setLayout(layout);
    layout->addWidget(qText);

    setCentralWidget(qText);
    qText->moveCursor(QTextCursor::Start);

    QSizePolicy policy = sizePolicy();
@@ -217,6 +212,3 @@ namespace Isis {
  BundleObservationView::~BundleObservationView() {
  }
}


Loading