diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-08-26 16:03:56 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2007-08-26 16:03:56 +0000 |
commit | 848abc803760298b2f97d1ffb135418f16a8166a (patch) | |
tree | c977f4ff3ce5bc6773d2af4b9c19b67bd505c28b /rbutil | |
parent | 663029ddfb18c2b8d0a202729459082e9191ec84 (diff) | |
download | rockbox-848abc803760298b2f97d1ffb135418f16a8166a.tar.gz rockbox-848abc803760298b2f97d1ffb135418f16a8166a.zip |
Add info window which shows details about the currently installed files based on the installation log file. Rework the log file and save revision number / timestamps instead of an arbitrary number.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14461 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/rbutilqt/install.cpp | 76 | ||||
-rw-r--r-- | rbutil/rbutilqt/install.h | 6 | ||||
-rw-r--r-- | rbutil/rbutilqt/installthemes.cpp | 14 | ||||
-rw-r--r-- | rbutil/rbutilqt/installzip.cpp | 5 | ||||
-rw-r--r-- | rbutil/rbutilqt/installzip.h | 6 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 142 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.h | 6 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqtfrm.ui | 34 |
8 files changed, 228 insertions, 61 deletions
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp index a537cb2cbe..93e9413d71 100644 --- a/rbutil/rbutilqt/install.cpp +++ b/rbutil/rbutilqt/install.cpp @@ -37,29 +37,6 @@ void Install::setCached(bool cache) } -void Install::setReleased(QString rel) -{ - releasever = rel; - if(!rel.isEmpty()) { - ui.radioStable->setChecked(true); - ui.radioStable->setEnabled(true); - QFont font; - font.setBold(true); - ui.radioStable->setFont(font); - } - else { - ui.radioCurrent->setChecked(true); - ui.radioStable->setEnabled(false); - ui.radioStable->setChecked(false); - QFont font; - font.setBold(true); - ui.radioCurrent->setFont(font); - } - qDebug() << "Install::setReleased" << releasever; - -} - - void Install::setProxy(QUrl proxy_url) { proxy = proxy_url; @@ -80,6 +57,7 @@ void Install::accept() return; } + QString myversion; if(ui.radioStable->isChecked()) { file = QString("%1/rockbox-%2-%3.zip") .arg(devices->value("download_url").toString(), @@ -89,17 +67,19 @@ void Install::accept() .arg(devices->value("last_release").toString(), userSettings->value("defaults/platform").toString()); userSettings->setValue("defaults/build", "stable"); + myversion = version.value("rel_rev"); } else if(ui.radioArchived->isChecked()) { file = QString("%1%2/rockbox-%3-%4.zip") .arg(devices->value("daily_url").toString(), userSettings->value("defaults/platform").toString(), userSettings->value("defaults/platform").toString(), - archived); + version.value("arch_date")); fileName = QString("rockbox-%1-%2.zip") .arg(userSettings->value("defaults/platform").toString(), - archived); + version.value("arch_date")); userSettings->setValue("defaults/build", "archived"); + myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date"); } else if(ui.radioCurrent->isChecked()) { file = QString("%1%2/rockbox.zip") @@ -107,6 +87,7 @@ void Install::accept() userSettings->value("defaults/platform").toString()); fileName = QString("rockbox.zip"); userSettings->setValue("defaults/build", "current"); + myversion = "r" + version.value("bleed_rev"); } else { qDebug() << "no build selected -- this shouldn't happen"; @@ -118,6 +99,7 @@ void Install::accept() installer->setUrl(file); installer->setProxy(proxy); installer->setLogSection("rockboxbase"); + installer->setLogVersion(myversion); installer->setMountPoint(mountPoint); installer->install(logger); @@ -147,8 +129,9 @@ void Install::setDetailsCurrent(bool show) if(show) { ui.labelDetails->setText(tr("This is the absolute up to the minute " "Rockbox built. A current build will get updated every time " - "a change is made.")); - if(releasever == "") + "a change is made. Latest version is r%1 (%2).") + .arg(version.value("bleed_rev"), version.value("bleed_date"))); + if(version.value("rel_rev").isEmpty()) ui.labelNote->setText(tr("<b>Note:</b> This option will always " "download a fresh copy. " "<b>This is the recommended version.</b>")); @@ -165,9 +148,11 @@ void Install::setDetailsStable(bool show) ui.labelDetails->setText( tr("This is the last released version of Rockbox.")); - if(releasever != "") ui.labelNote->setText(tr("<b>Note:</b>" + if(!version.value("rel_rev").isEmpty()) + ui.labelNote->setText(tr("<b>Note:</b>" "The lastest released version is %1. " - "<b>This is the recommended version.</b>").arg(releasever)); + "<b>This is the recommended version.</b>") + .arg(version.value("rel_rev"))); else ui.labelNote->setText(""); } } @@ -180,8 +165,8 @@ void Install::setDetailsArchived(bool show) "from the current development source code. This generally has more " "features than the last release but may be much less stable. " "Features may change regularly.")); - ui.labelNote->setText(tr("<b>Note:</b> archived version is %1.") - .arg(archived)); + ui.labelNote->setText(tr("<b>Note:</b> archived version is r%1 (%2).") + .arg(version.value("arch_rev"), version.value("arch_date"))); } } @@ -193,14 +178,35 @@ void Install::setDeviceSettings(QSettings *dev) } -void Install::setArchivedString(QString string) +void Install::setVersionStrings(QMap<QString, QString> ver) { - archived = string; - if(archived.isEmpty()) { + version = ver; + // version strings map is as following: + // rel_rev release version revision id + // rel_date release version release date + // same for arch_* and bleed_* + + if(version.value("arch_rev").isEmpty()) { ui.radioArchived->setEnabled(false); qDebug() << "no information about archived version available!"; } - qDebug() << "Install::setArchivedString" << archived; + + if(!version.value("rel_rev").isEmpty()) { + ui.radioStable->setChecked(true); + ui.radioStable->setEnabled(true); + QFont font; + font.setBold(true); + ui.radioStable->setFont(font); + } + else { + ui.radioCurrent->setChecked(true); + ui.radioStable->setEnabled(false); + ui.radioStable->setChecked(false); + QFont font; + font.setBold(true); + ui.radioCurrent->setFont(font); + } + qDebug() << "Install::setVersionStrings" << version; } void Install::setUserSettings(QSettings *user) diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/install.h index ec60601e70..17c4ba1086 100644 --- a/rbutil/rbutilqt/install.h +++ b/rbutil/rbutilqt/install.h @@ -34,10 +34,9 @@ class Install : public QDialog public: Install(QWidget *parent = 0); void setProxy(QUrl); - void setReleased(QString); void setUserSettings(QSettings*); void setDeviceSettings(QSettings*); - void setArchivedString(QString); + void setVersionStrings(QMap<QString, QString>); public slots: void accept(void); @@ -46,15 +45,14 @@ class Install : public QDialog Ui::InstallFrm ui; ProgressLoggerGui* logger; QUrl proxy; - QString releasever; QSettings *devices; QSettings *userSettings; QHttp *download; QFile *target; QString file; QString fileName; - QString archived; ZipInstaller* installer; + QMap<QString, QString> version; private slots: void setCached(bool); diff --git a/rbutil/rbutilqt/installthemes.cpp b/rbutil/rbutilqt/installthemes.cpp index d083231ba4..70a6ed6ec5 100644 --- a/rbutil/rbutilqt/installthemes.cpp +++ b/rbutil/rbutilqt/installthemes.cpp @@ -175,7 +175,8 @@ void ThemesInstallWindow::updateDetails(int row) QString text; text = tr("<b>Author:</b> %1<hr/>").arg(iniDetails.value("author", tr("unknown")).toString()); text += tr("<b>Version:</b> %1<hr/>").arg(iniDetails.value("version", tr("unknown")).toString()); - text += tr("<b>Description:</b> %1<br/>").arg(iniDetails.value("about", tr("no description")).toString()); + text += tr("<b>Description:</b> %1<hr/>").arg(iniDetails.value("about", tr("no description")).toString()); + ui.themeDescription->setHtml(text); iniDetails.endGroup(); @@ -259,13 +260,19 @@ void ThemesInstallWindow::accept() } QStringList themes; QStringList names; + QStringList version; QString zip; QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) { iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString()); - zip = devices->value("themes_url").toString() + "/" + iniDetails.value("archive").toString(); + zip = devices->value("themes_url").toString() + + "/" + iniDetails.value("archive").toString(); themes.append(zip); - names.append("Theme: " + ui.listThemes->selectedItems().at(i)->data(Qt::DisplayRole).toString()); + names.append("Theme: " + + ui.listThemes->selectedItems().at(i)->data(Qt::DisplayRole).toString()); + // if no version info is available use installation (current) date + version.append(iniDetails.value("version", + QDate().currentDate().toString("yyyyMMdd")).toString()); iniDetails.endGroup(); } qDebug() << "installing themes:" << themes; @@ -285,6 +292,7 @@ void ThemesInstallWindow::accept() installer->setUrl(themes); installer->setProxy(proxy); installer->setLogSection(names); + installer->setLogVersion(version); installer->setMountPoint(mountPoint); installer->install(logger); connect(logger, SIGNAL(closed()), this, SLOT(close())); diff --git a/rbutil/rbutilqt/installzip.cpp b/rbutil/rbutilqt/installzip.cpp index fe16333a06..c5e91d8e36 100644 --- a/rbutil/rbutilqt/installzip.cpp +++ b/rbutil/rbutilqt/installzip.cpp @@ -36,6 +36,7 @@ void ZipInstaller::install(ProgressloggerInterface *dp) connect(this, SIGNAL(cont()), this, SLOT(installContinue())); m_url = m_urllist.at(runner); m_logsection = m_loglist.at(runner); + m_logver = m_verlist.at(runner); installStart(); } @@ -52,6 +53,8 @@ void ZipInstaller::installContinue() m_dp->addItem(tr("done."), LOGOK); m_url = m_urllist.at(runner); m_logsection = m_loglist.at(runner); + if(runner < m_verlist.size()) m_logver = m_verlist.at(runner); + else m_logver = "0"; installStart(); } else { @@ -186,7 +189,7 @@ void ZipInstaller::downloadDone(bool error) installlog.beginGroup(m_logsection); for(int i = 0; i < zipContents.size(); i++) { - installlog.setValue(zipContents.at(i),installlog.value(zipContents.at(i),0).toInt()+1); + installlog.setValue(zipContents.at(i), m_logver); } installlog.endGroup(); diff --git a/rbutil/rbutilqt/installzip.h b/rbutil/rbutilqt/installzip.h index 7620865b31..376bc470e1 100644 --- a/rbutil/rbutilqt/installzip.h +++ b/rbutil/rbutilqt/installzip.h @@ -42,6 +42,8 @@ public: void setProxy(QUrl proxy) {m_proxy= proxy;} void setLogSection(QString name) {m_loglist = QStringList(name);} void setLogSection(QStringList name) { m_loglist = name; } + void setLogVersion(QString v) { m_verlist = QStringList(v); qDebug() << m_verlist;} + void setLogVersion(QStringList v) { m_verlist = v; qDebug() << m_verlist;} void setUnzip(bool i) { m_unzip = i; } void setTarget(QString t) { m_target = t; } @@ -58,8 +60,8 @@ private slots: private: void installSingle(ProgressloggerInterface *dp); - QString m_url, m_file, m_mountpoint, m_logsection; - QStringList m_urllist, m_loglist; + QString m_url, m_file, m_mountpoint, m_logsection, m_logver; + QStringList m_urllist, m_loglist, m_verlist; QUrl m_proxy; bool m_unzip; QString m_target; diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index a0dc521a69..3d700b7e81 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -72,6 +72,13 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) updateDevice(); ui.radioPdf->setChecked(true); + // info tab + ui.treeInfo->setAlternatingRowColors(true); + ui.treeInfo->setHeaderLabels(QStringList() << tr("File") << tr("Version")); + ui.treeInfo->expandAll(); + ui.treeInfo->setColumnCount(2); + + connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int))); connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about())); connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog())); @@ -86,6 +93,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall())); connect(ui.buttonRemoveBootloader, SIGNAL(clicked()), this, SLOT(uninstallBootloader())); connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual())); + // disable unimplemented stuff ui.buttonSmall->setEnabled(false); ui.buttonComplete->setEnabled(false); @@ -102,6 +110,16 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) } +void RbUtilQt::updateTabs(int count) +{ + switch(count) { + case 6: + updateInfo(); + break; + default: + break; + } +} void RbUtilQt::downloadInfo() @@ -115,14 +133,44 @@ void RbUtilQt::downloadInfo() qDebug() << "downloading build info"; daily->setFile(&buildInfo); daily->getFile(QUrl(devices->value("server_conf_url").toString())); + } void RbUtilQt::downloadDone(bool error) { - if(error) qDebug() << "network error:" << daily->error(); + if(error) { + qDebug() << "network error:" << daily->error(); + return; + } qDebug() << "network status:" << daily->error(); + + buildInfo.open(); + QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); + buildInfo.close(); + versmap.insert("arch_rev", info.value("dailies/rev").toString()); + versmap.insert("arch_date", info.value("dailies/date").toString()); + + bleeding = new HttpGet(this); + connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool))); + connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); + bleeding->setProxy(proxy()); + bleeding->setFile(&bleedingInfo); + bleeding->getFile(QUrl(devices->value("bleeding_info").toString())); +} + + +void RbUtilQt::downloadBleedingDone(bool error) +{ + if(error) qDebug() << "network error:" << bleeding->error(); + + bleedingInfo.open(); + QSettings info(bleedingInfo.fileName(), QSettings::IniFormat, this); + bleedingInfo.close(); + versmap.insert("bleed_rev", info.value("bleeding/rev").toString()); + versmap.insert("bleed_date", info.value("bleeding/timestamp").toString()); + qDebug() << "versmap =" << versmap; } @@ -131,7 +179,9 @@ void RbUtilQt::downloadDone(int id, bool error) QString errorString; errorString = tr("Network error: %1. Please check your network and proxy settings.") .arg(daily->errorString()); - if(error) QMessageBox::about(this, "Network Error", errorString); + if(error) { + QMessageBox::about(this, "Network Error", errorString); + } qDebug() << "downloadDone:" << id << error; } @@ -260,15 +310,17 @@ void RbUtilQt::install() buildInfo.open(); QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); buildInfo.close(); - installWindow->setArchivedString(info.value("dailies/date").toString()); devices->beginGroup(platform); QString released = devices->value("released").toString(); devices->endGroup(); - if(released == "yes") - installWindow->setReleased(devices->value("last_release", "").toString()); - else - installWindow->setReleased(0); + if(released == "yes") { + // only set the keys if needed -- querying will yield an empty string + // if not set. + versmap.insert("rel_rev", devices->value("last_release").toString()); + versmap.insert("rel_date", ""); // FIXME: provide the release timestamp + } + installWindow->setVersionStrings(versmap); installWindow->show(); } @@ -349,6 +401,7 @@ void RbUtilQt::installFonts() installer->setUrl(devices->value("font_url").toString()); installer->setProxy(proxy()); installer->setLogSection("Fonts"); + installer->setLogVersion(versmap.value("arch_date")); installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->install(logger); @@ -368,19 +421,16 @@ void RbUtilQt::installVoice() // create zip installer installer = new ZipInstaller(this); installer->setUnzip(false); -buildInfo.open(); - QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); - buildInfo.close(); - QString datestring = info.value("dailies/date").toString(); - + QString voiceurl = devices->value("voice_url").toString() + "/" + userSettings->value("defaults/platform").toString() + "-" + - datestring + "-english.voice"; + versmap.value("arch_date") + "-english.voice"; qDebug() << voiceurl; installer->setProxy(proxy()); installer->setUrl(voiceurl); installer->setLogSection("Voice"); + installer->setLogVersion(versmap.value("arch_date")); installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->setTarget("/.rockbox/langs/english.voice"); installer->install(logger); @@ -403,7 +453,8 @@ void RbUtilQt::installDoom() installer->setUrl(devices->value("doom_url").toString()); installer->setProxy(proxy()); - installer->setLogSection("GameAddons"); + installer->setLogSection("Game Addons"); + installer->setLogVersion(versmap.value("arch_date")); installer->setMountPoint(userSettings->value("defaults/mountpoint").toString()); installer->install(logger); @@ -547,6 +598,69 @@ void RbUtilQt::installPortable(void) } +void RbUtilQt::updateInfo() +{ + qDebug() << "RbUtilQt::updateInfo()"; + + QSettings log(userSettings->value("defaults/mountpoint").toString() + "/.rockbox/rbutil.log", QSettings::IniFormat, this); + QStringList groups = log.childGroups(); + QList<QTreeWidgetItem *> items; + QTreeWidgetItem *w, *w2; + QString min, max; + int olditems = 0; + + // remove old list entries (if any) + int l = ui.treeInfo->topLevelItemCount(); + while(l--) { + QTreeWidgetItem *m; + m = ui.treeInfo->takeTopLevelItem(l); + // delete childs (single level deep, no recursion here) + int n = m->childCount(); + while(n--) + delete m->child(n); + } + // get and populate new items + for(int a = 0; a < groups.size(); a++) { + log.beginGroup(groups.at(a)); + QStringList keys = log.allKeys(); + w = new QTreeWidgetItem; + w->setFlags(Qt::ItemIsEnabled); + w->setText(0, groups.at(a)); + items.append(w); + // get minimum and maximum version information so we can hilight old files + min = max = log.value(keys.at(0)).toString(); + for(int b = 0; b < keys.size(); b++) { + if(log.value(keys.at(b)).toString() > max) + max = log.value(keys.at(b)).toString(); + if(log.value(keys.at(b)).toString() < min) + min = log.value(keys.at(b)).toString(); + } + + for(int b = 0; b < keys.size(); b++) { + QString file; + file = userSettings->value("defaults/mountpoint").toString() + "/" + keys.at(b); + if(QFileInfo(file).isDir()) + continue; + w2 = new QTreeWidgetItem(w, QStringList() << "/" + + keys.at(b) << log.value(keys.at(b)).toString()); + if(log.value(keys.at(b)).toString() != max) { + w2->setForeground(0, QBrush(QColor(255, 0, 0))); + w2->setForeground(1, QBrush(QColor(255, 0, 0))); + olditems++; + } + items.append(w2); + } + log.endGroup(); + if(min != max) + w->setData(1, Qt::DisplayRole, QString("%1 / %2").arg(min, max)); + else + w->setData(1, Qt::DisplayRole, max); + } + ui.treeInfo->insertTopLevelItems(0, items); + ui.treeInfo->resizeColumnToContents(0); +} + + QUrl RbUtilQt::proxy() { if(userSettings->value("defaults/proxytype") == "manual") diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h index 1a6dda8259..a2e25112f3 100644 --- a/rbutil/rbutilqt/rbutilqt.h +++ b/rbutil/rbutilqt/rbutilqt.h @@ -45,13 +45,16 @@ class RbUtilQt : public QMainWindow QString deviceName(QString); QString platform; HttpGet *daily; + HttpGet *bleeding; QString absolutePath; QTemporaryFile buildInfo; + QTemporaryFile bleedingInfo; void updateManual(void); ProgressLoggerGui *logger; ZipInstaller *installer; BootloaderInstaller* blinstaller; QUrl proxy(void); + QMap<QString, QString> versmap; private slots: void about(void); @@ -65,6 +68,7 @@ class RbUtilQt : public QMainWindow void createTalkFiles(void); void downloadDone(bool); void downloadDone(int, bool); + void downloadBleedingDone(bool); void downloadInfo(void); void installVoice(void); void installThemes(void); @@ -72,6 +76,8 @@ class RbUtilQt : public QMainWindow void uninstallBootloader(void); void downloadManual(void); void installPortable(void); + void updateInfo(void); + void updateTabs(int); }; #endif diff --git a/rbutil/rbutilqt/rbutilqtfrm.ui b/rbutil/rbutilqt/rbutilqtfrm.ui index 826ac15133..2a79cee26c 100644 --- a/rbutil/rbutilqt/rbutilqtfrm.ui +++ b/rbutil/rbutilqt/rbutilqtfrm.ui @@ -5,7 +5,7 @@ <rect> <x>0</x> <y>0</y> - <width>600</width> + <width>662</width> <height>550</height> </rect> </property> @@ -761,6 +761,36 @@ p, li { white-space: pre-wrap; } </item> </layout> </widget> + <widget class="QWidget" name="info" > + <attribute name="title" > + <string>Inf&o</string> + </attribute> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="labelInfo" > + <property name="text" > + <string><html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Currently installed packages.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Note</span>: if you manually installed packages this might not be correct!</p></body></html></string> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QTreeWidget" name="treeInfo" > + <column> + <property name="text" > + <string>1</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> </widget> </item> </layout> @@ -770,7 +800,7 @@ p, li { white-space: pre-wrap; } <rect> <x>0</x> <y>0</y> - <width>600</width> + <width>662</width> <height>29</height> </rect> </property> |