-
Notifications
You must be signed in to change notification settings - Fork 0
/
QNetMount.h
95 lines (85 loc) · 2.48 KB
/
QNetMount.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
#ifndef QNETMOUNT_H
#define QNETMOUNT_H
#include <QAction>
#include <QCloseEvent>
#include <QDesktopServices>
#include <QDir>
#include <QFileDialog>
#include <QHostAddress>
#include <QJsonDocument>
#include <QJsonObject>
#include <QMainWindow>
#include <QMap>
#include <QMessageBox>
#include <QNetworkInterface>
#include <QProcess>
#include <QRegExp>
#include <QStandardPaths>
#include <QStatusBar>
#include <QSystemTrayIcon>
#include <QTextEdit>
#include <QTimer>
#include <QToolButton>
#include <QThread>
QT_BEGIN_NAMESPACE
namespace Ui
{
class QNetMount;
}
QT_END_NAMESPACE
class QNetMount : public QMainWindow
{
Q_OBJECT
public:
QNetMount(QWidget *parent = nullptr);
~QNetMount();
QString configPath();
QString alistExecPath();
QString alistConfigDir();
static QString parentDir(const QString&path, bool *ok = nullptr);
private:
QString getString(const QString &key);
QAction *getAction(const QString &key);
void setString(const QString &key, const QString &value);
void setAction(const QString &key, QAction *value);
bool hasString(const QString &key);
bool hasAction(const QString &key);
QMap<QString, QString> &stringsMap();
QMap<QString, QAction *> &actionsMap();
void initStrings();
void initTrayIcon();
void initStatusBar();
void initAcitons();
void disableStartAlistServerButtons(bool disable = true);
void startAlistServer();
void stopAlistServer();
void initConfigFile(bool rewrite = false); // rewrite 强制覆盖
void loadConfig();
void updateToCofigFile();
QString alistToken();
QString alistVersion();
QString alistPidPath();
const QVector<QHostAddress> &getIPs();
bool checkAlistExecuable();
void syncAlistConfigDir();
void showAlistHost();
void updateSettingLibsTitleInfo();
signals:
private slots:
void on_tabWidgetCentral_currentChanged(int index);
void checkAlistStatus();
protected:
virtual void closeEvent(QCloseEvent *event) override;
private:
Ui::QNetMount *ui;
QSystemTrayIcon *m_trayIcon = nullptr;
QMap<QString, QString> m_strings; // QMap<id, text> 获取文本信息
QMap<QString, QAction *> m_actions;
QString m_confgPath;
// Alist
QProcess *m_processAlist = nullptr; // 维护 Alist 运行状态
QToolButton *m_alist_status = nullptr;
QString m_alist_address;
int m_alist_httpPort = -1;
};
#endif // QNETMOUNT_H