Bug 122114

Summary: Split channel in kmix applet shows one channel as a slider, the other numerical
Product: [Applications] kmix Reporter: beroot
Component: Obsolete component. Do NOT use!!! (ex: KMix Panel Applet).Assignee: Christian Esken <esken>
Status: RESOLVED FIXED    
Severity: normal    
Priority: VHI    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: screenshot of the split channel behaviour
the corresponding kmix_panelapplet_rc

Description beroot 2006-02-16 18:20:25 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    Compiled From Sources
Compiler:          gcc-3.4.5 
OS:                Linux

I have master and PCM Channel shown in the kmix panel applet. When I split a channel, the left is shown as expected, the right is shown by a field with a percentage in it. 
I got this the first time with kde-3.5.1. I deleted the config file in my home directory (kmix_panelapplet_rc) to see if that's the problem and it helped for the moment. But now the same behaviour is back.
Comment 1 beroot 2006-02-16 18:21:39 UTC
Created attachment 14722 [details]
screenshot of the split channel behaviour
Comment 2 beroot 2006-02-16 18:24:24 UTC
Created attachment 14723 [details]
the corresponding kmix_panelapplet_rc
Comment 3 Christian Esken 2006-02-19 00:45:59 UTC
I can reproduce the problem. As it is looking very weird, priority is raised to VHI.
Target milestone: KDE3.5.2
Comment 4 Christian Esken 2006-02-21 21:46:35 UTC
I added a fix for this situation. I cannot reproduce this anymore with the fix.

The fixed version will ship with KDE3.5.2 . In the KDE4 branch this feature is not yet implemented - the issue must be kept in mind for KDE4.
Comment 5 Christian Esken 2006-02-21 21:49:11 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;