Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
8102fd2b
Commit
8102fd2b
authored
Feb 08, 2010
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] - added string and double property widgets
parent
08bd7658
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
374 additions
and
14 deletions
+374
-14
src/gui/qt4/CMakeLists.txt
src/gui/qt4/CMakeLists.txt
+2
-0
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.cpp
+107
-0
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.h
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.h
+87
-0
src/gui/qt4/datasetbrowser/WPropertyIntWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyIntWidget.cpp
+1
-4
src/gui/qt4/datasetbrowser/WPropertyStringWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyStringWidget.cpp
+73
-0
src/gui/qt4/datasetbrowser/WPropertyStringWidget.h
src/gui/qt4/datasetbrowser/WPropertyStringWidget.h
+86
-0
src/gui/qt4/datasetbrowser/WQtDSBWidget.cpp
src/gui/qt4/datasetbrowser/WQtDSBWidget.cpp
+4
-4
src/gui/qt4/datasetbrowser/WQtDSBWidget.h
src/gui/qt4/datasetbrowser/WQtDSBWidget.h
+4
-2
src/modules/connectomeView/WMConnectomeView.cpp
src/modules/connectomeView/WMConnectomeView.cpp
+2
-2
src/modules/connectomeView/WMConnectomeView.h
src/modules/connectomeView/WMConnectomeView.h
+2
-2
src/modules/navSlices/WMNavSlices.cpp
src/modules/navSlices/WMNavSlices.cpp
+6
-0
No files found.
src/gui/qt4/CMakeLists.txt
View file @
8102fd2b
...
...
@@ -18,6 +18,8 @@ SET(GUI_QT4_MOC_HDRS
datasetbrowser/WPropertyWidget.h
datasetbrowser/WPropertyBoolWidget.h
datasetbrowser/WPropertyIntWidget.h
datasetbrowser/WPropertyDoubleWidget.h
datasetbrowser/WPropertyStringWidget.h
datasetbrowser/WQtDatasetBrowser.h
datasetbrowser/WQtDSBWidget.h
datasetbrowser/WQtLineEdit.h
...
...
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.cpp
0 → 100644
View file @
8102fd2b
//---------------------------------------------------------------------------
//
// 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/>.
//
//---------------------------------------------------------------------------
#include <cmath>
#include <boost/lexical_cast.hpp>
#include "../../../common/WLogger.h"
#include "../../../common/WPropertyVariable.h"
#include "WPropertyDoubleWidget.h"
WPropertyDoubleWidget
::
WPropertyDoubleWidget
(
WPropDouble
property
,
QGridLayout
*
propertyGrid
,
QWidget
*
parent
)
:
WPropertyWidget
(
property
,
propertyGrid
,
parent
),
m_doubleProperty
(
property
),
m_spin
(
this
),
m_layout
()
{
// initialize members
setLayout
(
&
m_layout
);
// layout both against each other
m_layout
.
addWidget
(
&
m_spin
);
// get the min constraint
WPVDouble
::
PropertyConstraintMin
minC
=
m_doubleProperty
->
getMin
();
double
min
=
0.0
;
if
(
minC
.
get
()
)
{
min
=
minC
->
getMin
();
}
else
{
WLogger
::
getLogger
()
->
addLogMessage
(
std
::
string
(
"The property has no minimum constraint. You should define it to avoid unexpected behaviour. "
)
+
std
::
string
(
"Using default ("
+
boost
::
lexical_cast
<
std
::
string
>
(
min
)
+
")."
),
"PropertyWidget( "
+
m_doubleProperty
->
getName
()
+
" )"
,
LL_WARNING
);
}
// get the max constraint
WPVDouble
::
PropertyConstraintMax
maxC
=
m_doubleProperty
->
getMax
();
double
max
=
100.0
;
if
(
maxC
.
get
()
)
{
max
=
maxC
->
getMax
();
}
else
{
WLogger
::
getLogger
()
->
addLogMessage
(
std
::
string
(
"The property has no maximum constraint. You should define it to avoid unexpected behaviour. "
)
+
std
::
string
(
"Using default ("
+
boost
::
lexical_cast
<
std
::
string
>
(
max
)
+
")."
),
"PropertyWidget( "
+
m_doubleProperty
->
getName
()
+
" )"
,
LL_WARNING
);
}
// setup the slider
m_spin
.
setMinimum
(
min
);
m_spin
.
setMaximum
(
max
);
// set the initial values
m_spin
.
setValue
(
m_doubleProperty
->
get
()
);
m_spin
.
setSingleStep
(
(
max
-
min
)
/
100.0
);
// connect the modification signal of the edit and slider with our callback
connect
(
&
m_spin
,
SIGNAL
(
valueChanged
(
double
)
),
this
,
SLOT
(
spinChanged
(
double
)
)
);
}
WPropertyDoubleWidget
::~
WPropertyDoubleWidget
()
{
// cleanup
}
void
WPropertyDoubleWidget
::
spinChanged
(
double
value
)
{
// set to the property
if
(
!
m_doubleProperty
->
accept
(
value
)
)
{
// this is not a valid value!
invalidate
();
}
else
{
invalidate
(
false
);
m_doubleProperty
->
set
(
value
);
}
}
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.h
0 → 100644
View file @
8102fd2b
//---------------------------------------------------------------------------
//
// 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 WPROPERTYDOUBLEWIDGET_H
#define WPROPERTYDOUBLEWIDGET_H
#include <string>
#include <QtGui/QDoubleSpinBox>
#include <QtGui/QHBoxLayout>
#include "WPropertyWidget.h"
/**
* Implements a property widget for WPropDouble.
*/
class
WPropertyDoubleWidget
:
public
WPropertyWidget
{
Q_OBJECT
public:
/**
* Constructor. Creates a new widget appropriate for the specified property.
*
* \param property the property to handle
* \param parent the parent widget.
* \param propertyGrid the grid used to layout the labels and property widgets
*/
WPropertyDoubleWidget
(
WPropDouble
property
,
QGridLayout
*
propertyGrid
,
QWidget
*
parent
=
0
);
/**
* Destructor.
*/
virtual
~
WPropertyDoubleWidget
();
protected:
/**
* The integer property represented by this widget.
*/
WPropDouble
m_doubleProperty
;
/**
* Spin box for doubles
*/
QDoubleSpinBox
m_spin
;
/**
* Layout used to position the label and the checkbox
*/
QHBoxLayout
m_layout
;
private:
public
slots
:
/**
* Called whenever the spin box changes
*
* \param value the new value
*/
void
spinChanged
(
double
value
);
};
#endif // WPROPERTYDOUBLEWIDGET_H
src/gui/qt4/datasetbrowser/WPropertyIntWidget.cpp
View file @
8102fd2b
...
...
@@ -23,7 +23,6 @@
//---------------------------------------------------------------------------
#include <iostream>
#include <sstream>
#include <cmath>
#include <boost/lexical_cast.hpp>
...
...
@@ -98,9 +97,7 @@ WPropertyIntWidget::WPropertyIntWidget( WPropInt property, QGridLayout* property
m_edit
.
resize
(
m_edit
.
minimumSizeHint
().
width
()
*
length
/
2
,
m_edit
.
size
().
height
()
);
// set the initial values
std
::
ostringstream
s
;
s
<<
m_intProperty
->
get
();
m_edit
.
setText
(
QString
(
s
.
str
().
c_str
()
)
);
m_edit
.
setText
(
QString
(
boost
::
lexical_cast
<
std
::
string
>
(
m_intProperty
->
get
()
).
c_str
()
)
);
m_slider
.
setValue
(
m_intProperty
->
get
()
);
// connect the modification signal of the edit and slider with our callback
...
...
src/gui/qt4/datasetbrowser/WPropertyStringWidget.cpp
0 → 100644
View file @
8102fd2b
//---------------------------------------------------------------------------
//
// 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/>.
//
//---------------------------------------------------------------------------
#include <iostream>
#include <cmath>
#include <boost/lexical_cast.hpp>
#include "../../../common/WLogger.h"
#include "../../../common/WPropertyVariable.h"
#include "WPropertyStringWidget.h"
WPropertyStringWidget
::
WPropertyStringWidget
(
WPropString
property
,
QGridLayout
*
propertyGrid
,
QWidget
*
parent
)
:
WPropertyWidget
(
property
,
propertyGrid
,
parent
),
m_stringProperty
(
property
),
m_edit
(
this
),
m_layout
()
{
// initialize members
setLayout
(
&
m_layout
);
// layout both against each other
m_layout
.
addWidget
(
&
m_edit
);
// set the initial values
m_edit
.
setText
(
QString
(
m_stringProperty
->
get
().
c_str
()
)
);
// connect the modification signal of the edit and slider with our callback
connect
(
&
m_edit
,
SIGNAL
(
returnPressed
()
),
this
,
SLOT
(
editChanged
()
)
);
}
WPropertyStringWidget
::~
WPropertyStringWidget
()
{
// cleanup
}
void
WPropertyStringWidget
::
editChanged
()
{
std
::
string
value
=
m_edit
.
text
().
toStdString
();
// now: is the value acceptable by the property?
if
(
!
m_stringProperty
->
accept
(
value
)
)
{
invalidate
();
}
else
{
invalidate
(
false
);
m_stringProperty
->
set
(
value
);
}
}
src/gui/qt4/datasetbrowser/WPropertyStringWidget.h
0 → 100644
View file @
8102fd2b
//---------------------------------------------------------------------------
//
// 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 WPROPERTYSTRINGWIDGET_H
#define WPROPERTYSTRINGWIDGET_H
#include <string>
#include <QtGui/QLineEdit>
#include <QtGui/QSlider>
#include <QtGui/QHBoxLayout>
#include "WPropertyWidget.h"
/**
* Implements a property widget for WPropString.
*/
class
WPropertyStringWidget
:
public
WPropertyWidget
{
Q_OBJECT
public:
/**
* Constructor. Creates a new widget appropriate for the specified property.
*
* \param property the property to handle
* \param parent the parent widget.
* \param propertyGrid the grid used to layout the labels and property widgets
*/
WPropertyStringWidget
(
WPropString
property
,
QGridLayout
*
propertyGrid
,
QWidget
*
parent
=
0
);
/**
* Destructor.
*/
virtual
~
WPropertyStringWidget
();
protected:
/**
* The integer property represented by this widget.
*/
WPropString
m_stringProperty
;
/**
* The edit field showing the value
*/
QLineEdit
m_edit
;
/**
* Layout used to position the label and the checkbox
*/
QHBoxLayout
m_layout
;
private:
public
slots
:
/**
* Called whenever the edit field changes
*/
void
editChanged
();
};
#endif // WPROPERTYSTRINGWIDGET_H
src/gui/qt4/datasetbrowser/WQtDSBWidget.cpp
View file @
8102fd2b
...
...
@@ -49,14 +49,14 @@ WPropertyIntWidget* WQtDSBWidget::addPropInt( WPropInt property )
return
new
WPropertyIntWidget
(
property
,
&
m_controlLayout
,
this
);
}
WProperty
Int
Widget
*
WQtDSBWidget
::
addPropDouble
(
WPropDouble
property
)
WProperty
Double
Widget
*
WQtDSBWidget
::
addPropDouble
(
WPropDouble
property
)
{
return
NULL
;
return
new
WPropertyDoubleWidget
(
property
,
&
m_controlLayout
,
this
)
;
}
WProperty
Int
Widget
*
WQtDSBWidget
::
addPropString
(
WPropString
property
)
WProperty
String
Widget
*
WQtDSBWidget
::
addPropString
(
WPropString
property
)
{
return
NULL
;
return
new
WPropertyStringWidget
(
property
,
&
m_controlLayout
,
this
)
;
}
void
WQtDSBWidget
::
addSpacer
()
...
...
src/gui/qt4/datasetbrowser/WQtDSBWidget.h
View file @
8102fd2b
...
...
@@ -36,6 +36,8 @@
#include "WPropertyBoolWidget.h"
#include "WPropertyIntWidget.h"
#include "WPropertyStringWidget.h"
#include "WPropertyDoubleWidget.h"
#include "../../../common/WPropertyVariable.h"
...
...
@@ -90,7 +92,7 @@ public:
*
* \return the widget that has been added.
*/
WProperty
Int
Widget
*
addPropDouble
(
WPropDouble
property
);
WProperty
Double
Widget
*
addPropDouble
(
WPropDouble
property
);
/**
* Adds a new int property to the DSB.
...
...
@@ -99,7 +101,7 @@ public:
*
* \return the widget that has been added.
*/
WProperty
Int
Widget
*
addPropString
(
WPropString
property
);
WProperty
String
Widget
*
addPropString
(
WPropString
property
);
/**
* helper function to add a spacer at the end
...
...
src/modules/connectomeView/WMConnectomeView.cpp
View file @
8102fd2b
...
...
@@ -102,8 +102,8 @@ void WMConnectomeView::connectors()
addConnector
(
m_mrtInput
);
// this is the scalar field input
m_fiberInput
=
boost
::
shared_ptr
<
WModuleInputForwardData
<
WDataSetFibers
2
>
>
(
new
WModuleInputForwardData
<
WDataSetFibers
2
>
(
shared_from_this
(),
m_fiberInput
=
boost
::
shared_ptr
<
WModuleInputForwardData
<
WDataSetFibers
>
>
(
new
WModuleInputForwardData
<
WDataSetFibers
>
(
shared_from_this
(),
"fibers"
,
"The fiber dataset used to find connection path."
)
);
...
...
src/modules/connectomeView/WMConnectomeView.h
View file @
8102fd2b
...
...
@@ -33,7 +33,7 @@
#include <osg/Geode>
#include <osg/Uniform>
#include "../../dataHandler/WDataSetFibers
2
.h"
#include "../../dataHandler/WDataSetFibers.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleContainer.h"
...
...
@@ -116,7 +116,7 @@ private:
/**
* The fiber dataset used.
*/
boost
::
shared_ptr
<
WModuleInputForwardData
<
WDataSetFibers
2
>
>
m_fiberInput
;
boost
::
shared_ptr
<
WModuleInputForwardData
<
WDataSetFibers
>
>
m_fiberInput
;
/**
* the current dataset
...
...
src/modules/navSlices/WMNavSlices.cpp
View file @
8102fd2b
...
...
@@ -141,6 +141,12 @@ void WMNavSlices::properties()
m_maxAxial
=
m_properties2
->
addProperty
(
"maxAxial"
,
"Max position of axial slice."
,
160
,
true
);
m_maxCoronal
=
m_properties2
->
addProperty
(
"maxCoronal"
,
"Max position of coronal slice."
,
200
,
true
);
m_maxSagittal
=
m_properties2
->
addProperty
(
"maxSagittal"
,
"Max position of sagittal slice."
,
160
,
true
);
WPropDouble
d
=
m_properties2
->
addProperty
(
"hallo"
,
"Position of axial slice."
,
5.0
);
d
->
setMin
(
0.5
);
d
->
setMax
(
10.2
);
WPropString
s
=
m_properties2
->
addProperty
(
"hallo2"
,
"Position of axial slice."
,
std
::
string
(
"hallo du"
)
);
}
void
WMNavSlices
::
notifyDataChange
(
boost
::
shared_ptr
<
WModuleConnector
>
input
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment