diff options
Diffstat (limited to 'rbutil/rbutilqt/bootloaderinstallbase.h')
-rw-r--r-- | rbutil/rbutilqt/bootloaderinstallbase.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/bootloaderinstallbase.h b/rbutil/rbutilqt/bootloaderinstallbase.h new file mode 100644 index 0000000000..4f0d279229 --- /dev/null +++ b/rbutil/rbutilqt/bootloaderinstallbase.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2008 by Dominik Riebeling | ||
10 | * $Id:$ | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef BOOTLOADERINSTALLBASE_H | ||
21 | #define BOOTLOADERINSTALLBASE_H | ||
22 | |||
23 | #include <QtCore> | ||
24 | #include "progressloggerinterface.h" | ||
25 | #include "httpget.h" | ||
26 | |||
27 | |||
28 | class BootloaderInstallBase : public QObject | ||
29 | { | ||
30 | Q_OBJECT | ||
31 | |||
32 | public: | ||
33 | enum Capability | ||
34 | { Install = 0x01, Uninstall = 0x02, Backup = 0x04, | ||
35 | IsFile = 0x08, IsRaw = 0x10, NeedsFlashing = 0x20, | ||
36 | CanCheckInstalled = 0x40, CanCheckVersion = 0x80 }; | ||
37 | Q_DECLARE_FLAGS(Capabilities, Capability) | ||
38 | |||
39 | enum BootloaderType | ||
40 | { BootloaderNone, BootloaderRockbox, BootloaderOther, BootloaderUnknown }; | ||
41 | |||
42 | BootloaderInstallBase(QObject *parent = 0) : QObject(parent) | ||
43 | { } | ||
44 | |||
45 | virtual bool install(void) | ||
46 | { return false; } | ||
47 | virtual bool uninstall(void) | ||
48 | { return false; } | ||
49 | virtual BootloaderType installed(void); | ||
50 | virtual Capabilities capabilities(void); | ||
51 | bool backup(QString to); | ||
52 | |||
53 | void setBlFile(QString f) | ||
54 | { m_blfile = f; } | ||
55 | void setBlUrl(QUrl u) | ||
56 | { m_blurl = u; } | ||
57 | void setLogfile(QString f) | ||
58 | { m_logfile = f; } | ||
59 | |||
60 | static QString postinstallHints(QString model); | ||
61 | |||
62 | protected slots: | ||
63 | void downloadReqFinished(int id, bool error); | ||
64 | void downloadBlFinish(bool error); | ||
65 | void installBlfile(void); | ||
66 | protected: | ||
67 | enum LogMode | ||
68 | { LogAdd, LogRemove }; | ||
69 | |||
70 | void downloadBlStart(QUrl source); | ||
71 | int logInstall(LogMode mode); | ||
72 | |||
73 | HttpGet m_http; //! http download object | ||
74 | QString m_blfile; //! bootloader filename on player | ||
75 | QString m_logfile; //! file for installation log | ||
76 | QUrl m_blurl; //! bootloader download URL | ||
77 | QTemporaryFile m_tempfile; //! temporary file for download | ||
78 | QDateTime m_blversion; //! download timestamp used for version information | ||
79 | |||
80 | signals: | ||
81 | void downloadDone(void); //! internal signal sent when download finished. | ||
82 | void done(bool); | ||
83 | void logItem(QString, int); //! set logger item | ||
84 | void logProgress(int, int); //! set progress bar. | ||
85 | }; | ||
86 | |||
87 | Q_DECLARE_OPERATORS_FOR_FLAGS(BootloaderInstallBase::Capabilities) | ||
88 | |||
89 | #endif | ||
90 | |||