1
0
Fork 0
forked from len0rd/rockbox

Rename "interface" parameter.

Current MinGW #defines interface, causing the preprocessor messing up the
function parameter. Rename it to avoid this.

Change-Id: Id49edbfc056a42456d88c9e260e54844e8b1ca07
This commit is contained in:
Dominik Riebeling 2013-04-03 23:36:13 +02:00
parent 7271ff603d
commit 801f3bbec4
2 changed files with 41 additions and 41 deletions

View file

@ -33,11 +33,12 @@
#include <QProgressDialog> #include <QProgressDialog>
#include "encttscfggui.h" #include "encttscfggui.h"
EncTtsCfgGui::EncTtsCfgGui(QDialog* parent,EncTtsSettingInterface* interface,QString name) : QDialog(parent) EncTtsCfgGui::EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* iface, QString name)
: QDialog(parent)
{ {
m_settingInterface = interface; m_settingInterface = iface;
m_busyCnt=0; m_busyCnt=0;
// create a busy Dialog // create a busy Dialog
m_busyDlg= new QProgressDialog("", "", 0, 0,this); m_busyDlg= new QProgressDialog("", "", 0, 0,this);
m_busyDlg->setWindowTitle(tr("Waiting for engine...")); m_busyDlg->setWindowTitle(tr("Waiting for engine..."));
@ -45,8 +46,8 @@ EncTtsCfgGui::EncTtsCfgGui(QDialog* parent,EncTtsSettingInterface* interface,QSt
m_busyDlg->setLabel(0); m_busyDlg->setLabel(0);
m_busyDlg->setCancelButton(0); m_busyDlg->setCancelButton(0);
m_busyDlg->hide(); m_busyDlg->hide();
connect(interface,SIGNAL(busy()),this,SLOT(showBusy())); connect(iface,SIGNAL(busy()),this,SLOT(showBusy()));
connect(interface,SIGNAL(busyEnd()),this,SLOT(hideBusy())); connect(iface,SIGNAL(busyEnd()),this,SLOT(hideBusy()));
//setup the window //setup the window
setWindowTitle(name); setWindowTitle(name);
@ -56,10 +57,10 @@ EncTtsCfgGui::EncTtsCfgGui(QDialog* parent,EncTtsSettingInterface* interface,QSt
void EncTtsCfgGui::setUpWindow() void EncTtsCfgGui::setUpWindow()
{ {
m_settingsList = m_settingInterface->getSettings(); m_settingsList = m_settingInterface->getSettings();
// layout // layout
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
// groupbox // groupbox
QGroupBox *groupBox = new QGroupBox(this); QGroupBox *groupBox = new QGroupBox(this);
QGridLayout *gridLayout = new QGridLayout(groupBox); QGridLayout *gridLayout = new QGridLayout(groupBox);
@ -85,10 +86,10 @@ void EncTtsCfgGui::setUpWindow()
groupBox->setLayout(gridLayout); groupBox->setLayout(gridLayout);
mainLayout->addWidget(groupBox); mainLayout->addWidget(groupBox);
// connect browse btn // connect browse btn
connect(&m_browseBtnMap,SIGNAL(mapped(QObject*)),this,SLOT(browse(QObject*))); connect(&m_browseBtnMap,SIGNAL(mapped(QObject*)),this,SLOT(browse(QObject*)));
// ok - cancel buttons // ok - cancel buttons
QPushButton* okBtn = new QPushButton(tr("Ok"),this); QPushButton* okBtn = new QPushButton(tr("Ok"),this);
okBtn->setDefault(true); okBtn->setDefault(true);
@ -97,14 +98,14 @@ void EncTtsCfgGui::setUpWindow()
cancelBtn->setIcon(QIcon(":icons/process-stop.png")); cancelBtn->setIcon(QIcon(":icons/process-stop.png"));
connect(okBtn,SIGNAL(clicked()),this,SLOT(accept())); connect(okBtn,SIGNAL(clicked()),this,SLOT(accept()));
connect(cancelBtn,SIGNAL(clicked()),this,SLOT(reject())); connect(cancelBtn,SIGNAL(clicked()),this,SLOT(reject()));
QHBoxLayout *btnbox = new QHBoxLayout; QHBoxLayout *btnbox = new QHBoxLayout;
btnbox->addWidget(okBtn); btnbox->addWidget(okBtn);
btnbox->addWidget(cancelBtn); btnbox->addWidget(cancelBtn);
btnbox->insertStretch(0,1); btnbox->insertStretch(0,1);
mainLayout->addLayout(btnbox); mainLayout->addLayout(btnbox);
this->setLayout(mainLayout); this->setLayout(mainLayout);
} }
@ -177,14 +178,14 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
break; break;
} }
} }
// remember widget // remember widget
if(value != NULL) if(value != NULL)
{ {
m_settingsWidgetsMap.insert(setting,value); m_settingsWidgetsMap.insert(setting,value);
connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget())); connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget()));
} }
return value; return value;
} }
@ -216,8 +217,8 @@ void EncTtsCfgGui::updateSetting()
if(widget == NULL) return; if(widget == NULL) return;
// get the corresponding setting // get the corresponding setting
EncTtsSetting* setting = m_settingsWidgetsMap.key(widget); EncTtsSetting* setting = m_settingsWidgetsMap.key(widget);
// update widget based on setting type // update widget based on setting type
switch(setting->type()) switch(setting->type())
{ {
case EncTtsSetting::eDOUBLE: case EncTtsSetting::eDOUBLE:
@ -253,7 +254,7 @@ void EncTtsCfgGui::updateSetting()
{ {
qDebug() << "unknown Settingtype !!"; qDebug() << "unknown Settingtype !!";
break; break;
} }
} }
} }
@ -264,7 +265,7 @@ void EncTtsCfgGui::updateWidget()
if(setting == NULL) return; if(setting == NULL) return;
// get corresponding widget // get corresponding widget
QWidget* widget = m_settingsWidgetsMap.value(setting); QWidget* widget = m_settingsWidgetsMap.value(setting);
// update Widget based on setting type // update Widget based on setting type
switch(setting->type()) switch(setting->type())
{ {
@ -291,7 +292,7 @@ void EncTtsCfgGui::updateWidget()
case EncTtsSetting::eSTRING: case EncTtsSetting::eSTRING:
{ {
QLineEdit* lineedit = (QLineEdit*) widget; QLineEdit* lineedit = (QLineEdit*) widget;
lineedit->blockSignals(true); lineedit->blockSignals(true);
lineedit->setText(setting->current().toString()); lineedit->setText(setting->current().toString());
lineedit->blockSignals(false); lineedit->blockSignals(false);
@ -300,7 +301,7 @@ void EncTtsCfgGui::updateWidget()
case EncTtsSetting::eREADONLYSTRING: case EncTtsSetting::eREADONLYSTRING:
{ {
QLabel* label = (QLabel*) widget; QLabel* label = (QLabel*) widget;
label->blockSignals(true); label->blockSignals(true);
label->setText(setting->current().toString()); label->setText(setting->current().toString());
label->blockSignals(false); label->blockSignals(false);
@ -309,20 +310,20 @@ void EncTtsCfgGui::updateWidget()
case EncTtsSetting::eSTRINGLIST: case EncTtsSetting::eSTRINGLIST:
{ {
QComboBox* combobox = (QComboBox*) widget; QComboBox* combobox = (QComboBox*) widget;
combobox->blockSignals(true); combobox->blockSignals(true);
combobox->clear(); combobox->clear();
combobox->addItems(setting->list()); combobox->addItems(setting->list());
int index = combobox->findText(setting->current().toString()); int index = combobox->findText(setting->current().toString());
combobox->setCurrentIndex(index); combobox->setCurrentIndex(index);
combobox->blockSignals(false); combobox->blockSignals(false);
break; break;
} }
case EncTtsSetting::eBOOL: case EncTtsSetting::eBOOL:
{ {
QCheckBox* checkbox = (QCheckBox*) widget; QCheckBox* checkbox = (QCheckBox*) widget;
checkbox->blockSignals(true); checkbox->blockSignals(true);
checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked); checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked);
checkbox->blockSignals(false); checkbox->blockSignals(false);
@ -332,25 +333,25 @@ void EncTtsCfgGui::updateWidget()
{ {
qDebug() << "unknown EncTTsSetting"; qDebug() << "unknown EncTTsSetting";
break; break;
} }
} }
} }
void EncTtsCfgGui::showBusy() void EncTtsCfgGui::showBusy()
{ {
if(m_busyCnt == 0) m_busyDlg->show(); if(m_busyCnt == 0) m_busyDlg->show();
m_busyCnt++; m_busyCnt++;
} }
void EncTtsCfgGui::hideBusy() void EncTtsCfgGui::hideBusy()
{ {
m_busyCnt--; m_busyCnt--;
if(m_busyCnt == 0) m_busyDlg->hide(); if(m_busyCnt == 0) m_busyDlg->hide();
} }
void EncTtsCfgGui::accept(void) void EncTtsCfgGui::accept(void)
{ {
m_settingInterface->saveSettings(); m_settingInterface->saveSettings();
@ -368,7 +369,7 @@ void EncTtsCfgGui::browse(QObject* settingObj)
// cast top setting // cast top setting
EncTtsSetting* setting= qobject_cast<EncTtsSetting*>(settingObj); EncTtsSetting* setting= qobject_cast<EncTtsSetting*>(settingObj);
if(setting == NULL) return; if(setting == NULL) return;
//current path //current path
QString curPath = setting->current().toString(); QString curPath = setting->current().toString();
// show file dialog // show file dialog
@ -379,5 +380,3 @@ void EncTtsCfgGui::browse(QObject* settingObj)
setting->setCurrent(exe); setting->setCurrent(exe);
} }

View file

@ -17,31 +17,32 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#ifndef ENCTTSCFGGUI_H #ifndef ENCTTSCFGGUI_H
#define ENCTTSCFGGUI_H #define ENCTTSCFGGUI_H
#include <QDialog> #include <QDialog>
#include <QString>
#include <QProgressDialog> #include <QProgressDialog>
#include "encttssettings.h" #include "encttssettings.h"
//! \brief Shows and manages a configuration gui for encoders and tts enignes //! \brief Shows and manages a configuration gui for encoders and tts enignes
//! //!
class EncTtsCfgGui: public QDialog class EncTtsCfgGui: public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
//! Creates the UI. give it a endoer or tts engine with already set config. uses show() or exec() to show it. //! Creates the UI. give it a endoer or tts engine with already set config. uses show() or exec() to show it.
EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* interface,QString name); EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* iface, QString name);
private slots: private slots:
//! accept current configuration values and close window //! accept current configuration values and close window
void accept(void); void accept(void);
//! close window and dont save configuration //! close window and dont save configuration
void reject(void); void reject(void);
//! updates the corresponding setting from the sending Widget //! updates the corresponding setting from the sending Widget
void updateSetting(); void updateSetting();
//! updates corresponding Widget from the sending Setting. //! updates corresponding Widget from the sending Setting.
void updateWidget(); void updateWidget();
//! shows a busy dialog. counts calls. //! shows a busy dialog. counts calls.
void showBusy(); void showBusy();
@ -49,7 +50,7 @@ private slots:
void hideBusy(); void hideBusy();
//! used via the SignalMapper for all Browse buttons //! used via the SignalMapper for all Browse buttons
void browse(QObject*); void browse(QObject*);
private: private:
//! creates all dynamic window content //! creates all dynamic window content
void setUpWindow(); void setUpWindow();
@ -69,7 +70,7 @@ private:
QMap<EncTtsSetting*,QWidget*> m_settingsWidgetsMap; QMap<EncTtsSetting*,QWidget*> m_settingsWidgetsMap;
//! Maps all browse buttons to the corresponding Setting //! Maps all browse buttons to the corresponding Setting
QSignalMapper m_browseBtnMap; QSignalMapper m_browseBtnMap;
//! counter how often busyShow() is called, //! counter how often busyShow() is called,
int m_busyCnt; int m_busyCnt;
}; };