1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
//===========================================
// Lumina-Desktop source code
// Copyright (c) 2017, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
#include "mainUI.h"
#include "ui_mainUI.h"
#include <QDebug>
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){
ui->setupUi(this);
//Any special UI changes
QWidget *spacer = new QWidget(this);
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
ui->toolBar->insertWidget(ui->actionVolUp, spacer);
setupPandora();
ui->radio_pandora->setChecked(true);
setupConnections();
}
MainUI::~MainUI(){
}
void MainUI::loadArguments(QStringList){
}
// ==== PRIVATE ====
void MainUI::setupPandora(){
PANDORA = new PianoBarProcess(this);
connect(PANDORA, SIGNAL(currentStateChanged(PianoBarProcess::State)), this, SLOT(PandoraStateChanged(PianoBarProcess::State)) );
connect(PANDORA, SIGNAL(NewInformation(QString)), this, SLOT(NewPandoraInfo(QString)) );
connect(PANDORA, SIGNAL(NowPlayingStation(QString, QString)), this, SLOT(PandoraStationChanged(QString)) );
connect(PANDORA, SIGNAL(NowPlayingSong(bool, QString,QString,QString, QString, QString)), this, SLOT(PandoraSongChanged(bool, QString, QString, QString, QString, QString)) );
connect(PANDORA, SIGNAL(TimeUpdate(int, int)), this, SLOT(PandoraTimeUpdate(int,int)) );
connect(PANDORA, SIGNAL(NewList(QStringList)), this, SLOT(PandoraListInfo(QStringList)) );
connect(PANDORA, SIGNAL(StationListChanged(QStringList)), this, SLOT(PandoraStationListChanged(QStringList)) );
//Setup a couple of the option lists
ui->combo_pandora_quality->clear();
ui->combo_pandora_quality->addItem(tr("Low"),"low");
ui->combo_pandora_quality->addItem(tr("Medium"), "medium");
ui->combo_pandora_quality->addItem(tr("High"),"high");
//Now load the current settings into the UI
int qual = ui->combo_pandora_quality->findData(PANDORA->audioQuality());
if(qual>=0){ ui->combo_pandora_quality->setCurrentIndex(qual); }
else{ ui->combo_pandora_quality->setCurrentIndex(1); } //medium quality by default
ui->line_pandora_email->setText( PANDORA->email() );
ui->line_pandora_pass->setText( PANDORA->password() );
ui->line_pandora_proxy->setText( PANDORA->proxy() );
ui->line_pandora_cproxy->setText( PANDORA->controlProxy() );
}
void MainUI::setupConnections(){
connect(ui->actionPlay, SIGNAL(triggered()), this, SLOT(playToggled()) );
connect(ui->actionPause, SIGNAL(triggered()), this, SLOT(pauseToggled()) );
connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(stopToggled()) );
connect(ui->actionNext, SIGNAL(triggered()), this, SLOT(nextToggled()) );
connect(ui->actionBack, SIGNAL(triggered()), this, SLOT(backToggled()) );
connect(ui->actionVolUp, SIGNAL(triggered()), this, SLOT(volupToggled()) );
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()) );
}
// ==== PRIVATE SLOTS ====
void MainUI::PlayerTypeChanged(){
if(ui->radio_pandora->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_pandora); }
else{ ui->stackedWidget->setCurrentWidget(ui->page_local); }
//Now hide/deactivate any toolbar buttons which are not used
ui->actionBack->setVisible(!ui->radio_pandora->isChecked());
}
//Toolbar actions
void MainUI::playToggled(){
if(ui->radio_pandora->isChecked()){
PANDORA->play();
}
}
void MainUI::pauseToggled(){
if(ui->radio_pandora->isChecked()){
PANDORA->pause();
}
}
void MainUI::stopToggled(){
if(ui->radio_pandora->isChecked()){
PANDORA->closePianoBar();
}
}
void MainUI::nextToggled(){
if(ui->radio_pandora->isChecked()){
PANDORA->skipSong();
}
}
void MainUI::backToggled(){
}
void MainUI::volupToggled(){
}
void MainUI::voldownToggled(){
}
//Pandora Options
void MainUI::showPandoraSongInfo(){
}
void MainUI::changePandoraStation(QString){
}
void MainUI::applyPandoraSettings(){
PANDORA->setLogin(ui->line_pandora_email->text(), ui->line_pandora_pass->text());
PANDORA->setAudioQuality(ui->combo_pandora_quality->currentData().toString());
PANDORA->setProxy(ui->line_pandora_proxy->text());
PANDORA->setControlProxy(ui->line_pandora_cproxy->text());
}
//Pandora Process Feedback
void MainUI::PandoraStateChanged(PianoBarProcess::State){
}
void MainUI::NewPandoraInfo(QString info){
qDebug() << "[INFO]" << info;
}
void MainUI::PandoraStationChanged(QString station){
qDebug() << "[STATION CHANGE]" << station;
}
void MainUI::PandoraSongChanged(bool isLoved, QString title, QString artist, QString album, QString detailsURL, QString fromStation){
qDebug() << "[SONG CHANGE]" << isLoved << title << artist << album << detailsURL << fromStation;
}
void MainUI::PandoraTimeUpdate(int curS, int totS){
qDebug() << "[TIME UPDATE]" << curS << "/" << totS;
}
void MainUI::PandoraStationListChanged(QStringList list){
qDebug() << "[STATION LIST]" << list;
}
void MainUI::PandoraListInfo(QStringList list){
qDebug() << "[LIST INFO]" << list;
}
|