Unverified Commit 66aa6868 authored by Kaitlyn Lee's avatar Kaitlyn Lee Committed by GitHub
Browse files

Merge branch 'ipceDocks' into ipceMW

parents b9059872 2fc7559d
Loading
Loading
Loading
Loading
+43 −19
Original line number Diff line number Diff line
@@ -76,19 +76,25 @@ 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);
    centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    //centralWidget->hide();
    setDockNestingEnabled(true);

    m_activeView = NULL;

    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(viewClosed(QWidget *)), this, SLOT(removeView(QWidget *)));
@@ -115,6 +121,7 @@ namespace Isis {
    projectTreeView->treeView()->expandAll();
    projectTreeView->installEventFilter(this);
    m_projectDock->setWidget(projectTreeView);
    m_projectDock->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    addDockWidget(Qt::LeftDockWidgetArea, m_projectDock, Qt::Horizontal);

@@ -189,9 +196,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();

@@ -207,6 +214,23 @@ namespace Isis {
  }


  void IpceMainWindow::addDock(QMainWindow *newWidgetForDock) {

    QDockWidget *dock = new QDockWidget(newWidgetForDock->windowTitle(), this, Qt::SubWindow);
    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::LeftDockWidgetArea, dock, Qt::Horizontal);
//    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.
@@ -275,7 +299,7 @@ namespace Isis {
//    window->show();
//    window->activateWindow();
//    mdiArea->addSubWindow(window);
      mdiArea->closeAllSubWindows();
//    mdiArea->closeAllSubWindows();
//    delete window;
    }
    if (!m_detachedViews.isEmpty()) {
@@ -593,15 +617,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() ),
@@ -697,7 +721,7 @@ namespace Isis {
        QSettings::NativeFormat);

    projectSettings.setValue("geometry", saveGeometry());
    projectSettings.setValue("windowState", saveState());
    //projectSettings.setValue("windowState", saveState());
    projectSettings.setValue("size", size());
    projectSettings.setValue("pos", pos());

@@ -810,7 +834,7 @@ namespace Isis {
        .expanded(), QSettings::NativeFormat);

    restoreGeometry(settings.value("geometry").toByteArray());
    restoreState(settings.value("windowState").toByteArray());
    //restoreState(settings.value("windowState").toByteArray());

    QStringList projectNameList;
    QStringList projectPathList;
+6 −0
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,10 @@ 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. Added addDock method. This needs further work to clean up and
   *                           change the mdi interface.
   *  
   */
  class IpceMainWindow : public QMainWindow {
@@ -139,6 +144,7 @@ namespace Isis {

    public slots:
      void addView(QWidget *newWidget);
      void addDock(QMainWindow *newWidgetForDock);
      void removeView(QWidget *view);
      void removeAllViews();

+5 −0
Original line number Diff line number Diff line
@@ -43,6 +43,11 @@ namespace Isis {
   * @param[in] parent (QMainWindow *) The parent widget
   */
  AbstractProjectItemView::AbstractProjectItemView(QWidget *parent) : QMainWindow(parent) {

    setWindowFlags(Qt::Widget);



    m_internalModel = new ProjectItemProxyModel(this);
    setAcceptDrops(true);
  }
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ namespace Isis {
   *                           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. 
   */
  class AbstractProjectItemView : public QMainWindow {

+24 −27
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <QMdiArea>
#include <QMdiSubWindow>
#include <QMenu>
#include <QMenuBar>
#include <QModelIndex>
#include <QSize>
#include <QSizePolicy>
@@ -102,54 +103,52 @@ namespace Isis {
    m_workspace = new Workspace(false, this);
    m_workspace->mdiArea()->setActivationOrder(QMdiArea::StackingOrder);

    // Since this is a QMainWindow, set the workspace as the central widget.
    setCentralWidget(m_workspace);

    createActions(directory);

    connect(m_workspace, SIGNAL( cubeViewportActivated(MdiCubeViewport *) ),
            this, SLOT( onCubeViewportActivated(MdiCubeViewport *) ) );

    connect(m_workspace, SIGNAL( cubeViewportAdded(MdiCubeViewport *) ),
            this, SLOT( onCubeViewportAdded(MdiCubeViewport *) ) );


    // !!!!!!!   TODO  LOOK AT THIS       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // These connections should be at higher level, directory or project???? ::addCubeDnView().
    Project *activeProject = directory->project();
    // These connect signals listen to the active project, and if a control network
    // or list of control networks is added, then the enableControlNetTool() function is called.
    connect(activeProject, SIGNAL(controlListAdded(ControlList *)), this, SLOT(enableControlNetTool()));
    connect(activeProject, SIGNAL(controlAdded(Control *)), this, SLOT(enableControlNetTool()));
  }


    QVBoxLayout *layout = new QVBoxLayout;
    setLayout(layout);

    //m_toolBar = new QWidget(this);
  void CubeDnView::createActions(Directory *directory) {

    //QHBoxLayout *toolBarLayout = new QHBoxLayout;
    
    m_permToolBar = new QToolBar("Standard Tools", 0);
    m_permToolBar = addToolBar("Standard Tools");
    m_permToolBar->setObjectName("permToolBar");
    m_permToolBar->setIconSize(QSize(22, 22));
    //toolBarLayout->addWidget(m_permToolBar);

    m_activeToolBar = new QToolBar("Active Tool", 0);
    m_activeToolBar = addToolBar("Active Tool");
    m_activeToolBar->setObjectName("activeToolBar");
    m_activeToolBar->setIconSize(QSize(22, 22));
    //toolBarLayout->addWidget(m_activeToolBar);

    m_toolPad = new ToolPad("Tool Pad", 0);
    m_toolPad->setObjectName("toolPad");
    //toolBarLayout->addWidget(m_toolPad);

    //m_toolBar->setLayout(toolBarLayout);

    //layout->addWidget(m_toolBar);
    layout->addWidget(m_workspace);
    addToolBar(m_toolPad);

    // Create tools
    ToolList *tools = new ToolList;

    // !!!!!!!   TODO  LOOK AT THIS       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    //*******   TODO  :   Look at code below.  What is defaultActiveTool used for? Why is NULL
    // appended??    ***************
    Tool *defaultActiveTool = NULL;

    tools->append(new RubberBandTool(this));
//  QnetTool *qnetTool = new QnetTool(m_workspace);
    //tools->append(new FileTool(this));
    //tools->append(new QnetFileTool(qnetTool, this));
    tools->append(NULL);

    ControlNetTool *controlNetTool = new ControlNetTool(directory, this);
@@ -199,18 +198,16 @@ namespace Isis {
    tools->append(new StereoTool(this));
    tools->append(new HelpTool(this));

    QStatusBar *statusBar = new QStatusBar(this);
    layout->addWidget(statusBar);
    tools->append(new TrackTool(statusBar));
    tools->append(new TrackTool(statusBar()));

    m_separatorAction = new QAction(this);
    m_separatorAction->setSeparator(true);

    m_fileMenu = new QMenu;
    m_viewMenu = new QMenu;
    m_optionsMenu = new QMenu;
    m_windowMenu = new QMenu;
    m_helpMenu = new QMenu;
    m_fileMenu = menuBar()->addMenu("&File");
    m_viewMenu = menuBar()->addMenu("&View");
    m_optionsMenu = menuBar()->addMenu("&Options");
    m_windowMenu = menuBar()->addMenu("&Window");
    m_helpMenu = menuBar()->addMenu("&Help");

    for (int i = 0; i < tools->count(); i++) {
      Tool *tool = (*tools)[i];
Loading