Mailinglist Archive: yast-devel (101 mails)

< Previous Next >
[yast-devel] BusyIndicator
  • From: Martin Vidner <mvidner@xxxxxxx>
  • Date: Mon, 14 Jan 2008 11:29:35 +0100
  • Message-id: <20080114102935.GB25444@xxxxxxxxxxxxxxxx>
On Thu, Jan 10, 2008 at 04:07:46PM -0000, tgoettlicher@xxxxxxxxxxxxxxxx wrote:
Author: tgoettlicher
Date: Thu Jan 10 17:07:46 2008
New Revision: 43537

URL: http://svn.opensuse.org/viewcvs/yast?rev=43537&view=rev
Log:
added BusyIndicator widget (fate #302559)

Hi,

Thomas has asked me for a review of the implementation, here it is:

We are adding a new widget. In general, we need
- documentation
http://forgeftp.novell.com/yast/doc/SL10.3/tdg/Book-UIReference.html
OK, it is there

- implementation for all 3 UIs
I see only qt. What about the rest?

- proper dependencies because the ABI changes
See below

Added:
trunk/core/libyui/doc/examples/BusyIndicator.ycp
trunk/core/libyui/src/YBusyIndicator.cc
trunk/core/libyui/src/YBusyIndicator.h
Modified:
trunk/core/VERSION
trunk/core/libyui/src/Makefile.am
trunk/core/libyui/src/YCPDialogParser.cc
trunk/core/libyui/src/YCPDialogParser.h
trunk/core/libyui/src/YUISymbols.h
trunk/core/libyui/src/YWidgetFactory.h
trunk/core/package/yast2-core.changes

...
Added: trunk/core/libyui/doc/examples/BusyIndicator.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/doc/examples/BusyIndicator.ycp?rev=43537&view=auto
==============================================================================
--- trunk/core/libyui/doc/examples/BusyIndicator.ycp (added)
+++ trunk/core/libyui/doc/examples/BusyIndicator.ycp Thu Jan 10 17:07:46 2008
@@ -0,0 +1,33 @@
+// Simple ProgressBar example
BusyIndicator

+{
+ integer timeout = 1001;
// in milliseconds

+
+ UI::OpenDialog(
+ `VBox(
+ `BusyIndicator(`id(`busy), "Sample busy indicator",
timeout ),
+ `PushButton(`id(`alive), "send &tick"),
+ `PushButton(`id(`query), "&query"),
+ `Right(`PushButton(`id(`close), "&Close" ) )
+ )
+ );
+
+
+ while ( true )
+ {
+ symbol button = (symbol) UI::UserInput();
+
+ if ( button == `alive )
+ {
+ UI::ChangeWidget(`id(`busy), `Alive, true);
+ UI::ChangeWidget(`id(`busy), `Timeout, 999);
+ }
+ else if ( button == `query )
+ {
+ UI::ChangeWidget(`id(`busy), `Label, sformat("timeout: %1, alive:
%2",UI::QueryWidget(`id(`busy), `Timeout), UI::QueryWidget(`id(`busy),
`Alive)));
+ }
+ else if ( button == `close )
+ break;
+ }
+
+ UI::CloseDialog();
+}

Added: trunk/core/libyui/src/YBusyIndicator.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YBusyIndicator.cc?rev=43537&view=auto
==============================================================================
--- trunk/core/libyui/src/YBusyIndicator.cc (added)
+++ trunk/core/libyui/src/YBusyIndicator.cc Thu Jan 10 17:07:46 2008
+const YPropertySet &
+YBusyIndicator::propertySet()
+{
+ static YPropertySet propSet;
+
+ if ( propSet.isEmpty() )
+ {
+ /*
+ * @property integer Timeout timeout until busy indicator changes to
stalled state
in ms

+ * @property bool Alive busy indicator is in alive or stalled
state
+ * @property string Label caption above the busy indicator
+ */
+ propSet.add( YProperty( YUIProperty_Timeout,
YIntegerProperty ) );
+ propSet.add( YProperty( YUIProperty_Alive, YBoolProperty )
);
+ propSet.add( YProperty( YUIProperty_Label, YStringProperty
) );
+ propSet.add( YWidget::propertySet() );
+ }
+
+ return propSet;
+}
Added: trunk/core/libyui/src/YBusyIndicator.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YBusyIndicator.h?rev=43537&view=auto
==============================================================================
--- trunk/core/libyui/src/YBusyIndicator.h (added)
+++ trunk/core/libyui/src/YBusyIndicator.h Thu Jan 10 17:07:46 2008
+ /**
+ * Return the current timout value.

in milliseconds

+ **/
+ int timeout() const;
+
Modified: trunk/core/libyui/src/YCPDialogParser.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCPDialogParser.cc?rev=43537&r1=43536&r2=43537&view=diff
==============================================================================
--- trunk/core/libyui/src/YCPDialogParser.cc (original)
+++ trunk/core/libyui/src/YCPDialogParser.cc Thu Jan 10 17:07:46 2008
@@ -80,6 +80,7 @@
#include "YTree.h"
#include "YWizard.h"
#include "YTimezoneSelector.h"
+#include "YBusyIndicator.h"

