25 #define YUILogComponent "qt-ui"
26 #include <yui/YUILog.h>
30 #include <yui/YEvent.h>
31 #include "YQWidgetFactory.h"
32 #include "YQOptionalWidgetFactory.h"
33 #include "YQPartitionSplitter.h"
34 #include "YQLayoutBox.h"
35 #include "YQBarGraph.h"
36 #include "YQIntField.h"
38 #include "YQSignalBlocker.h"
47 const std::string & usedLabel,
48 const std::string & freeLabel,
49 const std::string & newPartLabel,
50 const std::string & freeFieldLabel,
51 const std::string & newPartFieldLabel )
52 : QWidget( (QWidget *) parent->widgetRep() )
53 , YPartitionSplitter( parent,
67 , _freeSizeSlider( 0 )
73 setChildrenManager(
new YSingleWidgetChildManager(
this ) );
79 _vbox = YUI::widgetFactory()->createVBox(
this );
80 _barGraph =
dynamic_cast<YQBarGraph *
> ( YUI::optionalWidgetFactory()->createBarGraph( _vbox ) );
81 YUI_CHECK_PTR( _barGraph );
83 int freeSize = totalFreeSize - newPartSize;
86 YBarGraphMultiUpdate multiUpdate( _barGraph );
88 _barGraph->addSegment( YBarGraphSegment( usedSize, usedLabel ) );
89 _barGraph->addSegment( YBarGraphSegment( freeSize, freeLabel ) );
90 _barGraph->addSegment( YBarGraphSegment( newPartSize, newPartLabel) );
93 _hbox = YUI::widgetFactory()->createHBox( _vbox );
95 _freeSizeSlider =
new YQSlider( _hbox, freeFieldLabel,
96 minFreeSize, maxFreeSize(), freeSize,
98 YUI_CHECK_PTR( _freeSizeSlider );
99 _freeSizeSlider->setStretchable( YD_HORIZ,
true );
101 _newPartField =
new YQIntField( _hbox, newPartFieldLabel,
102 minNewSize, maxNewPartSize(), newPartSize );
103 YUI_CHECK_PTR( _newPartField );
104 _newPartField->setStretchable( YD_HORIZ,
false );
109 connect( _newPartField, &pclass(_newPartField)::valueChanged,
112 connect( _freeSizeSlider, &pclass(_freeSizeSlider)::valueChanged,
128 YWidget::setEnabled( enabled );
134 return _vbox->preferredWidth();
140 return _vbox->preferredHeight();
146 QWidget::resize( newWidth, newHeight );
147 _vbox->setSize ( newWidth, newHeight );
153 YUI_CHECK_PTR( _newPartField );
155 return _newPartField->
value();
161 YUI_CHECK_PTR( _barGraph );
162 YUI_CHECK_PTR( _freeSizeSlider );
163 YUI_CHECK_PTR( _newPartField );
169 _newPartField->setValue( newValue );
171 int freeSize = totalFreeSize() - newValue;
172 _freeSizeSlider->setValue( freeSize );
174 YBarGraphMultiUpdate multiUpdate( _barGraph );
176 _barGraph->setValue( freeSegment, freeSize );
177 _barGraph->setValue( newPartSegment, newValue );
184 int newPartSize = totalFreeSize() - newFreeSize;
210 #include "YQPartitionSplitter.moc"