1 Star 0 Fork 0

qinxude/rk3568ui

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mainscreen.cpp 63.48 KB
一键复制 编辑 原始数据 按行查看 历史
qinxude 提交于 2024-09-06 09:05 . for real 3 camera
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859
#include "mainscreen.h"
#include "mylistwidget.h"
#include "ui_mainscreen.h"
#include <QMouseEvent>
#include <QGraphicsDropShadowEffect>
#include <QPaintEvent>
#include <QEvent>
//#include <qsvggenerator.h>
#include <QStackedLayout>
#include <QPropertyAnimation>
#include <QDebug>
#include <QListWidget>
#include <QScrollArea>
MainScreen::MainScreen(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainScreen)
{
ui->setupUi(this);
m_DataDictionary = DataDictionary::GetInstance();
addAlarmLabel();
initNetworkcamera();
initTowerAnalog();
ui->WindSpeedBar->setRange(0,100);
ui->ScopeBar->setRange(0,100);
ui->HeightBar->setRange(0,100);
ui->MomentForceBar->setRange(0,100);
ui->AngleBar->setRange(0,100);
ui->WeightBar->setRange(0,100);
ui->RotationBar->setRange(0,100);
}
void MainScreen::GetSigCraneInfo()
{
m_SigCraneInfo[0].auStartAngle = m_DataDictionary->GetSignalParamData(SC_START_ANGLE_1).toUInt();
m_SigCraneInfo[0].auEndAngle = m_DataDictionary->GetSignalParamData(SC_END_ANGLE_1).toUInt();
m_SigCraneInfo[0].afStartScope = m_DataDictionary->GetSignalParamData(SC_START_SCOPE_1).toDouble();
m_SigCraneInfo[0].afEndScope = m_DataDictionary->GetSignalParamData(SC_END_SCOPE_1).toDouble();
m_SigCraneInfo[1].auStartAngle = m_DataDictionary->GetSignalParamData(SC_START_ANGLE_2).toUInt();
m_SigCraneInfo[1].auEndAngle = m_DataDictionary->GetSignalParamData(SC_END_ANGLE_2).toUInt();
m_SigCraneInfo[1].afStartScope = m_DataDictionary->GetSignalParamData(SC_START_SCOPE_2).toDouble();
m_SigCraneInfo[1].afEndScope = m_DataDictionary->GetSignalParamData(SC_END_SCOPE_2).toDouble();
m_SigCraneInfo[2].auStartAngle = m_DataDictionary->GetSignalParamData(SC_START_ANGLE_3).toUInt();
m_SigCraneInfo[2].auEndAngle = m_DataDictionary->GetSignalParamData(SC_END_ANGLE_3).toUInt();
m_SigCraneInfo[2].afStartScope = m_DataDictionary->GetSignalParamData(SC_START_SCOPE_3).toDouble();
m_SigCraneInfo[2].afEndScope = m_DataDictionary->GetSignalParamData(SC_END_SCOPE_3).toDouble();
m_SigCraneInfo[3].auStartAngle = m_DataDictionary->GetSignalParamData(SC_START_ANGLE_4).toUInt();
m_SigCraneInfo[3].auEndAngle = m_DataDictionary->GetSignalParamData(SC_END_ANGLE_4).toUInt();
m_SigCraneInfo[3].afStartScope = m_DataDictionary->GetSignalParamData(SC_START_SCOPE_4).toDouble();
m_SigCraneInfo[3].afEndScope = m_DataDictionary->GetSignalParamData(SC_END_SCOPE_4).toDouble();
m_SigCraneInfo[4].auStartAngle = m_DataDictionary->GetSignalParamData(SC_START_ANGLE_5).toUInt();
m_SigCraneInfo[4].auEndAngle = m_DataDictionary->GetSignalParamData(SC_END_ANGLE_5).toUInt();
m_SigCraneInfo[4].afStartScope = m_DataDictionary->GetSignalParamData(SC_START_SCOPE_5).toDouble();
m_SigCraneInfo[4].afEndScope = m_DataDictionary->GetSignalParamData(SC_END_SCOPE_5).toDouble();
m_SigCraneInfo[5].auStartAngle = m_DataDictionary->GetSignalParamData(SC_START_ANGLE_6).toUInt();
m_SigCraneInfo[5].auEndAngle = m_DataDictionary->GetSignalParamData(SC_END_ANGLE_6).toUInt();
m_SigCraneInfo[5].afStartScope = m_DataDictionary->GetSignalParamData(SC_START_SCOPE_6).toDouble();
m_SigCraneInfo[5].afEndScope = m_DataDictionary->GetSignalParamData(SC_END_SCOPE_6).toDouble();
m_SigCraneInfo[6].auStartAngle = m_DataDictionary->GetSignalParamData(SC_START_ANGLE_7).toUInt();
m_SigCraneInfo[6].auEndAngle = m_DataDictionary->GetSignalParamData(SC_END_ANGLE_7).toUInt();
m_SigCraneInfo[6].afStartScope = m_DataDictionary->GetSignalParamData(SC_START_SCOPE_7).toDouble();
m_SigCraneInfo[6].afEndScope = m_DataDictionary->GetSignalParamData(SC_END_SCOPE_7).toDouble();
m_SigCraneInfo[7].auStartAngle = m_DataDictionary->GetSignalParamData(SC_START_ANGLE_8).toUInt();
m_SigCraneInfo[7].auEndAngle = m_DataDictionary->GetSignalParamData(SC_END_ANGLE_8).toUInt();
m_SigCraneInfo[7].afStartScope = m_DataDictionary->GetSignalParamData(SC_START_SCOPE_8).toDouble();
m_SigCraneInfo[7].afEndScope = m_DataDictionary->GetSignalParamData(SC_END_SCOPE_8).toDouble();
}
void MainScreen::SignalParamDataChangeProcess(SignalParamDataIndex_t Index)
{
switch (Index) {
case SC_START_SCOPE_1: /** 第一组起始幅度 */
case SC_END_SCOPE_1: /** 第一组终止幅度 */
case SC_START_ANGLE_1: /** 第一组起始角度 */
case SC_END_ANGLE_1: /** 第一组终止角度 */
case SC_START_SCOPE_2: /** 第一组起始幅度 */
case SC_END_SCOPE_2: /** 第一组终止幅度 */
case SC_START_ANGLE_2: /** 第一组起始角度 */
case SC_END_ANGLE_2: /** 第一组终止角度 */
case SC_START_SCOPE_3: /** 第一组起始幅度 */
case SC_END_SCOPE_3: /** 第一组终止幅度 */
case SC_START_ANGLE_3: /** 第一组起始角度 */
case SC_END_ANGLE_3: /** 第一组终止角度 */
case SC_START_SCOPE_4: /** 第一组起始幅度 */
case SC_END_SCOPE_4: /** 第一组终止幅度 */
case SC_START_ANGLE_4: /** 第一组起始角度 */
case SC_END_ANGLE_4: /** 第一组终止角度 */
case SC_START_SCOPE_5: /** 第一组起始幅度 */
case SC_END_SCOPE_5: /** 第一组终止幅度 */
case SC_START_ANGLE_5: /** 第一组起始角度 */
case SC_END_ANGLE_5: /** 第一组终止角度 */
case SC_START_SCOPE_6: /** 第一组起始幅度 */
case SC_END_SCOPE_6: /** 第一组终止幅度 */
case SC_START_ANGLE_6: /** 第一组起始角度 */
case SC_END_ANGLE_6: /** 第一组终止角度 */
case SC_START_SCOPE_7: /** 第一组起始幅度 */
case SC_END_SCOPE_7: /** 第一组终止幅度 */
case SC_START_ANGLE_7: /** 第一组起始角度 */
case SC_END_ANGLE_7: /** 第一组终止角度 */
case SC_START_SCOPE_8: /** 第一组起始幅度 */
case SC_END_SCOPE_8: /** 第一组终止幅度 */
case SC_START_ANGLE_8: /** 第一组起始角度 */
case SC_END_ANGLE_8: /** 第一组终止角度 */
GetSigCraneInfo();
DisplayOverLook();
break;
default:
break;
}
}
void MainScreen::CheckAlarm(uint32_t Sta)
{
// if(Sta & 0x1 || Sta & 0x2)
// {
// //多机防碰撞报警
// ui->OverlookAlarm->SetAlarm();
// AlarmFlag |= ALARM_ONE;
// }
// else {
// ui->OverlookAlarm->ClearAlarm();
// }
// if()
// {
// //防碰撞报警
// ui->OverlookAlarm->SetAlarm();
// AlarmFlag |= ALARM_ONE;
// }
// else {
// ui->OverlookAlarm->ClearAlarm();
// }
// if(Sta & 0x2000000)
// {
// //起重量报警
// ui->WeightAlarm->SetAlarm();
// }
// else {
// ui->WeightAlarm->ClearAlarm();
// }
BarSet(ui->ScopeShow,ui->ScopeBar,BAR_NORMAL);
BarSet(ui->AngleShow,ui->AngleBar,BAR_NORMAL);
// BarSet(ui->CableTorsionBar,BAR_NORMAL);
BarSet(ui->MomentShow,ui->MomentForceBar,BAR_NORMAL);
BarSet(ui->WindSpeedShow,ui->WindSpeedBar,BAR_NORMAL);
BarSet(ui->HeightShow,ui->HeightBar,BAR_NORMAL);
if(Sta & 0x1 || Sta & 0x2)
{
//多机防碰撞报警
// ui->OverlookAlarm->SetAlarm();
}
else {
// ui->OverlookAlarm->ClearAlarm();
}
if(Sta & 0x1000000)
{
// ui->MomentAlarm->SetAlarm();
BarSet(ui->MomentShow,ui->MomentForceBar,BAR_ALARM);
}
else
{
// ui->MomentAlarm->ClearAlarm();
}
if(Sta & 0x100 || Sta & 0x200)
{
// ui->ScopeAlarm->SetAlarm();
BarSet(ui->ScopeShow,ui->ScopeBar,BAR_ALARM);
}
else {
// ui->ScopeAlarm->ClearAlarm();
}
if(Sta & 0x400)
{
// ui->HeightAlarm->SetAlarm();
BarSet(ui->HeightShow,ui->HeightBar,BAR_ALARM);
}
else {
// ui->HeightAlarm->ClearAlarm();
}
if(Sta & 0x1000 || Sta & 0x2000)
{
//回转左限位报警
//回转右限位报警
// ui->RotationAlarml->SetAlarm();
// BarSet(ui->CableTorsionBar,BAR_ALARM);
}
else {
// ui->RotationAlarml->ClearAlarm();
}
if(Sta & 0x20)
{
// ui->WindAlarm->SetAlarm();
BarSet(ui->WindSpeedShow,ui->WindSpeedBar,BAR_ALARM);
}
else {
// ui->WindAlarm->ClearAlarm();
}
if(Sta & 0x10000000)
{
// ui->AngleXAlarm->SetAlarm();
BarSet(ui->AngleShow,ui->AngleBar,BAR_ALARM);
}
else {
// ui->AngleXAlarm->ClearAlarm();
}
if(Sta & 0x8 || Sta & 0x4)
{
//多机防碰撞预警
// ui->OverlookAlarm->SetWarning();
}
else {
// ui->OverlookAlarm->ClearWarning();
}
// if()
// {
// //防碰撞预警
// ui->OverlookAlarm->SetWarning();
// AlarmFlag |= ALARM_ONE;
// }
// else {
// ui->OverlookAlarm->ClearWarning();
// }
// if(Sta & 0x8000000)
// {
// //起重量预警
// ui->WeightAlarm->SetWarning();
// }
// else {
// ui->WeightAlarm->ClearWarning();
// }
if(Sta & 0x4000000)
{
// ui->MomentAlarm->SetWarning();
BarSet(ui->MomentShow,ui->MomentForceBar,BAR_WARNING);
}
else {
// ui->MomentAlarm->ClearWarning();
}
if(Sta & 0x10000 || Sta & 0x20000)
{
// ui->ScopeAlarm->SetWarning();
BarSet(ui->ScopeShow,ui->ScopeBar,BAR_WARNING);
}
else {
// ui->ScopeAlarm->ClearWarning();
}
if(Sta & 0x40000)
{
// ui->HeightAlarm->SetWarning();
BarSet(ui->HeightShow,ui->HeightBar,BAR_WARNING);
}
else {
// ui->HeightAlarm->ClearWarning();
}
if(Sta & 0x4000 || Sta & 0x8000)
{
//回转左限位预警
//回转右限位预警
// ui->RotationAlarml->SetWarning();
// BarSet(ui->CableTorsionBar,BAR_WARNING);
}
else {
// ui->RotationAlarml->ClearWarning();
}
if(Sta & 0x40)
{
// ui->WindAlarm->SetWarning();
BarSet(ui->WindSpeedShow,ui->WindSpeedBar,BAR_WARNING);
}
else {
// ui->WindAlarm->ClearWarning();
}
if(Sta & 0x40000000)
{
// ui->AngleXAlarm->SetWarning();
BarSet(ui->AngleShow,ui->AngleBar,BAR_WARNING);
}
else {
// ui->AngleXAlarm->ClearWarning();
}
}
void MainScreen::DevParamDataChange(DevParamDataIndex_t Index)
{
QString V = m_DataDictionary->GetDevParamData(Index);
switch (Index) {
// case D_CUSTOM_NUMBER:
// ui->CustomNumberShow->setText(V+"#");
// m_CraneInfo[0].auiTowerId = V.toUInt();
// DisplayOverLook();
// break;
// case D_TOWER_RATIO:
// ui->RatioShow->setText(V);
// break;
// case D_DEV_ID:
// ui->DevId->setText(V);
// break;
case D_HEIGHT:
ui->m_lblTowerHeight->setText(tr("塔高(m):")+m_DataDictionary->GetDevParamData(D_HEIGHT));
SetHeightForce();
break;
case D_ARM_LENGTH: /** 臂长 */
ui->m_lblArmLen->setText(tr("臂长(m):")+m_DataDictionary->GetDevParamData(D_ARM_LENGTH));
SetScopeForce();
m_CraneInfo[0].afArmLength = m_DataDictionary->GetDevParamData(Index).toUInt();
DisplayOverLook();
break;
case D_HEIGHT_PREALARM_V: /** 高度 */
ui->m_lblHeightAlarm->setText(V+"m");
SetHeightForce();
break;
case D_SCOPE_PREALARM_V: /** 高度 */
ui->m_lblScopeAlarm->setText(V+"m");
SetScopeForce();
break;
case D_WIND_PREALARM_V: /** 高度 */
ui->m_lblWindAlarm->setText(V+"m/s");
SetWindForce();
break;
case D_ANGLE_PREALARM_V: /** 高度 */
ui->m_lblAngleAlarm->setText(V+"度");
SetAngleForce();
break;
default:
break;
}
}
void MainScreen::BarSet(QWidget* widget,QProgressBar *Bar,Sta_t s)
{
if(s == BAR_NORMAL)
{
widget->setStyleSheet("color: #02B695;font: 24pt '等线';font-weight: 700;");
Bar->setStyleSheet("QProgressBar { \
border-bottom-right-radius:5.4px;\
border-bottom-left-radius:5.4px;\
background-color: #76706F;\
}\
QProgressBar::chunk {\
border-bottom-left-radius:5.4px;\
background-color: #02B695;\
}");
}
else if(s == BAR_ALARM)
{
widget->setStyleSheet("color: #FE6240;font: 24pt '等线';font-weight: 700;");
Bar->setStyleSheet("QProgressBar { \
border-bottom-right-radius:5.4px;\
border-bottom-left-radius:5.4px;\
background-color: #76706F;\
}\
QProgressBar::chunk {\
border-bottom-left-radius:5.4px;\
background-color: #FE6240;\
}");
}
else if(s == BAR_WARNING)
{
widget->setStyleSheet("color: #F6B66E;font: 24pt '等线';font-weight: 700;");
Bar->setStyleSheet("QProgressBar { \
border-bottom-right-radius:5.4px;\
border-bottom-left-radius:5.4px;\
background-color: #76706F;\
}\
QProgressBar::chunk {\
border-bottom-left-radius:5.4px;\
background-color: #F6B66E;\
}");
}
}
void MainScreen::SetWindForce()
{
QString CurH = m_DataDictionary->GetMonitorRtData(M_WINDSPEED);
QString RateH = "24.4";
double Force = 0.0;
if(RateH.toDouble() == 0){
Force = 1;
}else {
Force = (CurH.toDouble()/RateH.toDouble());
}
//ui->HeightForceLabel->setText(QString::number(Force)+tr("%"));
ui->WindSpeedBar->setValue(Force*100);
//m_TCModel->MoveH(Force);
}
void MainScreen::SetAngleForce()
{
QString CurH = m_DataDictionary->GetMonitorRtData(M_ANGLEZ);
QString RateH = m_DataDictionary->GetDevParamData(D_ANGLE_ALARM_V);
double Force = 0.0;
if(RateH.toDouble() == 0){
Force = 1;
}else {
Force = (CurH.toDouble()/RateH.toDouble());
}
if(Force > 1)
Force = 1;
//ui->HeightForceLabel->setText(QString::number(Force)+tr("%"));
ui->AngleBar->setValue(Force*100);
//m_TCModel->MoveH(Force);
}
void MainScreen::SetWeightForce()
{
QString Data=m_DataDictionary->GetMonitorRtData(M_WEIGHT);
int v=Data.toDouble();
if(v >= 100){
ui->WeightBar->setValue(100);
}else if(v < 0){
ui->WeightBar->setValue(0);
}else{
ui->WeightBar->setValue(v);
}
}
void MainScreen::SetMomentForce()
{
QString Data=m_DataDictionary->GetMonitorRtData(M_MOMENT);
int v=Data.toDouble();
if(v >= 100){
ui->MomentForceBar->setValue(100);
}else if(v < 0){
ui->MomentForceBar->setValue(0);
}else{
ui->MomentForceBar->setValue(v);
}
}
void MainScreen::SetRotationForce()
{
QString Data=m_DataDictionary->GetMonitorRtData(M_ROTATION);
double_t v=Data.toDouble();
if(v >= 100){
ui->RotationBar->setValue(100);
}else if(v < 0){
ui->RotationBar->setValue(0);
}else{
ui->RotationBar->setValue(v);
}
}
void MainScreen::SetHeightForce()
{
QString CurH = m_DataDictionary->GetMonitorRtData(M_HEIGHT);
QString RateH = m_DataDictionary->GetDevParamData(D_HEIGHT);
double Force = 0.0;
if(RateH.toDouble() == 0){
Force = 1;
}else {
Force = (CurH.toDouble()/RateH.toDouble());
}
//ui->HeightForceLabel->setText(QString::number(Force)+tr("%"));
if(m_DataDictionary->GetMisData(MIS_HEIGHT_ZERO_POS).toUInt() == LAND_ZERO_POS)
{
Force = 1 - Force;
}
ui->HeightBar->setValue(Force*100);
// m_TCModel->MoveH(Force);
}
void MainScreen::SetScopeForce()
{
QString CurSc = m_DataDictionary->GetMonitorRtData(M_SCOPE);
QString RateSc = m_DataDictionary->GetDevParamData(D_ARM_LENGTH);
double Force = 0.0;
if(RateSc.toDouble() == 0.0){
Force = 1;
}else {
Force = (CurSc.toDouble()/RateSc.toDouble());
}
ui->ScopeBar->setValue(Force*100);
m_TowerAnalog[0]->SetScopeRate(Force);
}
void MainScreen::MonitorRtDataChange(MonitorRtDataIndex_t Index)
{
QString V = m_DataDictionary->GetMonitorRtData(Index);
switch (Index) {
case M_WEIGHT:
ui->WeightShow->setText(V);
SetWeightForce();
break;
case M_MOMENT:
ui->MomentShow->setText(V);
SetMomentForce();
break;
// case M_MOMENTFORCE:
// SetMomentForce(V);
// break;
case M_WINDSPEED:
ui->WindSpeedShow->setText(V);
// SetWindLevel(V);
// ui->WindSpeedBar->setValue(100);
SetWindForce();
break;
case M_ANGLEZ:
ui->AngleShow->setText(V);
SetAngleForce();
break;
case M_SCOPE:
ui->ScopeShow->setText(V);
SetScopeForce();
break;
case M_HEIGHT:
ui->HeightShow->setText(V);
SetHeightForce();
break;
// case M_CABLE_TORSION:
// ui->CableTorsionShow->setText(V);
// SetCableTorsionForce();
// break;
case M_ROTATION:
ui->RotationShow->setText(V);
m_TowerAnalog[0]->SetAnagle(V.toUInt());
ui->OverLook->update();
break;
case M_MUL_ID1_ROTATION:
m_TowerAnalog[1]->SetAnagle(m_DataDictionary->GetMonitorRtData(Index).toUInt());
break;
case M_MUL_ID2_ROTATION:
m_TowerAnalog[2]->SetAnagle(m_DataDictionary->GetMonitorRtData(Index).toUInt());
break;
case M_MUL_ID3_ROTATION:
m_TowerAnalog[3]->SetAnagle(m_DataDictionary->GetMonitorRtData(Index).toUInt());
break;
case M_MUL_ID4_ROTATION:
m_TowerAnalog[4]->SetAnagle(m_DataDictionary->GetMonitorRtData(Index).toUInt());
break;
case M_MUL_ID5_ROTATION:
m_TowerAnalog[5]->SetAnagle(m_DataDictionary->GetMonitorRtData(Index).toUInt());
break;
case M_MUL_ID6_ROTATION:
m_TowerAnalog[6]->SetAnagle(m_DataDictionary->GetMonitorRtData(Index).toUInt());
break;
case M_MUL_ID7_ROTATION:
m_TowerAnalog[7]->SetAnagle(m_DataDictionary->GetMonitorRtData(Index).toUInt());
break;
case M_MUL_ID8_ROTATION:
m_TowerAnalog[8]->SetAnagle(m_DataDictionary->GetMonitorRtData(Index).toUInt());
break;
case M_ALARM_STA:
{
uint32_t Sta = m_DataDictionary->GetMonitorRtData(M_ALARM_STA).toUInt();
if(m_DataDictionary->GetMisData(MIS_NEW_OR_OLD_BLKBOX).toInt() == NEW_BBOX)
{
CheckAlarm(0);
CheckAlarm(V.toUInt());
// if(m_VolumeControl->GetState() == MediaStop && \
// m_VolumeControl->GetMuteState() == false)
// {
// QString Media = GetNewAlarmSound(Sta,m_AlarmSoundList);
// if(!Media.isEmpty())
// {
// m_VolumeControl->SetMedia(Media);
// //m_VolumeControl->Play();
// }
// }
}
break;
}
case M_SENSOR_STA:
{
// uint32_t Sta = m_DataDictionary->GetMonitorRtData(M_SENSOR_STA).toUInt();
// CheckSensorSta(Sta);
}
break;
default:
break;
}
update();
}
void MainScreen::videoExitFullScreen()
{
ui->VTDisplay->setCurrentWidget(ui->page_1);
}
void MainScreen::onExitFullScreenNetworkCamera_1()
{
QWidget* parent=qobject_cast<QWidget*>(m_beforeFullScreenArea);
m_networkCameraChannel1->Show(parent,0,0);
m_networkCameraChannel1->resize(parent->size());
videoExitFullScreen();
}
void MainScreen::onExitFullScreenNetworkCamera_2()
{
QWidget* parent=qobject_cast<QWidget*>(m_beforeFullScreenArea);
m_networkCameraChannel2->Show(parent,0,0);
m_networkCameraChannel2->resize(parent->size());
videoExitFullScreen();
}
void MainScreen::onExitFullScreenNetworkCamera_3()
{
QWidget* parent=qobject_cast<QWidget*>(m_beforeFullScreenArea);
m_networkCameraChannel3->Show(parent,0,0);
m_networkCameraChannel3->resize(parent->size());
videoExitFullScreen();
}
void MainScreen::onExitFullScreenNetworkCamera_4()
{
QWidget* parent=qobject_cast<QWidget*>(m_beforeFullScreenArea);
m_networkCameraChannel4->Show(parent,0,0);
m_networkCameraChannel4->resize(parent->size());
videoExitFullScreen();
}
void MainScreen::onFullScreenNetworkCamera_1()
{
m_videoFullIndex = 1;
videoFullScreen();
}
void MainScreen::onFullScreenNetworkCamera_2()
{
m_videoFullIndex = 2;
videoFullScreen();
}
void MainScreen::onFullScreenNetworkCamera_3()
{
m_videoFullIndex = 3;
videoFullScreen();
}
void MainScreen::onFullScreenNetworkCamera_4()
{
m_videoFullIndex = 4;
videoFullScreen();
}
void MainScreen::videoFullScreen()
{
switch (m_videoFullIndex) {
case 1:
m_beforeFullScreenArea=m_networkCameraChannel1->parent();
m_networkCameraChannel1->Show(ui->FullDisplay,0,0);
m_networkCameraChannel1->resize(ui->FullDisplay->size());
break;
case 2:
m_beforeFullScreenArea=m_networkCameraChannel2->parent();
m_networkCameraChannel2->Show(ui->FullDisplay,0,0);
m_networkCameraChannel2->resize(ui->FullDisplay->size());
break;
case 3:
m_beforeFullScreenArea=m_networkCameraChannel3->parent();
m_networkCameraChannel3->Show(ui->FullDisplay,0,0);
m_networkCameraChannel3->resize(ui->FullDisplay->size());
break;
case 4:
m_beforeFullScreenArea=m_networkCameraChannel4->parent();
m_networkCameraChannel4->Show(ui->FullDisplay,0,0);
m_networkCameraChannel4->resize(ui->FullDisplay->size());
break;
default:
break;
}
ui->VTDisplay->setCurrentWidget(ui->page_2);
// m_FullScreenButton1->hide();
// m_FullScreenButton2->hide();
// m_FullScreenButton3->hide();
// m_SplitScreenButton->show();
// m_VandTButton->SetPic(VandTButton::Tower_Pic);
// m_ScreenIndex = FULL_SCREEN;
// m_TcMainScreenInfo->Show();
// ui->VTDisplay->setCurrentWidget(ui->page_2);
// m_FullScreenButton1->hide();
// m_FullScreenButton2->hide();
// m_FullScreenButton3->hide();
// m_SplitScreenButton->show();
// m_VandTButton->SetPic(VandTButton::Tower_Pic);
// m_ScreenIndex = FULL_SCREEN;
// m_TcMainScreenInfo->Show();
}
void MainScreen::mainShowNetworkCamera_4()
{
QWidget* parent=(QWidget*)m_networkCameraChannel4->parent();
if(parent==ui->MainDisplay)
{
return;
}
m_networkCameraChannel4->Show(ui->MainDisplay,0,0);
m_networkCameraChannel4->resize(ui->MainDisplay->size());
m_videoMainQWidget->Show(parent,0,0);
m_videoMainQWidget->resize(parent->size());
m_videoMainQWidget=m_networkCameraChannel4;
}
void MainScreen::mainShowNetworkCamera_1()
{
QWidget* parent=(QWidget*)m_networkCameraChannel1->parent();
if(parent==ui->MainDisplay)
{
return;
}
m_networkCameraChannel1->Show(ui->MainDisplay,0,0);
m_networkCameraChannel1->resize(ui->MainDisplay->size());
m_videoMainQWidget->Show(parent,0,0);
m_videoMainQWidget->resize(parent->size());
m_videoMainQWidget=m_networkCameraChannel1;
}
void MainScreen::mainShowNetworkCamera_2()
{
QWidget* parent=(QWidget*)m_networkCameraChannel2->parent();
if(parent==ui->MainDisplay)
{
return;
}
m_networkCameraChannel2->Show(ui->MainDisplay,0,0);
m_networkCameraChannel2->resize(ui->MainDisplay->size());
m_videoMainQWidget->Show(parent,0,0);
m_videoMainQWidget->resize(parent->size());
m_videoMainQWidget=m_networkCameraChannel2;
}
void MainScreen::mainShowNetworkCamera_3()
{
QWidget* parent=(QWidget*)m_networkCameraChannel3->parent();
if(parent==ui->MainDisplay)
{
return;
}
m_networkCameraChannel3->Show(ui->MainDisplay,0,0);
m_networkCameraChannel3->resize(ui->MainDisplay->size());
m_videoMainQWidget->Show(parent,0,0);
m_videoMainQWidget->resize(parent->size());
m_videoMainQWidget=m_networkCameraChannel3;
}
void MainScreen::initNetworkcamera()
{
avformat_network_init();
NetWorkCameraInfo netWorkCameraInfo1;
netWorkCameraInfo1.passWord = m_DataDictionary->GetSystemData(SYS_CAMERA_PASSWORD1);
netWorkCameraInfo1.userName = m_DataDictionary->GetSystemData(SYS_CAMERA_USERNAME1);
netWorkCameraInfo1.ip = m_DataDictionary->GetSystemData(SYS_CAMERA_IP1);
netWorkCameraInfo1.port = m_DataDictionary->GetSystemData(SYS_CAMERA_PORT1);
netWorkCameraInfo1.path = m_DataDictionary->GetSystemData(SYS_CAMERA_PATH);
netWorkCameraInfo1.url = m_DataDictionary->GetSystemData(SYS_CAMERA_URL1);
NetWorkCameraInfo netWorkCameraInfo2;
netWorkCameraInfo2.passWord = m_DataDictionary->GetSystemData(SYS_CAMERA_PASSWORD2);
netWorkCameraInfo2.userName = m_DataDictionary->GetSystemData(SYS_CAMERA_USERNAME2);
netWorkCameraInfo2.ip = m_DataDictionary->GetSystemData(SYS_CAMERA_IP2);
netWorkCameraInfo2.port = m_DataDictionary->GetSystemData(SYS_CAMERA_PORT2);
netWorkCameraInfo2.path = m_DataDictionary->GetSystemData(SYS_CAMERA_PATH);
netWorkCameraInfo2.url = m_DataDictionary->GetSystemData(SYS_CAMERA_URL2);
NetWorkCameraInfo netWorkCameraInfo3;
netWorkCameraInfo3.passWord = m_DataDictionary->GetSystemData(SYS_CAMERA_PASSWORD3);
netWorkCameraInfo3.userName = m_DataDictionary->GetSystemData(SYS_CAMERA_USERNAME3);
netWorkCameraInfo3.ip = m_DataDictionary->GetSystemData(SYS_CAMERA_IP3);
netWorkCameraInfo3.port = m_DataDictionary->GetSystemData(SYS_CAMERA_PORT3);
netWorkCameraInfo3.path = m_DataDictionary->GetSystemData(SYS_CAMERA_PATH);
netWorkCameraInfo3.url = m_DataDictionary->GetSystemData(SYS_CAMERA_URL3);
NetWorkCameraInfo netWorkCameraInfo4;
netWorkCameraInfo4.passWord = m_DataDictionary->GetSystemData(SYS_CAMERA_PASSWORD4);
netWorkCameraInfo4.userName = m_DataDictionary->GetSystemData(SYS_CAMERA_USERNAME4);
netWorkCameraInfo4.ip = m_DataDictionary->GetSystemData(SYS_CAMERA_IP4);
netWorkCameraInfo4.port = m_DataDictionary->GetSystemData(SYS_CAMERA_PORT4);
netWorkCameraInfo4.path = m_DataDictionary->GetSystemData(SYS_CAMERA_PATH);
netWorkCameraInfo4.url = m_DataDictionary->GetSystemData(SYS_CAMERA_URL4);
m_networkCameraChannel1= new NetWorkCameraChannel1(netWorkCameraInfo1,ui->MainDisplay);
m_networkCameraChannel2= new NetWorkCameraChannel1(netWorkCameraInfo2,ui->SubDisplay1);
m_networkCameraChannel3= new NetWorkCameraChannel1(netWorkCameraInfo3,ui->SubDisplay2);
m_videoMainQWidget=m_networkCameraChannel1;//设置主摄像头为了将来换位置用
m_networkCameraChannel1->Show(ui->MainDisplay,0,0);
m_networkCameraChannel1->resize(ui->MainDisplay->size());
m_networkCameraChannel2->Show(ui->SubDisplay1,0,0);
m_networkCameraChannel2->resize(ui->SubDisplay1->size());
m_networkCameraChannel3->Show(ui->SubDisplay2,0,0);
m_networkCameraChannel3->resize(ui->SubDisplay2->size());
connect(m_networkCameraChannel1,SIGNAL(swapScreensButtonClicked()),this,SLOT(mainShowNetworkCamera_1()));
connect(m_networkCameraChannel1,SIGNAL(fullScreenButtonClicked()),this,SLOT(onFullScreenNetworkCamera_1()));
connect(m_networkCameraChannel1,SIGNAL(exitFullScreenClicked()),this,SLOT(onExitFullScreenNetworkCamera_1()));
connect(m_networkCameraChannel2,SIGNAL(swapScreensButtonClicked()),this,SLOT(mainShowNetworkCamera_2()));
connect(m_networkCameraChannel2,SIGNAL(fullScreenButtonClicked()),this,SLOT(onFullScreenNetworkCamera_2()));
connect(m_networkCameraChannel2,SIGNAL(exitFullScreenClicked()),this,SLOT(onExitFullScreenNetworkCamera_2()));
connect(m_networkCameraChannel3,SIGNAL(swapScreensButtonClicked()),this,SLOT(mainShowNetworkCamera_3()));
connect(m_networkCameraChannel3,SIGNAL(fullScreenButtonClicked()),this,SLOT(onFullScreenNetworkCamera_3()));
connect(m_networkCameraChannel3,SIGNAL(exitFullScreenClicked()),this,SLOT(onExitFullScreenNetworkCamera_3()));
if(!netWorkCameraInfo4.ip.isEmpty())
{
m_networkCameraChannel4= new NetWorkCameraChannel1(netWorkCameraInfo1,ui->addCamera);
m_networkCameraChannel4->Show(ui->addCamera,0,0);
m_networkCameraChannel4->resize(ui->addCamera->size());
connect(m_networkCameraChannel4,SIGNAL(swapScreensButtonClicked()),this,SLOT(mainShowNetworkCamera_4()));
connect(m_networkCameraChannel4,SIGNAL(fullScreenButtonClicked()),this,SLOT(onFullScreenNetworkCamera_4()));
connect(m_networkCameraChannel4,SIGNAL(exitFullScreenClicked()),this,SLOT(onExitFullScreenNetworkCamera_4()));
ui->pushButton_10->hide();
}
ui->VTDisplay->setCurrentWidget(ui->page_1);
}
void MainScreen::mousePressEvent(QMouseEvent *event)
{
if(m_networkCameraChannel1)
{
m_networkCameraChannel1->getViewList()->hide();
}
if(m_networkCameraChannel2)
{
m_networkCameraChannel2->getViewList()->hide();
}
if(m_networkCameraChannel3)
{
m_networkCameraChannel3->getViewList()->hide();
}
if(m_networkCameraChannel4)
{
m_networkCameraChannel4->getViewList()->hide();
}
m_startPosX = event->x();
QWidget::mousePressEvent(event);
}
void MainScreen::mouseMoveEvent(QMouseEvent *event)
{
QWidget::mouseMoveEvent(event);
if(!(m_startPosX>810&&(1010<event->y())&&event->y()<1430))
{
return;
}
// 鼠标移动事件
m_curPosX = event->x();
int delta = m_curPosX - m_startPosX; // 计算位移差
if (delta > 30)
{
// 向右翻页操作
int currentIndex = m_stackedLayout->currentIndex();
if (currentIndex > 0) {
QWidget *currentWidget = m_stackedLayout->currentWidget();
QWidget *prevWidget = m_stackedLayout->widget(currentIndex - 1);
QPropertyAnimation *animation = new QPropertyAnimation(currentWidget, "pos");
animation->setDuration(500);
animation->setStartValue(QPoint(820, 1140));
animation->setEndValue(QPoint(1050, 1140));
animation->start(QAbstractAnimation::DeleteWhenStopped);
m_stackedLayout->setCurrentWidget(prevWidget);
prevWidget->setGeometry(590, 1140, 230, 270);
QPropertyAnimation *animation2 = new QPropertyAnimation(prevWidget, "pos");
animation2->setDuration(500);
animation2->setStartValue(QPoint(590, 1140));
animation2->setEndValue(QPoint(820, 1140));
animation2->start(QAbstractAnimation::DeleteWhenStopped);
m_startPosX = m_curPosX;
}
}
else if (delta < -30)
{
// 向左翻页操作
int currentIndex = m_stackedLayout->currentIndex();
if (currentIndex < m_stackedLayout->count() - 1) {
QWidget *currentWidget = m_stackedLayout->currentWidget();
QWidget *nextWidget = m_stackedLayout->widget(currentIndex + 1);
QPropertyAnimation *animation = new QPropertyAnimation(currentWidget, "pos");
animation->setDuration(500);
animation->setStartValue(QPoint(820, 1140));
animation->setEndValue(QPoint(590, 1140));
animation->start(QAbstractAnimation::DeleteWhenStopped);
m_stackedLayout->setCurrentWidget(nextWidget);
nextWidget->setGeometry(1050, 1140, 230, 270);
QPropertyAnimation *animation2 = new QPropertyAnimation(nextWidget, "pos");
animation2->setDuration(500);
animation2->setStartValue(QPoint(1050, 1140));
animation2->setEndValue(QPoint(820, 1140));
animation2->start(QAbstractAnimation::DeleteWhenStopped);
m_startPosX = m_curPosX;
}
}
}
void MainScreen::mouseReleaseEvent(QMouseEvent *event)
{
QWidget::mouseReleaseEvent(event);
if(!(m_startPosX>810&&(1010<event->y())&&event->y()<1430))
{
return;
}
int currentIndex = m_stackedLayout->currentIndex();
if(currentIndex==0)
{
ui->label_54->setGeometry(890,1390,45,8);
ui->label_75->setGeometry(940,1390,15,8);
ui->label_77->setGeometry(960,1390,15,8);
ui->label_54->setStyleSheet("QLabel{background-color: #69ACFF; border-radius: 4px;}");
ui->label_75->setStyleSheet("QLabel{background-color: #3B6BA6; border-radius: 4px;}");
ui->label_77->setStyleSheet("QLabel{background-color: #3B6BA6; border-radius: 4px;}");
}
if(currentIndex==1)
{
ui->label_54->setGeometry(890,1390,15,8);
ui->label_75->setGeometry(910,1390,45,8);
ui->label_77->setGeometry(960,1390,15,8);
ui->label_54->setStyleSheet("QLabel{background-color: #3B6BA6; border-radius: 4px;}");
ui->label_75->setStyleSheet("QLabel{background-color: #69ACFF; border-radius: 4px;}");
ui->label_77->setStyleSheet("QLabel{background-color: #3B6BA6; border-radius: 4px;}");
}
if(currentIndex==2)
{
ui->label_54->setGeometry(890,1390,15,8);
ui->label_75->setGeometry(910,1390,15,8);
ui->label_77->setGeometry(930,1390,45,8);
ui->label_54->setStyleSheet("QLabel{background-color: #3B6BA6; border-radius: 4px;}");
ui->label_75->setStyleSheet("QLabel{background-color: #3B6BA6; border-radius: 4px;}");
ui->label_77->setStyleSheet("QLabel{background-color: #69ACFF; border-radius: 4px;}");
}
// 鼠标释放事件
m_startPosX = 0;
m_curPosX = 0;
}
void MainScreen::dragMoveEvent(QDragMoveEvent *event)
{
// 鼠标释放事件
// m_startPosX = 0;
// m_curPosX = 0;
}
/*主界面1*/
void MainScreen::InitHomePage1()
{
Home_Page_1 = new MyListWidget(this);
Home_Page_1->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Home_Page_1->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Home_Page_1->setGeometry(QRect(815,1140,250,271));
Home_Page_1->setWrapping(true); //自动换行
Home_Page_1->setFlow(QListView::LeftToRight);
Home_Page_1->setStyleSheet("QListWidget{background:transparent;border:none;}"
"QListWidget::item{width:100px;height:30px;background:transparent;"
"border:none;margin-left:13px;margin-bottom:20px;}"
);
for (int count = 0; count < 4; ++count) {
QLabel* label_1 = new QLabel(this);
label_1->setMouseTracking(true);
label_1->setText("倾斜预警");
label_1->setStyleSheet("font: 25px '等线';color: #F6B66E;");
QListWidgetItem *pitem1 = new QListWidgetItem(Home_Page_1);
Home_Page_1->setItemWidget(pitem1,label_1);
}
for (int count = 0; count < 6; ++count) {
QLabel* label_1 = new QLabel(this);
label_1->setMouseTracking(true);
label_1->setText("倾斜预警");
label_1->setStyleSheet("font: 25px '等线';color: #FE6240;");
QListWidgetItem *pitem1 = new QListWidgetItem(Home_Page_1);
Home_Page_1->setItemWidget(pitem1,label_1);
}
}
/*主界面2*/
void MainScreen::InitHomePage2()
{
Home_Page_2 = new MyListWidget(this);
Home_Page_2->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Home_Page_2->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Home_Page_2->setGeometry(QRect(815,1140,250,270));
Home_Page_2->setWrapping(true); //自动换行
Home_Page_2->setFlow(QListView::LeftToRight);
Home_Page_2->setStyleSheet("QListWidget{background:transparent;border:none;}"
"QListWidget::item{width:100px;height:30px;background:transparent;"
"border:none;margin-left:13px;margin-bottom:20px;}"
);
for (int count = 0; count < 4; ++count) {
QLabel* label_1 = new QLabel(this);
label_1->setMouseTracking(true);
label_1->setText("风速预警");
label_1->setStyleSheet("font: 25px '等线';color: #F6B66E;");
QListWidgetItem *pitem1 = new QListWidgetItem(Home_Page_2);
Home_Page_2->setItemWidget(pitem1,label_1);
}
}
/*主界面3*/
void MainScreen::InitHomePage3()
{
Home_Page_3 = new MyListWidget(this);
Home_Page_3->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Home_Page_3->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Home_Page_3->setGeometry(QRect(815,1140,250,271));
Home_Page_3->setWrapping(true); //自动换行
Home_Page_3->setFlow(QListView::LeftToRight);
Home_Page_3->setStyleSheet("QListWidget{background:transparent;border:none;}"
"QListWidget::item{width:100px;height:30px;background:transparent;"
"border:none;margin-left:13px;margin-bottom:20px;}"
);
for (int count = 0; count < 2; ++count) {
QLabel* label_1 = new QLabel(this);
label_1->setMouseTracking(true);
label_1->setText("力矩预警");
label_1->setStyleSheet("font: 25px '等线';color: #F6B66E;");
QListWidgetItem *pitem1 = new QListWidgetItem(Home_Page_3);
Home_Page_3->setItemWidget(pitem1,label_1);
}
}
void MainScreen::addAlarmLabel()
{
m_stackedLayout = new QStackedLayout;
InitHomePage1();
InitHomePage2();
InitHomePage3();
m_stackedLayout->addWidget(Home_Page_1);
m_stackedLayout->addWidget(Home_Page_2);
m_stackedLayout->addWidget(Home_Page_3);
QVBoxLayout *pLayout = new QVBoxLayout(ui->stackedWidget);
pLayout->addLayout(m_stackedLayout);
ui->stackedWidget->setLayout(pLayout);
}
MainScreen::~MainScreen()
{
avformat_network_deinit();
delete ui;
}
void MainScreen::on_pushButton_3_clicked()
{
m_tip=new QLabel(this);
m_tip->setWindowFlags(Qt::FramelessWindowHint);
m_tip->setGeometry(173,803,110,59);
m_tip->setText("基础监测");
m_tip->setAlignment(Qt::AlignHCenter);
m_tip->setStyleSheet("border-image:url(:/image/tip.png);width:200px;weight:100px;"
"color: rgb(203, 231, 255);"
"padding: 17px 20px 0px 20px;"
"font: 11pt '等线';"
"font-size:23;");
m_tip->show();
}
void MainScreen::initTowerAnalog()
{
for(int i = 0;i < 9;i++)
{
if(i != 0)
{
m_TowerAnalog[i] = new TowerAnalog(ui->OverLook,true);
}
else
{
m_TowerAnalog[i] = new TowerAnalog(ui->OverLook);
}
m_TowerAnalog[i]->hide();
memset(&m_CraneInfo[i],0x0,sizeof(m_CraneInfo[i]));
}
m_TowerAnalog[0]->SetScopeEnable(true);
testGetMultipCraneInfo();
DisplayOverLook();
}
void MainScreen::DisplayOverLook()
{
double ShowScreenW = ui->OverLook->width()-2;
double ShowScreenH = ui->OverLook->height()-2;
double ShowMaxSize = (ShowScreenH > ShowScreenW) ? ShowScreenW : ShowScreenH;
double Ratio = ShowMaxSize;
double RatioTmp = 0;
for(int i = 1;i < 9;i++)
{
m_CraneInfo[i].auiShowX = 0;
m_CraneInfo[i].auiShowY = 0;
m_CraneInfo[i].afShowArmLength = 0;
if(m_CraneInfo[i].afRelativeDistance == 0 || \
m_CraneInfo[i].auiDevId == 0 || \
m_CraneInfo[0].afArmLength == 0)
{
continue;
}
else if(m_CraneInfo[i].afRelativeDistance > (m_CraneInfo[0].afArmLength + m_CraneInfo[i].afArmLength))
{
continue;
}
else
{
RatioTmp = ShowMaxSize/2.5/(m_CraneInfo[i].afRelativeDistance + m_CraneInfo[i].afArmLength);
if(Ratio > RatioTmp)
Ratio = RatioTmp;
}
}
if(Ratio >= ShowMaxSize)
{
m_CraneInfo[0].afShowArmLength = ShowMaxSize/2.5;
m_CraneInfo[0].auiShowX = ShowScreenW/2 - m_CraneInfo[0].afShowArmLength;
m_CraneInfo[0].auiShowY = ShowScreenH/2 - m_CraneInfo[0].afShowArmLength;
}
else
{
m_CraneInfo[0].auiShowX = ShowScreenW/2 - m_CraneInfo[0].afArmLength*Ratio;
m_CraneInfo[0].auiShowY = ShowScreenH/2 - m_CraneInfo[0].afArmLength*Ratio;
m_CraneInfo[0].afShowArmLength = m_CraneInfo[0].afArmLength*Ratio;
for(int i = 1;i < 9;i++)
{
if(m_CraneInfo[i].afRelativeDistance == 0 || \
m_CraneInfo[i].auiDevId == 0 || \
m_CraneInfo[0].afArmLength == 0)
{
continue;
}
else if(m_CraneInfo[i].afRelativeDistance > (m_CraneInfo[0].afArmLength + m_CraneInfo[i].afArmLength))
{
continue;
}
else
{
m_CraneInfo[i].auiShowX = ShowScreenW/2 + (m_CraneInfo[i].afRelativeDistance*Ratio*qSin(qDegreesToRadians((double)m_CraneInfo[i].auiRelativeAngle))) - m_CraneInfo[i].afArmLength*Ratio;
m_CraneInfo[i].auiShowY = ShowScreenH/2 - (m_CraneInfo[i].afRelativeDistance*Ratio*qCos(qDegreesToRadians((double)m_CraneInfo[i].auiRelativeAngle))) - m_CraneInfo[i].afArmLength*Ratio;
m_CraneInfo[i].afShowArmLength = m_CraneInfo[i].afArmLength*Ratio;
}
}
}
for(int i = 0;i < 9;i++)
{
if(m_CraneInfo[i].afShowArmLength != 0)
{
m_TowerAnalog[i]->SetRadius(m_CraneInfo[i].afShowArmLength,5);
m_TowerAnalog[i]->SetLineLen(m_CraneInfo[i].afShowArmLength,4);
m_TowerAnalog[i]->SetId(QString::number(m_CraneInfo[i].auiTowerId));
m_TowerAnalog[i]->move(m_CraneInfo[i].auiShowX,m_CraneInfo[i].auiShowY);
m_TowerAnalog[i]->show();
}
else
{
m_TowerAnalog[i]->hide();
}
}
for(int i = 0;i < 8;i++)
{
if(m_SigCraneInfo[i].afStartScope <= 0)
{
m_SigCraneInfo[i].afShowStartScope = 0;
}
else
{
m_SigCraneInfo[i].afShowStartScope = m_SigCraneInfo[i].afStartScope/m_CraneInfo[0].afArmLength*m_CraneInfo[0].afShowArmLength;
}
if( m_SigCraneInfo[i].afEndScope <= 0)
{
m_SigCraneInfo[i].afShowEndScope = 0;
}
else
{
m_SigCraneInfo[i].afShowEndScope = m_SigCraneInfo[i].afEndScope/m_CraneInfo[0].afArmLength*m_CraneInfo[0].afShowArmLength;
}
m_TowerAnalog[0]->CalDangerZone(i,m_SigCraneInfo[i].auStartAngle,m_SigCraneInfo[i].auEndAngle,
m_SigCraneInfo[i].afShowStartScope,m_SigCraneInfo[i].afShowEndScope);
}
ui->OverLook->update();
}
void MainScreen::Display()
{
ui->m_lblTowerHeight->setText(tr("塔高(m):")+m_DataDictionary->GetDevParamData(D_HEIGHT));
ui->m_lblArmLen->setText(tr("臂长(m):")+m_DataDictionary->GetDevParamData(D_ARM_LENGTH));
ui->WeightShow->setText(m_DataDictionary->GetMonitorRtData(M_WEIGHT));
ui->RotationShow->setText(m_DataDictionary->GetMonitorRtData(M_ROTATION));
ui->ScopeShow->setText(m_DataDictionary->GetMonitorRtData(M_SCOPE));
ui->HeightShow->setText(m_DataDictionary->GetMonitorRtData(M_HEIGHT));
ui->WindSpeedShow->setText(m_DataDictionary->GetMonitorRtData(M_WINDSPEED));
ui->AngleShow->setText(m_DataDictionary->GetMonitorRtData(M_ANGLEX));
ui->MomentShow->setText(m_DataDictionary->GetMonitorRtData(M_MOMENT));
ui->m_lblHeightAlarm->setText(m_DataDictionary->GetDevParamData(D_HEIGHT_PREALARM_V)+tr("m"));
ui->m_lblWindAlarm->setText(m_DataDictionary->GetDevParamData(D_WIND_PREALARM_V)+tr("m/s"));
ui->m_lblAngleAlarm->setText(m_DataDictionary->GetDevParamData(D_ANGLE_PREALARM_V)+tr("度"));
ui->m_lblScopeAlarm->setText(m_DataDictionary->GetDevParamData(D_SCOPE_PREALARM_V)+tr("m"));
// ui->m_lblMomentAlarm->setText(m_DataDictionary->GetDevParamData(D_SCOPE_PREALARM_V)+tr("m"));
// ui->ArmHeightShow->setText(m_DataDictionary->GetDevParamData(D_HEIGHT)+tr("M"));
// ui->RatioShow->setText(m_DataDictionary->GetDevParamData(D_TOWER_RATIO));
// ui->ArmLenShow->setText(m_DataDictionary->GetDevParamData(D_ARM_LENGTH)+tr("M"));
// ui->DevId->setText(m_DataDictionary->GetDevParamData(D_DEV_ID));
// ui->CustomNumberShow->setText(m_DataDictionary->GetDevParamData(D_CUSTOM_NUMBER)+tr("#"));
// ui->CableTorsionShow->setText(m_DataDictionary->GetMonitorRtData(M_CABLE_TORSION));
// SetMomentForce(m_DataDictionary->GetMonitorRtData(M_MOMENTFORCE));
SetScopeForce();
SetHeightForce();
SetWeightForce();
SetWindForce();
SetAngleForce();
SetMomentForce();
SetRotationForce();
// SetCableTorsionForce();
// SetRtHeightDisplay();
// ui->HeightRtDisplay->setText(m_DataDictionary->GetMonitorRtData(M_HEIGHT)+tr("m"));
// ui->WeightRtDisplay->setText(m_DataDictionary->GetMonitorRtData(M_WEIGHT)+tr("t"));
// MisDataChangeProcess(MIS_SERIAL_STA);
// m_TowerAnalog[0]->SetId(m_DataDictionary->GetDevParamData(D_TOWER_ID));
GetSigCraneInfo();
// GetMultipCraneInfo();
DisplayOverLook();
update();
}
void MainScreen::showEvent(QShowEvent *event)
{
// m_VolumeControl->hide();
// ToolBar::GetInstance()->Show(this);
// BottomToolBar::GetInstance()->Show(this);
// BottomToolBar::GetInstance()->move(0,1859);
// if(m_DataDictionary->GetMisData(MIS_ALIGN_STA).toUInt() == ALIGN_DISABLE){
// m_DataDictionary->SetMisData(MIS_ALIGN_STA,ALIGN_ENABLE);
// }
// if(!m_FaceIdTimeout->isHidden())
// {
// m_FaceIdTimeout->move(0,0);
// m_FaceIdTimeout->raise();
// m_FaceIdTimeout->setWindowFlags(Qt::WindowStaysOnTopHint);
// }
// if(m_ScreenIndex == FULL_SCREEN)
// {
// VoideFullScreen();
// }
// else if(m_ScreenIndex == SPLIT_SCREEN){
// VoideSplitScreen();
// }
// else if(m_ScreenIndex == TOWER_SCREEN)
// {
// TowerScreen();
// }
// VoideSplitScreen();
// if(ToolBar::GetInstance()->GetLockScreenSta() == ToolBar::SCREEN_LOCK)
// {
// LockScreen(true);
// }
// else
// {
// LockScreen(false);
// }
// ui->Ipshow->setText(getIPAddress());
Display();
// m_Timer->start();
// m_AlarmTimer->start();
connect(m_DataDictionary,SIGNAL(MonitorRtDataChange(MonitorRtDataIndex_t)),\
this,SLOT(MonitorRtDataChange(MonitorRtDataIndex_t)));
connect(m_DataDictionary,SIGNAL(DevParamDataChange(DevParamDataIndex_t)),\
this,SLOT(DevParamDataChange(DevParamDataIndex_t)));
// connect(m_DataDictionary,SIGNAL(MultipleParamDataChange(MultipleParamDataIndex_t)),
// this,SLOT(MultipleParamDataChangeProcess(MultipleParamDataIndex_t)));
connect(m_DataDictionary,SIGNAL(SignalParamDataChange(SignalParamDataIndex_t)),
this,SLOT(SignalParamDataChangeProcess(SignalParamDataIndex_t)));
// connect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
// this,SLOT(MisDataChange(MisDataIndex_t)));
}
void MainScreen::testGetMultipCraneInfo()
{
m_CraneInfo[0].auiDevId = 1;
m_CraneInfo[0].auiTowerId = 1;
m_CraneInfo[0].afArmLength = 20;
m_CraneInfo[0].auiRelativeAngle = 0;
m_CraneInfo[0].afRelativeDistance = 35;
m_CraneInfo[0].auiCurrentAngle = 0;
m_CraneInfo[1].auiDevId = 2;
m_CraneInfo[1].auiTowerId = 2;
m_CraneInfo[1].afArmLength = 20;
m_CraneInfo[1].auiRelativeAngle = 0;
m_CraneInfo[1].afRelativeDistance = 35;
m_CraneInfo[1].auiCurrentAngle = 0;
m_CraneInfo[2].auiDevId = 3;
m_CraneInfo[2].auiTowerId = 3;
m_CraneInfo[2].afArmLength = 20;
m_CraneInfo[2].auiRelativeAngle = 90;
m_CraneInfo[2].afRelativeDistance = 35;
m_CraneInfo[2].auiCurrentAngle = 0;
m_CraneInfo[3].auiDevId = 4;
m_CraneInfo[3].auiTowerId = 4;
m_CraneInfo[3].afArmLength = 20;
m_CraneInfo[3].auiRelativeAngle = 180;
m_CraneInfo[3].afRelativeDistance = 35;
m_CraneInfo[3].auiCurrentAngle = 0;
m_CraneInfo[4].auiDevId = 5;
m_CraneInfo[4].auiTowerId = 5;
m_CraneInfo[4].afArmLength = 20;
m_CraneInfo[4].auiRelativeAngle = 270;
m_CraneInfo[4].afRelativeDistance = 35;
m_CraneInfo[4].auiCurrentAngle = 0;
}
#ifdef TEST3568
//void MainScreen::hideEvent(QHideEvent *event)
//{
// m_Timer->stop();
// m_AlarmTimer->stop();
// disconnect(m_DataDictionary,SIGNAL(MonitorRtDataChange(MonitorRtDataIndex_t)),\
// this,SLOT(MonitorRtDataChange(MonitorRtDataIndex_t)));
// disconnect(m_DataDictionary,SIGNAL(DevParamDataChange(DevParamDataIndex_t)),\
// this,SLOT(DevParamDataChange(DevParamDataIndex_t)));
// disconnect(m_DataDictionary,SIGNAL(MultipleParamDataChange(MultipleParamDataIndex_t)),
// this,SLOT(MultipleParamDataChangeProcess(MultipleParamDataIndex_t)));
// disconnect(m_DataDictionary,SIGNAL(SignalParamDataChange(SignalParamDataIndex_t)),
// this,SLOT(SignalParamDataChangeProcess(SignalParamDataIndex_t)));
// disconnect(m_DataDictionary,SIGNAL(MisDataChange(MisDataIndex_t)),
// this,SLOT(MisDataChange(MisDataIndex_t)));
//}
void MainScreen::LockScreen(bool S)
{
// if(S)
// {
//// m_ShieldClick->move(0,110);
//// m_ShieldClick->show();
// }
// else
// {
//// m_ShieldClick->hide();
// }
}
//void MainScreen::GetMultipCraneInfo()
//{
// m_CraneInfo[0].auiDevId = m_DataDictionary->GetDevParamData(D_DEV_ID).toUInt();
// m_CraneInfo[0].auiTowerId = m_DataDictionary->GetDevParamData(D_CUSTOM_NUMBER).toUInt();
// m_CraneInfo[0].afArmLength = m_DataDictionary->GetDevParamData(D_ARM_LENGTH).toDouble();
// m_CraneInfo[0].auiRelativeAngle = 0;
// m_CraneInfo[0].afRelativeDistance = 0;
// m_CraneInfo[0].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_ROTATION).toUInt();
// m_CraneInfo[1].auiDevId = m_DataDictionary->GetMultipleParamData(MC_DEVID_1).toUInt();
// m_CraneInfo[1].auiTowerId = m_DataDictionary->GetMultipleParamData(MC_TOWER_ID_1).toUInt();
// m_CraneInfo[1].afArmLength = m_DataDictionary->GetMultipleParamData(MC_ARM_LENGTH_1).toDouble();
// m_CraneInfo[1].auiRelativeAngle = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_ANGLE_1).toUInt();
// m_CraneInfo[1].afRelativeDistance = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_DISTANCE_1).toDouble();
// m_CraneInfo[1].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_MUL_ID1_ROTATION).toUInt();
// m_CraneInfo[2].auiDevId = m_DataDictionary->GetMultipleParamData(MC_DEVID_2).toUInt();
// m_CraneInfo[2].auiTowerId = m_DataDictionary->GetMultipleParamData(MC_TOWER_ID_2).toUInt();
// m_CraneInfo[2].afArmLength = m_DataDictionary->GetMultipleParamData(MC_ARM_LENGTH_2).toDouble();
// m_CraneInfo[2].auiRelativeAngle = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_ANGLE_2).toUInt();
// m_CraneInfo[2].afRelativeDistance = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_DISTANCE_2).toDouble();
// m_CraneInfo[2].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_MUL_ID2_ROTATION).toUInt();
// m_CraneInfo[3].auiDevId = m_DataDictionary->GetMultipleParamData(MC_DEVID_3).toUInt();
// m_CraneInfo[3].auiTowerId = m_DataDictionary->GetMultipleParamData(MC_TOWER_ID_3).toUInt();
// m_CraneInfo[3].afArmLength = m_DataDictionary->GetMultipleParamData(MC_ARM_LENGTH_3).toDouble();
// m_CraneInfo[3].auiRelativeAngle = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_ANGLE_3).toUInt();
// m_CraneInfo[3].afRelativeDistance = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_DISTANCE_3).toDouble();
// m_CraneInfo[3].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_MUL_ID3_ROTATION).toUInt();
// m_CraneInfo[4].auiDevId = m_DataDictionary->GetMultipleParamData(MC_DEVID_4).toUInt();
// m_CraneInfo[4].auiTowerId = m_DataDictionary->GetMultipleParamData(MC_TOWER_ID_4).toUInt();
// m_CraneInfo[4].afArmLength = m_DataDictionary->GetMultipleParamData(MC_ARM_LENGTH_4).toDouble();
// m_CraneInfo[4].auiRelativeAngle = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_ANGLE_4).toUInt();
// m_CraneInfo[4].afRelativeDistance = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_DISTANCE_4).toDouble();
// m_CraneInfo[4].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_MUL_ID4_ROTATION).toUInt();
// m_CraneInfo[5].auiDevId = m_DataDictionary->GetMultipleParamData(MC_DEVID_5).toUInt();
// m_CraneInfo[5].auiTowerId = m_DataDictionary->GetMultipleParamData(MC_TOWER_ID_5).toUInt();
// m_CraneInfo[5].afArmLength = m_DataDictionary->GetMultipleParamData(MC_ARM_LENGTH_5).toDouble();
// m_CraneInfo[5].auiRelativeAngle = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_ANGLE_5).toUInt();
// m_CraneInfo[5].afRelativeDistance = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_DISTANCE_5).toDouble();
// m_CraneInfo[5].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_MUL_ID5_ROTATION).toUInt();
// m_CraneInfo[6].auiDevId = m_DataDictionary->GetMultipleParamData(MC_DEVID_6).toUInt();
// m_CraneInfo[6].auiTowerId = m_DataDictionary->GetMultipleParamData(MC_TOWER_ID_6).toUInt();
// m_CraneInfo[6].afArmLength = m_DataDictionary->GetMultipleParamData(MC_ARM_LENGTH_6).toDouble();
// m_CraneInfo[6].auiRelativeAngle = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_ANGLE_6).toUInt();
// m_CraneInfo[6].afRelativeDistance = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_DISTANCE_6).toDouble();
// m_CraneInfo[6].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_MUL_ID6_ROTATION).toUInt();
// m_CraneInfo[7].auiDevId = m_DataDictionary->GetMultipleParamData(MC_DEVID_7).toUInt();
// m_CraneInfo[7].auiTowerId = m_DataDictionary->GetMultipleParamData(MC_TOWER_ID_7).toUInt();
// m_CraneInfo[7].afArmLength = m_DataDictionary->GetMultipleParamData(MC_ARM_LENGTH_7).toDouble();
// m_CraneInfo[7].auiRelativeAngle = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_ANGLE_7).toUInt();
// m_CraneInfo[7].afRelativeDistance = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_DISTANCE_7).toDouble();
// m_CraneInfo[7].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_MUL_ID7_ROTATION).toUInt();
// m_CraneInfo[8].auiDevId = m_DataDictionary->GetMultipleParamData(MC_DEVID_8).toUInt();
// m_CraneInfo[8].auiTowerId = m_DataDictionary->GetMultipleParamData(MC_TOWER_ID_8).toUInt();
// m_CraneInfo[8].afArmLength = m_DataDictionary->GetMultipleParamData(MC_ARM_LENGTH_8).toDouble();
// m_CraneInfo[8].auiRelativeAngle = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_ANGLE_8).toUInt();
// m_CraneInfo[8].afRelativeDistance = m_DataDictionary->GetMultipleParamData(MC_RELATIVE_DISTANCE_8).toDouble();
// m_CraneInfo[8].auiCurrentAngle = m_DataDictionary->GetMonitorRtData(M_MUL_ID8_ROTATION).toUInt();
//}
void MainScreen::SetCableTorsionForce()
{
// QString CurH = m_DataDictionary->GetMonitorRtData(M_CABLE_TORSION);
// //QString RateH = m_DataDictionary->GetDevParamData(D_CABLE_TORSION);
// double Force = 0.0;
// if(CurH.toShort() >= 0){
// Force = CurH.toShort()/540.0;
// }else {
// Force = (CurH.toShort()*(-1))/540.0;
// }
// if(Force > 1)
// Force = 1;
// //ui->HeightForceLabel->setText(QString::number(Force)+tr("%"));
// ui->CableTorsionBar->setValue(Force*100);
// //m_TCModel->MoveH(Force);
}
void MainScreen::VoideSplitScreen()
{
// m_NetWorkCameraChannel1->Show(ui->MainDisplay,0,0);
// m_NetWorkCameraChannel1->resize(ui->MainDisplay->size());
// m_networkCameraChannel2->Show(ui->SubDisplay1,0,0);
// m_networkCameraChannel2->resize(ui->SubDisplay1->size());
// m_networkCameraChannel3->Show(ui->SubDisplay2,0,0);
// m_networkCameraChannel3->resize(ui->SubDisplay2->size());
// ui->VTDisplay->setCurrentWidget(ui->page_1);
// m_FullScreenButton1->show();
// m_FullScreenButton2->show();
// m_FullScreenButton3->show();
// m_SplitScreenButton->hide();
// m_VandTButton->SetPic(VandTButton::Tower_Pic);
// m_ScreenIndex = SPLIT_SCREEN;
// m_TcMainScreenInfo->Show();
}
void MainScreen::TowerScreen()
{
// ui->VTDisplay->setCurrentWidget(ui->page);
// m_VandTButton->SetPic(VandTButton::Video_Pic);
// m_FullScreenButton1->hide();
// m_FullScreenButton2->hide();
// m_FullScreenButton3->hide();
// m_SplitScreenButton->hide();
// m_ScreenIndex = TOWER_SCREEN;
// m_TcMainScreenInfo->hide();
}
void MainScreen::MultipleParamDataChangeProcess(MultipleParamDataIndex_t Index)
{
switch (Index) {
case MC_DEVID_1:
case MC_ARM_LENGTH_1: /** 第一组臂长 */
case MC_RELATIVE_DISTANCE_1: /** 第一组相对距离 */
case MC_RELATIVE_ANGLE_1: /** 第一组相对角度 */
case MC_TOWER_ID_1:
case MC_DEVID_2: /** 第二组设备号 */
case MC_ARM_LENGTH_2: /** 第二组臂长 */
case MC_RELATIVE_DISTANCE_2: /** 第二组相对距离 */
case MC_RELATIVE_ANGLE_2: /** 第二组相对角度 */
case MC_TOWER_ID_2:
case MC_DEVID_3: /** 第三组设备号 */
case MC_ARM_LENGTH_3: /** 第三组臂长 */
case MC_RELATIVE_DISTANCE_3: /** 第三组相对距离 */
case MC_RELATIVE_ANGLE_3: /** 第三组相对角度 */
case MC_TOWER_ID_3:
case MC_DEVID_4: /** 第四组设备号 */
case MC_ARM_LENGTH_4: /** 第四组臂长 */
case MC_RELATIVE_DISTANCE_4: /** 第四组相对距离 */
case MC_RELATIVE_ANGLE_4: /** 第四组相对角度 */
case MC_TOWER_ID_4:
case MC_DEVID_5 : /** 第五组设备号 */
case MC_ARM_LENGTH_5: /** 第五组臂长 */
case MC_RELATIVE_DISTANCE_5: /** 第五组相对距离 */
case MC_RELATIVE_ANGLE_5: /** 第五组相对角度 */
case MC_TOWER_ID_5:
case MC_DEVID_6: /** 第六组设备号 */
case MC_ARM_LENGTH_6: /** 第六组臂长 */
case MC_RELATIVE_DISTANCE_6: /** 第六组相对距离 */
case MC_RELATIVE_ANGLE_6: /** 第六组相对角度 */
case MC_TOWER_ID_6:
case MC_DEVID_7: /** 第七组设备号 */
case MC_ARM_LENGTH_7: /** 第七组臂长 */
case MC_RELATIVE_DISTANCE_7: /** 第七组相对距离 */
case MC_RELATIVE_ANGLE_7: /** 第七组相对角度 */
case MC_TOWER_ID_7:
case MC_DEVID_8: /** 第八组设备号 */
case MC_ARM_LENGTH_8: /** 第八组臂长 */
case MC_RELATIVE_DISTANCE_8: /** 第八组相对距离 */
case MC_RELATIVE_ANGLE_8: /** 第八组相对角度 */
case MC_TOWER_ID_8:
// GetMultipCraneInfo();
// DisplayOverLook();
break;
default:
break;
}
}
void MainScreen::MisDataChange(MisDataIndex_t Index)
{
// switch (Index) {
// case MIS_FACEID_INFO:
// if(m_DataDictionary->GetMisData(Index).toUInt() == 2 && \
// m_FaceIdTimeout->isHidden())
// {
// m_FaceIdTimeout->show();
// m_FaceIdTimeout->move(0,0);
// m_FaceIdTimeout->raise();
// m_FaceIdTimeout->setWindowFlags(Qt::WindowStaysOnTopHint);
// }
// break;
// }
}
void MainScreen::VolumeControlShow()
{
// if(m_VolumeControl->isHidden())
// {
// m_VolumeControl->show();
// }
// else
// {
// m_VolumeControl->hide();
// }
}
void MainScreen::VandTClicked()
{
// if(m_VandTButton->GetPic() == VandTButton::Tower_Pic)
// {
// TowerScreen();
// m_VandTButton->SetPic(VandTButton::Video_Pic);
// }
// else if(m_VandTButton->GetPic() == VandTButton::Video_Pic)
// {
// VoideSplitScreen();
// m_VandTButton->SetPic(VandTButton::Tower_Pic);
// }
}
void MainScreen::IpRefresh()
{
ui->Ipshow->setText(getIPAddress());
//update();
}
void MainScreen::SetWindLevel(QString V)
{
double Speed = V.toDouble();
uint32_t Level = 0;
if(Speed < 0)
return;
if(Speed <= 0.2)
{
Level = 0;
}
else if(Speed <= 1.5)
{
Level = 1;
}
else if(Speed <= 3.3)
{
Level = 2;
}
else if(Speed <= 5.4)
{
Level = 3;
}
else if(Speed <= 7.9)
{
Level = 4;
}
else if(Speed <= 10.7)
{
Level = 5;
}
else if(Speed <= 13.8)
{
Level = 6;
}
else if(Speed <= 17.1)
{
Level = 7;
}
else if(Speed <= 20.7)
{
Level = 8;
}
else if(Speed <= 24.4)
{
Level = 9;
}
ui->WindLevel->setText(QString().number(Level));
}
void MainScreen::CheckSensorSta(uint32_t Sta)
{
/*
第1位:重量传感器,如0x0001表示重量传感器异常;
第2位:幅度传感器;
第3位:回转传感器;
第4位:高度传感器;
第5位:风速传感器;
第6位:倾角传感器;
第7位:多机防碰撞模块;
第8位:控制模块;
第10位:定位模块;
*/
if(Sta & (1 << 0)){
ui->MomentAlarm->SetFault();
}else{
ui->MomentAlarm->ClearFault();
}
if(Sta & (1 << 1)){
ui->ScopeAlarm->SetFault();
}else{
ui->ScopeAlarm->ClearFault();
}
if(Sta & (1 << 2)){
ui->RotationAlarml->SetFault();
}else{
ui->RotationAlarml->ClearFault();
}
if(Sta & (1 << 3)){
ui->HeightAlarm->SetFault();
}else {
ui->HeightAlarm->ClearFault();
}
if(Sta & (1 << 4)){
ui->WindAlarm->SetFault();
}else{
ui->WindAlarm->ClearFault();
}
if(Sta & (1 << 5)){
ui->AngleXAlarm->SetFault();
}else {
ui->AngleXAlarm->ClearFault();
}
}
void MainScreen::SetAlarmShow()
{
ui->MomentAlarm->ShowAlarmPic();
ui->ScopeAlarm->ShowAlarmPic();
ui->HeightAlarm->ShowAlarmPic();
ui->RotationAlarml->ShowAlarmPic();
ui->WindAlarm->ShowAlarmPic();
ui->AngleXAlarm->ShowAlarmPic();
if(ui->MomentAlarm->GetAlarmSta()){
ui->MomentFrm->show();
}
else {
ui->MomentFrm->hide();
}
if(ui->ScopeAlarm->GetAlarmSta()){
ui->ScopeFrm->show();
}
else {
ui->ScopeFrm->hide();
}
if(ui->HeightAlarm->GetAlarmSta()){
ui->HeightFrm->show();
}
else {
ui->HeightFrm->hide();
}
if(ui->RotationAlarml->GetAlarmSta())
{
//ui->RotationFrm->show();
ui->CableTorsionFrm->show();
}
else {
//ui->RotationFrm->hide();
ui->CableTorsionFrm->hide();
}
if(ui->WindAlarm->GetAlarmSta()){
ui->WindSpeedFrm->show();
}
else {
ui->WindSpeedFrm->hide();
}
if(ui->AngleXAlarm->GetAlarmSta()){
ui->AngleFrm->show();
}
else {
ui->AngleFrm->hide();
}
if(ui->OverlookAlarm->GetAlarmSta()){
ui->RotationFrm->show();
}
else {
ui->RotationFrm->hide();
}
}
void MainScreen::AlarmShow()
{
static int cnt = 0;
if(cnt % 2)
{
SetAlarmShow();
}else {
ui->MomentFrm->hide();
ui->ScopeFrm->hide();
ui->HeightFrm->hide();
ui->RotationFrm->hide();
ui->CableTorsionFrm->hide();
ui->WindSpeedFrm->hide();
ui->AngleFrm->hide();
}
cnt++;
cnt %= 2;
}
#endif
void MainScreen::on_m_pBtnSet_clicked()
{
emit showLimitSettingPag();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/qinxude/rk3568ui.git
[email protected]:qinxude/rk3568ui.git
qinxude
rk3568ui
rk3568ui
master

搜索帮助