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::setReleased(QString rel
)
44 ui
.radioStable
->setChecked(true);
45 ui
.radioStable
->setEnabled(true);
48 ui
.radioStable
->setFont(font
);
51 ui
.radioCurrent
->setChecked(true);
52 ui
.radioStable
->setEnabled(false);
53 ui
.radioStable
->setChecked(false);
56 ui
.radioCurrent
->setFont(font
);
58 qDebug() << "Install::setReleased" << releasever
;
63 void Install::setProxy(QUrl proxy_url
)
66 qDebug() << "Install::setProxy" << proxy
;
70 void Install::accept()
72 logger
= new ProgressLoggerGui(this);
74 QString mountPoint
= userSettings
->value("defaults/mountpoint").toString();
75 qDebug() << "mountpoint:" << userSettings
->value("defaults/mountpoint").toString();
76 // show dialog with error if mount point is wrong
77 if(!QFileInfo(mountPoint
).isDir()) {
78 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
83 if(ui
.radioStable
->isChecked()) {
84 file
= "stable"; // FIXME: this is wrong!
85 fileName
= QString("rockbox.zip");
86 userSettings
->setValue("defaults/build", "stable");
88 else if(ui
.radioArchived
->isChecked()) {
89 file
= QString("%1%2/rockbox-%3-%4.zip")
90 .arg(devices
->value("daily_url").toString(),
91 userSettings
->value("defaults/platform").toString(),
92 userSettings
->value("defaults/platform").toString(),
94 fileName
= QString("rockbox-%1-%2.zip")
95 .arg(userSettings
->value("defaults/platform").toString(),
97 userSettings
->setValue("defaults/build", "archived");
99 else if(ui
.radioCurrent
->isChecked()) {
100 file
= QString("%1%2/rockbox.zip")
101 .arg(devices
->value("bleeding_url").toString(),
102 userSettings
->value("defaults/platform").toString());
103 fileName
= QString("rockbox.zip");
104 userSettings
->setValue("defaults/build", "current");
107 qDebug() << "no build selected -- this shouldn't happen";
110 userSettings
->sync();
112 installer
= new ZipInstaller(this);
113 installer
->setUrl(file
);
114 installer
->setProxy(proxy
);
115 installer
->setLogSection("rockboxbase");
116 installer
->setMountPoint(mountPoint
);
117 installer
->install(logger
);
119 connect(installer
, SIGNAL(done(bool)), this, SLOT(done(bool)));
123 // Zip installer has finished
124 void Install::done(bool error
)
126 qDebug() << "Install::done, error:" << error
;
134 // no error, close the window, when the logger is closed
135 connect(logger
,SIGNAL(closed()),this,SLOT(close()));
140 void Install::setDetailsCurrent(bool show
)
143 ui
.labelDetails
->setText(tr("This is the absolute up to the minute "
144 "Rockbox built. A current build will get updated every time "
145 "a change is made."));
147 ui
.labelNote
->setText(tr("<b>Note:</b> This option will always "
148 "download a fresh copy. "
149 "<b>This is the recommended version.</b>"));
151 ui
.labelNote
->setText(tr("<b>Note:</b> This option will always "
152 "download a fresh copy."));
157 void Install::setDetailsStable(bool show
)
160 ui
.labelDetails
->setText(
161 tr("This is the last released version of Rockbox."));
163 if(releasever
!= "") ui
.labelNote
->setText(tr("<b>Note:</b>"
164 "The lastest released version is %1. "
165 "<b>This is the recommended version.</b>").arg(releasever
));
166 else ui
.labelNote
->setText("");
171 void Install::setDetailsArchived(bool show
)
174 ui
.labelDetails
->setText(tr("These are automatically built each day "
175 "from the current development source code. This generally has more "
176 "features than the last release but may be much less stable. "
177 "Features may change regularly."));
178 ui
.labelNote
->setText(tr("<b>Note:</b> archived version is %1.")
184 void Install::setDeviceSettings(QSettings
*dev
)
187 qDebug() << "Install::setDeviceSettings:" << devices
;
191 void Install::setArchivedString(QString string
)
194 if(archived
.isEmpty()) {
195 ui
.radioArchived
->setEnabled(false);
196 qDebug() << "no information about archived version available!";
198 qDebug() << "Install::setArchivedString" << archived
;
201 void Install::setUserSettings(QSettings
*user
)