Esempio n. 1
0
void MainWindow::onWorkflowStateChangedSlot()
{
	Desktop desktop = stateService()->getActiveDesktop();

	mDockWidgets->restoreFrom(desktop);
	viewService()->setActiveLayout(desktop.mLayoutUid, 0);
	viewService()->setActiveLayout(desktop.mSecondaryLayoutUid, 1);
	patientService()->autoSave();

	// moved to help plugin:
//	// set initial focus to mainwindow in order to view it in the documentation
//	// this is most important when starting up.
//	QTimer::singleShot(0, this, SLOT(setFocus())); // avoid loops etc by send async event.

//#ifdef CX_APPLE
//	// HACK
//	// Toolbars are not correctly refreshed on mac 10.8,
//	// Cause is related to QVTKWidget (removing it removes the problem)
//	// The following "force refresh by resize" solves repaint, but
//	// inactive toolbars are still partly clickable.
//	QSize size = this->size();
//	this->resize(size.width()-1, size.height());
//	this->resize(size);
//#endif
}
Esempio n. 2
0
void MainWindow::saveDesktopSlot()
{
	Desktop desktop;
	desktop.mMainWindowState = this->saveState();
	desktop.mLayoutUid = viewService()->getActiveLayout(0);
	desktop.mSecondaryLayoutUid = viewService()->getActiveLayout(1);
	stateService()->saveDesktop(desktop);

	// save to settings file in addition
	settings()->setValue("mainWindow/geometry", saveGeometry());
	settings()->setValue("mainWindow/windowState", saveState());
	settings()->sync();
}
Esempio n. 3
0
void MainWindow::updateWindowTitle()
{
	QString profileName = stateService()->getApplicationStateName();
	QString versionName = stateService()->getVersionName();

	QString activePatientFolder = patientService()->getActivePatientFolder();
	if (activePatientFolder.endsWith('/'))
		activePatientFolder.chop(1);
	QString patientName;

	if (!activePatientFolder.isEmpty())
	{
		QFileInfo info(activePatientFolder);
		patientName = info.completeBaseName();
	}

	QString format("%1 %2 - %3 - %4  (not approved for medical use)");
	QString title = format
			.arg(qApp->applicationDisplayName())
			.arg(versionName)
			.arg(profileName)
			.arg(patientName);
	this->setWindowTitle(title);
}
Esempio n. 4
0
void MainWindow::createToolBars()
{
	mWorkflowToolBar = this->registerToolBar("Workflow");
	QList<QAction*> actions = stateService()->getWorkflowActions()->actions();
	for (int i=0; i<actions.size(); ++i)
		mWorkflowToolBar->addAction(actions[i]);

	mDataToolBar = this->registerToolBar("Data");
	mDataToolBar->addAction(mActions->getAction("NewPatient"));
	mDataToolBar->addAction(mActions->getAction("LoadFile"));
	mDataToolBar->addAction(mActions->getAction("SaveFile"));
	mDataToolBar->addAction(mActions->getAction("ImportData"));

	mToolToolBar = this->registerToolBar("Tools");
	mToolToolBar->addAction(mActions->getAction("TrackingTools"));
	mToolToolBar->addAction(mActions->getAction("StartStreaming"));

	mNavigationToolBar = this->registerToolBar("Navigation");
	mNavigationToolBar->addAction(mActions->getAction("CenterToImageCenter"));
	mNavigationToolBar->addAction(mActions->getAction("CenterToTooltip"));
	mNavigationToolBar->addAction(mActions->getAction("ShowPointPicker"));

	mInteractorStyleToolBar = this->registerToolBar("InteractorStyle");
	mInteractorStyleToolBar->addActions(mInteractorStyleActionGroup->actions());

	mDesktopToolBar = this->registerToolBar("Desktop");
	mDesktopToolBar->addAction(mSaveDesktopAction);
	mDesktopToolBar->addAction(mResetDesktopAction);

	mScreenshotToolBar = this->registerToolBar("Screenshot");
	mScreenshotToolBar->addAction(mActions->getAction("ShootScreen"));
	mScreenshotToolBar->addAction(mActions->getAction("RecordFullscreen"));

	QToolBar* camera3DViewToolBar = this->registerToolBar("Camera 3D Views");
	camera3DViewToolBar->addActions(mStandard3DViewActions->actions());

	QToolBar* samplerWidgetToolBar = this->registerToolBar("Sampler");
	samplerWidgetToolBar->addWidget(new SamplerWidget(this));

	QToolBar* toolOffsetToolBar = this->registerToolBar("Tool Offset");
	DoublePropertyBasePtr offset = DoublePropertyActiveToolOffset::create(ActiveToolProxy::New(mServices->tracking()));
	SpinBoxAndSliderGroupWidget* offsetWidget = new SpinBoxAndSliderGroupWidget(this, offset);
	offsetWidget->showLabel(false);
	toolOffsetToolBar->addWidget(offsetWidget);

	QToolBar* helpToolBar = this->registerToolBar("Help");
	helpToolBar->addAction(mShowContextSensitiveHelpAction);
}
Esempio n. 5
0
MainWindow::MainWindow() :
	mFullScreenAction(NULL),
	mStandard3DViewActions(new QActionGroup(this)),
	mControlPanel(NULL),
	mDockWidgets(new DynamicMainWindowWidgets(this)),
	mActions(NULL)
{
	this->setObjectName("MainWindow");

	mServices = VisServices::create(logicManager()->getPluginContext());
	mLayoutInteractor.reset(new LayoutInteractor());

    this->setCentralWidget(viewService()->createLayoutWidget(this, 0));

	mActions = new MainWindowActions(mServices, this);

	this->createActions();
	this->createMenus();
	this->createToolBars();
	this->setStatusBar(new StatusBar());

	reporter()->setAudioSource(AudioPtr(new AudioImpl()));

	connect(stateService().get(), &StateService::applicationStateChanged, this, &MainWindow::onApplicationStateChangedSlot);
	connect(stateService().get(), &StateService::workflowStateChanged, this, &MainWindow::onWorkflowStateChangedSlot);
	connect(stateService().get(), &StateService::workflowStateAboutToChange, this, &MainWindow::saveDesktopSlot);

	this->updateWindowTitle();

	this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);

	this->addAsDockWidget(new PlaybackWidget(this), "Browsing");
	this->addAsDockWidget(new VideoConnectionWidget(mServices, this), "Utility");
	this->addAsDockWidget(new EraserWidget(mServices->patient(), mServices->view(), this), "Properties");
	this->addAsDockWidget(new MetricWidget(mServices->view(), mServices->patient(), this), "Utility");
	this->addAsDockWidget(new SlicePropertiesWidget(mServices->patient(), mServices->view(), this), "Properties");
	this->addAsDockWidget(new VolumePropertiesWidget(mServices, this), "Properties");
	this->addAsDockWidget(new ActiveMeshPropertiesWidget(mServices, this), "Properties");
	this->addAsDockWidget(new StreamPropertiesWidget(mServices->patient(), mServices->view(), this), "Properties");
	this->addAsDockWidget(new TrackPadWidget(this), "Utility");
	this->addAsDockWidget(new ActiveToolPropertiesWidget(mServices->tracking(), mServices->spaceProvider(), this), "Properties");
	this->addAsDockWidget(new NavigationWidget(this), "Properties");
	this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget", "Console"), "Utility");
	this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget2", "Extra Console"), "Utility");
