⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 devmoduledlg.ui.h

📁 为电力系统开发保护设备装置通讯的源代码 采用串口通讯, ret hat 9下 QT开发
💻 H
字号:
/****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you wish to add, delete or rename functions or slots use** Qt Designer which will update this file, preserving your code. Create an** init() function in place of a constructor, and a destroy() function in** place of a destructor.*****************************************************************************/#include <qdatetime.h>#include <qtimer.h>#include "baseclass/publicclass.h"#include "clientareadlg.h"#include <qtextbrowser.h> extern CPublicClass g_PublicClass;void DevModuleDlg::init(){    g_PublicClass.m_MainForm=this;    iFlag=1;    //打开时钟显示    QTimer *timer = new QTimer(this);    connect(timer,SIGNAL(timeout()),this,SLOT(timerDone()) );	    timer->start(2000, FALSE );     //    m_ClientArea=(QWidget*)new CClientAreaDlg(this,"控制面板");    AreaStack->addWidget(m_ClientArea);    AreaStack->raiseWidget(m_ClientArea);}QWidget* DevModuleDlg::GetTextBrower(int ipage){	QTabWidget* pMsgInfo = ((CClientAreaDlg*)this->m_ClientArea)->m_MsgInfo;	return pMsgInfo->page(ipage);}void DevModuleDlg::timerDone(){    QDateTime t=QDateTime::currentDateTime();    int interval=t.toTime_t()-g_PublicClass.m_MainModuleNode.m_LastTime.toTime_t();    if(interval>80)   //认为主模块已经崩溃    {	accept();    }}void DevModuleDlg::accept (){    printf("--Is Over\n");    g_PublicClass.m_Stop=TRUE;    sleep(10);    QDialog::accept();}	void DevModuleDlg::FlashLamp(){    if(iFlag==0)    {	lab_lamp->setBackgroundColor(QColor::QColor(0,255,0));iFlag=1;    }    else    {	lab_lamp->setBackgroundColor(QColor::QColor(255,0,0));iFlag=0;    }}void DevModuleDlg::SetLogText(int flag,QString sMsg){    CClientAreaDlg* pWnd=(CClientAreaDlg*)m_ClientArea;    pWnd->SetMsgInfo(flag,sMsg);}void DevModuleDlg::AddTopLevelDevice(void* ppNode){    QString s1;    CClientAreaDlg* pWnd=(CClientAreaDlg*)m_ClientArea;    CDeviceNode* pNode=(CDeviceNode*)ppNode;    if(!pNode) return;    CListViewItem* item=new CListViewItem(pWnd->m_DeviceListView);    s1.sprintf("%s",pNode->m_deviceinfo.m_RecordIndex);	item->SetKeyIndexText(s1);    s1.sprintf("%d",pNode->m_deviceinfo.m_EquipNo);	item->SetColumnText(0,s1);    s1=_T(pNode->m_deviceinfo.m_Equipment);	item->SetColumnText(1,s1);    if(pNode->m_deviceinfo.m_UsedIp==1)	s1=_T("运行");    else if(pNode->m_deviceinfo.m_UsedIp==2)	s1=_T("检修");    else	s1=_T("停止");    item->SetColumnText(2,s1);    if(pNode->m_deviceinfo.m_CommClass==0)	s1=_T("串口");    else if(pNode->m_deviceinfo.m_CommClass==1)	s1=_T("网口");    else if(pNode->m_deviceinfo.m_CommClass==2)	s1=_T("LonWorks");    else	s1=_T("其他");    item->SetColumnText(3,s1);    s1=_T("正常");    item->SetColumnText(4,s1);}void DevModuleDlg::Clear(){	CClientAreaDlg* pWnd=(CClientAreaDlg*)m_ClientArea;	pWnd->m_DeviceListView->clear();}void DevModuleDlg::AddChildDevice(void* ppNode){    CClientAreaDlg* pWnd=(CClientAreaDlg*)m_ClientArea;    CDeviceNode* pNode=(CDeviceNode*)ppNode;    if(!pNode) return;    QString s1;    s1.sprintf("%s",pNode->m_deviceinfo.m_RecordIndex);    CListViewItem* pitem=pWnd->m_DeviceListView->FindItemByKey(s1);    DeviceInfoListType::iterator it;    for(int i=0;i<(int)pNode->m_ChildDevList.count();i++)    {	it=pNode->m_ChildDevList.at(i);	CListViewItem* item=new CListViewItem(pitem);		s1.sprintf("%s",(*it).m_RecordIndex);   item->SetKeyIndexText(s1);	s1.sprintf("%d",(*it).m_EquipNo);     item->SetColumnText(0,s1);	s1=_T((*it).m_Equipment);    	     item->SetColumnText(1,s1);	if((*it).m_UsedIp==1) s1=_T("运行");	else if((*it).m_UsedIp==2)  s1=_T("检修");	else  s1=_T("停止");	item->SetColumnText(2,s1);	if((*it).m_CommClass==0)  s1=_T("串口");	else if((*it).m_CommClass==1)  s1=_T("网口");	else if((*it).m_CommClass==2)  s1=_T("LonWorks");	else  s1=_T("其他");	item->SetColumnText(3,s1);	s1=_T("正常");	item->SetColumnText(4,s1);    }    pWnd->m_DeviceListView->setOpen(pitem,TRUE);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -