summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/rbutilqt.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-02 21:29:31 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-02 21:29:31 +0000
commit7a62bb04d8abeedc237baaec51503d1180e2d93d (patch)
tree61d4b38ec2abcd884da434656a83a41527d00b3b /rbutil/rbutilqt/rbutilqt.cpp
parentc21abddaae1102087afdad5dcc0531ce6c6add1f (diff)
downloadrockbox-7a62bb04d8abeedc237baaec51503d1180e2d93d.tar.gz
rockbox-7a62bb04d8abeedc237baaec51503d1180e2d93d.zip
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
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp62
1 files changed, 26 insertions, 36 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 14f34824f7..2e82b31335 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -50,7 +50,6 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
50 } 50 }
51 51
52 ui.setupUi(this); 52 ui.setupUi(this);
53 initDeviceNames();
54 53
55 // portable installation: 54 // portable installation:
56 // check for a configuration file in the program folder. 55 // check for a configuration file in the program folder.
@@ -66,21 +65,16 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
66 QSettings::UserScope, "rockbox.org", "RockboxUtility"); 65 QSettings::UserScope, "rockbox.org", "RockboxUtility");
67 qDebug() << "config: system"; 66 qDebug() << "config: system";
68 } 67 }
69
70 userSettings->beginGroup("defaults");
71 platform = userSettings->value("platform").toString();
72 userSettings->endGroup();
73 ui.comboBoxDevice->setCurrentIndex(ui.comboBoxDevice->findData(platform));
74 updateDevice(ui.comboBoxDevice->currentIndex());
75 68
76 // manual tab 69 // manual tab
77 ui.buttonDownloadManual->setEnabled(false); 70 ui.buttonDownloadManual->setEnabled(false);
78 updateManual(); 71 updateManual();
72 updateDevice();
79 73
80 connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); 74 connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
81 connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about())); 75 connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about()));
82 connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog())); 76 connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog()));
83 connect(ui.comboBoxDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDevice(int))); 77 connect(ui.buttonChangeDevice, SIGNAL(clicked()), this, SLOT(configDialog()));
84 connect(ui.buttonRockbox, SIGNAL(clicked()), this, SLOT(install())); 78 connect(ui.buttonRockbox, SIGNAL(clicked()), this, SLOT(install()));
85 connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBl())); 79 connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBl()));
86 connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFonts())); 80 connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFonts()));
@@ -92,7 +86,6 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
92 ui.buttonRemoveRockbox->setEnabled(false); 86 ui.buttonRemoveRockbox->setEnabled(false);
93 ui.buttonRemoveBootloader->setEnabled(false); 87 ui.buttonRemoveBootloader->setEnabled(false);
94 ui.buttonComplete->setEnabled(false); 88 ui.buttonComplete->setEnabled(false);
95 ui.buttonDetect->setEnabled(false);
96 89
97 initIpodpatcher(); 90 initIpodpatcher();
98 downloadInfo(); 91 downloadInfo();
@@ -130,7 +123,8 @@ void RbUtilQt::downloadDone(bool error)
130void RbUtilQt::downloadDone(int id, bool error) 123void RbUtilQt::downloadDone(int id, bool error)
131{ 124{
132 QString errorString; 125 QString errorString;
133 errorString = tr("Network error: %1. Please check your network and proxy settings.").arg(daily->errorString()); 126 errorString = tr("Network error: %1. Please check your network and proxy settings.")
127 .arg(daily->errorString());
134 if(error) QMessageBox::about(this, "Network Error", errorString); 128 if(error) QMessageBox::about(this, "Network Error", errorString);
135 qDebug() << "downloadDone:" << id << error; 129 qDebug() << "downloadDone:" << id << error;
136} 130}
@@ -168,38 +162,25 @@ void RbUtilQt::configDialog()
168{ 162{
169 Config *cw = new Config(this); 163 Config *cw = new Config(this);
170 cw->setUserSettings(userSettings); 164 cw->setUserSettings(userSettings);
165 cw->setDevices(devices);
171 cw->show(); 166 cw->show();
172 connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); 167 connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
168 connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
173} 169}
174 170
175 171
176void RbUtilQt::initDeviceNames() 172void RbUtilQt::updateSettings()
177{ 173{
178 qDebug() << "RbUtilQt::initDeviceNames()"; 174 qDebug() << "updateSettings()";
179 devices->beginGroup("platforms"); 175 updateDevice();
180 QStringList a = devices->childKeys(); 176 updateManual();
181 devices->endGroup();
182
183 for(int it = 0; it < a.size(); it++) {
184 QString curdev;
185 devices->beginGroup("platforms");
186 curdev = devices->value(a.at(it), "null").toString();
187 devices->endGroup();
188 QString curname;
189 devices->beginGroup(curdev);
190 curname = devices->value("name", "null").toString();
191 devices->endGroup();
192 ui.comboBoxDevice->addItem(curname, curdev);
193 }
194} 177}
195 178
196 179
197void RbUtilQt::updateDevice(int index) 180void RbUtilQt::updateDevice()
198{ 181{
199 platform = ui.comboBoxDevice->itemData(index).toString(); 182 platform = userSettings->value("defaults/platform").toString();
200 userSettings->setValue("defaults/platform", platform); 183 // buttons
201 userSettings->sync();
202
203 devices->beginGroup(platform); 184 devices->beginGroup(platform);
204 if(devices->value("needsbootloader", "") == "no") { 185 if(devices->value("needsbootloader", "") == "no") {
205 ui.buttonBootloader->setEnabled(false); 186 ui.buttonBootloader->setEnabled(false);
@@ -220,10 +201,15 @@ void RbUtilQt::updateDevice(int index)
220 } 201 }
221 } 202 }
222 devices->endGroup(); 203 devices->endGroup();
223 204 // displayed device info
224 qDebug() << "new device selected:" << platform; 205 platform = userSettings->value("defaults/platform").toString();
225 // update manual from here to make sure new device is already selected 206 QString mountpoint = userSettings->value("defaults/mountpoint").toString();
226 updateManual(); 207 devices->beginGroup(platform);
208 QString brand = devices->value("brand").toString();
209 QString name = devices->value("name").toString();
210 devices->endGroup();
211 ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>")
212 .arg(brand, name, mountpoint));
227} 213}
228 214
229 215
@@ -285,6 +271,7 @@ void RbUtilQt::install()
285 installWindow->show(); 271 installWindow->show();
286} 272}
287 273
274
288void RbUtilQt::installBl() 275void RbUtilQt::installBl()
289{ 276{
290 InstallBl *installWindow = new InstallBl(this); 277 InstallBl *installWindow = new InstallBl(this);
@@ -301,6 +288,7 @@ void RbUtilQt::installBl()
301 installWindow->show(); 288 installWindow->show();
302} 289}
303 290
291
304void RbUtilQt::installFonts() 292void RbUtilQt::installFonts()
305{ 293{
306 InstallZipWindow* installWindow = new InstallZipWindow(this); 294 InstallZipWindow* installWindow = new InstallZipWindow(this);
@@ -320,6 +308,7 @@ void RbUtilQt::installFonts()
320 308
321} 309}
322 310
311
323void RbUtilQt::installDoom() 312void RbUtilQt::installDoom()
324{ 313{
325 InstallZipWindow* installWindow = new InstallZipWindow(this); 314 InstallZipWindow* installWindow = new InstallZipWindow(this);
@@ -338,3 +327,4 @@ void RbUtilQt::installDoom()
338 installWindow->show(); 327 installWindow->show();
339 328
340} 329}
330