[yast-commit] r41959 - in /branches/tmp/sh/mod-ui/qt/src: YQPartitionSplitter.cc YQPartitionSplitter.h YQSlider.cc YQSlider.h
Author: sh-sh-sh Date: Sun Nov 11 02:42:36 2007 New Revision: 41959 URL: http://svn.opensuse.org/viewcvs/yast?rev=41959&view=rev Log: intuitive slider direction Modified: branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h branches/tmp/sh/mod-ui/qt/src/YQSlider.cc branches/tmp/sh/mod-ui/qt/src/YQSlider.h Modified: branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc?rev=41959&r1=41958&r2=41959&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc (original) +++ branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc Sun Nov 11 02:42:36 2007 @@ -59,8 +59,8 @@ , _vbox( 0 ) , _barGraph( 0 ) , _hbox( 0 ) - , _freeSizeField( 0 ) - , _newPartSlider( 0 ) + , _freeSizeSlider( 0 ) + , _newPartField( 0 ) { setWidgetRep( this ); @@ -87,25 +87,24 @@ _hbox = YUI::widgetFactory()->createHBox( _vbox ); - _freeSizeField = dynamic_cast<YQIntField *> - ( YUI::widgetFactory()->createIntField( _hbox, freeFieldLabel, - minFreeSize, maxFreeSize(), freeSize) ); - YUI_CHECK_PTR( _freeSizeField ); - _freeSizeField->setStretchable( YD_HORIZ, false ); - - _newPartSlider = dynamic_cast<YQSlider *> - ( YUI::optionalWidgetFactory()->createSlider( _hbox, newPartFieldLabel, - minNewSize, maxNewPartSize(), newPartSize ) ); - YUI_CHECK_PTR( _newPartSlider ); - _newPartSlider->setStretchable( YD_HORIZ, true ); + _freeSizeSlider = new YQSlider( _hbox, freeFieldLabel, + minFreeSize, maxFreeSize(), freeSize, + true ); // reverseLayout (put QSpinBox left of QSlider) + YUI_CHECK_PTR( _freeSizeSlider ); + _freeSizeSlider->setStretchable( YD_HORIZ, true ); + + _newPartField = new YQIntField( _hbox, newPartFieldLabel, + minNewSize, maxNewPartSize(), newPartSize ); + YUI_CHECK_PTR( _newPartField ); + _newPartField->setStretchable( YD_HORIZ, false ); // Connect signals - connect( _newPartSlider, SIGNAL( valueChanged (int) ), + connect( _newPartField, SIGNAL( valueChanged (int) ), this, SLOT ( setNewPartSizeSlot(int) ) ); - connect( _freeSizeField, SIGNAL( valueChanged (int) ), + connect( _freeSizeSlider, SIGNAL( valueChanged (int) ), this, SLOT ( setFreeSizeSlot(int) ) ); } @@ -118,8 +117,8 @@ void YQPartitionSplitter::setEnabled( bool enabled ) { - _freeSizeField->setEnabled ( enabled ); - _newPartSlider->setEnabled ( enabled ); + _freeSizeSlider->setEnabled( enabled ); + _newPartField->setEnabled ( enabled ); YWidget::setEnabled( enabled ); } @@ -146,26 +145,26 @@ int YQPartitionSplitter::value() { - YUI_CHECK_PTR( _newPartSlider ); + YUI_CHECK_PTR( _newPartField ); - return _newPartSlider->value(); + return _newPartField->value(); } void YQPartitionSplitter::setValue( int newValue ) { - YUI_CHECK_PTR( _barGraph ); - YUI_CHECK_PTR( _freeSizeField ); - YUI_CHECK_PTR( _newPartSlider ); + YUI_CHECK_PTR( _barGraph ); + YUI_CHECK_PTR( _freeSizeSlider ); + YUI_CHECK_PTR( _newPartField ); - YQSignalBlocker sigBlocker1( _barGraph ); - YQSignalBlocker sigBlocker2( _freeSizeField ); - YQSignalBlocker sigBlocker3( _newPartSlider ); + YQSignalBlocker sigBlocker1( _barGraph ); + YQSignalBlocker sigBlocker2( _freeSizeSlider ); + YQSignalBlocker sigBlocker3( _newPartField ); - _newPartSlider->setValue( newValue ); + _newPartField->setValue( newValue ); int freeSize = totalFreeSize() - newValue; - _freeSizeField->setValue ( freeSize ); + _freeSizeSlider->setValue( freeSize ); YBarGraphMultiUpdate multiUpdate( _barGraph ); { @@ -197,7 +196,7 @@ bool YQPartitionSplitter::setKeyboardFocus() { - _newPartSlider->setKeyboardFocus(); + _newPartField->setKeyboardFocus(); return true; } Modified: branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h?rev=41959&r1=41958&r2=41959&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h (original) +++ branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h Sun Nov 11 02:42:36 2007 @@ -132,8 +132,8 @@ YLayoutBox * _vbox; YQBarGraph * _barGraph; YLayoutBox * _hbox; - YQIntField * _freeSizeField; - YQSlider * _newPartSlider; + YQSlider * _freeSizeSlider; + YQIntField * _newPartField; }; Modified: branches/tmp/sh/mod-ui/qt/src/YQSlider.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSlider.cc?rev=41959&r1=41958&r2=41959&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQSlider.cc (original) +++ branches/tmp/sh/mod-ui/qt/src/YQSlider.cc Sun Nov 11 02:42:36 2007 @@ -37,7 +37,8 @@ const string & label, int minValue, int maxValue, - int initialValue ) + int initialValue, + bool reverseLayout ) : QVBox( (QWidget *) parent->widgetRep() ) , YSlider( parent, label, minValue, maxValue ) @@ -50,22 +51,34 @@ _caption = new YQWidgetCaption( this, toUTF8( label ) ); YUI_CHECK_NEW( _caption ); - _caption->setAlignment( Qt::AlignRight ); - _hbox = new QHBox( this ); YUI_CHECK_NEW( _hbox ); _hbox->setSpacing( YQWidgetSpacing ); + if ( reverseLayout ) + { + _qt_spinBox = new QSpinBox( minValue, maxValue, + 1, // step + _hbox ); + } + else + { + _caption->setAlignment( Qt::AlignRight ); + } + _qt_slider = new QSlider( minValue, maxValue, 1, // pageStep initialValue, QSlider::Horizontal, _hbox ); YUI_CHECK_NEW( _qt_slider ); - _qt_spinBox = new QSpinBox( minValue, maxValue, - 1, // step - _hbox ); + if ( ! reverseLayout ) + { + _qt_spinBox = new QSpinBox( minValue, maxValue, + 1, // step + _hbox ); + } YUI_CHECK_NEW( _qt_spinBox ); _qt_spinBox->setValue( initialValue ); Modified: branches/tmp/sh/mod-ui/qt/src/YQSlider.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSlider.h?rev=41959&r1=41958&r2=41959&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQSlider.h (original) +++ branches/tmp/sh/mod-ui/qt/src/YQSlider.h Sun Nov 11 02:42:36 2007 @@ -37,12 +37,15 @@ /** * Constructor. + * + * 'reverseLayout' creates the QSpinBox to the left and the QSlider to the right. **/ YQSlider( YWidget * parent, const string & label, int minValue, int maxValue, - int initialValue ); + int initialValue, + bool reverseLayout = false ); /** * Destructor. -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
sh-sh-sh@svn.opensuse.org