Hello community,
here is the log from the commit of package yast2-libyui
checked in at Fri Sep 12 01:56:56 CEST 2008.
--------
--- yast2-libyui/yast2-libyui.changes 2008-09-04 15:36:48.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-libyui/yast2-libyui.changes 2008-09-11 15:52:52.508537000 +0200
@@ -1,0 +2,23 @@
+Thu Sep 11 15:42:18 CEST 2008 - sh@suse.de
+
+- Added highlighting for target dialog in YDialogSpy
+- V 2.17.9
+
+-------------------------------------------------------------------
+Wed Sep 10 17:15:52 CEST 2008 - sh@suse.de
+
+- Force [Help] button left-aligned in GNOME button order
+
+-------------------------------------------------------------------
+Tue Sep 9 17:05:23 CEST 2008 - sh@suse.de
+
+- Added YDialogSpy for interactive introspection of a widget tree
+- V 2.17.8
+
+-------------------------------------------------------------------
+Tue Sep 9 16:21:35 CEST 2008 - sh@suse.de
+
+- Made YEvents more robust against attempts of duplicate deletion
+- Stream output (logging) for YEvents
+
+-------------------------------------------------------------------
Old:
----
yast2-libyui-2.17.7.tar.bz2
New:
----
yast2-libyui-2.17.9.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-libyui.spec ++++++
--- /var/tmp/diff_new_pack.Ab6350/_old 2008-09-12 01:56:42.000000000 +0200
+++ /var/tmp/diff_new_pack.Ab6350/_new 2008-09-12 01:56:42.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-libyui (Version 2.17.7)
+# spec file for package yast2-libyui (Version 2.17.9)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-libyui
-Version: 2.17.7
+Version: 2.17.9
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-libyui-2.17.7.tar.bz2
+Source0: yast2-libyui-2.17.9.tar.bz2
Prefix: /usr
Source1: yast2-libyui-rpmlintrc
BuildRequires: gcc-c++
@@ -77,7 +77,7 @@
Stefan Hundhammer
%prep
-%setup -n yast2-libyui-2.17.7
+%setup -n yast2-libyui-2.17.9
%build
%{prefix}/bin/y2tool y2autoconf
@@ -123,6 +123,17 @@
%{_datadir}/cmake/Modules/*
%doc %{prefix}/share/doc/packages/yast2-libyui
%changelog
+* Thu Sep 11 2008 sh@suse.de
+- Added highlighting for target dialog in YDialogSpy
+- V 2.17.9
+* Wed Sep 10 2008 sh@suse.de
+- Force [Help] button left-aligned in GNOME button order
+* Tue Sep 09 2008 sh@suse.de
+- Added YDialogSpy for interactive introspection of a widget tree
+- V 2.17.8
+* Tue Sep 09 2008 sh@suse.de
+- Made YEvents more robust against attempts of duplicate deletion
+- Stream output (logging) for YEvents
* Thu Sep 04 2008 sh@suse.de
- Allow ButtonBox sanity check to be relaxed (bnc #422612)
- V 2.17.7
++++++ yast2-libyui-2.17.7.tar.bz2 -> yast2-libyui-2.17.9.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/Makefile.am new/yast2-libyui-2.17.9/src/Makefile.am
--- old/yast2-libyui-2.17.7/src/Makefile.am 2008-08-22 17:08:53.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/Makefile.am 2008-09-08 16:52:37.000000000 +0200
@@ -24,6 +24,7 @@
YOptionalWidgetFactory.cc \
\
YCommandLine.cc \
+ YDialogSpy.cc \
YEvent.cc \
YEventFilter.cc \
YEnvVar.cc \
@@ -107,6 +108,7 @@
YChildrenManager.h \
YColor.h \
YCommandLine.h \
+ YDialogSpy.h \
YEvent.h \
YEventFilter.h \
YEnvVar.h \
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/Makefile.in new/yast2-libyui-2.17.9/src/Makefile.in
--- old/yast2-libyui-2.17.7/src/Makefile.in 2008-08-22 17:37:47.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/Makefile.in 2008-09-08 16:52:41.000000000 +0200
@@ -60,25 +60,25 @@
LTLIBRARIES = $(lib_LTLIBRARIES)
libyui_la_DEPENDENCIES =
am_libyui_la_OBJECTS = YUI.lo YApplication.lo YWidgetFactory.lo \
- YOptionalWidgetFactory.lo YCommandLine.lo YEvent.lo \
- YEventFilter.lo YEnvVar.lo YItem.lo YMacro.lo YProperty.lo \
- YShortcut.lo YShortcutManager.lo YSimpleEventHandler.lo \
- YSingleChildContainerWidget.lo YTableHeader.lo YTableItem.lo \
- YTreeItem.lo YUIException.lo YUILoader.lo YUILog.lo \
- YUIPlugin.lo YWidgetID.lo YSelectionWidget.lo \
- YSimpleInputField.lo YAlignment.lo YBarGraph.lo \
- YBusyIndicator.lo YButtonBox.lo YCheckBox.lo YCheckBoxFrame.lo \
- YComboBox.lo YDateField.lo YDialog.lo YDownloadProgress.lo \
- YDumbTab.lo YEmpty.lo YFrame.lo YImage.lo YInputField.lo \
- YIntField.lo YLabel.lo YLayoutBox.lo YLogView.lo \
- YMenuButton.lo YMultiLineEdit.lo YMultiProgressMeter.lo \
- YMultiSelectionBox.lo YPackageSelector.lo \
- YPartitionSplitter.lo YProgressBar.lo YPushButton.lo \
- YRadioButton.lo YRadioButtonGroup.lo YReplacePoint.lo \
- YRichText.lo YSelectionBox.lo YSlider.lo YSpacing.lo \
- YSquash.lo YTable.lo YTimeField.lo YTimezoneSelector.lo \
- YTree.lo YWidget.lo YWizard.lo FSize.lo YStringTree.lo \
- YRpmGroupsTree.lo
+ YOptionalWidgetFactory.lo YCommandLine.lo YDialogSpy.lo \
+ YEvent.lo YEventFilter.lo YEnvVar.lo YItem.lo YMacro.lo \
+ YProperty.lo YShortcut.lo YShortcutManager.lo \
+ YSimpleEventHandler.lo YSingleChildContainerWidget.lo \
+ YTableHeader.lo YTableItem.lo YTreeItem.lo YUIException.lo \
+ YUILoader.lo YUILog.lo YUIPlugin.lo YWidgetID.lo \
+ YSelectionWidget.lo YSimpleInputField.lo YAlignment.lo \
+ YBarGraph.lo YBusyIndicator.lo YButtonBox.lo YCheckBox.lo \
+ YCheckBoxFrame.lo YComboBox.lo YDateField.lo YDialog.lo \
+ YDownloadProgress.lo YDumbTab.lo YEmpty.lo YFrame.lo YImage.lo \
+ YInputField.lo YIntField.lo YLabel.lo YLayoutBox.lo \
+ YLogView.lo YMenuButton.lo YMultiLineEdit.lo \
+ YMultiProgressMeter.lo YMultiSelectionBox.lo \
+ YPackageSelector.lo YPartitionSplitter.lo YProgressBar.lo \
+ YPushButton.lo YRadioButton.lo YRadioButtonGroup.lo \
+ YReplacePoint.lo YRichText.lo YSelectionBox.lo YSlider.lo \
+ YSpacing.lo YSquash.lo YTable.lo YTimeField.lo \
+ YTimezoneSelector.lo YTree.lo YWidget.lo YWizard.lo FSize.lo \
+ YStringTree.lo YRpmGroupsTree.lo
libyui_la_OBJECTS = $(am_libyui_la_OBJECTS)
libyui_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -269,6 +269,7 @@
YOptionalWidgetFactory.cc \
\
YCommandLine.cc \
+ YDialogSpy.cc \
YEvent.cc \
YEventFilter.cc \
YEnvVar.cc \
@@ -348,6 +349,7 @@
YChildrenManager.h \
YColor.h \
YCommandLine.h \
+ YDialogSpy.h \
YEvent.h \
YEventFilter.h \
YEnvVar.h \
@@ -508,6 +510,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YCommandLine.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YDateField.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YDialog.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YDialogSpy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YDownloadProgress.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YDumbTab.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YEmpty.Plo@am__quote@
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YAlignment.cc new/yast2-libyui-2.17.9/src/YAlignment.cc
--- old/yast2-libyui-2.17.7/src/YAlignment.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YAlignment.cc 2008-09-10 16:30:23.000000000 +0200
@@ -170,7 +170,7 @@
void YAlignment::addChild( YWidget * child )
{
YSingleChildContainerWidget::addChild( child );
-
+
if ( minWidth() > 0 ) child->setStretchable( YD_HORIZ, true );
if ( minHeight() > 0 ) child->setStretchable( YD_VERT , true );
}
@@ -192,7 +192,7 @@
int preferredWidth = firstChild()->preferredWidth();
preferredWidth += leftMargin() + rightMargin();
-
+
return max( minWidth(), preferredWidth );
}
@@ -204,7 +204,7 @@
int preferredHeight = firstChild()->preferredHeight();
preferredHeight += topMargin() + bottomMargin();
-
+
return max( minHeight(), preferredHeight );
}
@@ -321,7 +321,7 @@
void YAlignment::setBackgroundPixmap( const string & pixmapFileName )
{
string pixmap = pixmapFileName;
-
+
if ( pixmap.length() > 0 &&
pixmap[0] != '/' && // Absolute path?
pixmap[0] != '.' ) // Path relative to $CWD ?
@@ -332,3 +332,46 @@
priv->backgroundPixmap = pixmap;
}
+
+
+const char *
+YAlignment::widgetClass() const
+{
+ string wClass = "YAlignment";
+ string subClass;
+
+ if ( priv->alignment.hor == YAlignBegin ) subClass = "Left";
+ else if ( priv->alignment.hor == YAlignEnd ) subClass = "Right";
+ else if ( priv->alignment.hor == YAlignCenter )
+ {
+ if ( priv->alignment.vert == YAlignCenter ) subClass = "HVCenter";
+ else subClass = "HCenter";
+ }
+ else if ( priv->alignment.vert == YAlignBegin ) subClass = "Top";
+ else if ( priv->alignment.vert == YAlignEnd ) subClass = "Bottom";
+ else if ( priv->alignment.vert == YAlignCenter ) subClass = "VCenter";
+
+ if ( priv->alignment.hor == YAlignUnchanged &&
+ priv->alignment.vert == YAlignUnchanged )
+ {
+ if ( priv->leftMargin > 0 ||
+ priv->rightMargin > 0 ||
+ priv->topMargin > 0 ||
+ priv->bottomMargin > 0 )
+ {
+ wClass = "YMarginBox";
+ }
+
+ if ( priv->minWidth > 0 || priv->minHeight > 0 )
+ {
+ if ( priv->minWidth == 0 ) wClass = "YMinHeight";
+ else if ( priv->minHeight == 0 ) wClass = "YMinWidth";
+ else wClass = "YMinSize";
+ }
+ }
+
+ if ( ! subClass.empty() )
+ wClass += "_" + subClass;
+
+ return wClass.c_str();
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YAlignment.h new/yast2-libyui-2.17.9/src/YAlignment.h
--- old/yast2-libyui-2.17.7/src/YAlignment.h 2008-06-05 16:18:44.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YAlignment.h 2008-09-10 16:00:46.000000000 +0200
@@ -53,7 +53,7 @@
* Return a descriptive name of this widget class for logging,
* debugging etc.
**/
- virtual const char * widgetClass() const { return "YAlignment"; }
+ virtual const char * widgetClass() const;
/**
* Return the alignment in the specified dimension.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YButtonBox.cc new/yast2-libyui-2.17.9/src/YButtonBox.cc
--- old/yast2-libyui-2.17.7/src/YButtonBox.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YButtonBox.cc 2008-09-10 17:14:13.000000000 +0200
@@ -111,6 +111,7 @@
policy.equalSizeButtons = true;
policy.alignment[ YD_HORIZ ] = YAlignEnd; // Align right
policy.alignment[ YD_VERT ] = YAlignBegin; // Align top
+ policy.addExcessSpaceToHelpButtonExtraMargin = true;
return policy;
}
@@ -267,21 +268,28 @@
{
int excessWidth = width - prefWidth;
- switch ( _layoutPolicy.alignment[ YD_HORIZ ] )
+ if ( _layoutPolicy.addExcessSpaceToHelpButtonExtraMargin && helpButton )
{
- case YAlignCenter:
- margins.left += excessWidth / 2;
- margins.right += excessWidth / 2;
- break;
-
- case YAlignBegin:
- case YAlignUnchanged:
- margins.right += excessWidth;
- break;
-
- case YAlignEnd:
- margins.left += excessWidth;
- break;
+ margins.helpButtonExtraSpacing += excessWidth;
+ }
+ else
+ {
+ switch ( _layoutPolicy.alignment[ YD_HORIZ ] )
+ {
+ case YAlignCenter:
+ margins.left += excessWidth / 2;
+ margins.right += excessWidth / 2;
+ break;
+
+ case YAlignBegin:
+ case YAlignUnchanged:
+ margins.right += excessWidth;
+ break;
+
+ case YAlignEnd:
+ margins.left += excessWidth;
+ break;
+ }
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YButtonBox.h new/yast2-libyui-2.17.9/src/YButtonBox.h
--- old/yast2-libyui-2.17.7/src/YButtonBox.h 2008-09-04 14:35:39.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YButtonBox.h 2008-09-10 17:09:01.000000000 +0200
@@ -37,6 +37,7 @@
YButtonBoxLayoutPolicy()
: buttonOrder( YKDEButtonOrder )
, equalSizeButtons( false )
+ , addExcessSpaceToHelpButtonExtraMargin( false )
{
alignment[ YD_HORIZ ] = YAlignCenter;
alignment[ YD_VERT ] = YAlignBegin; // Align top
@@ -44,6 +45,7 @@
YButtonOrder buttonOrder; // YKDEButtonOrder / YGnomeButtonOrder
bool equalSizeButtons; // Make all buttons the same size?
+ bool addExcessSpaceToHelpButtonExtraMargin;
// Alignment for the YButtonBox itself
YAlignmentType alignment[ YUIAllDimensions ];
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YDialog.cc new/yast2-libyui-2.17.9/src/YDialog.cc
--- old/yast2-libyui-2.17.7/src/YDialog.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YDialog.cc 2008-09-09 16:03:37.000000000 +0200
@@ -27,6 +27,7 @@
#include "YEvent.h"
#include "YShortcutManager.h"
#include "YPushButton.h"
+#include "YButtonBox.h"
#include "YUI.h"
#include "YWidgetFactory.h"
@@ -40,6 +41,7 @@
#define VERBOSE_DIALOGS 0
#define VERBOSE_DISCARDED_EVENTS 0
+#define VERBOSE_EVENTS 0
std::stack YDialog::_dialogStack;
@@ -454,7 +456,19 @@
priv->lastEvent = 0;
if ( event )
- delete event;
+ {
+ if ( event->isValid() )
+ {
+#if VERBOSE_EVENTS
+ yuiDebug() << "Deleting " << event << endl;
+#endif
+ delete event;
+ }
+ else
+ {
+ yuiError() << "Attempt to delete invalid event " << event << endl;
+ }
+ }
}
@@ -589,11 +603,13 @@
{
try
{
- YDialog * dialog = YUI::widgetFactory()->createPopupDialog();
- YAlignment * minSize = YUI::widgetFactory()->createMinSize( dialog, 45, 15 );
- YLayoutBox * vbox = YUI::widgetFactory()->createVBox( minSize );
+ YDialog * dialog = YUI::widgetFactory()->createPopupDialog();
+ YAlignment * minSize = YUI::widgetFactory()->createMinSize( dialog, 45, 15 );
+ YLayoutBox * vbox = YUI::widgetFactory()->createVBox( minSize );
YUI::widgetFactory()->createRichText( vbox, text, ! useRichText );
- YPushButton * okButton = YUI::widgetFactory()->createPushButton( vbox, "&OK" );
+ YButtonBox * buttonBox = YUI::widgetFactory()->createButtonBox( vbox );
+ YPushButton * okButton = YUI::widgetFactory()->createPushButton( buttonBox, "&OK" );
+ okButton->setRole( YOKButton );
okButton->setDefaultButton();
dialog->waitForEvent();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YDialog.h new/yast2-libyui-2.17.9/src/YDialog.h
--- old/yast2-libyui-2.17.7/src/YDialog.h 2008-06-18 18:21:16.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YDialog.h 2008-09-11 11:52:20.000000000 +0200
@@ -287,6 +287,19 @@
void removeEventFilter( YEventFilter * eventFilter );
/**
+ * Highlight a child widget of this dialog. This is meant for debugging:
+ * YDialogSpy and similar uses.
+ *
+ * No more than one widget can be highlighted at any one time in the same
+ * dialog. Highlighting another widget un-highlights a previously
+ * highlighted widget. 0 means 'unhighlight the last highlighted widget,
+ * but don't highlight any other'.
+ *
+ * This default implementation does nothing.
+ **/
+ virtual void highlight( YWidget * child ) {}
+
+ /**
* Set this dialog's default button (the button that is activated when
* the user hits [Return] anywhere in this dialog). 0 means no default
* button.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YDialogSpy.cc new/yast2-libyui-2.17.9/src/YDialogSpy.cc
--- old/yast2-libyui-2.17.7/src/YDialogSpy.cc 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-libyui-2.17.9/src/YDialogSpy.cc 2008-09-11 13:39:16.000000000 +0200
@@ -0,0 +1,197 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YDialogSpy.cc
+
+ Author: Stefan Hundhammer
+
+/-*/
+
+#include <sstream>
+
+#define YUILogComponent "ui-dialog-spy"
+#include "YUILog.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+/**
+ * Custom tree item class to map tree items to widgets
+ **/
+class YWidgetTreeItem: public YTreeItem
+{
+public:
+ YWidgetTreeItem( YWidget * widget,
+ bool isOpen )
+ : YTreeItem( "", isOpen )
+ , _widget( widget )
+ {
+ setWidgetLabel();
+ }
+
+ YWidgetTreeItem( YWidgetTreeItem * parent,
+ YWidget * widget,
+ bool isOpen )
+ : YTreeItem( parent, "", isOpen )
+ , _widget( widget )
+ {
+ setWidgetLabel();
+ }
+
+ virtual ~YWidgetTreeItem() {}
+ YWidget * widget() const { return _widget; }
+
+
+protected:
+
+ void setWidgetLabel()
+ {
+ std::ostringstream str;
+ str << _widget;
+ setLabel( str.str() );
+ }
+
+private:
+ YWidget * _widget;
+};
+
+
+static void fillTree( YWidgetTreeItem * parent,
+ YWidgetListConstIterator begin,
+ YWidgetListConstIterator end,
+ int treeLevel );
+
+
+
+
+struct YDialogSpyPrivate
+{
+ YDialogSpyPrivate()
+ : targetDialog( 0 )
+ , spyDialog( 0 )
+ , widgetTree( 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 * closeButton;
+};
+
+
+
+YDialogSpy::YDialogSpy( YDialog * targetDialog )
+ : priv( new YDialogSpyPrivate() )
+{
+ if ( ! targetDialog )
+ targetDialog = YDialog::topmostDialog();
+
+ priv->targetDialog = targetDialog;
+ YWidgetFactory * fac = YUI::widgetFactory();
+
+ 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->setNotify( true );
+
+ YWidgetTreeItem * rootItem = new YWidgetTreeItem( targetDialog, true );
+ YUI_CHECK_NEW( rootItem );
+ fillTree( rootItem, targetDialog->childrenBegin(), targetDialog->childrenEnd(), 1 );
+ priv->widgetTree->addItem( rootItem );
+ priv->widgetTree->rebuildTree();
+
+ YButtonBox * buttonBox = fac->createButtonBox( vbox );
+ priv->closeButton = fac->createPushButton( buttonBox, "&Close" );
+ priv->closeButton->setRole( YOKButton );
+}
+
+
+YDialogSpy::~YDialogSpy()
+{
+ if ( priv->spyDialog )
+ priv->spyDialog->destroy();
+}
+
+
+void fillTree( YWidgetTreeItem * parent,
+ YWidgetListConstIterator begin,
+ YWidgetListConstIterator end,
+ int treeLevel )
+{
+ for ( YWidgetListConstIterator it = begin; it != end; ++it )
+ {
+ YWidget * widget = *it;
+ YWidgetTreeItem * item = new YWidgetTreeItem( parent, widget, treeLevel < 4 );
+
+ if ( widget->hasChildren() )
+ fillTree( item, widget->childrenBegin(), widget->childrenEnd(), treeLevel+1 );
+ }
+}
+
+
+void YDialogSpy::exec()
+{
+ YUI_CHECK_PTR( priv->spyDialog );
+
+ while ( true )
+ {
+ YEvent * event = priv->spyDialog->waitForEvent();
+
+ if ( event )
+ {
+ if ( event->widget() == priv->closeButton )
+ {
+ priv->targetDialog->highlight( 0 );
+ return;
+ }
+
+ if ( event->widget() == priv->widgetTree )
+ {
+ yuiDebug() << "Event from " << event->widget() << endl;
+ YWidgetTreeItem * item = (YWidgetTreeItem *) priv->widgetTree->selectedItem();
+ yuiDebug() << "Highlighting " << item << endl;
+
+ if ( item )
+ {
+ priv->targetDialog->highlight( item->widget() );
+ }
+ }
+ }
+ }
+}
+
+
+void YDialogSpy::showDialogSpy( YDialog * dialog )
+{
+ try
+ {
+ YDialogSpy dialogSpy( dialog );
+ dialogSpy.exec();
+ }
+ catch ( YUIException & exception )
+ {
+ YUI_CAUGHT( exception );
+ }
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YDialogSpy.h new/yast2-libyui-2.17.9/src/YDialogSpy.h
--- old/yast2-libyui-2.17.7/src/YDialogSpy.h 1970-01-01 01:00:00.000000000 +0100
+++ new/yast2-libyui-2.17.9/src/YDialogSpy.h 2008-09-09 16:58:52.000000000 +0200
@@ -0,0 +1,75 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YDialogSpy.h
+
+ Author: Stefan Hundhammer
+
+/-*/
+
+
+#ifndef YDialogSpy_h
+#define YDialogSpy_h
+
+#include "ImplPtr.h"
+
+class YDialog;
+class YDialogSpyPrivate;
+
+
+/**
+ * An interactive dialog debugger: Show the structure and content of a dialog
+ * and its widgets.
+ *
+ * This can be invoked by special key combinations:
+ * Ctrl-Alt-Shift-Y in the Qt UI
+ **/
+class YDialogSpy
+{
+public:
+ /**
+ * Show a YDialogSpy for the specified dialog. 0 means "use the topmost
+ * dialog".
+ * This will return only when the user closes the YDialogSpy dialog.
+ **/
+ static void showDialogSpy( YDialog * dialog = 0 );
+
+
+protected:
+ /**
+ * Constructor: Create a YDialogSpy for the specified dialog. 0 means "use
+ * the topmost dialog".
+ *
+ * In most cases it is more useful to use the static showDialogSpy() method
+ * rather than create this dialog directly.
+ **/
+ YDialogSpy( YDialog * dialog = 0 );
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YDialogSpy();
+
+ /**
+ * Execute the event loop. This will only return when the user closes the
+ * YDialogSpy dialog.
+ **/
+ void exec();
+
+
+private:
+
+ ImplPtr<YDialogSpyPrivate> priv;
+};
+
+
+#endif // YDialogSpy_h
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YEvent.cc new/yast2-libyui-2.17.9/src/YEvent.cc
--- old/yast2-libyui-2.17.7/src/YEvent.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YEvent.cc 2008-09-09 16:17:55.000000000 +0200
@@ -27,31 +27,34 @@
using std::string;
-
-unsigned long YEvent::_nextSerial = 0;
-int YEvent::_activeEvents = 0;
+unsigned long YEvent::_nextSerial = 0;
YEvent::YEvent( EventType eventType )
- : _eventType( eventType )
+ : _eventType( eventType )
{
_dialog = YDialog::currentDialog( false ); // don't throw
_serial = _nextSerial++;
-
- if ( ++_activeEvents > 3 )
- {
- yuiError() << "Memory leak? " << _activeEvents << " active events!" << endl;
- }
}
YEvent::~YEvent()
{
- if ( --_activeEvents < 0 )
- {
- yuiError() << "FATAL: More events deleted than destroyed" << endl;
- abort();
- }
+ invalidate();
+}
+
+
+bool
+YEvent::isValid() const
+{
+ return _eventType != InvalidEvent;
+}
+
+
+void
+YEvent::invalidate()
+{
+ _eventType = InvalidEvent;
}
@@ -68,6 +71,7 @@
case CancelEvent: return "CancelEvent";
case TimeoutEvent: return "TimeoutEvent";
case DebugEvent: return "DebugEvent";
+ case InvalidEvent: return "InvalidEvent";
// Intentionally omitting "default" branch so the compiler can
// detect unhandled enums
@@ -118,3 +122,20 @@
{
}
+
+
+std::ostream &
+operator<<( std::ostream & stream, const YEvent * event )
+{
+ if ( event )
+ {
+ stream << YEvent::toString( event->eventType() )
+ << " at " << hex << (void *) event << dec;
+ }
+ else
+ {
+ stream << "<NULL event>";
+ }
+
+ return stream;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YEvent.h new/yast2-libyui-2.17.9/src/YEvent.h
--- old/yast2-libyui-2.17.7/src/YEvent.h 2008-06-05 16:18:44.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YEvent.h 2008-09-09 16:17:12.000000000 +0200
@@ -21,6 +21,7 @@
#include <string>
+#include <iosfwd>
#include "YDialog.h"
#include "YSimpleEventHandler.h"
@@ -47,7 +48,8 @@
KeyEvent,
CancelEvent,
TimeoutEvent,
- DebugEvent
+ DebugEvent,
+ InvalidEvent = 0x4242
};
@@ -98,6 +100,11 @@
YDialog * dialog() const { return _dialog; }
/**
+ * Check if this event is valid. Events become invalid in the destructor.
+ **/
+ bool isValid() const;
+
+ /**
* Returns the character representation of an event type.
**/
static const char * toString( EventType eventType );
@@ -124,7 +131,12 @@
* so dynamic_cast<> can be used.
**/
virtual ~YEvent();
-
+
+ /**
+ * Mark this event as invalid. This cannot be undone.
+ **/
+ void invalidate();
+
private:
friend void YDialog::deleteEvent( YEvent * event );
@@ -140,7 +152,6 @@
YDialog * _dialog;
static unsigned long _nextSerial;
- static int _activeEvents;
};
@@ -342,4 +353,7 @@
};
+std::ostream & operator<<( std::ostream & stream, const YEvent * event );
+
+
#endif // YEvent_h
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YInputField.cc new/yast2-libyui-2.17.9/src/YInputField.cc
--- old/yast2-libyui-2.17.7/src/YInputField.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YInputField.cc 2008-09-10 16:31:32.000000000 +0200
@@ -184,3 +184,10 @@
}
}
+
+const char *
+YInputField::widgetClass() const
+{
+ if ( priv->passwordMode ) return "YPasswordField";
+ else return "YInputField";
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YInputField.h new/yast2-libyui-2.17.9/src/YInputField.h
--- old/yast2-libyui-2.17.7/src/YInputField.h 2008-06-05 16:18:44.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YInputField.h 2008-09-10 16:17:25.000000000 +0200
@@ -61,7 +61,7 @@
* Return a descriptive name of this widget class for logging,
* debugging etc.
**/
- virtual const char * widgetClass() const { return "YInputField"; }
+ virtual const char * widgetClass() const;
/**
* Get the current value (the text entered by the user or set from the
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YLabel.cc new/yast2-libyui-2.17.9/src/YLabel.cc
--- old/yast2-libyui-2.17.7/src/YLabel.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YLabel.cc 2008-09-10 16:16:46.000000000 +0200
@@ -173,3 +173,13 @@
return label;
}
+
+
+
+const char *
+YLabel::widgetClass() const
+{
+ if ( priv->isHeading ) return "YLabel_Heading";
+ else if ( priv->isOutputField ) return "YLabel_OutputField";
+ else return "YLabel";
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YLabel.h new/yast2-libyui-2.17.9/src/YLabel.h
--- old/yast2-libyui-2.17.7/src/YLabel.h 2008-06-05 16:18:44.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YLabel.h 2008-09-10 16:14:13.000000000 +0200
@@ -61,7 +61,7 @@
*
* Reimplemented from YWidget.
**/
- virtual const char * widgetClass() const { return "YLabel"; }
+ virtual const char * widgetClass() const;
/**
* Return the text the widget displays.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YLayoutBox.cc new/yast2-libyui-2.17.9/src/YLayoutBox.cc
--- old/yast2-libyui-2.17.7/src/YLayoutBox.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YLayoutBox.cc 2008-09-11 15:29:11.000000000 +0200
@@ -683,7 +683,9 @@
YWidget * child = *it;
int preferred = child->preferredSize( secondary() );
- if ( child->stretchable( secondary() ) || newSize < preferred )
+ if ( child->stretchable( secondary() ) || newSize < preferred || preferred == 0 )
+ // Also checking for preferred == 0 to make HSpacing / VSpacing visible in YDialogSpy:
+ // Otherwise they would be 0 pixels wide or high, i.e. invisible
{
childSize[i] = newSize;
childPos [i] = 0L;
@@ -749,3 +751,8 @@
}
+const char *
+YLayoutBox::widgetClass() const
+{
+ return primary() == YD_VERT ? "YVBox" : "YHBox";
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YLayoutBox.h new/yast2-libyui-2.17.9/src/YLayoutBox.h
--- old/yast2-libyui-2.17.7/src/YLayoutBox.h 2008-06-05 16:18:44.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YLayoutBox.h 2008-09-10 16:41:45.000000000 +0200
@@ -51,8 +51,7 @@
* Returns a descriptive name of this widget class for logging,
* debugging etc.
**/
- virtual const char * widgetClass() const
- { return primary() == YD_VERT ? "YVBox" : "YHBox"; }
+ virtual const char * widgetClass() const;
/**
* Return the primary dimension, i.e., the dimension this LayoutBox lays
@@ -76,21 +75,6 @@
void setDebugLayout( bool deb = true );
/**
- * Minimum size the widget should have to make it look and feel
- * nice, i.e. all of the widget's preferred size.
- *
- * For the "primary" dimension, this is the sum of the children's
- * preferred sizes with respect to any specified weight ratios -
- * i.e. the weights will always be respected. Children may be
- * stretched as appropriate.
- *
- * For the "other" dimension, this is the maximum of the children's
- * preferred sizes in that dimension.
- *
- * @param dim Dimension, either YD_HORIZ or YD_VERT
- **/
-
- /**
* Preferred size of the widget in the specified dimension.
*
* Reimplemented from YWidget.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YSimpleEventHandler.cc new/yast2-libyui-2.17.9/src/YSimpleEventHandler.cc
--- old/yast2-libyui-2.17.7/src/YSimpleEventHandler.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YSimpleEventHandler.cc 2008-09-09 16:13:48.000000000 +0200
@@ -48,7 +48,7 @@
if ( _pendingEvent )
{
#if VERBOSE_EVENTS
- yuiDebug() << "Clearing pending event: " << YEvent::toString( _pendingEvent->eventType() ) << endl;
+ yuiDebug() << "Clearing pending event: " << _pendingEvent << endl;
#endif
deleteEvent( _pendingEvent );
}
@@ -60,6 +60,10 @@
YEvent * event = _pendingEvent;
_pendingEvent = 0;
+#if VERBOSE_EVENTS
+ yuiDebug() << "Consuming " << event << endl;
+#endif
+
return event;
}
@@ -75,7 +79,7 @@
if ( eventsBlocked() )
{
#if VERBOSE_BLOCK
- yuiDebug() << "Blocking " << YEvent::toString( event->eventType() ) << " event" << endl;
+ yuiDebug() << "Blocking " << event << endl;
#endif
// Avoid memory leak: The event handler assumes ownership of the newly
// created event, so we have to clean it up here.
@@ -100,7 +104,7 @@
}
#if VERBOSE_EVENTS
- yuiDebug() << "New pending event: " << YEvent::toString( event->eventType() ) << endl;
+ yuiDebug() << "New pending event: " << event << endl;
#endif
_pendingEvent = event;
@@ -136,5 +140,17 @@
_pendingEvent = 0;
if ( event )
- delete event;
+ {
+ if ( event->isValid() )
+ {
+#if VERBOSE_EVENTS
+ yuiDebug() << "Deleting " << event << endl;
+#endif
+ delete event;
+ }
+ else
+ {
+ yuiError() << "Attempt to delete invalid event " << event << endl;
+ }
+ }
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YSpacing.cc new/yast2-libyui-2.17.9/src/YSpacing.cc
--- old/yast2-libyui-2.17.7/src/YSpacing.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YSpacing.cc 2008-09-10 16:39:30.000000000 +0200
@@ -90,3 +90,14 @@
}
+const char *
+YSpacing::widgetClass() const
+{
+ if ( priv->size > 0 )
+ return ( priv->dim == YD_HORIZ ) ? "YHSpacing" : "YVSpacing";
+
+ if ( stretchable( YD_HORIZ ) ) return "YHStretch";
+ if ( stretchable( YD_VERT ) ) return "YVStretch";
+
+ return "YSpacing";
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YSpacing.h new/yast2-libyui-2.17.9/src/YSpacing.h
--- old/yast2-libyui-2.17.7/src/YSpacing.h 2008-06-05 16:18:44.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YSpacing.h 2008-09-10 16:21:09.000000000 +0200
@@ -58,7 +58,7 @@
* Return a descriptive name of this widget class for logging,
* debugging etc.
**/
- virtual const char * widgetClass() const { return "YSpacing"; }
+ virtual const char * widgetClass() const;
/**
* Return the primary dimension of this Spacing/Stretch,
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YSquash.cc new/yast2-libyui-2.17.9/src/YSquash.cc
--- old/yast2-libyui-2.17.7/src/YSquash.cc 2008-09-04 15:02:18.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YSquash.cc 2008-09-10 16:32:02.000000000 +0200
@@ -69,3 +69,12 @@
return ! priv->squash[ dim ] && firstChild()->stretchable( dim );
}
+
+const char *
+YSquash::widgetClass() const
+{
+ if ( priv->squash.hor && priv->squash.vert ) return "YHVSquash";
+ else if ( priv->squash.hor ) return "YHSquash";
+ else if ( priv->squash.vert ) return "YVSquash";
+ else return "YSquash_NoSquash";
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/src/YSquash.h new/yast2-libyui-2.17.9/src/YSquash.h
--- old/yast2-libyui-2.17.7/src/YSquash.h 2008-06-05 16:18:43.000000000 +0200
+++ new/yast2-libyui-2.17.9/src/YSquash.h 2008-09-10 16:01:07.000000000 +0200
@@ -53,7 +53,7 @@
* Returns a descriptive name of this widget class for logging,
* debugging etc.
**/
- virtual const char * widgetClass() const { return "YSquash"; }
+ virtual const char * widgetClass() const;
/**
* Returns 'true' if this widget squashes horizontally.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-libyui-2.17.7/VERSION new/yast2-libyui-2.17.9/VERSION
--- old/yast2-libyui-2.17.7/VERSION 2008-09-04 14:37:11.000000000 +0200
+++ new/yast2-libyui-2.17.9/VERSION 2008-09-11 15:42:47.000000000 +0200
@@ -1 +1 @@
-2.17.7
+2.17.9
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org