Working on the Unshield functionality
parent
dddd9cba57
commit
40486370d9
@ -0,0 +1,61 @@
|
||||
#include "unshieldthread.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
|
||||
Wizard::UnshieldThread::UnshieldThread(QObject *parent) :
|
||||
QThread(parent)
|
||||
{
|
||||
unshield_set_log_level(0);
|
||||
|
||||
mInstallMorrowind = false;
|
||||
mInstallTribunal = false;
|
||||
mInstallBloodmoon = false;
|
||||
|
||||
}
|
||||
|
||||
void Wizard::UnshieldThread::setInstallMorrowind(bool install)
|
||||
{
|
||||
mInstallMorrowind = install;
|
||||
}
|
||||
|
||||
void Wizard::UnshieldThread::setInstallTribunal(bool install)
|
||||
{
|
||||
mInstallTribunal = install;
|
||||
}
|
||||
|
||||
void Wizard::UnshieldThread::setInstallBloodmoon(bool install)
|
||||
{
|
||||
mInstallBloodmoon = install;
|
||||
}
|
||||
|
||||
void Wizard::UnshieldThread::setPath(const QString &path)
|
||||
{
|
||||
mPath = path;
|
||||
}
|
||||
|
||||
void Wizard::UnshieldThread::extract()
|
||||
{
|
||||
emit textChanged(QLatin1String("Starting installation"));
|
||||
emit textChanged(QLatin1String("Installation target: ") + mPath);
|
||||
|
||||
QStringList components;
|
||||
if (mInstallMorrowind)
|
||||
components << QLatin1String("Morrowind");
|
||||
|
||||
if (mInstallTribunal)
|
||||
components << QLatin1String("Tribunal");
|
||||
|
||||
if (mInstallBloodmoon)
|
||||
components << QLatin1String("Bloodmoon");
|
||||
|
||||
emit textChanged(QLatin1String("Components: ") + components.join(QLatin1String(", ")));
|
||||
|
||||
}
|
||||
|
||||
void Wizard::UnshieldThread::run()
|
||||
{
|
||||
qDebug() << "From worker thread: " << currentThreadId();
|
||||
|
||||
extract();
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
#ifndef UNSHIELDTHREAD_HPP
|
||||
#define UNSHIELDTHREAD_HPP
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include <libunshield.h>
|
||||
|
||||
namespace Wizard
|
||||
{
|
||||
|
||||
class UnshieldThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit UnshieldThread(QObject *parent = 0);
|
||||
|
||||
void setInstallMorrowind(bool install);
|
||||
void setInstallTribunal(bool install);
|
||||
void setInstallBloodmoon(bool install);
|
||||
|
||||
void setPath(const QString &path);
|
||||
|
||||
private:
|
||||
void extract();
|
||||
|
||||
void extractCab(const QString &cabFile,
|
||||
const QString &outputDir, bool extractIni);
|
||||
//void extractFile(Unshield *unshield,
|
||||
// )
|
||||
|
||||
bool mInstallMorrowind;
|
||||
bool mInstallTribunal;
|
||||
bool mInstallBloodmoon;
|
||||
|
||||
QString mPath;
|
||||
|
||||
protected:
|
||||
virtual void run();
|
||||
|
||||
signals:
|
||||
void textChanged(const QString &text);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // UNSHIELDTHREAD_HPP
|
Loading…
Reference in New Issue