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:
parent
7271ff603d
commit
801f3bbec4
2 changed files with 41 additions and 41 deletions
|
|
@ -33,11 +33,12 @@
|
|||
#include <QProgressDialog>
|
||||
#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_busyCnt=0;
|
||||
m_settingInterface = iface;
|
||||
|
||||
m_busyCnt=0;
|
||||
// create a busy Dialog
|
||||
m_busyDlg= new QProgressDialog("", "", 0, 0,this);
|
||||
m_busyDlg->setWindowTitle(tr("Waiting for engine..."));
|
||||
|
|
@ -45,8 +46,8 @@ EncTtsCfgGui::EncTtsCfgGui(QDialog* parent,EncTtsSettingInterface* interface,QSt
|
|||
m_busyDlg->setLabel(0);
|
||||
m_busyDlg->setCancelButton(0);
|
||||
m_busyDlg->hide();
|
||||
connect(interface,SIGNAL(busy()),this,SLOT(showBusy()));
|
||||
connect(interface,SIGNAL(busyEnd()),this,SLOT(hideBusy()));
|
||||
connect(iface,SIGNAL(busy()),this,SLOT(showBusy()));
|
||||
connect(iface,SIGNAL(busyEnd()),this,SLOT(hideBusy()));
|
||||
|
||||
//setup the window
|
||||
setWindowTitle(name);
|
||||
|
|
@ -56,10 +57,10 @@ EncTtsCfgGui::EncTtsCfgGui(QDialog* parent,EncTtsSettingInterface* interface,QSt
|
|||
void EncTtsCfgGui::setUpWindow()
|
||||
{
|
||||
m_settingsList = m_settingInterface->getSettings();
|
||||
|
||||
|
||||
// layout
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
|
||||
|
||||
// groupbox
|
||||
QGroupBox *groupBox = new QGroupBox(this);
|
||||
QGridLayout *gridLayout = new QGridLayout(groupBox);
|
||||
|
|
@ -85,10 +86,10 @@ void EncTtsCfgGui::setUpWindow()
|
|||
|
||||
groupBox->setLayout(gridLayout);
|
||||
mainLayout->addWidget(groupBox);
|
||||
|
||||
|
||||
// connect browse btn
|
||||
connect(&m_browseBtnMap,SIGNAL(mapped(QObject*)),this,SLOT(browse(QObject*)));
|
||||
|
||||
|
||||
// ok - cancel buttons
|
||||
QPushButton* okBtn = new QPushButton(tr("Ok"),this);
|
||||
okBtn->setDefault(true);
|
||||
|
|
@ -97,14 +98,14 @@ void EncTtsCfgGui::setUpWindow()
|
|||
cancelBtn->setIcon(QIcon(":icons/process-stop.png"));
|
||||
connect(okBtn,SIGNAL(clicked()),this,SLOT(accept()));
|
||||
connect(cancelBtn,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
|
||||
|
||||
QHBoxLayout *btnbox = new QHBoxLayout;
|
||||
btnbox->addWidget(okBtn);
|
||||
btnbox->addWidget(cancelBtn);
|
||||
btnbox->insertStretch(0,1);
|
||||
|
||||
|
||||
mainLayout->addLayout(btnbox);
|
||||
|
||||
|
||||
this->setLayout(mainLayout);
|
||||
}
|
||||
|
||||
|
|
@ -177,14 +178,14 @@ QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// remember widget
|
||||
if(value != NULL)
|
||||
{
|
||||
{
|
||||
m_settingsWidgetsMap.insert(setting,value);
|
||||
connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget()));
|
||||
}
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
@ -216,8 +217,8 @@ void EncTtsCfgGui::updateSetting()
|
|||
if(widget == NULL) return;
|
||||
// get the corresponding setting
|
||||
EncTtsSetting* setting = m_settingsWidgetsMap.key(widget);
|
||||
|
||||
// update widget based on setting type
|
||||
|
||||
// update widget based on setting type
|
||||
switch(setting->type())
|
||||
{
|
||||
case EncTtsSetting::eDOUBLE:
|
||||
|
|
@ -253,7 +254,7 @@ void EncTtsCfgGui::updateSetting()
|
|||
{
|
||||
qDebug() << "unknown Settingtype !!";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -264,7 +265,7 @@ void EncTtsCfgGui::updateWidget()
|
|||
if(setting == NULL) return;
|
||||
// get corresponding widget
|
||||
QWidget* widget = m_settingsWidgetsMap.value(setting);
|
||||
|
||||
|
||||
// update Widget based on setting type
|
||||
switch(setting->type())
|
||||
{
|
||||
|
|
@ -291,7 +292,7 @@ void EncTtsCfgGui::updateWidget()
|
|||
case EncTtsSetting::eSTRING:
|
||||
{
|
||||
QLineEdit* lineedit = (QLineEdit*) widget;
|
||||
|
||||
|
||||
lineedit->blockSignals(true);
|
||||
lineedit->setText(setting->current().toString());
|
||||
lineedit->blockSignals(false);
|
||||
|
|
@ -300,7 +301,7 @@ void EncTtsCfgGui::updateWidget()
|
|||
case EncTtsSetting::eREADONLYSTRING:
|
||||
{
|
||||
QLabel* label = (QLabel*) widget;
|
||||
|
||||
|
||||
label->blockSignals(true);
|
||||
label->setText(setting->current().toString());
|
||||
label->blockSignals(false);
|
||||
|
|
@ -309,20 +310,20 @@ void EncTtsCfgGui::updateWidget()
|
|||
case EncTtsSetting::eSTRINGLIST:
|
||||
{
|
||||
QComboBox* combobox = (QComboBox*) widget;
|
||||
|
||||
|
||||
combobox->blockSignals(true);
|
||||
combobox->clear();
|
||||
combobox->addItems(setting->list());
|
||||
int index = combobox->findText(setting->current().toString());
|
||||
combobox->setCurrentIndex(index);
|
||||
combobox->blockSignals(false);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case EncTtsSetting::eBOOL:
|
||||
{
|
||||
QCheckBox* checkbox = (QCheckBox*) widget;
|
||||
|
||||
|
||||
checkbox->blockSignals(true);
|
||||
checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked);
|
||||
checkbox->blockSignals(false);
|
||||
|
|
@ -332,25 +333,25 @@ void EncTtsCfgGui::updateWidget()
|
|||
{
|
||||
qDebug() << "unknown EncTTsSetting";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EncTtsCfgGui::showBusy()
|
||||
{
|
||||
if(m_busyCnt == 0) m_busyDlg->show();
|
||||
|
||||
|
||||
m_busyCnt++;
|
||||
}
|
||||
|
||||
void EncTtsCfgGui::hideBusy()
|
||||
{
|
||||
m_busyCnt--;
|
||||
|
||||
|
||||
if(m_busyCnt == 0) m_busyDlg->hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void EncTtsCfgGui::accept(void)
|
||||
{
|
||||
m_settingInterface->saveSettings();
|
||||
|
|
@ -368,7 +369,7 @@ void EncTtsCfgGui::browse(QObject* settingObj)
|
|||
// cast top setting
|
||||
EncTtsSetting* setting= qobject_cast<EncTtsSetting*>(settingObj);
|
||||
if(setting == NULL) return;
|
||||
|
||||
|
||||
//current path
|
||||
QString curPath = setting->current().toString();
|
||||
// show file dialog
|
||||
|
|
@ -379,5 +380,3 @@ void EncTtsCfgGui::browse(QObject* settingObj)
|
|||
setting->setCurrent(exe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,31 +17,32 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef ENCTTSCFGGUI_H
|
||||
#define ENCTTSCFGGUI_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QString>
|
||||
#include <QProgressDialog>
|
||||
#include "encttssettings.h"
|
||||
|
||||
//! \brief Shows and manages a configuration gui for encoders and tts enignes
|
||||
//!
|
||||
//!
|
||||
class EncTtsCfgGui: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
//! 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:
|
||||
//! accept current configuration values and close window
|
||||
void accept(void);
|
||||
void accept(void);
|
||||
//! close window and dont save configuration
|
||||
void reject(void);
|
||||
//! updates the corresponding setting from the sending Widget
|
||||
void updateSetting();
|
||||
//! updates corresponding Widget from the sending Setting.
|
||||
//! updates corresponding Widget from the sending Setting.
|
||||
void updateWidget();
|
||||
//! shows a busy dialog. counts calls.
|
||||
void showBusy();
|
||||
|
|
@ -49,7 +50,7 @@ private slots:
|
|||
void hideBusy();
|
||||
//! used via the SignalMapper for all Browse buttons
|
||||
void browse(QObject*);
|
||||
|
||||
|
||||
private:
|
||||
//! creates all dynamic window content
|
||||
void setUpWindow();
|
||||
|
|
@ -69,7 +70,7 @@ private:
|
|||
QMap<EncTtsSetting*,QWidget*> m_settingsWidgetsMap;
|
||||
//! Maps all browse buttons to the corresponding Setting
|
||||
QSignalMapper m_browseBtnMap;
|
||||
//! counter how often busyShow() is called,
|
||||
//! counter how often busyShow() is called,
|
||||
int m_busyCnt;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue