Patch for global shortcuts on Windows

Ian Monroe ian.monroe at gmail.com
Sat Aug 8 18:53:07 CEST 2009


On Sat, Aug 8, 2009 at 7:36 AM, Casper van
Donderen<casper.vandonderen at gmail.com> wrote:
> There has been a bug report this week about multimediakeys in
> KDE/Amarok ( https://bugs.kde.org/show_bug.cgi?id=202747 )
> Because of this I have been looking into the shortcuts on Windows.
>
> it appears that MS locked all combinations with the plus and minus
> keys to OS functions (even though not used, ctrl+alt+minus is to zoom
> out using the screen magnifier, I never use that but still I cannot
> use the combo in Amarok)
>
> So for now I made a patch to switch to using Meta+<up/down> for volume changes:
>
> diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
> index d451cb9..7339ded 100644
> --- a/src/MainWindow.cpp
> +++ b/src/MainWindow.cpp
> @@ -694,13 +694,21 @@ MainWindow::createActions()
>
>     action = new KAction( i18n( "Increase Volume" ), this );
>     ac->addAction( "increaseVolume", action );
> +    #ifndef Q_WS_WIN
>     action->setGlobalShortcut( KShortcut( Qt::META + Qt::Key_Plus ) );
> +    #else Q_WS_WIN
> +    action->setGlobalShortcut( KShortcut( Qt::META + Qt::Key_Up ) );
> +    #endif Q_WS_WIN
>     action->setShortcut( Qt::Key_Plus );
>     connect( action, SIGNAL( triggered() ), ec, SLOT( increaseVolume() ) );
>
>     action = new KAction( i18n( "Decrease Volume" ), this );
>     ac->addAction( "decreaseVolume", action );
> +    #ifndef Q_WS_WIN
>     action->setGlobalShortcut( KShortcut( Qt::META + Qt::Key_Minus ) );
> +    #else Q_WS_WIN
> +    action->setGlobalShortcut( KShortcut( Qt::META + Qt::Key_Down ) );
> +    #endif Q_WS_WIN
>     action->setShortcut( Qt::Key_Minus );
>     connect( action, SIGNAL( triggered() ), ec, SLOT( decreaseVolume() ) );

Looks fine to me. Just add some comments to explain why this
difference is needed. :)

Ian


More information about the Amarok-devel mailing list