diff options
| author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-08-02 21:29:31 +0000 |
|---|---|---|
| committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-08-02 21:29:31 +0000 |
| commit | 7a62bb04d8abeedc237baaec51503d1180e2d93d (patch) | |
| tree | 61d4b38ec2abcd884da434656a83a41527d00b3b | |
| parent | c21abddaae1102087afdad5dcc0531ce6c6add1f (diff) | |
| download | rockbox-7a62bb04d8abeedc237baaec51503d1180e2d93d.zip rockbox-7a62bb04d8abeedc237baaec51503d1180e2d93d.tar.gz rockbox-7a62bb04d8abeedc237baaec51503d1180e2d93d.tar.bz2 rockbox-7a62bb04d8abeedc237baaec51503d1180e2d93d.tar.xz | |
Move device and mountpoint selection to configuration to eliminate the need of asking for the mountpoint in every installation window. Use a QListWidget to make the devices list nicer. Remove scrobbler settings as this will most likely get implemented as plugin.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14149 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | rbutil/rbutilqt/configure.cpp | 112 | ||||
| -rw-r--r-- | rbutil/rbutilqt/configure.h | 4 | ||||
| -rw-r--r-- | rbutil/rbutilqt/configurefrm.ui | 142 | ||||
| -rw-r--r-- | rbutil/rbutilqt/rbutil.ini | 109 | ||||
| -rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 62 | ||||
| -rw-r--r-- | rbutil/rbutilqt/rbutilqt.h | 3 | ||||
| -rw-r--r-- | rbutil/rbutilqt/rbutilqtfrm.ui | 243 |
7 files changed, 382 insertions, 293 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index e922345..cef996e 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -60,15 +60,15 @@ Config::Config(QWidget *parent) : QDialog(parent) connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(abort())); connect(ui.radioNoProxy, SIGNAL(toggled(bool)), this, SLOT(setNoProxy(bool))); connect(ui.radioSystemProxy, SIGNAL(toggled(bool)), this, SLOT(setSystemProxy(bool))); + connect(ui.browseMountPoint, SIGNAL(clicked()), this, SLOT(browseFolder())); // disable unimplemented stuff ui.buttonCacheBrowse->setEnabled(false); ui.cacheDisable->setEnabled(false); ui.cacheOfflineMode->setEnabled(false); ui.buttonCacheClear->setEnabled(false); - ui.scrobblerUser->setEnabled(false); - ui.scrobblerPass->setEnabled(false); - ui.scrobblerTimezone->setEnabled(false); + + ui.buttonAutodetect->setEnabled(false); } @@ -115,6 +115,7 @@ void Config::abort() void Config::setUserSettings(QSettings *user) { userSettings = user; + // set proxy QUrl proxy = userSettings->value("defaults/proxy").toString(); ui.proxyPort->setText(QString("%1").arg(proxy.port())); @@ -145,6 +146,94 @@ void Config::setUserSettings(QSettings *user) if(a.size() > 0) ui.listLanguages->setCurrentItem(a.at(0)); + // devices tab + ui.mountPoint->setText(userSettings->value("defaults/mountpoint").toString()); + +} + + +void Config::setDevices(QSettings *dev) +{ + devices = dev; + // setup devices table + qDebug() << "Config::setDevices()"; + devices->beginGroup("platforms"); + QStringList a = devices->childKeys(); + devices->endGroup(); + + QMap <QString, QString> manuf; + QMap <QString, QString> devcs; + for(int it = 0; it < a.size(); it++) { + QString curdev; + devices->beginGroup("platforms"); + curdev = devices->value(a.at(it), "null").toString(); + devices->endGroup(); + QString curname; + devices->beginGroup(curdev); + curname = devices->value("name", "null").toString(); + QString curbrand = devices->value("brand", "").toString(); + devices->endGroup(); + manuf.insertMulti(curbrand, curdev); + devcs.insert(curdev, curname); + } + + QString platform; + platform = devcs.value(userSettings->value("defaults/platform").toString()); + + // set up devices table + ui.treeDevices->header()->hide(); + ui.treeDevices->expandAll(); + ui.treeDevices->setColumnCount(1); + QList<QTreeWidgetItem *> items; + + // get manufacturers + QStringList brands = manuf.uniqueKeys(); + QTreeWidgetItem *w; + QTreeWidgetItem *w2; + QTreeWidgetItem *w3; + for(int c = 0; c < brands.size(); c++) { + qDebug() << brands.at(c); + w = new QTreeWidgetItem(); + w->setFlags(Qt::ItemIsEnabled); + w->setText(0, brands.at(c)); +// w->setData(0, Qt::DecorationRole, <icon>); + items.append(w); + + // go through platforms again for sake of order + for(int it = 0; it < a.size(); it++) { + QString curdev; + devices->beginGroup("platforms"); + curdev = devices->value(a.at(it), "null").toString(); + devices->endGroup(); + QString curname; + devices->beginGroup(curdev); + curname = devices->value("name", "null").toString(); + QString curbrand = devices->value("brand", "").toString(); + devices->endGroup(); + if(curbrand != brands.at(c)) continue; + qDebug() << "adding:" << brands.at(c) << curname << curdev; + w2 = new QTreeWidgetItem(w, QStringList(curname)); + w2->setData(0, Qt::UserRole, curdev); + if(platform.contains(curname)) { + w2->setSelected(true); + w->setExpanded(true); + w3 = w2; // save pointer to hilight old selection + } + items.append(w2); + } + } + ui.treeDevices->insertTopLevelItems(0, items); + ui.treeDevices->setCurrentItem(w3); // hilight old selection + connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updatePlatform())); +} + + +void Config::updatePlatform() +{ + qDebug() << "updatePlatform()"; + QString nplat; + nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); + userSettings->setValue("defaults/platform", nplat); } @@ -227,3 +316,20 @@ void Config::updateLanguage() } +void Config::browseFolder() +{ + QFileDialog browser(this); + if(QFileInfo(ui.mountPoint->text()).isDir()) + browser.setDirectory(ui.mountPoint->text()); + else + browser.setDirectory("/media"); + browser.setReadOnly(true); + browser.setFileMode(QFileDialog::DirectoryOnly); + browser.setAcceptMode(QFileDialog::AcceptOpen); + if(browser.exec()) { + qDebug() << browser.directory(); + QStringList files = browser.selectedFiles(); + ui.mountPoint->setText(files.at(0)); + userSettings->setValue("defaults/mountpoint", files.at(0)); + } +} diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h index 20ae409..dee1e06 100644 --- a/rbutil/rbutilqt/configure.h +++ b/rbutil/rbutilqt/configure.h @@ -29,6 +29,7 @@ class Config : public QDialog public: Config(QWidget *parent = 0); void setUserSettings(QSettings*); + void setDevices(QSettings*); signals: void settingsUpdated(void); @@ -40,6 +41,7 @@ class Config : public QDialog private: Ui::ConfigForm ui; QSettings *userSettings; + QSettings *devices; QStringList findLanguageFiles(void); QString languageName(const QString&); QMap<QString, QString> lang; @@ -51,6 +53,8 @@ class Config : public QDialog void setNoProxy(bool); void setSystemProxy(bool); void updateLanguage(void); + void browseFolder(void); + void updatePlatform(void); }; #endif diff --git a/rbutil/rbutilqt/configurefrm.ui b/rbutil/rbutilqt/configurefrm.ui index 8310c71..da0a1c1 100644 --- a/rbutil/rbutilqt/configurefrm.ui +++ b/rbutil/rbutilqt/configurefrm.ui @@ -5,8 +5,8 @@ <rect> <x>0</x> <y>0</y> - <width>476</width> - <height>384</height> + <width>500</width> + <height>400</height> </rect> </property> <property name="windowTitle" > @@ -58,6 +58,79 @@ <property name="currentIndex" > <number>0</number> </property> + <widget class="QWidget" name="tabDevice" > + <attribute name="title" > + <string>&Device</string> + </attribute> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="labelMountPoint" > + <property name="text" > + <string>Select your device in the &filesystem</string> + </property> + <property name="buddy" > + <cstring>mountPoint</cstring> + </property> + </widget> + </item> + <item row="1" column="0" colspan="2" > + <layout class="QHBoxLayout" > + <item> + <widget class="QLineEdit" name="mountPoint" /> + </item> + <item> + <widget class="QPushButton" name="browseMountPoint" > + <property name="text" > + <string>&Browse</string> + </property> + <property name="icon" > + <iconset resource="rbutilqt.qrc" >:/icons/icons/system-search.png</iconset> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="labelPlayer" > + <property name="text" > + <string>&Select your audio player</string> + </property> + <property name="buddy" > + <cstring>treeDevices</cstring> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2" > + <widget class="QTreeWidget" name="treeDevices" > + <column> + <property name="text" > + <string>1</string> + </property> + </column> + </widget> + </item> + <item row="4" column="0" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="4" column="1" > + <widget class="QPushButton" name="buttonAutodetect" > + <property name="text" > + <string>&Autodetect</string> + </property> + </widget> + </item> + </layout> + </widget> <widget class="QWidget" name="tabProxy" > <attribute name="title" > <string>&Proxy</string> @@ -183,7 +256,7 @@ </widget> <widget class="QWidget" name="tabCache" > <attribute name="title" > - <string>C&ache</string> + <string>Cac&he</string> </attribute> <attribute name="toolTip" > <string>Download cache settings</string> @@ -286,69 +359,6 @@ </item> </layout> </widget> - <widget class="QWidget" name="tabScrobbler" > - <attribute name="title" > - <string>&Scrobbler</string> - </attribute> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label_8" > - <property name="text" > - <string>&Username</string> - </property> - <property name="buddy" > - <cstring>scrobblerUser</cstring> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="scrobblerUser" /> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_9" > - <property name="text" > - <string>P&assword</string> - </property> - <property name="buddy" > - <cstring>scrobblerPass</cstring> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QLineEdit" name="scrobblerPass" > - <property name="echoMode" > - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - <item row="2" column="0" > - <widget class="QLabel" name="label_10" > - <property name="text" > - <string>&Timezone</string> - </property> - <property name="buddy" > - <cstring>scrobblerTimezone</cstring> - </property> - </widget> - </item> - <item row="2" column="1" > - <widget class="QComboBox" name="scrobblerTimezone" /> - </item> - <item row="4" column="1" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> </widget> </item> </layout> diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini index 4542c3b..c3d9629 100644 --- a/rbutil/rbutilqt/rbutil.ini +++ b/rbutil/rbutilqt/rbutil.ini @@ -3,6 +3,7 @@ download_url=http://www.rockbox.org/download/ daily_url=http://download.rockbox.org/daily/ bleeding_url=http://build.rockbox.org/dist/build- server_conf_url=http://www.rockbox.org/daily/build-info +bleeding_info=http://build.rockbox.org/cvsmod/build-info font_url=http://www.rockbox.org/daily/fonts/rockbox-fonts.zip last_release=2.5 prog_name=rockbox @@ -41,7 +42,7 @@ platform40=gigabeatf platform50=sansae200 [player] -name="Archos Jukebox Player 6000 / Jukebox Studio 5/10/20" +name="Jukebox Player 6000 / Jukebox Studio 5/10/20" platform=player released=yes needsbootloader=no @@ -49,10 +50,10 @@ bootloadermethod= bootloadername= resolution=11x2x1 manualname= -brand=archos +brand=Archos [recorder] -name="Archos Jukebox Recorder 10 / 20" +name="Jukebox Recorder 10 / 20" platform=recorder released=yes needsbootloader=no @@ -60,10 +61,10 @@ bootloadermethod= bootloadername= resolution=112x64x1 manualname= -brand=archos +brand=Archos [recorder8mb] -name="Archos Jukebox Recorder 10 / 20 (with 8mb memory)" +name="Jukebox Recorder 10 / 20 (with 8mb memory)" platform=recorder8mb released=no needsbootloader=no @@ -71,10 +72,10 @@ bootloadermethod= bootloadername= resolution=112x64x1 manualname=rockbox-recorder -brand=archos +brand=Archos [recorderv2] -name="Archos Jukebox Recorder v2 (20GB)" +name="Jukebox Recorder v2 (20GB)" platform=recorderv2 released=yes needsbootloader=no @@ -82,10 +83,10 @@ bootloadermethod= bootloadername= resolution=112x64x1 manualname= -brand=archos +brand=Archos [fmrecorder] -name="Archos Jukebox Recorder FM" +name="Jukebox Recorder FM" platform=fmrecorder released=yes needsbootloader=no @@ -93,10 +94,10 @@ bootloadermethod= bootloadername= resolution=112x64x1 manualname= -brand=archos +brand=Archos [fmrecorder8mb] -name="Archos Jukebox Recorder FM (with 8mb memory)" +name="Jukebox Recorder FM (with 8mb memory)" platform=fmrecorder8mb released=no needsbootloader=no @@ -104,10 +105,10 @@ bootloadermethod= bootloadername= resolution=112x64x1 manualname=rockbox-fmrecorder -brand=archos +brand=Archos [ondiosp] -name="Archos Ondio SP" +name="Ondio SP" platform=ondiosp released=yes needsbootloader=no @@ -115,10 +116,10 @@ bootloadermethod= bootloadername= resolution=112x64x1 manualname= -brand=archos +brand=Archos [ondiofm] -name="Archos Ondio FM" +name="Ondio FM" platform=ondiofm released=yes needsbootloader=no @@ -126,10 +127,10 @@ bootloadermethod= bootloadername= resolution=112x64x1 manualname= -brand=archos +brand=Archos [h100] -name="Iriver iHP100 / iHP110" +name="iHP100 / iHP110" platform=h100 released=no needsbootloader=yes @@ -137,10 +138,10 @@ bootloadermethod=fwpatcher bootloadername=bootloader-h100.bin resolution=160x128x2 manualname=rockbox-h100 -brand=iriver +brand=Iriver [h120] -name="Iriver iHP120 / iHP140 / H120 / H140" +name="iHP120 / iHP140 / H120 / H140" platform=h120 released=no needsbootloader=yes @@ -148,10 +149,10 @@ bootloadermethod=fwpatcher bootloadername=bootloader-h120.bin resolution=160x128x2 manualname=rockbox-h100 -brand=iriver +brand=Iriver [h300] -name="Iriver H320 / H340" +name="H320 / H340" platform=h300 released=no needsbootloader=yes @@ -159,10 +160,10 @@ bootloadermethod=fwpatcher bootloadername=bootloader-h300.bin resolution=220x176x16 manualname=rockbox-h300 -brand=iriver +brand=Iriver [h10_5gbums] -name="Iriver H10 (5 / 6GB) UMS" +name="H10 (5 / 6GB) UMS" platform=h10_5gb released=no needsbootloader=yes @@ -170,10 +171,10 @@ bootloadermethod=h10 bootloadername=H10.mi4 resolution=128x128x16 manualname= -brand=iriver +brand=Iriver [h10_5gbmtp] -name="Iriver H10 (5 / 6GB) MTP" +name="H10 (5 / 6GB) MTP" platform=h10_5gb released=no needsbootloader=yes @@ -181,10 +182,10 @@ bootloadermethod=h10 bootloadername=H10_5GB-MTP/H10.mi4 resolution=128x128x16 manualname= -brand=iriver +brand=Iriver [h10] -name="Iriver H10 (20GB)" +name="H10 (20GB)" platform=h10 released=no needsbootloader=yes @@ -192,10 +193,10 @@ bootloadermethod=h10 bootloadername=H10_20GC.mi4 resolution=160x128x16 manualname= -brand=iriver +brand=Iriver [ipod1g2g] -name="Apple Ipod (1st / 2nd gen)" +name="Ipod (1st / 2nd gen)" platform=ipod1g2g released=no needsbootloader=yes @@ -203,10 +204,10 @@ bootloadermethod=ipodpatcher bootloadername=ipod1g2g resolution=160x128x2 manualname= -brand=apple +brand=Apple [ipodcolor] -name="Apple Ipod Colour / Photo / U2 (4th gen)" +name="Ipod Colour / Photo / U2 (4th gen)" platform=ipodcolor released=no needsbootloader=yes @@ -214,10 +215,10 @@ bootloadermethod=ipodpatcher bootloadername=ipodcolor resolution=220x176x16 manualname= -brand=apple +brand=Apple [ipodnano] -name="Apple Ipod Nano (1st gen)" +name="Ipod Nano (1st gen)" platform=ipodnano released=no needsbootloader=yes @@ -225,10 +226,10 @@ bootloadermethod=ipodpatcher bootloadername=ipodnano resolution=176x132x16 manualname= -brand=apple +brand=Apple [ipod4gray] -name="Apple Ipod (4th gen, greyscale)" +name="Ipod (4th gen, greyscale)" platform=ipod4gray released=no needsbootloader=yes @@ -236,10 +237,10 @@ bootloadermethod=ipodpatcher bootloadername=ipod4g resolution=160x128x2 manualname= -brand=apple +brand=Apple [ipodvideo] -name="Apple Ipod Video (5th gen)" +name="Ipod Video (5th gen)" platform=ipodvideo released=no needsbootloader=yes @@ -247,10 +248,10 @@ bootloadermethod=ipodpatcher bootloadername=ipodvideo resolution=320x240x16 manualname= -brand=apple +brand=Apple [ipod3g] -name="Apple Ipod (3rd gen)" +name="Ipod (3rd gen)" platform=ipod3g released=no needsbootloader=yes @@ -258,10 +259,10 @@ bootloadermethod=ipodpatcher bootloadername=ipod3g resolution=160x128x2 manualname= -brand=apple +brand=Apple [ipodmini1g] -name="Apple Ipod Mini (1st gen)" +name="Ipod Mini (1st gen)" platform=ipodmini1g released=no needsbootloader=yes @@ -269,10 +270,10 @@ bootloadermethod=ipodpatcher bootloadername=ipodmini resolution=138x110x2 manualname=rockbox-ipodmini2g -brand=apple +brand=Apple [ipodmini2g] -name="Apple Ipod Mini (2nd gen)" +name="Ipod Mini (2nd gen)" platform=ipodmini2g released=no needsbootloader=yes @@ -280,10 +281,10 @@ bootloadermethod=ipodpatcher bootloadername=ipodmini2g resolution=138x110x2 manualname=rockbox-ipodmini2g -brand=apple +brand=Apple [iaudiox5] -name="Cowon iAudio X5 / X5L" +name="iAudio X5 / X5L" platform=iaudiox5 released=no needsbootloader=yes @@ -291,10 +292,10 @@ bootloadermethod=iaudio bootloadername=x5_fw.bin resolution=160x128x16 manualname= -brand=iaudio +brand=Cowon [iaudiox5v] -name="Cowon iAudio X5V" +name="iAudio X5V" platform=iaudiox5 released=no needsbootloader=yes @@ -302,10 +303,10 @@ bootloadermethod=iaudio bootloadername=x5v_fw.bin resolution=160x128x2 manualname= -brand=iaudio +brand=Cowon [iaudiom5] -name="Cowon iAudio M5 / M5L" +name="iAudio M5 / M5L" platform=iaudiom5 released=no needsbootloader=yes @@ -313,20 +314,20 @@ bootloadermethod=iaudio bootloadername=m5_fw.bin resolution=160x128x16 manualname= -brand=iaudio +brand=Cowon [gigabeatf] -name="Toshiba Gigabeat F / X" +name="Gigabeat F / X" platform=gigabeatf needsbootloader=yes bootloadermethod=gigabeatf bootloadername=FWIMG01.DAT resolution=240x320x16 manualname= -brand=toshiba +brand=Toshiba [sansae200] -name="Sandisk Sansa E200" +name="Sansa E200" platform=sansae200 released=no needsbootloader=yes @@ -334,5 +335,5 @@ bootloadermethod=sansapatcher bootloadername=PP5022.mi4 resolution=176x220x16 manualname= -brand=sandisk +brand=Sandisk diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 14f3482..2e82b31 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -50,7 +50,6 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) } ui.setupUi(this); - initDeviceNames(); // portable installation: // check for a configuration file in the program folder. @@ -66,21 +65,16 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) QSettings::UserScope, "rockbox.org", "RockboxUtility"); qDebug() << "config: system"; } - - userSettings->beginGroup("defaults"); - platform = userSettings->value("platform").toString(); - userSettings->endGroup(); - ui.comboBoxDevice->setCurrentIndex(ui.comboBoxDevice->findData(platform)); - updateDevice(ui.comboBoxDevice->currentIndex()); // manual tab ui.buttonDownloadManual->setEnabled(false); updateManual(); + updateDevice(); connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about())); connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog())); - connect(ui.comboBoxDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDevice(int))); + connect(ui.buttonChangeDevice, SIGNAL(clicked()), this, SLOT(configDialog())); connect(ui.buttonRockbox, SIGNAL(clicked()), this, SLOT(install())); connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBl())); connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFonts())); @@ -92,7 +86,6 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) ui.buttonRemoveRockbox->setEnabled(false); ui.buttonRemoveBootloader->setEnabled(false); ui.buttonComplete->setEnabled(false); - ui.buttonDetect->setEnabled(false); initIpodpatcher(); downloadInfo(); @@ -130,7 +123,8 @@ void RbUtilQt::downloadDone(bool error) void RbUtilQt::downloadDone(int id, bool error) { QString errorString; - errorString = tr("Network error: %1. Please check your network and proxy settings.").arg(daily->errorString()); + errorString = tr("Network error: %1. Please check your network and proxy settings.") + .arg(daily->errorString()); if(error) QMessageBox::about(this, "Network Error", errorString); qDebug() << "downloadDone:" << id << error; } @@ -168,38 +162,25 @@ void RbUtilQt::configDialog() { Config *cw = new Config(this); cw->setUserSettings(userSettings); + cw->setDevices(devices); cw->show(); connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); + connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); } -void RbUtilQt::initDeviceNames() +void RbUtilQt::updateSettings() { - qDebug() << "RbUtilQt::initDeviceNames()"; - devices->beginGroup("platforms"); - QStringList a = devices->childKeys(); - devices->endGroup(); - - for(int it = 0; it < a.size(); it++) { - QString curdev; - devices->beginGroup("platforms"); - curdev = devices->value(a.at(it), "null").toString(); - devices->endGroup(); - QString curname; - devices->beginGroup(curdev); - curname = devices->value("name", "null").toString(); - devices->endGroup(); - ui.comboBoxDevice->addItem(curname, curdev); - } + qDebug() << "updateSettings()"; + updateDevice(); + updateManual(); } -void RbUtilQt::updateDevice(int index) +void RbUtilQt::updateDevice() { - platform = ui.comboBoxDevice->itemData(index).toString(); - userSettings->setValue("defaults/platform", platform); - userSettings->sync(); - + platform = userSettings->value("defaults/platform").toString(); + // buttons devices->beginGroup(platform); if(devices->value("needsbootloader", "") == "no") { ui.buttonBootloader->setEnabled(false); @@ -220,10 +201,15 @@ void RbUtilQt::updateDevice(int index) } } devices->endGroup(); - - qDebug() << "new device selected:" << platform; - // update manual from here to make sure new device is already selected - updateManual(); + // displayed device info + platform = userSettings->value("defaults/platform").toString(); + QString mountpoint = userSettings->value("defaults/mountpoint").toString(); + devices->beginGroup(platform); + QString brand = devices->value("brand").toString(); + QString name = devices->value("name").toString(); + devices->endGroup(); + ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") + .arg(brand, name, mountpoint)); } @@ -285,6 +271,7 @@ void RbUtilQt::install() installWindow->show(); } + void RbUtilQt::installBl() { InstallBl *installWindow = new InstallBl(this); @@ -301,6 +288,7 @@ void RbUtilQt::installBl() installWindow->show(); } + void RbUtilQt::installFonts() { InstallZipWindow* installWindow = new InstallZipWindow(this); @@ -320,6 +308,7 @@ void RbUtilQt::installFonts() } + void RbUtilQt::installDoom() { InstallZipWindow* installWindow = new InstallZipWindow(this); @@ -338,3 +327,4 @@ void RbUtilQt::installDoom() installWindow->show(); } + diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h index 86bde0c..dc22077 100644 --- a/rbutil/rbutilqt/rbutilqt.h +++ b/rbutil/rbutilqt/rbutilqt.h @@ -48,7 +48,8 @@ class RbUtilQt : public QMainWindow private slots: void about(void); void configDialog(void); - void updateDevice(int); + void updateDevice(void); + void updateSettings(void); void install(void); void installBl(void); void installFonts(void); diff --git a/rbutil/rbutilqt/rbutilqtfrm.ui b/rbutil/rbutilqt/rbutilqtfrm.ui index 3a5c6f7..0d4cf7f 100644 --- a/rbutil/rbutilqt/rbutilqtfrm.ui +++ b/rbutil/rbutilqt/rbutilqtfrm.ui @@ -5,8 +5,8 @@ <rect> <x>0</x> <y>0</y> - <width>577</width> - <height>511</height> + <width>600</width> + <height>550</height> </rect> </property> <property name="windowTitle" > @@ -17,24 +17,113 @@ </property> <widget class="QWidget" name="centralwidget" > <layout class="QGridLayout" > - <property name="leftMargin" > - <number>9</number> - </property> - <property name="topMargin" > - <number>9</number> - </property> - <property name="rightMargin" > - <number>9</number> - </property> - <property name="bottomMargin" > - <number>9</number> - </property> - <property name="horizontalSpacing" > - <number>6</number> - </property> - <property name="verticalSpacing" > - <number>6</number> - </property> + <item row="0" column="0" > + <layout class="QHBoxLayout" > + <property name="spacing" > + <number>6</number> + </property> + <property name="leftMargin" > + <number>0</number> + </property> + <property name="topMargin" > + <number>0</number> + </property> + <property name="rightMargin" > + <number>0</number> + </property> + <property name="bottomMargin" > + <number>0</number> + </property> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="logoLabel" > + <property name="text" > + <string comment="Welcome to Rockbox Utility, the installation and housekeeping tool for Rockbox." /> + </property> + <property name="pixmap" > + <pixmap resource="rbutilqt.qrc" >:/icons/icons/rblogo.xpm</pixmap> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="1" column="0" > + <widget class="QGroupBox" name="groupBox_3" > + <property name="title" > + <string>Device</string> + </property> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="labelDeviceTitle" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Selected device:</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLabel" name="labelDevice" > + <property name="text" > + <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">none</span> at <span style=" font-weight:600;">unknown</span></p></body></html></string> + </property> + </widget> + </item> + <item row="0" column="2" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="3" > + <widget class="QPushButton" name="buttonChangeDevice" > + <property name="text" > + <string>&Change</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> <item row="2" column="0" > <widget class="QTabWidget" name="tabWidget" > <property name="currentIndex" > @@ -575,116 +664,6 @@ p, li { white-space: pre-wrap; } </widget> </widget> </item> - <item row="0" column="0" > - <layout class="QHBoxLayout" > - <property name="spacing" > - <number>6</number> - </property> - <property name="leftMargin" > - <number>0</number> - </property> - <property name="topMargin" > - <number>0</number> - </property> - <property name="rightMargin" > - <number>0</number> - </property> - <property name="bottomMargin" > - <number>0</number> - </property> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="logoLabel" > - <property name="text" > - <string comment="Welcome to Rockbox Utility, the installation and housekeeping tool for Rockbox." /> - </property> - <property name="pixmap" > - <pixmap resource="rbutilqt.qrc" >:/icons/icons/rblogo.xpm</pixmap> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <property name="spacing" > - <number>6</number> - </property> - <property name="leftMargin" > - <number>0</number> - </property> - <property name="topMargin" > - <number>0</number> - </property> - <property name="rightMargin" > - <number>0</number> - </property> - <property name="bottomMargin" > - <number>0</number> - </property> - <item> - <widget class="QLabel" name="labelDevice" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>&Device</string> - </property> - <property name="buddy" > - <cstring>comboBoxDevice</cstring> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="comboBoxDevice" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="accessibleDescription" > - <string>Device selection combo box</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="buttonDetect" > - <property name="text" > - <string>&Autodetect</string> - </property> - </widget> - </item> - </layout> - </item> </layout> </widget> <widget class="QMenuBar" name="menubar" > @@ -692,7 +671,7 @@ p, li { white-space: pre-wrap; } <rect> <x>0</x> <y>0</y> - <width>577</width> + <width>600</width> <height>29</height> </rect> </property> @@ -752,8 +731,6 @@ p, li { white-space: pre-wrap; } </action> </widget> <tabstops> - <tabstop>comboBoxDevice</tabstop> - <tabstop>buttonDetect</tabstop> <tabstop>tabWidget</tabstop> <tabstop>buttonComplete</tabstop> <tabstop>buttonSmall</tabstop> |