diff options
Diffstat (limited to 'src-qt5')
4 files changed, 47 insertions, 19 deletions
diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp index 19b6b99b..55c85a33 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp +++ b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp @@ -61,7 +61,7 @@ void PianoBarProcess::setCurrentStation(QString station){ void PianoBarProcess::deleteCurrentStation(){ //"d" -> "y" if(cstation == "QuickMix" || cstation=="Thumbprint Radio"){ return; } //cannot delete these stations - provided by Pandora itself sendToProcess("d"); //delete current station - sendToProcess("y"); //yes, we want to delete it + sendToProcess("y",true); //yes, we want to delete it //Now need to automatically change to another station setCurrentStation("QuickMix"); //this is always a valid station } @@ -69,12 +69,12 @@ void PianoBarProcess::deleteCurrentStation(){ //"d" -> "y" //void PianoBarProcess::createNewStation(); //"c" void PianoBarProcess::createStationFromCurrentSong(){ //"v" -> "s" sendToProcess("v"); - sendToProcess("s"); + sendToProcess("s",true); } void PianoBarProcess::createStationFromCurrentArtist(){ //"v" -> "a" sendToProcess("v"); - sendToProcess("a"); + sendToProcess("a",true); } //Settings Manipulation @@ -189,9 +189,10 @@ void PianoBarProcess::setupProcess(){ connect(PROC, SIGNAL(readyRead()), this, SLOT(ProcUpdate()) ); } -void PianoBarProcess::sendToProcess(QString txt){ +void PianoBarProcess::sendToProcess(QString txt, bool withreturn){ if(PROC->state()==QProcess::Running){ - PROC->write( QString(txt+"\r\n").toLocal8Bit() ); + if(withreturn){ PROC->write( QString(txt+"\r\n").toLocal8Bit() ); } + else{ PROC->write( QString(txt).toLocal8Bit() ); } } } @@ -221,8 +222,8 @@ void PianoBarProcess::ProcUpdate(){ emit NowPlayingStation(data[0], data[1]); if(stationList.isEmpty()){ //Need to prompt to list all the available stations - sendToProcess("s"); - sendToProcess(""); //empty line - canceles the prompt + sendToProcess("s",true);//line return cancels the prompt + //sendToProcess("",true); //empty line - cancels the prompt } //Automatically save this station for autostart next time (make toggle-able later) if(data[1]!=autostartStation()){ setAutostartStation(data[1]); } @@ -233,18 +234,21 @@ void PianoBarProcess::ProcUpdate(){ }else if(info[i].startsWith("(i) ")){ //informational line emit NewInformation(info[i].section(" ",1,-1)); }else if(info[i].startsWith("[?] ")){ //waiting for reply to question - //qDebug() << "Got Question:" << info[i] << infoList; + qDebug() << "Got Question:" << info[i] << infoList; if(info[i].contains("Select station:")){ + qDebug() << "Change to Station:" << cstation; stationList = infoList; //save this list for later infoList.clear(); emit StationListChanged(stationList); //Find the station number which corresponds to the cstation variable/name for(int i=0; i<stationList.length(); i++){ - if(stationList.endsWith(cstation) ){ - sendToProcess(QString::number(i)); + if(stationList[i].endsWith(cstation) ){ + qDebug() << "Activate Station:" << stationList[i]; + sendToProcess(QString::number(i), true); break; }else if(i==stationList.length()-1){ - sendToProcess(QString::number(stationList.length()-1)); + qDebug() << "Activate Last Station:" << stationList[i]; + sendToProcess(QString::number(stationList.length()-1), true); } } } diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h index 77df3309..a11da247 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h +++ b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h @@ -60,7 +60,7 @@ private: QProcess *PROC; QStringList infoList; void setupProcess(); - void sendToProcess(QString); + void sendToProcess(QString, bool withreturn = false); //Settings file management QStringList currentSettings; //cache of the settings file (file is really small); diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp index 128025ec..bf8a7558 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp @@ -64,6 +64,7 @@ void MainUI::setupConnections(){ connect(ui->actionVolDown, SIGNAL(triggered()), this, SLOT(voldownToggled()) ); connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) ); connect(ui->push_pandora_apply, SIGNAL(clicked()), this, SLOT(applyPandoraSettings()) ); + connect(ui->combo_pandora_station, SIGNAL(activated(QString)), this, SLOT(changePandoraStation(QString)) ); } @@ -119,8 +120,8 @@ void MainUI::showPandoraSongInfo(){ } -void MainUI::changePandoraStation(QString){ - +void MainUI::changePandoraStation(QString station){ + PANDORA->setCurrentStation(station); } void MainUI::applyPandoraSettings(){ @@ -136,23 +137,43 @@ void MainUI::PandoraStateChanged(PianoBarProcess::State){ } void MainUI::NewPandoraInfo(QString info){ - qDebug() << "[INFO]" << info; + //qDebug() << "[INFO]" << info; + ui->statusbar->showMessage(info, 2000); } void MainUI::PandoraStationChanged(QString station){ - qDebug() << "[STATION CHANGE]" << station; + //qDebug() << "[STATION CHANGE]" << station; + int index = ui->combo_pandora_station->findText( station ); + if(index>=0){ ui->combo_pandora_station->setCurrentIndex(index); } } void MainUI::PandoraSongChanged(bool isLoved, QString title, QString artist, QString album, QString detailsURL, QString fromStation){ - qDebug() << "[SONG CHANGE]" << isLoved << title << artist << album << detailsURL << fromStation; + //qDebug() << "[SONG CHANGE]" << isLoved << title << artist << album << detailsURL << fromStation; + ui->tool_pandora_info->setWhatsThis(detailsURL); + ui->tool_pandora_love->setChecked(isLoved); + ui->tool_pandora_love->setEnabled(!isLoved); //pianobar cannot "unlove" a song + ui->label_pandora_album->setText(album); + ui->label_pandora_artist->setText(artist); + ui->label_pandora_title->setText(title); } void MainUI::PandoraTimeUpdate(int curS, int totS){ - qDebug() << "[TIME UPDATE]" << curS << "/" << totS; + //qDebug() << "[TIME UPDATE]" << curS << "/" << totS; + ui->progress_pandora->setRange(0, totS); + ui->progress_pandora->setValue(curS); } void MainUI::PandoraStationListChanged(QStringList list){ - qDebug() << "[STATION LIST]" << list; + //qDebug() << "[STATION LIST]" << list; + ui->combo_pandora_station->clear(); + for(int i=0; i<list.length(); i++){ + list[i] =list[i].simplified(); + if(list[i].startsWith("q ")){ list[i] = list[i].section("q ",1,-1); } + if(list[i].startsWith("Q ")){ list[i] = list[i].section("Q ",1,-1); } + ui->combo_pandora_station->addItem(list[i]); + } + int index = ui->combo_pandora_station->findText( PANDORA->currentStation() ); + if(index>=0){ ui->combo_pandora_station->setCurrentIndex(index); } } void MainUI::PandoraListInfo(QStringList list){ diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui index 9c8dd46a..6cd3ca14 100644 --- a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui +++ b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui @@ -130,6 +130,9 @@ <property name="value"> <number>24</number> </property> + <property name="format"> + <string/> + </property> </widget> </item> </layout> |