Make addItem() a slot to be able adding items using a signal.
[Rockbox.git] / rbutil / rbutilqt / installbootloader.h
bloba026a35fad607589f13430e0294d5f88469cc841
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
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 #ifndef INSTALLBOOTLOADER_H
21 #define INSTALLBOOTLOADER_H
23 #ifndef CONSOLE
24 #include <QtGui>
25 #else
26 #include <QtCore>
27 #endif
29 #include "progressloggerinterface.h"
30 #include "httpget.h"
31 #include "irivertools/irivertools.h"
33 extern "C" {
34 // Ipodpatcher
35 #include "../ipodpatcher/ipodpatcher.h"
36 #include "../sansapatcher/sansapatcher.h"
39 bool initIpodpatcher();
40 bool initSansapatcher();
42 class BootloaderInstaller : public QObject
44 Q_OBJECT
46 public:
47 BootloaderInstaller(QObject* parent);
48 ~BootloaderInstaller() {}
50 void install(ProgressloggerInterface* dp);
51 void uninstall(ProgressloggerInterface* dp);
53 void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
54 void setDevice(QString device) {m_device= device;} //!< the current plattform
55 void setBootloaderMethod(QString method) {m_bootloadermethod= method;}
56 void setBootloaderName(QString name){m_bootloadername= name;}
57 void setBootloaderBaseUrl(QString baseUrl){m_bootloaderUrlBase = baseUrl;}
58 void setOrigFirmwarePath(QString path) {m_origfirmware = path;} //!< for iriver original firmware
59 void setBootloaderInfoUrl(QString url) {m_bootloaderinfoUrl =url; } //!< the url for the info file
60 bool downloadInfo(); //!< should be called before install/uninstall, blocks until downloaded.
61 bool uptodate(); //!< returns wether the bootloader is uptodate
63 signals:
64 void done(bool error); //installation finished.
66 signals: // internal signals. Dont use this from out side.
67 void prepare();
68 void finish();
70 private slots:
71 void createInstallLog(); // adds the bootloader entry to the log
72 void removeInstallLog(); // removes the bootloader entry from the log
74 void updateDataReadProgress(int, int);
75 void downloadDone(bool);
76 void downloadRequestFinished(int, bool);
77 void infoDownloadDone(bool);
78 void infoRequestFinished(int, bool);
79 void installEnded(bool);
81 // gigabeat specific routines
82 void gigabeatPrepare();
83 void gigabeatFinish();
85 //iaudio specific routines
86 void iaudioPrepare();
87 void iaudioFinish();
89 //h10 specific routines
90 void h10Prepare();
91 void h10Finish();
93 //ipod specific routines
94 void ipodPrepare();
95 void ipodFinish();
97 //sansa specific routines
98 void sansaPrepare();
99 void sansaFinish();
101 //iriver specific routines
102 void iriverPrepare();
103 void iriverFinish();
105 //mrobe100 specific routines
106 void mrobe100Prepare();
107 void mrobe100Finish();
109 private:
111 HttpGet *infodownloader;
112 QTemporaryFile bootloaderInfo;
113 volatile bool infoDownloaded;
114 volatile bool infoError;
116 QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername;
117 QString m_bootloaderUrlBase,m_tempfilename,m_origfirmware;
118 QString m_bootloaderinfoUrl;
119 bool m_install;
121 int series,table_entry; // for fwpatcher
123 HttpGet *getter;
124 QTemporaryFile downloadFile;
126 ProgressloggerInterface* m_dp;
129 #endif