| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 | 
							- #include "ytwidget.h"
 
- #include "ui_ytwidget.h"
 
- //#define wd[8] {"","星期一","星期二","星期三","星期四","星期五","星期六","星期日"}
 
- YtWidget::YtWidget(QWidget *parent) :
 
-     QWidget(parent),
 
-     ui(new Ui::YtWidget)
 
- {
 
-     current_page = 0;
 
-     api = new Ycapi();
 
-     beepThread = new BeepThread(this,api);
 
-     beepThread->start();
 
-     wd.clear();
 
-     wd.append("");
 
-     wd.append(QString::fromUtf8("Mon"));
 
-     wd.append(QString::fromUtf8("Tus"));
 
-     wd.append(QString::fromUtf8("Wed"));
 
-     wd.append(QString::fromUtf8("Thu"));
 
-     wd.append(QString::fromUtf8("Fri"));
 
-     wd.append(QString::fromUtf8("Sat"));
 
-     wd.append(QString::fromUtf8("Sun"));
 
-     beepThread->setBeep(BeepThread::OkBeep);
 
-     title_font.setPointSize(40);
 
-     normal_font.setPointSize(32);
 
-     ui->setupUi(this);
 
-     ui->title_label->setFont(title_font);
 
-     ui->sta_label->setFont(normal_font);
 
-     ui->num_label->setFont(normal_font);
 
-     ui->normal_label->setFont(normal_font);
 
-     ui->alarm_label->setFont(normal_font);
 
-     ui->online_label->setFont(normal_font);
 
-     ui->sleep_label->setFont(normal_font);
 
-     ui->back_btn->hide();
 
-     connect(ui->last_btn,SIGNAL(clicked()),this,SLOT(page_click()));
 
-     connect(ui->next_btn,SIGNAL(clicked()),this,SLOT(page_click()));
 
-     timer = new QTimer(this);
 
-     connect(timer,SIGNAL(timeout()),this,SLOT(ui_timeout()));
 
-     ui_timeout();
 
-     timer->start(500);
 
-     show_page();
 
- }
 
- YtWidget::~YtWidget()
 
- {
 
-     delete ui;
 
- }
 
- void YtWidget::page_click()
 
- {
 
-     QToolButton *btn = (QToolButton *)sender();
 
-     if(btn==ui->last_btn)
 
-         current_page--;
 
-     else if(btn==ui->next_btn)
 
-         current_page++;
 
-     if(current_page>3)
 
-         current_page=0;
 
-     else if(current_page<0)
 
-         current_page=3;
 
-     beepThread->setBeep(BeepThread::BtnBeep);
 
-     show_page();
 
- }
 
- void YtWidget::ui_timeout()
 
- {
 
-     QDateTime dt = QDateTime::currentDateTime();
 
-     ui->time_label->setText(QString("%1 %2")
 
-                             .arg(wd.at(dt.date().dayOfWeek()%8))
 
-                             .arg(dt.toString("yyyy-MM-dd HH:mm")));
 
- }
 
- void YtWidget::show_page()
 
- {
 
-     QCursor::setPos(801,481);
 
-     ui->title_label->setText(QString::fromUtf8(""));
 
-     ui->sta_label->setText(QString::fromUtf8(""));
 
-     ui->num_label->setText(QString::fromUtf8(""));
 
-     ui->normal_label->setText(QString::fromUtf8(""));
 
-     ui->alarm_label->setText(QString::fromUtf8(""));
 
-     ui->online_label->setText(QString::fromUtf8(""));
 
-     ui->sleep_label->setText(QString::fromUtf8(""));
 
-     switch(current_page){
 
-     case 0:
 
-         ui->title_label->setText(QString::fromUtf8("火灾监控子系统"));
 
-         ui->sta_label->setText(QString::fromUtf8("状态:正常"));
 
-         ui->num_label->setText(QString::fromUtf8("监控点位数量:8"));
 
-         ui->normal_label->setText(QString::fromUtf8("正常点位数量:8"));
 
-         ui->alarm_label->setText(QString::fromUtf8("告警点位数量:0"));
 
-         ui->online_label->setText(QString::fromUtf8("在线点位数量:8"));
 
-         ui->sleep_label->setText(QString::fromUtf8("离线点位数量:0"));
 
-         break;
 
-     case 1:
 
-         ui->title_label->setText(QString::fromUtf8("电气火灾监控子系统"));
 
-         ui->sta_label->setText(QString::fromUtf8("状态:正常"));
 
-         ui->num_label->setText(QString::fromUtf8("监控点位数量:16"));
 
-         ui->normal_label->setText(QString::fromUtf8("正常点位数量:16"));
 
-         ui->alarm_label->setText(QString::fromUtf8("告警点位数量:0"));
 
-         ui->online_label->setText(QString::fromUtf8("在线点位数量:16"));
 
-         ui->sleep_label->setText(QString::fromUtf8("离线点位数量:0"));
 
-         break;
 
-     case 2:
 
-         ui->title_label->setText(QString::fromUtf8("消防水监控子系统"));
 
-         ui->sta_label->setText(QString::fromUtf8("状态:正常"));
 
-         ui->num_label->setText(QString::fromUtf8("监控点位数量:3"));
 
-         ui->normal_label->setText(QString::fromUtf8("正常点位数量:3"));
 
-         ui->alarm_label->setText(QString::fromUtf8("告警点位数量:0"));
 
-         ui->online_label->setText(QString::fromUtf8("在线点位数量:3"));
 
-         ui->sleep_label->setText(QString::fromUtf8("离线点位数量:0"));
 
-         break;
 
-     case 3:
 
-         ui->title_label->setText(QString::fromUtf8("消防电源监控子系统"));
 
-         ui->sta_label->setText(QString::fromUtf8("状态:正常"));
 
-         ui->num_label->setText(QString::fromUtf8("监控点位数量:4"));
 
-         ui->normal_label->setText(QString::fromUtf8("正常点位数量:4"));
 
-         ui->alarm_label->setText(QString::fromUtf8("告警点位数量:0"));
 
-         ui->online_label->setText(QString::fromUtf8("在线点位数量:4"));
 
-         ui->sleep_label->setText(QString::fromUtf8("离线点位数量:0"));
 
-         break;
 
-     }
 
- }
 
- void YtWidget::show_html()
 
- {
 
- }
 
 
  |