Mailinglist Archive: yast-commit (490 mails)

< Previous Next >
[yast-commit] r38474 - in /branches/tmp/sh/mod-ui/qt/src: YQAlignment.cc YQAlignment.h YQCheckBoxFrame.cc YQDumbTab.cc YQFrame.cc YQUI.h YQUI_widgets.cc YQWidgetFactory.cc YQWidgetFactory.h YQWizard.cc
  • From: sh-sh-sh@xxxxxxxxxxxxxxxx
  • Date: Thu, 14 Jun 2007 21:04:51 -0000
  • Message-id: <20070614210451.D626E2387B@xxxxxxxxxxxxxxxx>
Author: sh-sh-sh
Date: Thu Jun 14 23:04:51 2007
New Revision: 38474

URL: http://svn.opensuse.org/viewcvs/yast?rev=38474&view=rev
Log:
adapted to changed YCont

Modified:
    branches/tmp/sh/mod-ui/qt/src/YQAlignment.cc
    branches/tmp/sh/mod-ui/qt/src/YQAlignment.h
    branches/tmp/sh/mod-ui/qt/src/YQCheckBoxFrame.cc
    branches/tmp/sh/mod-ui/qt/src/YQDumbTab.cc
    branches/tmp/sh/mod-ui/qt/src/YQFrame.cc
    branches/tmp/sh/mod-ui/qt/src/YQUI.h
    branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
    branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc
    branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.h
    branches/tmp/sh/mod-ui/qt/src/YQWizard.cc

Modified: branches/tmp/sh/mod-ui/qt/src/YQAlignment.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQAlignment.cc?rev=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQAlignment.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQAlignment.cc Thu Jun 14 23:04:51 2007
@@ -25,12 +25,22 @@
 using std::string;
 
 
-YQAlignment::YQAlignment( QWidget *            parent,
-                         const YWidgetOpt &        opt,
+YQAlignment::YQAlignment( YWidget *            parent,
                          YAlignmentType        horAlign,
                          YAlignmentType        vertAlign )
-    : QWidget( parent )
-    , YAlignment( opt, horAlign, vertAlign )
+    : QWidget( (QWidget *) parent->widgetRep() )
+    , YAlignment( parent, horAlign, vertAlign )
+{
+    setWidgetRep( this );
+}
+
+
+YQAlignment::YQAlignment( YWidget *            yParent,
+                         QWidget *             qParent,
+                         YAlignmentType        horAlign,
+                         YAlignmentType        vertAlign )
+    : QWidget( qParent )
+    , YAlignment( yParent, horAlign, vertAlign )
 {
     setWidgetRep( this );
 }
@@ -57,8 +67,10 @@
 }
 
 