//	this->addAsDockWidget(new ConsoleWidgetCollection(this, "ConsoleWidgets", "Consoles"), "Utility");
	this->addAsDockWidget(new FrameTreeWidget(mServices->patient(), this), "Browsing");
	this->addAsDockWidget(new ToolManagerWidget(this), "Debugging");
	this->addAsDockWidget(new PluginFrameworkWidget(this), "Browsing");
    this->addAsDockWidget(new FiltersWidget(VisServices::create(logicManager()->getPluginContext()), this), "Algorithms");
	this->addAsDockWidget(new ClippingPropertiesWidget(mServices, this), "Properties");

	this->addAsDockWidget(new BrowserWidget(this, mServices), "Browsing");

	connect(patientService().get(), &PatientModelService::patientChanged, this, &MainWindow::patientChangedSlot);
	connect(qApp, &QApplication::focusChanged, this, &MainWindow::focusChanged);

	this->setupGUIExtenders();

	// window menu must be created after all dock widgets are created
	QMenu* popupMenu = this->createPopupMenu();
	popupMenu->setTitle("Window");
	this->menuBar()->insertMenu(mHelpMenuAction, popupMenu);

	// show after window has been initialized
	QTimer::singleShot(0, this, SLOT(delayedShow()));
}
Esempio n. 6
0
void MainWindow::createMenus()
{
#ifdef CX_LINUX
    // shortcuts defined on actions in the global menubar is not reachable on Qt5+Ubuntu14.04,
    // solve by reverting to old style.
    // This will create a double menubar: remove by autohiding menubar or using
    //   sudo apt-get autoremove appmenu-gtk appmenu-gtk3 appmenu-qt
    // and reboot
    this->menuBar()->setNativeMenuBar(false);
#endif
	mFileMenu = new QMenu(tr("File"), this);
	mWorkflowMenu = new QMenu(tr("Workflow"), this);
	mToolMenu = new QMenu(tr("Tracking"), this);
	mLayoutMenu = new QMenu(tr("Layouts"), this);
	mNavigationMenu = new QMenu(tr("Navigation"), this);
	mHelpMenu = new QMenu(tr("Help"), this);

	// File
	mFileMenu->addAction(mPreferencesAction);
	this->menuBar()->addMenu(mFileMenu);
	mFileMenu->addAction(mActions->getAction("NewPatient"));
	mFileMenu->addAction(mActions->getAction("SaveFile"));
	mFileMenu->addAction(mActions->getAction("LoadFile"));
	mFileMenu->addAction(mActions->getAction("ClearPatient"));
	mFileMenu->addSeparator();
	mFileMenu->addAction(mActions->getAction("ExportPatient"));
	mFileMenu->addAction(mActions->getAction("ImportData"));
	mFileMenu->addSeparator();
	mFileMenu->addAction(mFullScreenAction);
	mFileMenu->addAction(mActions->getAction("StartLogConsole"));
	mFileMenu->addAction(mActions->getAction("ShootScreen"));
	mFileMenu->addAction(mActions->getAction("ShootWindow"));
	mFileMenu->addAction(mActions->getAction("RecordFullscreen"));
	mFileMenu->addSeparator();
	mFileMenu->addAction(mShowControlPanelAction);
	mFileMenu->addAction(mSecondaryViewLayoutWindowAction);

	mFileMenu->addAction(mQuitAction);

	//workflow
	this->menuBar()->addMenu(mWorkflowMenu);
	QList<QAction*> actions = stateService()->getWorkflowActions()->actions();
	for (int i=0; i<actions.size(); ++i)
	{
		mWorkflowMenu->addAction(actions[i]);
	}

	mWorkflowMenu->addSeparator();
	mWorkflowMenu->addAction(mSaveDesktopAction);
	mWorkflowMenu->addAction(mResetDesktopAction);

	//tool
	this->menuBar()->addMenu(mToolMenu);
	mToolMenu->addAction(mActions->getAction("ConfigureTools"));
	mToolMenu->addAction(mActions->getAction("InitializeTools"));
	mToolMenu->addAction(mActions->getAction("TrackingTools"));
	mToolMenu->addSeparator();
	mToolMenu->addAction(mActions->getAction("StartStreaming"));
	mToolMenu->addSeparator();

	//layout
	this->menuBar()->addMenu(mLayoutMenu);
	mLayoutInteractor->connectToMenu(mLayoutMenu);

	this->menuBar()->addMenu(mNavigationMenu);
	mNavigationMenu->addAction(mActions->getAction("CenterToImageCenter"));
	mNavigationMenu->addAction(mActions->getAction("CenterToTooltip"));
	mNavigationMenu->addAction(mActions->getAction("ShowPointPicker"));
	mNavigationMenu->addSeparator();
	mNavigationMenu->addActions(mInteractorStyleActionGroup->actions());

	mHelpMenuAction = this->menuBar()->addMenu(mHelpMenu);
	mHelpMenu->addAction(mAboutAction);
	mHelpMenu->addAction(mActions->getAction("GotoDocumentation"));
	mHelpMenu->addAction(mShowContextSensitiveHelpAction);
}
Esempio n. 7
0
void MainWindow::resetDesktopSlot()
{
	stateService()->resetDesktop();
	this->onWorkflowStateChangedSlot();
}
Esempio n. 8
0
MainWindow::MainWindow() :
	mFullScreenAction(NULL),
	mStandard3DViewActions(new QActionGroup(this)),
	mControlPanel(NULL),
	mDockWidgets(new DynamicMainWindowWidgets(this)),
	mActions(NULL)
{
	this->setObjectName("MainWindow");

	mServices = VisServices::create(logicManager()->getPluginContext());
	mLayoutInteractor.reset(new LayoutInteractor());

	this->setCentralWidget(viewService()->getLayoutWidget(this, 0));

	mActions = new MainWindowActions(mServices, this);

	this->createActions();
	this->createMenus();
	this->createToolBars();
	this->setStatusBar(new StatusBar());

	reporter()->setAudioSource(AudioPtr(new AudioImpl()));

	connect(stateService().get(), &StateService::applicationStateChanged, this, &MainWindow::onApplicationStateChangedSlot);
	connect(stateService().get(), &StateService::workflowStateChanged, this, &MainWindow::onWorkflowStateChangedSlot);
	connect(stateService().get(), &StateService::workflowStateAboutToChange, this, &MainWindow::saveDesktopSlot);

	this->updateWindowTitle();

	this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);

	this->addAsDockWidget(new PlaybackWidget(this), "Browsing");
	this->addAsDockWidget(new VideoConnectionWidget(mServices, this), "Utility");
	this->addAsDockWidget(new EraserWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties");
	this->addAsDockWidget(new MetricWidget(mServices->visualizationService, mServices->patientModelService, this), "Utility");
	this->addAsDockWidget(new SlicePropertiesWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties");
	this->addAsDockWidget(new VolumePropertiesWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties");
	this->addAsDockWidget(new MeshInfoWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties");
	this->addAsDockWidget(new StreamPropertiesWidget(mServices->patientModelService, mServices->visualizationService, this), "Properties");
	this->addAsDockWidget(new TrackPadWidget(this), "Utility");
	this->addAsDockWidget(new ToolPropertiesWidget(this), "Properties");
	this->addAsDockWidget(new NavigationWidget(this), "Properties");
	this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget", "Console"), "Utility");
	this->addAsDockWidget(new ConsoleWidget(this, "ConsoleWidget2", "Extra Console"), "Utility");
//	this->addAsDockWidget(new ConsoleWidgetCollection(this, "ConsoleWidgets", "Consoles"), "Utility");
	this->addAsDockWidget(new FrameTreeWidget(mServices->patientModelService, this), "Browsing");
	this->addAsDockWidget(new ToolManagerWidget(this), "Debugging");
	this->addAsDockWidget(new PluginFrameworkWidget(this), "Browsing");
	this->addAsDockWidget(new AllFiltersWidget(VisServices::create(logicManager()->getPluginContext()), this), "Algorithms");

	connect(patientService().get(), &PatientModelService::patientChanged, this, &MainWindow::patientChangedSlot);
	connect(qApp, &QApplication::focusChanged, this, &MainWindow::focusChanged);

	this->setupGUIExtenders();

	// window menu must be created after all dock widgets are created
	QMenu* popupMenu = this->createPopupMenu();
	popupMenu->setTitle("Window");
	this->menuBar()->insertMenu(mHelpMenuAction, popupMenu);

	// Restore saved window states
	// Must be done after all DockWidgets are created
	if (restoreGeometry(settings()->value("mainWindow/geometry").toByteArray()))
	{
		this->show();
	}
	else
	{
		this->showMaximized();
	}

	if (settings()->value("gui/fullscreen").toBool())
		this->setWindowState(this->windowState() | Qt::WindowFullScreen);
}