1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2008 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 ****************************************************************************/
20 #ifndef BOOTLOADERINSTALLBASE_H
21 #define BOOTLOADERINSTALLBASE_H
24 #include "progressloggerinterface.h"
27 //! baseclass for all Bootloader installs
28 class BootloaderInstallBase
: public QObject
33 { Install
= 0x01, Uninstall
= 0x02, Backup
= 0x04,
34 IsFile
= 0x08, IsRaw
= 0x10, NeedsOf
= 0x20,
35 CanCheckInstalled
= 0x40, CanCheckVersion
= 0x80 };
36 Q_DECLARE_FLAGS(Capabilities
, Capability
)
39 { BootloaderNone
, BootloaderRockbox
, BootloaderOther
, BootloaderUnknown
};
41 BootloaderInstallBase(QObject
*parent
) : QObject(parent
)
44 //! install the bootloader, must be implemented
45 virtual bool install(void) = 0;
46 //! uninstall the bootloader, must be implemented
47 virtual bool uninstall(void) = 0;
48 //! returns the installed bootloader
49 virtual BootloaderType
installed(void)=0;
50 //! returns the capabilities of the bootloader class
51 virtual Capabilities
capabilities(void)=0;
52 //! returns a OF Firmware hint or empty if there is none
53 virtual QString
ofHint() {return QString();}
56 //! backup a already installed bootloader
57 bool backup(QString to
);
59 //! set the different filenames and paths
60 void setBlFile(QStringList f
);
63 void setLogfile(QString f
)
65 void setOfFile(QString f
)
68 //! returns a port Install Hint or empty if there is none
69 //! static and in the base class, so the installer classes dont need to
70 // be modified for new targets
71 static QString
postinstallHints(QString model
);
74 void downloadReqFinished(int id
, bool error
);
75 void downloadBlFinish(bool error
);
76 void installBlfile(void);
79 { LogAdd
, LogRemove
};
81 void downloadBlStart(QUrl source
);
82 int logInstall(LogMode mode
);
84 HttpGet m_http
; //! http download object
85 QString m_blfile
; //! bootloader filename on player
86 QString m_logfile
; //! file for installation log
87 QUrl m_blurl
; //! bootloader download URL
88 QTemporaryFile m_tempfile
; //! temporary file for download
89 QDateTime m_blversion
; //! download timestamp used for version information
90 QString m_offile
; //! path to the offile
92 void downloadDone(void); //! internal signal sent when download finished.
94 void logItem(QString
, int); //! set logger item
95 void logProgress(int, int); //! set progress bar.
98 Q_DECLARE_OPERATORS_FOR_FLAGS(BootloaderInstallBase::Capabilities
)