Author: sh-sh-sh
Date: Fri Nov 9 16:07:11 2007
New Revision: 41934
URL: http://svn.opensuse.org/viewcvs/yast?rev=41934&view=rev
Log:
ported YQBarGraph
Added:
branches/tmp/sh/mod-ui/core/libyui/src/YColor.h
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am
branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.cc
branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.h
branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h
branches/tmp/sh/mod-ui/core/libyui/src/YContainerWidget.h
branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc
branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc
branches/tmp/sh/mod-ui/qt/src/YQBarGraph.cc
branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h
branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc
branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h
branches/tmp/sh/mod-ui/qt/src/YQUI.h
branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog Fri Nov 9 16:07:11 2007
@@ -404,3 +404,17 @@
* Renamed YTime -> YTimeField
* Renamed YDate -> YDateField
+
+* Ported YTimeField
+* Ported YDateField
+
+
+2007-11-06 sh@suse.de
+
+* Ported default function key handling
+
+
+2007-11-09 sh@suse.de
+
+* Ported YBarGraph
+
Modified: branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am Fri Nov 9 16:07:11 2007
@@ -98,6 +98,7 @@
Y2CCUI.h \
YApplication.h \
YBothDim.h \
+ YColor.h \
YCPDialogParser.h \
YCPItem.h \
YCPItemParser.h \
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.cc Fri Nov 9 16:07:11 2007
@@ -20,25 +20,241 @@
#include
#define y2log_component "ui"
-#include
#include
-#include
-#include
-#include
-#include
-#include
#include "YUISymbols.h"
#include "YBarGraph.h"
+#define CHECK_INDEX(index) \
+ do \
+ { \
+ if ( (index) < 0 || \
+ (index) >= (int) priv->segments.size() ) \
+ { \
+ YUI_THROW( YUIIndexOutOfRangeException( \
+ (index), /* current */ \
+ 0, /* min */ \
+ (int) priv->segments.size() - 1 ) ); /* max */ \
+ } \
+ } while( 0 )
+
+
+
+struct YBarGraphPrivate
+{
+ YBarGraphPrivate()
+ : updatesPending( false )
+ , postponeUpdates( false )
+ {}
+
+ vector<YBarGraphSegment> segments;
+ bool updatesPending;
+ bool postponeUpdates;
+};
+
+
-YBarGraph::YBarGraph( const YWidgetOpt & opt )
- :YWidget( opt )
+
+YBarGraph::YBarGraph( YWidget * parent )
+ :YWidget( parent )
+ , priv( new YBarGraphPrivate() )
{
+ YUI_CHECK_NEW( priv );
setDefaultStretchable( YD_HORIZ, true );
}
+YBarGraph::~YBarGraph()
+{
+ // NOP
+}
+
+
+void
+YBarGraph::updateDisplay()
+{
+ priv->updatesPending = true;
+
+ if ( ! priv->postponeUpdates )
+ {
+ doUpdate();
+ priv->updatesPending = false;
+ }
+}
+
+
+void
+YBarGraph::addSegment( const YBarGraphSegment & segment )
+{
+ priv->segments.push_back( segment );
+ updateDisplay();
+}
+
+
+void
+YBarGraph::deleteAllSegments()
+{
+ priv->segments.clear();
+ updateDisplay();
+}
+
+
+const YBarGraphSegment &
+YBarGraph::segment( int segmentIndex ) const
+{
+ CHECK_INDEX( segmentIndex );
+
+ return priv->segments[ segmentIndex ];
+}
+
+
+int
+YBarGraph::segments()
+{
+ return (int) priv->segments.size();
+}
+
+
+void
+YBarGraph::setValue( int segmentIndex, int newValue )
+{
+ CHECK_INDEX( segmentIndex );
+
+ priv->segments[ segmentIndex ].setValue( newValue );
+ updateDisplay();
+}
+
+
+void
+YBarGraph::setLabel( int segmentIndex, const string & newLabel )
+{
+ CHECK_INDEX( segmentIndex );
+
+ priv->segments[ segmentIndex ].setLabel( newLabel );
+ updateDisplay();
+}
+
+
+void
+YBarGraph::setSegmentColor( int segmentIndex, const YColor & color )
+{
+ CHECK_INDEX( segmentIndex );
+
+ if ( color.isUndefined() )
+ YUI_THROW( YUIException( "Invalid YColor" ) );
+
+ priv->segments[ segmentIndex ].setSegmentColor( color );
+ updateDisplay();
+}
+
+
+void
+YBarGraph::setTextColor( int segmentIndex, const YColor & color )
+{
+ CHECK_INDEX( segmentIndex );
+
+ if ( color.isUndefined() )
+ YUI_THROW( YUIException( "Invalid YColor" ) );
+
+ priv->segments[ segmentIndex ].setTextColor( color );
+ updateDisplay();
+}
+
+
+const YPropertySet &
+YBarGraph::propertySet()
+{
+ static YPropertySet propSet;
+
+ if ( propSet.isEmpty() )
+ {
+ /*
+ * @property list<integer> Values The numerical value for each segment.
+ * @property list<string> Labels Text label for each segment ('\n' allowed).
+ * Use %1 as a placeholder for the current value.
+ */
+ propSet.add( YProperty( YUIProperty_Values, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_Labels, YOtherProperty ) );
+ propSet.add( YWidget::propertySet() );
+ }
+
+ return propSet;
+}
+
+
+bool
+YBarGraph::setProperty( const string & propertyName, const YPropertyValue & val )
+{
+ propertySet().check( propertyName, val.type() ); // throws exceptions if not found or type mismatch
+
+ if ( propertyName == YUIProperty_Values ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_Labels ) return false; // Needs special handling
+ else
+ {
+ YWidget::setProperty( propertyName, val );
+ }
+
+ return true; // success -- no special handling necessary
+}
+
+
+YPropertyValue
+YBarGraph::getProperty( const string & propertyName )
+{
+ propertySet().check( propertyName ); // throws exceptions if not found
+
+ if ( propertyName == YUIProperty_Values ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_Labels ) return YPropertyValue( YOtherProperty );
+ else
+ {
+ return YWidget::getProperty( propertyName );
+ }
+}
+
+
+
+
+YBarGraphMultiUpdate::YBarGraphMultiUpdate( YBarGraph * barGraph )
+ : _barGraph ( barGraph )
+{
+ YUI_CHECK_PTR( barGraph );
+
+ _barGraph->priv->postponeUpdates = true;
+}
+
+
+YBarGraphMultiUpdate::~YBarGraphMultiUpdate()
+{
+ _barGraph->priv->postponeUpdates = false;
+
+ if ( _barGraph->priv->updatesPending )
+ _barGraph->updateDisplay();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#if 0
+
+
+
YCPValue YBarGraph::changeWidget( const YCPSymbol & property, const YCPValue & newValue )
{
string s = property->symbol();
@@ -90,57 +306,6 @@
}
-int YBarGraph::segments()
-{
- return _values.size();
-}
-
-
-int YBarGraph::value( int n )
-{
- if ( n >= 0 && n < (int) _values.size() )
- {
- return _values[n];
- }
- else
- {
- y2error( "YBarGraph::value(): Invalid index %d ( 0 <= n <= %zd",
- n, _values.size() );
-
- return -1;
- }
-}
-
-
-string YBarGraph::label( int n )
-{
- if ( n >= 0 && n < (int) _labels.size() )
- {
- return _labels[n];
- }
- else
- {
- if ( n >= 0 && n < (int) _values.size() )
- {
- // If an existing segment doesn't have a label, use its value
- // as fallback
-
- char buffer[ 20 ];
- sprintf( buffer, "%d", _values[n] );
-
- return string( buffer );
- }
- else
- {
- y2error( "YBarGraph::label(): Invalid index %d ( 0 <= n <= %zd",
- n, _labels.size() );
- }
-
- return string();
- }
-}
-
-
void YBarGraph::parseValuesList( const YCPList & newVal )
{
@@ -207,13 +372,4 @@
}
-/*
- * Default update method - does nothing.
- * Overwrite this to do the actual visual update.
- */
-
-void YBarGraph::doUpdate()
-{
- // NOP
-}
-
+#endif
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.h?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YBarGraph.h Fri Nov 9 16:07:11 2007
@@ -19,73 +19,295 @@
#ifndef YBarGraph_h
#define YBarGraph_h
-#include
#include "YWidget.h"
+#include "YColor.h"
+
+
+class YBarGraphPrivate;
+class YBarGraphSegment;
class YBarGraph : public YWidget
{
+ friend class YBarGraphMultiUpdate;
+
protected:
/**
- * Constructor
+ * Constructor.
**/
- YBarGraph( const YWidgetOpt & opt );
-
+ YBarGraph( YWidget * parent );
public:
/**
- * Returns a descriptive name of this widget class for logging,
+ * Destructor.
+ **/
+ virtual ~YBarGraph();
+
+ /**
+ * Return a descriptive name of this widget class for logging,
* debugging etc.
**/
virtual const char * widgetClass() const { return "YBarGraph"; }
/**
- * Returns the current number of bar segments, i.e. the nuber of values.
+ * Add one segment.
+ *
+ * If the segment's background and text colors are not explicitly
+ * specified, the YBarGraph widget will assign them from a list of (at
+ * least 5 different) color sets.
+ *
+ * When adding multiple segments, use a YBarGraphMultiUpdate object for
+ * improved performance to hold back display updates until all segments are
+ * added.
+ **/
+ void addSegment( const YBarGraphSegment & segment );
+
+ /**
+ * Delete all segments.
+ **/
+ void deleteAllSegments();
+
+ /**
+ * Return the current number of segments.
**/
int segments();
/**
- * Returns the value of segment no. n
- * or -1 if there are not that many segments.
+ * Return the segment with the specified index (from 0 on).
+ *
+ * This will throw an exception if there are not this many segments.
+ **/
+ const YBarGraphSegment & segment( int segmentIndex ) const;
+
+ /**
+ * Set the value of the segment with the specifie index (from 0 on).
+ *
+ * This will throw an exception if there are not this many segments.
+ *
+ * Note: Use a YBarGraphMultiUpdate object for improved performance
+ * when doing multiple changes at the same time.
**/
- int value( int n );
+ void setValue( int segmentIndex, int newValue );
/**
- * Returns the label of segment no. n
- * or an empty string if there are not that many segments
- * or the specified segment doesn't have a label.
+ * Set the label of the segment with the specified index (from 0 on).
+ * Use %1 as a placeholder for the current value.
+ *
+ * This will throw an exception if there are not this many segments.
+ *
+ * Note: Use a YBarGraphMultiUpdate object for improved performance
+ * when doing multiple changes at the same time.
**/
- string label( int n );
+ void setLabel( int segmentIndex, const string & newLabel );
/**
- * Parse and store new values.
+ * Set the background color of the segment with the specified index
+ * (from 0 on).
+ *
+ * This will throw an exception if there are not this many segments
+ * or if the color is undefined.
**/
- void parseValuesList( const YCPList & newValues );
+ void setSegmentColor( int segmentIndex, const YColor & color );
+ /**
+ * Set the text color of the segment with the specified index
+ * (from 0 on).
+ *
+ * This will throw an exception if there are not this many segments
+ * or if the color is undefined.
+ **/
+ void setTextColor( int segmentIndex, const YColor & color );
+
+ /**
+ * Set a property.
+ * Reimplemented from YWidget.
+ *
+ * This function may throw YUIPropertyExceptions.
+ *
+ * This function returns 'true' if the value was successfully set and
+ * 'false' if that value requires special handling (not in error cases:
+ * those are covered by exceptions).
+ **/
+ virtual bool setProperty( const string & propertyName,
+ const YPropertyValue & val );
/**
- * Parse and store new labels.
+ * Get a property.
+ * Reimplemented from YWidget.
+ *
+ * This method may throw YUIPropertyExceptions.
**/
- void parseLabelsList( const YCPList & newLabels );
+ virtual YPropertyValue getProperty( const string & propertyName );
/**
- * Perform a display update after values and/or labels have changed.
- * Overwrite this method and do your actual drawing here.
+ * Return this class's property set.
+ * This also initializes the property upon the first call.
+ *
+ * Reimplemented from YWidget.
**/
- virtual void doUpdate();
+ virtual const YPropertySet & propertySet();
+
protected:
+ /**
+ * Perform a display update after any change to any of the segments.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual void doUpdate() = 0;
+
private:
+ /**
+ * Conditionally perform display update if not currently postponed.
+ **/
+ void updateDisplay();
+
+ ImplPtr<YBarGraphPrivate> priv;
+};
+
+
+
+
+/**
+ * Helper class to describe one segment of a YBarGraph.
+ **/
+class YBarGraphSegment
+{
+public:
+ /**
+ * Constructor.
+ *
+ * 'value' is the initial value of this segment.
+ *
+ * 'label' is the label text in the segment.
+ * Use %1 as a placeholder for the current value.
+ *
+ * 'segmentColor' is the background color of this segment.
+ *
+ * 'textColor' is the color for the label text.
+ *
+ * The YBarGraph widget will automatically assign some default colors (one
+ * of at least 5 different ones) if none are specified.
+ **/
+ YBarGraphSegment( int value = 0,
+ const string & label = string(),
+ const YColor & segmentColor = YColor(),
+ const YColor & textColor = YColor() )
+ : _value( value )
+ , _label( label )
+ , _segmentColor( segmentColor )
+ , _textColor( textColor )
+ {}
/**
- * Set specific widget properties.
- * Inherited from YWidget.
+ * Return the current value of this segment.
**/
- YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newValue );
+ int value() const { return _value; }
+
+ /**
+ * Set the value of this segment.
+ **/
+ void setValue( int newValue ) { _value = newValue; }
+
+ /**
+ * Return the current text label of this segment.
+ * Any %1 placeholder will be returned as %1 (not expanded).
+ **/
+ string label() const { return _label; }
+
+ /**
+ * Set the text label of this segment.
+ * Use %1 as a placeholder for the current value.
+ **/
+ void setLabel( const string & newLabel ) { _label = newLabel; }
+
+ /**
+ * Return the segment background color.
+ **/
+ YColor segmentColor() const { return _segmentColor; }
+
+ /**
+ * Return 'true' if this segment's background color is defined,
+ * i.e. it has a real RGB value and was not just created with the default
+ * constructor.
+ **/
+ bool hasSegmentColor() const { return _segmentColor.isDefined(); }
+
+ /**
+ * Set this segment's background color.
+ **/
+ void setSegmentColor( const YColor & color ) { _segmentColor = color; }
+
+ /**
+ * Return this segment's text color.
+ **/
+ YColor textColor() const { return _textColor; }
+
+ /**
+ * Return 'true' if this segment's text color is defined,
+ * i.e. it has a real RGB value and was not just created with the default
+ * constructor.
+ **/
+ bool hasTextColor() const { return _textColor.isDefined(); }
+
+ /**
+ * Set this segment's text color.
+ **/
+ void setTextColor( const YColor & color ) { _textColor = color; }
+
+
+private:
+
+ int _value;
+ string _label;
+ YColor _segmentColor;
+ YColor _textColor;
+};
+
+
+
+/**
+ * Helper class for multiple updates to a YBarGraph widget:
+ * This will hold back display updates until this object goes out of scope.
+ **/
+class YBarGraphMultiUpdate
+{
+public:
+ /**
+ * Constructor.
+ *
+ * This will make the corresponding YBarGraph widget hold back any
+ * pending display updates (due to changed values, labels, or colors) until
+ * this object is destroyed (goes out of scope).
+ *
+ * Create objects of this class on the stack (as local variables) and
+ * simply let them go out of scope.
+ *
+ * Example:
+ *
+ * {
+ * YBarGraphMultiUpdate multiUpdate( myBarGraph );
+ * myBarGraph->setValue( 0, 42 ); // No display update yet
+ * myBarGraph->setValue( 1, 84 ); // No display update yet
+ * myBarGraph->setValue( 2, 21 ); // No display update yet
+ *
+ * } // multiUpdate goes out of scope, will trigger display update now
+ *
+ **/
+ YBarGraphMultiUpdate( YBarGraph * barGraph );
+
+ /**
+ * Destructor.
+ *
+ * This will trigger display updates of the corresponding YBarGraph widget
+ * if any are necessary.
+ **/
+ ~YBarGraphMultiUpdate();
+
+private:
- vector<int> _values;
- vector<string> _labels;
+ YBarGraph * _barGraph;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc Fri Nov 9 16:07:11 2007
@@ -2549,26 +2549,50 @@
}
rejectAllOptions( term,optList );
- YBarGraph *barGraph;
- if ( YUI::ui()->hasBarGraph() )
- {
- barGraph = dynamic_cast ( YUI::ui()->createBarGraph( parent, opt ) );
- assert( barGraph );
+ YBarGraph * barGraph = YUI::optionalWidgetFactory()->createBarGraph( parent );
+ YBarGraphMultiUpdate multiUpdate( barGraph ); // Hold back display updates
+
+ YCPList valuesList = term->value( argnr )->asList();
+ YCPList labelsList;
+
+ if ( numArgs > 1 )
+ labelsList = term->value( argnr+1 )->asList();
- barGraph->parseValuesList( term->value( argnr )->asList() );
+ int segments = valuesList->size();
+
+ if ( labelsList->size() > segments )
+ segments = labelsList->size();
+
+ for ( int i=0; i < segments; i++ )
+ {
+ int value = 0;
- if ( numArgs > 1 )
+ if ( i < valuesList->size() )
{
- barGraph->parseLabelsList( term->value( argnr+1 )->asList() );
+ if ( valuesList->value(i)->isInteger() )
+ value = valuesList->value(i)->asInteger()->value();
+ else
+ {
+ ycperror( "YBarGraph value #%d should be integer, not %s",
+ i, valuesList->value(i)->toString().c_str() );
+ }
}
- barGraph->doUpdate();
- }
- else
- {
- y2error( "This UI does not support the BarGraph widget." );
- return 0;
+ string label;
+
+ if ( i < labelsList->size() )
+ {
+ if ( labelsList->value(i)->isString() )
+ label = labelsList->value(i)->asString()->value();
+ else
+ {
+ ycperror( "YBarGraph label #%d should be integer, not %s",
+ i, labelsList->value(i)->toString().c_str() );
+ }
+ }
+
+ barGraph->addSegment( YBarGraphSegment( value, label ) );
}
return barGraph;
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc Fri Nov 9 16:07:11 2007
@@ -46,6 +46,7 @@
#include "YCPTreeItemWriter.h"
#include "YCPValueWidgetID.h"
+#include "YBarGraph.h"
#include "YCheckBox.h"
#include "YComboBox.h"
#include "YMenuButton.h"
@@ -76,9 +77,14 @@
if ( trySetTableValue ( widget, val ) ) return true;
if ( trySetComboBoxValue ( widget, val ) ) return true;
}
- if ( propertyName == YUIProperty_Values )
+ else if ( propertyName == YUIProperty_Values )
{
if ( trySetMultiProgressMeterValues ( widget, val ) ) return true;
+ if ( trySetBarGraphValues ( widget, val ) ) return true;
+ }
+ else if ( propertyName == YUIProperty_Labels )
+ {
+ if ( trySetBarGraphLabels ( widget, val ) ) return true;
}
else if ( propertyName == YUIProperty_CurrentItem )
{
@@ -149,6 +155,10 @@
val = tryGetTableValue ( widget ); if ( ! val.isNull() ) return val;
val = tryGetComboBoxValue ( widget ); if ( ! val.isNull() ) return val;
}
+ else if ( propertyName == YUIProperty_Values )
+ {
+ val = tryGetBarGraphValues ( widget ); if ( ! val.isNull() ) return val;
+ }
else if ( propertyName == YUIProperty_CurrentItem )
{
val = tryGetSelectionBoxValue ( widget ); if ( ! val.isNull() ) return val;
@@ -184,6 +194,10 @@
val = tryGetTreeItems ( widget ); if ( ! val.isNull() ) return val;
val = tryGetSelectionWidgetItems( widget ); if ( ! val.isNull() ) return val;
}
+ else if ( propertyName == YUIProperty_Labels )
+ {
+ val = tryGetBarGraphLabels ( widget ); if ( ! val.isNull() ) return val;
+ }
y2error( "Can't handle property %s::%s - returning 'nil'",
widget->widgetClass(), propertyName.c_str() );
@@ -651,6 +665,98 @@
}
+bool
+YCPPropertyHandler::trySetBarGraphValues( YWidget * widget, const YCPValue & val )
+{
+ YBarGraph * barGraph = dynamic_cast (widget);
+
+ if ( ! barGraph )
+ return false;
+
+ string msg = "Expected a list of integers";
+
+ if ( ! val->isList() )
+ {
+ YUI_THROW( YUIBadPropertyArgException( YProperty( YUIProperty_Values,
+ YOtherProperty ),
+ widget, msg ) );
+ }
+
+ YBarGraphMultiUpdate multiUpdate( barGraph );
+
+ YCPList valuesList = val->asList();
+
+ for ( int i=0; i < valuesList->size(); i++ )
+ {
+ if ( valuesList->value(i)->isInteger() )
+ {
+ if ( i < barGraph->segments() )
+ barGraph->setValue( i, valuesList->value(i)->asInteger()->value() );
+ else
+ {
+ ycperror( "Ignoring excess BarGraph value #%i (only %d segments!)",
+ i, barGraph->segments() );
+ }
+ }
+ else
+ {
+ YUI_THROW( YUIBadPropertyArgException( YProperty( YUIProperty_Values,
+ YOtherProperty ),
+ widget, msg ) );
+ }
+ }
+
+ return true;
+}
+
+
+bool
+YCPPropertyHandler::trySetBarGraphLabels( YWidget * widget, const YCPValue & val )
+{
+ YBarGraph * barGraph = dynamic_cast (widget);
+
+ if ( ! barGraph )
+ return false;
+
+ string msg = "Expected a list of strings";
+
+ if ( ! val->isList() )
+ {
+ YUI_THROW( YUIBadPropertyArgException( YProperty( YUIProperty_Values,
+ YOtherProperty ),
+ widget, msg ) );
+ }
+
+ YBarGraphMultiUpdate multiUpdate( barGraph );
+
+ YCPList labelsList = val->asList();
+
+ for ( int i=0; i < labelsList->size(); i++ )
+ {
+ if ( labelsList->value(i)->isString() )
+ {
+ if ( i < barGraph->segments() )
+ barGraph->setLabel( i, labelsList->value(i)->asString()->value() );
+ else
+ {
+ ycperror( "Ignoring excess BarGraph label #%i (only %d segments!)",
+ i, barGraph->segments() );
+ }
+ }
+ else
+ {
+ YUI_THROW( YUIBadPropertyArgException( YProperty( YUIProperty_Values,
+ YOtherProperty ),
+ widget, msg ) );
+ }
+ }
+
+ return true;
+}
+
+
+
+
//------------------------------------------------------------------------------
@@ -1050,4 +1156,38 @@
}
+YCPValue
+YCPPropertyHandler::tryGetBarGraphValues( YWidget * widget )
+{
+ YBarGraph * barGraph = dynamic_cast (widget);
+
+ if ( ! barGraph )
+ return YCPNull();
+
+ YCPList result;
+
+ for ( int i=0; i < barGraph->segments(); i++ )
+ result->add( YCPInteger( barGraph->segment(i).value() ) );
+
+ return result;
+}
+
+
+YCPValue
+YCPPropertyHandler::tryGetBarGraphLabels( YWidget * widget )
+{
+ YBarGraph * barGraph = dynamic_cast (widget);
+
+ if ( ! barGraph )
+ return YCPNull();
+
+ YCPList result;
+
+ for ( int i=0; i < barGraph->segments(); i++ )
+ result->add( YCPString( barGraph->segment(i).label() ) );
+
+ return result;
+}
+
+
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h Fri Nov 9 16:07:11 2007
@@ -106,6 +106,8 @@
static bool trySetMultiSelectionBoxSelectedItems ( YWidget * widget, const YCPValue & val );
static bool trySetMultiSelectionBoxCurrentItem ( YWidget * widget, const YCPValue & val );
static bool trySetMultiProgressMeterValues ( YWidget * widget, const YCPValue & val );
+ static bool trySetBarGraphValues ( YWidget * widget, const YCPValue & val );
+ static bool trySetBarGraphLabels ( YWidget * widget, const YCPValue & val );
/**
* All trySet..() functions try to dynamic_cast 'widget' to the expected
@@ -129,6 +131,8 @@
static YCPValue tryGetTreeItems ( YWidget * widget );
static YCPValue tryGetMenuButtonItems ( YWidget * widget );
static YCPValue tryGetSelectionWidgetItems ( YWidget * widget );
+ static YCPValue tryGetBarGraphValues ( YWidget * widget );
+ static YCPValue tryGetBarGraphLabels ( YWidget * widget );
/**
Added: branches/tmp/sh/mod-ui/core/libyui/src/YColor.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YColor.h?rev=41934&view=auto
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YColor.h (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YColor.h Fri Nov 9 16:07:11 2007
@@ -0,0 +1,85 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YColor.h
+
+ Author: Stefan Hundhammer
+
+/-*/
+
+#ifndef YColor_h
+
+typedef unsigned char uchar;
+
+
+/**
+ * Helper class to define an RGB color.
+ **/
+class YColor
+{
+public:
+ /**
+ * Constructor.
+ **/
+ YColor( uchar red, uchar green, uchar blue )
+ : _red ( red )
+ , _green( green )
+ , _blue ( blue )
+ , _undef( false )
+ {}
+
+ /**
+ * Default constructor: Create "undefined" color.
+ **/
+ YColor()
+ : _red( 0 ), _green( 0 ), _blue( 0 )
+ , _undef( true )
+ {}
+
+ /**
+ * Return the red component (0: none, 255: bright red).
+ **/
+ uchar red() const { return _red; }
+
+ /**
+ * Return the green component (0: none, 255: bright green).
+ **/
+ uchar green() const { return _green; }
+
+ /**
+ * Return the blue component (0: none, 255: bright blue).
+ **/
+ uchar blue() const { return _blue; }
+
+ /**
+ * Return 'true' if this color is undefined.
+ **/
+ bool isUndefined() const { return _undef; }
+
+ /**
+ * Return 'true' if this color is defined.
+ **/
+ bool isDefined() const { return ! _undef; }
+
+private:
+
+ uchar _red;
+ uchar _green;
+ uchar _blue;
+
+ bool _undef;
+};
+
+
+#define YColor_h
+
+#endif // YColor_h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YContainerWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YContainerWidget.h?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YContainerWidget.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YContainerWidget.h Fri Nov 9 16:07:11 2007
@@ -19,7 +19,6 @@
#ifndef YContainerWidget_h
#define YContainerWidget_h
-#include
#include "YWidget.h"
/**
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc Fri Nov 9 16:07:11 2007
@@ -135,7 +135,7 @@
}
YBarGraph *
-YOptionalWidgetFactory::createBarGraph( YWidget * parent, const vector<int> & values, const vector<string> & labels )
+YOptionalWidgetFactory::createBarGraph( YWidget * parent )
{
THROW_UNSUPPORTED( "YBarGraph" );
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h Fri Nov 9 16:07:11 2007
@@ -85,7 +85,7 @@
virtual YTimeField * createTimeField ( YWidget * parent, const string & label );
virtual bool hasBarGraph();
- virtual YBarGraph * createBarGraph ( YWidget * parent, const vector<int> & values, const vector<string> & labels );
+ virtual YBarGraph * createBarGraph ( YWidget * parent );
virtual bool hasPatternSelector();
virtual YWidget * createPatternSelector ( YWidget * parent, long modeFlags = 0 );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI.h?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI.h Fri Nov 9 16:07:11 2007
@@ -473,16 +473,6 @@
virtual bool hasDownloadProgress() { return false; }
/**
- * Creates a BarGraph widget.
- *
- * This is a special widget that the UI may or may not support.
- * Overwrite this method at your own discretion.
- * If you do, remember to overwrite the has...() method as well!
- **/
- virtual YWidget * createBarGraph( YWidget *parent, YWidgetOpt & opt );
- virtual bool hasBarGraph() { return false; }
-
- /**
* Creates a DumbTab.
*
* This is a special widget that the UI may or may not support.
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc Fri Nov 9 16:07:11 2007
@@ -85,7 +85,7 @@
string symbol = widget->symbol();
if ( symbol == YUISpecialWidget_DummySpecialWidget ) hasWidget = fact->hasDummySpecialWidget();
- else if ( symbol == YUISpecialWidget_BarGraph ) hasWidget = hasBarGraph();
+ else if ( symbol == YUISpecialWidget_BarGraph ) hasWidget = fact->hasBarGraph();
else if ( symbol == YUISpecialWidget_DumbTab ) hasWidget = hasDumbTab();
else if ( symbol == YUISpecialWidget_DownloadProgress ) hasWidget = hasDownloadProgress();
else if ( symbol == YUISpecialWidget_HMultiProgressMeter ) hasWidget = fact->hasMultiProgressMeter();
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc Fri Nov 9 16:07:11 2007
@@ -20,15 +20,9 @@
#define y2log_component "ui"
#include
-#include
#include "YUI.h"
-#include "YUISymbols.h"
-#include "YLabel.h"
#include "YWidget.h"
-#include "YWidgetFactory.h"
-
-#include "YBarGraph.h"
#include "YDumbTab.h"
#include
@@ -61,14 +55,6 @@
* has...() method as well!
*/
-YWidget * YUI::createBarGraph( YWidget *parent, YWidgetOpt & opt )
-{
- y2error( "Default createBarGraph() method called - "
- "forgot to call HasSpecialWidget()?" );
-
- return 0;
-}
-
YWidget * YUI::createDumbTab( YWidget *parent, YWidgetOpt & opt )
{
Modified: branches/tmp/sh/mod-ui/qt/src/YQBarGraph.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQBarGraph.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQBarGraph.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQBarGraph.cc Fri Nov 9 16:07:11 2007
@@ -20,61 +20,227 @@
#define y2log_component "qt-ui"
#include
+#include <algorithm>
+#include
+#include
+
#include "utf8.h"
#include "YQUI.h"
#include "YQBarGraph.h"
-YQBarGraph::YQBarGraph( QWidget * parent, const YWidgetOpt & opt )
- : QWidget( parent )
- , YBarGraph( opt )
+#define YQBarGraphOuterMargin YQWidgetMargin
+#define YQBarGraphLabelHorizontalMargin 1
+#define YQBarGraphLabelVerticalMargin 2
+#define YQBarGraphMinWidth 80
+#define YQBarGraphMinHeight 30
+
+
+
+YQBarGraph::YQBarGraph( YWidget * parent )
+ : QFrame( (QWidget *) parent->widgetRep() )
+ , YBarGraph( parent )
{
setWidgetRep( this );
- _barGraph = new QY2BarGraph( this );
- _barGraph->move( YQWidgetMargin, YQWidgetMargin );
}
-void YQBarGraph::doUpdate()
+YQBarGraph::~YQBarGraph()
{
- QString msg;
+ // NOP
+}
+
- _barGraph->setSegments( segments() );
+void
+YQBarGraph::doUpdate()
+{
+ QFrame::update(); // triggers drawContents()
+}
+
+
+void
+YQBarGraph::drawContents( QPainter * painter )
+{
+ unsigned nextDefaultColor = 0;
+ int totalWidth = contentsRect().width() - 2*YQBarGraphOuterMargin;
+ int segHeight = contentsRect().height() - 2*YQBarGraphOuterMargin;
+ int x_off = YQBarGraphOuterMargin;
+ int y_off = YQBarGraphOuterMargin;
+ int valueTotal = 0;
for ( int i=0; i < segments(); i++ )
+ valueTotal += segment(i).value();
+
+ if ( valueTotal == 0 ) // Avoid division by zero
+ return;
+
+ for ( int i=0; i < segments(); i++ )
+ {
+ const YBarGraphSegment & seg = segment(i);
+ int segWidth = ( (long) totalWidth * seg.value() ) / valueTotal;
+
+ if ( i == segments()-1 )
+ {
+ // Compensate for rounding errors:
+ // The last segment gets all leftover pixels from the previous ones.
+
+ segWidth = totalWidth - x_off + YQBarGraphOuterMargin;
+ }
+
+
+ //
+ // Fill the segment
+ //
+
+ YColor segmentColor = seg.segmentColor();
+ YColor textColor = seg.textColor();
+
+ if ( segmentColor.isUndefined() || textColor.isUndefined() )
+ {
+ // If any of the colors is undefined, use the next default color
+ // for both so some contrast is ensured.
+
+ segmentColor = defaultSegmentColor( nextDefaultColor );
+ textColor = defaultTextColor ( nextDefaultColor++ );
+ }
+
+ painter->setBrush( QColor( segmentColor.red(),
+ segmentColor.green(),
+ segmentColor.blue() ) );
+ painter->setPen( Qt::NoPen );
+ painter->drawRect( x_off, y_off, segWidth+2, segHeight+2 );
+
+
+ //
+ // Draw the label
+ //
+
+ painter->setPen( Qt::SolidLine );
+ painter->setPen( QColor( textColor.red(),
+ textColor.green(),
+ textColor.blue() ) );
+ QString txt = seg.label();
+
+ if ( txt.contains( "%1" ) )
+ txt = txt.arg( seg.value() ); // substitute variable
+
+ painter->drawText( x_off + YQBarGraphLabelHorizontalMargin,
+ y_off + YQBarGraphLabelVerticalMargin,
+ segWidth - 2 * YQBarGraphLabelHorizontalMargin + 1,
+ segHeight - 2 * YQBarGraphLabelVerticalMargin + 1,
+ AlignCenter, txt );
+
+ // Prepare for the next segment
+
+ x_off += segWidth;
+ }
+}
+
+
+YColor
+YQBarGraph::defaultSegmentColor( unsigned index )
+{
+ switch( index % 8 )
{
- _barGraph->setValue( i, value(i) );
- _barGraph->setLabel( i, fromUTF8( label(i) ) );
+ case 0: return YColor( 0, 0, 128 ); // dark blue
+ case 1: return YColor( 64, 200, 255 ); // medium blue
+ case 2: return YColor( 255, 255, 255 ); // white
+ case 3: return YColor( 0, 153, 153 ); // cadet blue
+ case 4: return YColor( 150, 255, 255 ); // cyan
+ case 5: return YColor( 100, 100, 100 ); // medium grey
+ case 6: return YColor( 0, 200, 100 ); // medium green
+ case 7: return YColor( 0, 100, 76 ); // dark green
}
- _barGraph->update();
+ return YColor( 255, 255, 255 ); // just to make gcc happy
}
-void YQBarGraph::setEnabled( bool enabled )
+YColor
+YQBarGraph::defaultTextColor( unsigned index )
{
- _barGraph->setEnabled( enabled );
+ YColor black = YColor( 0, 0, 0 );
+ YColor white = YColor( 255, 255, 255 );
+
+ switch( index % 8 )
+ {
+ case 0: return white;
+ case 1: return black;
+ case 2: return black;
+ case 3: return black;
+ case 4: return black;
+ case 5: return white;
+ case 6: return black;
+ case 7: return white;
+ }
+
+ return black; // just to make gcc happy
+}
+
+
+void
+YQBarGraph::setEnabled( bool enabled )
+{
+ QFrame::setEnabled( enabled );
YWidget::setEnabled( enabled );
}
-int YQBarGraph::preferredWidth()
+int
+YQBarGraph::preferredWidth()
{
- return _barGraph->sizeHint().width() + 2*YQWidgetMargin;
+ int width = 0;
+ QFontMetrics metrics = fontMetrics();
+
+ for ( int i=0; i < segments(); i++ )
+ {
+ QString txt = segment(i).label();
+
+ if ( txt.contains( "%1" ) )
+ txt = txt.arg( segment(i).value() );
+
+ QSize segSize = metrics.size( 0, txt );
+ width += segSize.width();
+ }
+
+ width += 2 * YQBarGraphLabelHorizontalMargin;
+ width += frameWidth();
+ width += 2 * YQBarGraphOuterMargin;
+ width = max( width, YQBarGraphMinWidth );
+
+ return width;
}
-int YQBarGraph::preferredHeight()
+int
+YQBarGraph::preferredHeight()
{
- return _barGraph->sizeHint().height() + 2*YQWidgetMargin;
+ int height = YQBarGraphMinHeight;
+ QFontMetrics metrics = fontMetrics();
+
+ for ( int i=0; i < segments(); i++ )
+ {
+ QString txt = segment(i).label();
+
+ if ( txt.contains( "%1" ) )
+ txt = txt.arg( segment(i).value() );
+
+ QSize segSize = metrics.size( 0, txt );
+ height = max( height, segSize.height() );
+ }
+
+ height += 2 * YQBarGraphLabelVerticalMargin;
+ height += frameWidth();
+ height += 2 * YQBarGraphOuterMargin;
+ height = max( height, YQBarGraphMinHeight );
+
+ return height;
}
-void YQBarGraph::setSize( int newWidth, int newHeight )
+void
+YQBarGraph::setSize( int newWidth, int newHeight )
{
- _barGraph->move( YQWidgetMargin, YQWidgetMargin );
- _barGraph->resize( newWidth - 2*YQWidgetMargin,
- newHeight - 2*YQWidgetMargin );
resize( newWidth, newHeight );
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h Fri Nov 9 16:07:11 2007
@@ -20,13 +20,13 @@
#ifndef YQBarGraph_h
#define YQBarGraph_h
-#include
-
-#include "QY2BarGraph.h"
+#include "qframe.h"
#include "YBarGraph.h"
+class QPainter;
+
-class YQBarGraph : public QWidget, public YBarGraph
+class YQBarGraph : public QFrame, public YBarGraph
{
Q_OBJECT
@@ -35,7 +35,19 @@
/**
* Constructor.
**/
- YQBarGraph( QWidget * parent, const YWidgetOpt & opt );
+ YQBarGraph( YWidget * parent );
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YQBarGraph();
+
+ /**
+ * Perform a visual update on the screen.
+ *
+ * Implemented from YBarGraph.
+ **/
+ virtual void doUpdate();
/**
* Set enabled/disabled state.
@@ -65,17 +77,26 @@
**/
virtual void setSize( int newWidth, int newHeight );
+
+protected:
+
/**
- * Perform a visual update on the screen.
- * Inherited from YBarGraph.
+ * Draw the contents.
+ *
+ * Reimplemented from QFrame.
**/
- void doUpdate();
+ virtual void drawContents( QPainter * painter );
-
-protected:
+ /**
+ * Return one from a set of default segment background colors.
+ **/
+ YColor defaultSegmentColor( unsigned index );
-
- QY2BarGraph * _barGraph;
+ /**
+ * Return one from a set of default text colors. This text color is
+ * guaranteed to contrast with the defaultSegmentColor with the same index.
+ **/
+ YColor defaultTextColor( unsigned index );
};
Modified: branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc Fri Nov 9 16:07:11 2007
@@ -132,13 +132,16 @@
bool YQOptionalWidgetFactory::hasBarGraph()
{
- return false;
+ return true;
}
YQBarGraph *
-YQOptionalWidgetFactory::createBarGraph( YWidget * parent, const vector<int> & values, const vector<string> & labels )
+YQOptionalWidgetFactory::createBarGraph( YWidget * parent )
{
- THROW_UNSUPPORTED( "YQBarGraph" );
+ YQBarGraph * barGraph = new YQBarGraph( parent );
+ YUI_CHECK_NEW( barGraph );
+
+ return barGraph;
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h Fri Nov 9 16:07:11 2007
@@ -79,7 +79,7 @@
virtual YQTimeField * createTimeField ( YWidget * parent, const string & label );
virtual bool hasBarGraph();
- virtual YQBarGraph * createBarGraph ( YWidget * parent, const vector<int> & values, const vector<string> & labels );
+ virtual YQBarGraph * createBarGraph ( YWidget * parent );
virtual bool hasPatternSelector();
virtual YQPatternSelector * createPatternSelector ( YWidget * parent, long modeFlags = 0 );
Modified: branches/tmp/sh/mod-ui/qt/src/YQUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQUI.h?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI.h Fri Nov 9 16:07:11 2007
@@ -432,10 +432,6 @@
/*** Widget creation methods for optional widgets, all reimplemented from YUI ***/
- bool hasBarGraph();
- YWidget * createBarGraph ( YWidget * parent, YWidgetOpt & opt);
-
-
bool hasDownloadProgress();
YWidget * createDownloadProgress ( YWidget * parent,
YWidgetOpt & opt,
Modified: branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc?rev=41934&r1=41933&r2=41934&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc Fri Nov 9 16:07:11 2007
@@ -52,17 +52,6 @@
//========= Optional widgets ==================================================
-bool YQUI::hasBarGraph()
-{
- return true;
-}
-
-YWidget * YQUI::createBarGraph( YWidget * parent, YWidgetOpt & opt)
-{
- return new YQBarGraph( (QWidget *) ( parent->widgetRep() ), opt );
-}
-
-
bool YQUI::hasDownloadProgress()
{
return true;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org