OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
unshieldworker.hpp
Go to the documentation of this file.
1 #ifndef UNSHIELDWORKER_HPP
2 #define UNSHIELDWORKER_HPP
3 
4 #include <QObject>
5 #include <QThread>
6 #include <QMutex>
7 #include <QWaitCondition>
8 #include <QReadWriteLock>
9 #include <QStringList>
10 
11 #include <libunshield.h>
12 
13 #include "../inisettings.hpp"
14 
15 
16 namespace Wizard
17 {
18  enum Component {
22  };
23 
24  class UnshieldWorker : public QObject
25  {
26  Q_OBJECT
27 
28  public:
29  UnshieldWorker(QObject *parent = 0);
31 
32  void stopWorker();
33 
34  void setInstallComponent(Wizard::Component component, bool install);
35 
36  void setDiskPath(const QString &path);
37 
38  void setPath(const QString &path);
39  void setIniPath(const QString &path);
40 
41  QString getPath();
42  QString getIniPath();
43 
44  void setIniCodec(QTextCodec *codec);
45 
46  bool setupSettings();
47 
48  private:
49 
50  bool writeSettings();
51 
52  bool getInstallComponent(Component component);
53 
54  QString getDiskPath();
55 
56  void setComponentDone(Component component, bool done = true);
57  bool getComponentDone(Component component);
58 
59  bool removeDirectory(const QString &dirName);
60 
61  bool copyFile(const QString &source, const QString &destination, bool keepSource = true);
62  bool copyDirectory(const QString &source, const QString &destination, bool keepSource = true);
63 
64  bool extractCab(const QString &cabFile, const QString &destination);
65  bool extractFile(Unshield *unshield, const QString &destination, const QString &prefix, int index, int counter);
66 
67  bool findInCab(const QString &fileName, const QString &cabFile);
68 
69  QString findFile(const QString &fileName, const QString &path);
70 
71  QStringList findFiles(const QString &fileName, const QString &path, int depth = 0, bool recursive = true,
72  bool directories = false, Qt::MatchFlags flags = Qt::MatchExactly);
73 
74  QStringList findDirectories(const QString &dirName, const QString &path, bool recursive = true);
75 
76  bool installFile(const QString &fileName, const QString &path, Qt::MatchFlags flags = Qt::MatchExactly,
77  bool keepSource = false);
78 
79  bool installFiles(const QString &fileName, const QString &path, Qt::MatchFlags flags = Qt::MatchExactly,
80  bool keepSource = false, bool single = false);
81 
82  bool installDirectories(const QString &dirName, const QString &path,
83  bool recursive = true, bool keepSource = false);
84 
85  bool installComponent(Component component, const QString &path);
86  bool setupComponent(Component component);
87 
91 
95 
96  bool mStopped;
97 
98  QString mPath;
99  QString mIniPath;
100  QString mDiskPath;
101 
103 
104  QTextCodec *mIniCodec;
105 
106  QWaitCondition mWait;
107 
108  QReadWriteLock mLock;
109 
110  public slots:
111  void extract();
112 
113  signals:
114  void finished();
115  void requestFileDialog(Wizard::Component component);
116 
117  void textChanged(const QString &text);
118 
119  void error(const QString &text, const QString &details);
120  void progressChanged(int progress);
121 
122  };
123 }
124 
125 #endif // UNSHIELDWORKER_HPP
Definition: unshieldworker.hpp:19
void requestFileDialog(Wizard::Component component)
bool extractCab(const QString &cabFile, const QString &destination)
Definition: unshieldworker.cpp:768
void textChanged(const QString &text)
bool copyFile(const QString &source, const QString &destination, bool keepSource=true)
Definition: unshieldworker.cpp:235
static const struct @2 signals[]
bool mStopped
Definition: unshieldworker.hpp:96
bool installDirectories(const QString &dirName, const QString &path, bool recursive=true, bool keepSource=false)
Definition: unshieldworker.cpp:332
void setIniCodec(QTextCodec *codec)
Definition: unshieldworker.cpp:156
bool extractFile(Unshield *unshield, const QString &destination, const QString &prefix, int index, int counter)
Definition: unshieldworker.cpp:719
QReadWriteLock mLock
Definition: unshieldworker.hpp:108
bool mInstallMorrowind
Definition: unshieldworker.hpp:88
QStringList findDirectories(const QString &dirName, const QString &path, bool recursive=true)
Definition: unshieldworker.cpp:884
bool setupSettings()
Definition: unshieldworker.cpp:162
IniSettings mIniSettings
Definition: unshieldworker.hpp:102
bool copyDirectory(const QString &source, const QString &destination, bool keepSource=true)
Definition: unshieldworker.cpp:261
bool installComponent(Component component, const QString &path)
Definition: unshieldworker.cpp:503
QString getIniPath()
Definition: unshieldworker.cpp:143
Definition: unshieldworker.hpp:20
Component
Definition: unshieldworker.hpp:18
void error(const QString &text, const QString &details)
QString getDiskPath()
Definition: unshieldworker.cpp:149
QString findFile(const QString &fileName, const QString &path)
Definition: unshieldworker.cpp:820
bool installFile(const QString &fileName, const QString &path, Qt::MatchFlags flags=Qt::MatchExactly, bool keepSource=false)
Definition: unshieldworker.cpp:303
QWaitCondition mWait
Definition: unshieldworker.hpp:106
bool getInstallComponent(Component component)
Definition: unshieldworker.cpp:68
Definition: inisettings.hpp:14
bool writeSettings()
Definition: unshieldworker.cpp:184
bool mInstallBloodmoon
Definition: unshieldworker.hpp:90
Definition: unshieldworker.hpp:21
~UnshieldWorker()
Definition: unshieldworker.cpp:42
void setIniPath(const QString &path)
Definition: unshieldworker.cpp:124
Definition: unshieldworker.hpp:24
void extract()
Definition: unshieldworker.cpp:351
void setDiskPath(const QString &path)
Definition: unshieldworker.cpp:130
bool findInCab(const QString &fileName, const QString &cabFile)
Definition: unshieldworker.cpp:889
bool mInstallTribunal
Definition: unshieldworker.hpp:89
bool mBloodmoonDone
Definition: unshieldworker.hpp:94
void progressChanged(int progress)
QStringList findFiles(const QString &fileName, const QString &path, int depth=0, bool recursive=true, bool directories=false, Qt::MatchFlags flags=Qt::MatchExactly)
Definition: unshieldworker.cpp:825
QString mPath
Definition: unshieldworker.hpp:98
QString getPath()
Definition: unshieldworker.cpp:137
bool getComponentDone(Component component)
Definition: unshieldworker.cpp:101
bool removeDirectory(const QString &dirName)
Definition: unshieldworker.cpp:209
bool installFiles(const QString &fileName, const QString &path, Qt::MatchFlags flags=Qt::MatchExactly, bool keepSource=false, bool single=false)
Definition: unshieldworker.cpp:308
bool setupComponent(Component component)
Definition: unshieldworker.cpp:420
QTextCodec * mIniCodec
Definition: unshieldworker.hpp:104
QString mDiskPath
Definition: unshieldworker.hpp:100
void stopWorker()
Definition: unshieldworker.cpp:46
void setInstallComponent(Wizard::Component component, bool install)
Definition: unshieldworker.cpp:51
QString mIniPath
Definition: unshieldworker.hpp:99
UnshieldWorker(QObject *parent=0)
Definition: unshieldworker.cpp:16
void setPath(const QString &path)
Definition: unshieldworker.cpp:118
void setComponentDone(Component component, bool done=true)
Definition: unshieldworker.cpp:84
bool mTribunalDone
Definition: unshieldworker.hpp:93
bool mMorrowindDone
Definition: unshieldworker.hpp:92