summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/base/encttssettings.cpp140
-rw-r--r--rbutil/rbutilqt/base/encttssettings.h258
-rw-r--r--rbutil/rbutilqt/encttscfggui.cpp722
-rw-r--r--rbutil/rbutilqt/encttscfggui.h156
4 files changed, 638 insertions, 638 deletions
diff --git a/rbutil/rbutilqt/base/encttssettings.cpp b/rbutil/rbutilqt/base/encttssettings.cpp
index 5b62e30816..9c8c2e57fd 100644
--- a/rbutil/rbutilqt/base/encttssettings.cpp
+++ b/rbutil/rbutilqt/base/encttssettings.cpp
@@ -1,70 +1,70 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Wenger 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: encoders.h 17902 2008-06-30 22:09:45Z bluebrother $ 10 * $Id: encoders.h 17902 2008-06-30 22:09:45Z bluebrother $
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2 14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version. 15 * of the License, or (at your option) any later version.
16 * 16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "encttssettings.h" 22#include "encttssettings.h"
23 23
24 24
25EncTtsSetting::EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current, EButton btn) : QObject(parent) 25EncTtsSetting::EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current, EButton btn) : QObject(parent)
26{ 26{
27 m_btn = btn; 27 m_btn = btn;
28 m_name =name; 28 m_name =name;
29 m_type =type; 29 m_type =type;
30 m_currentValue = current; 30 m_currentValue = current;
31} 31}
32 32
33EncTtsSetting::EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QStringList list,EButton btn) : QObject(parent) 33EncTtsSetting::EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QStringList list,EButton btn) : QObject(parent)
34{ 34{
35 m_btn = btn; 35 m_btn = btn;
36 m_name =name; 36 m_name =name;
37 m_type =type; 37 m_type =type;
38 m_currentValue = current; 38 m_currentValue = current;
39 m_list = list; 39 m_list = list;
40} 40}
41 41
42EncTtsSetting::EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QVariant min,QVariant max, EButton btn) : QObject(parent) 42EncTtsSetting::EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QVariant min,QVariant max, EButton btn) : QObject(parent)
43{ 43{
44 m_btn = btn; 44 m_btn = btn;
45 m_name =name; 45 m_name =name;
46 m_type =type; 46 m_type =type;
47 m_currentValue = current; 47 m_currentValue = current;
48 m_minValue = min; 48 m_minValue = min;
49 m_maxValue = max; 49 m_maxValue = max;
50} 50}
51 51
52void EncTtsSetting::setCurrent(QVariant current,bool noticeGui) 52void EncTtsSetting::setCurrent(QVariant current,bool noticeGui)
53{ 53{
54 m_currentValue = current; 54 m_currentValue = current;
55 emit dataChanged(); 55 emit dataChanged();
56 56
57 if(noticeGui) emit updateGui(); 57 if(noticeGui) emit updateGui();
58} 58}
59 59
60//! insert a setting 60//! insert a setting
61void EncTtsSettingInterface::insertSetting(int id,EncTtsSetting* setting) 61void EncTtsSettingInterface::insertSetting(int id,EncTtsSetting* setting)
62{ 62{
63 settingsList.insert(id,setting); 63 settingsList.insert(id,setting);
64} 64}
65 65
66//! retrieve a specific setting 66//! retrieve a specific setting
67EncTtsSetting* EncTtsSettingInterface::getSetting(int id) 67EncTtsSetting* EncTtsSettingInterface::getSetting(int id)
68{ 68{
69 return settingsList.at(id); 69 return settingsList.at(id);
70} 70}
diff --git a/rbutil/rbutilqt/base/encttssettings.h b/rbutil/rbutilqt/base/encttssettings.h
index 843829a815..eb8887d8d9 100644
--- a/rbutil/rbutilqt/base/encttssettings.h
+++ b/rbutil/rbutilqt/base/encttssettings.h
@@ -1,129 +1,129 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Wenger 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: encoders.h 17902 2008-06-30 22:09:45Z bluebrother $ 10 * $Id: encoders.h 17902 2008-06-30 22:09:45Z bluebrother $
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2 14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version. 15 * of the License, or (at your option) any later version.
16 * 16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#ifndef ENCTTSSETTINGS_H 22#ifndef ENCTTSSETTINGS_H
23#define ENCTTSSETTINGS_H 23#define ENCTTSSETTINGS_H
24 24
25#include <QtCore> 25#include <QtCore>
26 26
27//! \brief This class stores everything needed to display a Setting. 27//! \brief This class stores everything needed to display a Setting.
28//! 28//!
29class EncTtsSetting : public QObject 29class EncTtsSetting : public QObject
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32public: 32public:
33 enum ESettingType 33 enum ESettingType
34 { 34 {
35 eBASE, 35 eBASE,
36 eBOOL, 36 eBOOL,
37 eDOUBLE, 37 eDOUBLE,
38 eINT, 38 eINT,
39 eSTRING, 39 eSTRING,
40 eREADONLYSTRING, 40 eREADONLYSTRING,
41 eSTRINGLIST, 41 eSTRINGLIST,
42 }; 42 };
43 enum EButton 43 enum EButton
44 { 44 {
45 eNOBTN, 45 eNOBTN,
46 eBROWSEBTN, 46 eBROWSEBTN,
47 eREFRESHBTN 47 eREFRESHBTN
48 }; 48 };
49 49
50 //! constructor for a String or Bool setting 50 //! constructor for a String or Bool setting
51 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,EButton btn = eNOBTN); 51 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,EButton btn = eNOBTN);
52 //! contructor for a Stringlist setting, ie a enumeration 52 //! contructor for a Stringlist setting, ie a enumeration
53 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QStringList list,EButton btn = eNOBTN); 53 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QStringList list,EButton btn = eNOBTN);
54 //! constructor for a setting with a min-max range 54 //! constructor for a setting with a min-max range
55 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QVariant min,QVariant max,EButton = eNOBTN); 55 EncTtsSetting(QObject* parent,ESettingType type,QString name,QVariant current,QVariant min,QVariant max,EButton = eNOBTN);
56 56
57 //! get currentValue 57 //! get currentValue
58 QVariant current() {return m_currentValue;} 58 QVariant current() {return m_currentValue;}
59 //! set currentValue 59 //! set currentValue
60 void setCurrent(QVariant current,bool noticeGui=true); 60 void setCurrent(QVariant current,bool noticeGui=true);
61 61
62 //! get name of the Setting 62 //! get name of the Setting
63 QString name() {return m_name;} 63 QString name() {return m_name;}
64 //! get the type of the setting 64 //! get the type of the setting
65 ESettingType type() {return m_type;} 65 ESettingType type() {return m_type;}
66 //! get what type of button this setting needs 66 //! get what type of button this setting needs
67 EButton button() {return m_btn;} 67 EButton button() {return m_btn;}
68 //! get the minValue (only valid for a range setting, ie eDOUBLE or eINT) 68 //! get the minValue (only valid for a range setting, ie eDOUBLE or eINT)
69 QVariant min() {return m_minValue; } 69 QVariant min() {return m_minValue; }
70 //! get the maxValue (only valid for a range setting, ie eDOUBLE or eINT) 70 //! get the maxValue (only valid for a range setting, ie eDOUBLE or eINT)
71 QVariant max() {return m_maxValue; } 71 QVariant max() {return m_maxValue; }
72 //! get the enumerationlist (only valid for eSTRINGLIST settings) 72 //! get the enumerationlist (only valid for eSTRINGLIST settings)
73 QStringList list() {return m_list;} 73 QStringList list() {return m_list;}
74 //! set the enumeration list 74 //! set the enumeration list
75 void setList(QStringList list){m_list = list;} 75 void setList(QStringList list){m_list = list;}
76 76
77signals: 77signals:
78 //! connect to this signal if you want to get noticed when the data changes 78 //! connect to this signal if you want to get noticed when the data changes
79 void dataChanged(); 79 void dataChanged();
80 //! connect to this if you want to react on refresh button 80 //! connect to this if you want to react on refresh button
81 void refresh(); 81 void refresh();
82 //! will be emited when the gui should update this setting 82 //! will be emited when the gui should update this setting
83 void updateGui(); 83 void updateGui();
84 84
85private: 85private:
86 ESettingType m_type; 86 ESettingType m_type;
87 EButton m_btn; 87 EButton m_btn;
88 QString m_name; 88 QString m_name;
89 QVariant m_currentValue; 89 QVariant m_currentValue;
90 QVariant m_minValue; 90 QVariant m_minValue;
91 QVariant m_maxValue; 91 QVariant m_maxValue;
92 QStringList m_list; 92 QStringList m_list;
93}; 93};
94 94
95 95
96//! \brief this class is the Interface for Encoder and TTS engines, to display settings 96//! \brief this class is the Interface for Encoder and TTS engines, to display settings
97//! It wraps nearly everything needed, only updateModel() and commitModel() needs to be reimplemented 97//! It wraps nearly everything needed, only updateModel() and commitModel() needs to be reimplemented
98//! 98//!
99class EncTtsSettingInterface : public QObject 99class EncTtsSettingInterface : public QObject
100{ 100{
101 Q_OBJECT 101 Q_OBJECT
102public: 102public:
103 EncTtsSettingInterface(QObject* parent) : QObject(parent) {} 103 EncTtsSettingInterface(QObject* parent) : QObject(parent) {}
104 104
105 //! get the Settings list 105 //! get the Settings list
106 QList<EncTtsSetting*> getSettings() {generateSettings(); return settingsList;} 106 QList<EncTtsSetting*> getSettings() {generateSettings(); return settingsList;}
107 107
108 //! Chlid class should commit the from SettingsList to permanent storage 108 //! Chlid class should commit the from SettingsList to permanent storage
109 virtual void saveSettings() = 0; 109 virtual void saveSettings() = 0;
110 110
111signals: 111signals:
112 void busy(); // emit this if a operation takes time 112 void busy(); // emit this if a operation takes time
113 void busyEnd(); // emit this at the end of a busy section 113 void busyEnd(); // emit this at the end of a busy section
114 114
115protected: 115protected:
116 //! Child class should fill in the setttingsList 116 //! Child class should fill in the setttingsList
117 virtual void generateSettings() = 0; 117 virtual void generateSettings() = 0;
118 118
119 //! insert a setting 119 //! insert a setting
120 void insertSetting(int id,EncTtsSetting* setting); 120 void insertSetting(int id,EncTtsSetting* setting);
121 //! retrieve a specific setting 121 //! retrieve a specific setting
122 EncTtsSetting* getSetting(int id); 122 EncTtsSetting* getSetting(int id);
123 123
124private: 124private:
125 //! The setting storage. 125 //! The setting storage.
126 QList<EncTtsSetting*> settingsList; 126 QList<EncTtsSetting*> settingsList;
127 127
128}; 128};
129#endif 129#endif
diff --git a/rbutil/rbutilqt/encttscfggui.cpp b/rbutil/rbutilqt/encttscfggui.cpp
index 25089873fc..c38ff44df0 100644
--- a/rbutil/rbutilqt/encttscfggui.cpp
+++ b/rbutil/rbutilqt/encttscfggui.cpp
@@ -1,361 +1,361 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Wenger 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: encoders.h 17902 2008-06-30 22:09:45Z bluebrother $ 10 * $Id: encoders.h 17902 2008-06-30 22:09:45Z bluebrother $
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2 14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version. 15 * of the License, or (at your option) any later version.
16 * 16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "encttscfggui.h" 22#include "encttscfggui.h"
23#include "browsedirtree.h" 23#include "browsedirtree.h"
24 24
25EncTtsCfgGui::EncTtsCfgGui(QDialog* parent,EncTtsSettingInterface* interface,QString name) : QDialog(parent) 25EncTtsCfgGui::EncTtsCfgGui(QDialog* parent,EncTtsSettingInterface* interface,QString name) : QDialog(parent)
26{ 26{
27 m_settingInterface = interface; 27 m_settingInterface = interface;
28 28
29 m_busyCnt=0; 29 m_busyCnt=0;
30 // create a busy Dialog 30 // create a busy Dialog
31 m_busyDlg= new QProgressDialog(tr(""), tr(""), 0, 0,this); 31 m_busyDlg= new QProgressDialog(tr(""), tr(""), 0, 0,this);
32 m_busyDlg->setWindowTitle(tr("Waiting for engine...")); 32 m_busyDlg->setWindowTitle(tr("Waiting for engine..."));
33 m_busyDlg->setModal(true); 33 m_busyDlg->setModal(true);
34 m_busyDlg->setLabel(0); 34 m_busyDlg->setLabel(0);
35 m_busyDlg->setCancelButton(0); 35 m_busyDlg->setCancelButton(0);
36 m_busyDlg->hide(); 36 m_busyDlg->hide();
37 connect(interface,SIGNAL(busy()),this,SLOT(showBusy())); 37 connect(interface,SIGNAL(busy()),this,SLOT(showBusy()));
38 connect(interface,SIGNAL(busyEnd()),this,SLOT(hideBusy())); 38 connect(interface,SIGNAL(busyEnd()),this,SLOT(hideBusy()));
39 39
40 //setup the window 40 //setup the window
41 setWindowTitle(name); 41 setWindowTitle(name);
42 setUpWindow(); 42 setUpWindow();
43} 43}
44 44
45void EncTtsCfgGui::setUpWindow() 45void EncTtsCfgGui::setUpWindow()
46{ 46{
47 m_settingsList = m_settingInterface->getSettings(); 47 m_settingsList = m_settingInterface->getSettings();
48 48
49 //layout 49 //layout
50 QVBoxLayout *mainLayout = new QVBoxLayout; 50 QVBoxLayout *mainLayout = new QVBoxLayout;
51 51
52 // groupbox 52 // groupbox
53 QGroupBox *groupBox = new QGroupBox(this); 53 QGroupBox *groupBox = new QGroupBox(this);
54 QFormLayout *formlayout = new QFormLayout; 54 QFormLayout *formlayout = new QFormLayout;
55 // setting widgets 55 // setting widgets
56 for(int i = 0; i < m_settingsList.size(); i++) 56 for(int i = 0; i < m_settingsList.size(); i++)
57 { 57 {
58 formlayout->addRow(m_settingsList.at(i)->name(),createWidgets(m_settingsList.at(i))); 58 formlayout->addRow(m_settingsList.at(i)->name(),createWidgets(m_settingsList.at(i)));
59 } 59 }
60 groupBox->setLayout(formlayout); 60 groupBox->setLayout(formlayout);
61 mainLayout->addWidget(groupBox); 61 mainLayout->addWidget(groupBox);
62 62
63 // connect browse btn 63 // connect browse btn
64 connect(&m_browseBtnMap,SIGNAL(mapped(QObject*)),this,SLOT(browse(QObject*))); 64 connect(&m_browseBtnMap,SIGNAL(mapped(QObject*)),this,SLOT(browse(QObject*)));
65 65
66 // ok - cancel buttons 66 // ok - cancel buttons
67 QPushButton* okBtn = new QPushButton(tr("Ok"),this); 67 QPushButton* okBtn = new QPushButton(tr("Ok"),this);
68 okBtn->setDefault(true); 68 okBtn->setDefault(true);
69 okBtn->setIcon(QIcon(":icons/go-next.png")); 69 okBtn->setIcon(QIcon(":icons/go-next.png"));
70 QPushButton* cancelBtn = new QPushButton(tr("Cancel"),this); 70 QPushButton* cancelBtn = new QPushButton(tr("Cancel"),this);
71 cancelBtn->setIcon(QIcon(":icons/process-stop.png")); 71 cancelBtn->setIcon(QIcon(":icons/process-stop.png"));
72 connect(okBtn,SIGNAL(clicked()),this,SLOT(accept())); 72 connect(okBtn,SIGNAL(clicked()),this,SLOT(accept()));
73 connect(cancelBtn,SIGNAL(clicked()),this,SLOT(reject())); 73 connect(cancelBtn,SIGNAL(clicked()),this,SLOT(reject()));
74 74
75 QHBoxLayout *btnbox = new QHBoxLayout; 75 QHBoxLayout *btnbox = new QHBoxLayout;
76 btnbox->addWidget(okBtn); 76 btnbox->addWidget(okBtn);
77 btnbox->addWidget(cancelBtn); 77 btnbox->addWidget(cancelBtn);
78 btnbox->insertStretch(0,1); 78 btnbox->insertStretch(0,1);
79 79
80 mainLayout->addLayout(btnbox); 80 mainLayout->addLayout(btnbox);
81 81
82 this->setLayout(mainLayout); 82 this->setLayout(mainLayout);
83} 83}
84 84
85QLayout* EncTtsCfgGui::createWidgets(EncTtsSetting* setting) 85QLayout* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
86{ 86{
87 // value display 87 // value display
88 QWidget* value = NULL; 88 QWidget* value = NULL;
89 switch(setting->type()) 89 switch(setting->type())
90 { 90 {
91 case EncTtsSetting::eDOUBLE: 91 case EncTtsSetting::eDOUBLE:
92 { 92 {
93 QDoubleSpinBox *spinBox = new QDoubleSpinBox(this); 93 QDoubleSpinBox *spinBox = new QDoubleSpinBox(this);
94 spinBox->setMinimum(setting->min().toDouble()); 94 spinBox->setMinimum(setting->min().toDouble());
95 spinBox->setMaximum(setting->max().toDouble()); 95 spinBox->setMaximum(setting->max().toDouble());
96 spinBox->setSingleStep(0.01); 96 spinBox->setSingleStep(0.01);
97 spinBox->setValue(setting->current().toDouble()); 97 spinBox->setValue(setting->current().toDouble());
98 connect(spinBox,SIGNAL(valueChanged(double)),this,SLOT(updateSetting())); 98 connect(spinBox,SIGNAL(valueChanged(double)),this,SLOT(updateSetting()));
99 value = spinBox; 99 value = spinBox;
100 break; 100 break;
101 } 101 }
102 case EncTtsSetting::eINT: 102 case EncTtsSetting::eINT:
103 { 103 {
104 QSpinBox *spinBox = new QSpinBox(this); 104 QSpinBox *spinBox = new QSpinBox(this);
105 spinBox->setMinimum(setting->min().toInt()); 105 spinBox->setMinimum(setting->min().toInt());
106 spinBox->setMaximum(setting->max().toInt()); 106 spinBox->setMaximum(setting->max().toInt());
107 spinBox->setValue(setting->current().toInt()); 107 spinBox->setValue(setting->current().toInt());
108 connect(spinBox,SIGNAL(valueChanged(int)),this,SLOT(updateSetting())); 108 connect(spinBox,SIGNAL(valueChanged(int)),this,SLOT(updateSetting()));
109 value = spinBox; 109 value = spinBox;
110 break; 110 break;
111 } 111 }
112 case EncTtsSetting::eSTRING: 112 case EncTtsSetting::eSTRING:
113 { 113 {
114 QLineEdit *lineEdit = new QLineEdit(this); 114 QLineEdit *lineEdit = new QLineEdit(this);
115 lineEdit->setText(setting->current().toString()); 115 lineEdit->setText(setting->current().toString());
116 connect(lineEdit,SIGNAL(textChanged(QString)),this,SLOT(updateSetting())); 116 connect(lineEdit,SIGNAL(textChanged(QString)),this,SLOT(updateSetting()));
117 value = lineEdit; 117 value = lineEdit;
118 break; 118 break;
119 } 119 }
120 case EncTtsSetting::eREADONLYSTRING: 120 case EncTtsSetting::eREADONLYSTRING:
121 { 121 {
122 value = new QLabel(setting->current().toString(),this); 122 value = new QLabel(setting->current().toString(),this);
123 break; 123 break;
124 } 124 }
125 case EncTtsSetting::eSTRINGLIST: 125 case EncTtsSetting::eSTRINGLIST:
126 { 126 {
127 QComboBox *comboBox = new QComboBox(this); 127 QComboBox *comboBox = new QComboBox(this);
128 comboBox->addItems(setting->list()); 128 comboBox->addItems(setting->list());
129 int index = comboBox->findText(setting->current().toString()); 129 int index = comboBox->findText(setting->current().toString());
130 comboBox->setCurrentIndex(index); 130 comboBox->setCurrentIndex(index);
131 connect(comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateSetting())); 131 connect(comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateSetting()));
132 value = comboBox; 132 value = comboBox;
133 break; 133 break;
134 } 134 }
135 case EncTtsSetting::eBOOL: 135 case EncTtsSetting::eBOOL:
136 { 136 {
137 QCheckBox *checkbox = new QCheckBox(this); 137 QCheckBox *checkbox = new QCheckBox(this);
138 checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked); 138 checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked);
139 connect(checkbox,SIGNAL(stateChanged(int)),this,SLOT(updateSetting())); 139 connect(checkbox,SIGNAL(stateChanged(int)),this,SLOT(updateSetting()));
140 value = checkbox; 140 value = checkbox;
141 break; 141 break;
142 } 142 }
143 default: 143 default:
144 { 144 {
145 qDebug() << "Warning: unknown EncTTsSetting type" << setting->type(); 145 qDebug() << "Warning: unknown EncTTsSetting type" << setting->type();
146 break; 146 break;
147 } 147 }
148 } 148 }
149 149
150 // remeber widget 150 // remeber widget
151 if(value != NULL) 151 if(value != NULL)
152 { 152 {
153 m_settingsWidgetsMap.insert(setting,value); 153 m_settingsWidgetsMap.insert(setting,value);
154 connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget())); 154 connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget()));
155 } 155 }
156 156
157 // buttons ? 157 // buttons ?
158 QWidget* btn = createButton(setting); 158 QWidget* btn = createButton(setting);
159 159
160 // add to layout 160 // add to layout
161 QHBoxLayout *hbox = new QHBoxLayout; 161 QHBoxLayout *hbox = new QHBoxLayout;
162 if(value != NULL)hbox->addWidget(value); 162 if(value != NULL)hbox->addWidget(value);
163 if(btn != NULL) hbox->addWidget(btn); 163 if(btn != NULL) hbox->addWidget(btn);
164 164
165 return hbox; 165 return hbox;
166 166
167} 167}
168 168
169QWidget* EncTtsCfgGui::createButton(EncTtsSetting* setting) 169QWidget* EncTtsCfgGui::createButton(EncTtsSetting* setting)
170{ 170{
171 if(setting->button() == EncTtsSetting::eBROWSEBTN) 171 if(setting->button() == EncTtsSetting::eBROWSEBTN)
172 { 172 {
173 QPushButton* browsebtn = new QPushButton(tr("Browse"),this); 173 QPushButton* browsebtn = new QPushButton(tr("Browse"),this);
174 browsebtn->setFixedWidth(50); //all buttons the same size, or it looks ugly 174 browsebtn->setFixedWidth(50); //all buttons the same size, or it looks ugly
175 m_browseBtnMap.setMapping(browsebtn,setting); 175 m_browseBtnMap.setMapping(browsebtn,setting);
176 connect(browsebtn,SIGNAL(clicked()),&m_browseBtnMap,SLOT(map())); 176 connect(browsebtn,SIGNAL(clicked()),&m_browseBtnMap,SLOT(map()));
177 return browsebtn; 177 return browsebtn;
178 } 178 }
179 else if(setting->button() == EncTtsSetting::eREFRESHBTN) 179 else if(setting->button() == EncTtsSetting::eREFRESHBTN)
180 { 180 {
181 QPushButton* refreshbtn = new QPushButton(tr("Refresh"),this); 181 QPushButton* refreshbtn = new QPushButton(tr("Refresh"),this);
182 refreshbtn->setFixedWidth(50); //all buttons the same size, or it looks ugly 182 refreshbtn->setFixedWidth(50); //all buttons the same size, or it looks ugly
183 connect(refreshbtn,SIGNAL(clicked()),setting,SIGNAL(refresh())); 183 connect(refreshbtn,SIGNAL(clicked()),setting,SIGNAL(refresh()));
184 return refreshbtn; 184 return refreshbtn;
185 } 185 }
186 else 186 else
187 return NULL; 187 return NULL;
188} 188}
189 189
190void EncTtsCfgGui::updateSetting() 190void EncTtsCfgGui::updateSetting()
191{ 191{
192 //cast and get the sender widget 192 //cast and get the sender widget
193 QWidget* widget = qobject_cast<QWidget*>(QObject::sender()); 193 QWidget* widget = qobject_cast<QWidget*>(QObject::sender());
194 if(widget == NULL) return; 194 if(widget == NULL) return;
195 // get the corresponding setting 195 // get the corresponding setting
196 EncTtsSetting* setting = m_settingsWidgetsMap.key(widget); 196 EncTtsSetting* setting = m_settingsWidgetsMap.key(widget);
197 197
198 // update widget based on setting type 198 // update widget based on setting type
199 switch(setting->type()) 199 switch(setting->type())
200 { 200 {
201 case EncTtsSetting::eDOUBLE: 201 case EncTtsSetting::eDOUBLE:
202 { 202 {
203 setting->setCurrent(((QDoubleSpinBox*)widget)->value(),false); 203 setting->setCurrent(((QDoubleSpinBox*)widget)->value(),false);
204 break; 204 break;
205 } 205 }
206 case EncTtsSetting::eINT: 206 case EncTtsSetting::eINT:
207 { 207 {
208 setting->setCurrent(((QSpinBox*)widget)->value(),false); 208 setting->setCurrent(((QSpinBox*)widget)->value(),false);
209 break; 209 break;
210 } 210 }
211 case EncTtsSetting::eSTRING: 211 case EncTtsSetting::eSTRING:
212 { 212 {
213 setting->setCurrent(((QLineEdit*)widget)->text(),false); 213 setting->setCurrent(((QLineEdit*)widget)->text(),false);
214 break; 214 break;
215 } 215 }
216 case EncTtsSetting::eREADONLYSTRING: 216 case EncTtsSetting::eREADONLYSTRING:
217 { 217 {
218 setting->setCurrent(((QLabel*)widget)->text(),false); 218 setting->setCurrent(((QLabel*)widget)->text(),false);
219 break; 219 break;
220 } 220 }
221 case EncTtsSetting::eSTRINGLIST: 221 case EncTtsSetting::eSTRINGLIST:
222 { 222 {
223 setting->setCurrent(((QComboBox*)widget)->currentText(),false); 223 setting->setCurrent(((QComboBox*)widget)->currentText(),false);
224 break; 224 break;
225 } 225 }
226 case EncTtsSetting::eBOOL: 226 case EncTtsSetting::eBOOL:
227 { 227 {
228 setting->setCurrent(((QCheckBox*)widget)->isChecked(),false); 228 setting->setCurrent(((QCheckBox*)widget)->isChecked(),false);
229 } 229 }
230 default: 230 default:
231 { 231 {
232 qDebug() << "unknown Settingtype !!"; 232 qDebug() << "unknown Settingtype !!";
233 break; 233 break;
234 } 234 }
235 } 235 }
236} 236}
237 237
238void EncTtsCfgGui::updateWidget() 238void EncTtsCfgGui::updateWidget()
239{ 239{
240 // get sender setting 240 // get sender setting
241 EncTtsSetting* setting = qobject_cast<EncTtsSetting*>(QObject::sender()); 241 EncTtsSetting* setting = qobject_cast<EncTtsSetting*>(QObject::sender());
242 if(setting == NULL) return; 242 if(setting == NULL) return;
243 // get corresponding widget 243 // get corresponding widget
244 QWidget* widget = m_settingsWidgetsMap.value(setting); 244 QWidget* widget = m_settingsWidgetsMap.value(setting);
245 245
246 // update Widget based on setting type 246 // update Widget based on setting type
247 switch(setting->type()) 247 switch(setting->type())
248 { 248 {
249 case EncTtsSetting::eDOUBLE: 249 case EncTtsSetting::eDOUBLE:
250 { 250 {
251 QDoubleSpinBox* spinbox = (QDoubleSpinBox*) widget; 251 QDoubleSpinBox* spinbox = (QDoubleSpinBox*) widget;
252 spinbox->setMinimum(setting->min().toDouble()); 252 spinbox->setMinimum(setting->min().toDouble());
253 spinbox->setMaximum(setting->max().toDouble()); 253 spinbox->setMaximum(setting->max().toDouble());
254 spinbox->blockSignals(true); 254 spinbox->blockSignals(true);
255 spinbox->setValue(setting->current().toDouble()); 255 spinbox->setValue(setting->current().toDouble());
256 spinbox->blockSignals(false); 256 spinbox->blockSignals(false);
257 break; 257 break;
258 } 258 }
259 case EncTtsSetting::eINT: 259 case EncTtsSetting::eINT:
260 { 260 {
261 QSpinBox* spinbox = (QSpinBox*) widget; 261 QSpinBox* spinbox = (QSpinBox*) widget;
262 spinbox->setMinimum(setting->min().toInt()); 262 spinbox->setMinimum(setting->min().toInt());
263 spinbox->setMaximum(setting->max().toInt()); 263 spinbox->setMaximum(setting->max().toInt());
264 spinbox->blockSignals(true); 264 spinbox->blockSignals(true);
265 spinbox->setValue(setting->current().toInt()); 265 spinbox->setValue(setting->current().toInt());
266 spinbox->blockSignals(false); 266 spinbox->blockSignals(false);
267 break; 267 break;
268 } 268 }
269 case EncTtsSetting::eSTRING: 269 case EncTtsSetting::eSTRING:
270 { 270 {
271 QLineEdit* lineedit = (QLineEdit*) widget; 271 QLineEdit* lineedit = (QLineEdit*) widget;
272 272
273 lineedit->blockSignals(true); 273 lineedit->blockSignals(true);
274 lineedit->setText(setting->current().toString()); 274 lineedit->setText(setting->current().toString());
275 lineedit->blockSignals(false); 275 lineedit->blockSignals(false);
276 break; 276 break;
277 } 277 }
278 case EncTtsSetting::eREADONLYSTRING: 278 case EncTtsSetting::eREADONLYSTRING:
279 { 279 {
280 QLabel* label = (QLabel*) widget; 280 QLabel* label = (QLabel*) widget;
281 281
282 label->blockSignals(true); 282 label->blockSignals(true);
283 label->setText(setting->current().toString()); 283 label->setText(setting->current().toString());
284 label->blockSignals(false); 284 label->blockSignals(false);
285 break; 285 break;
286 } 286 }
287 case EncTtsSetting::eSTRINGLIST: 287 case EncTtsSetting::eSTRINGLIST:
288 { 288 {
289 QComboBox* combobox = (QComboBox*) widget; 289 QComboBox* combobox = (QComboBox*) widget;
290 290
291 combobox->blockSignals(true); 291 combobox->blockSignals(true);
292 combobox->clear(); 292 combobox->clear();
293 combobox->addItems(setting->list()); 293 combobox->addItems(setting->list());
294 int index = combobox->findText(setting->current().toString()); 294 int index = combobox->findText(setting->current().toString());
295 combobox->setCurrentIndex(index); 295 combobox->setCurrentIndex(index);
296 combobox->blockSignals(false); 296 combobox->blockSignals(false);
297 297
298 break; 298 break;
299 } 299 }
300 case EncTtsSetting::eBOOL: 300 case EncTtsSetting::eBOOL:
301 { 301 {
302 QCheckBox* checkbox = (QCheckBox*) widget; 302 QCheckBox* checkbox = (QCheckBox*) widget;
303 303
304 checkbox->blockSignals(true); 304 checkbox->blockSignals(true);
305 checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked); 305 checkbox->setCheckState(setting->current().toBool() == true ? Qt::Checked : Qt::Unchecked);
306 checkbox->blockSignals(false); 306 checkbox->blockSignals(false);
307 break; 307 break;
308 } 308 }
309 default: 309 default:
310 { 310 {
311 qDebug() << "unknown EncTTsSetting"; 311 qDebug() << "unknown EncTTsSetting";
312 break; 312 break;
313 } 313 }
314 } 314 }
315} 315}
316 316
317void EncTtsCfgGui::showBusy() 317void EncTtsCfgGui::showBusy()
318{ 318{
319 if(m_busyCnt == 0) m_busyDlg->show(); 319 if(m_busyCnt == 0) m_busyDlg->show();
320 320
321 m_busyCnt++; 321 m_busyCnt++;
322} 322}
323 323
324void EncTtsCfgGui::hideBusy() 324void EncTtsCfgGui::hideBusy()
325{ 325{
326 m_busyCnt--; 326 m_busyCnt--;
327 327
328 if(m_busyCnt == 0) m_busyDlg->hide(); 328 if(m_busyCnt == 0) m_busyDlg->hide();
329} 329}
330 330
331 331
332void EncTtsCfgGui::accept(void) 332void EncTtsCfgGui::accept(void)
333{ 333{
334 m_settingInterface->saveSettings(); 334 m_settingInterface->saveSettings();
335 this->done(0); 335 this->done(0);
336} 336}
337 337
338void EncTtsCfgGui::reject(void) 338void EncTtsCfgGui::reject(void)
339{ 339{
340 this->done(0); 340 this->done(0);
341} 341}
342 342
343//! takes a QObject because of QsignalMapper 343//! takes a QObject because of QsignalMapper
344void EncTtsCfgGui::browse(QObject* settingObj) 344void EncTtsCfgGui::browse(QObject* settingObj)
345{ 345{
346 // cast top setting 346 // cast top setting
347 EncTtsSetting* setting= qobject_cast<EncTtsSetting*>(settingObj); 347 EncTtsSetting* setting= qobject_cast<EncTtsSetting*>(settingObj);
348 if(setting == NULL) return; 348 if(setting == NULL) return;
349 349
350 //current path 350 //current path
351 QString curPath = setting->current().toString(); 351 QString curPath = setting->current().toString();
352 // show file dialog 352 // show file dialog
353 QString exe = QFileDialog::getOpenFileName(this, tr("Select excutable"), curPath, "*"); 353 QString exe = QFileDialog::getOpenFileName(this, tr("Select excutable"), curPath, "*");
354 if(!QFileInfo(exe).isExecutable()) 354 if(!QFileInfo(exe).isExecutable())
355 return; 355 return;
356 // set new value, gui will update automatically 356 // set new value, gui will update automatically
357 setting->setCurrent(exe); 357 setting->setCurrent(exe);
358} 358}
359 359
360 360
361 361
diff --git a/rbutil/rbutilqt/encttscfggui.h b/rbutil/rbutilqt/encttscfggui.h
index 45b151ce23..c0f5119a81 100644
--- a/rbutil/rbutilqt/encttscfggui.h
+++ b/rbutil/rbutilqt/encttscfggui.h
@@ -1,78 +1,78 @@
1/*************************************************************************** 1/***************************************************************************
2 * __________ __ ___. 2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * 8 *
9 * Copyright (C) 2007 by Dominik Wenger 9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: encoders.h 17902 2008-06-30 22:09:45Z bluebrother $ 10 * $Id: encoders.h 17902 2008-06-30 22:09:45Z bluebrother $
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2 14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version. 15 * of the License, or (at your option) any later version.
16 * 16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#ifndef ENCTTSCFGGUI_H 22#ifndef ENCTTSCFGGUI_H
23#define ENCTTSCFGGUI_H 23#define ENCTTSCFGGUI_H
24 24
25#include <QtGui> 25#include <QtGui>
26#include "encttssettings.h" 26#include "encttssettings.h"
27 27
28//! \brief Shows and manages a configuration gui for encoders and tts enignes 28//! \brief Shows and manages a configuration gui for encoders and tts enignes
29//! 29//!
30class EncTtsCfgGui: public QDialog 30class EncTtsCfgGui: public QDialog
31{ 31{
32 Q_OBJECT 32 Q_OBJECT
33public: 33public:
34 //! Creates the UI. give it a endoer or tts engine with already set config. uses show() or exec() to show it. 34 //! Creates the UI. give it a endoer or tts engine with already set config. uses show() or exec() to show it.
35 EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* interface,QString name); 35 EncTtsCfgGui(QDialog* parent, EncTtsSettingInterface* interface,QString name);
36 36
37private slots: 37private slots:
38 //! accept current configuration values and close window 38 //! accept current configuration values and close window
39 void accept(void); 39 void accept(void);
40 //! close window and dont save configuration 40 //! close window and dont save configuration
41 void reject(void); 41 void reject(void);
42 //! updates the corresponding setting from the sending Widget 42 //! updates the corresponding setting from the sending Widget
43 void updateSetting(); 43 void updateSetting();
44 //! updates corresponding Widget from the sending Setting. 44 //! updates corresponding Widget from the sending Setting.
45 void updateWidget(); 45 void updateWidget();
46 //! shows a busy dialog. counts calls. 46 //! shows a busy dialog. counts calls.
47 void showBusy(); 47 void showBusy();
48 //! hides the busy dialog, counts calls 48 //! hides the busy dialog, counts calls
49 void hideBusy(); 49 void hideBusy();
50 //! used via the SignalMapper for all Browse buttons 50 //! used via the SignalMapper for all Browse buttons
51 void browse(QObject*); 51 void browse(QObject*);
52 52
53private: 53private:
54 //! creates all dynamic window content 54 //! creates all dynamic window content
55 void setUpWindow(); 55 void setUpWindow();
56 //! creates the Widgets needed for one setting. returns a Layout with the widgets 56 //! creates the Widgets needed for one setting. returns a Layout with the widgets
57 QLayout* createWidgets(EncTtsSetting* setting); 57 QLayout* createWidgets(EncTtsSetting* setting);
58 //! creates a button when needed by the setting. 58 //! creates a button when needed by the setting.
59 QWidget* createButton(EncTtsSetting* setting); 59 QWidget* createButton(EncTtsSetting* setting);
60 //! name of the Encoder or TTS for which this UI is 60 //! name of the Encoder or TTS for which this UI is
61 QString m_name; 61 QString m_name;
62 //! the interface pointer to the TTS or encoder 62 //! the interface pointer to the TTS or encoder
63 EncTtsSettingInterface* m_settingInterface; 63 EncTtsSettingInterface* m_settingInterface;
64 //! Dialog, shown when enc or tts is busy 64 //! Dialog, shown when enc or tts is busy
65 QProgressDialog* m_busyDlg; 65 QProgressDialog* m_busyDlg;
66 //! List of settings from the TTS or Encoder 66 //! List of settings from the TTS or Encoder
67 QList<EncTtsSetting*> m_settingsList; 67 QList<EncTtsSetting*> m_settingsList;
68 //! Maps settings and the correspondig Widget 68 //! Maps settings and the correspondig Widget
69 QMap<EncTtsSetting*,QWidget*> m_settingsWidgetsMap; 69 QMap<EncTtsSetting*,QWidget*> m_settingsWidgetsMap;
70 //! Maps all browse buttons to the corresponding Setting 70 //! Maps all browse buttons to the corresponding Setting
71 QSignalMapper m_browseBtnMap; 71 QSignalMapper m_browseBtnMap;
72 //! counter how often busyShow() is called, 72 //! counter how often busyShow() is called,
73 int m_busyCnt; 73 int m_busyCnt;
74}; 74};
75 75
76 76
77#endif 77#endif
78 78