Debian Codegraph @

src/libdbm/util/sevenzip.h

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd.
2 //
3 // SPDX-License-Identifier: GPL-3.0-only
4
5 #ifndef SEVENZIP_H
6 #define SEVENZIP_H
7
8 #include <QObject>
9 #include <QThread>
10 #include <QProcess>
11 #include <QEventLoop>
12
13 class SevenZipProcessParser : public QThread
14 {
15 Q_OBJECT
16 public:
17 explicit SevenZipProcessParser(const QString &file, QProcess *process, QObject *parent = nullptr);
18
19 void setProgressName(const QString &file) {m_progressFilename = file;}
20
21 void run() Q_DECL_OVERRIDE;
22
23 signals:
24 void progressChanged(int, int, const QString &);
25
26 private:
27 QString m_progressFilename;
28 QProcess *m_sevenZip = nullptr;
29
30 int m_lastPencent = 0;
31 QString m_lastFilename;
32 };
33
34 class SevenZip : public QObject
35 {
36 Q_OBJECT
37 public:
38 SevenZipProcessParser *m_szpp;
39
40 explicit SevenZip(const QString &image, const QString &target, QObject *parent = nullptr);
41
42 void setArchiveFile(const QString &archiveFile);
43 void setOutputDirectory(const QString &outputDir);
44 void stopProcess();
45 bool extract();
46 bool check();
47
48 signals:
49 void progressChanged(int);
50
51 private slots:
52 void handleFinished();
53
54 private:
55 QProcess m_sevenz;
56 QString m_sevenZip;
57 QString m_archiveFile;
58 QString m_outputDir;
59 QEventLoop m_eventLoop;
60 bool m_bExit;
61 };
62
63 #endif // SEVENZIP_HHH