wiiqt/nandExtract/nandthread.h

73 lines
1.6 KiB
C
Raw Normal View History

2010-12-11 11:39:41 +01:00
#ifndef NANDTHREAD_H
#define NANDTHREAD_H
#include "../WiiQt/includes.h"
#include "../WiiQt/nandbin.h"
//TODO: this thread really isnt setup to be inturruptable. especially while it is extracting the full nand.bin
class NandThread : public QThread
{
Q_OBJECT
public:
NandThread( QObject *parent = 0 );
~NandThread();
2010-12-11 11:39:41 +01:00
bool IsRunning();
2010-12-11 11:39:41 +01:00
//these just call the same function of the nand.bin object
// dont use them if the thread is running ( it is busy extracting )
// wait till after SendExtractDone() is emitted
bool SetPath( const QString &path );
QTreeWidgetItem *GetTree();
bool InitNand( QIcon dirs = QIcon(), QIcon files = QIcon() );
const QList<quint16> GetFats();
const QList<quint16> GetFatsForFile( quint16 i );
2010-12-11 11:39:41 +01:00
//extract some stuff from a nand.bin in a thread so the gui doesn't freeze up
void Extract( QTreeWidgetItem *item, const QString &path );
void ForceQuit();
2010-12-11 11:39:41 +01:00
const Blocks0to7 BootBlocks();
const QList<Boot2Info> Boot2Infos();
quint8 Boot1Version();
2011-03-24 09:57:59 +01:00
void SetFixNamesForFat( bool fix = true );
protected:
void run();
2010-12-11 11:39:41 +01:00
signals:
void SendProgress( int );
void SendExtractDone();
void SendText( QString );
void SendError( QString );
2010-12-11 11:39:41 +01:00
private:
QMutex mutex;
QWaitCondition condition;
2010-12-11 11:39:41 +01:00
QString extractPath;
QTreeWidgetItem *itemToExtract;
NandBin nandBin;
2010-12-11 11:39:41 +01:00
quint32 fileCnt;
quint32 idx;
2010-12-11 11:39:41 +01:00
bool abort;
2011-03-24 09:57:59 +01:00
bool fatNames;
2010-12-11 11:39:41 +01:00
//count the number of files in a given folder
quint32 FileCount( QTreeWidgetItem *item );
2010-12-11 11:39:41 +01:00
public slots:
void GetError( QString );
void GetStatusUpdate( QString );
};
2010-12-11 11:39:41 +01:00
#endif // NANDTHREAD_H