Commit 0848afb8 authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Refactored for changes to view classes which are now docked widgets within the ipce main window.

parent d967117a
Loading
Loading
Loading
Loading
+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];
+8 −1
Original line number Diff line number Diff line
@@ -79,7 +79,12 @@ namespace Isis {
   *                           ipce tool to redraw control measures on cube viewports. Fixes #5007,
   *                           #5008.
   *   @history 2017-08-03 Cole Neubauer - Changed all references from IpceTool to ControlNetTool
   *                           Fixes #5090
   *                           Fixes #5090.
   *   @history 2018-05-30 Tracie Sucharski - Refactored for new docked interface.  Views are now
   *                           responsible for creating their menus and toolbars.
   *                           AbstractProjectItemView now inherits from QMainWindow, so the
   *                           Workspace of this view is the centralWidget. This needs further work
   *                           to cleanup and fit in with the new docked view interface.git
   */
  class CubeDnView : public AbstractProjectItemView {

@@ -123,6 +128,8 @@ namespace Isis {
      void enableControlNetTool();

    private slots:
      void createActions(Directory *directory);

      void onCurrentChanged(const QModelIndex &current);
      void onCubeViewportActivated(MdiCubeViewport *);
      void onItemAdded(ProjectItem *item);