From 89e5333bc18e0e2fcb0ed541a8bfa9479cbe830a Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 8 Aug 2009 00:02:33 +0000 Subject: Move download link pattern description to rbutil.ini. Don't hard code the creation of the download links anymore but use pattern replacement and define the basic structure in rbutil.ini. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22200 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/rbutilqt/install.cpp | 21 ++++++++------------- rbutil/rbutilqt/install.h | 1 - rbutil/rbutilqt/rbutil.ini | 6 +++--- rbutil/rbutilqt/rbutilqt.cpp | 8 +++----- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp index 099575fec4..e410222636 100644 --- a/rbutil/rbutilqt/install.cpp +++ b/rbutil/rbutilqt/install.cpp @@ -103,27 +103,17 @@ void Install::accept() QString myversion; QString buildname = RbSettings::value(RbSettings::CurBuildserverModel).toString(); if(ui.radioStable->isChecked()) { - file = QString("%1/%2/rockbox-%3-%4.zip") - .arg(RbSettings::value(RbSettings::ReleaseUrl).toString(), version.value("rel_rev"), - buildname, version.value("rel_rev")); - fileName = QString("rockbox-%1-%2.zip") - .arg(version.value("rel_rev"), buildname); + file = RbSettings::value(RbSettings::ReleaseUrl).toString(); RbSettings::setValue(RbSettings::Build, "stable"); myversion = version.value("rel_rev"); } else if(ui.radioArchived->isChecked()) { - file = QString("%1%2/rockbox-%3-%4.zip") - .arg(RbSettings::value(RbSettings::DailyUrl).toString(), - buildname, buildname, version.value("arch_date")); - fileName = QString("rockbox-%1-%2.zip") - .arg(buildname, version.value("arch_date")); + file = RbSettings::value(RbSettings::DailyUrl).toString(); RbSettings::setValue(RbSettings::Build, "archived"); myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date"); } else if(ui.radioCurrent->isChecked()) { - file = QString("%1%2/rockbox.zip") - .arg(RbSettings::value(RbSettings::BleedingUrl).toString(), buildname); - fileName = QString("rockbox.zip"); + file = RbSettings::value(RbSettings::BleedingUrl).toString(); RbSettings::setValue(RbSettings::Build, "current"); myversion = "r" + version.value("bleed_rev"); } @@ -131,6 +121,11 @@ void Install::accept() qDebug() << "[Install] no build selected -- this shouldn't happen"; return; } + file.replace("%MODEL%", buildname); + file.replace("%RELVERSION%", version.value("rel_rev")); + file.replace("%REVISION%", version.value("arch_rev")); + file.replace("%DATE%", version.value("arch_date")); + RbSettings::sync(); QString warning = Detect::check(false); diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/install.h index 2a8ec891de..4ac6f281af 100644 --- a/rbutil/rbutilqt/install.h +++ b/rbutil/rbutilqt/install.h @@ -44,7 +44,6 @@ class Install : public QDialog QHttp *download; QFile *target; QString file; - QString fileName; ZipInstaller* installer; QMap version; QString m_backupName; diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini index 942ea222d6..0922a4fdd4 100644 --- a/rbutil/rbutilqt/rbutil.ini +++ b/rbutil/rbutilqt/rbutil.ini @@ -1,7 +1,7 @@ [general] -release_url=http://download.rockbox.org/release/ -daily_url=http://download.rockbox.org/daily/ -bleeding_url=http://build.rockbox.org/dist/build- +release_url=http://download.rockbox.org/release/%RELVERSION%/rockbox-%MODEL%-%RELVERSION%.zip +daily_url=http://download.rockbox.org/daily/%MODEL%/rockbox-%MODEL%.zip +bleeding_url=http://build.rockbox.org/data/rockbox-%MODEL%.zip server_conf_url=http://www.rockbox.org/daily/build-info bootloader_info_url=http://download.rockbox.org/bootloader/bootloaders-info bleeding_info=http://build.rockbox.org/cvsmod/build-info diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index c8513b1187..4c4003fcc2 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -518,11 +518,9 @@ void RbUtilQt::installBtn() bool RbUtilQt::installAuto() { - QString file = QString("%1/%2/rockbox-%3-%4.zip") - .arg(RbSettings::value(RbSettings::ReleaseUrl).toString(), - versmap.value("rel_rev"), - RbSettings::value(RbSettings::CurBuildserverModel).toString(), - versmap.value("rel_rev")); + QString file = RbSettings::value(RbSettings::ReleaseUrl).toString(); + file.replace("%MODEL%", RbSettings::value(RbSettings::CurBuildserverModel).toString()); + file.replace("%RELVERSION%", versmap.value("rel_rev")); buildInfo.open(); QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); buildInfo.close(); -- cgit v1.2.3