enable downloading of the manual. It will get saved to the players root folder for now.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14429 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2007-08-22 10:55:05 +00:00
parent b7466fd8cf
commit 9295e0a489
2 changed files with 54 additions and 1 deletions

View file

@ -68,9 +68,9 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
} }
// manual tab // manual tab
ui.buttonDownloadManual->setEnabled(false);
updateManual(); updateManual();
updateDevice(); updateDevice();
ui.radioPdf->setChecked(true);
connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about())); connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about()));
@ -85,6 +85,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
connect(ui.buttonThemes, SIGNAL(clicked()), this, SLOT(installThemes())); connect(ui.buttonThemes, SIGNAL(clicked()), this, SLOT(installThemes()));
connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall())); connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall()));
connect(ui.buttonRemoveBootloader, SIGNAL(clicked()), this, SLOT(uninstallBootloader())); connect(ui.buttonRemoveBootloader, SIGNAL(clicked()), this, SLOT(uninstallBootloader()));
connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual()));
// disable unimplemented stuff // disable unimplemented stuff
ui.buttonSmall->setEnabled(false); ui.buttonSmall->setEnabled(false);
ui.buttonComplete->setEnabled(false); ui.buttonComplete->setEnabled(false);
@ -491,3 +492,54 @@ void RbUtilQt::uninstallBootloader(void)
blinstaller.uninstall(logger); blinstaller.uninstall(logger);
} }
void RbUtilQt::downloadManual(void)
{
if(QMessageBox::question(this, tr("Confirm download"),
tr("Do you really want to download the manual? The manual will be saved "
"to the root folder of your player."),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return;
buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
buildInfo.close();
devices->beginGroup(userSettings->value("defaults/platform").toString());
QString manual;
manual = devices->value("manualname", "rockbox-" + devices->value("platform").toString()).toString();
devices->endGroup();
QString date = (info.value("dailies/date").toString());
QString manualurl;
QString target;
QString section;
if(ui.radioPdf->isChecked()) {
target = "/" + manual + ".pdf";
section = "Manual (PDF)";
}
else {
target = "/" + manual + "-" + date + "-html.zip";
section = "Manual (HTML)";
}
manualurl = devices->value("manual_url").toString() + "/" + target;
qDebug() << "manualurl =" << manualurl;
ProgressLoggerGui* logger = new ProgressLoggerGui(this);
logger->show();
installer = new ZipInstaller(this);
installer->setMountPoint(userSettings->value("defaults/mountpoint").toString());
if(userSettings->value("defaults/proxytype") == "manual")
installer->setProxy(QUrl(userSettings->value("defaults/proxy").toString()));
#ifdef __linux
else if(userSettings->value("defaults/proxytype") == "system")
installer->setProxy(QUrl(getenv("http_proxy")));
#endif
installer->setLogSection(section);
installer->setUrl(manualurl);
installer->setUnzip(false);
installer->setTarget(target);
installer->install(logger);
}

View file

@ -69,6 +69,7 @@ class RbUtilQt : public QMainWindow
void installThemes(void); void installThemes(void);
void uninstall(void); void uninstall(void);
void uninstallBootloader(void); void uninstallBootloader(void);
void downloadManual(void);
}; };
#endif #endif