1
0
Fork 0
forked from len0rd/rockbox

Add option to show disabled targets in the configuration dialog.

Note that disabled targets support is not intended for use by end users.
This is to make development (and testing of svn) easier and should get
disabled for releases.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24513 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2010-02-04 21:10:20 +00:00
parent 69fe1ad830
commit a9ab407f84
5 changed files with 268 additions and 217 deletions

View file

@ -119,7 +119,8 @@ QStringList SystemInfo::platforms(enum SystemInfo::PlatformType type, QString va
{
QString target = systemInfos->value("platforms/"+a.at(i), "null").toString();
// only add target if its not disabled
if(systemInfos->value(target+"/status").toString() == "disabled")
if(type != PlatformAllDisabled
&& systemInfos->value(target+"/status").toString() == "disabled")
continue;
// report only base targets when PlatformBase is requested
if(type == PlatformBase && target.contains('.'))

View file

@ -65,6 +65,7 @@ class SystemInfo : public QObject
enum PlatformType {
PlatformAll,
PlatformAllDisabled,
PlatformBase,
PlatformVariant
};

View file

@ -99,6 +99,7 @@ Config::Config(QWidget *parent,int index) : QDialog(parent)
connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int)));
connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updateEncState()));
connect(ui.testTTS,SIGNAL(clicked()),this,SLOT(testTts()));
connect(ui.showDisabled, SIGNAL(toggled(bool)), this, SLOT(showDisabled(bool)));
setUserSettings();
setDevices();
}
@ -282,20 +283,38 @@ void Config::updateCacheInfo(QString path)
}
void Config::showDisabled(bool show)
{
qDebug() << "[Config] disabled targets shown:" << show;
if(show)
QMessageBox::warning(this, tr("Showing disabled targets"),
tr("You just enabled showing targets that are marked disabled. "
"Disabled targets are not recommended to end users. Please "
"use this option only if you know what you are doing."));
setDevices();
}
void Config::setDevices()
{
// setup devices table
qDebug() << "[Config] setting up devices list";
QStringList platformList = SystemInfo::platforms();
QStringList platformList;
if(ui.showDisabled->isChecked())
platformList = SystemInfo::platforms(SystemInfo::PlatformAllDisabled);
else
platformList = SystemInfo::platforms(SystemInfo::PlatformAll);
QMap <QString, QString> manuf;
QMap <QString, QString> devcs;
for(int it = 0; it < platformList.size(); it++)
{
QString curname = SystemInfo::name(platformList.at(it)) +
" (" +ServerInfo::platformValue(platformList.at(it),ServerInfo::CurStatus).toString() + ")";
" (" +ServerInfo::platformValue(platformList.at(it),
ServerInfo::CurStatus).toString() + ")";
QString curbrand = SystemInfo::brand(platformList.at(it));
manuf.insertMulti(curbrand, platformList.at(it));
devcs.insert(platformList.at(it), curname);
@ -341,6 +360,14 @@ void Config::setDevices()
items.append(w2);
}
}
// remove any old items in list
QTreeWidgetItem* widgetitem;
do {
widgetitem = ui.treeDevices->takeTopLevelItem(0);
delete widgetitem;
}
while(widgetitem);
// add new items
ui.treeDevices->insertTopLevelItems(0, items);
if(w3 != 0)
ui.treeDevices->setCurrentItem(w3); // hilight old selection

View file

@ -71,6 +71,7 @@ class Config : public QDialog
void updateTtsState(int);
void updateEncState();
void testTts();
void showDisabled(bool);
};
#endif

View file

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigForm</class>
<widget class="QDialog" name="ConfigForm">
@ -26,15 +27,15 @@
<number>0</number>
</property>
<widget class="QWidget" name="tabDevice">
<attribute name="title" >
<string>&amp;Device</string>
</attribute>
<attribute name="icon">
<iconset resource="rbutilqt.qrc">
<normaloff>:/icons/rbutil.png</normaloff>:/icons/rbutil.png</iconset>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
<attribute name="title">
<string>&amp;Device</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="labelMountPoint">
<property name="text">
<string>Select your device in the &amp;filesystem</string>
@ -44,7 +45,7 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<item row="1" column="0" colspan="3">
<layout class="QHBoxLayout">
<item>
<widget class="QLineEdit" name="mountPoint"/>
@ -75,7 +76,27 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<item row="2" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>118</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="showDisabled">
<property name="text">
<string>Show disabled targets</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QTreeWidget" name="treeDevices">
<column>
<property name="text">
@ -84,7 +105,7 @@
</column>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<item row="4" column="0">
<widget class="QPushButton" name="buttonAutodetect">
<property name="text">
<string>&amp;Autodetect</string>
@ -104,13 +125,13 @@
</layout>
</widget>
<widget class="QWidget" name="tabProxy">
<attribute name="title" >
<string>&amp;Proxy</string>
</attribute>
<attribute name="icon">
<iconset resource="rbutilqt.qrc">
<normaloff>:/icons/network-idle.png</normaloff>:/icons/network-idle.png</iconset>
</attribute>
<attribute name="title">
<string>&amp;Proxy</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QRadioButton" name="radioNoProxy">
@ -221,13 +242,13 @@
</layout>
</widget>
<widget class="QWidget" name="tabLanguage">
<attribute name="title" >
<string>&amp;Language</string>
</attribute>
<attribute name="icon">
<iconset resource="rbutilqt.qrc">
<normaloff>:/icons/preferences-desktop-locale.png</normaloff>:/icons/preferences-desktop-locale.png</iconset>
</attribute>
<attribute name="title">
<string>&amp;Language</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QListWidget" name="listLanguages"/>
@ -235,13 +256,13 @@
</layout>
</widget>
<widget class="QWidget" name="tabCache">
<attribute name="title" >
<string>Cac&amp;he</string>
</attribute>
<attribute name="icon">
<iconset resource="rbutilqt.qrc">
<normaloff>:/icons/package-x-generic.png</normaloff>:/icons/package-x-generic.png</iconset>
</attribute>
<attribute name="title">
<string>Cac&amp;he</string>
</attribute>
<attribute name="toolTip">
<string>Download cache settings</string>
</attribute>
@ -356,13 +377,13 @@
</layout>
</widget>
<widget class="QWidget" name="tabTts">
<attribute name="title" >
<string>&amp;TTS &amp;&amp; Encoder</string>
</attribute>
<attribute name="icon">
<iconset resource="rbutilqt.qrc">
<normaloff>:/icons/audio-input-microphone.png</normaloff>:/icons/audio-input-microphone.png</iconset>
</attribute>
<attribute name="title">
<string>&amp;TTS &amp;&amp; Encoder</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">