Bug 97666

Summary: icons ruin vertical panel applet usability
Product: [Applications] kmix Reporter: amrit <amrit>
Component: Obsolete component. Do NOT use!!! (ex: KMix Panel Applet).Assignee: Christian Esken <esken>
Status: RESOLVED FIXED    
Severity: minor    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Slackware   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description amrit 2005-01-22 19:19:59 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Slackware Packages

After the upgrade from KDE 3.3.1 to 3.3.2, the mixer applet, when used with a vertical panel, has become useless for small panels.  My Kicker is a 24px wide, and with 3.3.1 the volume bars were just as wide as the panel, with nothing extra.  Now they have a small icon to the left, padding between the icon and the volume bar, and vertical padding between each icon+volume bar.  The last one is only annoying, but the first two make the applet hard to use, as over half the bar is obscured.

I've placed a permanent screenshot at: http://transamrit.net/files/permanent/20050122-kmixBugAndWishList.png

As for the huge space above and below the shown channels, that's a separate bug, which I'll file appropriately (probably under the description "applet does not shrink when channels removed" fyi).

Thanks
Comment 1 amrit 2005-01-22 19:21:58 UTC
Oh sorry, I suppose I should have noted what I'd like to see happen, as well.  IMHO 3.3.1's behavior of no icons and no padding was perfectly fine.  Use the tooltips to find out which channels you want, hide the rest, and then it's set that way forever, so no need for icons or anything.
Comment 2 Christian Esken 2005-02-07 14:03:04 UTC
I can confirm that behaviour. I have checked the situation, and it seems to be a Kicker/Panel problem. It tells me it is 36 pixels wide, when it is only 24 pixels.
Comment 3 Christian Esken 2005-02-08 21:50:00 UTC
The "vertical padding" problem is now fixed.
The "icon" problem unfortunately not.
Comment 4 Christian Esken 2006-02-21 21:44:27 UTC
I finally found the source of the "icon" problem ... YEAH !!!
Somebody put a "spacing" of 36 in the geometry manager, but ONLY in vertical mode. This was a REALLY bad idea!!! The fix will remove all of the the spacing.

The fixed version will ship with KDE3.5.2 . In the KDE4 branch this has already  been removed 6 months ago during a general source code cleanup session.
Comment 5 Christian Esken 2006-02-21 21:49:08 UTC
SVN commit 512112 by esken:

Fix the "icons ruin vertical panel applet usability" issue.
Fix the "Split channel in kmix applet shows one channel as a slider, the
other numerical" issue.

BUGS: 122114
BUGS: 97666



 M  +11 -2     mdwslider.cpp  
 M  +25 -11    viewapplet.cpp  
 M  +3 -0      viewapplet.h  


--- branches/KDE/3.5/kdemultimedia/kmix/mdwslider.cpp #512111:512112
@@ -121,7 +121,6 @@
 	_layout = new QHBoxLayout( this );
 	_layout->setAlignment(Qt::AlignCenter);
     }
-    QToolTip::add( this, m_mixdevice->name() );
 
 	 // -- MAIN SLIDERS LAYOUT  ---
 	 QBoxLayout *slidersLayout;
@@ -154,22 +153,31 @@
 	 }
     if ( _orientation == Qt::Vertical ) {
 		 m_label = new VerticalText( this, m_mixdevice->name().utf8().data() );
+		QToolTip::add( m_label, m_mixdevice->name() );
+
 	 }
 	 else {
 		 m_label = new QLabel(this);
 		 static_cast<QLabel*>(m_label) ->setText(m_mixdevice->name());
+		QToolTip::add( m_label, m_mixdevice->name() );
 	 }
 
 	 m_label->hide();
+
+/* This addSpacing() looks VERY bizarre => removing it (cesken, 21.2.2006).
+   Also horizontal and vertical spacing differs. This doesn't look sensible.
     if ( _orientation == Qt::Horizontal )
 		 labelLayout->addSpacing( 36 );
-
+*/
 	 labelLayout->addWidget( m_label );
 	 m_label->installEventFilter( this );
 
+/* This addSpacing() looks VERY bizarre => removing it (cesken, 21.2.2006)
+   Also horizontal and vertical spacing differs. This doesn't look sensible.
     if ( _orientation == Qt::Vertical ) {
 		 labelLayout->addSpacing( 18 );
 	 }
+*/
 
 	 // -- SLIDERS, LEDS AND ICON
 	 QBoxLayout *sliLayout;
@@ -300,6 +308,7 @@
 		 }
 
 		 slider->installEventFilter( this );
