aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp
diff options
context:
space:
mode:
authorZackaryWelch <welch.zackary@gmail.com>2018-04-27 13:43:29 -0400
committerZackaryWelch <welch.zackary@gmail.com>2018-04-27 13:43:29 -0400
commit0793bddd026d7b2e9bfcf6e33ad76674adb89fce (patch)
treec740c7e24827b07db81e1373ffe882f7801f231a /src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp
parentMerge branch 'master' of http://github.com/trueos/lumina (diff)
parentMake sure the libreoffice icons are no longer bypassed. Use the ones in the c... (diff)
downloadlumina-0793bddd026d7b2e9bfcf6e33ad76674adb89fce.tar.gz
lumina-0793bddd026d7b2e9bfcf6e33ad76674adb89fce.tar.bz2
lumina-0793bddd026d7b2e9bfcf6e33ad76674adb89fce.zip
Merge branch 'master' of http://github.com/trueos/lumina
Diffstat (limited to 'src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp
index 73275acd..7449f6b3 100644
--- a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp
+++ b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp
@@ -13,6 +13,8 @@
#include <QApplication>
#include <LUtils.h>
+#define DEBUG 0
+
PianoBarProcess::PianoBarProcess(QWidget *parent) : QObject(parent){
setupProcess();
saveTimer = new QTimer(this);
@@ -69,7 +71,7 @@ void PianoBarProcess::answerQuestion(int selection){
if(makingStation && sel.isEmpty()){ makingStation = false; } //cancelled
sendToProcess(sel, true);
- if(makingStation){
+ if(makingStation){
//Need to prompt to list all the available stations to switch over right away
sendToProcess("s");
}
@@ -171,7 +173,7 @@ void PianoBarProcess::setAudioDriver(QString driver){
LUtils::writeFile(QDir::homePath()+"/.libao", info, true);
}
// ====== PUBLIC SLOTS ======
-void PianoBarProcess::play(){
+void PianoBarProcess::play(){
if(PROC->state() == QProcess::NotRunning){
PROC->start();
}else{
@@ -181,14 +183,14 @@ void PianoBarProcess::play(){
}
}
-void PianoBarProcess::pause(){
- sendToProcess("S");
+void PianoBarProcess::pause(){
+ sendToProcess("S");
cState = PianoBarProcess::Paused;
emit currentStateChanged(cState);
}
-void PianoBarProcess::skipSong(){
- sendToProcess("n");
+void PianoBarProcess::skipSong(){
+ sendToProcess("n");
}
// ====== PRIVATE ======
@@ -280,7 +282,7 @@ void PianoBarProcess::ProcUpdate(){
QStringList info = tmp.split("\n",QString::SkipEmptyParts);
//NOTE: Need to have a cache of info lines which can carry over between updates as needed (for questions, etc)
- //qDebug() << "Got Update:" << info;
+ if(DEBUG){ qDebug() << "Got Update:" << info; }
for(int i=0; i<info.length(); i++){
//First handle any pending cache of listing lines
if((info[i].startsWith("\t")||info[i].startsWith(" ")) && info[i].contains(")")){
@@ -340,7 +342,7 @@ void PianoBarProcess::ProcUpdate(){
for(int j=0; j<stationList.length(); j++){
if(stationList[j].endsWith(cstation) ){
//qDebug() << "Activate Station:" << stationList[i];
- sendToProcess(QString::number(j), true);
+ sendToProcess(QString::number(j), true);
break;
}else if(j==stationList.length()-1){
//qDebug() << "Activate Last Station:" << stationList[i];
@@ -348,10 +350,10 @@ void PianoBarProcess::ProcUpdate(){
}
}
}else if( !infoList.isEmpty() ){
- qDebug() << "Got Question with List:" << info[i] << infoList;
+ //qDebug() << "Got Question with List:" << info[i] << infoList;
emit NewQuestion(info[i].section("[?]",1,-1).simplified(), infoList);
}else if(info[i].contains(" Select ") ){
- qDebug() << "Got Question without List:" << info[i];
+ //qDebug() << "Got Question without List:" << info[i];
//Got a prompt without a list of answers - just cancel the prompt
sendToProcess("",true);
if(makingStation){
@@ -368,6 +370,8 @@ void PianoBarProcess::ProcUpdate(){
stamp = QTime::fromString(info[i].section("/",1,-1), "mm:ss");
int totS = 60*stamp.minute() + stamp.second(); //time total
emit TimeUpdate(totS-curS, totS);
+ }else if(DEBUG){
+ qDebug() << "Got Unhandled Pianobar message:" << info[i];
}
}
}
@@ -375,5 +379,6 @@ void PianoBarProcess::ProcUpdate(){
void PianoBarProcess::ProcStateChanged(QProcess::ProcessState stat){
if(stat == QProcess::NotRunning){ cState = PianoBarProcess::Stopped; }
else{ cState = PianoBarProcess::Paused; }
+ if(DEBUG){ qDebug() << "Pianobar Process State Changed:" << cState; }
emit currentStateChanged(cState);
}
bgstack15