Commit 45883d7a authored by reichenbach's avatar reichenbach

[MERGE]

parents 12d73a8a 66434683
......@@ -26,7 +26,6 @@
####################################################################
# Toolbars
# useToolBarBreak = no # put compatibles toolbar in separate row
useAutoDisplay = no # automatically add a standard module after loading a data module.
# The next property controls the style of ALL toolbars in OpenWalnut.
......@@ -37,24 +36,9 @@ useAutoDisplay = no # automatically add a standard module after loading a data m
toolBarStyle = 0
compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style (overrides toolBarStyle)
# Position of the compatibles toolbar
# 0 -> top
# 1 -> bottom
# 2 -> left
# 3 -> right
# 4 -> hide completely
# 5 -> inside the control panel ( not possible for compatiblesToolBarPos! This will be mapped to right (=3) )
toolBarPos = 0 # default position of the toolbars
compatiblesToolBarPos = 0 # position of the compatibles toolbar (overrides toolBarPos)
####################################################################
# Control panel
# combineTreeAndRoiAndTextureSorter = yes # should the module tree, ROI tree and the Texture Sorter be combined in ONE Tab widget?
# dsbWidth = 400 # the width of the control panel
# dsbInvisibleByDefault = yes # hide the control panel on startup. Can be shown using F9.
# dsbFloatingByDefault = yes # should the control panel be undocked on startup?
# Here you can put any key sequence you would like to result in removing modules or ROIs
# Examples:
# deleteKey = Backspace
......@@ -66,6 +50,14 @@ deleteROIKey = Del
####################################################################
# Other GUI settings
# With this option, you are able to let OpenWalnut load another window state. OpenWalnut stores and resotres the window
# positions, sizes and so on on quit and startup. If you are an developer and have multiple compiled OW versions and you want
# each version to have other window state files set some name here which is unique.
# stateNamePostfix = someName
# This option allows you to turn off that the GUI stores its state.
# saveState = no
# hideMenuBar = yes # hide the menu bar
[ge] ## Settings for the graphics engine
......
......@@ -29,7 +29,6 @@ whiteList = Arbitrary Plane,Coordinate System,Image Extractor,Paint Texture,Arbi
####################################################################
# Toolbars
# useToolBarBreak = no # put compatibles toolbar in separate row
# useAutoDisplay = no # automatically add a standard module after loading a data module.
# The next property controls the style of ALL toolbars in OpenWalnut.
......@@ -40,24 +39,9 @@ whiteList = Arbitrary Plane,Coordinate System,Image Extractor,Paint Texture,Arbi
toolBarStyle = 0
compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style (overrides toolBarStyle)
# Position of the compatibles toolbar
# 0 -> top
# 1 -> bottom
# 2 -> left
# 3 -> right
# 4 -> hide completely
# 5 -> inside the control panel ( not possible for compatiblesToolBarPos! This will be mapped to right (=3) )
toolBarPos = 0 # default position of the toolbars
compatiblesToolBarPos = 0 # position of the compatibles toolbar (overrides toolBarPos)
####################################################################
# Control panel
# combineTreeAndRoiAndTextureSorter = yes # should the module tree, ROI tree and the Texture Sorter be combined in ONE Tab widget?
# dsbWidth = 400 # the width of the control panel
# dsbInvisibleByDefault = yes # hide the control panel on startup. Can be shown using F9.
# dsbFloatingByDefault = yes # should the control panel be undocked on startup?
# Here you can put any key sequence you would like to result in removing modules or ROIs
# Examples:
# deleteKey = Backspace
......@@ -69,6 +53,14 @@ deleteROIKey = Del
####################################################################
# Other GUI settings
# With this option, you are able to let OpenWalnut load another window state. OpenWalnut stores and resotres the window
# positions, sizes and so on on quit and startup. If you are an developer and have multiple compiled OW versions and you want
# each version to have other window state files set some name here which is unique.
# stateNamePostfix = someName
# This option allows you to turn off that the GUI stores its state.
# saveState = no
# hideMenuBar = yes # hide the menu bar
[ge] ## Settings for the graphics engine
......
......@@ -107,7 +107,7 @@ osg::ref_ptr< osg::Image > wge::genWhiteNoiseImage( size_t sizeX, size_t sizeY,
for( size_t i = 0; i < channels * sizeX * sizeY * sizeZ; ++i )
{
// - stylechecker says "use rand_r" but I am not sure about portability.
unsigned char r = ( unsigned char )( std::rand() % 255 ); // NOLINT
unsigned char r = static_cast< unsigned char >( std::rand() % 255 ); // NOLINT - no we want std::rand instead of rand_r
randomLuminance[ i ] = r;
}
......
......@@ -12,7 +12,6 @@ SET( QT_LIBS ${QT_QTCORE_LIBRARY}
# add here all classes that inherit from QObject
SET(GUI_QT4_MOC_HDRS
WMainWindow.h
WQtConfigWidget.h
WQtNavGLWidget.h
WQtGLWidget.h
WQtCombinerToolbar.h
......@@ -35,9 +34,18 @@ SET(GUI_QT4_MOC_HDRS
controlPanel/WQtTreeWidget.h
controlPanel/WQtTreeItem.h
controlPanel/WQtTextureSorter.h
networkEditor/WQtNetworkEditor.h
networkEditor/WQtNetworkScene.h
networkEditor/WQtNetworkItem.h
networkEditor/WQtNetworkPort.h
networkEditor/WQtNetworkInputPort.h
networkEditor/WQtNetworkOutputPort.h
networkEditor/WQtNetworkArrow.h
commandPrompt/WQtCommandPromptToolbar.h
commandPrompt/WQtCommandPrompt.h
)
IF( CMAKE_HOST_SYSTEM MATCHES Darwin )
LIST( APPEND GUI_QT4_MOC_HDRS platformDependent/WQtGLWidgetMac.h )
LIST( APPEND GUI_QT4_MOC_HDRS platformDependent/WQtGLWidgetMac.h )
ELSE()
IF( CMAKE_GENERATOR MATCHES "Visual Studio" )
......@@ -49,23 +57,24 @@ ENDIF()
QT4_WRAP_CPP(GUI_QT4_MOC_SRCS ${GUI_QT4_MOC_HDRS} )
FILE(GLOB GUI_QT4_SRC "*.cpp" "guiElements/*.cpp" "controlPanel/*.cpp" "ribbonMenu/*.cpp" "events/*.cpp" "*.h" "guiElements/*.h" "controlPanel/*.h" "ribbonMenu/*.h" "events/*.h" "../icons/WIcons.h" )
FILE(GLOB GUI_QT4_SRC "*.cpp" "guiElements/*.cpp" "controlPanel/*.cpp" "events/*.cpp" "networkEditor/*.cpp" "*.h" "guiElements/*.h"
"controlPanel/*.h" "events/*.h" "networkEditor/*.h" "../icons/WIcons.h" "commandPrompt/*.h" "commandPrompt/*.cpp" )
IF( CMAKE_HOST_SYSTEM MATCHES Darwin )
FILE( GLOB GUIQT4_PLATFORMDEPENDENT_SRC
"platformDependent/WQtGLWidgetMac.cpp"
FILE( GLOB GUIQT4_PLATFORMDEPENDENT_SRC
"platformDependent/WQtGLWidgetMac.cpp"
"platformDependent/WQtGLWidgetMac.h" )
ELSE()
IF( CMAKE_GENERATOR MATCHES "Visual Studio" )
FILE( GLOB GUIQT4_PLATFORMDEPENDENT_SRC
"platformDependent/WQtGLWidgetWin.cpp"
FILE( GLOB GUIQT4_PLATFORMDEPENDENT_SRC
"platformDependent/WQtGLWidgetWin.cpp"
"platformDependent/WQtGLWidgetWin.h" )
ELSE( CMAKE_GENERATOR MATCHES "Visual Studio" )
FILE( GLOB GUIQT4_PLATFORMDEPENDENT_SRC
"platformDependent/WQtGLWidgetAll.cpp"
FILE( GLOB GUIQT4_PLATFORMDEPENDENT_SRC
"platformDependent/WQtGLWidgetAll.cpp"
"platformDependent/WQtGLWidgetAll.h" )
ENDIF( CMAKE_GENERATOR MATCHES "Visual Studio" )
ENDIF()
SET( LIB_NAME "${OWguiqt4Name}" )
SET( ${LIB_NAME}_COMBINER_SRC ${GUI_QT4_SRC} ${GUIQT4_PLATFORMDEPENDENT_SRC} ${GUI_QT4_MOC_SRCS} )
......@@ -79,14 +88,14 @@ LIST( REMOVE_ITEM ${LIB_NAME}_ALL_CPP_WITHOUT_MOC ${${LIB_NAME}_REMOVE_H} )
IF( OW_BUILD_AS_ONE_BIG_FILE )
SET( UNITY_BUILD_FILE_NAME "${LIB_NAME}UnityBuildFile.cpp" )
GENERATE_UNITY_BUILD_FILE( ${LIB_NAME}_ALL_CPP )
ADD_LIBRARY( ${LIB_NAME} ${UNITY_BUILD_FILE_NAME} ${${LIB_NAME}_COMBINER_SRC} )
ENDIF( OW_BUILD_AS_ONE_BIG_FILE )
IF( NOT OW_BUILD_AS_ONE_BIG_FILE )
ADD_LIBRARY( ${LIB_NAME} ${${LIB_NAME}_COMBINER_SRC} )
ENDIF( NOT OW_BUILD_AS_ONE_BIG_FILE )
#IF( OW_BUILD_AS_ONE_BIG_FILE )
# SET( ALL_GUI_QT4_COMBINER_SRC ${GUI_QT4_SRC} ${GUIQT4_PLATFORMDEPENDENT_SRC} ${GUI_QT4_MOC_SRCS} )
# SET( UNITY_BUILD_FILE_NAME "GuiQt4UnityBuildFile.cpp" )
......
This diff is collapsed.
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WCFGOPERATIONS_H
#define WCFGOPERATIONS_H
#include <string>
#include <vector>
#include "../../common/WProperties.h"
/**
* static class that provides string and file operation functions
* to operate on a config file
*/
class WCfgOperations
{
public:
/**
* read the whole plain text from a text file
*
* \param fileName filename
*
* \result line vector of the text file
*/
static std::vector< std::string > readCfg( const std::string fileName );
/**
* write the plain line text to a file
*
* \param fileName filename
* \param lines line vector
*/
static void writeCfg( const std::string fileName, const std::vector< std::string > lines );
/**
* determine if a line is a comment
*
* \param line line
*
* \result is a comment
*/
static bool isComment( const std::string line );
/**
* determine if a line is an assignment
*
* \param line line
*
* \result is an assignment
*/
static bool isAssignment( const std::string line );
/**
* remove a comment from a line
*
* \param line line
*
* \result line without the comment
*/
static std::string removeComment( const std::string line );
/**
* parses a line with an assignment and returns the components
*
* \param line line
* \param left pointer to left part of the assignment
* \param right pointer to right part of the assignment
*/
static void getAssignementComponents( const std::string line, std::string *left, std::string *right );
/**
* determine if the line is a comment and in the comment is an assignment
*
* \param line line
*
* \result is a commented assignment
*/
static bool isCommentedAssignment( const std::string line );
/**
* determine if a line is a section
*
* \param line line
*
* \result is line a section
*/
static bool isSection( const std::string line );
/**
* get the section name of a line
*
* \param line line
*
* \result section name
*/
static std::string getSectionName( const std::string line );
/**
* return the line as uncommented
*
* \param line line
*
* \result line with first comment signs removed
*/
static std::string uncommentLine( const std::string line );
/**
* determine if a string is a bool var ("yes", "no")
*
* \param line line
*
* \result is bool var
*/
static bool isBool( const std::string line );
/**
* get the bool value of the line
*
* \param line line
*
* \result bool value
*/
static bool getAsBool( const std::string line );
/**
* determine if a line an int
*
* \param line line
*
* \result is int
*/
static bool isInt( const std::string line );
/**
* get a line as an int
*
* \param line line
*
* \result as int
*/
static int getAsInt( const std::string line );
/**
* determine if a line is a double
*
* \param line line
*
* \result is double
*/
static bool isDouble( const std::string line );
/**
* get a line as a double
*
* \param line line
*
* \result as double
*/
static double getAsDouble( const std::string line );
/**
* determine if a line is a string ( beginning and ending with a quote )
*
* \param line line
* \param useColon consider a colon at the beginning and end of the string
*
* \result is string
*/
static bool isString( const std::string line, bool useColon = false );
/**
* get the line as a string
*
* \param line line
* \param useColon consider a colon at the beginning and end of the string
*
* \result as string
*/
static std::string getAsString( const std::string line, bool useColon = false );
/**
* convert a property value to a string
* \note so far only functional with the types bool, int, double and string
* others will return an empty string
* doubles are capped to 2 digits after the dot and all zeros after the dot except the
* one behind the dot are removed, also if there's a '0' before the dot it's removed
* to have a consistent writing in the config file
*
* \param prop property variable
* \param useColon consider a colon at the beginning and end of the string
*
* \result property variable as string
*/
static std::string getPropValAsString( boost::shared_ptr< WProperties > prop, bool useColon = false );
private:
};
#endif // WCFGOPERATIONS_H
This diff is collapsed.
......@@ -39,13 +39,14 @@
#include "WIconManager.h"
#include "WQtToolBar.h"
#include "WQtGLWidget.h"
#include "networkEditor/WQtNetworkEditor.h"
#include "commandPrompt/WQtCommandPromptToolbar.h"
// forward declarations
class QMenuBar;
class WModule;
class WProjectFileIO;
class WQtCombinerToolbar;
class WQtConfigWidget;
class WQtControlPanel;
class WQtCustomDockWidget;
class WQtNavGLWidget;
......@@ -65,13 +66,23 @@ public:
/**
* Constructor of the main window
*/
explicit WMainWindow();
WMainWindow();
/**
* Destructor. Stores window state.
*/
virtual ~WMainWindow();
/**
* Set up all widgets menus an buttons in the main window.
*/
void setupGUI();
/**
* returns a pointer to the network editor object
*/
WQtNetworkEditor* getNetworkEditor();
/**
* returns a pointer to the control panel object
*/
......@@ -112,42 +123,6 @@ public:
*/
Qt::ToolButtonStyle getToolbarStyle() const;
/**
* All possible positions of the toolbars.
*/
typedef enum
{
Top = 0,
Bottom,
Left,
Right,
Hide,
InControlPanel
}
ToolBarPosition;
/**
* Returns the preferred position of toolbars.
*
* \return QT Position for the toolbars used as default for all toolbars.
*/
static ToolBarPosition getToolbarPos();
/**
* Returns the preferred position of toolbars.
*
* \return QT Position for the toolbars used as default for the compatibles toolbars.
*/
static ToolBarPosition getCompatiblesToolbarPos();
/**
* Converts the specified position to the appropriate qt toolbar area constant. Unknown positions (InControlPanel, Hide) are converted to
* Qt::NoToolBarArea.
*
* \param pos the position to convert.
*/
static Qt::ToolBarArea toQtToolBarArea( ToolBarPosition pos );
/**
* This method removes the old compatibles toolbar and sets the specified one.
*
......@@ -322,17 +297,16 @@ private:
WQtControlPanel* m_controlPanel; //!< control panel
WQtNetworkEditor* m_networkEditor; //!< network editor
WQtCommandPromptToolbar* m_commandPrompt; //!< command prompt
boost::shared_ptr< WQtGLWidget > m_mainGLWidget; //!< the main GL widget of the GUI
boost::shared_ptr< WQtNavGLWidget > m_navAxial; //!< the axial view widget GL widget of the GUI
boost::shared_ptr< WQtNavGLWidget > m_navCoronal; //!< the coronal view widget GL widget of the GUI
boost::shared_ptr< WQtNavGLWidget > m_navSagittal; //!< the sgittal view widget GL widget of the GUI
QDockWidget* m_dummyWidget; //!< The dummywidget serves as spacer in the dockwidget area;
/**
* shared pointer for the configuration widget
*/
boost::shared_ptr< WQtConfigWidget > m_configWidget;
/**
* All registered WQtCustomDockWidgets.
*/
......@@ -358,6 +332,16 @@ private:
* if the module is removed.
*/
std::map< boost::shared_ptr< WPropertyBase >, WQtPropertyBoolAction* > propertyActionMap;
/**
* Loads the window states and geometries from a file.
*/
void restoreSavedState();
/**
* Saves the current window states and geometries to a file.
*/
void saveWindowState();
};
#endif // WMAINWINDOW_H
......@@ -243,6 +243,8 @@ int WQt4Gui::run()
// run
int qtRetCode = appl.exec();
delete m_mainWindow;
// signal everybody to shut down properly.
WKernel::getRunningKernel()->wait( true );
WKernel::getRunningKernel()->getGraphicsEngine()->wait( true );
......@@ -267,6 +269,7 @@ void WQt4Gui::slotAddDatasetOrModuleToTree( boost::shared_ptr< WModule > module
{
// create a new event for this and insert it into event queue
QCoreApplication::postEvent( m_mainWindow->getControlPanel(), new WModuleAssocEvent( module ) );
QCoreApplication::postEvent( m_mainWindow->getNetworkEditor(), new WModuleAssocEvent( module ) );
}
void WQt4Gui::slotAddRoiToTree( osg::ref_ptr< WROI > roi )
......@@ -284,6 +287,7 @@ void WQt4Gui::slotActivateDatasetOrModuleInTree( boost::shared_ptr< WModule > mo
// create a new event for this and insert it into event queue
QCoreApplication::postEvent( m_mainWindow->getControlPanel(), new WModuleReadyEvent( module ) );
QCoreApplication::postEvent( m_mainWindow, new WModuleReadyEvent( module ) );
QCoreApplication::postEvent( m_mainWindow->getNetworkEditor(), new WModuleReadyEvent( module ) );
}
void WQt4Gui::slotRemoveDatasetOrModuleInTree( boost::shared_ptr< WModule > module )
......@@ -294,6 +298,7 @@ void WQt4Gui::slotRemoveDatasetOrModuleInTree( boost::shared_ptr< WModule > modu
boost::shared_ptr< WMData > dataModule = boost::shared_dynamic_cast< WMData >( module );
WAssert( dataModule, "Internal failure." );
}
QCoreApplication::postEvent( m_mainWindow->getNetworkEditor(), new WModuleRemovedEvent( module ) );
QCoreApplication::postEvent( m_mainWindow->getControlPanel(), new WModuleRemovedEvent( module ) );
QCoreApplication::postEvent( m_mainWindow, new WModuleRemovedEvent( module ) );
}
......@@ -304,10 +309,12 @@ void WQt4Gui::slotConnectionEstablished( boost::shared_ptr<WModuleConnector> in,
if ( in->isInputConnector() )
{
QCoreApplication::postEvent( m_mainWindow->getControlPanel(), new WModuleConnectEvent( in, out ) );
QCoreApplication::postEvent( m_mainWindow->getNetworkEditor(), new WModuleConnectEvent( in, out ) );
}
else
{
QCoreApplication::postEvent( m_mainWindow->getControlPanel(), new WModuleConnectEvent( out, in ) );
QCoreApplication::postEvent( m_mainWindow->getNetworkEditor(), new WModuleConnectEvent( out, in ) );
}
}
......@@ -316,10 +323,12 @@ void WQt4Gui::slotConnectionClosed( boost::shared_ptr<WModuleConnector> in, boos
// create a new event for this and insert it into event queue
if ( in->isInputConnector() )
{
QCoreApplication::postEvent( m_mainWindow->getNetworkEditor(), new WModuleDisconnectEvent( in, out ) );
QCoreApplication::postEvent( m_mainWindow->getControlPanel(), new WModuleDisconnectEvent( in, out ) );
}
else
{
QCoreApplication::postEvent( m_mainWindow->getNetworkEditor(), new WModuleDisconnectEvent( out, in ) );
QCoreApplication::postEvent( m_mainWindow->getControlPanel(), new WModuleDisconnectEvent( out, in ) );
}
}
......
......@@ -26,6 +26,7 @@
#include <QtGui/QAction>
#include <QtGui/QPushButton>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include "../../common/WPreferences.h"
......@@ -43,6 +44,10 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent, const WQtCombinerAc
{
// setup toolbar
setAllowedAreas( Qt::AllToolBarAreas );
setObjectName( QString( "Compatible Modules" ) );
setMinimumWidth( 50 );
setMinimumHeight( 30 );
// this sets the toolbar style
int compToolBarStyle = parent->getToolbarStyle(); // this defaults to the global toolbar style
......@@ -57,7 +62,6 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent, const WQtCombinerAc
// create the list of actions possible
addActions( compatibles );
insertDummyButton();
}
WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent )
......@@ -77,9 +81,6 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent )
// cast and set
setToolButtonStyle( static_cast< Qt::ToolButtonStyle >( compToolBarStyle ) );
// reserve size
insertDummyButton();
}
WQtCombinerToolbar::~WQtCombinerToolbar()
......@@ -89,7 +90,6 @@ WQtCombinerToolbar::~WQtCombinerToolbar()
void WQtCombinerToolbar::makeEmpty()
{
clear();
insertDummyButton();
}
void WQtCombinerToolbar::updateButtons( const WQtCombinerActionList& compatibles )
......@@ -98,21 +98,3 @@ void WQtCombinerToolbar::updateButtons( const WQtCombinerActionList& compatibles
addActions( compatibles );
}
void WQtCombinerToolbar::insertDummyButton()
{
// The following makes the bar having button size.
QPushButton* dummyButton = new QPushButton;
if ( ( m_parent->toQtToolBarArea( m_parent->getCompatiblesToolbarPos() ) == Qt::TopToolBarArea ) ||
( m_parent->toQtToolBarArea( m_parent->getCompatiblesToolbarPos() ) == Qt::BottomToolBarArea ) )
{
dummyButton->setFixedWidth( 0 );
dummyButton->setFixedHeight( 30 );
}
else
{
dummyButton->setFixedWidth( 48 ); // well this size must be more than 32 as there might be these little submenu arrows besides the icon
dummyButton->setFixedHeight( 0 );
}