Hello community, here is the log from the commit of package kdemultimedia4 checked in at Tue Nov 4 18:04:47 CET 2008. -------- --- KDE/kdemultimedia4/kdemultimedia4.changes 2008-10-31 11:12:26.000000000 +0100 +++ /mounts/work_src_done/STABLE/kdemultimedia4/kdemultimedia4.changes 2008-11-04 17:11:49.000000000 +0100 @@ -1,0 +2,5 @@ +Tue Nov 4 17:11:19 CET 2008 - llunak@suse.cz + +- assign multimedia volume shortcuts to KMix (bnc#384745) + +------------------------------------------------------------------- calling whatdependson for head-i586 New: ---- kmix-global-shortcuts.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kdemultimedia4.spec ++++++ --- /var/tmp/diff_new_pack.Mj6394/_old 2008-11-04 18:04:32.000000000 +0100 +++ /var/tmp/diff_new_pack.Mj6394/_new 2008-11-04 18:04:32.000000000 +0100 @@ -26,11 +26,12 @@ Summary: kdemultimedia base package Url: http://www.kde.org Version: 4.1.3 -Release: 1 +Release: 2 Source0: kdemultimedia-%version.tar.bz2 Source1: _upstream Patch0: 4_1_BRANCH.diff Patch1: kmix-autostart.diff +Patch2: kmix-global-shortcuts.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %kde4_runtime_requires Suggests: kde4-juk @@ -58,6 +59,7 @@ %setup -q -n kdemultimedia-%version %patch %patch1 +%patch2 %build %cmake_kde4 -d build @@ -301,6 +303,8 @@ %doc COPYING COPYING.DOC README %changelog +* Tue Nov 04 2008 llunak@suse.cz +- assign multimedia volume shortcuts to KMix (bnc#384745) * Fri Oct 31 2008 dmueller@suse.de - update to 4.1.3 * see http://kde.org/announcements/changelogs/changelog4_1_2to4_1_3.php ++++++ kmix-global-shortcuts.diff ++++++ Subject: Assign multimedia volumeup/volumedown/mute keys to kmix by default From: Lubos Lunak Patch-upstream: no (4.2 seems to have something slightly different) This is just adding global shortcuts with default assignments (the i18n strings are not new, they are also elsewhere) and more or less copy&pasting code from the tray widget that does the same on scrollwheel. --- kmix/kmix.cpp.sav 2008-11-04 16:29:16.000000000 +0100 +++ kmix/kmix.cpp 2008-11-04 17:04:06.000000000 +0100 @@ -122,6 +122,22 @@ void KMixWindow::initActions() action = actionCollection()->addAction("toggle_channels_currentview"); action->setText(i18n("Configure &Channels...")); connect(action, SIGNAL(triggered(bool) ), SLOT(slotConfigureCurrentView())); + + KAction* globalAction = actionCollection()->addAction("increase_volume"); + globalAction->setText(i18n("Increase Volume")); + globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeUp)); + connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotIncreaseVolume())); + + globalAction = actionCollection()->addAction("decrease_volume"); + globalAction->setText(i18n("Decrease Volume")); + globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeDown)); + connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotDecreaseVolume())); + + globalAction = actionCollection()->addAction("mute"); + globalAction->setText(i18n("Toggle Mute")); + globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeMute)); + connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotMute())); + createGUI( "kmixui.rc" ); } @@ -694,6 +710,54 @@ void KMixWindow::newMixerShown(int /*tab } } +// based on code from kmixdockwidget.cpp +void KMixWindow::slotIncreaseVolume() +{ + volumeHelper( true ); +} + +void KMixWindow::slotDecreaseVolume() +{ + volumeHelper( false ); +} + +void KMixWindow::volumeHelper( bool up ) +{ + MixDevice *md = Mixer::getGlobalMasterMD(); + if ( md != 0 ) + { + Volume vol = md->playbackVolume(); + if ( md->playbackVolume().hasVolume() ) + vol = md->playbackVolume(); + else + vol = md->captureVolume(); + + int inc = vol.maxVolume() / 20; + + if ( inc < 1 ) inc = 1; + + for ( int i = 0; i < vol.count(); i++ ) { + int newVal = vol[i] + (inc * ( up ? 1 : -1 )); + if( newVal < 0 ) newVal = 0; + vol.setVolume( (Volume::ChannelID)i, newVal < vol.maxVolume() ? newVal : vol.maxVolume() ); + } + + if ( md->playbackVolume().hasVolume() ) + md->playbackVolume().setVolume(vol); + else + md->captureVolume().setVolume(vol); + (Mixer::getGlobalMasterMixer())->commitVolumeChange(md); + } +} + +void KMixWindow::slotMute() +{ + MixDevice *md = Mixer::getGlobalMasterMD(); + if ( md != 0 ) { + md->setMuted( !md->isMuted() ); + md->mixer()->commitVolumeChange( md ); + } +} #include "kmix.moc" --- kmix/kmix.h.sav 2008-11-04 16:29:16.000000000 +0100 +++ kmix/kmix.h 2008-11-04 16:42:38.000000000 +0100 @@ -70,6 +70,7 @@ KMixWindow : public KXmlGuiWindow void clearMixerWidgets(); void fixConfigAfterRead(); + void volumeHelper( bool up ); virtual bool queryClose(); @@ -124,6 +125,9 @@ KMixWindow : public KXmlGuiWindow void plugged( const char* driverName, const QString& udi, QString& dev); void unplugged( const QString& udi); void hideOrClose(); + void slotIncreaseVolume(); + void slotDecreaseVolume(); + void slotMute(); }; #endif // KMIX_H ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org