1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id: installzipwindow.cpp 14027 2007-07-27 17:42:49Z domonoky $
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 ****************************************************************************/
20 #include "installzipwindow.h"
21 //#include "ui_installprogressfrm.h"
24 InstallZipWindow::InstallZipWindow(QWidget
*parent
) : QDialog(parent
)
27 connect(ui
.buttonBrowse
, SIGNAL(clicked()), this, SLOT(browseFolder()));
30 void InstallZipWindow::setProxy(QUrl proxy_url
)
33 qDebug() << "Install::setProxy" << proxy
;
36 void InstallZipWindow::setMountPoint(QString mount
)
40 ui
.lineMountPoint
->clear();
41 ui
.lineMountPoint
->insert(mount
);
45 void InstallZipWindow::setUrl(QString path
)
50 void InstallZipWindow::browseFolder()
52 QFileDialog
browser(this);
53 if(QFileInfo(ui
.lineMountPoint
->text()).isDir())
54 browser
.setDirectory(ui
.lineMountPoint
->text());
56 browser
.setDirectory("/media");
57 browser
.setReadOnly(true);
58 browser
.setFileMode(QFileDialog::DirectoryOnly
);
59 browser
.setAcceptMode(QFileDialog::AcceptOpen
);
61 qDebug() << browser
.directory();
62 QStringList files
= browser
.selectedFiles();
63 setMountPoint(files
.at(0));
67 void InstallZipWindow::accept()
70 logger
= new ProgressLoggerGui(this);
73 // show dialog with error if mount point is wrong
74 if(QFileInfo(ui
.lineMountPoint
->text()).isDir()) {
75 mountPoint
= ui
.lineMountPoint
->text();
76 userSettings
->setValue("defaults/mountpoint", mountPoint
);
79 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
86 // create Zip installer
87 installer
= new ZipInstaller(this);
89 QString fileName
= url
.section('/', -1);
90 installer
->setFilename(fileName
);
91 installer
->setUrl(url
);
92 installer
->setProxy(proxy
);
93 installer
->setLogSection(logsection
);
94 installer
->setMountPoint(mountPoint
);
95 installer
->install(logger
);
97 connect(installer
, SIGNAL(done(bool)), this, SLOT(done(bool)));
102 // we are done with Zip installing
103 void InstallZipWindow::done(bool error
)
105 qDebug() << "Install::done, error:" << error
;
107 if(error
) // if there was an error
113 // no error, close the window, when the logger is closed
114 connect(logger
,SIGNAL(closed()),this,SLOT(close()));
117 void InstallZipWindow::setDeviceSettings(QSettings
*dev
)
120 qDebug() << "Install::setDeviceSettings:" << devices
;
123 void InstallZipWindow::setUserSettings(QSettings
*user
)