-void YQAlignment::setBackgroundPixmap( string pixmapName )
+void YQAlignment::setBackgroundPixmap( const string & pixmapFileName )
 {
+    string pixmapName = pixmapFileName;
+    
     YAlignment::setBackgroundPixmap( pixmapName );     // Prepend path etc.
     pixmapName = YAlignment::backgroundPixmap();
 

Modified: branches/tmp/sh/mod-ui/qt/src/YQAlignment.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQAlignment.h?rev=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQAlignment.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQAlignment.h Thu Jun 14 23:04:51 2007
@@ -16,7 +16,6 @@
 
 /-*/
 
-// -*- c++ -*-
 
 #ifndef YQAlignment_h
 #define YQAlignment_h
@@ -36,34 +35,51 @@
     /**
      * Constructor.
      */
-    YQAlignment( QWidget *             parent,
-                const YWidgetOpt &         opt,
+    YQAlignment( YWidget *             parent,
                 YAlignmentType         horAlign,
                 YAlignmentType         vertAlign );
 
     /**
-     * Moves a child widget to a new position.
+     * Constructor for cases where the YWidget parent's widgetRep() isn't the
+     * QWidget parent, for example in compound widgets like YQWizard where it
+     * makes sense to pass a child of the YQWizard (the client area) as the
+     * QWidget parent.
+     *
+     * Use this only if you know very well what you are doing.
+     **/
+    YQAlignment( YWidget *             yParent,
+                QWidget *              qParent,
+                YAlignmentType         horAlign,
+                YAlignmentType         vertAlign );
+
+    /**
+     * Move the child widget to a new position.
+     *
+     * Implemented from YAlignment.
      */
-    void moveChild( YWidget * child, long newX, long newY );
+    virtual void moveChild( YWidget * child, long newX, long newY );
 
     /**
-     * Inherited from YWidget: Sets the enabled state of the
-     * widget. All new widgets are enabled per definition. Only
-     * enabled widgets can take user input.
+     * Enable or disable this widget and its child.
+     *
+     * Reimplemented from YWidget.
      */
-    void setEnabled( bool enabled );
+    virtual void setEnabled( bool enabled );
 
     /**
-     * Sets the size
+     * Set the size of this widget and reposition the child accordingly.
+     *
+     * Reimplemented from YWidget.
      */
     void setSize( long newWidth, long newHeight );
 
     /**
      * Set the background pixmap.
+     *
      * Reimplemented from YAlignment.
      **/
-    virtual void setBackgroundPixmap( string px );
-    
+    virtual void setBackgroundPixmap( const string & pixmapFileName );
+
 };
 
 

Modified: branches/tmp/sh/mod-ui/qt/src/YQCheckBoxFrame.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQCheckBoxFrame.cc?rev=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQCheckBoxFrame.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQCheckBoxFrame.cc Thu Jun 14 23:04:51 2007
@@ -142,11 +142,13 @@
 {
     resize ( newWidth, newHeight );
 
-    long newChildWidth  = max ( 0L, newWidth  - 2 * frameWidth() - 1 );
-    long newChildHeight = max ( 0L, newHeight - frameWidth() - fontMetrics().height() - TOP_MARGIN - 1 );
+    if ( hasChildren() )
+    {
+       long newChildWidth  = max ( 0L, newWidth  - 2 * frameWidth() - 1 );
+       long newChildHeight = max ( 0L, newHeight - frameWidth() - fontMetrics().height() - TOP_MARGIN - 1 );
 
-    if ( numChildren() > 0 )
-       YContainerWidget::child(0)->setSize( newChildWidth, newChildHeight );
+       firstChild()->setSize( newChildWidth, newChildHeight );
+    }
 }
 
 
@@ -161,7 +163,7 @@
 long YQCheckBoxFrame::nicesize( YUIDimension dim )
 {
     long niceSize;
-    long childNiceSize = numChildren() > 0 ? YContainerWidget::child(0)->nicesize( dim ) : 0;
+    long childNiceSize = hasChildren() ? firstChild()->nicesize( dim ) : 0;
 
     if ( dim == YD_HORIZ )
     {

Modified: branches/tmp/sh/mod-ui/qt/src/YQDumbTab.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQDumbTab.cc?rev=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQDumbTab.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQDumbTab.cc Thu Jun 14 23:04:51 2007
@@ -78,14 +78,8 @@
     // HVCenter for contents
     //
 
-    YWidgetOpt widgetOpt;
-    _contents = new YQAlignment( _clientArea, widgetOpt, YAlignUnchanged, YAlignUnchanged);
-    CHECK_PTR( _contents );
-
-#warning obsolete
-    addChild( _contents );
-
-    _contents->setParent( this );
+    _contents = new YQAlignment( this, _clientArea, YAlignUnchanged, YAlignUnchanged);
+    YUI_CHECK_NEW( _contents );
     _contents->installEventFilter( this );
 }
 
@@ -153,7 +147,7 @@
     {
        YContainerWidget::addChild( child );
     }
-    else if ( _contents->numChildren() < 1 )
+    else if ( ! hasChildren() )
     {
        //
        // Reparent any other child: Make it a child of _contents (YAlignment)

Modified: branches/tmp/sh/mod-ui/qt/src/YQFrame.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQFrame.cc?rev=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQFrame.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQFrame.cc Thu Jun 14 23:04:51 2007
@@ -50,11 +50,13 @@
 {
     resize ( newWidth, newHeight );
 
-    long newChildWidth  = max ( 0L, newWidth  - 2 * frameWidth() - 1 );
-    long newChildHeight = max ( 0L, newHeight - frameWidth() - fontMetrics().height() - 1 );
+    if ( hasChildren() )
+    {
+       long newChildWidth  = max ( 0L, newWidth  - 2 * frameWidth() - 1 );
+       long newChildHeight = max ( 0L, newHeight - frameWidth() - fontMetrics().height() - 1 );
 
-    if ( numChildren() > 0 )
-       YContainerWidget::child(0)->setSize( newChildWidth, newChildHeight );
+       firstChild()->setSize( newChildWidth, newChildHeight );
+    }
 }
 
 
@@ -69,7 +71,7 @@
 long YQFrame::nicesize( YUIDimension dim )
 {
     long niceSize;
-    long childNiceSize = numChildren() > 0 ? YContainerWidget::child(0)->nicesize( dim ) : 0;
+    long childNiceSize = hasChildren() ? firstChild()->nicesize( dim ) : 0;
 
     if ( dim == YD_HORIZ )
     {

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=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI.h Thu Jun 14 23:04:51 2007
@@ -438,7 +438,6 @@
 
     /*** Widget creation methods, all reimplemented from YUI ***/
 
-    YContainerWidget * createAlignment         ( YWidget * parent, YWidgetOpt & opt, YAlignmentType horAlign, YAlignmentType vertAlign );
     YContainerWidget * createFrame             ( YWidget * parent, YWidgetOpt & opt, const YCPString & label );
     YContainerWidget * createCheckBoxFrame     ( YWidget * parent, YWidgetOpt & opt, const YCPString & label, bool checked );
     YContainerWidget * createRadioButtonGroup  ( 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=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc Thu Jun 14 23:04:51 2007
@@ -102,14 +102,6 @@
 }
 
 
-YContainerWidget * YQUI::createAlignment( YWidget *            parent,
-                                         YWidgetOpt &              opt,
-                                         YAlignmentType        halign,
-                                         YAlignmentType        valign )
-{
-    return new YQAlignment( ( (QWidget *)parent->widgetRep() ), opt, halign, valign);
-}
-
 YContainerWidget * YQUI::createSquash  ( YWidget *             parent,
                                          YWidgetOpt &              opt,
                                          bool                  hsquash,

Modified: branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc?rev=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.cc Thu Jun 14 23:04:51 2007
@@ -326,31 +326,17 @@
 
 
 YQAlignment *
-YQWidgetFactory::createAlignment( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment )
-{
-    return 0; // FIXME: TO DO
-}
-
-
-
-YQAlignment *
-YQWidgetFactory::createMarginBox( YWidget * parent,
-                                 YLayoutSize_t leftMargin, YLayoutSize_t rightMargin,
-                                 YLayoutSize_t topMargin,  YLayoutSize_t bottomMargin )
-{
-    return 0; // FIXME: TO DO
+YQWidgetFactory::createAlignment( YWidget *     parent,
+                                 YAlignmentType horAlignment,
+                                 YAlignmentType vertAlignment )
+{
+    YQAlignment * alignment = new YQAlignment( parent, horAlignment, vertAlignment );
+    YUI_CHECK_NEW( alignment );
+    
+    return alignment;
 }
 
 
-
-YQAlignment *
-YQWidgetFactory::createMinSize( YWidget * parent, YLayoutSize_t minWidth, YLayoutSize_t minHeight )
-{
-    return 0; // FIXME: TO DO
-}
-
-
-
 YQSquash *
 YQWidgetFactory::createSquash( YWidget * parent, bool hSquash, bool vSquash )
 {

Modified: branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.h?rev=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQWidgetFactory.h Thu Jun 14 23:04:51 2007
@@ -129,12 +129,6 @@
     virtual YQEmpty *          createEmpty             ( YWidget * parent );
 
     virtual YQAlignment *      createAlignment         ( YWidget * parent, YAlignmentType horAlignment, YAlignmentType vertAlignment );
-
-    virtual YQAlignment *      createMarginBox         ( YWidget * parent,
-                                                         YLayoutSize_t leftMargin, YLayoutSize_t rightMargin,
-                                                         YLayoutSize_t topMargin,  YLayoutSize_t bottomMargin );
-
-    virtual YQAlignment *      createMinSize           ( YWidget * parent, YLayoutSize_t minWidth, YLayoutSize_t minHeight );
     virtual YQSquash *         createSquash            ( YWidget * parent, bool hSquash, bool vSquash );
 
     //

Modified: branches/tmp/sh/mod-ui/qt/src/YQWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQWizard.cc?rev=38474&r1=38473&r2=38474&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQWizard.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQWizard.cc Thu Jun 14 23:04:51 2007
@@ -1100,13 +1100,11 @@
     // HVCenter for wizard contents
     //
 
-    YWidgetOpt hvstretchOpt;
-    hvstretchOpt.isHStretchable.setValue( true );
-    hvstretchOpt.isVStretchable.setValue( true );
-    _contents = new YQAlignment( _clientArea, hvstretchOpt, YAlignCenter, YAlignCenter );
-    CHECK_PTR( _contents );
+    _contents = new YQAlignment( this, _clientArea, YAlignCenter, YAlignCenter );
+    YUI_CHECK_NEW( _contents );
 
-    addChild( _contents );
+    _contents->setStretchable( YD_HORIZ, true );
+    _contents->setStretchable( YD_VERT,  true );
     _contents->setParent( this );
     _contents->installEventFilter( this );
     _contents->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // hor/vert
@@ -1518,13 +1516,13 @@
 void YQWizard::addChild( YWidget * child )
 {
     if ( dynamic_cast<YQWizardButton *> (child)
-        || child == _contents )
+        || _contents == 0 )
     {
-       YContainerWidget::addChild( child );
+       YWidget::addChild( child );
     }
     else
     {
-       y2error( "Ignoring unwanted %s child", child->widgetClass() );
+       YUI_THROW( YUITooManyChildrenException<YWidget>( this ) );
     }
 }
 

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages