去除了一个定时器 优化内存占用

This commit is contained in:
才明洋
2018-03-19 19:51:13 +08:00
parent 103933fa66
commit b7a1ff371d
4 changed files with 5 additions and 8 deletions
+2 -2
View File
@@ -98,10 +98,10 @@ MainTray::MainTray(QByteArray username, QByteArray password, QObject *parent): Q
connect(this, exit, this, [this](){setVisible(false);});
autoLoginTimer = new QTimer(this);
autoLoginTimer->setInterval(1000);
autoLoginTimer->setInterval(checkInterval);
autoLoginTimer->start();
connect(autoLoginTimer,QTimer::timeout, this, [this](){
// netctrl->checkStatus(); //可只使用一个定时器
netctrl->checkStatus(); //可只使用一个定时器
//Offline状态下自动重连
if(currentState == Offline && isAutoLogin && !isForceLogout)
netctrl->sendLoginRequest();
+1
View File
@@ -39,6 +39,7 @@ private:
QByteArray user, passwd;
int msgDur = 1000; //通知持续时间
int checkInterval = 1000; //查询状态定时器周期
signals:
+1 -5
View File
@@ -2,7 +2,7 @@
NetController::NetController(QByteArray id, QByteArray passwd, QObject *parent) : QObject(parent),
username(id), password(passwd), NEUStatus(Unknown), flag(Unknown),
manager(this), checkTimer(new QTimer(this))
manager(this)
{
checkParam.append("action=get_online_info");
@@ -19,10 +19,6 @@ NetController::NetController(QByteArray id, QByteArray passwd, QObject *parent)
request.setRawHeader("Accept-Language", "zh-CN,zh;q=0.9");
connect(&manager, QNetworkAccessManager::finished, this, handleResponse);
checkTimer->setInterval(1000);
connect(checkTimer, QTimer::timeout, this, checkStatus);
checkTimer->start();
}
void NetController::checkStatus()
+1 -1
View File
@@ -31,7 +31,7 @@ private:
QNetworkAccessManager manager;
QNetworkRequest request;
QTimer *checkTimer;
signals:
void getOnline();
void getOffline();