Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 255 → Rev 256

/trunk/DBViewer/mainwindow.cpp
1869,10 → 1869,14
m++;
}
else {
 
wmiThread.terminate();
/*********************
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
**********************/
}
 
/*
1943,10 → 1947,13
m++;
}
else {
wmiThread.terminate();
/***********************
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
**********************/
}
 
 
2005,10 → 2012,14
m++;
}
else {
 
wmiThread.terminate();
/************************
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
********************/
}
 
 
2075,10 → 2086,13
m++;
}
else {
wmiThread.terminate();
/*********************
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
****************/
}
 
 
2183,10 → 2197,13
m++;
}
else {
wmiThread.terminate();
/***********************
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
***************************/
}
 
 
2260,10 → 2277,13
m++;
}
else {
wmiThread.terminate();
/****************************
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
*************************/
}
 
 
2271,3 → 2291,163
 
 
}
 
 
 
 
 
 
 
 
QList<TWmiCDROM> MainWindow::getWmiCDROM(QString host, QString user_name, QString password)
{
QList<TWmiCDROM> result;
TWmiCDROM cdrom_tmp;
bool ok;
QString ansver_string;
 
 
wmiThread.setHost(host); // çàäàåì õîñò
wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ
wmiThread.setPassword( password);
wmiThread.setWmiString(tr("select Caption, Manufacturer from Win32_CDRomDrive"));
wmiThread.start(QThread::NormalPriority);
ok = wmiThread.wait(10000);
 
if (ok){
QTextDocument * wmiDoc = ui->textEdit_2->document();
QTextCursor * wmiCursor;
QStringList split_new_line; //
QStringList fields_list; //â ýòîì ñïèñêå ñîõðàíèì ïîëÿ
QStringList values_list; //à â ýòîì ñïèñêå - çíà÷åíèÿ
wmiCursor = new QTextCursor(wmiDoc);
 
 
ansver_string = wmiThread.resultString();
 
 
wmiCursor->insertText(ansver_string);
split_new_line = ansver_string.split("\n", QString::SkipEmptyParts); // ðàçáèâàåíì îòâåò íà ñòðîêè
if(split_new_line.count()>2) {
QString tmp_str;
tmp_str = split_new_line.at(1);
fields_list = tmp_str.split("|");
 
for(int i=2; i< split_new_line.count(); i++)
{
cdrom_tmp.name = "";
cdrom_tmp.manufacturer = "";
tmp_str = split_new_line.at(i);
values_list = tmp_str.split("|");
int index_tmp;
index_tmp = fields_list.indexOf(tr("Caption")); // íàèìåíîâàíèå ïðèíòåðà
if ((index_tmp!=-1) && (index_tmp < values_list.count())) cdrom_tmp.name = values_list.at(index_tmp);
index_tmp = fields_list.indexOf(tr("Manufacturer")); // ïðîèçâîäèòåëü äèñêà
if ((index_tmp!=-1) && (index_tmp < values_list.count())) cdrom_tmp.manufacturer = values_list.at(index_tmp);
 
result << cdrom_tmp;
 
};
 
return result;
}
else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò
int m;
m++;
}
else {
wmiThread.terminate();
return result;
/*********
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
*******/
}
 
 
 
 
 
}
 
 
 
QList<TWmiNetCard> MainWindow::getWmiNetCard(QString host, QString user_name, QString password){
 
QList<TWmiNetCard> result;
TWmiNetCard netCard_tmp;
bool ok;
QString ansver_string;
wmiThread.setHost(host); // çàäàåì õîñò
wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ
wmiThread.setPassword( password);
wmiThread.setWmiString(tr("Select Description, Caption, MACAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE"));
wmiThread.start(QThread::NormalPriority);
ok = wmiThread.wait(10000);
 
 
 
if (ok){
QTextDocument * wmiDoc = ui->textEdit_2->document();
QTextCursor * wmiCursor;
QStringList split_new_line; //
QStringList fields_list; //â ýòîì ñïèñêå ñîõðàíèì ïîëÿ
QStringList values_list; //à â ýòîì ñïèñêå - çíà÷åíèÿ
wmiCursor = new QTextCursor(wmiDoc);
 
 
ansver_string = wmiThread.resultString();
 
 
wmiCursor->insertText(ansver_string);
split_new_line = ansver_string.split("\n", QString::SkipEmptyParts); // ðàçáèâàåíì îòâåò íà ñòðîêè
if(split_new_line.count()>2) {
QString tmp_str;
tmp_str = split_new_line.at(1);
fields_list = tmp_str.split("|");
 
for(int i=2; i< split_new_line.count(); i++)
{
netCard_tmp.caption = "";
netCard_tmp.MACAddress= "";
tmp_str = split_new_line.at(i);
values_list = tmp_str.split("|");
int index_tmp;
index_tmp = fields_list.indexOf(tr("Description")); // íàèìåíîâàíèå ïðèíòåðà
if ((index_tmp!=-1) && (index_tmp < values_list.count())) netCard_tmp.caption = values_list.at(index_tmp);
index_tmp = fields_list.indexOf(tr("MACAddress")); // ïðîèçâîäèòåëü äèñêà
if ((index_tmp!=-1) && (index_tmp < values_list.count())) netCard_tmp.MACAddress = values_list.at(index_tmp);
 
result << netCard_tmp;
 
};
 
return result;
}
else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò
int m;
m++;
}
else {
wmiThread.terminate();
return result;
/*********
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
*******/
}
 
 
 
 
 
 
 
 
 
 
}