You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.8 KiB
C++
78 lines
1.8 KiB
C++
// DlgDevListImpl.cpp: implementation of the CDlgDevListImpl class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "DlgDevListImpl.h"
|
|
#include <qvariant.h>
|
|
#include <qpushbutton.h>
|
|
#include <qtable.h>
|
|
#include <qlayout.h>
|
|
#include <qtooltip.h>
|
|
#include <qwhatsthis.h>
|
|
|
|
#include "qt_public.h"
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
const char* gColumnName[MAX_NET_NUM+1] = {"序号","IP地址1","IP地址2","IP地址3"};
|
|
|
|
CDlgDevListImpl::CDlgDevListImpl(DEV_DEF *pDevParam, int iDevNum, int iCurSel, QWidget* parent, const char* name, bool modal, WFlags fl)
|
|
: DevList(parent, name, modal, fl)
|
|
{
|
|
int i, j;
|
|
char sztmp[128];
|
|
|
|
m_iCurSelect = 0;
|
|
languageChange();
|
|
|
|
m_CTableDevList->setNumRows(iDevNum);
|
|
m_CTableDevList->setNumCols(MAX_NET_NUM+1);
|
|
|
|
QHeader *pHorHeader = m_CTableDevList->horizontalHeader();
|
|
for(i=0; i<(MAX_NET_NUM+1); i++)
|
|
{
|
|
pHorHeader->setLabel(i, CHS(gColumnName[i]));
|
|
}
|
|
|
|
for(i=0; i<iDevNum; i++)
|
|
{
|
|
sprintf(sztmp, "%d", i+1);
|
|
m_CTableDevList->setText(i, 0, CHS(sztmp));
|
|
|
|
for(j=0; j<MAX_NET_NUM; j++)
|
|
{
|
|
sprintf(sztmp, "%d.%d.%d.%d",
|
|
((pDevParam[i].IpAddr[j]>>24)&0xFF),
|
|
((pDevParam[i].IpAddr[j]>>16)&0xFF),
|
|
((pDevParam[i].IpAddr[j]>>8)&0xFF),
|
|
(pDevParam[i].IpAddr[j]&0xFF));
|
|
m_CTableDevList->setText(i, j+1, CHS(sztmp));
|
|
}
|
|
}
|
|
|
|
for(i=0; i<(MAX_NET_NUM+1); i++)
|
|
{
|
|
m_CTableDevList->adjustColumn( i );
|
|
}
|
|
|
|
m_CTableDevList->selectRow(iCurSel);
|
|
}
|
|
|
|
CDlgDevListImpl::~CDlgDevListImpl()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
void CDlgDevListImpl::languageChange()
|
|
{
|
|
setCaption(CHS("设备列表"));
|
|
m_BtnChange->setText(CHS("选择"));
|
|
m_BtnCancel->setText(CHS("取消"));
|
|
}
|
|
|
|
void CDlgDevListImpl::ChangeSelectSlot()
|
|
{
|
|
m_iCurSelect = m_CTableDevList->currentRow();
|
|
} |