source: src-qt4/pc-mixer/MixerGUI.cpp @ caf88c8

releng/10.0.1releng/10.0.2releng/10.0.3
Last change on this file since caf88c8 was caf88c8, checked in by Ken Moore <ken@…>, 8 months ago

Add a new utility: pc-mixer
This utility is a tray application that is a front-end to the "mixer" CLI tool, granting control over volumes and other audio settings.
The tray portion of it is complete, still need to finish filling out the full mixer GUI tomorrow.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#include "MixerGUI.h"
2#include "ui_MixerGUI.h"
3
4MixerGUI::MixerGUI(QSettings *set) : QMainWindow(), ui(new Ui::MixerGUI){
5  ui->setupUi(this); //load the designer file
6  settings = set; //save this settings access for later
7  closing = false;
8  //connect the signals/slots
9  connect(ui->actionClose_Mixer, SIGNAL(triggered()), this, SLOT(hideGUI()) );
10  connect(ui->actionClose_Mixer_and_Tray, SIGNAL(triggered()), this, SLOT(closeApplication()) );
11}
12
13MixerGUI::~MixerGUI(){
14       
15}
16
17void MixerGUI::updateGUI(){
18  //Load the list of available devices
19  QStringList devList = Mixer::getDevices();
20  devList.sort();
21  //Clear the UI
22  ui->combo_default->disconnect();
23  ui->combo_default->clear();
24 
25  //Now Fill the UI with the devices
26  QString cdefault = settings->value("tray-device", "vol").toString();
27  for(int i=0; i<devList.length(); i++){
28    //Get the individual pieces
29    QString dev = devList[i].section(":",0,0);
30    int Lval = devList[i].section(":",1,1).toInt();
31    int Rval = devList[i].section(":",2,2).toInt();
32    //Now create the device widget
33         
34    //Now add the device to the default List
35    ui->combo_default->addItem(dev);
36    if(dev == cdefault){
37      ui->combo_default->setCurrentIndex(i);
38    }
39  }
40  //re-connect combobox signal
41  connect(ui->combo_default, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeDefaultTrayDevice(QString)) );
42}
43
44void MixerGUI::changeDefaultTrayDevice(QString device){
45  settings->setValue("tray-device", device);
46  emit updateTray();
47}
48
49void MixerGUI::itemChanged(QString device){
50  if(device == ui->combo_default->currentText()){
51    emit updateTray();
52  }
53}
Note: See TracBrowser for help on using the repository browser.