Hello community,
here is the log from the commit of package yast2-libyui
checked in at Fri Sep 12 17:27:23 CEST 2008.
--------
--- yast2-libyui/yast2-libyui.changes 2008-09-11 15:52:52.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-libyui/yast2-libyui.changes 2008-09-12 16:42:49.556145000 +0200
@@ -1,0 +2,12 @@
+Fri Sep 12 16:12:49 CEST 2008 - sh@suse.de
+
+- Added widget properties to YDialogSpy
+- V 2.17.10
+
+-------------------------------------------------------------------
+Fri Sep 12 13:54:34 CEST 2008 - sh@suse.de
+
+- Now exporting more YWidget base class attributes as properties:
+ HWeight, VWeight, HStretch, VStretch
+
+-------------------------------------------------------------------
Old:
----
yast2-libyui-2.17.9.tar.bz2
New:
----
yast2-libyui-2.17.10.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-libyui.spec ++++++
--- /var/tmp/diff_new_pack.T16576/_old 2008-09-12 17:27:18.000000000 +0200
+++ /var/tmp/diff_new_pack.T16576/_new 2008-09-12 17:27:18.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-libyui (Version 2.17.9)
+# spec file for package yast2-libyui (Version 2.17.10)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-libyui
-Version: 2.17.9
+Version: 2.17.10
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-libyui-2.17.9.tar.bz2
+Source0: yast2-libyui-2.17.10.tar.bz2
Prefix: /usr
Source1: yast2-libyui-rpmlintrc
BuildRequires: gcc-c++
@@ -77,7 +77,7 @@
Stefan Hundhammer
%prep
-%setup -n yast2-libyui-2.17.9
+%setup -n yast2-libyui-2.17.10
%build
%{prefix}/bin/y2tool y2autoconf
@@ -123,6 +123,12 @@
%{_datadir}/cmake/Modules/*
%doc %{prefix}/share/doc/packages/yast2-libyui
%changelog
+* Fri Sep 12 2008 sh@suse.de
+- Added widget properties to YDialogSpy
+- V 2.17.10
+* Fri Sep 12 2008 sh@suse.de
+- Now exporting more YWidget base class attributes as properties:
+ HWeight, VWeight, HStretch, VStretch
* Thu Sep 11 2008 sh@suse.de
- Added highlighting for target dialog in YDialogSpy
- V 2.17.9
++++++ yast2-libyui-2.17.9.tar.bz2 -> yast2-libyui-2.17.10.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.9/src/YCommandLine.cc new/yast2-libyui-2.17.10/src/YCommandLine.cc
--- old/yast2-libyui-2.17.9/src/YCommandLine.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.10/src/YCommandLine.cc 2008-09-12 13:47:27.000000000 +0200
@@ -128,3 +128,15 @@
priv->args[ index ] = newArg;
}
+
+int
+YCommandLine::find( const string & argName ) const
+{
+ for ( int i=0; i < argc(); i++ )
+ {
+ if ( priv->args[i] == argName )
+ return i;
+ }
+
+ return -1;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.9/src/YCommandLine.h new/yast2-libyui-2.17.10/src/YCommandLine.h
--- old/yast2-libyui-2.17.9/src/YCommandLine.h 2008-06-05 16:18:43.000000000 +0200
+++ new/yast2-libyui-2.17.10/src/YCommandLine.h 2008-09-12 13:47:19.000000000 +0200
@@ -99,6 +99,15 @@
**/
void replace( int index, const string & arg );
+ /**
+ * Find a command line argument 'argName' ("-display" etc.).
+ * Notice that leading minus signs must be specified in 'argName'.
+ * Since argv[0] is the program name, the search starts from argv[1].
+ *
+ * Return the position of 'argName' (from 0 on) or -1 if not found.
+ **/
+ int find( const string & argName ) const;
+
private:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.9/src/YDialogSpy.cc new/yast2-libyui-2.17.10/src/YDialogSpy.cc
--- old/yast2-libyui-2.17.9/src/YDialogSpy.cc 2008-09-11 13:39:16.000000000 +0200
+++ new/yast2-libyui-2.17.10/src/YDialogSpy.cc 2008-09-12 15:44:21.000000000 +0200
@@ -25,12 +25,14 @@
#include
#include
#include
+#include
#include
#include
#include
#include
#include
#include
+#include
#include
@@ -89,12 +91,18 @@
: targetDialog( 0 )
, spyDialog( 0 )
, widgetTree( 0 )
+ , propButton( 0 )
+ , propReplacePoint( 0 )
+ , propTable( 0 )
, closeButton( 0 )
{}
YDialog * targetDialog; // Dialog that is being inspected
YDialog * spyDialog; // Debug dialog that shows widget data
YTree * widgetTree; // Tree widget to show widget hierarchy
+ YPushButton * propButton;
+ YReplacePoint * propReplacePoint;
+ YTable * propTable;
YPushButton * closeButton;
};
@@ -109,11 +117,11 @@
priv->targetDialog = targetDialog;
YWidgetFactory * fac = YUI::widgetFactory();
- priv->spyDialog = fac->createPopupDialog();
- YLayoutBox * vbox = fac->createVBox( priv->spyDialog );
+ priv->spyDialog = fac->createPopupDialog();
+ YLayoutBox * vbox = fac->createVBox( priv->spyDialog );
+
YAlignment * minSize = fac->createMinSize( vbox, 50, 20 );
-
- priv->widgetTree = fac->createTree( minSize, "Widget &Tree" );
+ priv->widgetTree = fac->createTree( minSize, "Widget &Tree" );
priv->widgetTree->setNotify( true );
YWidgetTreeItem * rootItem = new YWidgetTreeItem( targetDialog, true );
@@ -122,8 +130,13 @@
priv->widgetTree->addItem( rootItem );
priv->widgetTree->rebuildTree();
+ YAlignment * alignment = fac->createLeft( vbox );
+ priv->propButton = fac->createPushButton( alignment, "&Properties >>>" );
+ priv->propReplacePoint = fac->createReplacePoint( vbox );
+ fac->createEmpty( priv->propReplacePoint );
+
YButtonBox * buttonBox = fac->createButtonBox( vbox );
- priv->closeButton = fac->createPushButton( buttonBox, "&Close" );
+ priv->closeButton = fac->createPushButton( buttonBox, "&Close" );
priv->closeButton->setRole( YOKButton );
}
@@ -135,6 +148,105 @@
}
+bool YDialogSpy::propertiesShown() const
+{
+ return priv->propTable != 0;
+}
+
+
+void YDialogSpy::showProperties()
+{
+ if ( ! propertiesShown() )
+ {
+ priv->propReplacePoint->deleteChildren();
+
+ YWidgetFactory * fac = YUI::widgetFactory();
+ YAlignment * minSize = fac->createMinSize( priv->propReplacePoint, 30, 12 );
+
+ YTableHeader * header = new YTableHeader();
+ YUI_CHECK_NEW( header );
+ header->addColumn( "Property" );
+ header->addColumn( "Value" );
+ header->addColumn( "Type" );
+
+ priv->propTable = fac->createTable( minSize, header );
+
+ priv->propButton->setLabel( "<<< &Properties" );
+ priv->propReplacePoint->showChild();
+ priv->spyDialog->recalcLayout();
+ }
+}
+
+
+void YDialogSpy::hideProperties()
+{
+ if ( propertiesShown() )
+ {
+ priv->propReplacePoint->deleteChildren();
+ priv->propTable = 0;
+ YUI::widgetFactory()->createEmpty( priv->propReplacePoint );
+
+ priv->propButton->setLabel( "&Properties >>>" );
+ priv->propReplacePoint->showChild();
+ priv->spyDialog->recalcLayout();
+ }
+}
+
+
+void YDialogSpy::showProperties( YWidget * widget )
+{
+ if ( ! priv->propTable )
+ return;
+
+ priv->propTable->deleteAllItems();
+
+ if ( widget )
+ {
+ YPropertySet propSet = widget->propertySet();
+ YItemCollection items;
+ items.reserve( propSet.size() );
+
+ for ( YPropertySet::const_iterator it = propSet.propertiesBegin();
+ it != propSet.propertiesEnd();
+ ++it )
+ {
+ YProperty prop = *it;
+ YPropertyValue propVal = widget->getProperty( prop.name() );
+ string propValStr;
+
+ switch ( prop.type() )
+ {
+ case YStringProperty:
+ propValStr = propVal.stringVal();
+ break;
+
+ case YBoolProperty:
+ propValStr = propVal.boolVal() ? "true" : "false";
+ break;
+
+ case YIntegerProperty:
+ {
+ std::ostringstream str;
+ str << propVal.integerVal();
+ propValStr = str.str();
+ }
+ break;
+
+ default:
+ propValStr = "???";
+ break;
+ }
+
+ YTableItem * item = new YTableItem( prop.name(), propValStr, prop.typeAsStr() );
+ YUI_CHECK_NEW( item );
+ items.push_back( item );
+ }
+
+ priv->propTable->addItems( items );
+ }
+}
+
+
void fillTree( YWidgetTreeItem * parent,
YWidgetListConstIterator begin,
YWidgetListConstIterator end,
@@ -157,25 +269,38 @@
while ( true )
{
+ bool updateProp = false;
YEvent * event = priv->spyDialog->waitForEvent();
if ( event )
{
- if ( event->widget() == priv->closeButton )
+ if ( event->widget() == priv->closeButton ||
+ event->eventType() == YEvent::CancelEvent ) // window manager "close window" button
{
priv->targetDialog->highlight( 0 );
return;
}
- if ( event->widget() == priv->widgetTree )
+ if ( event->widget() == priv->propButton )
+ {
+ if ( propertiesShown() )
+ hideProperties();
+ else
+ {
+ showProperties();
+ updateProp = true;
+ }
+ }
+
+ if ( event->widget() == priv->widgetTree || updateProp )
{
- yuiDebug() << "Event from " << event->widget() << endl;
YWidgetTreeItem * item = (YWidgetTreeItem *) priv->widgetTree->selectedItem();
yuiDebug() << "Highlighting " << item << endl;
if ( item )
{
priv->targetDialog->highlight( item->widget() );
+ showProperties( item->widget() );
}
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.9/src/YDialogSpy.h new/yast2-libyui-2.17.10/src/YDialogSpy.h
--- old/yast2-libyui-2.17.9/src/YDialogSpy.h 2008-09-09 16:58:52.000000000 +0200
+++ new/yast2-libyui-2.17.10/src/YDialogSpy.h 2008-09-12 15:38:49.000000000 +0200
@@ -22,6 +22,7 @@
#include "ImplPtr.h"
+class YWidget;
class YDialog;
class YDialogSpyPrivate;
@@ -43,7 +44,22 @@
**/
static void showDialogSpy( YDialog * dialog = 0 );
-
+ /**
+ * Show the "Properties" sub-window.
+ **/
+ void showProperties();
+
+ /**
+ * Hide the "Properties" sub-window.
+ **/
+ void hideProperties();
+
+ /**
+ * Return 'true' if the "Properties" sub-window is currently shown,
+ * 'false' if not.
+ **/
+ bool propertiesShown() const;
+
protected:
/**
* Constructor: Create a YDialogSpy for the specified dialog. 0 means "use
@@ -65,6 +81,11 @@
**/
void exec();
+ /**
+ * Show the properties of the specified widget if the "Properties"
+ * sub-window is currently shown.
+ **/
+ void showProperties( YWidget * widget );
private:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.9/src/YUISymbols.h new/yast2-libyui-2.17.10/src/YUISymbols.h
--- old/yast2-libyui-2.17.9/src/YUISymbols.h 2008-09-04 15:22:21.000000000 +0200
+++ new/yast2-libyui-2.17.10/src/YUISymbols.h 2008-09-12 12:21:51.000000000 +0200
@@ -162,6 +162,8 @@
#define YUIProperty_HelpText "HelpText"
#define YUIProperty_IconPath "IconPath"
#define YUIProperty_InputMaxLength "InputMaxLength"
+#define YUIProperty_HWeight "HWeight"
+#define YUIProperty_HStretch "HStretch"
#define YUIProperty_Item "Item"
#define YUIProperty_Items "Items"
#define YUIProperty_Label "Label"
@@ -180,8 +182,9 @@
#define YUIProperty_Value "Value"
#define YUIProperty_Values "Values"
#define YUIProperty_VisibleLines "VisibleLines"
+#define YUIProperty_VWeight "VWeight"
+#define YUIProperty_VStretch "VStretch"
#define YUIProperty_WidgetClass "WidgetClass"
-#define YUIProperty_WidgetName "WidgetName"
// Widget and dialog options
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.9/src/YWidget.cc new/yast2-libyui-2.17.10/src/YWidget.cc
--- old/yast2-libyui-2.17.9/src/YWidget.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.10/src/YWidget.cc 2008-09-12 12:28:06.000000000 +0200
@@ -87,7 +87,6 @@
YBothDim<bool> stretch;
YBothDim<int> weight;
int functionKey;
- string widgetName;
string helpText;
};
@@ -331,18 +330,6 @@
}
-string YWidget::widgetName() const
-{
- return priv->widgetName;
-}
-
-
-void YWidget::setWidgetName( const string & name )
-{
- priv->widgetName = name;
-}
-
-
string YWidget::helpText() const
{
return priv->helpText;
@@ -406,17 +393,23 @@
* @property boolean Enabled enabled/disabled state of this widget
* @property boolean Notify the current notify state (see also `opt( `notify ))
* @property string WidgetClass the widget class of this widget (YLabel, YPushButton, ...)
- * @property string WidgetName internal name for this widget (by default the string-ized ID)
- * @property string HelpText help text
* @property string DebugLabel (possibly translated) text describing this widget for debugging
+ * @property string HelpText help text
+ * @property integer HWeight horizontal layout weight (same as `HWeight(widget())
+ * @property integer VWeight vertical layout weight (same as `VWeight(widget())
+ * @property boolean HStretch horizontally stretchable? (same as `opt(`hstretch))
+ * @property boolean VStretch vertically stretchable? (same as `opt(`vstretch))
**/
- propSet.add( YProperty( YUIProperty_Enabled, YBoolProperty ) );
- propSet.add( YProperty( YUIProperty_Notify, YBoolProperty ) );
+ propSet.add( YProperty( YUIProperty_Enabled, YBoolProperty ) );
+ propSet.add( YProperty( YUIProperty_Notify, YBoolProperty ) );
propSet.add( YProperty( YUIProperty_WidgetClass, YStringProperty, true ) ); // read-only
propSet.add( YProperty( YUIProperty_DebugLabel, YStringProperty, true ) ); // read-only
- propSet.add( YProperty( YUIProperty_WidgetName, YStringProperty ) );
- propSet.add( YProperty( YUIProperty_HelpText, YStringProperty ) );
+ propSet.add( YProperty( YUIProperty_HelpText, YStringProperty ) );
+ propSet.add( YProperty( YUIProperty_HWeight, YIntegerProperty ) );
+ propSet.add( YProperty( YUIProperty_VWeight, YIntegerProperty ) );
+ propSet.add( YProperty( YUIProperty_HStretch, YBoolProperty ) );
+ propSet.add( YProperty( YUIProperty_VStretch, YBoolProperty ) );
}
return propSet;
@@ -436,10 +429,13 @@
throw;
}
- if ( propertyName == YUIProperty_Enabled ) setEnabled( val.boolVal() );
- else if ( propertyName == YUIProperty_Notify ) setNotify ( val.boolVal() );
- else if ( propertyName == YUIProperty_WidgetName ) setWidgetName( val.stringVal() );
+ if ( propertyName == YUIProperty_Enabled ) setEnabled( val.boolVal() );
+ else if ( propertyName == YUIProperty_Notify ) setNotify ( val.boolVal() );
else if ( propertyName == YUIProperty_HelpText ) setHelpText( val.stringVal() );
+ else if ( propertyName == YUIProperty_HWeight ) setWeight( YD_HORIZ, val.integerVal() );
+ else if ( propertyName == YUIProperty_VWeight ) setWeight( YD_VERT , val.integerVal() );
+ else if ( propertyName == YUIProperty_HStretch ) setStretchable( YD_HORIZ, val.boolVal() );
+ else if ( propertyName == YUIProperty_VStretch ) setStretchable( YD_VERT , val.boolVal() );
return true; // success -- no special processing necessary
}
@@ -461,9 +457,12 @@
if ( propertyName == YUIProperty_Enabled ) return YPropertyValue( isEnabled() );
if ( propertyName == YUIProperty_Notify ) return YPropertyValue( notify() );
if ( propertyName == YUIProperty_WidgetClass ) return YPropertyValue( widgetClass() );
- if ( propertyName == YUIProperty_WidgetName ) return YPropertyValue( widgetName() );
if ( propertyName == YUIProperty_HelpText ) return YPropertyValue( helpText() );
if ( propertyName == YUIProperty_DebugLabel ) return YPropertyValue( debugLabel() );
+ if ( propertyName == YUIProperty_HWeight ) return YPropertyValue( weight( YD_HORIZ ) );
+ if ( propertyName == YUIProperty_VWeight ) return YPropertyValue( weight( YD_VERT ) );
+ if ( propertyName == YUIProperty_HStretch ) return YPropertyValue( stretchable( YD_HORIZ ) );
+ if ( propertyName == YUIProperty_VStretch ) return YPropertyValue( stretchable( YD_VERT ) );
return YPropertyValue( false ); // NOTREACHED
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.9/src/YWidget.h new/yast2-libyui-2.17.10/src/YWidget.h
--- old/yast2-libyui-2.17.9/src/YWidget.h 2008-09-04 15:04:19.000000000 +0200
+++ new/yast2-libyui-2.17.10/src/YWidget.h 2008-09-12 12:12:43.000000000 +0200
@@ -80,16 +80,6 @@
virtual string debugLabel() const;
/**
- * Return this widget's debugging name (if one was previously set).
- **/
- string widgetName() const;
-
- /**
- * Set a widget name for debugging.
- **/
- void setWidgetName( const string & name );
-
- /**
* Return the help text for this widget.
**/
string helpText() const;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.9/VERSION new/yast2-libyui-2.17.10/VERSION
--- old/yast2-libyui-2.17.9/VERSION 2008-09-11 15:42:47.000000000 +0200
+++ new/yast2-libyui-2.17.10/VERSION 2008-09-12 12:30:40.000000000 +0200
@@ -1 +1 @@
-2.17.9
+2.17.10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org