Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
c8b6747a
Commit
c8b6747a
authored
Nov 17, 2009
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] - completely restructured initialization and shutdown order
parent
3e4f8887
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
382 additions
and
276 deletions
+382
-276
src/OpenWalnut.cpp
src/OpenWalnut.cpp
+10
-18
src/graphicsEngine/WGraphicsEngine.cpp
src/graphicsEngine/WGraphicsEngine.cpp
+12
-4
src/graphicsEngine/WGraphicsEngine.h
src/graphicsEngine/WGraphicsEngine.h
+14
-3
src/gui/WGUI.cpp
src/gui/WGUI.cpp
+13
-0
src/gui/WGUI.h
src/gui/WGUI.h
+48
-14
src/gui/qt4/WMainWindow.cpp
src/gui/qt4/WMainWindow.cpp
+69
-35
src/gui/qt4/WMainWindow.h
src/gui/qt4/WMainWindow.h
+17
-8
src/gui/qt4/WQt4Gui.cpp
src/gui/qt4/WQt4Gui.cpp
+30
-26
src/gui/qt4/WQt4Gui.h
src/gui/qt4/WQt4Gui.h
+29
-13
src/gui/qt4/WQtGLWidget.cpp
src/gui/qt4/WQtGLWidget.cpp
+27
-7
src/gui/qt4/WQtGLWidget.h
src/gui/qt4/WQtGLWidget.h
+24
-1
src/gui/qt4/WQtNavGLWidget.cpp
src/gui/qt4/WQtNavGLWidget.cpp
+1
-0
src/gui/qt4/WQtNavGLWidget.h
src/gui/qt4/WQtNavGLWidget.h
+3
-0
src/kernel/WKernel.cpp
src/kernel/WKernel.cpp
+37
-72
src/kernel/WKernel.h
src/kernel/WKernel.h
+26
-60
src/kernel/WModuleContainer.cpp
src/kernel/WModuleContainer.cpp
+12
-2
src/kernel/WModuleContainer.h
src/kernel/WModuleContainer.h
+2
-1
src/modules/coordinateSystem/WMCoordinateSystem.cpp
src/modules/coordinateSystem/WMCoordinateSystem.cpp
+4
-6
src/modules/navSlices/WMNavSlices.cpp
src/modules/navSlices/WMNavSlices.cpp
+4
-6
No files found.
src/OpenWalnut.cpp
View file @
c8b6747a
...
...
@@ -24,19 +24,11 @@
#include <iostream>
#include <boost/signals2/signal.hpp>
#include <boost/function.hpp>
#include "common/WException.h"
#include "common/WSegmentationFault.h"
#include "common/WLogger.h"
#include "gui/WGUI.h"
#include "gui/qt4/WQt4Gui.h"
#include "kernel/WKernel.h"
#include "kernel/WModuleSignals.h"
/**
* The main routine starting up the whole application.
*
...
...
@@ -44,7 +36,7 @@
*
* For a list of the current modules see the "Modules" tab in the navigation bar above.
*/
int
main
(
int
argc
,
char
*
argv
[]
)
int
main
(
int
argc
,
char
*
*
argv
)
{
std
::
cout
<<
"OpenWalnut ( http://www.openwalnut.org )
\n
"
"Copyright (C) 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
\n
"
...
...
@@ -59,20 +51,20 @@ int main( int argc, char* argv[] )
// install signal handler as early as possible
WSegmentationFault
::
installSignalHandler
();
// initialize GUI
boost
::
shared_ptr
<
WGUI
>
gui
=
boost
::
shared_ptr
<
WGUI
>
(
new
WQt4Gui
()
);
// init logger
WLogger
logger
;
logger
.
run
();
// init the kernel
WKernel
kernel
=
WKernel
(
argc
,
argv
,
gui
);
// initialize GUI
// NOTE: we need a shared ptr here since WGUI uses enable_shared_from_this.
boost
::
shared_ptr
<
WQt4Gui
>
gui
=
boost
::
shared_ptr
<
WQt4Gui
>
(
new
WQt4Gui
(
argc
,
argv
)
);
int
result
=
gui
->
run
();
// bind the GUI's slot with the ready signal
t_ModuleGenericSignalHandlerType
f
=
boost
::
bind
(
&
WGUI
::
slotAddDatasetToBrowser
,
gui
,
_1
);
kernel
.
getRootContainer
()
->
addDefaultNotifier
(
READY
,
f
);
// finish running thread
WLogger
::
getLogger
()
->
wait
(
true
);
// write remaining log messages
WLogger
::
getLogger
()
->
processQueue
();
return
kernel
.
run
()
;
return
result
;
}
src/graphicsEngine/WGraphicsEngine.cpp
View file @
c8b6747a
...
...
@@ -35,13 +35,15 @@
#include "WGraphicsEngine.h"
#include "WGEViewer.h"
WGraphicsEngine
::
WGraphicsEngine
(
std
::
string
shaderPath
)
:
m_shaderPath
(
shaderPath
)
WGraphicsEngine
::
WGraphicsEngine
(
)
{
WLogger
::
getLogger
()
->
addLogMessage
(
"Initializing Graphics Engine"
,
"GE"
,
LL_DEBUG
);
// initialize members
m_rootNode
=
new
WGEScene
();
m_shaderPath
=
""
;
}
WGraphicsEngine
::~
WGraphicsEngine
()
...
...
@@ -55,16 +57,21 @@ osg::ref_ptr<WGEScene> WGraphicsEngine::getScene()
return
m_rootNode
;
}
std
::
string
WGraphicsEngine
::
getShaderPath
()
std
::
string
WGraphicsEngine
::
getShaderPath
()
const
{
return
m_shaderPath
;
}
void
WGraphicsEngine
::
setShaderPath
(
std
::
string
path
)
{
m_shaderPath
=
path
;
}
boost
::
shared_ptr
<
WGEViewer
>
WGraphicsEngine
::
createViewer
(
osg
::
ref_ptr
<
WindowData
>
wdata
,
int
x
,
int
y
,
int
width
,
int
height
,
WGECamera
::
ProjectionMode
projectionMode
)
{
boost
::
shared_ptr
<
WGEViewer
>
viewer
=
boost
::
shared_ptr
<
WGEViewer
>
(
new
WGEViewer
(
wdata
,
x
,
y
,
width
,
height
,
projectionMode
)
);
viewer
->
setScene
(
this
->
getScene
()
);
viewer
->
setScene
(
getScene
()
);
// start rendering
viewer
->
run
();
...
...
@@ -77,3 +84,4 @@ boost::shared_ptr<WGEViewer> WGraphicsEngine::createViewer(
return
viewer
;
}
src/graphicsEngine/WGraphicsEngine.h
View file @
c8b6747a
...
...
@@ -55,7 +55,7 @@ public:
/**
* Default constructor.
*/
explicit
WGraphicsEngine
(
std
::
string
shaderPath
);
explicit
WGraphicsEngine
();
/**
* Destructor.
...
...
@@ -74,7 +74,14 @@ public:
*
* \return shader path
*/
std
::
string
getShaderPath
();
std
::
string
getShaderPath
()
const
;
/**
* Sets the shader path.
*
* \param path path to shaders.
*/
void
setShaderPath
(
std
::
string
path
);
/**
* Creates a new viewer. Does basic initialization and sets the default scene.
...
...
@@ -108,8 +115,12 @@ protected:
*/
boost
::
mutex
m_ViewerLock
;
private:
/**
* Path to the shaders.
*/
std
::
string
m_shaderPath
;
private:
};
/**
...
...
src/gui/WGUI.cpp
View file @
c8b6747a
...
...
@@ -24,10 +24,23 @@
#include "WGUI.h"
WGUI
::
WGUI
(
int
argc
,
char
**
argv
)
:
boost
::
enable_shared_from_this
<
WGUI
>
()
{
m_isInitialized
=
false
;
this
->
argc
=
argc
;
this
->
argv
=
argv
;
}
WGUI
::~
WGUI
()
{
}
bool
WGUI
::
isInitalized
()
{
return
m_isInitialized
;
}
void
WGUI
::
slotAddDatasetToBrowser
(
boost
::
shared_ptr
<
WModule
>
module
)
{
addDatasetToBrowser
(
module
,
0
);
...
...
src/gui/WGUI.h
View file @
c8b6747a
...
...
@@ -28,29 +28,57 @@
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include "../common/WThreadedRunner.h"
#include "../kernel/WModule.h"
#include "qt4/signalslib.hpp"
/**
* This class prescribes the interface to the GUI.
* \defgroup gui GUI
*
* \brief
* This module implements the graphical user interface for OpenWalnut.
*
*/
/**
* This class prescribes the interface to the GUI. It basically is an abstract class defining the interface common to all possible
* GUI implementations.
*
* \ingroup gui
*/
class
WGUI
:
public
WThreadedRunner
class
WGUI
:
public
boost
::
enable_shared_from_this
<
WGUI
>
{
public:
/**
* Default destructor.
* Constructor.
*
* \param argc number of arguments given on command line.
* \param argv arguments given on command line.
*/
WGUI
(
int
argc
,
char
**
argv
);
/**
* Destructor.
*/
virtual
~
WGUI
();
virtual
bool
isInitalized
()
=
0
;
/**
* Determines whether the GUI is properly initialized.
*
* \return true if initialized.
*/
virtual
bool
isInitalized
();
/**
* function to create a main window on demand, so it doesn't happen in the constructor
* Runs the GUI. All initialization should be done here.
*
* \return the return code.
*/
virtual
void
createMainWindow
()
=
0
;
virtual
int
run
()
=
0
;
/**
* Slot gets called whenever a new module is added.
...
...
@@ -80,16 +108,22 @@ public:
virtual
void
connectProperties
(
boost
::
shared_ptr
<
WProperties
>
properties
)
=
0
;
protected:
/**
* Flag determining whether the GUI is properly initialized.
*/
bool
m_isInitialized
;
};
/**
* Number of command line arguments given.
*/
int
argc
;
/**
* \defgroup gui GUI
*
* \brief
* This module implements the graphical user interface for OpenWalnut.
*
*/
/**
* Command line arguments given.
*/
char
**
argv
;
};
#endif // WGUI_H
src/gui/qt4/WMainWindow.cpp
View file @
c8b6747a
...
...
@@ -27,6 +27,7 @@
#include <vector>
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QDockWidget>
#include <QtGui/QFileDialog>
#include <QtGui/QSlider>
...
...
@@ -34,77 +35,74 @@
#include "WMainWindow.h"
#include "WQtGLWidget.h"
#include "../../kernel/WKernel.h"
#include "WQtNavGLWidget.h"
#include "../icons/WIcons.h"
WMainWindow
::
WMainWindow
()
:
QMainWindow
(),
m_iconManager
(),
m_propertyManager
()
{
setupGUI
();
}
WMainWindow
::~
WMainWindow
()
{
// clean up list with views
m_glWidgets
.
clear
();
}
void
WMainWindow
::
setupGUI
(
QMainWindow
*
mainWindow
)
void
WMainWindow
::
setupGUI
()
{
m_iconManager
.
addIcon
(
std
::
string
(
"logo"
),
logoIcon_xpm
);
if
(
mainWindow
->
objectName
().
isEmpty
()
)
if
(
objectName
().
isEmpty
()
)
{
mainWindow
->
setObjectName
(
QString
::
fromUtf8
(
"MainWindow"
)
);
setObjectName
(
QString
::
fromUtf8
(
"MainWindow"
)
);
}
mainWindow
->
resize
(
946
,
632
);
mainWindow
->
setWindowIcon
(
m_iconManager
.
getIcon
(
"logo"
)
);
mainWindow
->
setWindowTitle
(
QApplication
::
translate
(
"MainWindow"
,
"OpenWalnut"
,
0
,
QApplication
::
UnicodeUTF8
)
);
resize
(
946
,
632
);
setWindowIcon
(
m_iconManager
.
getIcon
(
"logo"
)
);
setWindowTitle
(
QApplication
::
translate
(
"MainWindow"
,
"OpenWalnut"
,
0
,
QApplication
::
UnicodeUTF8
)
);
m_centralwidget
=
new
QWidget
(
mainWindow
);
m_centralwidget
=
new
QWidget
(
this
);
m_centralwidget
->
setObjectName
(
QString
::
fromUtf8
(
"centralwidget"
)
);
mainWindow
->
setCentralWidget
(
m_centralwidget
);
setCentralWidget
(
m_centralwidget
);
std
::
cout
<<
"init main gl"
<<
std
::
endl
;
boost
::
shared_ptr
<
WQtGLWidget
>
widget
=
boost
::
shared_ptr
<
WQtGLWidget
>
(
new
WQtGLWidget
(
mainWindow
,
WGECamera
::
ORTHOGRAPHIC
)
);
m_glWidgets
.
push_back
(
widget
);
mainWindow
->
setCentralWidget
(
widget
.
get
()
);
m_mainGLWidget
=
boost
::
shared_ptr
<
WQtGLWidget
>
(
new
WQtGLWidget
(
this
,
WGECamera
::
ORTHOGRAPHIC
)
);
m_mainGLWidget
->
initialize
();
setCentralWidget
(
m_mainGLWidget
.
get
()
);
// initially 3 views
std
::
cout
<<
"init nav gl 1"
<<
std
::
endl
;
m_navAxial
=
new
WQtNavGLWidget
(
"axial"
,
160
,
"axialPos"
);
m_glWidgets
.
push_back
(
m_navAxial
->
getGLWidget
()
);
mainWindow
->
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
m_navAxial
);
m_navAxial
=
boost
::
shared_ptr
<
WQtNavGLWidget
>
(
new
WQtNavGLWidget
(
"axial"
,
160
,
"axialPos"
)
);
m_navAxial
->
getGLWidget
()
->
initialize
();
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
m_navAxial
.
get
()
);
std
::
cout
<<
"init nav gl 2"
<<
std
::
endl
;
m_navCoronal
=
new
WQtNavGLWidget
(
"coronal"
,
200
,
"coronalPos"
);
m_glWidgets
.
push_back
(
m_navCoronal
->
getGLWidget
()
);
mainWindow
->
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
m_navCoronal
);
m_navCoronal
=
boost
::
shared_ptr
<
WQtNavGLWidget
>
(
new
WQtNavGLWidget
(
"coronal"
,
200
,
"coronalPos"
)
);
m_navCoronal
->
getGLWidget
()
->
initialize
();
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
m_navCoronal
.
get
()
);
std
::
cout
<<
"init nav gl 3"
<<
std
::
endl
;
m_navSagittal
=
new
WQtNavGLWidget
(
"sagittal"
,
160
,
"sagittalPos"
);
m_glWidgets
.
push_back
(
m_navSagittal
->
getGLWidget
()
);
mainWindow
->
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
m_navSagittal
);
m_navSagittal
=
boost
::
shared_ptr
<
WQtNavGLWidget
>
(
new
WQtNavGLWidget
(
"sagittal"
,
160
,
"sagittalPos"
)
);
m_navSagittal
->
getGLWidget
()
->
initialize
();
addDockWidget
(
Qt
::
LeftDockWidgetArea
,
m_navSagittal
.
get
()
);
connect
(
m_navAxial
,
SIGNAL
(
navSliderValueChanged
(
QString
,
int
)
),
&
m_propertyManager
,
SLOT
(
slotIntChanged
(
QString
,
int
)
)
);
connect
(
m_navCoronal
,
SIGNAL
(
navSliderValueChanged
(
QString
,
int
)
),
&
m_propertyManager
,
SLOT
(
slotIntChanged
(
QString
,
int
)
)
);
connect
(
m_navSagittal
,
SIGNAL
(
navSliderValueChanged
(
QString
,
int
)
),
&
m_propertyManager
,
SLOT
(
slotIntChanged
(
QString
,
int
)
)
);
connect
(
m_navAxial
.
get
()
,
SIGNAL
(
navSliderValueChanged
(
QString
,
int
)
),
&
m_propertyManager
,
SLOT
(
slotIntChanged
(
QString
,
int
)
)
);
connect
(
m_navCoronal
.
get
()
,
SIGNAL
(
navSliderValueChanged
(
QString
,
int
)
),
&
m_propertyManager
,
SLOT
(
slotIntChanged
(
QString
,
int
)
)
);
connect
(
m_navSagittal
.
get
()
,
SIGNAL
(
navSliderValueChanged
(
QString
,
int
)
),
&
m_propertyManager
,
SLOT
(
slotIntChanged
(
QString
,
int
)
)
);
m_datasetBrowser
=
new
WQtDatasetBrowser
();
mainWindow
->
addDockWidget
(
Qt
::
RightDockWidgetArea
,
m_datasetBrowser
);
addDockWidget
(
Qt
::
RightDockWidgetArea
,
m_datasetBrowser
);
m_datasetBrowser
->
addSubject
(
"subject1"
);
connect
(
m_datasetBrowser
,
SIGNAL
(
dataSetBrowserEvent
(
QString
,
bool
)
),
&
m_propertyManager
,
SLOT
(
slotBoolChanged
(
QString
,
bool
)
)
);
setupToolBar
(
mainWindow
);
setupToolBar
();
}
void
WMainWindow
::
setupToolBar
(
QMainWindow
*
mainWindow
)
void
WMainWindow
::
setupToolBar
()
{
m_toolBar
=
new
WQtRibbonMenu
(
mainWindow
);
m_toolBar
=
new
WQtRibbonMenu
(
this
);
m_iconManager
.
addIcon
(
std
::
string
(
"quit"
),
quit_xpm
);
m_iconManager
.
addIcon
(
std
::
string
(
"save"
),
disc_xpm
);
...
...
@@ -119,7 +117,7 @@ void WMainWindow::setupToolBar( QMainWindow *mainWindow )
m_toolBar
->
getButton
(
QString
(
"buttonSave"
)
)
->
setMaximumSize
(
50
,
24
);
m_toolBar
->
getButton
(
QString
(
"buttonQuit"
)
)
->
setMaximumSize
(
50
,
24
);
connect
(
m_toolBar
->
getButton
(
QString
(
"buttonQuit"
)
),
SIGNAL
(
pressed
()
),
mainWindow
,
SLOT
(
close
()
)
);
connect
(
m_toolBar
->
getButton
(
QString
(
"buttonQuit"
)
),
SIGNAL
(
pressed
()
),
this
,
SLOT
(
close
()
)
);
connect
(
m_toolBar
->
getButton
(
QString
(
"buttonLoad"
)
),
SIGNAL
(
pressed
()
),
this
,
SLOT
(
openLoadDialog
()
)
);
m_toolBar
->
addTab
(
QString
(
"Modules"
)
);
...
...
@@ -152,7 +150,7 @@ void WMainWindow::setupToolBar( QMainWindow *mainWindow )
connect
(
m_toolBar
->
getButton
(
QString
(
"showSagittal"
)
),
SIGNAL
(
pushButtonToggled
(
QString
,
bool
)
),
&
m_propertyManager
,
SLOT
(
slotBoolChanged
(
QString
,
bool
)
)
);
mainWindow
->
addToolBar
(
Qt
::
TopToolBarArea
,
m_toolBar
);
addToolBar
(
Qt
::
TopToolBarArea
,
m_toolBar
);
}
...
...
@@ -208,3 +206,39 @@ WIconManager* WMainWindow::getIconManager()
{
return
&
m_iconManager
;
}
void
WMainWindow
::
closeEvent
(
QCloseEvent
*
e
)
{
// use some "Really Close?" Dialog here
bool
reallyClose
=
true
;
// handle close event
if
(
reallyClose
)
{
// signal everybuddy to shut down properly.
WKernel
::
getRunningKernel
()
->
stop
();
// now nobody acesses the osg anymore
// clean up gl widgets
m_mainGLWidget
->
close
();
m_mainGLWidget
.
reset
();
m_navAxial
->
close
();
m_navAxial
.
reset
();
m_navCoronal
->
close
();
m_navCoronal
.
reset
();
m_navSagittal
->
close
();
m_navSagittal
.
reset
();
// finally close
e
->
accept
();
}
else
{
e
->
ignore
();
}
}
src/gui/qt4/WMainWindow.h
View file @
c8b6747a
...
...
@@ -35,6 +35,7 @@
#include <QtGui/QMainWindow>
#include <QtGui/QSlider>
#include <QtGui/QWidget>
#include <QtGui/QCloseEvent>
#include "signalslib.hpp"
#include "WQtNavGLWidget.h"
...
...
@@ -46,13 +47,12 @@
// forward declarations
class
WQtGLWidget
;
/**
* This class contains the main window and the layout
* of the widgets within the window.
* \ingroup gui
*/
class
WMainWindow
:
public
Q
Object
class
WMainWindow
:
public
Q
MainWindow
{
Q_OBJECT
...
...
@@ -62,7 +62,7 @@ public:
/**
* Set up all widgets menus an buttons in the main window.
*/
void
setupGUI
(
QMainWindow
*
MainWindow
);
void
setupGUI
();
/**
* Destructor.
...
...
@@ -95,6 +95,15 @@ public:
*/
boost
::
signal1
<
void
,
std
::
vector
<
std
::
string
>
>*
getLoaderSignal
();
protected:
/**
* We want to react on close events.
*
* \param e the close event.
*/
void
closeEvent
(
QCloseEvent
*
e
);
public
slots
:
/**
* gets called when menu option or toolbar button load is activated
...
...
@@ -102,7 +111,7 @@ public slots:
void
openLoadDialog
();
private:
void
setupToolBar
(
QMainWindow
*
mainWindow
);
void
setupToolBar
();
WIconManager
m_iconManager
;
...
...
@@ -111,12 +120,12 @@ private:
QWidget
*
m_centralwidget
;
WQtRibbonMenu
*
m_toolBar
;
std
::
list
<
boost
::
shared_ptr
<
WQtGLWidget
>
>
m_glWidgets
;
WQtDatasetBrowser
*
m_datasetBrowser
;
WQtNavGLWidget
*
m_navAxial
;
WQtNavGLWidget
*
m_navCoronal
;
WQtNavGLWidget
*
m_navSagittal
;
boost
::
shared_ptr
<
WQtGLWidget
>
m_mainGLWidget
;
boost
::
shared_ptr
<
WQtNavGLWidget
>
m_navAxial
;
boost
::
shared_ptr
<
WQtNavGLWidget
>
m_navCoronal
;
boost
::
shared_ptr
<
WQtNavGLWidget
>
m_navSagittal
;
boost
::
signal1
<
void
,
std
::
vector
<
std
::
string
>
>
m_loaderSignal
;
};
...
...
src/gui/qt4/WQt4Gui.cpp
View file @
c8b6747a
...
...
@@ -30,46 +30,55 @@
#include <QtGui/QFileDialog>
#include "WMainWindow.h"
#include "../../kernel/WKernel.h"
#include "../../graphicsEngine/WGraphicsEngine.h"
#include "WQt4Gui.h"
WQt4Gui
::
WQt4Gui
()
:
WGUI
()
WQt4Gui
::
WQt4Gui
(
int
argc
,
char
**
argv
)
:
WGUI
(
argc
,
argv
)
{
m_isInitialized
=
false
;
}
WQt4Gui
::~
WQt4Gui
()
{
}
void
WQt4Gui
::
threadMai
n
()
int
WQt4Gui
::
ru
n
()
{
// TODO(ebaum): currently removed argument stuff. will be done later in conjunction with a better
// option handler.+
WLogger
::
getLogger
()
->
addLogMessage
(
"Bringing up GUI"
,
"GUI"
,
LL_DEBUG
);
#ifdef __APPLE__
char
*
dummy
=
""
;
int
dummyInt
=
0
;
QApplication
appl
(
dummyInt
,
&
dummy
,
0
);
// TODO(hlawitschka): what does the third parameter mean?
QApplication
appl
(
argc
,
argv
,
0
);
#else
QApplication
appl
(
0
,
NULL
);
QApplication
appl
(
argc
,
argv
);
#endif
QMainWindow
*
mainWindow
=
new
QMainWindow
;
m_gui
=
new
WMainWindow
;
m_gui
->
setupGUI
(
mainWindow
);
mainWindow
->
show
();
m_isInitialized
=
true
;
// startup graphics engine
m_ge
=
boost
::
shared_ptr
<
WGraphicsEngine
>
(
new
WGraphicsEngine
()
);
int
qtExecResult
;
qtExecResult
=
appl
.
exec
();
// and startup kernel
m_kernel
=
boost
::
shared_ptr
<
WKernel
>
(
new
WKernel
(
m_ge
,
shared_from_this
()
)
);
m_kernel
->
run
();
// create the window
m_gui
=
new
WMainWindow
;
m_gui
->
show
();
//
TODO(ebaum): how to handle return codes?
}
//
connect out loader signal with krnel
getLoadButtonSignal
()
->
connect
(
boost
::
bind
(
&
WKernel
::
doLoadDataSets
,
m_kernel
,
_1
)
);
void
WQt4Gui
::
createMainWindow
()
{
// bind the GUI's slot with the ready signal
t_ModuleGenericSignalHandlerType
f
=
boost
::
bind
(
&
WGUI
::
slotAddDatasetToBrowser
,
this
,
_1
);
m_kernel
->
getRootContainer
()
->
addDefaultNotifier
(
READY
,
f
);
// now we are initialized
m_isInitialized
=
true
;
// run
// NOTE: kernel shutdown is implemented in WMainWindow
return
appl
.
exec
();
}
void
WQt4Gui
::
addDatasetToBrowser
(
boost
::
shared_ptr
<
WModule
>
module
,
int
subjectId
)
...
...
@@ -82,11 +91,6 @@ std::vector< boost::shared_ptr< WModule > >WQt4Gui::getDataSetList( int subjectI
return
m_gui
->
getDatasetBrowser
()
->
getDataSetList
(
subjectId
);
}
bool
WQt4Gui
::
isInitalized
()
{
return
m_isInitialized
;
}
boost
::
signal1
<
void
,
std
::
vector
<
std
::
string
>
>*
WQt4Gui
::
getLoadButtonSignal
()
{
return
m_gui
->
getLoaderSignal
();
...
...
src/gui/qt4/WQt4Gui.h
View file @
c8b6747a
...
...
@@ -31,18 +31,24 @@
#include "../WGUI.h"
class
WMainWindow
;
class
WGraphicsEngine
;
class
WKernel
;
/**
*
Starts up the QT
GUI.
*
The QT4 Based GUI implementation. Implements W
GUI.
* \ingroup gui
*/
class
WQt4Gui
:
public
WGUI
{
public:
/**
* Default Constructor.
* Constructor.
*
* \param argc number of arguments given on command line.
* \param argv arguments given on command line.
*/
WQt4Gui
();
WQt4Gui
(
int
argc
,
char
**
argv
);
/**
* Default destructor.
...
...
@@ -50,16 +56,18 @@ public:
<