You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
1.2 KiB

#include "mainwidget.h"
#include <QApplication>
#include "mainconfig.h"
#include "httpservice.h"
#include "websocketservice.h"
#include "patientemergencyinfo.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//初始化配置文件
MainConfig::initConfig();
//初始化httpservice,并自动登录
HttpService httpService;
httpService.login(MainConfig::username,MainConfig::password);
//初始化websocket,并自动连接服务器
WebsocketService websocketService;
websocketService.connectToServer(MainConfig::wsUrl);
//创建主窗体
MainWidget w;
//绑定信号与槽
QObject::connect(&websocketService,&WebsocketService::wsConnectedStatusChanged,
&w,MainWidget::onWsConnectedStatusChanged);
QObject::connect(&websocketService,&WebsocketService::newPatientMergencyInfo,
&w,MainWidget::onNewPatientMergencyInfo);
QObject::connect(&websocketService,&WebsocketService::patientMergencyStatusChanged,
&w,MainWidget::onPatientMergencyStatusChanged);
QObject::connect(&w,&MainWidget::statusChanged,&httpService,&HttpService::updateStatus);
// w.show();
w.showFullScreen();
return a.exec();
}