summaryrefslogtreecommitdiffstats
path: root/playerwidget.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2017-03-25 09:01:41 +0100
committerArno <arno@disconnect.de>2017-03-25 09:01:41 +0100
commitbe7f32353d736ff1dc1f74ae80e301ce72044dee (patch)
tree46e0bdc022605058031da77c2d9e1b6edd39411d /playerwidget.cpp
parenta55b7eb7a765f09f0e83e9d3ce5696f540b6bd9b (diff)
downloadBeetPlayer-be7f32353d736ff1dc1f74ae80e301ce72044dee.tar.gz
BeetPlayer-be7f32353d736ff1dc1f74ae80e301ce72044dee.tar.bz2
BeetPlayer-be7f32353d736ff1dc1f74ae80e301ce72044dee.zip
Show Popup-Window on various occasions
When we play a new song, get paused, continue and change volume. The hardest part was to display the QWidget on the current desktop. Turns out KWindowSystem and Qt::ToolWindow don't work together well... I should post that on my blog, I guess...
Diffstat (limited to 'playerwidget.cpp')
-rw-r--r--playerwidget.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp
index f026bfe..035db06 100644
--- a/playerwidget.cpp
+++ b/playerwidget.cpp
@@ -31,6 +31,7 @@
#include "playerwidget.h"
#include "beetview.h"
#include "indexerdialog.h"
+#include "toolwindow.h"
#include "globals.h"
#include "helper.h"
@@ -54,6 +55,9 @@ void PlayerWidget::setupGui(){
mTrayIcon->setIcon(QIcon(":/stop.png"));
mTrayIcon->show();
+ //tool window
+ mToolWin = new ToolWindow;
+
//THE view
mView = new BeetView;
mView->setAlternatingRowColors(true);
@@ -628,6 +632,8 @@ void PlayerWidget::doPlay(){
emit setWinTitle(mCurWinTitle);
mTrayIcon->setIcon(QIcon(":/play.png"));
mTrayIcon->setToolTip(mCurWinTitle);
+ mToolWin->toHTML(tr("[Continue...]"));
+ mToolWin->showMe();
return;
}
int playListCount = mPlayListModel->rowCount();
@@ -652,6 +658,8 @@ void PlayerWidget::doStop(){
emit setWinTitle(winTitle);
mTrayIcon->setIcon(QIcon(":/stop.png"));
mTrayIcon->setToolTip(tr("[Stopped]"));
+ mToolWin->toHTML("[Stopped]");
+ mToolWin->showMe();
}
void PlayerWidget::doPause(){
@@ -662,6 +670,8 @@ void PlayerWidget::doPause(){
emit setWinTitle(winTitle);
mTrayIcon->setIcon(QIcon(":/pause.png"));
mTrayIcon->setToolTip(tr("[Paused]"));
+ mToolWin->toHTML("[Paused]");
+ mToolWin->showMe();
}
void PlayerWidget::doPlayOrPause(){
@@ -1000,6 +1010,14 @@ void PlayerWidget::play(const QString &fullPath){
emit message(msg);
mCurWinTitle = QString(tr("%1 [%2 - %3 - %4]")).arg(qApp->applicationName()).arg(artist).arg(album).arg(title);
emit setWinTitle(mCurWinTitle);
+ QString toolStr;
+ toolStr.append("<html><body>");
+ toolStr.append(QString("<p style=\"margin:7px;\"><span style=\"font-weight: bold; font-size: large;\">%1</span></p>").arg(artist));
+ toolStr.append(QString("<p style=\"margin:7px;\"><span style=\"font-weight: normal; font-size: medium;\">%1</span></p>").arg(title));
+ toolStr.append("</body></html>");
+ mToolWin->setText(toolStr);
+ mToolWin->showMe();
+
mPlayer->play();
mPlayA->setChecked(true);
emit playModeChanged(tr("Playing"));
@@ -1008,10 +1026,19 @@ void PlayerWidget::play(const QString &fullPath){
void PlayerWidget::volumeChanged(int volume){
QString s = QString("%1 %").arg(volume, 3, 10, QChar('0'));
mVolumePos->setText(s);
+ QString tool = QString(tr("Volume: %1")).arg(s);
+ mToolWin->toHTML(tool);
+ mToolWin->showMe();
}
void PlayerWidget::mute(bool triggered){
mPlayer->setMuted(triggered);
+ if(triggered){
+ mToolWin->toHTML(tr("[Muted]"));
+ }else{
+ mToolWin->toHTML(tr("[Unmuted]"));
+ }
+ mToolWin->showMe();
}
void PlayerWidget::next(){