Skip to content

Commit da39684

Browse files
committed
Parameter: add server stats
1 parent 05723e5 commit da39684

4 files changed

Lines changed: 57 additions & 4 deletions

File tree

ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
- Add file transfer
3434
- SFTP
3535
- FTP
36-
- Server
36+
- Add Server
3737
- FTP server
38+
- SFTP server
3839
- Player
3940
- Add display subtitle
4041
- Add web browser

ChangeLog_zh_CN.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
- SSH 终端
3030
- Telnet
3131
- 串口
32-
- 文件传输
32+
- 增加文件传输
3333
- SFTP
3434
- FTP
35-
- 服务
35+
- 增加服务
3636
- FTP 服务
37+
- SFTP 服务
3738
- 播放器
3839
- 增加显示字幕
3940
- 增加网页浏览器

Src/ParameterCompone/Stats.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,38 @@ int CStats::OnSave(QSettings &set)
122122
return 0;
123123
}
124124

125+
CStatsSever::CStatsSever(CParameterOperate *parent, const QString &szPrefix)
126+
: CStats(parent, szPrefix)
127+
{
128+
}
129+
130+
quint64 CStatsSever::GetTotalConnects() const
131+
{
132+
return m_TotalConnects;
133+
}
134+
135+
quint64 CStatsSever::GetConnects() const
136+
{
137+
return m_Connects;
138+
}
139+
140+
quint64 CStatsSever::GetDisconnects() const
141+
{
142+
return m_Disconnects;
143+
}
144+
145+
void CStatsSever::AddConnects(quint64 c)
146+
{
147+
m_Connects += c;
148+
m_TotalConnects += c;
149+
}
150+
151+
void CStatsSever::Disconnects(quint64 c)
152+
{
153+
m_Disconnects += c;
154+
m_Connects -= c;
155+
}
156+
125157
CSecurityLevel::CSecurityLevel(Levels level, QObject* parent)
126158
: QObject(parent)
127159
, m_Level(level)
@@ -258,3 +290,4 @@ QIcon CSecurityLevel::GetIcon(const Levels &level)
258290
return QIcon::fromTheme("dialog-warning");
259291
return QIcon::fromTheme("unlock");
260292
}
293+

Src/ParameterCompone/Stats.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,29 @@ public Q_SLOTS:
7272
virtual int OnSave(QSettings &set) override;
7373
};
7474

75+
class PLUGIN_EXPORT CStatsSever : public CStats {
76+
Q_OBJECT
77+
78+
public:
79+
explicit CStatsSever(CParameterOperate* parent = nullptr,
80+
const QString& szPrefix = QString());
81+
quint64 GetTotalConnects() const;
82+
quint64 GetConnects() const;
83+
quint64 GetDisconnects() const;
84+
void AddConnects(quint64 c = 1);
85+
void Disconnects(quint64 c = 1);
86+
87+
private:
88+
QAtomicInteger<quint64> m_TotalConnects;
89+
QAtomicInteger<quint64> m_Connects;
90+
QAtomicInteger<quint64> m_Disconnects;
91+
};
92+
7593
/*!
7694
* \~chinese 安全级别
7795
* \~english Security level
7896
*/
79-
class PLUGIN_EXPORT CSecurityLevel : QObject {
97+
class PLUGIN_EXPORT CSecurityLevel : public QObject {
8098
Q_OBJECT
8199

82100
public:

0 commit comments

Comments
 (0)