Commit e268c029 authored by grunau's avatar grunau
Browse files

Show rendering canvases in the top docking area

Rendering canvases, as well as the data container inspector, are now
displayed as tabbed docks in the top docking area. The two docks that
were previously located in the right docking area have been moved to the
left to make the layout more intuitive.

We don't use the main window's central widget, but Qt requires it to
exist. This causes certain sizing problems, e.g. docks located in the
top and bottom docking areas don't expand to take up all the vertical
space, which results in some empty space in the centre of the window.
This will hopefully be fixed soon.

git-svn-id: https://camplinux.in.tum.de/svn/campvis/branches/gui-redux@506 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 3c9d830c
......@@ -237,7 +237,7 @@ namespace campvis {
// create canvas and painter for the VisPipeline and connect all together
tgt::QtThreadedCanvas* canvas = CtxtMgr.createContext(name, "CAMPVis", tgt::ivec2(512, 512));
GLJobProc.registerContext(canvas);
_mainWindow->setCentralWidget(canvas);
_mainWindow->addVisualizationPipelineWidget(name, canvas);
canvas->init();
TumVisPainter* painter = new TumVisPainter(canvas, vp);
......
......@@ -46,6 +46,7 @@ namespace campvis {
, _pipelineWidget(0)
, _propCollectionWidget(0)
, _dcInspectorWidget(0)
, _dcInspectorDock(0)
, _btnExecute(0)
, _btnShowDataContainerInspector(0)
, _selectedPipeline(0)
......@@ -67,10 +68,11 @@ namespace campvis {
qRegisterMetaType<QtDataHandle>("QtDataHandle");
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
_dcInspectorWidget = new DataContainerInspectorWidget();
ui.dataContainerInspectorDock->setWidget(_dcInspectorWidget);
setTabPosition(Qt::TopDockWidgetArea, QTabWidget::North);
_pipelineWidget = new PipelineTreeWidget();
ui.pipelineTreeDock->setWidget(_pipelineWidget);
......@@ -93,8 +95,11 @@ namespace campvis {
_logViewer = new QTextEdit();
_logViewer->setReadOnly(true);
ui.logViewerDock->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
ui.logViewerDock->setWidget(_logViewer);
_dcInspectorWidget = new DataContainerInspectorWidget();
connect(
this, SIGNAL(updatePipelineWidget(const std::vector<AbstractPipeline*>&)),
_pipelineWidget, SLOT(update(const std::vector<AbstractPipeline*>&)));
......@@ -127,8 +132,6 @@ namespace campvis {
if (AbstractPipeline* pipeline = dynamic_cast<AbstractPipeline*>(ptr)) {
_selectedPipeline = pipeline;
_selectedProcessor = 0;
if (_dcInspectorWidget != 0)
onBtnShowDataContainerInspectorClicked();
}
else if (AbstractProcessor* processor = dynamic_cast<AbstractProcessor*>(ptr)) {
_selectedProcessor = processor;
......@@ -158,8 +161,15 @@ namespace campvis {
void MainWindow::onBtnShowDataContainerInspectorClicked() {
if (_selectedPipeline != 0) {
if (_dcInspectorDock == 0) {
_dcInspectorDock = dockPrimaryWidget("Data Container inspector", _dcInspectorWidget);
} else {
// Activate the dock's tab
_dcInspectorDock->setVisible(true);
_dcInspectorDock->raise();
}
_dcInspectorWidget->setDataContainer(&(_selectedPipeline->getDataContainer()));
_dcInspectorWidget->show();
}
}
......@@ -179,4 +189,26 @@ namespace campvis {
LogMgr.removeLog(_log);
}
void MainWindow::addVisualizationPipelineWidget(const std::string& name, QWidget* widget) {
dockPrimaryWidget(name, widget);
}
QDockWidget* MainWindow::dockPrimaryWidget(const std::string& name, QWidget* widget) {
QDockWidget* dockWidget = new QDockWidget(QString::fromStdString(name));
dockWidget->setWidget(widget);
dockWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
if (_primaryDocks.empty()) {
addDockWidget(Qt::TopDockWidgetArea, dockWidget);
} else {
tabifyDockWidget(_primaryDocks.back(), dockWidget);
// Activate the dock's tab
dockWidget->setVisible(true);
dockWidget->raise();
}
_primaryDocks.push_back(dockWidget);
return dockWidget;
}
}
......@@ -89,6 +89,13 @@ namespace campvis {
*/
QSize sizeHint() const;
/**
* Adds a widget of a visualization pipeline to the main window.
* \param name the name of the visualization pipeline.
* \param widget the pipeline's widget to add to the main window.
*/
void addVisualizationPipelineWidget(const std::string& name, QWidget* widget);
signals:
/// Qt signal for updating the PipelineWidget.
void updatePipelineWidget(const std::vector<AbstractPipeline*>&);
......@@ -118,6 +125,18 @@ namespace campvis {
*/
void setup();
/**
* Adds a widget to the top docking area of the main window.
* This method creates a new dock with the specified name,
* sets its widget to the given widget, and docks it in top
* docking area of the main window. If there are already
* other docks there, they're tabified with the new dock.
* \param name the name that will be given to the created dock
* \param widget the widget to add to the top docking area of the main window
* \return the dock created to store the provided widget
*/
QDockWidget* dockPrimaryWidget(const std::string& name, QWidget* widget);
Ui::MainWindow ui; ///< Interface definition of the MainWindow
CampVisApplication* _application; ///< Pointer to the application hosting the whole stuff
......@@ -126,6 +145,7 @@ namespace campvis {
PipelineTreeWidget* _pipelineWidget; ///< Widget for browsing the active pipelines
PropertyCollectionWidget* _propCollectionWidget; ///< Widget for brosing the PropertyCollection of the selected pipeline/processor
DataContainerInspectorWidget* _dcInspectorWidget; ///< Widget for inspecting the DataContainer of the selected pipeline.
QDockWidget* _dcInspectorDock; ///< Dock storing the above DataContainerInspectorWidget instance.
QPushButton* _btnExecute; ///< Button to execute the selected pipeline/processor
QPushButton* _btnShowDataContainerInspector; ///< Button to show the DataContainerInspector for the selected pipeline
......@@ -134,6 +154,7 @@ namespace campvis {
AbstractProcessor* _selectedProcessor; ///< currently selected processor
QTextEditLog* _log; ///< Log appending messages to a QTextEdit
QTextEdit* _logViewer; ///< Widget displaying log messages
std::vector<QDockWidget*> _primaryDocks; ///< Docks located in top docking area of the main window
};
}
......
......@@ -6,40 +6,32 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<width>903</width>
<height>435</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget"/>
<widget class="QWidget" name="centralwidget">
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<width>903</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QDockWidget" name="dataContainerInspectorDock">
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<attribute name="dockWidgetArea">
<number>1</number>
</attribute>
<widget class="QWidget" name="dataContainerInspectorDockContents"/>
</widget>
<widget class="QDockWidget" name="pipelineTreeDock">
<property name="allowedAreas">
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
<number>1</number>
</attribute>
<widget class="QWidget" name="pipelineTreeDockContents"/>
</widget>
......@@ -48,7 +40,7 @@
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property>
<attribute name="dockWidgetArea">
<number>2</number>
<number>1</number>
</attribute>
<widget class="QWidget" name="pipelinePropertiesDockContents"/>
</widget>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment