Commit 434e931b by Sebastian Eichelbaum

[MERGE] merged in current branch to android branch

parents fd01e404 decfc5aa
......@@ -70,6 +70,11 @@ SETUP_LIB_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} "CORE" )
# Core contains the headers which are needed for any developer release. Install them.
# NOTE: do not use ${TARGET_H_FILES}. The command requires a list
SETUP_DEV_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} TARGET_H_FILES "include/openwalnut/core" "CORE_DEV" )
# Install the header too
INSTALL( FILES ${OW_VERSION_HEADER}
DESTINATION "include/openwalnut/core"
COMPONENT "CORE_DEV"
)
# The core does also provide some nice pkg-config file. Set this up and configure it to contain the correct install prefix
SETUP_CONFIGURED_FILE( "core-dev" "lib/pkgconfig/openwalnut.pc" "CORE_DEV" )
......
......@@ -44,7 +44,7 @@
#include "WROIManager.h"
#include "WSelectionManager.h"
#include "WVersion.h" // NOTE: this file is auto-generated by CMAKE
#include "core/WVersion.h" // NOTE: this file is auto-generated by CMAKE
/**
* Used for program wide access to the kernel.
......
......@@ -289,7 +289,7 @@ void WMData::moduleMain()
m_properties->addProperty( m_dataSet->getProperties() );
m_infoProperties->addProperty( m_dataSet->getInformationProperties() );
m_infoProperties->addProperty( getTransformationProperties() );
// I am interested in the active property ( manually subscribe signal )
m_active->getCondition()->subscribeSignal( boost::bind( &WMData::propertyChanged, this, m_active ) );
......
......@@ -177,7 +177,11 @@ protected:
WMatrix< double > m_transformQForm;
private:
//! returns info property group with the three availabe transformation matrixes
/**
* Returns info property group with the three availabe transformation matrixes
*
* \return info property group with the three availabe transformation matrixes
*/
boost::shared_ptr< WProperties > getTransformationProperties() const;
//! a condition for the matrix selection
......
......@@ -198,21 +198,21 @@ void WMNavigationSlices::initOSG()
osg::ref_ptr< osg::Node > xSlice = wge::genFinitePlane( minV, osg::Vec3( 0.0, sizes[1], 0.0 ),
osg::Vec3( 0.0, 0.0, sizes[2] ) );
xSlice->setName( "Sagittal Slice" );
osg::Uniform* xSliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrix::identity() );
osg::Uniform* xSliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrixf::identity() );
xSlice->getOrCreateStateSet()->addUniform( xSliceUniform );
// Y Slice
osg::ref_ptr< osg::Node > ySlice = wge::genFinitePlane( minV, osg::Vec3( sizes[0], 0.0, 0.0 ),
osg::Vec3( 0.0, 0.0, sizes[2] ) );
ySlice->setName( "Coronal Slice" );
osg::Uniform* ySliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrix::identity() );
osg::Uniform* ySliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrixf::identity() );
ySlice->getOrCreateStateSet()->addUniform( ySliceUniform );
// Z Slice
osg::ref_ptr< osg::Node > zSlice = wge::genFinitePlane( minV, osg::Vec3( sizes[0], 0.0, 0.0 ),
osg::Vec3( 0.0, sizes[1], 0.0 ) );
zSlice->setName( "Axial Slice" );
osg::Uniform* zSliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrix::identity() );
osg::Uniform* zSliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrixf::identity() );
zSlice->getOrCreateStateSet()->addUniform( zSliceUniform );
// disable culling.
......
......@@ -58,6 +58,7 @@ const char** WMTransferFunction1D::getXPMIcon() const
{
return WMTransferFunction1D_xpm;
}
const std::string WMTransferFunction1D::getName() const
{
return "Transfer Function 1D";
......
......@@ -39,6 +39,7 @@
#include "core/common/WStringUtils.h"
// own, local headers
#include "WMWriteTransferFunction.xpm"
#include "WMWriteTransferFunction.h"
W_LOADABLE_MODULE( WMWriteTransferFunction )
......@@ -59,6 +60,11 @@ boost::shared_ptr< WModule > WMWriteTransferFunction::factory() const
return boost::shared_ptr< WModule >( new WMWriteTransferFunction() );
}
const char** WMWriteTransferFunction::getXPMIcon() const
{
return WMWriteTransferFunction_xpm;
}
const std::string WMWriteTransferFunction::getName() const
{
return "Write Transfer Function";
......
......@@ -51,6 +51,13 @@ public:
virtual ~WMWriteTransferFunction();
/**
* Get the icon for this module in XPM format.
*
* \return The icon.
*/
const char** getXPMIcon() const;
/**
* Gives back the name of this module.
* \return the module's name.
*/
......
/* XPM */
static const char * WMWriteTransferFunction_xpm[] = {
"32 32 308 2",
" c None",
". c #000000",
"+ c #000001",
"@ c #040206",
"# c #0C000D",
"$ c #F900D0",
"% c #FF00AF",
"& c #F00070",
"* c #480015",
"= c #690084",
"- c #ED00F3",
"; c #FF00D8",
"> c #FE00A6",
", c #FF0077",
"' c #EC0044",
") c #010300",
"! c #153800",
"~ c #072000",
"{ c #110029",
"] c #7A00C8",
"^ c #CF00FF",
"/ c #F700FE",
"( c #FF00D7",
"_ c #FF00A7",
": c #FF0048",
"< c #BF0012",
"[ c #102200",
"} c #67FF00",
"| c #32F700",
"1 c #06AE00",
"2 c #000B00",
"3 c #1B0068",
"4 c #6500F9",
"5 c #9800FF",
"6 c #C700FE",
"7 c #FF0078",
"8 c #FE0048",
"9 c #FF0017",
"0 c #79D200",
"a c #65FF00",
"b c #35FE00",
"c c #06FF01",
"d c #00FF29",
"e c #008A2F",
"f c #000609",
"g c #010007",
"h c #3900FF",
"i c #6700FE",
"j c #9700FF",
"k c #C700FF",
"l c #F600FE",
"m c #FF00A8",
"n c #FF0079",
"o c #FF0049",
"p c #374C00",
"q c #9CFF00",
"r c #65FE00",
"s c #36FF00",
"t c #07FF00",
"u c #00FB57",
"v c #000C06",
"w c #00C2D7",
"x c #00B4FB",
"y c #0064B5",
"z c #0700C6",
"A c #3700FF",
"B c #6600FF",
"C c #9600FF",
"D c #C600FF",
"E c #FF00D9",
"F c #FF00A9",
"G c #FF004A",
"H c #FF0018",
"I c #020200",
"J c #98CB00",
"K c #95FE00",
"L c #66FF00",
"M c #00FF28",
"N c #00FF58",
"O c #00E478",
"P c #00CB92",
"Q c #00E4D0",
"R c #00ECFF",
"S c #00B7FE",
"T c #008AFF",
"U c #005EFF",
"V c #002AFF",
"W c #0700FF",
"X c #3600FE",
"Y c #9500FF",
"Z c #C500FE",
"` c #F600FF",
" . c #FF00DA",
".. c #FF007A",
"+. c #131600",
"@. c #D1FF00",
"#. c #96FF00",
"$. c #37FF00",
"%. c #08FF00",
"&. c #00FF27",
"*. c #00FF57",
"=. c #00FF87",
"-. c #00FFB6",
";. c #00FFE7",
">. c #00E9FF",
",. c #00B8FF",
"'. c #0088FF",
"). c #0059FF",
"!. c #0029FF",
"~. c #3500FF",
"{. c #6500FF",
"]. c #C400FF",
"^. c #F500FF",
"/. c #FF00AA",
"(. c #FF004B",
"_. c #FF0019",
":. c #DFE600",
"<. c #C8FF00",
"[. c #98FF00",
"}. c #38FF00",
"|. c #00FF26",
"1. c #00FF86",
"2. c #00FFE6",
"3. c #00EAFF",
"4. c #0089FF",
"5. c #0601FF",
"6. c #3400FF",
"7. c #9400FF",
"8. c #FF00DB",
"9. c #FF00AB",
"0. c #FF007B",
"a. c #FF001A",
"b. c #4E4600",
"c. c #FAFF00",
"d. c #C7FF00",
"e. c #97FF00",
"f. c #68FF00",
"g. c #00FF25",
"h. c #00FF56",
"i. c #00FF85",
"j. c #00FFB5",
"k. c #00B9FF",
"l. c #005BFF",
"m. c #6400FF",
"n. c #9300FF",
"o. c #C300FF",
"p. c #F300FF",
"q. c #FF00DC",
"r. c #FF00AC",
"s. c #FF007C",
"t. c #FF004C",
"u. c #BEA400",
"v. c #F7FE00",
"w. c #69FF00",
"x. c #39FF00",
"y. c #00FF55",
"z. c #00FF84",
"A. c #00FFB4",
"B. c #00FFE5",
"C. c #00EBFF",
"D. c #00BAFF",
"E. c #005AFF",
"F. c #002BFF",
"G. c #0501FF",
"H. c #3300FF",
"I. c #6300FF",
"J. c #C200FF",
"K. c #F200FF",
"L. c #FF00DD",
"M. c #FF007D",
"N. c #FF004D",
"O. c #FF001B",
"P. c #1E1500",
"Q. c #FFE200",
"R. c #F8FE00",
"S. c #99FF00",
"T. c #3AFF00",
"U. c #09FF00",
"V. c #00FF24",
"W. c #00FF54",
"X. c #00BBFF",
"Y. c #008BFF",
"Z. c #0502FF",
"`. c #6200FF",
" + c #9200FF",
".+ c #FF00AD",
"++ c #FF004E",
"@+ c #FF001C",
"#+ c #F39F00",
"$+ c #FFD500",
"%+ c #C9FF00",
"&+ c #9AFF00",
"*+ c #6AFF00",
"=+ c #0AFF00",
"-+ c #00FF23",
";+ c #00FF83",
">+ c #00FFB3",
",+ c #00FFE4",
"'+ c #008CFF",
")+ c #005CFF",
"!+ c #002CFF",
"~+ c #3200FF",
"{+ c #C100FF",
"]+ c #F100FF",
"^+ c #FF00DE",
"/+ c #FF007E",
"(+ c #FF004F",
"_+ c #FF001D",
":+ c #402200",
"<+ c #FEA400",
"[+ c #F8FD00",
"}+ c #CAFF00",
"|+ c #3BFF00",
"1+ c #00FF53",
"2+ c #00FFB2",
"3+ c #00FFE3",
"4+ c #00EDFF",
"5+ c #00BCFF",
"6+ c #005DFF",
"7+ c #002DFF",
"8+ c #0503FF",
"9+ c #3100FF",
"0+ c #6100FF",
"a+ c #9100FF",
"b+ c #FF007F",
"c+ c #E76A00",
"d+ c #FFA500",
"e+ c #FFD400",
"f+ c #F9FD00",
"g+ c #9BFF00",
"h+ c #6BFF00",
"i+ c #3CFF00",
"j+ c #0CFF00",
"k+ c #00FF22",
"l+ c #00FF52",
"m+ c #00FF82",
"n+ c #00FFE2",
"o+ c #00EEFF",
"p+ c #008DFF",
"q+ c #0402FF",
"r+ c #6000FF",
"s+ c #9000FF",
"t+ c #C000FF",
"u+ c #F000FF",
"v+ c #FF00DF",
"w+ c #FF0050",
"x+ c #FF001E",
"y+ c #FF7A00",
"z+ c #FFD300",
"A+ c #CBFF00",
"B+ c #6CFF00",
"C+ c #00FFB1",
"D+ c #00BDFF",
"E+ c #008EFF",
"F+ c #002EFF",
"G+ c #0403FF",
"H+ c #3000FF",
"I+ c #8F00FF",
"J+ c #BF00FF",
"K+ c #EF00FF",
"L+ c #FF00E0",
"M+ c #FF00B0",
"N+ c #FF0080",
"O+ c #0A0000",
"P+ c #471300",
"Q+ c #FF7700",
"R+ c #FFA300",
"S+ c #CCFF00",
"T+ c #3DFF00",
"U+ c #0DFF00",
"V+ c #00FF21",
"W+ c #00FF51",
"X+ c #00FF81",
"Y+ c #00FFB0",
"Z+ c #00FFE1",
"`+ c #00EFFF",
" @ c #00BEFF",
".@ c #002FFF",
"+@ c #5F00FF",
"@@ c #BE00FF",
"#@ c #EE00FF",
"$@ c #FF0081",
"%@ c #FF0051",
"&@ c #FF001F",
"*@ c #E30F00",
"=@ c #FF4400",
"-@ c #FE7200",
";@ c #FFA200",
">@ c #FFD200",
",@ c #F9FC00",
"'@ c #CDFF00",
")@ c #9DFF00",
"!@ c #6DFF00",
"~@ c #3EFF00",
"{@ c #00FF20",
"]@ c #00FF50",
"^@ c #00FF80",
"/@ c #00FFE0",
"(@ c #00F0FF",
"_@ c #008FFF",
":@ c #005FFF",
"<@ c #0304FF",
"[@ c #2F00FF",
"}@ c #5E00FF",
"|@ c #8E00FF",
"1@ c #BD00FF",
"2@ c #FF00E1",
"3@ c #FF0020",
". . . . . . ",
". . . . . . ",
". . . . . . . . . . ",
". . . . . . . . . . ",
". . . . . . . . ",
". . . . . . . . ",
". . . . . . . . ",
". . . . . . . . ",
". . . . . . . . . . . . ",
". . . . . . . . . . . . ",
" . . + . ",
" . . . @ . . . ",
" . . . . . ",
" . . . . . . . . . . ",
" . . . . . . # $ % & * . ",
" . . . . . . . . = - ; > , ' . ",
" . ) ! ~ . . . . . . . { ] ^ / ( _ , : < ",
" . [ } | 1 2 . . . . . . . . . . 3 4 5 6 / ; _ 7 8 9 ",
" . . 0 a b c d e . . . . . f . . g h i j k l ; m n o 9 ",
" . . p q r s t d u v . . w x y . . z A B C D l E F n G H ",
" . I J K L s t M N O P Q R S T U V W X B Y Z ` .F ..G H ",
" . . +.@.#.L $.%.&.*.=.-.;.>.,.'.).!.W ~.{.Y ].^. ./...(._.",
" . . :.<.[.} }.%.|.*.1.-.2.3.,.4.).V 5.6.{.7.].^.8.9.0.(.a.",
" . b.c.d.e.f.}.%.g.h.i.j.2.3.k.T l.V 5.6.m.n.o.p.q.r.s.t.a.",
" . . u.v.<.[.w.x.%.g.y.z.A.B.C.D.T E.F.G.H.I.n.J.K.L.r.M.N.O.",
" . . P.Q.R.<.S.w.T.U.V.W.z.A.B.C.X.Y.l.F.Z.H.`. +J.K.L..+M.++@+",
" . . #+$+R.%+&+*+T.=+-+W.;+>+,+R X.'+)+!+Z.~+`. +{+]+^+.+/+(+_+",
". . :+<+$+[+}+&+*+|+=+-+1+;+2+3+4+5+'+6+7+8+9+0+a+{+]+^+% b+(+_+",
". . c+d+e+f+}+g+h+i+j+k+l+m+2+n+o+5+p+6+7+q+9+r+s+t+u+v+% b+w+x+",
". . y+<+z+f+A+g+B+i+j+k+l+m+C+n+o+D+E+U F+G+H+r+I+J+K+L+M+N+w+x+",
"O+P+Q+R+z+f+S+q B+T+U+V+W+X+Y+Z+`+ @E+U .@G+H++@I+@@#@L+M+$@%@&@",
"*@=@-@;@>@,@'@)@!@~@U+{@]@^@Y+/@(@ @_@:@.@<@[@}@|@1@#@2@M+$@%@3@"};
......@@ -37,7 +37,7 @@
#include "core/common/WSegmentationFault.h"
#include "qt4/WQt4Gui.h"
#include "WVersion.h" // NOTE: this file is auto-generated by CMAKE
#include "core/WVersion.h" // NOTE: this file is auto-generated by CMAKE
/**
* \mainpage OpenWalnut Inline Documentation
......
......@@ -52,7 +52,7 @@
#include <QtWebKit/QWebView>
#endif
#include "WVersion.h" // NOTE: this file is auto-generated by CMAKE
#include "core/WVersion.h" // NOTE: this file is auto-generated by CMAKE
#include "../icons/WIcons.xpm"
#include "controlPanel/WPropertyBoolWidget.h"
......@@ -135,6 +135,10 @@ void WMainWindow::setupGUI()
"Auto-Display",
"If enabled, the best matching module is automatically added if some data was loaded.",
true );
m_sliderMinMaxEditSetting = new WSettingAction( this, std::string( "qt4gui/" ) + std::string( "sliderMinMaxEdit" ),
"Slider Min/Max Editing",
"If enabled, the maximum and minimum values of slider can be edited.",
false );
WSettingAction* mtViews = new WSettingAction( this, "qt4gui/ge/multiThreadedViewer",
"Multi-Threaded Views",
......@@ -348,6 +352,7 @@ void WMainWindow::setupGUI()
m_settingsAction = new QAction( "Settings", this );
m_settingsMenu = m_menuBar->addMenu( "Settings" );
m_settingsMenu->addAction( m_autoDisplaySetting );
m_settingsMenu->addAction( m_sliderMinMaxEditSetting );
m_settingsMenu->addAction( m_controlPanel->getModuleConfig().getConfigureAction() );
m_settingsMenu->addSeparator();
m_settingsMenu->addAction( mtViews );
......
......@@ -442,6 +442,11 @@ private:
WSettingAction* m_autoDisplaySetting;
/**
* The action for allowing editing min and max of sliders.
*/
WSettingAction* m_sliderMinMaxEditSetting;
/**
* Called whenever a async load has finished. Used by \ref asyncProjectLoad. It might be called from outside the GUI thread.
*
* \param file the filename
......
......@@ -22,34 +22,58 @@
//
//---------------------------------------------------------------------------
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>
#include <iostream>
#include <string>
#include <QtGui/QInputDialog>
#include "../WGuiConsts.h"
#include "../WQt4Gui.h"
#include "../guiElements/WQtIntervalEdit.h"
#include "core/common/WLogger.h"
#include "core/common/WPropertyVariable.h"
#include "../WGuiConsts.h"
#include "WPropertyDoubleWidget.h"
#include "WPropertyDoubleWidget.moc"
int WPropertyDoubleWidget::SliderResolution = 10000;
WPropertyDoubleWidget::WPropertyDoubleWidget( WPropDouble property, QGridLayout* propertyGrid, QWidget* parent ):
WPropertyWidget( property, propertyGrid, parent ),
m_doubleProperty( property ),
m_integralProperty( property ),
m_slider( Qt::Horizontal, &m_parameterWidgets ),
m_edit( &m_parameterWidgets ),
m_layout( &m_parameterWidgets ),
m_layout(),
m_vLayout( &m_parameterWidgets ),
m_asText( &m_informationWidgets ),
m_infoLayout( &m_informationWidgets )
m_infoLayout( &m_informationWidgets ),
m_intervalEdit( &m_parameterWidgets )
{
// layout both against each other
m_layout.addWidget( &m_slider );
m_layout.addWidget( &m_edit );
m_layout.setMargin( WGLOBAL_MARGIN );
m_layout.setSpacing( WGLOBAL_SPACING );
m_vLayout.setMargin( WGLOBAL_MARGIN );
m_vLayout.setSpacing( WGLOBAL_SPACING );
m_parameterWidgets.setLayout( &m_layout );
// add the m_layout to the vlayout
QWidget* layoutContainer = new QWidget();
layoutContainer->setLayout( &m_layout );
m_vLayout.addWidget( layoutContainer );
// configure the interval edit
m_vLayout.addWidget( &m_intervalEdit );
if( !WQt4Gui::getSettings().value( "qt4gui/sliderMinMaxEdit", false ).toBool() )
{
m_intervalEdit.hide();
}
m_parameterWidgets.setLayout( &m_vLayout );
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
m_infoLayout.addWidget( &m_asText );
......@@ -65,6 +89,8 @@ WPropertyDoubleWidget::WPropertyDoubleWidget( WPropDouble property, QGridLayout*
connect( &m_slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderChanged( int ) ) );
connect( &m_edit, SIGNAL( editingFinished() ), this, SLOT( editChanged() ) );
connect( &m_edit, SIGNAL( textEdited( const QString& ) ), this, SLOT( textEdited( const QString& ) ) );
connect( &m_intervalEdit, SIGNAL( minimumChanged() ), this, SLOT( minMaxUpdated() ) );
connect( &m_intervalEdit, SIGNAL( maximumChanged() ), this, SLOT( minMaxUpdated() ) );
}
WPropertyDoubleWidget::~WPropertyDoubleWidget()
......@@ -77,52 +103,60 @@ void WPropertyDoubleWidget::update()
// // calculate maximum size of the text widget.
// // XXX: this is not the optimal way but works for now
// NO, it doesn't work on Mac OS X: You won't be able to any digits in it!, So I reset it to default which should work on other platforms too
QString valStr = QString::number( m_doubleProperty->get() );
QString valStr = QString::number( m_integralProperty->get() );
m_edit.setText( valStr );
// get the min constraint
WPVDouble::PropertyConstraintMin minC = m_doubleProperty->getMin();
WPVDouble::PropertyConstraintMax maxC = m_doubleProperty->getMax();
WPVDouble::PropertyConstraintMin minC = m_integralProperty->getMin();
WPVDouble::PropertyConstraintMax maxC = m_integralProperty->getMax();
bool minMaxConstrained = minC && maxC;
if( minMaxConstrained )
{
// setup the slider
m_slider.setMinimum( 0 );
m_slider.setMaximum( 100 );
m_min = minC->getMin();
m_max = maxC->getMax();
m_slider.setMaximum( SliderResolution );
// update the interval edit too
m_intervalEdit.setAllowedMin( minC->getMin() );
m_intervalEdit.setAllowedMax( maxC->getMax() );
m_min = m_intervalEdit.getMin();
m_max = m_intervalEdit.getMax();
// updating the interval edit causes the proper values to be set in m_min and m_max
m_slider.setHidden( false );
m_slider.setValue( toPercent( m_doubleProperty->get() ) );
m_intervalEdit.setHidden( !WQt4Gui::getSettings().value( "qt4gui/sliderMinMaxEdit", false ).toBool() );
m_slider.setValue( toSliderValue( m_integralProperty->get() ) );
}
else
{
m_slider.setHidden( true );
m_intervalEdit.setHidden( true );
}
// do not forget to update the label
m_asText.setText( valStr );
}
int WPropertyDoubleWidget::toPercent( double value )
int WPropertyDoubleWidget::toSliderValue( double value )
{
return 100.0 * ( ( value - m_min ) / ( m_max - m_min ) );
int perc = static_cast< double >( SliderResolution ) * ( ( value - m_min ) / ( m_max - m_min ) );
return std::min( std::max( perc, 0 ), SliderResolution );
}
double WPropertyDoubleWidget::fromPercent( int perc )
double WPropertyDoubleWidget::fromSliderValue( int perc )
{
return ( static_cast< double >( perc ) / 100.0 ) * ( m_max - m_min ) + m_min;
return ( static_cast< double >( perc ) / static_cast< double >( SliderResolution ) ) * ( m_max - m_min ) + m_min;
}
void WPropertyDoubleWidget::sliderChanged( int value )
{
if( !m_slider.isHidden() && toPercent( m_doubleProperty->get() ) != value )
if( !m_slider.isHidden() && toSliderValue( m_integralProperty->get() ) != value )
{
// set to the property
invalidate( !m_doubleProperty->set( fromPercent( value ) ) ); // NOTE: set automatically checks the validity of the value
invalidate( !m_integralProperty->set( fromSliderValue( value ) ) ); // NOTE: set automatically checks the validity of the value
// set the value in the line edit
m_edit.setText( QString::number( m_doubleProperty->get() ) );
m_edit.setText( QString::number( m_integralProperty->get() ) );
}
}
......@@ -138,10 +172,10 @@ void WPropertyDoubleWidget::editChanged()
return;
}
// set to the property
invalidate( !m_doubleProperty->set( value ) ); // NOTE: set automatically checks the validity of the value
invalidate( !m_integralProperty->set( value ) ); // NOTE: set automatically checks the validity of the value
// update slider
m_slider.setValue( toPercent( value ) );
m_slider.setValue( toSliderValue( value ) );
}
void WPropertyDoubleWidget::textEdited( const QString& text )
......@@ -157,6 +191,23 @@ void WPropertyDoubleWidget::textEdited( const QString& text )
}
// simply check validity
invalidate( !m_doubleProperty->accept( value ) );
invalidate( !m_integralProperty->accept( value ) );
}
void WPropertyDoubleWidget::minMaxUpdated()
{
m_min = m_intervalEdit.getMin();
m_max = m_intervalEdit.getMax();
if( m_min > m_integralProperty->get() )
{
m_integralProperty->set( m_min );
}
if( m_max < m_integralProperty->get() )
{
m_integralProperty->set( m_max );
}
m_slider.setValue( toSliderValue( m_integralProperty->get() ) );
}
......@@ -30,7 +30,9 @@
#include <QtGui/QLineEdit>
#include <QtGui/QSlider>
#include <QtGui/QHBoxLayout>
#include <QtGui/QToolButton>
#include "../guiElements/WQtIntervalEdit.h"
#include "WPropertyWidget.h"
/**
......@@ -61,9 +63,9 @@ protected:
virtual void update();
/**
* The integer property represented by this widget.
* The property represented by this widget.
*/
WPropDouble m_doubleProperty;
WPropDouble m_integralProperty;
/**
* The slider allowing modification of the integer value
......@@ -81,22 +83,27 @@ protected:
QHBoxLayout m_layout;
/**
* Converts a given value to a percentage between m_min and m_max.
* Layout used to combine the property widgets with the WQtIntervalEdit.
*/
QVBoxLayout m_vLayout;
/**
* Converts a given value to a slider value between m_min and m_max.
*
* \param value the value.
*
* \return the percentage.
*/
int toPercent( double value );
int toSliderValue( double value );
/**
* Converts the given percentage to the real double value using m_min and m_max.
* Converts the given slider value to the real double value using m_min and m_max.
*
* \param perc the percentage.
*