[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [dragon/volumeactions] src/app: add volume actions
From:       Harald Sitter <sitter () kde ! org>
Date:       2012-05-31 21:23:58
Message-ID: 20120531212358.5224DA60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 36901a362a2dd5650fcac7edf8fd876cb067086c by Harald Sitter.
Committed on 31/05/2012 at 23:23.
Pushed by sitter into branch 'volumeactions'.

add volume actions

not quite sure if this should go into 4.9 though

CCBUG: 206717

M  +10   -0    src/app/mainWindow.cpp
M  +12   -0    src/app/videoWindow.cpp
M  +3    -0    src/app/videoWindow.h

http://commits.kde.org/dragon/36901a362a2dd5650fcac7edf8fd876cb067086c

diff --git a/src/app/mainWindow.cpp b/src/app/mainWindow.cpp
index 9db6f87..b74b6ed 100644
--- a/src/app/mainWindow.cpp
+++ b/src/app/mainWindow.cpp
@@ -301,6 +301,16 @@ MainWindow::setupActions()
     new PlayAction( this, SLOT(play()), ac );
     new VolumeAction( this, SLOT(toggleVolumeSlider(bool)), ac );
 
+    KAction *action = new KAction(i18nc("@action", "Increase Volume"), ac);
+    action->setObjectName(QLatin1String("volume_inc"));
+    connect(action, SIGNAL(triggered()), engine(), SLOT(increaseVolume()));
+    addToAc(action);
+
+    action = new KAction(i18nc("@action", "Decrease Volume"), ac);
+    action->setObjectName(QLatin1String("volume_dec"));
+    connect(action, SIGNAL(triggered()), engine(), SLOT(decreaseVolume()));
+    addToAc(action);
+
     KAction* playerStop = new KAction( KIcon(QLatin1String( "media-playback-stop" \
)), i18n("Stop"), ac );  playerStop->setObjectName( QLatin1String( "stop" ) );
     playerStop->setShortcut( Qt::Key_S );
diff --git a/src/app/videoWindow.cpp b/src/app/videoWindow.cpp
index 62ab1a9..7659a66 100644
--- a/src/app/videoWindow.cpp
+++ b/src/app/videoWindow.cpp
@@ -722,6 +722,18 @@ VideoWindow::tenSecondsForward()
     relativeSeek( 10000 );
 }
 
+void
+VideoWindow::increaseVolume()
+{
+    m_aOutput->setVolume(qMin(1.0, volume() + 0.10));
+}
+
+void
+VideoWindow::decreaseVolume()
+{
+    m_aOutput->setVolume(qMax(0.0, volume() - 0.10));
+}
+
 ///////////
 ///Protected
 ///////////
diff --git a/src/app/videoWindow.h b/src/app/videoWindow.h
index c695add..310deec 100644
--- a/src/app/videoWindow.h
+++ b/src/app/videoWindow.h
@@ -150,6 +150,9 @@ namespace Dragon
         void tenSecondsBack();
         void tenSecondsForward();
 
+        void increaseVolume();
+        void decreaseVolume();
+
     protected:
         virtual bool event( QEvent* e );
         virtual void contextMenuEvent( QContextMenuEvent * event );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic