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

Experiment with turning CubeDnView into a dockable widget using a MainWindow...

Experiment with turning CubeDnView into a dockable widget using a MainWindow to hold toolbars, toolpad.
parent 8a413155
Loading
Loading
Loading
Loading
+38 −18
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@
#include <QTreeView>
#include <QVariant>

#include "AbstractProjectItemView.h"
#include "AbstractProjectItemViewMW.h"
#include "Directory.h"
#include "FileName.h"
#include "IException.h"
@@ -76,12 +76,13 @@ namespace Isis {
      QMainWindow(parent) {
    m_maxThreadCount = -1;

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

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

    QWidget *centralWidget = new QWidget;
    setCentralWidget(centralWidget);
    setDockNestingEnabled(true);
 
@@ -89,6 +90,8 @@ namespace Isis {

    try {
      m_directory = new Directory(this);
      connect(m_directory, SIGNAL(newDockAvailable(QMainWindow *)),
              this, SLOT(addDock(QMainWindow *)));
      connect(m_directory, SIGNAL( newWidgetAvailable(QWidget *) ),
              this, SLOT( addView(QWidget *) ) );
      connect(m_directory, SIGNAL( directoryCleaned() ),
@@ -188,9 +191,9 @@ namespace Isis {
    addToolBar(m_toolPad);
    updateToolBarActions();

    setTabbedViewMode();
    centralWidget->setTabsMovable(true);
    centralWidget->setTabsClosable(true);
//  setTabbedViewMode();
//  centralWidget->setTabsMovable(true);
//  centralWidget->setTabsClosable(true);

    QStringList args = QCoreApplication::arguments();

@@ -206,6 +209,23 @@ namespace Isis {
  }


  void IpceMainWindow::addDock(QMainWindow *newWidgetForDock) {

    QDockWidget *dock = new QDockWidget(newWidgetForDock->windowTitle());
    dock->setWidget(newWidgetForDock);
    dock->setObjectName(newWidgetForDock->windowTitle());

    // This needs to eventually be a work order...
    dock->setAttribute(Qt::WA_DeleteOnClose);

    connect(newWidgetForDock, SIGNAL(destroyed(QObject *)),
            dock, SLOT(deleteLater()));

    addDockWidget(Qt::RightDockWidgetArea, dock);
//    addDockWidget(area, dock, orientation);
  }


  /**
   * This is connected from Directory's newWidgetAvailable signal and called when re-attaching a
   * view which was detached from the MDI main window.
@@ -530,15 +550,15 @@ namespace Isis {
            this, SLOT( toggleViewMode() ) );
    m_viewMenuActions.append(viewModeAction);

    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);
//  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 *detachActiveViewAction = new QAction("Detach Active View", this);
    connect(detachActiveViewAction, SIGNAL( triggered() ),