18/11/19: maintenance de la plate-forme - Interruptions du service gricad-gitlab et perturbations possibles tout au long de la journée.

Commit a163515a authored by Emmanuel Promayon's avatar Emmanuel Promayon

Merge branch 'feature/switch-central-viewer' into 'develop'

Feature/switch central viewer

See merge request !124
parents ff3a18ae d908b897
......@@ -61,5 +61,6 @@ QWidget* Show3DViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus Show3DViewer::apply() {
MedicalImageViewer::getInstance()->setVisibleViewer(MedicalImageViewer::VIEWER_3D);
Application::refresh();
return SUCCESS;
}
......@@ -61,5 +61,6 @@ QWidget* ShowAllViewers::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowAllViewers::apply() {
MedicalImageViewer::getInstance()->setVisibleViewer(MedicalImageViewer::VIEWER_ALL);
Application::refresh();
return SUCCESS;
}
......@@ -61,5 +61,6 @@ QWidget* ShowArbitraryViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowArbitraryViewer::apply() {
MedicalImageViewer::getInstance()->setVisibleViewer(MedicalImageViewer::VIEWER_ARBITRARY);
Application::refresh();
return SUCCESS;
}
......@@ -61,5 +61,6 @@ QWidget* ShowAxialViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowAxialViewer::apply() {
MedicalImageViewer::getInstance()->setVisibleViewer(MedicalImageViewer::VIEWER_AXIAL);
Application::refresh();
return SUCCESS;
}
......@@ -61,5 +61,6 @@ QWidget* ShowCoronalViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowCoronalViewer::apply() {
MedicalImageViewer::getInstance()->setVisibleViewer(MedicalImageViewer::VIEWER_CORONAL);
Application::refresh();
return SUCCESS;
}
......@@ -61,5 +61,6 @@ QWidget* ShowSagittalViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowSagittalViewer::apply() {
MedicalImageViewer::getInstance()->setVisibleViewer(MedicalImageViewer::VIEWER_SAGITTAL);
Application::refresh();
return SUCCESS;
}
......@@ -22,11 +22,11 @@ set -e
# values to check
initTestData() {
# fill test data
extensionCount=( [4.2]=42 [4.1]=41 [4.0]=31 )
extensionCount=( [4.2]=43 [4.1]=41 [4.0]=31 )
componentExtensionCount=( [4.2]=14 [4.1]=14 [4.0]=14 )
actionExtensionCount=( [4.2]=28 [4.1]=27 [4.0]=27 )
actionExtensionCount=( [4.2]=29 [4.1]=27 [4.0]=27 )
fileExtensionCount=( [4.2]=37 [4.1]=37 [4.0]=37 )
actionCount=( [4.2]=106 [4.1]=105 [4.0]=105 )
actionCount=( [4.2]=107 [4.1]=105 [4.0]=105 )
# fill release date
releaseDate=( [4.2]="not yet released, current development version" \
......
......@@ -85,7 +85,7 @@ ImpMainWindow::ImpMainWindow() : MainWindow("imp") {
dockWidgetExplorer->raise();
}
showViewer(ActionViewer::getInstance(), false);
showDockViewer(ActionViewer::getInstance(), false);
ActionViewer::getInstance()->setSearchPanelVisible(true);
showStatusBar(true);
}
......@@ -292,9 +292,9 @@ void ImpMainWindow::initMenuBar() {
//--------------------------initToolBar-------------------------------
void ImpMainWindow::initToolBar() {
mainToolbar = addToolBar("Main toolbar");
mainToolbar = addToolBar("Main Toolbar");
// ensure object name is set for saving the state
mainToolbar->setObjectName("imp main toolbar");
mainToolbar->setObjectName("ImpMainWindow Main Toolbar");
mainToolbar->addAction(fileOpen);
mainToolbar->addAction(fileSave);
mainToolbar->addAction(QWhatsThis::createAction(this));
......@@ -387,21 +387,24 @@ void ImpMainWindow::resetWindows() {
addDockWidget(Qt::LeftDockWidgetArea, it.value());
it.value()->show();
}
else if (it.value()->widget() == FrameExplorer::getInstance()->getWidget(NULL)) {
removeDockWidget(it.value());
addDockWidget(Qt::LeftDockWidgetArea, it.value());
it.value()->show();
}
else if (it.value()->widget() == PropertyExplorer::getInstance()->getWidget()) {
removeDockWidget(it.value());
addDockWidget(Qt::LeftDockWidgetArea, it.value());
it.value()->show();
}
else if (it.value()->widget() == ActionViewer::getInstance()->getWidget()) {
removeDockWidget(it.value());
addDockWidget(Qt::RightDockWidgetArea, it.value());
it.value()->show();
}
else
if (it.value()->widget() == FrameExplorer::getInstance()->getWidget(NULL)) {
removeDockWidget(it.value());
addDockWidget(Qt::LeftDockWidgetArea, it.value());
it.value()->show();
}
else
if (it.value()->widget() == PropertyExplorer::getInstance()->getWidget()) {
removeDockWidget(it.value());
addDockWidget(Qt::LeftDockWidgetArea, it.value());
it.value()->show();
}
else
if (it.value()->widget() == ActionViewer::getInstance()->getWidget()) {
removeDockWidget(it.value());
addDockWidget(Qt::RightDockWidgetArea, it.value());
it.value()->show();
}
}
//Merge Explorer and FrameExplorer viewers in one layout
QDockWidget* dockWidgetExplorer = dockWidgetMap.value(Explorer::getInstance(), NULL);
......@@ -478,6 +481,10 @@ void ImpMainWindow::openDirectory(QAction* emitter) {
// ------------- updateViewMenu -----------------
void ImpMainWindow::updateViewMenu() {
// From Qt documentation:
// "Removes all the menu's actions. Actions owned by the menu and not shown in any other widget are deleted"
// I.e., the central viewer toggle action are own by viewMenu (they are created and used here), they will
// therefore be no memory leak
viewMenu->clear();
// insert viewers menu
......@@ -489,6 +496,37 @@ void ImpMainWindow::updateViewMenu() {
}
}
// change the central viewer if there is more than one viewer in the central area
if (qobject_cast<QStackedWidget*>(centralWidget())->count() > 1) {
viewMenu->addSeparator()->setText(tr("Toggle Central Viewers"));
// add a toggle action for each widget stacked inside the central widget
for (int i = 0; i < qobject_cast<QStackedWidget*>(centralWidget())->count(); i++) {
QWidget* cWidget = qobject_cast<QStackedWidget*>(centralWidget())->widget(i);
// Get the viewer associated with the widget in the central area
// As there is no map from widget to viewer, we need to find the viewer that
// has the given corresponding widget.
// Beware that getWidget(..) requires a parent and as the widget was setup inside centralWidget()
// it was reparented to centralWidget() → use getWidget(centralWidget()) and not getWidget(this)
// in order not to modify the central widget parenting
auto it = std::find_if(viewers.begin(), viewers.end(), [&](Viewer * v) {
return v->getWidget(centralWidget()) == cWidget;
});
Viewer* cViewer = (*it);
// viewerAction is own by viewMenu, viewMenu->clear() will delete it
QAction *viewerAction = viewMenu->addAction(cViewer->objectName());
viewerAction->setCheckable(true);
viewerAction->setChecked(cViewer == centralViewer);
QString tipString = "Hide/show the " + cViewer->objectName() + " central viewer";
viewerAction->setStatusTip(tr(tipString.toStdString().c_str()));
viewerAction->setWhatsThis(tr(tipString.toStdString().c_str()));
// add the toggle action slot using C++11 lambda so that everything is contained inside viewMenu
connect(viewerAction, &QAction::toggled, [=](bool) {
setCentralViewer(cViewer);
});
}
}
// insert viewers on/off actions
viewMenu->addSeparator()->setText(tr("Toggle Viewers"));
viewMenu->addAction(viewResetWindows);
......
......@@ -45,6 +45,7 @@
#include <QUrl>
#include <QCloseEvent>
#include <QMimeData>
#include <QStackedWidget>
namespace camitk {
// ------------- constructor -----------------
......@@ -186,15 +187,10 @@ void MainWindow::setWindowSubtitle(QString subtitle) {
bool MainWindow::addViewer(Viewer* theViewer) {
if (!viewers.contains(theViewer)) {
viewers.append(theViewer);
// connect
connect(theViewer, SIGNAL(selectionChanged()), this, SLOT(refresh()));
// add the toolbar
if (theViewer->getToolBar()) {
QToolBar* viewerToolBar = theViewer->getToolBar();
addToolBar(viewerToolBar);
}
return true;
}
......@@ -203,27 +199,39 @@ bool MainWindow::addViewer(Viewer* theViewer) {
// ------------- removeViewer -----------------
bool MainWindow::removeViewer(Viewer* viewer) {
if (!viewers.contains(viewer)) {
return false;
}
return true;
}
// tell all component not to be visible anymore in this viewer
foreach (Component* comp, Application::getAllComponents()) {
comp->setVisibility(viewer, false);
// ------------- showDockViewer -----------------
void MainWindow::showDockViewer(Viewer* theViewer, bool visible) {
if (dockWidgetMap.contains(theViewer)) {
// set visibility of the viewer
dockWidgetMap[theViewer]->setVisible(visible);
// set visibility of the toolbar
showViewerToolbar(theViewer, visible);
}
// remove it properly
disconnect(viewer, SIGNAL(selectionChanged()), this, SLOT(refresh()));
viewers.removeAll(viewer);
delete viewer;
return true;
}
// ------------- showViewer -----------------
void MainWindow::showViewer(Viewer* theViewer, bool visible) {
if (viewers.contains(theViewer)) {
dockWidgetMap[theViewer]->setVisible(visible);
showDockViewer(theViewer, visible);
}
// ------------- showViewerToolbar -----------------
void MainWindow::showViewerToolbar(Viewer* theViewer, bool visible) {
if (theViewer == nullptr)
return;
QToolBar* viewerToolBar = theViewer->getToolBar();
if (viewerToolBar != nullptr) {
if (visible && theViewer->getToolBarVisibility()) {
addToolBar(viewerToolBar);
viewerToolBar->setVisible(true);
}
else {
removeToolBar(viewerToolBar);
viewerToolBar->setVisible(false);
}
}
}
......@@ -232,43 +240,56 @@ void MainWindow::refreshViewers() {
foreach (Viewer* v, viewers) {
v->refresh();
}
// update the central viewer toolbar visibility
showViewerToolbar(centralViewer, true);
}
// ------------- addDockViewer -----------------
void MainWindow::addDockViewer(Qt::DockWidgetArea dockingArea, Viewer* theViewer) {
if (addViewer(theViewer)) {
// create the dock widget and insert it
QDockWidget* viewerDock = new QDockWidget(theViewer->objectName(), this);
viewerDock->setObjectName(theViewer->objectName());
QWidget* viewerWidget = theViewer->getWidget(viewerDock);
// create the dock widget and insert it only if the viewer has a widget
QWidget* viewerWidget = theViewer->getWidget(this);
if (viewerWidget) {
// add the widget
QDockWidget* viewerDock = new QDockWidget(theViewer->objectName(), this);
viewerDock->setObjectName(theViewer->objectName());
viewerDock->setWidget(viewerWidget);
addDockWidget(dockingArea, viewerDock);
// update map
// update the map
dockWidgetMap.insert(theViewer, viewerDock);
}
else {
delete viewerDock;
}
}
else {
dockWidgetMap.value(theViewer)->show();
}
// show the viewer anyway
showDockViewer(theViewer, true);
}
// ------------- setCentralViewer -----------------
void MainWindow::setCentralViewer(Viewer* theViewer) {
if (theViewer->getWidget(this) && addViewer(theViewer)) {
// remove actual central viewer properly
if (centralViewer && (theViewer != centralViewer)) {
removeViewer(centralViewer);
// get the viewer widget (must have something to show as it is a viewer after all!)
QWidget* viewerWidget = theViewer->getWidget(this);
if (viewerWidget != nullptr) {
// add the viewer to the list (if not already in the list)
addViewer(theViewer);
// if needed, create the default (empty) central widget inside which the central viewers can be added
if (centralWidget() == 0) {
setCentralWidget(new QStackedWidget(this));
}
// set the central widget
setCentralWidget(theViewer->getWidget(this));
else {
// there is already a central viewer, just hide its toolbar
showViewerToolbar(centralViewer, false);
}
// add the viewer's widget
qobject_cast<QStackedWidget*>(centralWidget())->addWidget(viewerWidget);
qobject_cast<QStackedWidget*>(centralWidget())->setCurrentWidget(viewerWidget);
centralViewer = theViewer;
// show its toolbar
showViewerToolbar(centralViewer, true);
}
}
......@@ -285,6 +306,8 @@ void MainWindow::refresh() {
v->refresh();
}
}
// update the central viewer toolbar visibility
showViewerToolbar(centralViewer, true);
}
// ------------- showStatusBar -----------------
......@@ -297,7 +320,6 @@ QProgressBar* MainWindow::getProgressBar() {
return myProgressBar;
}
// ------------- setApplicationConsole -----------------
void MainWindow::redirectToConsole(bool visible) {
if (visible) {
......
......@@ -50,14 +50,20 @@ class Viewer;
* @ingroup group_sdk_libraries_core_application
*
* @brief
* This Class is the base class for your application. It sets up the main
* window and providing a menubar, toolbar and statusbar (all hidden).
* This class is the base class for your application. It sets up the main
* window and creates a menubar, toolbar and statusbar (all hidden by default).
*
* It is the default main window for a application.
*
* Create a class that inherits from MainWindow to
* get all the goodies of Core and add your own customization/UI.
* See applications for examples.
* get all the goodies of CamiTK and add your own customization/UI.
*
* See tutorials applications for examples.
*
* The central widget is a QStackWidget: when new central viewers are added, the previous central
* viewer is hidden, not destroyed. See the "switchviewer" action tutorial for some example on
* how to embed an new central viewer to the imp main window (and switch back to medical image viewer
* whenever required).
*/
class CAMITK_API MainWindow : public QMainWindow {
Q_OBJECT
......@@ -118,12 +124,28 @@ public:
/// @name Viewers
///@{
///@cond
/**
* TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 5.0
* @deprecated
*
* DEPRECATED (CamiTK 5.0) -> to be removed
* This method is now called showDockViewer.
*/
/// set the visibility for the given viewer (if it is in a dock)
virtual void showViewer(Viewer*, bool);
///@endcond
/// set the visibility for the given docked viewer and its toolbar
virtual void showDockViewer(Viewer*, bool);
/** add a Viewer to the application as a docking widget and specify where it has to be docked
* Note that MainWindow takes ownership of the Viewer pointer and deletes it at the appropriate time.
*
* This method calls addViewer(...).
* This method calls showDockViewer(..,true) and therefore showViewerToolbar(..,true)
*
* \note MainWindow takes ownership of the viewer pointer and deletes it when it is itself destroyed.
*/
virtual void addDockViewer(Qt::DockWidgetArea, Viewer*);
......@@ -131,16 +153,26 @@ public:
void refreshViewers();
/** set the central Viewer of the application.
* Note that MainWindow takes ownership of the Viewer pointer and deletes it at the appropriate time.
* This method calls addViewer(...).
* The central viewer has a specific behaviour in a MainWindow. It uses a QStackWidget to keep
* all the central viewer that are used. When a new central viewers is set, the previous central
* viewer (i.e., its widget) is hidden but not destroyed.
*
* This method calls addViewer(..).
* This method calls showViewerToolbar(..,true)
*
* \note MainWindow takes ownership of the viewer pointer and deletes it when it is itself destroyed.
*/
virtual void setCentralViewer(Viewer*);
/**
* @Return the actual central viewer.
* @return
* @return the current central viewer.
*/
virtual const Viewer& getCentralViewer() const;
/** Set the visibility of a viewer's toolbar.
* This method respect the toolbar visibility property of the viewer.
*/
virtual void showViewerToolbar(Viewer* theViewer, bool visible);
///@}
public slots:
......@@ -184,13 +216,22 @@ protected:
/// just call open with the dragged uri
void dropEvent(QDropEvent* event) override;
///@cond
/**
* TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 5.0
* @deprecated
*
* DEPRECATED (CamiTK 5.0) -> to be removed
* Removing viewers can be harmful. Central viewer is now simply hidden, therefore there is no need to remove it.
* It will keep itself refreshed and when shown again will be up to date.
*
* @brief Remove the given viewer from the list of viewer.
* @note This tell all Component not to be visible anymore in this viewer instance, remove it from the list of viewers and delete it.
* @param viewer The viewer to remove.
* @return True if removing succeeded, false otherwise.
*/
bool removeViewer(Viewer* viewer);
///@endcond
/**
* @brief The actual central Viewer.
......@@ -203,12 +244,11 @@ private:
/**
* Add a viewer (called by addDockViewer and setCentralViewer), returns true if not already added.
* Note that MainWindow takes ownership of the Viewer pointer and deletes it at the appropriate time.
* This method connects the selectionChanged signal of the viewer to the refresh method.
* Before CamiTK 4.x this method was a public method.
* Note that MainWindow takes ownership of the Viewer pointer and deletes it when it is itself destroyed.
*
* This method connects the selectionChanged signal of the viewer to the refresh method of MainWindow.
*/
virtual bool addViewer(Viewer*);
///@endcond
/// the output stream for the application console
ConsoleStream cout;
......@@ -227,6 +267,7 @@ private:
/// the main part of the title
QString mainTitle;
};
}
......
......@@ -145,13 +145,13 @@ void MeshComponent::init() {
// build the selection widget
auto* hbox = new QVBoxLayout(selectionWidget);
auto* selectionToolBar = new QToolBar(selectionWidget);
selectionToolBar->addAction(removeSelections);
selectionToolBar->addAction(mergeSelection);
selectionToolBar->addAction(inspectSelection);
selectionToolBar->addWidget(insertionPolicyBox);
auto* selectionToolbar = new QToolBar(selectionWidget);
selectionToolbar->addAction(removeSelections);
selectionToolbar->addAction(mergeSelection);
selectionToolbar->addAction(inspectSelection);
selectionToolbar->addWidget(insertionPolicyBox);
hbox->addWidget(selectionView);
hbox->addWidget(selectionToolBar);
hbox->addWidget(selectionToolbar);
selectionWidget->setLayout(hbox);
// data widget
......@@ -200,13 +200,13 @@ void MeshComponent::init() {
// build the data widget
auto* dataBox = new QVBoxLayout(dataWidget);
auto* dataToolBar = new QToolBar(dataWidget);
dataToolBar->addAction(removeData);
dataToolBar->addAction(inspectData);
dataToolBar->addWidget(displayTypePolicyBox);
dataToolBar->addWidget(vectorRepresentationPolicyBox);
auto* dataToolbar = new QToolBar(dataWidget);
dataToolbar->addAction(removeData);
dataToolbar->addAction(inspectData);
dataToolbar->addWidget(displayTypePolicyBox);
dataToolbar->addWidget(vectorRepresentationPolicyBox);
dataBox->addWidget(dataView);
dataBox->addWidget(dataToolBar);
dataBox->addWidget(dataToolbar);
dataWidget->setLayout(dataBox);
}
......
......@@ -436,7 +436,7 @@ protected:
QMenu* viewerMenu;
/// the QToolBar for the InteractiveViewer
QToolBar* viewerToolBar;
QToolBar* viewerToolbar;
/// the ComboBox for mesh scalar data
QComboBox* scalarDataComboBox;
......
......@@ -135,25 +135,13 @@ QWidget* MedicalImageViewer::getWidget(QWidget* parent) {
viewers.insert(VIEWER_CORONAL, InteractiveViewer::getCoronalViewer());
viewers.insert(VIEWER_SAGITTAL, InteractiveViewer::getSagittalViewer());
//-- add the InteractiveViewers
// topLeftLayout = new QVBoxLayout();
// frameLayout->addLayout(topLeftLayout, 0, 0);
// topLeftLayout->addWidget(InteractiveViewer::getAxialViewer()->getWidget(frame)); // north-west
// topLeftLayout->addWidget(InteractiveViewer::getArbitraryViewer()->getWidget(frame)); // north-west
// frameLayout->addWidget(InteractiveViewer::getCoronalViewer()->getWidget(frame), 0, 1); // north-east
// frameLayout->addWidget(InteractiveViewer::getSagittalViewer()->getWidget(frame), 1, 0); // south-west
// frameLayout->addWidget(InteractiveViewer::get3DViewer()->getWidget(frame), 1, 1); // south-east
topLeftLayout = new QVBoxLayout();
frameLayout->addLayout(topLeftLayout, 0, 0);
topLeftLayout->addWidget(InteractiveViewer::getAxialViewer()->getWidget(frame));
// frameLayout->addWidget(InteractiveViewer::getAxialViewer()->getWidget(frame), 0, 0); // north-west
topLeftLayout->addWidget(InteractiveViewer::getAxialViewer()->getWidget(frame)); // equivalent of addWidget(InteractiveViewer::getAxialViewer()->getWidget(frame), 0, 0) = north-west
frameLayout->addWidget(InteractiveViewer::getCoronalViewer()->getWidget(frame), 1, 0); // north-east
frameLayout->addWidget(InteractiveViewer::getSagittalViewer()->getWidget(frame), 1, 1); // south-west
frameLayout->addWidget(InteractiveViewer::get3DViewer()->getWidget(frame), 0, 1); // south-east
//-- connect
foreach (LayoutVisibility v, viewerVisibility) {
if (viewers.value(v)) { // prevent ALL
......@@ -247,8 +235,13 @@ void MedicalImageViewer::updateLayout() {
viewers.value(visibleLayout)->getWidget(frame)->show();
}
if (autoUpdateToolbarVisibility && (visibleLayout == VIEWER_3D || visibleLayout == VIEWER_ALL)) {
getToolBar()->show();
if (autoUpdateToolbarVisibility) {
if (visibleLayout == VIEWER_3D || visibleLayout == VIEWER_ALL) {
setToolBarVisibility(true);
}
else {
setToolBarVisibility(false);
}
}
}
......@@ -268,12 +261,9 @@ void MedicalImageViewer::synchronizeSelection() {
}
// -------------------- setToolbarAutoVisibility --------------------
void MedicalImageViewer::setToolbarAutoVisibility(bool toolbarVisibility) {
autoUpdateToolbarVisibility = toolbarVisibility;
getToolBar()->setVisible(autoUpdateToolbarVisibility);
if (!autoUpdateToolbarVisibility) {
getToolBar()->close();
}
void MedicalImageViewer::setToolbarAutoVisibility(bool toolbarAutoVisibility) {
autoUpdateToolbarVisibility = toolbarAutoVisibility;
setToolBarVisibility(false);
}
}
......
......@@ -1399,16 +1399,16 @@ void RendererWidget::resetCameraSettings() {
switch (cameraOrientation) {
case LEFT_UP:
// default position
cam->SetPosition(0, 0, -1);
cam->SetFocalPoint(0, 0, 0);
cam->SetViewUp(0, 1, 0);
cam->SetPosition(0.0, 0.0, -1.0);
cam->SetFocalPoint(0.0, 0.0, 0.0);
cam->SetViewUp(0.0, 1.0, 0.0);
cam->OrthogonalizeViewUp();
break;
case RIGHT_DOWN:
// default position
cam->SetPosition(0, 0, -1);
cam->SetFocalPoint(0, 0, 0);
cam->SetViewUp(0, -1, 0);
cam->SetPosition(0.0, 0.0, -1.0);
cam->SetFocalPoint(0.0, 0.0, 0.0);
cam->SetViewUp(0.0, -1.0, 0.0);
cam->OrthogonalizeViewUp();
break;
// For Coronal view of Coronal Viewer
......@@ -1427,9 +1427,9 @@ void RendererWidget::resetCameraSettings() {
break;
case RIGHT_UP:
default:
cam->SetPosition(0, 0, 1);
cam->SetFocalPoint(0, 0, 0);
cam->SetViewUp(0, 1, 0);
cam->SetPosition(0.0, 0.0, 1.0);
cam->SetFocalPoint(0.0, 0.0, 0.0);
cam->SetViewUp(0.0, 1.0, 0.0);
cam->OrthogonalizeViewUp();
break;
}
......
......@@ -32,6 +32,7 @@ namespace camitk {
//---------------------- constructor ------------------------
Viewer::Viewer(QString name): QObject() {
setObjectName(name);
toolbarVisibility = true;
}
//---------------------- selectionChanged ------------------------
......@@ -54,5 +55,14 @@ void Viewer::clearSelection() {
emit selectionChanged();
}
//---------------------- setToolBarVisibility ------------------------
void Viewer::setToolBarVisibility(bool toolbarVisibility) {
this->toolbarVisibility = toolbarVisibility;
}
//---------------------- getToolBarVisibility ------------------------
bool Viewer::getToolBarVisibility() {
return toolbarVisibility;
}
}
......@@ -86,6 +86,14 @@ public:
return nullptr;
};
/** set the visibility of the toolbar in the main window (true by default).
* If the visibility is set to false, the next call to setCentralViewer(..) or addDockViwer(...) will remove it
*/
void setToolBarVisibility(bool);
/// get the current value of the toolbar visibility
bool getToolBarVisibility();
/// Update the whole tree of the representation of the Component.
/// Is actually useful (and defined) in Explorer.
virtual void refreshInterfaceNode(Component* comp) {};
......@@ -109,6 +117,9 @@ protected:
/// clear the selection
void clearSelection();
private:
/// the current toolbar visibility
bool toolbarVisibility;
};
}
......
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include "BitmapViewer.h"
#include <Application.h>
#include <MainWindow.h>
#include <MedicalImageViewer.h>
#include <Log.h>
#include <QToolBar>
#include <vtkCamera.h> // to change the camera projection to parallel
using namespace camitk;
// initialize static variables
QString BitmapViewer::BitmapViewerName = "2D Bitmap Viewer"; // required due to QString ref needed by InteractiveViewer cstr
BitmapViewer* BitmapViewer::singleton = nullptr;
BitmapViewer* BitmapViewer::getInstance() {
if