-
Notifications
You must be signed in to change notification settings - Fork 11
/
mainWin.h
165 lines (137 loc) · 4.08 KB
/
mainWin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
* Copyright (C) Pedram Pourang (aka Tsu Jan) 2018-2023 <tsujan2000@gmail.com>
*
* Arqiver is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Arqiver is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @license GPL-3.0+ <https://spdx.org/licenses/GPL-3.0+.html>
*/
#ifndef ARQIVER_MAIN_UI_H
#define ARQIVER_MAIN_UI_H
#include <QMainWindow>
#include <QString>
#include <QCollator>
#include <QTreeWidgetItem>
#include <QDropEvent>
#include <QLabel>
#include <QProgressBar>
#include "backends.h"
#include "label.h"
#include "config.h"
namespace Arqiver {
class TreeWidgetItem : public QTreeWidgetItem {
public:
TreeWidgetItem(QTreeWidgetItem *parent = nullptr, int type = QTreeWidgetItem::Type) :
QTreeWidgetItem(parent, type) {
collator_.setNumericMode(true);
iconSize_ = QSize(16, 16);
backend_ = nullptr;
}
QVariant data(int column, int role) const override;
bool operator<(const QTreeWidgetItem& other) const override;
void setBackend(Backend* B) {
backend_ = B;
}
void setIconSize(const QSize& size) {
iconSize_ = size;
}
private:
QPixmap emblemizedPixmap(const QString icon, const QSize& icnSize,
bool selected, bool lock) const;
QCollator collator_;
QSize iconSize_;
Backend *backend_;
};
namespace Ui {
class mainWin;
};
class mainWin : public QMainWindow {
Q_OBJECT
public:
mainWin();
~mainWin();
void loadArguments(const QStringList& args);
Config& getConfig() {
return config_;
}
protected:
bool eventFilter(QObject *watched, QEvent *event);
private slots:
void newArchive();
void openArchive();
void addFiles();
void addDirs();
void removeFiles();
void extractFiles();
void autoextractFiles();
void nextAutoExtraction();
void autoArchiveFiles();
void simpleArchivetFiles();
void simpleExtractFiles();
void extractSelection();
void viewFile(QTreeWidgetItem *it);
void onEnterPressed(QTreeWidgetItem *it);
void extractDraggedItems();
void labelContextMenu(const QPoint& p);
void listContextMenu(const QPoint& p);
void onChangingExpansion(QTreeWidgetItem *item);
void procStarting();
void procFinished(bool, const QString& msg);
void procUpdate(int percent, const QString& txt);
void openEncryptedList(const QString& path);
void filter(const QString&);
void reallyApplyFilter();
void selectionChanged();
void prefDialog();
void aboutDialog();
private:
void closeEvent(QCloseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void changeEvent(QEvent *event);
QHash<QString, QTreeWidgetItem*> cleanTree(const QStringList& list); // returns the remaining items
void updateTree();
QString allArchivingTypes();
QString archivingTypes();
QHash<QString, QString> supportedMimeTypes();
QString openingTypes();
QString filterToExtension(const QString& filter);
bool pswrdDialog(bool listEncryptionBox = false, bool forceListEncryption = false);
void enableActions(bool enable);
bool subTreeIsEncrypted(QTreeWidgetItem *item);
void hideChildlessDir(QTreeWidgetItem *item);
void adjustColumnSizes();
bool ignoreChanges();
QLabel *iconLabel_;
Label *textLabel_;
QProgressBar *statusProgress_;
Ui::mainWin *ui;
Backend *BACKEND;
QStringList axFileList_, aaFileList_, saFileList_;
QString lastPath_, lastFilter_;
QString lastPswrd_;
QString lastMsg_;
bool canModify_;
bool canUpdate_;
bool updateTree_;
bool scrollToCurrent_;
bool expandAll_;
bool close_;
bool processIsRunning_;
QTimer *filterTimer_;
bool reapplyFilter_;
Config config_;
bool isRoot_;
};
#endif
}