+		 QToolTip::add( slider, m_mixdevice->name() );
 
 		 if( i>0 && isStereoLinked() ) {
 			 // show only one (the first) slider, when the user wants it so
--- branches/KDE/3.5/kdemultimedia/kmix/viewapplet.cpp #512111:512112
@@ -23,6 +23,7 @@
 // Qt
 #include <qwidget.h>
 #include <qlayout.h>
+#include <qsize.h>
 
 // KDE
 #include <kactioncollection.h>
@@ -31,6 +32,7 @@
 #include <kstdaction.h>
 
 // KMix
+#include "kmixtoolbox.h"
 #include "mdwslider.h"
 #include "mixer.h"
 
@@ -120,12 +122,17 @@
 			    this,         // View widget
 			    md->name().latin1()
 			    );
+    static_cast<MDWSlider*>(mdw)->setValueStyle(MixDeviceWidget::NNONE);
+    static_cast<MDWSlider*>(mdw)->setIcons(shouldShowIcons( size()) ); // !!! This should use the panel size
     _layoutMDW->add(mdw);
     return mdw;
 }
 
 void ViewApplet::constructionFinished() {
     _layoutMDW->activate();
+    
+    KMixToolBox::setIcons     ( _mdws, shouldShowIcons( size()) ); // !!! This should use the panel size
+    KMixToolBox::setValueStyle( _mdws, MixDeviceWidget::NNONE);
 }
 
 
@@ -147,24 +154,29 @@
     }
 }
 
-
-void ViewApplet::resizeEvent(QResizeEvent *qre)
-{
-    //kdDebug(67100) << "ViewApplet::resizeEvent() size=" << qre->size() << "\n";
-    // decide whether we have to show or hide all icons
+bool ViewApplet::shouldShowIcons(QSize qsz) {
     bool showIcons = false;
     if ( _viewOrientation == Qt::Horizontal ) {
-	if ( qre->size().height() >= 32 ) {
-	    //kdDebug(67100) << "ViewApplet::resizeEvent() hor >=32" << qre->size() << "\n";
-	    showIcons = true;
-	}
+        if ( qsz.height() >= 32 ) {
+            //kdDebug(67100) << "ViewApplet::resizeEvent() hor >=32" << qre->size() << "\n";
+            showIcons = true;
+        }
     }
     else {
-       if ( qre->size().width() >= 32 ) {
+       if ( qsz.width() >= 32 ) {
            //kdDebug(67100) << "ViewApplet::resizeEvent() vert >=32" << qre->size() << "\n";
            showIcons = true;
        }
     }
+    return showIcons;
+}
+
+void ViewApplet::resizeEvent(QResizeEvent *qre)
+{
+    //kdDebug(67100) << "ViewApplet::resizeEvent() size=" << qre->size() << "\n";
+    // decide whether we have to show or hide all icons
+    bool showIcons = shouldShowIcons(qre->size());
+
     for ( QWidget *mdw = _mdws.first(); mdw != 0; mdw = _mdws.next() ) {
 	if ( mdw == 0 ) {
 	    kdError(67100) << "ViewApplet::resizeEvent(): mdw == 0\n";
@@ -173,6 +185,7 @@
 	else {
 	    if ( mdw->inherits("MDWSlider")) {
 		static_cast<MDWSlider*>(mdw)->setIcons(showIcons);
+		static_cast<MDWSlider*>(mdw)->setValueStyle(MixDeviceWidget::NNONE);
 		//static_cast<MDWSlider*>(mdw)->resize(qre->size());
 	    }
 	}
@@ -213,7 +226,8 @@
 
 void ViewApplet::configurationUpdate() {
     updateGeometry();
-    _layoutMDW->activate();
+    //_layoutMDW->activate();
+    constructionFinished(); // contains "_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
--- branches/KDE/3.5/kdemultimedia/kmix/viewapplet.h #512111:512112
@@ -6,6 +6,8 @@
 
 class QBoxLayout;
 class QHBox;
+class QSize;
+
 class Mixer;
 
 class ViewApplet : public ViewBase
@@ -33,6 +35,7 @@
    virtual void refreshVolumeLevels();
 
 private:
+    bool shouldShowIcons(QSize);
     QBoxLayout*   _layoutMDW;
     // Position of the applet (pLeft, pRight, pTop, pBottom)
     //KPanelApplet::Position  _KMIXposition;
Comment 6 amrit 2006-02-22 14:48:09 UTC
On Tuesday 21 February 2006 12:44, Christian Esken wrote:
[bugs.kde.org quoted mail]

Wow!  I thought this bug ended up in /dev/null.. I had resorted to using the 
horizontal panel again.  Great to hear that this is fixed though, KDE rocks 
because of people like you. :)