summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/encttscfggui.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-10-10 16:52:36 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-10-10 16:52:36 +0000
commitef9dfb89b823ad1470fb56f33f8628143012e797 (patch)
tree40bce29ec3f1c971064c0953216a813e6d944b64 /rbutil/rbutilqt/encttscfggui.cpp
parent6be1d8b8a8d966d3c4669ce6ba0b535a9b3e6a1c (diff)
downloadrockbox-ef9dfb89b823ad1470fb56f33f8628143012e797.tar.gz
rockbox-ef9dfb89b823ad1470fb56f33f8628143012e797.tar.bz2
rockbox-ef9dfb89b823ad1470fb56f33f8628143012e797.zip
Rework configuration dialog for TTS / Encoder values.
The generated dialogs for encoder and TTS configuration didn't scale well and were missing icons. Use a grid layout so buttons are aligned properly now, remove the fixed width for buttongs (which breaks immediately if a label text is getting too long, especially when using a translation). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23075 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/encttscfggui.cpp')
-rw-r--r--rbutil/rbutilqt/encttscfggui.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/rbutil/rbutilqt/encttscfggui.cpp b/rbutil/rbutilqt/encttscfggui.cpp
index 57e5896148..2ff1e93003 100644
--- a/rbutil/rbutilqt/encttscfggui.cpp
+++ b/rbutil/rbutilqt/encttscfggui.cpp
@@ -46,18 +46,32 @@ void EncTtsCfgGui::setUpWindow()
{
m_settingsList = m_settingInterface->getSettings();
- //layout
+ // layout
QVBoxLayout *mainLayout = new QVBoxLayout;
- // groupbox
+ // groupbox
QGroupBox *groupBox = new QGroupBox(this);
- QFormLayout *formlayout = new QFormLayout;
+ QGridLayout *gridLayout = new QGridLayout(groupBox);
// setting widgets
for(int i = 0; i < m_settingsList.size(); i++)
{
- formlayout->addRow(m_settingsList.at(i)->name(),createWidgets(m_settingsList.at(i)));
+ QLabel *label = new QLabel(m_settingsList.at(i)->name());
+ gridLayout->addWidget(label, i, 0);
+ QWidget *widget = createWidgets(m_settingsList.at(i));
+ gridLayout->addWidget(widget, i, 1);
+ QWidget *btn = createButton(m_settingsList.at(i));
+ if(btn != NULL)
+ {
+ gridLayout->addWidget(btn, i, 2);
+ }
}
- groupBox->setLayout(formlayout);
+ // add hidden spacers to make the dialog scale properly
+ QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
+ gridLayout->addItem(spacer, m_settingsList.size(), 0);
+ spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+ gridLayout->addItem(spacer, m_settingsList.size(), 1);
+
+ groupBox->setLayout(gridLayout);
mainLayout->addWidget(groupBox);
// connect browse btn
@@ -82,7 +96,7 @@ void EncTtsCfgGui::setUpWindow()
this->setLayout(mainLayout);
}
-QLayout* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
+QWidget* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
{
// value display
QWidget* value = NULL;
@@ -152,23 +166,14 @@ QLayout* EncTtsCfgGui::createWidgets(EncTtsSetting* setting)
}
}
- // remeber widget
+ // remember widget
if(value != NULL)
{
m_settingsWidgetsMap.insert(setting,value);
connect(setting,SIGNAL(updateGui()),this,SLOT(updateWidget()));
}
- // buttons ?
- QWidget* btn = createButton(setting);
-
- // add to layout
- QHBoxLayout *hbox = new QHBoxLayout;
- if(value != NULL)hbox->addWidget(value);
- if(btn != NULL) hbox->addWidget(btn);
-
- return hbox;
-
+ return value;
}
QWidget* EncTtsCfgGui::createButton(EncTtsSetting* setting)
@@ -176,7 +181,7 @@ QWidget* EncTtsCfgGui::createButton(EncTtsSetting* setting)
if(setting->button() == EncTtsSetting::eBROWSEBTN)
{
QPushButton* browsebtn = new QPushButton(tr("Browse"),this);
- browsebtn->setFixedWidth(50); //all buttons the same size, or it looks ugly
+ browsebtn->setIcon(QIcon(":/icons/system-search.png"));
m_browseBtnMap.setMapping(browsebtn,setting);
connect(browsebtn,SIGNAL(clicked()),&m_browseBtnMap,SLOT(map()));
return browsebtn;
@@ -184,7 +189,7 @@ QWidget* EncTtsCfgGui::createButton(EncTtsSetting* setting)
else if(setting->button() == EncTtsSetting::eREFRESHBTN)
{
QPushButton* refreshbtn = new QPushButton(tr("Refresh"),this);
- refreshbtn->setFixedWidth(50); //all buttons the same size, or it looks ugly
+ refreshbtn->setIcon(QIcon(":/icons/view-refresh.png"));
connect(refreshbtn,SIGNAL(clicked()),setting,SIGNAL(refresh()));
return refreshbtn;
}