From 74af18ebf5d155a53268ec4ef41be3c1bbd85bac Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 17 Jun 2012 16:54:55 +0200 Subject: Add support for installing release candidate builds. Release candidates are now a third option in the installation window. Quick start will still install the latest release. Change-Id: I64e05160817263c5c4cb40cbdb4942149983e0ff --- rbutil/rbutilqt/installwindow.cpp | 55 +++++++++++++++++++++++++++++-------- rbutil/rbutilqt/installwindow.h | 2 +- rbutil/rbutilqt/installwindowfrm.ui | 7 +++++ 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/rbutil/rbutilqt/installwindow.cpp b/rbutil/rbutilqt/installwindow.cpp index 1306043027..17d0495bc4 100644 --- a/rbutil/rbutilqt/installwindow.cpp +++ b/rbutil/rbutilqt/installwindow.cpp @@ -31,6 +31,7 @@ InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent) ui.setupUi(this); connect(ui.radioStable, SIGNAL(toggled(bool)), this, SLOT(setDetailsStable(bool))); + connect(ui.radioCandidate, SIGNAL(toggled(bool)), this, SLOT(setDetailsCandidate(bool))); connect(ui.radioCurrent, SIGNAL(toggled(bool)), this, SLOT(setDetailsCurrent(bool))); connect(ui.changeBackup, SIGNAL(pressed()), this, SLOT(changeBackupPath())); connect(ui.backup, SIGNAL(stateChanged(int)), this, SLOT(backupCheckboxChanged(int))); @@ -39,8 +40,7 @@ InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent) RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString()); QString version = rbinfo.version(); - if(version != "") - { + if(version != "") { ui.Backupgroup->show(); m_backupName = RbSettings::value(RbSettings::Mountpoint).toString(); if(!m_backupName.endsWith("/")) m_backupName += "/"; @@ -48,24 +48,29 @@ InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent) // for some reason the label doesn't return its final size yet. // Delay filling ui.backupLocation until the checkbox is changed. } - else - { + else { ui.Backupgroup->hide(); } backupCheckboxChanged(Qt::Unchecked); - if(ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) { ui.radioStable->setEnabled(false); } // try to use the old selection first. If no selection has been made // in the past, use a preselection based on released status. - if(RbSettings::value(RbSettings::Build).toString() == "stable" - && !ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) + QString lastinstalled = RbSettings::value(RbSettings::Build).toString(); + if(lastinstalled == "stable" + && !ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) { ui.radioStable->setChecked(true); - else if(RbSettings::value(RbSettings::Build).toString() == "current") + } + else if(lastinstalled == "rc" + && !ServerInfo::value(ServerInfo::RelCandidateVersion).toString().isEmpty()) { + ui.radioCandidate->setChecked(true); + } + else if(lastinstalled == "current") { ui.radioCurrent->setChecked(true); + } else if(!ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) { ui.radioStable->setChecked(true); ui.radioStable->setEnabled(true); @@ -75,6 +80,9 @@ InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent) ui.radioStable->setEnabled(false); ui.radioStable->setChecked(false); } + if(ServerInfo::value(ServerInfo::RelCandidateVersion).toString().isEmpty()) { + ui.radioCandidate->setEnabled(false); + } } @@ -115,6 +123,7 @@ void InstallWindow::backupCheckboxChanged(int state) void InstallWindow::accept() { + QString url; logger = new ProgressLoggerGui(this); logger->show(); QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString(); @@ -128,15 +137,20 @@ void InstallWindow::accept() QString myversion; if(ui.radioStable->isChecked()) { - file = ServerInfo::value(ServerInfo::CurReleaseUrl).toString(); + url = ServerInfo::value(ServerInfo::CurReleaseUrl).toString(); RbSettings::setValue(RbSettings::Build, "stable"); myversion = ServerInfo::value(ServerInfo::CurReleaseVersion).toString(); } else if(ui.radioCurrent->isChecked()) { - file = ServerInfo::value(ServerInfo::CurDevelUrl).toString(); + url = ServerInfo::value(ServerInfo::CurDevelUrl).toString(); RbSettings::setValue(RbSettings::Build, "current"); myversion = "r" + ServerInfo::value(ServerInfo::BleedingRevision).toString(); } + else if(ui.radioCandidate->isChecked()) { + url = ServerInfo::value(ServerInfo::RelCandidateUrl).toString(); + RbSettings::setValue(RbSettings::Build, "rc"); + myversion = ServerInfo::value(ServerInfo::RelCandidateVersion).toString(); + } else { qDebug() << "[Install] no build selected -- this shouldn't happen"; return; @@ -192,7 +206,7 @@ void InstallWindow::accept() //! install build installer = new ZipInstaller(this); - installer->setUrl(file); + installer->setUrl(url); installer->setLogSection("Rockbox (Base)"); if(!RbSettings::value(RbSettings::CacheDisabled).toBool() && !ui.checkBoxCache->isChecked()) @@ -272,6 +286,25 @@ void InstallWindow::setDetailsStable(bool show) } +void InstallWindow::setDetailsCandidate(bool show) +{ + if(show) { + ui.labelDetails->setText( + tr("This is the release candidate for the next Rockbox version." + "
A release candidate is intended for testing. It will " + "receive bugfixes and eventually become the next stable " + "release of Rockbox. If you want to help testing Rockbox and " + "improve the next release install the release candidate.")); + + if(!ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty()) + ui.labelNote->setText(tr("Note: " + "The lastest release candidate is %1.") + .arg(ServerInfo::value(ServerInfo::RelCandidateVersion).toString())); + else ui.labelNote->setText(""); + } +} + + void InstallWindow::changeEvent(QEvent *e) { if(e->type() == QEvent::LanguageChange) { diff --git a/rbutil/rbutilqt/installwindow.h b/rbutil/rbutilqt/installwindow.h index 67c06c1f9a..140782088d 100644 --- a/rbutil/rbutilqt/installwindow.h +++ b/rbutil/rbutilqt/installwindow.h @@ -41,7 +41,6 @@ class InstallWindow : public QDialog ProgressLoggerGui* logger; QHttp *download; QFile *target; - QString file; ZipInstaller* installer; QString m_backupName; void resizeEvent(QResizeEvent*); @@ -53,6 +52,7 @@ class InstallWindow : public QDialog private slots: void setDetailsCurrent(bool); void setDetailsStable(bool); + void setDetailsCandidate(bool); void done(bool); void changeBackupPath(void); void backupCheckboxChanged(int state); diff --git a/rbutil/rbutilqt/installwindowfrm.ui b/rbutil/rbutilqt/installwindowfrm.ui index 92fe65e7c2..a06908214f 100644 --- a/rbutil/rbutilqt/installwindowfrm.ui +++ b/rbutil/rbutilqt/installwindowfrm.ui @@ -53,6 +53,13 @@ + + + + Release &Candidate + + + -- cgit v1.2.3