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
);
73 //! returns the correct BootloaderInstaller object for the requested type
74 static BootloaderInstallBase
* createBootloaderInstaller(QObject
* parent
,QString type
);
76 void downloadReqFinished(int id
, bool error
);
77 void downloadBlFinish(bool error
);
78 void installBlfile(void);
80 // NOTE: we need to keep this slot even on targets that don't need it
81 // -- using the preprocessor here confused moc.
82 void checkRemount(void);
85 { LogAdd
, LogRemove
};
87 void downloadBlStart(QUrl source
);
88 int logInstall(LogMode mode
);
90 HttpGet m_http
; //! http download object
91 QString m_blfile
; //! bootloader filename on player
92 QString m_logfile
; //! file for installation log
93 QUrl m_blurl
; //! bootloader download URL
94 QTemporaryFile m_tempfile
; //! temporary file for download
95 QDateTime m_blversion
; //! download timestamp used for version information
96 QString m_offile
; //! path to the offile
97 #if defined(Q_OS_MACX)
98 void waitRemount(void);
101 QString m_remountDevice
;
105 void downloadDone(void); //! internal signal sent when download finished.
107 void logItem(QString
, int); //! set logger item
108 void logProgress(int, int); //! set progress bar.
110 // NOTE: we need to keep this signal even on targets that don't need it
111 // -- using the preprocessor here confused moc.
112 void remounted(bool);
115 Q_DECLARE_OPERATORS_FOR_FLAGS(BootloaderInstallBase::Capabilities
)