Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 237 → Rev 238

/trunk/DBViewer/mainwindow.h
216,12 → 216,20
void on_pushButton_15_clicked();// íàæàòèå êíîïêè "Ïå÷àòü" (íà âêëàäêå îò÷åòîâ)
void on_pushButton_16_clicked();// íàæàòèå êíîïêè "Ïå÷àòü â PDF" (íà âêëàäêå îò÷åòîâ)
void on_pushButton_17_clicked();// íàæàòèå êíîïêè "Ýêñïîðò â OpenOffice" (íà âêëàäêå îò÷åòîâ)
void on_pushButton_18_clicked();// íàæàòèå êíîïêè "Ýêñïîðò â OpenOffice" (íà âêëàäêå îò÷åòîâ)
 
 
void on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
void on_model_for_ListModelsTable_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
void on_filter_model_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); // èçìåíèëè ñâîéñòâà ôèëüòðà èëè äîáàâèëè íîâûé ôèëüòð
void applySetting();
void getSetting(); // îòêðîåì îêíî íàñòðîåê
void readStandartProcessOutput();
void readStandartProcessError();
 
 
 
 
};
 
 
/trunk/DBViewer/database.cpp
990,6 → 990,26
}
 
 
void MainWindow::on_pushButton_18_clicked()// âûïîëíèòü wmi çàïðîñ
 
{
// QString program = tr(" wmic -U Àäìèíèñòðàòîð%Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\"");
QString program = tr("wmic");
QStringList arguments;
 
// 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 //192.168.0.135 \"select * from ")); //Win32_Product\""));
program.append(ui->comboBox_2->currentText());
program.append(tr("\""));
 
int i;
i++;
wmiProcess.start(program);
 
}
 
 
void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
int i;
i++;
/trunk/DBViewer/mainwindow.ui
480,6 → 480,77
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Выберете WMI-класс</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_2">
<item>
<property name="text">
<string>Win32_Fan</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_VideoController</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_TemperatureProbe</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_CDROMDrive</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_DiskDrive</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_FloppyDisk</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_MotherboardDevice</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_BIOS</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_PhysicalMemory</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_Processor</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_NetworkAdapter</string>
</property>
</item>
<item>
<property name="text">
<string>Win32_OperatingSystem</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
/trunk/DBViewer/mainwindow.cpp
96,8 → 96,10
connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
connect(model_for_ListModelsTable, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_model_for_ListModelsTable_dataChanged(QModelIndex,QModelIndex)));
connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
connect(&wmiProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput()));
 
 
 
ui->pushButton_3->setEnabled(false);
ui->pushButton_4->setEnabled(false);
 
1716,3 → 1718,89
return result_list;
 
}
 
 
 
void MainWindow::readStandartProcessOutput(){
 
QTextDocument * wmiDoc = ui->textEdit_2->document();
QTextCursor * wmiCursor;
wmiCursor = new QTextCursor(wmiDoc);
 
QByteArray arr;
QStringList result, fields, values;
QString str1, str2;
int i;
arr = wmiProcess.readAllStandardOutput();
QTextCodec *codecUTF = QTextCodec::codecForName("utf8");
QTextCodec *codec = QTextCodec::codecForName("cp1251");
QTextCodec::setCodecForTr(codecUTF);
str1 = QString(tr(arr));
result = str1.split("\n", QString::SkipEmptyParts);
if (result.count()>2){
 
 
 
 
QString tmp_str;
QTextTable * wmi_table;
int fields_count, row_count;
tmp_str = result.at(1);
fields = tmp_str.split("|");
fields_count = fields.count();
row_count = result.count()-1; // ïåðâóþ ñòðîêó (íàçâàíèå êëàññà) îòîáðàæàòü íå áóäåì
wmi_table = wmiCursor->insertTable(row_count, fields_count);
for(int n = 0; n < fields.count(); n++) { // çàïîëíÿåì "øàïêó" òàáëèöû
*wmiCursor = wmi_table->cellAt(0, n).firstCursorPosition();
wmiCursor->insertText(fields.at(n));
}
// tmp_str = result.at(2);
// values = tmp_str.split("|");
 
 
for (int m=2; m< result.count(); m++){
 
tmp_str = result.at(m);
values = tmp_str.split("|");
 
for(int n = 0; n < values.count(); n++){
*wmiCursor = wmi_table->cellAt(m-1, n).firstCursorPosition();
 
// wmiCursor->insertText(fields.at(n));
// wmiCursor->insertText(tr(": "));
wmiCursor->insertText(values.at(n));
// wmiCursor->insertText(tr("\n"));
 
}
 
 
 
}
 
 
 
}
QTextCodec::setCodecForTr(codec);
 
 
 
 
 
 
 
 
 
// result = QStringList(arr);
// str2 << arr;
//i = result.size();
// str1 = result.at(0);
i++;
//lineEdit->insert(str1);
 
}
 
void MainWindow::readStandartProcessError(){
QByteArray arr;
arr = wmiProcess.readAllStandardError();
 
}