changeset 10:f290e8c4e097

Add media icons to player widget
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 26 Mar 2015 16:41:08 +0100
parents e3c8f61e45a9
children 2881cd0d9da7
files src/l10n/main_de_DE.ts src/pngplayer.cpp
diffstat 2 files changed, 21 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/l10n/main_de_DE.ts	Thu Mar 26 16:30:18 2015 +0100
+++ b/src/l10n/main_de_DE.ts	Thu Mar 26 16:41:08 2015 +0100
@@ -101,32 +101,32 @@
 <context>
     <name>PNGPlayer</name>
     <message>
-        <location filename="../pngplayer.cpp" line="67"/>
+        <location filename="../pngplayer.cpp" line="75"/>
         <source>Speed:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="116"/>
+        <location filename="../pngplayer.cpp" line="124"/>
         <source>Screenshot Nr.:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="118"/>
+        <location filename="../pngplayer.cpp" line="126"/>
         <source>Timestamp:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="119"/>
+        <location filename="../pngplayer.cpp" line="127"/>
         <source>Unknown</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="128"/>
+        <location filename="../pngplayer.cpp" line="136"/>
         <source>%1 second per Picture</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../pngplayer.cpp" line="131"/>
+        <location filename="../pngplayer.cpp" line="139"/>
         <source>%1 seconds per Picture</source>
         <translation type="unfinished"></translation>
     </message>
--- a/src/pngplayer.cpp	Thu Mar 26 16:30:18 2015 +0100
+++ b/src/pngplayer.cpp	Thu Mar 26 16:41:08 2015 +0100
@@ -14,6 +14,8 @@
 #include <QHBoxLayout>
 #include <QSlider>
 #include <QSettings>
+#include <QApplication>
+#include <QStyle>
 
 #include <QDebug>
 
@@ -32,25 +34,31 @@
     QHBoxLayout *controlArea = new QHBoxLayout;
     QHBoxLayout *controlBtns = new QHBoxLayout;
     controlArea->addLayout(controlBtns);
+    controlArea->addStretch(-1);
 
-    QPushButton *firstBtn = new QPushButton("First");
+    QPushButton *firstBtn = new QPushButton;
+    firstBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaSkipBackward));
     controlBtns->addWidget(firstBtn);
     connect(firstBtn, &QPushButton::clicked, this, &PNGPlayer::firstClicked);
 
-    QPushButton *prevBtn = new QPushButton("Prev");
+    QPushButton *prevBtn = new QPushButton;
+    prevBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaSeekBackward));
     controlBtns->addWidget(prevBtn);
     connect(prevBtn, &QPushButton::clicked, this, &PNGPlayer::back);
 
-    mPlayBtn = new QPushButton("Play");
+    mPlayBtn = new QPushButton;
     mPlayBtn->setCheckable(true);
+    mPlayBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPlay));
     controlBtns->addWidget(mPlayBtn);
     connect(mPlayBtn, &QPushButton::clicked, this, &PNGPlayer::togglePlay);
 
-    QPushButton *nextBtn = new QPushButton("Next");
+    QPushButton *nextBtn = new QPushButton;
+    nextBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaSeekForward));
     connect(nextBtn, &QPushButton::clicked, this, &PNGPlayer::advance);
     controlBtns->addWidget(nextBtn);
 
-    QPushButton *lastBtn = new QPushButton("Last");
+    QPushButton *lastBtn = new QPushButton;
+    lastBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaSkipForward));
     controlBtns->addWidget(lastBtn);
     connect(lastBtn, &QPushButton::clicked, this, &PNGPlayer::lastClicked);
 
@@ -137,12 +145,12 @@
 void PNGPlayer::togglePlay() {
     if (mAdvanceTimer.isActive()) {
         mAdvanceTimer.stop();
-        mPlayBtn->setText("Play");
         mPlayBtn->setChecked(false);
+        mPlayBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPlay));
     } else {
         mAdvanceTimer.start();
-        mPlayBtn->setText("Pause");
         mPlayBtn->setChecked(true);
+        mPlayBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPause));
         emit advance();
     }
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)