2019-08-26 Fred Gleason <fredg@paravelsystems.com>

* Reimplemented the '--asoundrc-file=' directive in
	rdalsaconfig(8).
This commit is contained in:
Fred Gleason 2019-08-26 14:11:38 -04:00
parent 4f9b800379
commit 7fe3952c5d
3 changed files with 12 additions and 9 deletions

View File

@ -18956,3 +18956,6 @@
2019-08-26 Fred Gleason <fredg@paravelsystems.com> 2019-08-26 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in rdalsaconfig(8) that caused a 'Service not * Fixed a bug in rdalsaconfig(8) that caused a 'Service not
active' error to be generated at startup. active' error to be generated at startup.
2019-08-26 Fred Gleason <fredg@paravelsystems.com>
* Reimplemented the '--asoundrc-file=' directive in
rdalsaconfig(8).

View File

@ -136,7 +136,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
alsa_system_model=new RDAlsaModel(rda->system()->sampleRate(),this); alsa_system_model=new RDAlsaModel(rda->system()->sampleRate(),this);
alsa_system_list->setModel(alsa_system_model); alsa_system_list->setModel(alsa_system_model);
LoadConfig(); LoadConfig(alsa_filename);
// //
// Daemon Management // Daemon Management
@ -199,7 +199,7 @@ void MainWidget::saveData()
StartDaemons(); StartDaemons();
*/ */
SaveConfig(); SaveConfig(alsa_filename);
qApp->quit(); qApp->quit();
} }
@ -246,7 +246,7 @@ void MainWidget::closeEvent(QCloseEvent *e)
} }
void MainWidget::LoadConfig() void MainWidget::LoadConfig(const QString &filename)
{ {
FILE *f=NULL; FILE *f=NULL;
char line[1024]; char line[1024];
@ -258,7 +258,7 @@ void MainWidget::LoadConfig()
bool active_line=false; bool active_line=false;
QModelIndex index; QModelIndex index;
if((f=fopen(RD_ASOUNDRC_FILE,"r"))==NULL) { if((f=fopen(filename.toUtf8(),"r"))==NULL) {
return; return;
} }
while(fgets(line,1024,f)!=NULL) { while(fgets(line,1024,f)!=NULL) {
@ -330,9 +330,9 @@ void MainWidget::LoadConfig()
} }
void MainWidget::SaveConfig() const void MainWidget::SaveConfig(const QString &filename) const
{ {
QString tempfile=QString(RD_ASOUNDRC_FILE)+"-temp"; QString tempfile=filename+"-temp";
FILE *f=NULL; FILE *f=NULL;
if((f=fopen(tempfile.toUtf8(),"w"))==NULL) { if((f=fopen(tempfile.toUtf8(),"w"))==NULL) {
@ -363,7 +363,7 @@ void MainWidget::SaveConfig() const
fprintf(f,"%s\n",END_MARKER); fprintf(f,"%s\n",END_MARKER);
fclose(f); fclose(f);
rename(tempfile.toUtf8(),RD_ASOUNDRC_FILE); rename(tempfile.toUtf8(),filename.toUtf8());
} }

View File

@ -53,8 +53,8 @@ class MainWidget : public QWidget
void closeEvent(QCloseEvent *e); void closeEvent(QCloseEvent *e);
private: private:
void LoadConfig(); void LoadConfig(const QString &filename);
void SaveConfig() const; void SaveConfig(const QString &filename) const;
QLabel *alsa_system_label; QLabel *alsa_system_label;
QLabel *alsa_description_label; QLabel *alsa_description_label;
QListView *alsa_system_list; QListView *alsa_system_list;