Commit 5faa6a26 authored by Kaitlyn Lee's avatar Kaitlyn Lee
Browse files

Merge branch 'ipceDocks' of https://github.com/TracieSucharski/ISIS3 into deleteme

parents 80eeabe2 5571b947
Loading
Loading
Loading
Loading
+41 −6
Original line number Diff line number Diff line
@@ -25,11 +25,13 @@
#include <QApplication>
#include <QColor>
#include <QDebug>
#include <QDesktopWidget>
#include <QDockWidget>
#include <QMap>
#include <QMapIterator>
#include <QMdiArea>
#include <QObject>
#include <QRect>
#include <QRegExp>
#include <QStringList>
#include <QtWidgets>
@@ -78,20 +80,40 @@ namespace Isis {
      QMainWindow(parent) {
    m_maxThreadCount = -1;

    //  Set the initialize size of the mainwindow to fullscreen so that created views do not
    //  get squished.  Saved projects with view had the internal widgets squished because the
    //  initial size of this mainwindow was small and it does not get restored to the saved project
    //  size until after views are created.  For instance, the viewports within a CubeDnView were
    //  restored to a small size based on the original mainwindow size.  If the internal state
    //  of the views such as the viewport sizes, zooms, etc get serialized, this code will not be
    //  needed.
    QDesktopWidget deskTop;
    QRect mainScreenSize = deskTop.availableGeometry(deskTop.primaryScreen());
    resize(mainScreenSize.width(), mainScreenSize.height());

    QWidget *centralWidget = new QWidget;
    setCentralWidget(centralWidget);
    setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::South);
    //setDockOptions(GroupedDragging | AllowTabbedDocks);
    //centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    //centralWidget->hide();

    setDockNestingEnabled(true);

    //  Set the splitter frames to a reasonable color/size for resizing the docks.
    setStyleSheet("QMainWindow::separator {background: gray; width: 10; height: 10px;}");

    try {
      m_directory = new Directory(this);
      connect(m_directory, SIGNAL( newWidgetAvailable(QWidget *) ),
              this, SLOT( addView(QWidget *) ) );

      // Currently this connection is only used by Directory when a new active is chosen & user
      // chooses to discard any edits in the old active control which is in a CnetEditorWidget.
      // The only view which will not be updated with the new control are any CnetEditorViews
      // showing the old active control.  CnetEditorWidget classes do not have the ability to reload
      // a control net, so the CnetEditor view displaying the old control is removed, then recreated.
      connect(m_directory, SIGNAL(viewClosed(QWidget *)),
              this, SLOT(removeView(QWidget *)));

      connect(m_directory, SIGNAL( directoryCleaned() ),
              this, SLOT( removeAllViews() ) );
      connect(m_directory->project(), SIGNAL(projectLoaded(Project *)),
@@ -116,9 +138,9 @@ namespace Isis {
    projectTreeView->setInternalModel( m_directory->model() );
    projectTreeView->treeView()->expandAll();
    projectTreeView->installEventFilter(this);
    m_projectDock->setWidget(projectTreeView);
    m_projectDock->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    //projectTreeView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    m_projectDock->setWidget(projectTreeView);
    addDockWidget(Qt::LeftDockWidgetArea, m_projectDock, Qt::Horizontal);

    m_warningsDock = new QDockWidget("Warnings", this, Qt::SubWindow);
@@ -186,7 +208,7 @@ namespace Isis {

    QDockWidget *dock = new QDockWidget(newWidget->windowTitle(), this);
    dock->setWidget(newWidget);
    dock->setObjectName(newWidget->windowTitle());
    dock->setObjectName(newWidget->objectName());
    dock->setAttribute(Qt::WA_DeleteOnClose);
    dock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable |
                      QDockWidget::DockWidgetFloatable);
@@ -197,7 +219,18 @@ namespace Isis {
      splitDockWidget(m_projectDock, dock, Qt::Vertical);
    }
    else {
      addDockWidget(area, dock, orientation);
      if (m_viewDocks.count() == 0) {
        splitDockWidget(m_projectDock, dock, Qt::Horizontal);
      }
      else {
        tabifyDockWidget(m_viewDocks.last(), dock);
        dock->show();
        dock->raise();
        //  Keeps expanding IpceMainWindow to fit new dock
        //  Below causes problems if the last dock has been tabbed, then a new view is created. All
        // views except for first disappear.
        //splitDockWidget(m_viewDocks.last(), dock, Qt::Horizontal);
      }
    }

    // When dock widget is destroyed, make sure the view it holds is also destroyed
@@ -211,6 +244,7 @@ namespace Isis {


  void IpceMainWindow::cleanupViewDockList(QObject *obj) {

    QDockWidget *dock = static_cast<QDockWidget *>(obj);
    if (dock) {
      m_viewDocks.removeAll(dock);
@@ -225,6 +259,7 @@ namespace Isis {
   * @param view QWidget* The view to close.
   */
  void IpceMainWindow::removeView(QWidget *view) {

    view->close();
    delete view;
  }
+6 −1
Original line number Diff line number Diff line
@@ -159,6 +159,10 @@ 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-10 Tracie Sucharski - Change initial interface of views to tabbed view.
   *                           Changed the QMainWindow separator to a different color and wider size
   *                           for ease of use.  Create the QMainWindow initial size to prevent the
   *                           Viewports in CubeDnView from being created as a small size.
   *   @history 2018-07-11 Kaitlyn Lee - Added a value in the project settings that stores whether a
   *                           project was in fullscreen or not when saved. If not, we call showNormal()
   *                           to restore the poject's window size. This also fixes the warning/history tabs
@@ -193,6 +197,7 @@ namespace Isis {
      void tileViews();

      void raiseWarningTab();

      void cleanupViewDockList(QObject *obj);

    private:
+22 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <QDropEvent>
#include <QList>
#include <QMainWindow>
#include <QSizePolicy>
#include <QWidget>

#include "ProjectItem.h"
@@ -45,11 +46,32 @@ namespace Isis {
  AbstractProjectItemView::AbstractProjectItemView(QWidget *parent) : QMainWindow(parent) {

    setWindowFlags(Qt::Widget);

    QSizePolicy policy = sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Expanding);
    policy.setVerticalPolicy(QSizePolicy::Expanding);
    setSizePolicy(policy);

    m_internalModel = new ProjectItemProxyModel(this);
    setAcceptDrops(true);
  }


  /**
   * Returns the suggested size
   *
   * @return @b QSize The size hint
   */
  QSize AbstractProjectItemView::sizeHint() const {

    //  Size hint is make ridiculously large as a hack to have the views fill the available dock
    //  space.  SizePolicy alone did not work.
    // TODO:  There should be a better way to do this.
    //return QSize(800, 600);
    return QSize(3000, 1500);
  }


  /**
   * Sets the model used by the view. If the internal model is a proxy
   * model, it sets the source model.
+7 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ namespace Isis {
   *   @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
   *   @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
@@ -74,6 +74,10 @@ namespace Isis {
   *                           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.
   *   @history 2018-07-05 Tracie Sucharski - Added SizePolicy and a large sizeHint.  The large
   *                           sizeHint() is because using sizePolicy with a reasonable sizeHint did
   *                           not work to have views fill the available space in the dock area.
   *                           References #5433.
   */
  class AbstractProjectItemView : public QMainWindow {

@@ -82,6 +86,8 @@ namespace Isis {
    public:
      AbstractProjectItemView(QWidget *parent=0);

      virtual QSize sizeHint() const;

      virtual void setModel(ProjectItemModel *model);
      virtual ProjectItemModel *model();

+2 −10
Original line number Diff line number Diff line
@@ -189,15 +189,6 @@ namespace Isis {
  }


  /**
   * Returns the suggested size for the widget.
   *
   * @return (QSize) The size
   */
  QSize CnetEditorView::sizeHint() const {
    return QSize(800, 600);
  }

  /**
   * This method pushes a new XmlHandler into the parser stack.
   *
@@ -217,7 +208,8 @@ namespace Isis {
   */
  void CnetEditorView::save(QXmlStreamWriter &stream, Project *, FileName) const {

    stream.writeStartElement("control");
    stream.writeStartElement("cnetEditorView");
    stream.writeAttribute("objectName", objectName());
    stream.writeAttribute("id", m_control->id());
    stream.writeEndElement();
  }
Loading