34,9 → 34,16 |
// QString program = tr(" wmic -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\""); |
QString program = tr("wmic"); |
QStringList arguments; |
int index; |
|
// arguments << tr(" -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\""); |
program.append(tr(" -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\"")); |
program.append(tr(" -U Àäìèíèñòðàòîð%Patr10t //")); |
program.append(tr(m_ui->lineEdit_2->text())); |
program.append(tr(" \"select * from ")); |
index = m_ui->comboBox_2->currentIndex(); |
program.append(m_ui->comboBox_2->itemText(index)); |
program.append(tr("\"")); |
// Win32_ComputerSystem\"")); |
int i; |
i++; |
wmiProcess.start(program); |
46,8 → 53,8 |
|
void Form::readStandartProcessOutput(){ |
QByteArray arr; |
QStringList result; |
QString str1, str2, str_tmp; |
QStringList result, list_tmp, list_tmp_value; |
QString str1, str2, str_tmp, str_buf; |
int i; |
arr = wmiProcess.readAllStandardOutput(); |
QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
54,8 → 61,10 |
QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
QTextCodec::setCodecForTr(codecUTF); |
str1 = QString(tr(arr)); |
result.clear(); |
// result << QStringList(tr(arr)); |
QTextCodec::setCodecForTr(codec); |
result << QStringList(arr); |
|
// str2 << arr; |
i = result.size(); |
// str1 = result.at(0); |
97,7 → 106,43 |
cursor->insertBlock(); |
} |
|
str_tmp = result.at(1); |
list_tmp = get_substr_arr(str_tmp, "|"); |
/* |
i=0; |
while (i != -1){ |
i = str_tmp.indexOf("|"); |
if (i != -1) { |
str_buf = str_tmp.left(i); |
list_tmp << str_buf; |
str_tmp.remove(0, i+1);} |
|
} |
|
*/ |
|
str_tmp = result.at(2); |
i=0; |
while (i != -1){ |
i = str_tmp.indexOf("|"); |
if (i != -1) { |
str_buf = str_tmp.left(i); |
list_tmp_value << str_buf; |
str_tmp.remove(0, i+1);} |
|
} |
|
for (int m = 0; m < list_tmp.size(); ++m){ |
cursor->insertText(list_tmp.at(m), format); |
cursor->insertText(" : ", format); |
cursor->insertText(list_tmp_value.at(m), format); |
cursor->insertBlock(); |
cursor->insertText(tr("--------------------------"), format); |
cursor->insertBlock(); |
} |
|
|
/* |
cursor->insertText(result.at(2), format); |
cursor->insertBlock(); |
cursor->insertText(tr("--------------------------"), format); |
112,4 → 157,23 |
QByteArray arr; |
arr = wmiProcess.readAllStandardError(); |
|
} |
} |
|
|
QStringList Form::get_substr_arr(QString stroka, QString razdelitel){ |
QStringList result; |
QString str_tmp, str_buf; |
int i = 0; |
result.clear(); |
while (i != -1){ |
i = stroka.indexOf(razdelitel); |
if (i != -1) { |
str_buf = stroka.left(i); |
result << str_buf; |
stroka.remove(0, i+1);} |
|
} |
return result; |
|
|
} |