mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 21:25:19 -05:00
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
This commit is contained in:
parent
d0e95cf077
commit
6b0a1ec2a1
6 changed files with 83 additions and 1 deletions
|
|
@ -121,6 +121,23 @@ void Install::accept()
|
|||
}
|
||||
settings->sync();
|
||||
|
||||
int rbTarget = installedTargetId(settings->mountpoint());
|
||||
if(rbTarget != -1 && rbTarget != settings->curTargetId())
|
||||
{
|
||||
if(QMessageBox::question(this, tr("Device mismatch detected"),
|
||||
tr("Device mismatch detected.\n\n"
|
||||
"Installed Rockbox is for Device: %1.\n"
|
||||
"New Rockbox is for Device: %2.\n\n"
|
||||
"Do you want to continue?").arg(settings->nameOfTargetId(rbTarget),settings->curName()),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||
{
|
||||
logger->addItem(tr("Aborted!"),LOGERROR);
|
||||
logger->abort();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! check if we should backup
|
||||
if(ui.backup->isChecked())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -370,6 +370,30 @@ QString RbSettings::brand(QString plattform)
|
|||
return brand;
|
||||
}
|
||||
|
||||
QString RbSettings::nameOfTargetId(int id)
|
||||
{
|
||||
QString result ="";
|
||||
// get a list of ID -> target name
|
||||
QStringList platforms;
|
||||
devices->beginGroup("platforms");
|
||||
platforms = devices->childKeys();
|
||||
devices->endGroup();
|
||||
for(int i = 0; i < platforms.size(); i++)
|
||||
{
|
||||
devices->beginGroup("platforms");
|
||||
QString target = devices->value(platforms.at(i)).toString();
|
||||
devices->endGroup();
|
||||
devices->beginGroup(target);
|
||||
if(devices->value("targetid").toInt() == id)
|
||||
{
|
||||
result = devices->value("name").toString();
|
||||
}
|
||||
devices->endGroup();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QMap<int, QString> RbSettings::usbIdMap()
|
||||
{
|
||||
QMap<int, QString> map;
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ class RbSettings : public QObject
|
|||
QString name(QString plattform);
|
||||
QString brand(QString plattform);
|
||||
QStringList allLanguages();
|
||||
QString nameOfTargetId(int id);
|
||||
QMap<int, QString> usbIdMap();
|
||||
QMap<int, QString> usbIdErrorMap();
|
||||
QMap<int, QString> usbIdIncompatMap();
|
||||
|
|
|
|||
|
|
@ -474,8 +474,25 @@ bool RbUtilQt::installAuto()
|
|||
|
||||
QString myversion = "r" + versmap.value("bleed_rev");
|
||||
|
||||
//! check if rockbox is already installed
|
||||
// check installed Version and Target
|
||||
QString rbVersion = installedVersion(settings->mountpoint());
|
||||
int rbTarget = installedTargetId(settings->mountpoint());
|
||||
if(rbTarget != -1 && rbTarget != settings->curTargetId())
|
||||
{
|
||||
if(QMessageBox::question(this, tr("Target mismatch detected"),
|
||||
tr("Target mismatch detected. \n\n"
|
||||
"Installed target: %1.\n"
|
||||
"New Target: %2.\n\n"
|
||||
"Do you want to continue?").arg(settings->nameOfTargetId(rbTarget),settings->curName()),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
|
||||
{
|
||||
logger->addItem(tr("Aborted!"),LOGERROR);
|
||||
logger->abort();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// check version
|
||||
if(rbVersion != "")
|
||||
{
|
||||
if(QMessageBox::question(this, tr("Installed Rockbox detected"),
|
||||
|
|
|
|||
|
|
@ -180,6 +180,28 @@ QString installedVersion(QString mountpoint)
|
|||
return "";
|
||||
}
|
||||
|
||||
int installedTargetId(QString mountpoint)
|
||||
{
|
||||
// read rockbox-info.txt
|
||||
QFile info(mountpoint +"/.rockbox/rockbox-info.txt");
|
||||
if(!info.open(QIODevice::ReadOnly))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
QString target, features,version;
|
||||
while (!info.atEnd()) {
|
||||
QString line = info.readLine();
|
||||
|
||||
if(line.contains("Target id:"))
|
||||
{
|
||||
return line.remove("Target id:").trimmed().toInt();
|
||||
}
|
||||
}
|
||||
info.close();
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
QString getUserName(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ QString resolvePathCase(QString path);
|
|||
|
||||
QUrl systemProxy(void);
|
||||
QString installedVersion(QString mountpoint);
|
||||
int installedTargetId(QString mountpoint);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue