Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 253 → Rev 254

/trunk/DBViewer/database.cpp
1653,6 → 1653,7
TWmiVideoCard vCard;
TWmiMatherBoard mBoard;
TWmiProcessor processor;
QList<TWmiMemoryModul> memory_moduls;
 
vCard = MainWindow::getWmiVideoGard(IP_str, user_name_str, password_str);
 
1757,6 → 1758,30
}
 
 
memory_moduls = MainWindow::getWmiRAM(IP_str, user_name_str, password_str);
 
if (!memory_moduls.isEmpty()){
for (int i = 0; i < memory_moduls.count(); i++){
 
QTreeWidgetItem * itm_ram_modul;
QTreeWidgetItem * itm_modul_bank;
QTreeWidgetItem * itm_modul_cap; // îáúåì ïàìÿòè
 
QString tmp_str;
tmp_str = tr("Ìîäóëü ïàìÿòè: ");
tmp_str.append(QVariant(memory_moduls.at(i).capacity/1024/1024).asString());
tmp_str.append(tr(" ÌÁò"));
itm_ram_modul = new QTreeWidgetItem(itm_tmp);
itm_ram_modul->setText(0, tmp_str);
 
 
}
 
 
 
}
 
 
int i;
i++;
 
1769,3 → 1794,8
 
 
}
 
 
 
 
 
/trunk/DBViewer/mainwindow.cpp
2019,3 → 2019,71
 
}
 
 
QList<TWmiMemoryModul> MainWindow::getWmiRAM(QString host, QString user_name, QString password)
{
QList<TWmiMemoryModul> result;
TWmiMemoryModul ramModul_tmp;
bool ok;
QString ansver_string;
 
 
wmiThread.setHost(host); // çàäàåì õîñò
wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ
wmiThread.setPassword( password);
wmiThread.setWmiString(tr("SELECT BankLabel, Capacity, Manufacturer from Win32_PhysicalMemory"));
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++)
{
ramModul_tmp.bankLabel = "";
ramModul_tmp.capacity=0;
tmp_str = split_new_line.at(i);
values_list = tmp_str.split("|");
int index_tmp;
index_tmp = fields_list.indexOf(tr("BankLabel")); // Â êàêîé ñëîò óñòàíîâëåí ìîäóëü ïàìÿòè
if ((index_tmp!=-1) && (index_tmp < values_list.count())) ramModul_tmp.bankLabel = values_list.at(index_tmp);
index_tmp = fields_list.indexOf(tr("Capacity")); // Ðàçìåð ïàìÿòè
if ((index_tmp!=-1) && (index_tmp < values_list.count())) ramModul_tmp.capacity = QVariant(values_list.at(index_tmp)).asInt();
result << ramModul_tmp;
 
 
 
 
};
 
return result;
}
else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò
int m;
m++;
}
else {
wmiThread.stop();
ok = wmiThread.wait(10000);
int k;
k++;
}
 
 
 
return result;
}
 
 
/trunk/DBViewer/mainwindow.h
82,8 → 82,15
} TWmiProcessor;
 
 
typedef struct wmiMemoryModul {
QString bankLabel; // íîìåð áàíêè
int capacity; // ðàçìåð
 
} TWmiMemoryModul;
 
 
 
 
namespace Ui {
class MainWindow;
}
150,9 → 157,9
TWmiVideoCard getWmiVideoGard(QString host, QString user_name, QString password);
TWmiMatherBoard getWmiMatherBoard(QString host, QString user_name, QString password);
TWmiProcessor getWmiProcessor(QString host, QString user_name, QString password);
QList<TWmiMemoryModul> getWmiRAM(QString host, QString user_name, QString password);
 
 
 
WmiThread wmiThread;
/////// QSqlTableModel * sql_mogel;