Хранилища Subversion OpenInventory

Сравнить редакции

Не учитывать пробелы Редакция 15 → Редакция 16

/trunk/source_code/ui/form.ui
41,11 → 41,103
<rect>
<x>10</x>
<y>500</y>
<width>661</width>
<width>131</width>
<height>32</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="comboBox">
<property name="geometry">
<rect>
<x>320</x>
<y>470</y>
<width>351</width>
<height>31</height>
</rect>
</property>
<item>
<property name="text">
<string>Computer System Hardware Classes</string>
</property>
</item>
<item>
<property name="text">
<string>Operating System Classes</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>207</x>
<y>480</y>
<width>101</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>WMI класс</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>710</x>
<y>510</y>
<width>31</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>IP:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2">
<property name="geometry">
<rect>
<x>742</x>
<y>500</y>
<width>161</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>192.168.0.135</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>190</x>
<y>510</y>
<width>111</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>WMI объект</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_2">
<property name="geometry">
<rect>
<x>320</x>
<y>510</y>
<width>351</width>
<height>31</height>
</rect>
</property>
<item>
<property name="text">
<string>Win32_CDROMDrive</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_DiskDrive</string>
</property>
</item>
</widget>
</widget>
<resources/>
<connections/>
/trunk/source_code/src/mainwindowimpl.cpp
133,6 → 133,7
MainWindowImpl::~MainWindowImpl()
{
db.close();
delete pdb;
// delete setFrm;
}
 
/trunk/source_code/src/form.cpp
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,6 → 106,42
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();
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;
 
 
}
/trunk/source_code/src/form.h
35,6 → 35,7
 
public:
QProcess wmiProcess;
QStringList get_substr_arr(QString stroka, QString razdelitel);
private slots: