Loading isis/src/qisis/apps/ipce/IpceMainWindow.cpp +108 −474 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ namespace Isis { QWidget *centralWidget = new QWidget; setCentralWidget(centralWidget); centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); //centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); //centralWidget->hide(); setDockNestingEnabled(true); Loading Loading @@ -147,20 +147,10 @@ namespace Isis { m_directory->setHistoryContainer(historyDock); tabifyDockWidget(m_warningsDock, historyDock); // QDockWidget *progressDock = new QDockWidget("Progress", this, Qt::SubWindow); // progressDock->setObjectName("progressDock"); // progressDock->setFeatures(QDockWidget::DockWidgetClosable | // QDockWidget::DockWidgetMovable | // QDockWidget::DockWidgetFloatable); // progressDock->setAllowedAreas(Qt::BottomDockWidgetArea); // //m_directory->setProgressContainer(progressDock); // addDockWidget(Qt::BottomDockWidgetArea, progressDock); // tabifyDockWidget(historyDock, progressDock); historyDock->raise(); setTabPosition(Qt::TopDockWidgetArea, QTabWidget::North); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea); Loading @@ -173,28 +163,9 @@ namespace Isis { statusBar()->addWidget(progressBar); } createMenus(); initializeActions(); updateMenuActions(); 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); updateToolBarActions(); createMenus(); createToolBars(); // setTabbedViewMode(); // centralWidget->setTabsMovable(true); Loading @@ -206,11 +177,6 @@ namespace Isis { OpenProjectWorkOrder *workorder = new OpenProjectWorkOrder(m_directory->project()); workorder->execute(); } // ken testing If this is used, we will not need to call updateMenuActions() or updateToolBar() // above. They are both called from setActiveView. // setActiveView(projectTreeView); // ken testing } Loading Loading @@ -248,44 +214,24 @@ namespace Isis { splitDockWidget(m_projectDock, dock, Qt::Vertical); } else { if ( QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ) ) { mdiArea->addSubWindow(newWidget); newWidget->show(); mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow *>(newWidget)); setActiveView(qobject_cast<AbstractProjectItemView *>(newWidget)); } } // m_dockedWidgets.append } /** * @description This slot is connected from Directory::viewClosed(QWidget *) signal. It will * close the given QMdiSubWindow from the QMdiArea. This will also delete the widget contained * within the subwindow which is an AbstractProjectItemView. * close the given view and delete the view. * * @param view QWidget* * */ void IpceMainWindow::removeView(QWidget *view) { QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); if (mdiArea){ // Get all QMdiSubWindows, then find subwindow that hold widget QList<QMdiSubWindow *> subWindowList = mdiArea->subWindowList(); foreach (QMdiSubWindow *sub, subWindowList) { if (sub->widget() == view) { sub->close(); break; } } // QMdiSubWindow *window = qobject_cast<QMdiSubWindow *>(view); // qDebug()<<"IpceMainWindow::removeView activewindow = "<<window; // mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow *>(view)); // qDebug()<<"IpceMainWindow::removeView"; // mdiArea->closeActiveSubWindow(); view->close(); delete view; } } /** Loading @@ -293,20 +239,8 @@ namespace Isis { */ void IpceMainWindow::removeAllViews() { setWindowTitle("ipce"); QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); if (mdiArea){ // QMdiSubWindow* window = new QMdiSubWindow(); // window->show(); // window->activateWindow(); // mdiArea->addSubWindow(window); // mdiArea->closeAllSubWindows(); // delete window; } if (!m_detachedViews.isEmpty()) { foreach ( QMainWindow* view, m_detachedViews ) { view->close(); } } QList<QDockWidget *> docks = tabifiedDockWidgets(m_projectDock); if(docks.count() > 1) { Loading @@ -327,178 +261,6 @@ namespace Isis { } /** * Sets the active view and updates the toolbars and menus. * * @param[in] view (AbstractProjectItemView *) The active view. */ void IpceMainWindow::setActiveView(AbstractProjectItemView *view) { m_activeView = view; updateMenuActions(); updateToolBarActions(); } /** * Clears all the menus, then populates the menus with QActions from * several sources. The QActions come from an internal list of * QActions, the Directory, and the active view. */ void IpceMainWindow::updateMenuActions() { m_fileMenu->clear(); // Get Directory FileMenu actions foreach ( QAction *action, m_directory->fileMenuActions() ) { m_fileMenu->addAction(action); } m_fileMenu->addSeparator(); // Get FileMenu actions for the active view (eg. CubeDnView, Footprint2DView) if (m_activeView) { foreach ( QAction *action, m_activeView->fileMenuActions() ) { m_fileMenu->addAction(action); } } m_fileMenu->addSeparator(); // Get FileMenu actions from the ipceMainWindow, Exit is the only action foreach ( QAction *action, m_fileMenuActions ) { m_fileMenu->addAction(action); } m_projectMenu->clear(); // Get Project menu actions from Directory foreach ( QAction *action, m_directory->projectMenuActions() ) { m_projectMenu->addAction(action); } m_projectMenu->addSeparator(); // Get Project menu actions from the active view if (m_activeView) { foreach ( QAction *action, m_activeView->projectMenuActions() ) { m_projectMenu->addAction(action); } } m_projectMenu->addSeparator(); // Get Project menu actions from IpceMainWindow foreach ( QAction *action, m_projectMenuActions ) { m_projectMenu->addAction(action); } m_editMenu->clear(); // Get Edit menu actions from Directory foreach ( QAction *action, m_directory->editMenuActions() ) { m_editMenu->addAction(action); } m_editMenu->addSeparator(); // Get Edit menu actions from active view if (m_activeView) { foreach ( QAction *action, m_activeView->editMenuActions() ) { m_editMenu->addAction(action); } } m_editMenu->addSeparator(); // Get Edit menu actions from IpceMainWindow foreach ( QAction *action, m_editMenuActions ) { m_editMenu->addAction(action); } m_viewMenu->clear(); // Get View menu actions from Directory foreach ( QAction *action, m_directory->viewMenuActions() ) { m_viewMenu->addAction(action); } m_viewMenu->addSeparator(); // Get View menu actions from IpceMainWindow foreach ( QAction *action, m_viewMenuActions ) { m_viewMenu->addAction(action); } m_viewMenu->addSeparator(); // Get View menu actions from active view if (m_activeView) { foreach ( QAction *action, m_activeView->viewMenuActions() ) { m_viewMenu->addAction(action); } } m_settingsMenu->clear(); // Get Settings menu actions from Directory foreach ( QAction *action, m_directory->settingsMenuActions() ) { m_settingsMenu->addAction(action); } m_settingsMenu->addSeparator(); // Get Settings menu actions from active view if (m_activeView) { foreach ( QAction *action, m_activeView->settingsMenuActions() ) { m_settingsMenu->addAction(action); } } m_settingsMenu->addSeparator(); // Get Settings menu actions from IpceMainWindow foreach ( QAction *action, m_settingsMenuActions ) { m_settingsMenu->addAction(action); } m_helpMenu->clear(); // Get Help menu actions from Directory foreach ( QAction *action, m_directory->helpMenuActions() ) { m_helpMenu->addAction(action); } m_helpMenu->addSeparator(); // Get Help menu actions from active view if (m_activeView) { foreach ( QAction *action, m_activeView->helpMenuActions() ) { m_helpMenu->addAction(action); } } m_helpMenu->addSeparator(); // Get Help menu actions from IpceMainWindow foreach ( QAction *action, m_helpMenuActions ) { m_helpMenu->addAction(action); } } /** * Clears the tool bars and repopulates them with QActions from * several sources. Actions are taken from an internal list of * QActions, the Directory, and the active view. */ void IpceMainWindow::updateToolBarActions() { m_permToolBar->clear(); 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); if (action->text() == "&Save Active Control Network") { m_permToolBar->addSeparator(); } } m_permToolBar->addSeparator(); if (m_activeView) { foreach ( QAction *action, m_activeView->permToolBarActions() ) { m_permToolBar->addAction(action); } } m_activeToolBar->clear(); if (m_activeView) { foreach ( QAction *action, m_activeView->activeToolBarActions() ) { m_activeToolBar->addAction(action); } } m_toolPad->clear(); if (m_activeView) { foreach ( QAction *action, m_activeView->toolPadActions() ) { m_toolPad->addAction(action); } } } /** * Filters out events from views so they can be handled by the main * window. Filters out DragEnter Drop and ContextMenu events from Loading Loading @@ -611,12 +373,6 @@ namespace Isis { m_editMenuActions.append(undoAction); m_editMenuActions.append(redoAction); QAction *viewModeAction = new QAction("Toggle View Mode", this); connect(viewModeAction, SIGNAL( triggered() ), this, SLOT( toggleViewMode() ) ); m_viewMenuActions.append(viewModeAction); // m_cascadeViewsAction = new QAction("Cascade Views", this); // connect(m_cascadeViewsAction, SIGNAL( triggered() ), // centralWidget(), SLOT( cascadeSubWindows() ) ); Loading @@ -627,10 +383,6 @@ namespace Isis { // centralWidget(), SLOT( tileSubWindows() ) ); // m_viewMenuActions.append(m_tileViewsAction); QAction *detachActiveViewAction = new QAction("Detach Active View", this); connect(detachActiveViewAction, SIGNAL( triggered() ), this, SLOT( detachActiveView() ) ); m_viewMenuActions.append(detachActiveViewAction); QAction *threadLimitAction = new QAction("Set Thread &Limit", this); connect(threadLimitAction, SIGNAL(triggered()), Loading @@ -654,15 +406,28 @@ namespace Isis { /** * Creates the main menus of the menu bar. * Creates and fills the application menus of the menu bar. */ void IpceMainWindow::createMenus() { m_fileMenu = menuBar()->addMenu(tr("&File")); m_fileMenu->setObjectName("fileMenu"); // Get Directory FileMenu actions foreach ( QAction *action, m_directory->fileMenuActions() ) { m_fileMenu->addAction(action); } m_fileMenu->addSeparator(); // Get FileMenu actions from the ipceMainWindow, Exit is the only action foreach ( QAction *action, m_fileMenuActions ) { m_fileMenu->addAction(action); } m_projectMenu = menuBar()->addMenu(tr("&Project")); m_projectMenu->setObjectName("projectMenu"); // Get Project menu actions from Directory foreach ( QAction *action, m_directory->projectMenuActions() ) { m_projectMenu->addAction(action); } // Allow tool tips to be displayed for the project menu's actions (e.g. "Bundle Adjustment") // This is a work around for Qt's what this text not working on disabled actions // (even though the Qt documentation says it should work on disabled QAction's). Loading @@ -670,15 +435,91 @@ namespace Isis { m_editMenu = menuBar()->addMenu(tr("&Edit")); m_editMenu->setObjectName("editMenu"); m_editMenu->addSeparator(); // Get Edit menu actions from Directory foreach ( QAction *action, m_directory->editMenuActions() ) { m_editMenu->addAction(action); } // Get Edit menu actions from IpceMainWindow foreach ( QAction *action, m_editMenuActions ) { m_editMenu->addAction(action); } m_viewMenu = menuBar()->addMenu("&View"); m_viewMenu->setObjectName("viewMenu"); // Get View menu actions from Directory foreach ( QAction *action, m_directory->viewMenuActions() ) { m_viewMenu->addAction(action); } m_viewMenu->addSeparator(); // Get View menu actions from IpceMainWindow foreach ( QAction *action, m_viewMenuActions ) { m_viewMenu->addAction(action); } m_settingsMenu = menuBar()->addMenu("&Settings"); m_settingsMenu->setObjectName("settingsMenu"); // Get Settings menu actions from Directory foreach ( QAction *action, m_directory->settingsMenuActions() ) { m_settingsMenu->addAction(action); } m_settingsMenu->addSeparator(); // Get Settings menu actions from IpceMainWindow foreach ( QAction *action, m_settingsMenuActions ) { m_settingsMenu->addAction(action); } m_helpMenu = menuBar()->addMenu("&Help"); m_helpMenu->setObjectName("helpMenu"); // Get Help menu actions from Directory foreach ( QAction *action, m_directory->helpMenuActions() ) { m_helpMenu->addAction(action); } m_helpMenu->addSeparator(); // Get Help menu actions from IpceMainWindow foreach ( QAction *action, m_helpMenuActions ) { m_helpMenu->addAction(action); } } /** * Create the tool bars and populates them with QActions from several sources. Actions are taken * from an internal list of QActions and the Directory. */ 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); } } } Loading Loading @@ -966,220 +807,13 @@ namespace Isis { /** * Slot to connect to the subWindowActivated signal from the central * QMdiArea. Updates the active view to the active sub window, or * sets it to null if the active window is not an AbstractProjectItemView. * * @param[in] window (QMdiSubWindow *) The active sub window. */ void IpceMainWindow::onSubWindowActivated(QMdiSubWindow * window) { if (window) { setActiveView( qobject_cast<AbstractProjectItemView *>( window->widget() ) ); } else { setActiveView(0); } } /** * Toggles the view mode of the central QMdiArea between tabbed and * sub window mode. */ void IpceMainWindow::toggleViewMode() { QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); if (mdiArea->viewMode() == QMdiArea::SubWindowView) { setTabbedViewMode(); } else { setSubWindowViewMode(); } } /** * Sets the QMdiArea in the central widget to the tabbed view mode * and updates the appropriate actions. */ void IpceMainWindow::setTabbedViewMode() { QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); mdiArea->setViewMode(QMdiArea::TabbedView); m_cascadeViewsAction->setEnabled(false); m_tileViewsAction->setEnabled(false); } /** * Sets the QMdiArea in the central widget to the sub window view * mode and updates the appropriate actions. */ void IpceMainWindow::setSubWindowViewMode() { QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); mdiArea->setViewMode(QMdiArea::SubWindowView); m_cascadeViewsAction->setEnabled(true); m_tileViewsAction->setEnabled(true); } /** * Closes the detached window and removes it from the m_detachedViews list */ void IpceMainWindow::closeDetachedView() { ViewSubWindow *viewWindow = qobject_cast<ViewSubWindow *>( sender() ); if (!viewWindow) { return; } m_detachedViews.removeAt(m_detachedViews.indexOf(viewWindow)); viewWindow->close(); } /** * Moves the active view from the mdi area to its own independent * window. The view, its toolbars, and menu actions, are removed * from the main window and placed in an independent * QMainWindow. The new window contains the view as well as its * toolbars and menu actions. A detached view will not be set as the * active view when it is activated. */ void IpceMainWindow::detachActiveView() { AbstractProjectItemView *view = m_activeView; if (!m_activeView) { return; } QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); if (mdiArea) { mdiArea->removeSubWindow(view); mdiArea->closeActiveSubWindow(); } ViewSubWindow *newWindow = new ViewSubWindow(this, Qt::Window); connect( newWindow, SIGNAL( closeWindow() ), this, SLOT( closeDetachedView() ) ); connect( newWindow, SIGNAL( closeWindow() ), view, SLOT( deleteLater() ) ); m_detachedViews.append(newWindow); newWindow->setCentralWidget(view); newWindow->setWindowTitle( view->windowTitle() ); if ( !view->permToolBarActions().isEmpty() ) { QToolBar *permToolBar = new QToolBar(newWindow); foreach ( QAction *action, view->permToolBarActions() ) { permToolBar->addAction(action); } newWindow->addToolBar(permToolBar); } if ( !view->activeToolBarActions().isEmpty() ) { QToolBar *activeToolBar = new QToolBar(newWindow); foreach ( QAction *action, view->activeToolBarActions() ) { activeToolBar->addAction(action); } newWindow->addToolBar(activeToolBar); } if ( !view->toolPadActions().isEmpty() ) { QToolBar *toolPad = new QToolBar(newWindow); foreach ( QAction *action, view->toolPadActions() ) { toolPad->addAction(action); } newWindow->addToolBar(Qt::RightToolBarArea, toolPad); } QMenuBar *menuBar = new QMenuBar(newWindow); newWindow->setMenuBar(menuBar); if ( !view->fileMenuActions().isEmpty() ) { QMenu *fileMenu = new QMenu("&File", newWindow); foreach ( QAction *action, view->fileMenuActions() ) { fileMenu->addAction(action); } menuBar->addMenu(fileMenu); } if ( !view->projectMenuActions().isEmpty() ) { QMenu *projectMenu = new QMenu("&Project", newWindow); foreach ( QAction *action, view->projectMenuActions() ) { projectMenu->addAction(action); } menuBar->addMenu(projectMenu); } if ( !view->editMenuActions().isEmpty() ) { QMenu *editMenu = new QMenu("&Edit", newWindow); foreach ( QAction *action, view->editMenuActions() ) { editMenu->addAction(action); } menuBar->addMenu(editMenu); } QAction *reattachAction = new QAction("Reattach View", newWindow); connect( reattachAction, SIGNAL( triggered() ), this, SLOT( reattachView() ) ); QMenu *viewMenu = new QMenu("&View", newWindow); viewMenu->addAction(reattachAction); if ( !view->viewMenuActions().isEmpty() ) { foreach ( QAction *action, view->viewMenuActions() ) { viewMenu->addAction(action); } } menuBar->addMenu(viewMenu); if ( !view->settingsMenuActions().isEmpty() ) { QMenu *settingsMenu = new QMenu("S&ettings", newWindow); foreach ( QAction *action, view->settingsMenuActions() ) { settingsMenu->addAction(action); } menuBar->addMenu(settingsMenu); } if ( !view->helpMenuActions().isEmpty() ) { QMenu *helpMenu = new QMenu("&Help", newWindow); foreach ( QAction *action, view->helpMenuActions() ) { helpMenu->addAction(action); } menuBar->addMenu(helpMenu); } newWindow->show(); } /** * Reattaches a detached view. This slot can only be called by a QAction * from a QMainWindow that contains the view. The view is added to * the main window and the window that previously contained it is * deleted. * PlaceHolder for the option to tab all views. (This was setTabbedViewMode in the old code) */ void IpceMainWindow::reattachView() { QAction *reattachAction = qobject_cast<QAction *>( sender() ); if (!reattachAction) { return; } QMainWindow *viewWindow = qobject_cast<QMainWindow *>( reattachAction->parent() ); if (!viewWindow) { return; } AbstractProjectItemView *view = qobject_cast<AbstractProjectItemView *>( viewWindow->centralWidget() ); if (!view) { return; } view->setParent(this); viewWindow->deleteLater(); addView(view); void IpceMainWindow::tabAllViews() { // QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); // mdiArea->setViewMode(QMdiArea::TabbedView); // m_cascadeViewsAction->setEnabled(false); // m_tileViewsAction->setEnabled(false); } Loading isis/src/qisis/apps/ipce/IpceMainWindow.h +9 −16 Original line number Diff line number Diff line Loading @@ -132,8 +132,8 @@ namespace Isis { * 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. * widget. Added addDock method. Remove all methods having to do with * MDI sub-windows, detached views. * */ class IpceMainWindow : public QMainWindow { Loading @@ -148,9 +148,6 @@ namespace Isis { void removeView(QWidget *view); void removeAllViews(); void setActiveView(AbstractProjectItemView *view); void updateMenuActions(); void updateToolBarActions(); void readSettings(Project *); protected: Loading @@ -160,25 +157,20 @@ namespace Isis { private slots: void configureThreadLimit(); void enterWhatsThisMode(); void onSubWindowActivated(QMdiSubWindow *); void toggleViewMode(); void setTabbedViewMode(); void setSubWindowViewMode(); void closeDetachedView(); void detachActiveView(); void reattachView(); void tabAllViews(); void raiseWarningTab(); private: Q_DISABLE_COPY(IpceMainWindow); void applyMaxThreadCount(); void createMenus(); void writeSettings(const Project *project) const; void initializeActions(); void createMenus(); void createToolBars(); void writeSettings(const Project *project) const; private: /** Loading @@ -188,8 +180,9 @@ namespace Isis { QPointer<Directory> m_directory; QDockWidget *m_projectDock; QList<ViewSubWindow *> m_detachedViews; //!< List to keep track of any detached main windows QDockWidget *m_warningsDock; QList<QDockWidget *> m_dockedWidgets; /** * This is the "goal" or "estimated" maximum number of active threads running in this program * at once. For now, the GUI consumes 1 thread and QtConcurrent Loading isis/src/qisis/objs/CubeDnView/CubeDnView.cpp +17 −23 File changed.Preview size limit exceeded, changes collapsed. Show changes isis/src/qisis/objs/Directory/Directory.h +0 −1 Original line number Diff line number Diff line Loading @@ -364,7 +364,6 @@ namespace Isis { signals: void directoryCleaned(); void newWarning(); void newDockAvailable(QMainWindow *newWidget); void newWidgetAvailable(QWidget *newWidget); void viewClosed(QWidget *widget); Loading isis/src/qisis/objs/Footprint2DView/Footprint2DView.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -130,14 +130,14 @@ namespace Isis { m_toolPad = new ToolPad("Tool Pad", 0); m_toolPad->setObjectName("toolPad"); addToolBar(Qt::RightToolBarArea, m_toolPad); m_sceneWidget->addToPermanent(m_permToolBar); m_sceneWidget->addTo(m_activeToolBar); m_sceneWidget->addTo(m_toolPad); m_activeToolBarAction = new QWidgetAction(this); m_activeToolBarAction->setDefaultWidget(m_activeToolBar); // m_activeToolBarAction = new QWidgetAction(this); // m_activeToolBarAction->setDefaultWidget(m_activeToolBar); setAcceptDrops(true); Loading Loading
isis/src/qisis/apps/ipce/IpceMainWindow.cpp +108 −474 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ namespace Isis { QWidget *centralWidget = new QWidget; setCentralWidget(centralWidget); centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); //centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); //centralWidget->hide(); setDockNestingEnabled(true); Loading Loading @@ -147,20 +147,10 @@ namespace Isis { m_directory->setHistoryContainer(historyDock); tabifyDockWidget(m_warningsDock, historyDock); // QDockWidget *progressDock = new QDockWidget("Progress", this, Qt::SubWindow); // progressDock->setObjectName("progressDock"); // progressDock->setFeatures(QDockWidget::DockWidgetClosable | // QDockWidget::DockWidgetMovable | // QDockWidget::DockWidgetFloatable); // progressDock->setAllowedAreas(Qt::BottomDockWidgetArea); // //m_directory->setProgressContainer(progressDock); // addDockWidget(Qt::BottomDockWidgetArea, progressDock); // tabifyDockWidget(historyDock, progressDock); historyDock->raise(); setTabPosition(Qt::TopDockWidgetArea, QTabWidget::North); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea); Loading @@ -173,28 +163,9 @@ namespace Isis { statusBar()->addWidget(progressBar); } createMenus(); initializeActions(); updateMenuActions(); 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); updateToolBarActions(); createMenus(); createToolBars(); // setTabbedViewMode(); // centralWidget->setTabsMovable(true); Loading @@ -206,11 +177,6 @@ namespace Isis { OpenProjectWorkOrder *workorder = new OpenProjectWorkOrder(m_directory->project()); workorder->execute(); } // ken testing If this is used, we will not need to call updateMenuActions() or updateToolBar() // above. They are both called from setActiveView. // setActiveView(projectTreeView); // ken testing } Loading Loading @@ -248,44 +214,24 @@ namespace Isis { splitDockWidget(m_projectDock, dock, Qt::Vertical); } else { if ( QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ) ) { mdiArea->addSubWindow(newWidget); newWidget->show(); mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow *>(newWidget)); setActiveView(qobject_cast<AbstractProjectItemView *>(newWidget)); } } // m_dockedWidgets.append } /** * @description This slot is connected from Directory::viewClosed(QWidget *) signal. It will * close the given QMdiSubWindow from the QMdiArea. This will also delete the widget contained * within the subwindow which is an AbstractProjectItemView. * close the given view and delete the view. * * @param view QWidget* * */ void IpceMainWindow::removeView(QWidget *view) { QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); if (mdiArea){ // Get all QMdiSubWindows, then find subwindow that hold widget QList<QMdiSubWindow *> subWindowList = mdiArea->subWindowList(); foreach (QMdiSubWindow *sub, subWindowList) { if (sub->widget() == view) { sub->close(); break; } } // QMdiSubWindow *window = qobject_cast<QMdiSubWindow *>(view); // qDebug()<<"IpceMainWindow::removeView activewindow = "<<window; // mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow *>(view)); // qDebug()<<"IpceMainWindow::removeView"; // mdiArea->closeActiveSubWindow(); view->close(); delete view; } } /** Loading @@ -293,20 +239,8 @@ namespace Isis { */ void IpceMainWindow::removeAllViews() { setWindowTitle("ipce"); QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); if (mdiArea){ // QMdiSubWindow* window = new QMdiSubWindow(); // window->show(); // window->activateWindow(); // mdiArea->addSubWindow(window); // mdiArea->closeAllSubWindows(); // delete window; } if (!m_detachedViews.isEmpty()) { foreach ( QMainWindow* view, m_detachedViews ) { view->close(); } } QList<QDockWidget *> docks = tabifiedDockWidgets(m_projectDock); if(docks.count() > 1) { Loading @@ -327,178 +261,6 @@ namespace Isis { } /** * Sets the active view and updates the toolbars and menus. * * @param[in] view (AbstractProjectItemView *) The active view. */ void IpceMainWindow::setActiveView(AbstractProjectItemView *view) { m_activeView = view; updateMenuActions(); updateToolBarActions(); } /** * Clears all the menus, then populates the menus with QActions from * several sources. The QActions come from an internal list of * QActions, the Directory, and the active view. */ void IpceMainWindow::updateMenuActions() { m_fileMenu->clear(); // Get Directory FileMenu actions foreach ( QAction *action, m_directory->fileMenuActions() ) { m_fileMenu->addAction(action); } m_fileMenu->addSeparator(); // Get FileMenu actions for the active view (eg. CubeDnView, Footprint2DView) if (m_activeView) { foreach ( QAction *action, m_activeView->fileMenuActions() ) { m_fileMenu->addAction(action); } } m_fileMenu->addSeparator(); // Get FileMenu actions from the ipceMainWindow, Exit is the only action foreach ( QAction *action, m_fileMenuActions ) { m_fileMenu->addAction(action); } m_projectMenu->clear(); // Get Project menu actions from Directory foreach ( QAction *action, m_directory->projectMenuActions() ) { m_projectMenu->addAction(action); } m_projectMenu->addSeparator(); // Get Project menu actions from the active view if (m_activeView) { foreach ( QAction *action, m_activeView->projectMenuActions() ) { m_projectMenu->addAction(action); } } m_projectMenu->addSeparator(); // Get Project menu actions from IpceMainWindow foreach ( QAction *action, m_projectMenuActions ) { m_projectMenu->addAction(action); } m_editMenu->clear(); // Get Edit menu actions from Directory foreach ( QAction *action, m_directory->editMenuActions() ) { m_editMenu->addAction(action); } m_editMenu->addSeparator(); // Get Edit menu actions from active view if (m_activeView) { foreach ( QAction *action, m_activeView->editMenuActions() ) { m_editMenu->addAction(action); } } m_editMenu->addSeparator(); // Get Edit menu actions from IpceMainWindow foreach ( QAction *action, m_editMenuActions ) { m_editMenu->addAction(action); } m_viewMenu->clear(); // Get View menu actions from Directory foreach ( QAction *action, m_directory->viewMenuActions() ) { m_viewMenu->addAction(action); } m_viewMenu->addSeparator(); // Get View menu actions from IpceMainWindow foreach ( QAction *action, m_viewMenuActions ) { m_viewMenu->addAction(action); } m_viewMenu->addSeparator(); // Get View menu actions from active view if (m_activeView) { foreach ( QAction *action, m_activeView->viewMenuActions() ) { m_viewMenu->addAction(action); } } m_settingsMenu->clear(); // Get Settings menu actions from Directory foreach ( QAction *action, m_directory->settingsMenuActions() ) { m_settingsMenu->addAction(action); } m_settingsMenu->addSeparator(); // Get Settings menu actions from active view if (m_activeView) { foreach ( QAction *action, m_activeView->settingsMenuActions() ) { m_settingsMenu->addAction(action); } } m_settingsMenu->addSeparator(); // Get Settings menu actions from IpceMainWindow foreach ( QAction *action, m_settingsMenuActions ) { m_settingsMenu->addAction(action); } m_helpMenu->clear(); // Get Help menu actions from Directory foreach ( QAction *action, m_directory->helpMenuActions() ) { m_helpMenu->addAction(action); } m_helpMenu->addSeparator(); // Get Help menu actions from active view if (m_activeView) { foreach ( QAction *action, m_activeView->helpMenuActions() ) { m_helpMenu->addAction(action); } } m_helpMenu->addSeparator(); // Get Help menu actions from IpceMainWindow foreach ( QAction *action, m_helpMenuActions ) { m_helpMenu->addAction(action); } } /** * Clears the tool bars and repopulates them with QActions from * several sources. Actions are taken from an internal list of * QActions, the Directory, and the active view. */ void IpceMainWindow::updateToolBarActions() { m_permToolBar->clear(); 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); if (action->text() == "&Save Active Control Network") { m_permToolBar->addSeparator(); } } m_permToolBar->addSeparator(); if (m_activeView) { foreach ( QAction *action, m_activeView->permToolBarActions() ) { m_permToolBar->addAction(action); } } m_activeToolBar->clear(); if (m_activeView) { foreach ( QAction *action, m_activeView->activeToolBarActions() ) { m_activeToolBar->addAction(action); } } m_toolPad->clear(); if (m_activeView) { foreach ( QAction *action, m_activeView->toolPadActions() ) { m_toolPad->addAction(action); } } } /** * Filters out events from views so they can be handled by the main * window. Filters out DragEnter Drop and ContextMenu events from Loading Loading @@ -611,12 +373,6 @@ namespace Isis { m_editMenuActions.append(undoAction); m_editMenuActions.append(redoAction); QAction *viewModeAction = new QAction("Toggle View Mode", this); connect(viewModeAction, SIGNAL( triggered() ), this, SLOT( toggleViewMode() ) ); m_viewMenuActions.append(viewModeAction); // m_cascadeViewsAction = new QAction("Cascade Views", this); // connect(m_cascadeViewsAction, SIGNAL( triggered() ), // centralWidget(), SLOT( cascadeSubWindows() ) ); Loading @@ -627,10 +383,6 @@ namespace Isis { // centralWidget(), SLOT( tileSubWindows() ) ); // m_viewMenuActions.append(m_tileViewsAction); QAction *detachActiveViewAction = new QAction("Detach Active View", this); connect(detachActiveViewAction, SIGNAL( triggered() ), this, SLOT( detachActiveView() ) ); m_viewMenuActions.append(detachActiveViewAction); QAction *threadLimitAction = new QAction("Set Thread &Limit", this); connect(threadLimitAction, SIGNAL(triggered()), Loading @@ -654,15 +406,28 @@ namespace Isis { /** * Creates the main menus of the menu bar. * Creates and fills the application menus of the menu bar. */ void IpceMainWindow::createMenus() { m_fileMenu = menuBar()->addMenu(tr("&File")); m_fileMenu->setObjectName("fileMenu"); // Get Directory FileMenu actions foreach ( QAction *action, m_directory->fileMenuActions() ) { m_fileMenu->addAction(action); } m_fileMenu->addSeparator(); // Get FileMenu actions from the ipceMainWindow, Exit is the only action foreach ( QAction *action, m_fileMenuActions ) { m_fileMenu->addAction(action); } m_projectMenu = menuBar()->addMenu(tr("&Project")); m_projectMenu->setObjectName("projectMenu"); // Get Project menu actions from Directory foreach ( QAction *action, m_directory->projectMenuActions() ) { m_projectMenu->addAction(action); } // Allow tool tips to be displayed for the project menu's actions (e.g. "Bundle Adjustment") // This is a work around for Qt's what this text not working on disabled actions // (even though the Qt documentation says it should work on disabled QAction's). Loading @@ -670,15 +435,91 @@ namespace Isis { m_editMenu = menuBar()->addMenu(tr("&Edit")); m_editMenu->setObjectName("editMenu"); m_editMenu->addSeparator(); // Get Edit menu actions from Directory foreach ( QAction *action, m_directory->editMenuActions() ) { m_editMenu->addAction(action); } // Get Edit menu actions from IpceMainWindow foreach ( QAction *action, m_editMenuActions ) { m_editMenu->addAction(action); } m_viewMenu = menuBar()->addMenu("&View"); m_viewMenu->setObjectName("viewMenu"); // Get View menu actions from Directory foreach ( QAction *action, m_directory->viewMenuActions() ) { m_viewMenu->addAction(action); } m_viewMenu->addSeparator(); // Get View menu actions from IpceMainWindow foreach ( QAction *action, m_viewMenuActions ) { m_viewMenu->addAction(action); } m_settingsMenu = menuBar()->addMenu("&Settings"); m_settingsMenu->setObjectName("settingsMenu"); // Get Settings menu actions from Directory foreach ( QAction *action, m_directory->settingsMenuActions() ) { m_settingsMenu->addAction(action); } m_settingsMenu->addSeparator(); // Get Settings menu actions from IpceMainWindow foreach ( QAction *action, m_settingsMenuActions ) { m_settingsMenu->addAction(action); } m_helpMenu = menuBar()->addMenu("&Help"); m_helpMenu->setObjectName("helpMenu"); // Get Help menu actions from Directory foreach ( QAction *action, m_directory->helpMenuActions() ) { m_helpMenu->addAction(action); } m_helpMenu->addSeparator(); // Get Help menu actions from IpceMainWindow foreach ( QAction *action, m_helpMenuActions ) { m_helpMenu->addAction(action); } } /** * Create the tool bars and populates them with QActions from several sources. Actions are taken * from an internal list of QActions and the Directory. */ 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); } } } Loading Loading @@ -966,220 +807,13 @@ namespace Isis { /** * Slot to connect to the subWindowActivated signal from the central * QMdiArea. Updates the active view to the active sub window, or * sets it to null if the active window is not an AbstractProjectItemView. * * @param[in] window (QMdiSubWindow *) The active sub window. */ void IpceMainWindow::onSubWindowActivated(QMdiSubWindow * window) { if (window) { setActiveView( qobject_cast<AbstractProjectItemView *>( window->widget() ) ); } else { setActiveView(0); } } /** * Toggles the view mode of the central QMdiArea between tabbed and * sub window mode. */ void IpceMainWindow::toggleViewMode() { QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); if (mdiArea->viewMode() == QMdiArea::SubWindowView) { setTabbedViewMode(); } else { setSubWindowViewMode(); } } /** * Sets the QMdiArea in the central widget to the tabbed view mode * and updates the appropriate actions. */ void IpceMainWindow::setTabbedViewMode() { QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); mdiArea->setViewMode(QMdiArea::TabbedView); m_cascadeViewsAction->setEnabled(false); m_tileViewsAction->setEnabled(false); } /** * Sets the QMdiArea in the central widget to the sub window view * mode and updates the appropriate actions. */ void IpceMainWindow::setSubWindowViewMode() { QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); mdiArea->setViewMode(QMdiArea::SubWindowView); m_cascadeViewsAction->setEnabled(true); m_tileViewsAction->setEnabled(true); } /** * Closes the detached window and removes it from the m_detachedViews list */ void IpceMainWindow::closeDetachedView() { ViewSubWindow *viewWindow = qobject_cast<ViewSubWindow *>( sender() ); if (!viewWindow) { return; } m_detachedViews.removeAt(m_detachedViews.indexOf(viewWindow)); viewWindow->close(); } /** * Moves the active view from the mdi area to its own independent * window. The view, its toolbars, and menu actions, are removed * from the main window and placed in an independent * QMainWindow. The new window contains the view as well as its * toolbars and menu actions. A detached view will not be set as the * active view when it is activated. */ void IpceMainWindow::detachActiveView() { AbstractProjectItemView *view = m_activeView; if (!m_activeView) { return; } QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); if (mdiArea) { mdiArea->removeSubWindow(view); mdiArea->closeActiveSubWindow(); } ViewSubWindow *newWindow = new ViewSubWindow(this, Qt::Window); connect( newWindow, SIGNAL( closeWindow() ), this, SLOT( closeDetachedView() ) ); connect( newWindow, SIGNAL( closeWindow() ), view, SLOT( deleteLater() ) ); m_detachedViews.append(newWindow); newWindow->setCentralWidget(view); newWindow->setWindowTitle( view->windowTitle() ); if ( !view->permToolBarActions().isEmpty() ) { QToolBar *permToolBar = new QToolBar(newWindow); foreach ( QAction *action, view->permToolBarActions() ) { permToolBar->addAction(action); } newWindow->addToolBar(permToolBar); } if ( !view->activeToolBarActions().isEmpty() ) { QToolBar *activeToolBar = new QToolBar(newWindow); foreach ( QAction *action, view->activeToolBarActions() ) { activeToolBar->addAction(action); } newWindow->addToolBar(activeToolBar); } if ( !view->toolPadActions().isEmpty() ) { QToolBar *toolPad = new QToolBar(newWindow); foreach ( QAction *action, view->toolPadActions() ) { toolPad->addAction(action); } newWindow->addToolBar(Qt::RightToolBarArea, toolPad); } QMenuBar *menuBar = new QMenuBar(newWindow); newWindow->setMenuBar(menuBar); if ( !view->fileMenuActions().isEmpty() ) { QMenu *fileMenu = new QMenu("&File", newWindow); foreach ( QAction *action, view->fileMenuActions() ) { fileMenu->addAction(action); } menuBar->addMenu(fileMenu); } if ( !view->projectMenuActions().isEmpty() ) { QMenu *projectMenu = new QMenu("&Project", newWindow); foreach ( QAction *action, view->projectMenuActions() ) { projectMenu->addAction(action); } menuBar->addMenu(projectMenu); } if ( !view->editMenuActions().isEmpty() ) { QMenu *editMenu = new QMenu("&Edit", newWindow); foreach ( QAction *action, view->editMenuActions() ) { editMenu->addAction(action); } menuBar->addMenu(editMenu); } QAction *reattachAction = new QAction("Reattach View", newWindow); connect( reattachAction, SIGNAL( triggered() ), this, SLOT( reattachView() ) ); QMenu *viewMenu = new QMenu("&View", newWindow); viewMenu->addAction(reattachAction); if ( !view->viewMenuActions().isEmpty() ) { foreach ( QAction *action, view->viewMenuActions() ) { viewMenu->addAction(action); } } menuBar->addMenu(viewMenu); if ( !view->settingsMenuActions().isEmpty() ) { QMenu *settingsMenu = new QMenu("S&ettings", newWindow); foreach ( QAction *action, view->settingsMenuActions() ) { settingsMenu->addAction(action); } menuBar->addMenu(settingsMenu); } if ( !view->helpMenuActions().isEmpty() ) { QMenu *helpMenu = new QMenu("&Help", newWindow); foreach ( QAction *action, view->helpMenuActions() ) { helpMenu->addAction(action); } menuBar->addMenu(helpMenu); } newWindow->show(); } /** * Reattaches a detached view. This slot can only be called by a QAction * from a QMainWindow that contains the view. The view is added to * the main window and the window that previously contained it is * deleted. * PlaceHolder for the option to tab all views. (This was setTabbedViewMode in the old code) */ void IpceMainWindow::reattachView() { QAction *reattachAction = qobject_cast<QAction *>( sender() ); if (!reattachAction) { return; } QMainWindow *viewWindow = qobject_cast<QMainWindow *>( reattachAction->parent() ); if (!viewWindow) { return; } AbstractProjectItemView *view = qobject_cast<AbstractProjectItemView *>( viewWindow->centralWidget() ); if (!view) { return; } view->setParent(this); viewWindow->deleteLater(); addView(view); void IpceMainWindow::tabAllViews() { // QMdiArea *mdiArea = qobject_cast<QMdiArea *>( centralWidget() ); // mdiArea->setViewMode(QMdiArea::TabbedView); // m_cascadeViewsAction->setEnabled(false); // m_tileViewsAction->setEnabled(false); } Loading
isis/src/qisis/apps/ipce/IpceMainWindow.h +9 −16 Original line number Diff line number Diff line Loading @@ -132,8 +132,8 @@ namespace Isis { * 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. * widget. Added addDock method. Remove all methods having to do with * MDI sub-windows, detached views. * */ class IpceMainWindow : public QMainWindow { Loading @@ -148,9 +148,6 @@ namespace Isis { void removeView(QWidget *view); void removeAllViews(); void setActiveView(AbstractProjectItemView *view); void updateMenuActions(); void updateToolBarActions(); void readSettings(Project *); protected: Loading @@ -160,25 +157,20 @@ namespace Isis { private slots: void configureThreadLimit(); void enterWhatsThisMode(); void onSubWindowActivated(QMdiSubWindow *); void toggleViewMode(); void setTabbedViewMode(); void setSubWindowViewMode(); void closeDetachedView(); void detachActiveView(); void reattachView(); void tabAllViews(); void raiseWarningTab(); private: Q_DISABLE_COPY(IpceMainWindow); void applyMaxThreadCount(); void createMenus(); void writeSettings(const Project *project) const; void initializeActions(); void createMenus(); void createToolBars(); void writeSettings(const Project *project) const; private: /** Loading @@ -188,8 +180,9 @@ namespace Isis { QPointer<Directory> m_directory; QDockWidget *m_projectDock; QList<ViewSubWindow *> m_detachedViews; //!< List to keep track of any detached main windows QDockWidget *m_warningsDock; QList<QDockWidget *> m_dockedWidgets; /** * This is the "goal" or "estimated" maximum number of active threads running in this program * at once. For now, the GUI consumes 1 thread and QtConcurrent Loading
isis/src/qisis/objs/CubeDnView/CubeDnView.cpp +17 −23 File changed.Preview size limit exceeded, changes collapsed. Show changes
isis/src/qisis/objs/Directory/Directory.h +0 −1 Original line number Diff line number Diff line Loading @@ -364,7 +364,6 @@ namespace Isis { signals: void directoryCleaned(); void newWarning(); void newDockAvailable(QMainWindow *newWidget); void newWidgetAvailable(QWidget *newWidget); void viewClosed(QWidget *widget); Loading
isis/src/qisis/objs/Footprint2DView/Footprint2DView.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -130,14 +130,14 @@ namespace Isis { m_toolPad = new ToolPad("Tool Pad", 0); m_toolPad->setObjectName("toolPad"); addToolBar(Qt::RightToolBarArea, m_toolPad); m_sceneWidget->addToPermanent(m_permToolBar); m_sceneWidget->addTo(m_activeToolBar); m_sceneWidget->addTo(m_toolPad); m_activeToolBarAction = new QWidgetAction(this); m_activeToolBarAction->setDefaultWidget(m_activeToolBar); // m_activeToolBarAction = new QWidgetAction(this); // m_activeToolBarAction->setDefaultWidget(m_activeToolBar); setAcceptDrops(true); Loading