Unverified Commit f9889ee9 authored by Tracie Sucharski's avatar Tracie Sucharski Committed by GitHub
Browse files

Merge branch 'ipceDocks' into ipceDocksWindowChange

parents 11ac77c4 339391c1
Loading
Loading
Loading
Loading
+4 −53
Original line number Diff line number Diff line
@@ -89,8 +89,6 @@ namespace Isis {
    //centralWidget->hide();
    setDockNestingEnabled(true);

    m_activeView = NULL;

    try {
      m_directory = new Directory(this);
      connect(m_directory, SIGNAL( newWidgetAvailable(QWidget *) ),
@@ -218,7 +216,6 @@ namespace Isis {


  void IpceMainWindow::cleanupViewDockList(QObject *obj) {

    QDockWidget *dock = static_cast<QDockWidget *>(obj);
    if (dock) {
      m_viewDocks.removeAll(dock);
@@ -227,14 +224,12 @@ namespace Isis {


  /**
   * @description This slot is connected from Directory::viewClosed(QWidget *) signal.  It will 
   * This slot is connected from Directory::viewClosed(QWidget *) signal.  It will
   * close the given view and delete the view. This was written to handle
   *
   * @param view QWidget* 
   *
   * @param view QWidget* The view to close.
   */
  void IpceMainWindow::removeView(QWidget *view) {
    
    view->close();
    delete view;
  }
@@ -343,30 +338,6 @@ namespace Isis {
    m_fileMenuActions.append(exitAction);
    m_permToolBarActions.append(exitAction);

    QAction *saveNet = new QAction("&Save Active Control Network", this);
    saveNet->setIcon( QIcon::fromTheme("document-save") );
    saveNet->setShortcut(Qt::CTRL + Qt::Key_S);
    saveNet->setToolTip("Save current active control network");
    saveNet->setStatusTip("Save current active control network");
    QString whatsThis = "<b>Function:</b> Saves the current active<i>"
                        "control network</i>";
    saveNet->setWhatsThis(whatsThis);
    connect(saveNet, SIGNAL(triggered()), m_directory, SLOT(saveActiveControl()));
    m_permToolBarActions.append(saveNet);

//  m_saveAsNet = new QAction(QPixmap(toolIconDir() + "/mActionFileSaveAs.png"),
//                            "Save Control Network &As...",
//                            m_matchTool);
//  m_saveAsNet->setToolTip("Save current control network to chosen file");
//  m_saveAsNet->setStatusTip("Save current control network to chosen file");
//  whatsThis = "<b>Function:</b> Saves the current <i>"
//      "control network</i> under chosen filename";
//  m_saveAsNet->setWhatsThis(whatsThis);
//  connect(m_saveAsNet, SIGNAL(triggered()), this, SLOT(saveAsNet()));




    QAction *undoAction = m_directory->undoAction();
    undoAction->setShortcut(Qt::Key_Z | Qt::CTRL);

@@ -490,38 +461,19 @@ namespace Isis {
   */
  void IpceMainWindow::createToolBars() {
    m_permToolBar = new QToolBar(this);
    m_activeToolBar = new QToolBar(this);
    m_toolPad = new QToolBar(this);

    QSize iconSize(25, 45);

    m_permToolBar->setIconSize(iconSize);
    m_activeToolBar->setIconSize(iconSize);
    m_toolPad->setIconSize(iconSize);

    m_permToolBar->setObjectName("PermanentToolBar");
    m_activeToolBar->setObjectName("ActiveToolBar");
    m_toolPad->setObjectName("ToolPad");

    addToolBar(m_permToolBar);
    addToolBar(m_activeToolBar);
    addToolBar(m_toolPad);

    foreach ( QAction *action, m_directory->permToolBarActions() ) {
      m_permToolBar->addAction(action);
    }

    foreach (QAction *action, m_permToolBarActions) {
      if (action->text() == "&Save Active Control Network") {
        m_permToolBar->addSeparator();
        m_permToolBar->addAction(action); 
        m_permToolBar->addSeparator();
      }
      else {
      m_permToolBar->addAction(action);
    }
  }
  }


  /**
@@ -825,5 +777,4 @@ namespace Isis {
  void IpceMainWindow::raiseWarningTab() {
    m_warningsDock->raise();
  }

}
+5 −7
Original line number Diff line number Diff line
@@ -138,6 +138,10 @@ namespace Isis {
   *                           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.
@@ -202,8 +206,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
@@ -220,13 +222,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
  };
}

+7 −97
Original line number Diff line number Diff line
@@ -163,36 +163,6 @@ 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 *>();
  }


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


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


  /**
   * Returns a list of actions appropriate for a context menu.
   *
@@ -203,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.
   *
+5 −14
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ namespace Isis {
   *                           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
@@ -87,19 +89,8 @@ namespace Isis {
      virtual void moveEvent(QMoveEvent *event);
      virtual void resizeEvent(QResizeEvent *event);

      virtual QList<QAction *> permToolBarActions();
      virtual QList<QAction *> activeToolBarActions();
      virtual QList<QAction *> toolPadActions();
 
      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();

+76 −73
Original line number Diff line number Diff line
@@ -37,8 +37,6 @@
#include <QTabWidget>
#include <QToolBar>
#include <QtXml>
#include <QVBoxLayout>
#include <QWidgetAction>

#include "Control.h"
#include "ControlNet.h"
@@ -46,10 +44,8 @@
#include "Directory.h"
#include "FileName.h"
#include "Project.h"
#include "ToolPad.h"
#include "XmlStackedHandlerReader.h"


namespace Isis {
  /**
   * Constructor.
@@ -83,53 +79,95 @@ namespace Isis {
    filterViews->addTab( m_cnetEditorWidget->connectionFilterWidget(), tr("Filter Connections") );
    resultLayout->addWidget(filterViews, 1, 1, 1, 1);

    m_permToolBar = new QToolBar("Standard Tools", 0);
    m_permToolBar->setObjectName("permToolBar");
    m_permToolBar->setIconSize(QSize(22, 22));
    //toolBarLayout->addWidget(m_permToolBar);
    createMenus();
    createToolBars();
  }

    m_activeToolBar = new QToolBar("Active Tool", 0);
    m_activeToolBar->setObjectName("activeToolBar");
    m_activeToolBar->setIconSize(QSize(22, 22));
    //toolBarLayout->addWidget(m_activeToolBar);
  /**
   * Destructor
   */
  CnetEditorView::~CnetEditorView() {

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

    m_permToolBar = 0;
  }

//  m_cnetEditorWidget->addToPermanent(m_permToolBar);
//  m_cnetEditorWidget->addTo(m_activeToolBar);
//  m_cnetEditorWidget->addTo(m_toolPad);
  /**
   * Uses the actions created by CnetEditorWidget, tries to find the menus to put
   * the actions under, and creates the menus if said menus do not exist. Currently,
   * the menus added are Table and Help.
   */
  void CnetEditorView::createMenus() {
    QMap< QAction *, QList< QString > > actionMap = m_cnetEditorWidget->menuActions();
    QMapIterator< QAction *, QList< QString > > actionMapIter(actionMap);
    QMap<QString, QMenu *> topLevelMenus;

    while ( actionMapIter.hasNext() ) {
      actionMapIter.next();
      QAction *actionToAdd = actionMapIter.key();
      QList< QString > location = actionMapIter.value();

      // Skip the Help menu for now because we do not want to add the "What's This?"
      // action (it is in the main help menu of IPCE)
      if (location.first() == "&Help") {
        continue;
      }

    m_activeToolBarAction = new QWidgetAction(this);
    m_activeToolBarAction->setDefaultWidget(m_activeToolBar);
      QMenu *menuToPutActionInto = NULL;

    setAcceptDrops(true);
      if ( location.count() ) {
        QString topLevelMenuTitle = location.takeFirst();
        if (!topLevelMenus[topLevelMenuTitle]) {
          topLevelMenus[topLevelMenuTitle] = menuBar()->addMenu(topLevelMenuTitle);
        }

    QSizePolicy policy = sizePolicy();
    policy.setHorizontalPolicy(QSizePolicy::Expanding);
    policy.setVerticalPolicy(QSizePolicy::Expanding);
    setSizePolicy(policy);
        menuToPutActionInto = topLevelMenus[topLevelMenuTitle];
      }

      foreach (QString menuName, location) {
        bool foundSubMenu = false;
        foreach ( QAction *possibleSubMenu, menuToPutActionInto->actions() ) {
          if (!foundSubMenu &&
              possibleSubMenu->menu() && possibleSubMenu->menu()->title() == menuName) {
            foundSubMenu = true;
            menuToPutActionInto = possibleSubMenu->menu();
          }
        }

        if (!foundSubMenu) {
          menuToPutActionInto = menuToPutActionInto->addMenu(menuName);
        }
      }

      menuToPutActionInto->addAction(actionToAdd);
    }
  }

  /**
   * Destructor
   * Uses and adds the actions created by CnetEditorWidget to the view's toolbars
   * Right now, all actions created in CnetEditorWidget are added to the toolpad.
   * This was copied from CnetEditorWindow
   */
  CnetEditorView::~CnetEditorView() {
  void CnetEditorView::createToolBars() {
    m_permToolBar = addToolBar("Standard Tools");
    m_permToolBar->setObjectName("permToolBar");
    m_permToolBar->setIconSize(QSize(22, 22));

    delete m_cnetEditorWidget;
    delete m_permToolBar;
    delete m_activeToolBar;
    delete m_toolPad;
    QMap< QString, QList< QAction * > > actionMap;
    actionMap = m_cnetEditorWidget->toolBarActions();
    QMapIterator< QString, QList< QAction * > > actionIter(actionMap);

    m_permToolBar = 0;
    m_activeToolBar = 0;
    m_toolPad = 0;
    while (actionIter.hasNext()) {
      actionIter.next();
      QString objName = actionIter.key();
      QList< QAction * > actionList = actionIter.value();
      foreach (QAction *action, actionList) {
        m_permToolBar->addAction(action);
      }
    }
  }


  /**
   * Returns the cnetEditorWidget.
@@ -161,41 +199,6 @@ namespace Isis {
    return QSize(800, 600);
  }


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


  /**
   * Returns a list of actions for the active tool bar.
   *
   * @return (QList<QAction *>) The actions
   */
  QList<QAction *> CnetEditorView::activeToolBarActions() {
    QList<QAction *> actions;
    actions.append(m_activeToolBarAction);
    return actions;
  }


  /**
   * Returns a list of actions for the tool pad.
   *
   * @return (QList<QAction *>) The actions
   */
  QList<QAction *> CnetEditorView::toolPadActions() {
    return m_toolPad->actions();
  }




  /**
   * This method pushes a new XmlHandler into the parser stack.
   *
Loading