-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtimer.cpp
48 lines (42 loc) · 1.1 KB
/
timer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "timer.h"
#include <QtCore>
#include <QDebug>
timer::timer()
{
_timer = new QTimer();
connect(_timer,SIGNAL(timeout()),this,SLOT(mySlots()));
qDebug()<<"timer start";
}
void timer::mySlots() //还需要加入相应的处理模块
{
QTextStream qout(stdout);
switch(eventType)
{
case 0:
qout << "\033[0;32m"+eventContent+"\033[0;0m\n";
qDebug()<<"负载增大,触发容量自配置";
// here+自优化
break;
case 1:
qout<< "\033[0;31m"+eventContent+"\033[0;0m\n";
qDebug()<<"负载减小,触发容量自配置";
break;
case 2:
qout<< "\033[0;34m"+eventContent+"\033[0;0m\n";
qDebug()<<"触发欠覆盖自优化";
break;
case 3:
qout<< "\033[0;31m"+eventContent+"\033[0;0m\n";
qDebug()<<"触发频率自配置";
break;
case 4:
qout<< "\033[0;31m"+eventContent+"\033[0;0m\n";
qDebug()<<"触发容量自配置";
break;
}
// qDebug()<<"\033[32m"+eventContent;
}
void timer::start_timer()
{
_timer->start(6000);
}