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
);
96 installer
->install(logger
);
98 connect(installer
, SIGNAL(done(bool)), this, SLOT(done(bool)));
102 // Zip installer has finished
103 void Install::done(bool error
)
105 qDebug() << "Install::done, error:" << error
;
113 // no error, close the window, when the logger is closed
114 connect(logger
,SIGNAL(closed()),this,SLOT(close()));
115 // add platform info to log file for later detection
116 QSettings
installlog(settings
->mountpoint()
117 + "/.rockbox/rbutil.log", QSettings::IniFormat
, 0);
118 installlog
.setValue("platform", settings
->curPlatform());
123 void Install::setDetailsCurrent(bool show
)
126 ui
.labelDetails
->setText(tr("This is the absolute up to the minute "
127 "Rockbox built. A current build will get updated every time "
128 "a change is made. Latest version is r%1 (%2).")
129 .arg(version
.value("bleed_rev"), version
.value("bleed_date")));
130 if(version
.value("rel_rev").isEmpty())
131 ui
.labelNote
->setText(tr("<b>Note:</b> This option will always "
132 "download a fresh copy. "
133 "<b>This is the recommended version.</b>"));
135 ui
.labelNote
->setText(tr("<b>Note:</b> This option will always "
136 "download a fresh copy."));
141 void Install::setDetailsStable(bool show
)
144 ui
.labelDetails
->setText(
145 tr("This is the last released version of Rockbox."));
147 if(!version
.value("rel_rev").isEmpty())
148 ui
.labelNote
->setText(tr("<b>Note:</b>"
149 "The lastest released version is %1. "
150 "<b>This is the recommended version.</b>")
151 .arg(version
.value("rel_rev")));
152 else ui
.labelNote
->setText("");
157 void Install::setDetailsArchived(bool show
)
160 ui
.labelDetails
->setText(tr("These are automatically built each day "
161 "from the current development source code. This generally has more "
162 "features than the last stable release but may be much less stable. "
163 "Features may change regularly."));
164 ui
.labelNote
->setText(tr("<b>Note:</b> archived version is r%1 (%2).")
165 .arg(version
.value("arch_rev"), version
.value("arch_date")));
171 void Install::setVersionStrings(QMap
<QString
, QString
> ver
)
174 // version strings map is as following:
175 // rel_rev release version revision id
176 // rel_date release version release date
177 // same for arch_* and bleed_*
179 if(version
.value("arch_rev").isEmpty()) {
180 ui
.radioArchived
->setEnabled(false);
181 qDebug() << "no information about archived version available!";
184 if(!version
.value("rel_rev").isEmpty()) {
185 ui
.radioStable
->setChecked(true);
186 ui
.radioStable
->setEnabled(true);
189 ui
.radioStable
->setFont(font
);
192 ui
.radioCurrent
->setChecked(true);
193 ui
.radioStable
->setEnabled(false);
194 ui
.radioStable
->setChecked(false);
197 ui
.radioCurrent
->setFont(font
);
199 qDebug() << "Install::setVersionStrings" << version
;
202 void Install::setSettings(RbSettings
*sett
)