7 Commits
Author SHA1 Message Date
c-my cb572f4f10 update readme 2018-06-07 10:39:24 +08:00
c-my 14a1c568d0 update readme 2018-06-07 10:38:12 +08:00
c-my 2da62629a8 update readme 2018-06-07 10:36:48 +08:00
c-my 37bdaec248 add online count 2018-06-07 10:12:09 +08:00
c-my cb7a142b88 update tooltip 2018-06-03 17:28:52 +08:00
c-my 08dbdae2a8 change the logic of autologin 2018-06-03 17:24:16 +08:00
c-my 75fa1a8102 add button shortcut 2018-06-03 17:03:26 +08:00
7 changed files with 50 additions and 26 deletions

No files matched your search

+18 -5
View File
@@ -1,11 +1,24 @@
# NEU-Dectect
# NEU-Monitor
## 使用教程
* 注:软件只有托盘中的图标以及单击显示的菜单,并没有主窗口
1. 在设置中填好校园网账号和密码
1. 在设置中填好校园网账号,密码以及流量(剩余流量过少时发出提醒)
2. 开始使用
3. 双击托盘图标可以登录
## 自动重连
在已经登陆的状态下检测到校园网状态变为断开,此时会进行重新登陆,重新登陆等同于在ipgw网页点击`断开连接`后再进行`连接网络`
![](optionsWindow.png)
![](menu.png)
## 自动登陆
1. 在已经登陆的状态下检测到校园网状态变为断开,此时会进行重新登陆,重新登陆等同于在ipgw网页点击`断开连接`后再进行`连接网络`
2. 首次启动应用时进行登陆
3. 手动断开网络的情况下不会自动重新登陆
## 勿扰模式
该模式下不会发出系统通知
## 网络状态检测
网络状态分为
* 未连接到校园网
@@ -14,4 +27,4 @@
*为了检测网络状态,此工具会持续发送请求,~~可能由于请求频率过高,有很大概率会出现网关登陆被限制的情况(提示请5分钟之后再尝试)~~
*请不要短时间内频繁的进行登陆,会出现登陆受限的情况
*请不要短时间内频繁的进行登陆,否则会出现登陆受限的情况
+17 -14
View File
@@ -36,13 +36,16 @@ MainTray::MainTray(QByteArray username, QByteArray password, QObject *parent): Q
logoutAction->setEnabled(true);
break;
case NetController::Offline:
if(!isForceLogin){
setIcon(QIcon(tr(":/icon/offline.ico")));
if(!muteAction->isChecked())
showMessage(tr("网络已断开"),tr("校园网已注销"), this->icon(), msgDur);
loginAction->setEnabled(true);
logoutAction->setEnabled(true);
setIcon(QIcon(tr(":/icon/offline.ico")));
if(!muteAction->isChecked())
showMessage(tr("网络已断开"),tr("校园网已注销"), this->icon(), msgDur);
loginAction->setEnabled(true);
logoutAction->setEnabled(true);
//自动登陆
if(autoLogin->isChecked() && !isForceLogout){
loginAction->trigger();
}
break;
case NetController::Disconnected:
setIcon(QIcon(tr(":/icon/offline.ico")));
@@ -79,7 +82,7 @@ MainTray::MainTray(QByteArray username, QByteArray password, QObject *parent): Q
//菜单Action
loginAction = new QAction(tr("连接网络"),this);
logoutAction = new QAction(tr("断开网络"),this);
autoLogin = new QAction(tr("自动重连"), this);
autoLogin = new QAction(tr("自动登陆"), this);
optionsAction = new QAction(tr("选项"), this);
bootAction = new QAction(tr("开机启动"), this);
muteAction = new QAction(tr("勿扰模式"), this);
@@ -158,10 +161,10 @@ MainTray::MainTray(QByteArray username, QByteArray password, QObject *parent): Q
autoLoginTimer->start();
connect(autoLoginTimer,QTimer::timeout, this, [this](){
netctrl->checkState();
//Offline状态下自动重连
if(currentState == NetController::Offline && autoLogin->isChecked() && !isForceLogout){
loginAction->trigger();
}
// //Offline状态下自动重连
// if(currentState == NetController::Offline && autoLogin->isChecked() && !isForceLogout){
// loginAction->trigger();
// }
});
showToolTip(currentState);
@@ -185,7 +188,7 @@ void MainTray::showToolTip(NetController::State state)
tooltipString += tr("当前状态:连接");
break;
case NetController::Offline:
tooltipString += tr("当前状态:断开 (双击登陆)");
tooltipString += tr("当前状态:断开(双击登陆)");
break;
case NetController::Disconnected:
tooltipString += tr("当前状态:无法连接");
@@ -202,7 +205,7 @@ void MainTray::showToolTip(NetController::State state)
default:
break;
}
tooltipString += tr("\n自动重连:");
tooltipString += tr("\n自动登陆:");
tooltipString += autoLogin->isChecked()? tr("开启"):tr("关闭");
if(state == NetController::Online){
switch (trafficstate) {
@@ -244,7 +247,7 @@ void MainTray::showAbout()
QMessageBox *aboutWindow = new QMessageBox();
aboutWindow->setStandardButtons(QMessageBox::Ok);
aboutWindow->setText(tr("<h1>NEU-Monitor</h1>"
"<p>Based on Qt 5.10.1 (MinGW 5.3.0, 32bit)</p>"
"<p>Based on Qt 5.11.0 (MinGW 5.3.0, 32bit)</p>"
"Source Code: <a href=\"https://github.com/c-my/NEU-Monitor\">https://github.com/c-my/NEU-Monitor</a><br/>"
"Email: <address>"
"<a href=\"mailto:cmy1113@yeah.net?subject=SerialAsst Feedback\">Cai.MY</a>"
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

+12 -6
View File
@@ -105,6 +105,7 @@ void NetController::handleResponse(QNetworkReply *reply)
{
if(NEUState!=WrongPass && NEUState!=Owed && offlineCount++ > 1)
{
onlineCount = 0;
offlineCount = 0;
disconnectCount = 0;
lastState = NEUState;
@@ -113,16 +114,21 @@ void NetController::handleResponse(QNetworkReply *reply)
}
else
{
offlineCount = 0;
disconnectCount = 0;
lastState = NEUState;
NEUState = Online;
QStringList infoList = status.split(',');
emit sendInfo(infoList[0], infoList[1], infoList[2], infoList[5]);
if(onlineCount++ > 1)
{
onlineCount = 0;
offlineCount = 0;
disconnectCount = 0;
lastState = NEUState;
NEUState = Online;
QStringList infoList = status.split(',');
emit sendInfo(infoList[0], infoList[1], infoList[2], infoList[5]);
}
}
}
else if(disconnectCount++ > 1)
{
onlineCount = 0;
offlineCount = 0;
disconnectCount = 0;
lastState = NEUState;
+1 -1
View File
@@ -30,7 +30,7 @@ private:
QByteArray checkParam, username, password;
int traffic;
State NEUState = Unknown, lastState = Unknown;
int offlineCount = 0, disconnectCount = 0;
int onlineCount = 0, offlineCount = 0, disconnectCount = 0;
QNetworkAccessManager manager;
QNetworkRequest request;
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

+2
View File
@@ -27,7 +27,9 @@ OptionsWindow::OptionsWindow(QByteArray id, QByteArray pass, int traffic, QWidg
layout->setSpacing(20);
saveButton = new QPushButton("确定", this);
saveButton->setDefault(true);
cancleButton = new QPushButton("取消", this);
cancleButton->setShortcut(Qt::Key_Escape);
hlayout->addWidget(saveButton);
hlayout->addWidget(cancleButton);