diff --git a/README.md b/README.md index 8f41f46..82fcdd9 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,51 @@ # NEU-Monitor ## 使用教程 * 注:软件只有托盘中的图标以及单击显示的菜单,并没有主窗口 -1. 在设置中填好校园网账号,密码以及流量(剩余流量过少时发出提醒) +1. 在设置中填好校园网账号,密码以及流量(剩余流量过少时发出提醒,0为无限制) 2. 开始使用 -3. 双击托盘图标可以登录 +3. 双击或鼠标中键点击托盘图标可以登录或注销 ![](optionsWindow.png) ![](menu.png) -## 自动登陆 -1. 在已经登陆的状态下检测到校园网状态变为断开,此时会进行重新登陆,重新登陆等同于在ipgw网页点击`断开连接`后再进行`连接网络` +### 自动登陆 +1. 在已经登陆的状态下检测到校园网状态变为断开,此时会进行重新登陆,重新登陆等同于在网关页面点击`断开连接`后再进行`连接网络` 2. 首次启动应用时进行登陆 -3. 手动断开网络的情况下不会自动重新登陆 +3. 手动点击断开网络后不会自动重新登陆 -## 勿扰模式 +### 断开连接 + +* 当前在线:仅注销当前连接 +* 当前断开:断开全部连接 + +### 作为移动端登陆 + +开启此功能后将作为移动端登陆,由于校园网限制只能一个移动端和一个桌面端登陆,可用这一功能实现两台PC同时在线。 + +### 勿扰模式 该模式下不会发出系统通知 -## 网络状态检测 +### 账户信息 + +信息只有在进行登陆时才会更新 + +单击`IP地址`可将IP复制到剪切板 + +### 网络状态检测 + +*为了检测网络状态,此工具会持续向查询信息接口发送请求* + 网络状态分为 * 未连接到校园网 * 连接到校园网并已经登陆 * 连接到校园网但未登陆 -*为了检测网络状态,此工具会持续发送请求,~~可能由于请求频率过高,有很大概率会出现网关登陆被限制的情况(提示请5分钟之后再尝试)~~ +**请不要短时间内频繁的进行登陆,否则会出现登陆受限的情况** -*请不要短时间内频繁的进行登陆,否则会出现登陆受限的情况 \ No newline at end of file +## 注意事项 + +1. 一旦网管登陆等接口出现变动,该软件会部分或全部失效 +2. 请不要短时间内频繁的进行登陆,否则会出现登陆受限的情况 \ No newline at end of file diff --git a/maintray.cpp b/maintray.cpp index 7e5fa2b..8cd2a62 100644 --- a/maintray.cpp +++ b/maintray.cpp @@ -7,12 +7,13 @@ MainTray::MainTray(QObject *parent) : QSystemTrayIcon(parent), settingsMenu(new QMenu()), //初始化settings settings(QSettings::IniFormat, QSettings::UserScope, "Cai.MY", "NEU-Monitor"), - //初始化optionswindow - opWindow(settings.value("id", "").toByteArray(), QByteArray::fromBase64(settings.value("password", "").toByteArray()), settings.value("total traffic", 60).toInt(), settings.value("isMobile", false).toBool()), - logFileName("NEU_Monitor.log"), - logFile(logFileName, this), user(settings.value("id", "").toByteArray()), - passwd(QByteArray::fromBase64(settings.value("password", "").toByteArray())) + passwd(QByteArray::fromBase64(settings.value("password", "").toByteArray())), + totalTraffic(settings.value("total traffic", 0).toInt()), + isMobile(settings.value("isMobile", false).toBool()), + opWindow(user, passwd, totalTraffic, isMobile), + logFileName("NEU_Monitor.log"), + logFile(logFileName, this) { openLogFile(); @@ -21,10 +22,10 @@ MainTray::MainTray(QObject *parent) : QSystemTrayIcon(parent), netctrl = new NetController(user, passwd, this); //passwd为解密后密码 connect(netctrl, &NetController::sendLog, this, &MainTray::writeLog); - totalTraffic = settings.value("total traffic", 60).toInt(); netctrl->setUsername(user); netctrl->setPassword(passwd); netctrl->setTotalTraffic(totalTraffic); + netctrl->setMobile(isMobile); writeLog(tr("Load username[") + user + tr("] traffic[") + QString::number(totalTraffic) + tr("].")); diff --git a/maintray.h b/maintray.h index c13d839..dedafb2 100644 --- a/maintray.h +++ b/maintray.h @@ -35,10 +35,17 @@ private: QAction *mbAction, *timeAction, *balanceAction, *ipAction, *bootAction, *muteAction, *mobileAction; NetController *netctrl; QSettings settings; + + QByteArray user, passwd; + int totalTraffic; + bool isMobile = false; + OptionsWindow opWindow; QTimer *autoLoginTimer; //自动重连定时器 + QString logFileName; QFile logFile; + QString olIconPath = tr(":/icons/favicon.ico"); QString offIconPath = tr(":/icons/offline.ico"); @@ -55,8 +62,6 @@ private: void showAbout(); //显示关于窗口 void setAutoStart(bool set); - QByteArray user, passwd; - int totalTraffic; int msgDur = 500; //通知持续时间 int checkInterval = 1000; //查询状态定时器周期 diff --git a/optionsWindow.png b/optionsWindow.png index 1139118..c38ac5d 100644 Binary files a/optionsWindow.png and b/optionsWindow.png differ