aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-04-19 09:17:20 -0400
committerKen Moore <ken@ixsystems.com>2017-04-19 09:17:20 -0400
commit3c077da3151397ea371cdf9e26a5826c7824366e (patch)
tree1e47cf7c1aecec279b54682f7b0e8fca02160926 /src-qt5/desktop-utils
parentFix up the icons used for the battery notifications. (diff)
downloadlumina-3c077da3151397ea371cdf9e26a5826c7824366e.tar.gz
lumina-3c077da3151397ea371cdf9e26a5826c7824366e.tar.bz2
lumina-3c077da3151397ea371cdf9e26a5826c7824366e.zip
Add the ability to change the libao audio driver as needed.
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp32
-rw-r--r--src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h5
-rw-r--r--src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp10
-rw-r--r--src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui28
4 files changed, 65 insertions, 10 deletions
diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp
index 6799f25b..63d2987b 100644
--- a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp
+++ b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.cpp
@@ -116,6 +116,38 @@ void PianoBarProcess::setControlProxy(QString url){
setSettingValue("control_proxy", url);
}
+QString PianoBarProcess::currentAudioDriver(){
+ QString driver = "auto";
+ QStringList info = LUtils::readFile(QDir::homePath()+"/.libao").filter("default_driver");
+ if(!info.isEmpty()){
+ driver = info.last().section("=",-1).simplified();
+ }
+ return driver;
+}
+
+QStringList PianoBarProcess::availableAudioDrivers(){
+ QStringList known;
+ known << "pulse" << "alsa" << "sndio" << "oss" << "sun" << "roar" << "esd" << "nas";
+ known.sort();
+ known.prepend("auto"); //make sure this is always first
+ return known;
+}
+
+void PianoBarProcess::setAudioDriver(QString driver){
+ QStringList info = LUtils::readFile(QDir::homePath()+"/.libao");
+ bool found = false;
+ QString line = "default_driver="+driver;
+ if(driver=="auto"){ line.clear(); } //special bypass - nothing set
+ for(int i=0; i<info.length() && !found; i++){
+ if(info[i].section("=",0,0).simplified() == "default_driver"){
+ info[i] = line;
+ found = true;
+ }
+ }
+ if(!found && !line.isEmpty()){ info << line; }
+ //Now save the file
+ LUtils::writeFile(QDir::homePath()+"/.libao", info, true);
+}
// ====== PUBLIC SLOTS ======
void PianoBarProcess::play(){
if(PROC->state() == QProcess::NotRunning){
diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h
index f250c964..686eb122 100644
--- a/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h
+++ b/src-qt5/desktop-utils/lumina-mediaplayer/PianoBarProcess.h
@@ -50,6 +50,11 @@ public:
QString controlProxy(); //"control_proxy" = URL (example: "http://USER:PASSWORD@HOST:PORT/" )
void setControlProxy(QString);
+ //libao audio driver control
+ QString currentAudioDriver();
+ QStringList availableAudioDrivers();
+ void setAudioDriver(QString driver);
+
private:
//Process
QProcess *PROC;
diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp
index 09fe485d..5bf65cb0 100644
--- a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.cpp
@@ -104,10 +104,15 @@ void MainUI::setupPandora(){
ui->combo_pandora_quality->addItem(tr("Low"),"low");
ui->combo_pandora_quality->addItem(tr("Medium"), "medium");
ui->combo_pandora_quality->addItem(tr("High"),"high");
+ ui->combo_pandora_driver->clear();
+ ui->combo_pandora_driver->addItems( PANDORA->availableAudioDrivers() );
//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
+ qual = ui->combo_pandora_driver->findText(PANDORA->currentAudioDriver());
+ if(qual>=0){ ui->combo_pandora_driver->setCurrentIndex(qual); }
+ else{ ui->combo_pandora_driver->setCurrentIndex(0); } //automatic (always first in list)
ui->line_pandora_email->setText( PANDORA->email() );
ui->line_pandora_pass->setText( PANDORA->password() );
ui->line_pandora_proxy->setText( PANDORA->proxy() );
@@ -147,6 +152,7 @@ void MainUI::setupConnections(){
connect(ui->push_pandora_apply, SIGNAL(clicked()), this, SLOT(applyPandoraSettings()) );
connect(ui->combo_pandora_station, SIGNAL(activated(QString)), this, SLOT(changePandoraStation(QString)) );
+ connect(ui->combo_pandora_driver, SIGNAL(activated(QString)), this, SLOT(checkPandoraSettings()) );
connect(ui->tool_pandora_ban, SIGNAL(clicked()), PANDORA, SLOT(banSong()) );
connect(ui->tool_pandora_love, SIGNAL(clicked()), PANDORA, SLOT(loveSong()) );
connect(ui->tool_pandora_tired, SIGNAL(clicked()), PANDORA, SLOT(tiredSong()) );
@@ -475,7 +481,8 @@ void MainUI::checkPandoraSettings(){
|| (PANDORA->password() != ui->line_pandora_pass->text())
|| (PANDORA->audioQuality() != ui->combo_pandora_quality->currentData().toString())
|| (PANDORA->proxy() != ui->line_pandora_proxy->text())
- || (PANDORA->controlProxy() != ui->line_pandora_cproxy->text());
+ || (PANDORA->controlProxy() != ui->line_pandora_cproxy->text())
+ || (PANDORA->currentAudioDriver() != ui->combo_pandora_driver->currentText());
ui->push_pandora_apply->setEnabled(changes);
}
@@ -484,6 +491,7 @@ void MainUI::applyPandoraSettings(){
PANDORA->setAudioQuality(ui->combo_pandora_quality->currentData().toString());
PANDORA->setProxy(ui->line_pandora_proxy->text());
PANDORA->setControlProxy(ui->line_pandora_cproxy->text());
+ PANDORA->setAudioDriver(ui->combo_pandora_driver->currentText());
if(PANDORA->isSetup()){
//Go ahead and (re)start the Pandora process so it is aware of the new changes
if(PANDORA->currentState()!=PianoBarProcess::Stopped){ PANDORA->closePianoBar(); }
diff --git a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui
index f0bbef0e..3489d2ae 100644
--- a/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui
+++ b/src-qt5/desktop-utils/lumina-mediaplayer/mainUI.ui
@@ -84,7 +84,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="page_local">
<layout class="QVBoxLayout" name="verticalLayout_6">
@@ -254,7 +254,7 @@
<item>
<widget class="QTabWidget" name="tabWidget_pandora">
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="tab_pandora_playing">
<attribute name="title">
@@ -577,27 +577,27 @@
<item row="1" column="1">
<widget class="QComboBox" name="combo_pandora_quality"/>
</item>
- <item row="2" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Proxy URL</string>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<widget class="QLineEdit" name="line_pandora_proxy"/>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Control Proxy URL</string>
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<widget class="QLineEdit" name="line_pandora_cproxy"/>
</item>
- <item row="5" column="0" colspan="2">
+ <item row="6" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
@@ -634,7 +634,7 @@
</item>
</layout>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -647,6 +647,16 @@
</property>
</spacer>
</item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="combo_pandora_driver"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Audio Driver</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</widget>
@@ -663,7 +673,7 @@
<x>0</x>
<y>0</y>
<width>385</width>
- <height>23</height>
+ <height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
bgstack15