[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdemultimedia/kmix
From:       Christian Esken <esken () kde ! org>
Date:       2005-02-06 12:35:40
Message-ID: 20050206123540.9C4AD1D194 () office ! kde ! org
[Download RAW message or body]

CVS commit by esken: 

Trying to fix KMix Panel Applet sizing problems:
Use a better size hint.
Exchange/remove potentially cobflicting instance variable names (_orientation, \
_position). Inform the real Applet by a signal about possible size changes (after \
                hiding/showing channels).
CCBUG: 90930
CCBUG: 97667


  M +16 -10    viewapplet.cpp   1.8
  M +5 -2      viewapplet.h   1.5


--- kdemultimedia/kmix/viewapplet.cpp  #1.7:1.8
@@ -36,5 +36,5 @@
 
 ViewApplet::ViewApplet(QWidget* parent, const char* name, Mixer* mixer, \
                ViewBase::ViewFlags vflags, KPanelApplet::Position position )
-    : ViewBase(parent, name, mixer, WStyle_Customize|WStyle_NoBorder, vflags) , \
_position(position) +    : ViewBase(parent, name, mixer, \
WStyle_Customize|WStyle_NoBorder, vflags)  {
     // remove the menu bar action, that is put by the "ViewBase" constructor in \
_actions. @@ -42,18 +42,21 @@ ViewApplet::ViewApplet(QWidget* parent, 
     _actions->remove( KStdAction::showMenubar(this, SLOT(toggleMenuBarSlot()), \
_actions) );  
+
     if ( position == KPanelApplet::pLeft || position == KPanelApplet::pRight ) {
-        _orientation = Qt::Vertical;
+      //kdDebug(67100) << "ViewApplet() isVertical" << "\n";
+      _viewOrientation = Qt::Vertical;
     }
     else {
-        _orientation = Qt::Horizontal;
+      //kdDebug(67100) << "ViewApplet() isHorizontal" << "\n";
+      _viewOrientation = Qt::Horizontal;
     }
 
-    if ( _orientation == Qt::Horizontal ) {
+    if ( _viewOrientation == Qt::Horizontal ) {
         _layoutMDW = new QHBoxLayout( this );
-        setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+        setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
     }
     else {
         _layoutMDW = new QVBoxLayout( this );
-        setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+        setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
     }
 
@@ -100,5 +103,5 @@ QWidget* ViewApplet::add(MixDevice *md)
     */
     Qt::Orientation sliderOrientation;
-    if (_orientation == Qt::Horizontal )
+    if (_viewOrientation == Qt::Horizontal )
         sliderOrientation = Qt::Vertical;
     else
@@ -135,5 +138,5 @@ QSize ViewApplet::sizeHint() const {
 
 QSizePolicy ViewApplet::sizePolicy() const {
-    if ( _orientation == Qt::Horizontal ) {
+    if ( _viewOrientation == Qt::Horizontal ) {
         //kdDebug(67100) << "ViewApplet::sizePolicy=(Fixed,Expanding)\n";
         return QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
@@ -151,6 +154,7 @@ void ViewApplet::resizeEvent(QResizeEven
     // decide whether we have to show or hide all icons
     bool showIcons = false;
-    if ( _orientation == Qt::Horizontal ) {
+    if ( _viewOrientation == Qt::Horizontal ) {
         if ( qre->size().height() >= 32 ) {
+            //kdDebug(67100) << "ViewApplet::resizeEvent() hor >=32" << qre->size() \
<< "\n";  showIcons = true;
         }
@@ -158,4 +162,5 @@ void ViewApplet::resizeEvent(QResizeEven
     else {
        if ( qre->size().width() >= 32 ) {
+           //kdDebug(67100) << "ViewApplet::resizeEvent() vert >=32" << qre->size() \
<< "\n";  showIcons = true;
        }
@@ -210,4 +215,5 @@ void ViewApplet::configurationUpdate() {
     updateGeometry();
     _layoutMDW->activate();
+    emit appletContentChanged();
     kdDebug(67100) << "ViewApplet::configurationUpdate()" << endl;
     // the following "emit" is only here to be picked up by KMixApplet, because it \
has to

--- kdemultimedia/kmix/viewapplet.h  #1.4:1.5
@@ -27,4 +27,7 @@ public:
     virtual void resizeEvent(QResizeEvent*);
 
+signals:
+    void appletContentChanged();
+
 public slots:
    virtual void refreshVolumeLevels();
@@ -33,7 +36,7 @@ private:
     QBoxLayout*   _layoutMDW;
     // Position of the applet (pLeft, pRight, pTop, pBottom)
-    KPanelApplet::Position  _position;
+    //KPanelApplet::Position  _KMIXposition;
     // Orientation of the applet (horizontal or vertical)
-    Qt::Orientation _orientation;
+    Qt::Orientation _viewOrientation;
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic