-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathlafdup_window_p.h
128 lines (119 loc) · 3.4 KB
/
lafdup_window_p.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
#ifndef LAFDUP_WINDOW_P_H
#define LAFDUP_WINDOW_P_H
#include <QtCore/qdatetime.h>
#include <QtCore/qabstractitemmodel.h>
#include <QtWidgets/qdialog.h>
#include "lafdup_window.h"
namespace Ui {
class PasswordDialog;
class ConfigureDialog;
class GuideDialog;
} // namespace Ui
class CopyPasteModel : public QAbstractListModel
{
Q_OBJECT
public:
CopyPasteModel();
public:
int rowCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
public:
// bool checkLastCopyPaste(CopyPaste::Direction direction, const QString &text) const;
QModelIndex addCopyPaste(const CopyPaste ©Paste);
CopyPaste copyPasteAt(const QModelIndex &index) const;
bool removeCopyPaste(const QModelIndex &index);
void clearAll();
private:
QList<CopyPaste> copyPasteList;
};
class PeerModel : public QAbstractListModel
{
public:
void setPeers(const QStringList &peers);
QStringList getPeers() const { return peers; }
QModelIndex addPeer(const QString &peer);
bool removePeer(const QModelIndex &index);
public:
virtual int rowCount(const QModelIndex &parent) const override;
virtual QVariant data(const QModelIndex &index, int role) const override;
private:
QStringList peers;
};
class PasswordDialog : public QDialog
{
Q_OBJECT
public:
PasswordDialog(QWidget *parent);
virtual ~PasswordDialog() override;
public:
virtual void accept() override;
private:
Ui::PasswordDialog *ui;
};
class ConfigureDialog : public QDialog
{
Q_OBJECT
public:
ConfigureDialog(QWidget *parent);
virtual ~ConfigureDialog() override;
public:
virtual void accept() override;
bool isPasswordChanged();
private slots:
void onCacheDirectoryChanged(const QString &text);
void selectCacheDirectory();
void onDeleteFilesChanged(bool checked);
void onSendFilesChanged(bool checked);
void onOnlySendSmallFileChanged(bool checked);
void removeSelectedPeer();
void addPeer();
void onChangelanguage();
private:
void loadSettings();
void appAutoRun(bool checked);
private:
Ui::ConfigureDialog *ui;
PeerModel *peerModel;
};
class MessageTips : public QWidget
{
Q_OBJECT
public:
MessageTips(const QString &str, QWidget *partent = nullptr);
~MessageTips();
void prepare();
void setCloseTimeSpeed(int closeTime = 100, double closeSpeed = 0.1);
void setShowTime(int time);
void backgroundColor(QColor color);
static void showMessageTips(QString str, QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent *event) override;
private slots:
void opacityTimer();
void timerDelayShutdown();
private:
QString showStr;
double opacity = 0.8;
int textSize = 12; // 显示字体大小
QColor textColor = QColor(255, 255, 255); // 字体颜色
QColor bgColor = QColor(0, 191, 255); // 窗体的背景色
QColor frameColor = QColor(211, 211, 211); // 边框颜色
int frameSize = 1; // 边框粗细大小
int showTime = 5000; // 显示时间
int closeTime = 100; // 关闭需要时间
double closeSpeed = 0.1; // 窗体消失的平滑度,大小0~1
QTimer *mtimer = nullptr;
};
class GuideDialog : public QDialog
{
Q_OBJECT
public:
GuideDialog(QWidget *parent = nullptr);
~GuideDialog();
virtual void accept() override;
private:
void setRecvFileDirectory();
private:
Ui::GuideDialog *ui;
};
#endif