1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Riebeling
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
21 #include "ui_installfrm.h"
23 Install::Install(QWidget
*parent
) : QDialog(parent
)
27 connect(ui
.radioCurrent
, SIGNAL(toggled(bool)), this, SLOT(setCached(bool)));
28 connect(ui
.radioStable
, SIGNAL(toggled(bool)), this, SLOT(setDetailsStable(bool)));
29 connect(ui
.radioCurrent
, SIGNAL(toggled(bool)), this, SLOT(setDetailsCurrent(bool)));
30 connect(ui
.radioArchived
, SIGNAL(toggled(bool)), this, SLOT(setDetailsArchived(bool)));
34 void Install::setCached(bool cache
)
36 ui
.checkBoxCache
->setEnabled(!cache
);
40 void Install::accept()
42 logger
= new ProgressLoggerGui(this);
44 QString mountPoint
= settings
->mountpoint();
45 qDebug() << "mountpoint:" << settings
->mountpoint();
46 // show dialog with error if mount point is wrong
47 if(!QFileInfo(mountPoint
).isDir()) {
48 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
54 QString buildname
= settings
->curPlatformName();
55 if(ui
.radioStable
->isChecked()) {
56 file
= QString("%1/rockbox-%2-%3.zip")
57 .arg(settings
->downloadUrl(),
58 settings
->lastRelease(), buildname
);
59 fileName
= QString("rockbox-%1-%2.zip")
60 .arg(settings
->lastRelease(), buildname
);
61 settings
->setBuild("stable");
62 myversion
= version
.value("rel_rev");
64 else if(ui
.radioArchived
->isChecked()) {
65 file
= QString("%1%2/rockbox-%3-%4.zip")
66 .arg(settings
->dailyUrl(),
67 buildname
, buildname
, version
.value("arch_date"));
68 fileName
= QString("rockbox-%1-%2.zip")
69 .arg(buildname
, version
.value("arch_date"));
70 settings
->setBuild("archived");
71 myversion
= "r" + version
.value("arch_rev") + "-" + version
.value("arch_date");
73 else if(ui
.radioCurrent
->isChecked()) {
74 file
= QString("%1%2/rockbox.zip")
75 .arg(settings
->bleedingUrl(), buildname
);
76 fileName
= QString("rockbox.zip");
77 settings
->setBuild("current");
78 myversion
= "r" + version
.value("bleed_rev");
81 qDebug() << "no build selected -- this shouldn't happen";
86 installer
= new ZipInstaller(this);
87 installer
->setUrl(file
);
88 installer
->setLogSection("Rockbox (Base)");
89 if(!settings
->cacheDisabled()
90 && !ui
.radioCurrent
->isChecked()
91 && !ui
.checkBoxCache
->isChecked())
92 installer
->setCache(settings
->cachePath());
94 installer
->setLogVersion(myversion
);
95 installer
->setMountPoint(mountPoint
);
97 connect(installer
, SIGNAL(done(bool)), this, SLOT(done(bool)));
99 installer
->install(logger
);
103 // Zip installer has finished
104 void Install::done(bool error
)
106 qDebug() << "Install::done, error:" << error
;
114 // no error, close the window, when the logger is closed
115 connect(logger
,SIGNAL(closed()),this,SLOT(close()));
116 // add platform info to log file for later detection
117 QSettings
installlog(settings
->mountpoint()
118 + "/.rockbox/rbutil.log", QSettings::IniFormat
, 0);
119 installlog
.setValue("platform", settings
->curPlatform());
124 void Install::setDetailsCurrent(bool show
)
127 ui
.labelDetails
->setText(tr("This is the absolute up to the minute "
128 "Rockbox built. A current build will get updated every time "
129 "a change is made. Latest version is r%1 (%2).")
130 .arg(version
.value("bleed_rev"), version
.value("bleed_date")));
131 if(version
.value("rel_rev").isEmpty())
132 ui
.labelNote
->setText(tr("<b>Note:</b> This option will always "
133 "download a fresh copy. "
134 "<b>This is the recommended version.</b>"));
136 ui
.labelNote
->setText(tr("<b>Note:</b> This option will always "
137 "download a fresh copy."));
142 void Install::setDetailsStable(bool show
)
145 ui
.labelDetails
->setText(
146 tr("This is the last released version of Rockbox."));
148 if(!version
.value("rel_rev").isEmpty())
149 ui
.labelNote
->setText(tr("<b>Note:</b>"
150 "The lastest released version is %1. "
151 "<b>This is the recommended version.</b>")
152 .arg(version
.value("rel_rev")));
153 else ui
.labelNote
->setText("");
158 void Install::setDetailsArchived(bool show
)
161 ui
.labelDetails
->setText(tr("These are automatically built each day "
162 "from the current development source code. This generally has more "
163 "features than the last stable release but may be much less stable. "
164 "Features may change regularly."));
165 ui
.labelNote
->setText(tr("<b>Note:</b> archived version is r%1 (%2).")
166 .arg(version
.value("arch_rev"), version
.value("arch_date")));
172 void Install::setVersionStrings(QMap
<QString
, QString
> ver
)
175 // version strings map is as following:
176 // rel_rev release version revision id
177 // rel_date release version release date
178 // same for arch_* and bleed_*
180 if(version
.value("arch_rev").isEmpty()) {
181 ui
.radioArchived
->setEnabled(false);
182 qDebug() << "no information about archived version available!";
185 if(!version
.value("rel_rev").isEmpty()) {
186 ui
.radioStable
->setChecked(true);
187 ui
.radioStable
->setEnabled(true);
190 ui
.radioStable
->setFont(font
);
193 ui
.radioCurrent
->setChecked(true);
194 ui
.radioStable
->setEnabled(false);
195 ui
.radioStable
->setChecked(false);
198 ui
.radioCurrent
->setFont(font
);
200 qDebug() << "Install::setVersionStrings" << version
;
203 void Install::setSettings(RbSettings
*sett
)