2007-07-26 21:06:09 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
2007-07-27 17:42:49 +00:00
|
|
|
* Copyright (C) 2007 by Dominik Wenger
|
2007-07-26 21:06:09 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2007-07-26 21:06:09 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
2007-07-26 21:16:42 +00:00
|
|
|
****************************************************************************/
|
2007-09-15 22:57:07 +00:00
|
|
|
|
|
|
|
|
2013-03-09 18:37:40 +00:00
|
|
|
#ifndef ZIPINSTALLER_H
|
|
|
|
#define ZIPINSTALLER_H
|
2007-07-26 21:16:42 +00:00
|
|
|
|
2008-02-10 18:25:49 +00:00
|
|
|
#include <QtCore>
|
2007-07-26 21:16:42 +00:00
|
|
|
|
2021-12-26 10:05:25 +00:00
|
|
|
#include "progressloglevels.h"
|
2007-07-26 21:16:42 +00:00
|
|
|
#include "httpget.h"
|
2013-11-03 10:08:18 +00:00
|
|
|
#include "Logger.h"
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2020-09-26 15:51:33 +00:00
|
|
|
/** Install a file or zip.
|
|
|
|
* Downloads file(s) from a given URL, and installs by either extracting or
|
|
|
|
* copying it to the target path set by setMountpoint().
|
|
|
|
*/
|
2007-07-27 17:42:49 +00:00
|
|
|
class ZipInstaller : public QObject
|
2007-09-15 22:57:07 +00:00
|
|
|
{
|
2007-07-26 21:16:42 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-09-26 15:51:33 +00:00
|
|
|
ZipInstaller(QObject* parent);
|
2007-07-27 17:42:49 +00:00
|
|
|
~ZipInstaller(){}
|
2009-05-02 18:50:31 +00:00
|
|
|
void install(void);
|
2007-07-27 17:42:49 +00:00
|
|
|
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
2007-08-14 23:11:46 +00:00
|
|
|
void setUrl(QString url){m_urllist = QStringList(url);}
|
|
|
|
void setUrl(QStringList url) { m_urllist = url; }
|
|
|
|
void setLogSection(QString name) {m_loglist = QStringList(name);}
|
|
|
|
void setLogSection(QStringList name) { m_loglist = name; }
|
2012-05-23 19:05:28 +00:00
|
|
|
void setLogVersion(QString v = "")
|
2013-11-03 10:08:18 +00:00
|
|
|
{ m_verlist = QStringList(v); LOG_INFO() << m_verlist;}
|
2012-05-23 19:05:28 +00:00
|
|
|
void setLogVersion(QStringList v)
|
2013-11-03 10:08:18 +00:00
|
|
|
{ m_verlist = v; LOG_INFO() << m_verlist;}
|
2020-09-26 15:51:33 +00:00
|
|
|
/** Change between copy and unzip mode. */
|
2007-08-09 16:06:27 +00:00
|
|
|
void setUnzip(bool i) { m_unzip = i; }
|
2020-09-26 15:51:33 +00:00
|
|
|
/** Set target filename for copy mode.
|
|
|
|
* If not set the filename part of the download URL is used. */
|
2007-08-09 16:06:27 +00:00
|
|
|
void setTarget(QString t) { m_target = t; }
|
2020-09-26 15:51:33 +00:00
|
|
|
void setCache(bool c) { m_usecache = c; }
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2009-05-02 18:50:31 +00:00
|
|
|
public slots:
|
|
|
|
void abort(void);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-07-26 21:16:42 +00:00
|
|
|
private slots:
|
2007-07-26 21:06:09 +00:00
|
|
|
void downloadDone(bool);
|
2007-08-14 23:11:46 +00:00
|
|
|
void installStart(void);
|
|
|
|
void installContinue(void);
|
2007-07-26 21:16:42 +00:00
|
|
|
|
2009-05-02 18:50:31 +00:00
|
|
|
signals:
|
|
|
|
void done(bool error);
|
|
|
|
void cont();
|
|
|
|
void logItem(QString, int); //! set logger item
|
|
|
|
void logProgress(int, int); //! set progress bar.
|
|
|
|
void internalAborted(void);
|
|
|
|
|
2007-08-09 16:06:27 +00:00
|
|
|
private:
|
2007-08-26 16:03:56 +00:00
|
|
|
QString m_url, m_file, m_mountpoint, m_logsection, m_logver;
|
|
|
|
QStringList m_urllist, m_loglist, m_verlist;
|
2007-08-09 16:06:27 +00:00
|
|
|
bool m_unzip;
|
|
|
|
QString m_target;
|
2020-09-26 15:51:33 +00:00
|
|
|
int m_runner;
|
2008-03-05 21:12:24 +00:00
|
|
|
bool m_usecache;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2013-03-09 18:37:40 +00:00
|
|
|
HttpGet *m_getter;
|
|
|
|
QTemporaryFile *m_downloadFile;
|
2007-07-26 21:16:42 +00:00
|
|
|
};
|
2007-09-15 22:57:07 +00:00
|
|
|
|
|
|
|
|
2007-07-26 21:16:42 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|