File kmix-default-keybindings.diff of Package kdemultimedia3
--- kmix/kmix.cpp 2007/01/16 15:27:38 1.9
+++ kmix/kmix.cpp 2007/01/16 15:31:04
@@ -125,11 +125,11 @@
m_globalAccel = new KGlobalAccel( this );
m_globalAccel->insert( "Increase volume", i18n( "Increase Volume of Master Channel"), QString::null,
- KShortcut(), KShortcut(), this, SLOT( increaseVolume() ) );
+ KShortcut(Key_VolumeUp), KShortcut(Key_VolumeUp), this, SLOT( increaseVolume() ) );
m_globalAccel->insert( "Decrease volume", i18n( "Decrease Volume of Master Channel"), QString::null,
- KShortcut(), KShortcut(), this, SLOT( decreaseVolume() ) );
+ KShortcut(Key_VolumeDown), KShortcut(Key_VolumeDown), this, SLOT( decreaseVolume() ) );
m_globalAccel->insert( "Toggle mute", i18n( "Toggle Mute of Master Channel"), QString::null,
- KShortcut(), KShortcut(), this, SLOT( toggleMuted() ) );
+ KShortcut(Key_VolumeMute), KShortcut(Key_VolumeMute), this, SLOT( toggleMuted() ) );
m_globalAccel->readSettings();
m_globalAccel->updateConnections();
@@ -551,9 +551,7 @@
show();
}
- this->repaint(); // make KMix look fast (saveConfig() often uses several seconds)
- kapp->processEvents();
- saveConfig();
+ QTimer::singleShot(0, this, SLOT(saveConfig()));
}
@@ -623,6 +621,8 @@
if ( mixerMaster != 0 ) {
MixDevice* md = mixerMaster->masterDevice();
if ( md != 0 && md->hasMute() ) {
+ if (!isVisible() && m_dockWidget)
+ m_dockWidget->prepareOSD();
mixerMaster->toggleMute(md->num());
}
}
@@ -635,6 +635,8 @@
if ( mixerMaster != 0 ) {
MixDevice* md = mixerMaster->masterDevice();
if ( md != 0 ) {
+ if (!isVisible() && m_dockWidget)
+ m_dockWidget->prepareOSD();
mixerMaster->increaseVolume(md->num());
}
}
@@ -647,6 +649,8 @@
if ( mixerMaster != 0 ) {
MixDevice* md = mixerMaster->masterDevice();
if ( md != 0 ) {
+ if (!isVisible() && m_dockWidget)
+ m_dockWidget->prepareOSD();
mixerMaster->decreaseVolume(md->num());
}
}
Index: kmix/kmix.h
===================================================================
--- kmix/kmix.h (revision 606690)
+++ kmix/kmix.h (working copy)
@@ -64,7 +64,6 @@ KMixWindow : public KMainWindow
void saveSettings();
protected:
- void saveConfig();
void loadConfig();
void initPrefDlg();
@@ -79,6 +78,7 @@ KMixWindow : public KMainWindow
void hideEvent( QHideEvent * );
public slots:
+ void saveConfig();
void quit();
void showSettings();
void showHelp();
Index: kmix/kmixdockwidget.cpp
===================================================================
--- kmix/kmixdockwidget.cpp (revision 606690)
+++ kmix/kmixdockwidget.cpp (working copy)
@@ -68,6 +68,7 @@ KMixDockWidget::KMixDockWidget( Mixer *m
createActions();
createMasterVolWidget();
connect(this, SIGNAL(quitSelected()), kapp, SLOT(quitExtended()));
+ connect(&_volumePopupHide, SIGNAL(timeout()), SLOT(hideDockAreaPopup()));
}
KMixDockWidget::~KMixDockWidget()
@@ -206,6 +207,22 @@ KMixDockWidget::setVolumeTip()
_oldToolTipValue = newToolTipValue;
}
+void KMixDockWidget::prepareOSD()
+{
+ if (_dockAreaPopup && !_dockAreaPopup->isVisible()) {
+
+ popupVolumePopup();
+ _volumePopupHide.stop();
+ _volumePopupHide.start(2000, true /* single shot */);
+ }
+}
+
+void KMixDockWidget::hideDockAreaPopup()
+{
+ if (_dockAreaPopup && _dockAreaPopup->isVisible())
+ _dockAreaPopup->hide();
+}
+
void
KMixDockWidget::updatePixmap()
{
@@ -241,6 +258,34 @@ KMixDockWidget::updatePixmap()
}
void
+KMixDockWidget::popupVolumePopup()
+{
+ int h = _dockAreaPopup->height();
+ int x = this->mapToGlobal( QPoint( 0, 0 ) ).x() + this->width()/2 - _dockAreaPopup->width()/2;
+ int y = this->mapToGlobal( QPoint( 0, 0 ) ).y() - h;
+ if ( y < 0 )
+ y = y + h + this->height();
+
+ _dockAreaPopup->move(x, y); // so that the mouse is outside of the widget
+
+ // Now handle Multihead displays. And also make sure that the dialog is not
+ // moved out-of-the screen on the right (see Bug 101742).
+ QDesktopWidget* vdesktop = QApplication::desktop();
+ const QRect& vScreenSize = vdesktop->screenGeometry(_dockAreaPopup);
+ if ( (x+_dockAreaPopup->width()) > (vScreenSize.width() + vScreenSize.x()) ) {
+ // move horizontally, so that it is completely visible
+ _dockAreaPopup->move(vScreenSize.width() + vScreenSize.x() - _dockAreaPopup->width() -1 , y);
+ } // horizontally out-of bound
+ else if ( x < vScreenSize.x() ) {
+ _dockAreaPopup->move(vScreenSize.x(), y);
+ }
+ // the above stuff could also be implemented vertically
+
+ _dockAreaPopup->show();
+ KWin::setState(_dockAreaPopup->winId(), NET::StaysOnTop | NET::SkipTaskbar | NET::SkipPager );
+}
+
+void
KMixDockWidget::mousePressEvent(QMouseEvent *me)
{
if ( _dockAreaPopup == 0 ) {
@@ -265,31 +310,7 @@ KMixDockWidget::mousePressEvent(QMouseEv
_dockAreaPopup->hide();
return;
}
-
- int h = _dockAreaPopup->height();
- int x = this->mapToGlobal( QPoint( 0, 0 ) ).x() + this->width()/2 - _dockAreaPopup->width()/2;
- int y = this->mapToGlobal( QPoint( 0, 0 ) ).y() - h;
- if ( y < 0 )
- y = y + h + this->height();
-
- _dockAreaPopup->move(x, y); // so that the mouse is outside of the widget
-
- // Now handle Multihead displays. And also make sure that the dialog is not
- // moved out-of-the screen on the right (see Bug 101742).
- QDesktopWidget* vdesktop = QApplication::desktop();
- const QRect& vScreenSize = vdesktop->screenGeometry(_dockAreaPopup);
- if ( (x+_dockAreaPopup->width()) > (vScreenSize.width() + vScreenSize.x()) ) {
- // move horizontally, so that it is completely visible
- _dockAreaPopup->move(vScreenSize.width() + vScreenSize.x() - _dockAreaPopup->width() -1 , y);
- } // horizontally out-of bound
- else if ( x < vScreenSize.x() ) {
- _dockAreaPopup->move(vScreenSize.x(), y);
- }
- // the above stuff could also be implemented vertically
-
- _dockAreaPopup->show();
- KWin::setState(_dockAreaPopup->winId(), NET::StaysOnTop | NET::SkipTaskbar | NET::SkipPager );
-
+ popupVolumePopup();
QWidget::mousePressEvent(me); // KSystemTray's shouldn't do the default action for this
return;
} // LeftMouseButton pressed
Index: kmix/kmixdockwidget.h
===================================================================
--- kmix/kmixdockwidget.h (revision 606690)
+++ kmix/kmixdockwidget.h (working copy)
@@ -57,6 +57,9 @@ class KMixDockWidget : public KSystemTra
public slots:
void setVolumeTip();
void updatePixmap();
+ void prepareOSD();
+
+ void hideDockAreaPopup();
protected:
void createMasterVolWidget();
@@ -73,6 +76,8 @@ class KMixDockWidget : public KSystemTra
int _oldToolTipValue;
char _oldPixmapType;
bool _volumePopup;
+ QTimer _volumePopupHide;
+ void popupVolumePopup();
private slots:
void dockMute();
void selectMaster();