Part of batch commit to enable true tasktray resize support for Trinity applications

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1124758 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent ba91edcc60
commit 13c0220b02

@ -112,7 +112,7 @@ KMixDockWidget::createMasterVolWidget()
// In case that there is no mixer installed, there will be no newVolumeLevels() signal's
// Thus we prepare the dock areas manually
setVolumeTip();
updatePixmap();
updatePixmap(false);
return;
}
// create devices
@ -126,7 +126,7 @@ KMixDockWidget::createMasterVolWidget()
The call to m_mixer->readSetFromHWforceUpdate() is most likely superfluous, even if we don't use QSocketNotifier (e.g. in backends OSS, Solaris, ...)
*/
setVolumeTip();
updatePixmap();
updatePixmap(false);
/* We are setting up 3 connections:
* Refreshig the _dockAreaPopup (not anymore neccesary, because ViewBase already does it)
* Refreshing the Tooltip
@ -135,9 +135,13 @@ KMixDockWidget::createMasterVolWidget()
*/
// connect( m_mixer, SIGNAL(newVolumeLevels()), _dockAreaPopup, SLOT(refreshVolumeLevels()) );
connect( m_mixer, SIGNAL(newVolumeLevels()), this, SLOT(setVolumeTip() ) );
connect( m_mixer, SIGNAL(newVolumeLevels()), this, SLOT(updatePixmap() ) );
connect( m_mixer, SIGNAL(newVolumeLevels()), this, SLOT(slotUpdatePixmap() ) );
}
void KMixDockWidget::slotUpdatePixmap()
{
updatePixmap(false);
}
void KMixDockWidget::selectMaster()
{
@ -208,7 +212,7 @@ KMixDockWidget::setVolumeTip()
}
void
KMixDockWidget::updatePixmap()
KMixDockWidget::updatePixmap(bool force)
{
MixDevice *md = 0;
if ( _dockAreaPopup != 0 ) {
@ -228,17 +232,29 @@ KMixDockWidget::updatePixmap()
newPixmapType = 'd';
}
if ( newPixmapType != _oldPixmapType ) {
if (( newPixmapType != _oldPixmapType ) || (force == true)) {
// Pixmap must be changed => do so
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
QPixmap origpixmap;
QPixmap scaledpixmap;
QImage newIcon;
switch ( newPixmapType ) {
case 'e': setPixmap( loadIcon( "kmixdocked_error" ) ); break;
case 'm': setPixmap( loadIcon( "kmixdocked_mute" ) ); break;
case 'd': setPixmap( loadIcon( "kmixdocked" ) ); break;
case 'e': origpixmap = loadSizedIcon( "kmixdocked_error", width() ); break;
case 'm': origpixmap = loadSizedIcon( "kmixdocked_mute" , width() ); break;
case 'd': origpixmap = loadSizedIcon( "kmixdocked" , width() ); break;
}
newIcon = origpixmap;
newIcon = newIcon.smoothScale(width(), height());
scaledpixmap = newIcon;
setPixmap(scaledpixmap);
_oldPixmapType = newPixmapType;
}
}
_oldPixmapType = newPixmapType;
void KMixDockWidget::resizeEvent ( QResizeEvent * )
{
updatePixmap(true);
}
void
@ -260,7 +276,7 @@ KMixDockWidget::mousePressEvent(QMouseEvent *me)
// Case 2: User wants to show volume popup
if ( _dockAreaPopup->justHidden() )
return;
if ( _dockAreaPopup->isVisible() )
{
_dockAreaPopup->hide();

@ -56,7 +56,8 @@ class KMixDockWidget : public KSystemTray {
public slots:
void setVolumeTip();
void updatePixmap();
void updatePixmap(bool force);
void slotUpdatePixmap();
protected:
void createMasterVolWidget();
@ -66,6 +67,7 @@ class KMixDockWidget : public KSystemTray {
void wheelEvent(QWheelEvent *);
void contextMenuAboutToShow( KPopupMenu* menu );
void toggleMinimizeRestore();
void resizeEvent ( QResizeEvent * );
private:
bool _playBeepOnVolumeChange;

Loading…
Cancel
Save