diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2008-06-23 20:31:44 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2008-06-23 20:31:44 +0000 |
commit | 6b0a1ec2a13e8a0e4f39c4957f4d64f0e0c2d8d6 (patch) | |
tree | 1cf81a90b1b5fd93c5099aa98280986123c2fcdb | |
parent | d0e95cf0770af9fd034e193bd953480e8a74c6c4 (diff) | |
download | rockbox-6b0a1ec2a13e8a0e4f39c4957f4d64f0e0c2d8d6.tar.gz rockbox-6b0a1ec2a13e8a0e4f39c4957f4d64f0e0c2d8d6.zip |
rbutil: warn when you install a build for a different target then already installed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17769 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | rbutil/rbutilqt/install.cpp | 17 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbsettings.cpp | 24 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbsettings.h | 1 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 19 | ||||
-rw-r--r-- | rbutil/rbutilqt/utils.cpp | 22 | ||||
-rw-r--r-- | rbutil/rbutilqt/utils.h | 1 |
6 files changed, 83 insertions, 1 deletions
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp index dbdd2d4820..8ee1dc1ff5 100644 --- a/rbutil/rbutilqt/install.cpp +++ b/rbutil/rbutilqt/install.cpp | |||
@@ -121,6 +121,23 @@ void Install::accept() | |||
121 | } | 121 | } |
122 | settings->sync(); | 122 | settings->sync(); |
123 | 123 | ||
124 | int rbTarget = installedTargetId(settings->mountpoint()); | ||
125 | if(rbTarget != -1 && rbTarget != settings->curTargetId()) | ||
126 | { | ||
127 | if(QMessageBox::question(this, tr("Device mismatch detected"), | ||
128 | tr("Device mismatch detected.\n\n" | ||
129 | "Installed Rockbox is for Device: %1.\n" | ||
130 | "New Rockbox is for Device: %2.\n\n" | ||
131 | "Do you want to continue?").arg(settings->nameOfTargetId(rbTarget),settings->curName()), | ||
132 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) | ||
133 | { | ||
134 | logger->addItem(tr("Aborted!"),LOGERROR); | ||
135 | logger->abort(); | ||
136 | return; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | |||
124 | //! check if we should backup | 141 | //! check if we should backup |
125 | if(ui.backup->isChecked()) | 142 | if(ui.backup->isChecked()) |
126 | { | 143 | { |
diff --git a/rbutil/rbutilqt/rbsettings.cpp b/rbutil/rbutilqt/rbsettings.cpp index 1bb0f73db7..889164a1c9 100644 --- a/rbutil/rbutilqt/rbsettings.cpp +++ b/rbutil/rbutilqt/rbsettings.cpp | |||
@@ -370,6 +370,30 @@ QString RbSettings::brand(QString plattform) | |||
370 | return brand; | 370 | return brand; |
371 | } | 371 | } |
372 | 372 | ||
373 | QString RbSettings::nameOfTargetId(int id) | ||
374 | { | ||
375 | QString result =""; | ||
376 | // get a list of ID -> target name | ||
377 | QStringList platforms; | ||
378 | devices->beginGroup("platforms"); | ||
379 | platforms = devices->childKeys(); | ||
380 | devices->endGroup(); | ||
381 | for(int i = 0; i < platforms.size(); i++) | ||
382 | { | ||
383 | devices->beginGroup("platforms"); | ||
384 | QString target = devices->value(platforms.at(i)).toString(); | ||
385 | devices->endGroup(); | ||
386 | devices->beginGroup(target); | ||
387 | if(devices->value("targetid").toInt() == id) | ||
388 | { | ||
389 | result = devices->value("name").toString(); | ||
390 | } | ||
391 | devices->endGroup(); | ||
392 | } | ||
393 | |||
394 | return result; | ||
395 | } | ||
396 | |||
373 | QMap<int, QString> RbSettings::usbIdMap() | 397 | QMap<int, QString> RbSettings::usbIdMap() |
374 | { | 398 | { |
375 | QMap<int, QString> map; | 399 | QMap<int, QString> map; |
diff --git a/rbutil/rbutilqt/rbsettings.h b/rbutil/rbutilqt/rbsettings.h index f833c5320f..ece247a3de 100644 --- a/rbutil/rbutilqt/rbsettings.h +++ b/rbutil/rbutilqt/rbsettings.h | |||
@@ -81,6 +81,7 @@ class RbSettings : public QObject | |||
81 | QString name(QString plattform); | 81 | QString name(QString plattform); |
82 | QString brand(QString plattform); | 82 | QString brand(QString plattform); |
83 | QStringList allLanguages(); | 83 | QStringList allLanguages(); |
84 | QString nameOfTargetId(int id); | ||
84 | QMap<int, QString> usbIdMap(); | 85 | QMap<int, QString> usbIdMap(); |
85 | QMap<int, QString> usbIdErrorMap(); | 86 | QMap<int, QString> usbIdErrorMap(); |
86 | QMap<int, QString> usbIdIncompatMap(); | 87 | QMap<int, QString> usbIdIncompatMap(); |
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index a669949aa9..b7231977b2 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -474,8 +474,25 @@ bool RbUtilQt::installAuto() | |||
474 | 474 | ||
475 | QString myversion = "r" + versmap.value("bleed_rev"); | 475 | QString myversion = "r" + versmap.value("bleed_rev"); |
476 | 476 | ||
477 | //! check if rockbox is already installed | 477 | // check installed Version and Target |
478 | QString rbVersion = installedVersion(settings->mountpoint()); | 478 | QString rbVersion = installedVersion(settings->mountpoint()); |
479 | int rbTarget = installedTargetId(settings->mountpoint()); | ||
480 | if(rbTarget != -1 && rbTarget != settings->curTargetId()) | ||
481 | { | ||
482 | if(QMessageBox::question(this, tr("Target mismatch detected"), | ||
483 | tr("Target mismatch detected. \n\n" | ||
484 | "Installed target: %1.\n" | ||
485 | "New Target: %2.\n\n" | ||
486 | "Do you want to continue?").arg(settings->nameOfTargetId(rbTarget),settings->curName()), | ||
487 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) | ||
488 | { | ||
489 | logger->addItem(tr("Aborted!"),LOGERROR); | ||
490 | logger->abort(); | ||
491 | return false; | ||
492 | } | ||
493 | } | ||
494 | |||
495 | // check version | ||
479 | if(rbVersion != "") | 496 | if(rbVersion != "") |
480 | { | 497 | { |
481 | if(QMessageBox::question(this, tr("Installed Rockbox detected"), | 498 | if(QMessageBox::question(this, tr("Installed Rockbox detected"), |
diff --git a/rbutil/rbutilqt/utils.cpp b/rbutil/rbutilqt/utils.cpp index 5aa5cd4a55..9359522f04 100644 --- a/rbutil/rbutilqt/utils.cpp +++ b/rbutil/rbutilqt/utils.cpp | |||
@@ -180,6 +180,28 @@ QString installedVersion(QString mountpoint) | |||
180 | return ""; | 180 | return ""; |
181 | } | 181 | } |
182 | 182 | ||
183 | int installedTargetId(QString mountpoint) | ||
184 | { | ||
185 | // read rockbox-info.txt | ||
186 | QFile info(mountpoint +"/.rockbox/rockbox-info.txt"); | ||
187 | if(!info.open(QIODevice::ReadOnly)) | ||
188 | { | ||
189 | return -1; | ||
190 | } | ||
191 | |||
192 | QString target, features,version; | ||
193 | while (!info.atEnd()) { | ||
194 | QString line = info.readLine(); | ||
195 | |||
196 | if(line.contains("Target id:")) | ||
197 | { | ||
198 | return line.remove("Target id:").trimmed().toInt(); | ||
199 | } | ||
200 | } | ||
201 | info.close(); | ||
202 | return -1; | ||
203 | |||
204 | } | ||
183 | 205 | ||
184 | QString getUserName(void) | 206 | QString getUserName(void) |
185 | { | 207 | { |
diff --git a/rbutil/rbutilqt/utils.h b/rbutil/rbutilqt/utils.h index a7be093520..b4d660520e 100644 --- a/rbutil/rbutilqt/utils.h +++ b/rbutil/rbutilqt/utils.h | |||
@@ -38,6 +38,7 @@ QString resolvePathCase(QString path); | |||
38 | 38 | ||
39 | QUrl systemProxy(void); | 39 | QUrl systemProxy(void); |
40 | QString installedVersion(QString mountpoint); | 40 | QString installedVersion(QString mountpoint); |
41 | int installedTargetId(QString mountpoint); | ||
41 | 42 | ||
42 | #endif | 43 | #endif |
43 | 44 | ||