代码拉取完成,页面将自动刷新
/************************************************************************************
<GoSlowDetection> Copyright (C) <2021> <Tao Kiang>
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions;
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
************************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPaintEvent>
#include <QPainter>
#include <QTimer>
#include <QDateTime>
#include "pluginmanage.h"
#include "windowsupdatewidget.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
/************************************
1、显示按键、鼠标点击的次数
2、可设置开机自动启动
3、可清空当前计数
4、可设置背景透明不透明(后期可设置颜色,添加二级菜单)
5、设置警告颜色,1min无操作,显示淡红色,2-10min无操作颜色对应加深
************************************/
//背景颜色设置
#define START_COLOR QColor(255,215,0, 255) //显眼的金色
#define HY_COLOR QColor(255, 255, 255, 80) //透明
#define COLOR QColor(255, 255, 255, 255) //不透明
#define CHECK_TIME 30000 //30s判断一次,如果没有动作,红色加深一层,最多加深20层(10min全红)
class MySetting
{
public:
bool autoRunFlag; //开机自启动标志位
QSize boundSize; //边界限制框
int attractWidth; //磁吸距离,接近边界时,吸到边界上
bool isHyaline; //是否透明标志位
QBrush brush; //背景颜色刷
bool showUpdate; //检测到摸鱼后显示windows更新界面
public:
MySetting():
autoRunFlag(0)
,attractWidth(20) //磁吸距离
,isHyaline(1)
,brush(QBrush(HY_COLOR, Qt::SolidPattern))
{}
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
static void setProcessAutoRun(const QString &appPath,bool flag = 1);
static bool isAutoRun(const QString &appPath);
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void paintEvent(QPaintEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
private:
void showMenu(const QPoint& pos);
void addMapCount(QMap<QString,quint64> &map);
void clickOperator();
void loadSysMenu(QMenu &menu);
void loadPluginMenu(QMenu &menu);
void closeApp();
void cleanCount();
private:
Ui::MainWindow *ui;
QDateTime startRunTime;
QTimer runTime;
QTimer mTimer;
int mNoClickTime;
bool mPressFlag; //是否按下状态
QPoint mPressPos; //拖动,鼠标按下的位置
MySetting mSetting; //设置对象
PluginManage mPlugManage; //插件管理对象
quint64 mKeyCount; //按键的总计数
quint64 mMouseCount; //鼠标总计数
QMap<QDateTime,quint64> keyMapCount; //小时 map 按下的次数
QMap<QDateTime,quint64> mouseMapCount;
};
#endif // MAINWINDOW_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。