Commit fb182f92 authored by grunau's avatar grunau
Browse files

Add a dock widget displaying log messages

logViewerDock is a new dock in the main window. Its main widget is
a QTextEdit to which log messages are appended by a QTextEditLog
instance.

git-svn-id: https://camplinux.in.tum.de/svn/campvis/branches/gui-redux@503 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 66aa4a4b
......@@ -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->setCentralWidget(canvas);
canvas->init();
TumVisPainter* painter = new TumVisPainter(canvas, vp);
......@@ -251,4 +251,4 @@ namespace campvis {
CtxtMgr.releaseCurrentContext();
}
}
\ No newline at end of file
}
......@@ -50,9 +50,11 @@ namespace campvis {
, _btnShowDataContainerInspector(0)
, _selectedPipeline(0)
, _selectedProcessor(0)
, _logViewer(0)
, _log(0)
{
tgtAssert(_application != 0, "Application must not be 0.");
ui.setupUi(this);
ui.setupUi(this);
setup();
}
......@@ -64,17 +66,17 @@ namespace campvis {
void MainWindow::setup() {
qRegisterMetaType<QtDataHandle>("QtDataHandle");
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
_dcInspectorWidget = new DataContainerInspectorWidget();
ui.dataContainerInspectorDock->setWidget(_dcInspectorWidget);
_dcInspectorWidget = new DataContainerInspectorWidget();
ui.dataContainerInspectorDock->setWidget(_dcInspectorWidget);
_pipelineWidget = new PipelineTreeWidget();
ui.pipelineTreeDock->setWidget(_pipelineWidget);
_pipelineWidget = new PipelineTreeWidget();
ui.pipelineTreeDock->setWidget(_pipelineWidget);
QWidget* rightWidget = new QWidget();
ui.pipelinePropertiesDock->setWidget(rightWidget);
QWidget* rightWidget = new QWidget();
ui.pipelinePropertiesDock->setWidget(rightWidget);
QVBoxLayout* rightLayout = new QVBoxLayout();
rightLayout->setSpacing(4);
......@@ -89,6 +91,9 @@ namespace campvis {
_propCollectionWidget = new PropertyCollectionWidget(_centralWidget);
rightLayout->addWidget(_propCollectionWidget);
_logViewer = new QTextEdit();
_logViewer->setReadOnly(true);
ui.logViewerDock->setWidget(_logViewer);
connect(
this, SIGNAL(updatePipelineWidget(const std::vector<AbstractPipeline*>&)),
......@@ -161,11 +166,17 @@ namespace campvis {
void MainWindow::init() {
if (_dcInspectorWidget != 0)
_dcInspectorWidget->init();
_log = new QTextEditLog(_logViewer);
_log->addCat("", true);
LogMgr.addLog(_log);
}
void MainWindow::deinit() {
if (_dcInspectorWidget != 0)
_dcInspectorWidget->deinit();
LogMgr.removeLog(_log);
}
}
\ No newline at end of file
}
......@@ -34,12 +34,14 @@
#include "application/campvisapplication.h"
#include "application/gui/pipelinetreewidget.h"
#include "application/gui/properties/propertycollectionwidget.h"
#include "application/ui_mainwindow.h"
#include "application/tools/qtexteditlog.h"
#include "application/ui_mainwindow.h"
#include <QMainWindow>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QTextEdit>
#include <vector>
namespace campvis {
......@@ -116,8 +118,8 @@ namespace campvis {
*/
void setup();
Ui::MainWindow ui; ///< Interface definition of the MainWindow
Ui::MainWindow ui; ///< Interface definition of the MainWindow
CampVisApplication* _application; ///< Pointer to the application hosting the whole stuff
QWidget* _centralWidget; ///< Central widget of the MainWindow
......@@ -130,6 +132,8 @@ namespace campvis {
AbstractPipeline* _selectedPipeline; ///< currently selected pipeline
AbstractProcessor* _selectedProcessor; ///< currently selected processor
QTextEditLog* _log; ///< Log appending messages to a QTextEdit
QTextEdit* _logViewer; ///< Widget displaying log messages
};
}
......
......@@ -52,6 +52,12 @@
</attribute>
<widget class="QWidget" name="pipelinePropertiesDockContents"/>
</widget>
<widget class="QDockWidget" name="logViewerDock">
<attribute name="dockWidgetArea">
<number>8</number>
</attribute>
<widget class="QWidget" name="logViewerDockContents"/>
</widget>
</widget>
<resources/>
<connections/>
......
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