using std::string;

@@ -262,6 +263,7 @@
else if ( s == YUIWidget_VSquash ) w = parseSquash
( p, opt, term, ol, n, false, true );
else if ( s == YUIWidget_VStretch ) w =
parseSpacing ( p, opt, term, ol, n, YD_VERT, true );
else if ( s == YUIWidget_VWeight ) w = parseWeight
( p, opt, term, ol, n, YD_VERT );
+ else if ( s == YUIWidget_BusyIndicator ) w = parseBusyIndicator
( p, opt, term, ol, n );

// Special widgets - may or may not be supported by the specific UI.
// The YCP application should ask for presence of such a widget with
Has???Widget() prior to creating one.
@@ -2198,6 +2200,9 @@
* value will be 100. If you omit the optional parameter <tt>progress</tt>,
the
* progress bar will set to 0 initially.
*
+ * If you don't know the number of total steps you might want to use the
+ * BusyIndicator widget instead of ProgressBar.
+ *
**/

YWidget *
@@ -3307,6 +3312,54 @@
return selector;
}

+/**
+ * @widget Busy Indicator

BusyIndicator
(make -C core/libyui/doc and see the generated docs to proofread it)

+ * @short Graphical busy indicator
+ * @class YBusyIndicator
+ * @arg string label the label describing the bar
+ * @optarg integer timeout the timout until busy indicator changes to
stalled state
s/timout/timeout/
in milliseconds, 1000ms by default

+ * @usage `BusyIndicator(`id(`busy), "background action", 2000 ),
+ * @example BusyIndicator.ycp
+ *
+ * @description
+ *
+ * A busy indicator is a bar with a label that gives feedback to the user
that
+ * a task is in progress and the user has to wait. It is similar to a
progress bar.
+ * The difference is that a busy indicator can be used when the total number
of
+ * steps is not known before the action starts. You have to send keep alive
messages
+ * by setting alive to true every now and then, otherwise the busy indicator
will
+ * change to stalled state.
+ *
+ **/
Modified: trunk/core/libyui/src/YWidgetFactory.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YWidgetFactory.h?rev=43537&r1=43536&r2=43537&view=diff
==============================================================================
--- trunk/core/libyui/src/YWidgetFactory.h (original)
+++ trunk/core/libyui/src/YWidgetFactory.h Thu Jan 10 17:07:46 2008
@@ -56,6 +56,7 @@
class YTableHeader;
class YTimeField;
class YTree;
+class YBusyIndicator;



@@ -102,6 +103,7 @@
virtual YTable * createTable ( YWidget * parent,
YTableHeader * header ) = 0;
virtual YProgressBar * createProgressBar ( YWidget * parent,
const string & label, int maxValue = 100 ) = 0;
virtual YRichText * createRichText ( YWidget *
parent, const string & text = string(), bool plainTextMode = false ) =
0;
+ virtual YBusyIndicator * createBusyIndicator ( YWidget * parent,
const string & label, int timeout = 1000 ) = 0;

Adding a virtual method makes a library binary incompatible:
http://techbase.kde.org/index.php?title=Policies/Binary_Compatibility_Issues_With_C%2B%2B
I see that you use the implementation pointer technique in the
widget itself but we probably cannot avoid the ABI change for the
factory class.

So we have to add proper RPM dependencies. The easiest way should be
changing the soname, like this in Makefile.am:
-libpy2UI_la_LDFLAGS = -version-info 2:0
+libpy2UI_la_LDFLAGS = -version-info 3:0

--
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner

Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >