Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 249 → Rev 250

/trunk/DBViewer/mainwindow.cpp
61,6 → 61,9
 
MainWindow::readModels();
 
initWmiTree();
 
 
// MainWindow::creatModelString();
//int i;
//i++;
/trunk/DBViewer/mainwindow.h
104,6 → 104,9
QTreeWidgetItem *rootItem1, *rootItem2;
void openBase();
bool readModel();
 
void initWmiTree();
 
void setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row, QString model_id); // row - íîìåð ñòðîêè â òàáëèöå ìîäåëåé, ñîîòâåòñòâóþùèé äàííîé ìîäåëè
QString creatModelString(QTreeWidgetItem* model);
QString modelString; // ñòðîêà, îïèñûâàþùàÿ ìîäåëü ïðåäñòàâëåíèÿ
/trunk/DBViewer/wmithread.cpp
70,7 → 70,8
error = true; // åñëè îøèáêà, óñòàíîâèì ôëàã îøèáêè âûïîëíåíèÿ WMI-çàïðîñà
}
 
 
/*
void WmiThread::wokerIsStopped(){
exit();
}
*/
/trunk/DBViewer/wmithread.h
29,11 → 29,8
}
void setWmiString(QString new_wmi_string){wmi_string = new_wmi_string;}
QString resultString(){
// static QTextCodec *codec = QTextCodec::codecForName("cp1251");
// static QTextCodec *codecUTF = QTextCodec::codecForName("utf8");
// QTextCodec::setCodecForTr(codecUTF);
return QString(tr(p_buffer));
// QTextCodec::setCodecForTr(codec);
 
}
volatile bool stopped;
private:
53,7 → 50,7
public slots:
void readStandartProcessOutput();
void readStandartProcessError();
void wokerIsStopped();
// void wokerIsStopped();
 
private slots:
 
/trunk/DBViewer/database.cpp
1018,6 → 1018,8
int i;
i++;
 
 
 
}
 
 
1582,3 → 1584,121
}
 
 
void MainWindow::initWmiTree() {
 
QSqlQuery q;
QString sqlStr;
QString classID;
QString inctance;
int field_id;
bool ok;
int field_ip, field_user_name, field_password;
 
 
sqlStr = tr("select * from `ListOfClasses` where `ListOfClasses`.`ClassName` = 'WmiHost'");
ok = q.prepare(sqlStr);
ok = q.exec();
if (!ok){
QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
this, // Ðîäèòåëüñêèé âèäæåò.
QObject::tr("Database Error"), // Çàãîëîâîê.
q.lastError().text()); // Òåêñò ñîîáùåíèÿ.
return;
}
 
field_id = q.record().indexOf(tr("ID"));
if (field_id == -1) return;
else while (q.next()){
classID = q.value(field_id).asString();
 
}
 
inctance = MainWindow::getClassInctance(classID);
if(inctance.isEmpty()) return;
sqlStr = tr("select * from `");
sqlStr.append(inctance);
sqlStr.append(tr("`"));
ok = q.prepare(sqlStr);
ok = q.exec();
if (!ok){
QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå.
this, // Ðîäèòåëüñêèé âèäæåò.
QObject::tr("Database Error"), // Çàãîëîâîê.
q.lastError().text()); // Òåêñò ñîîáùåíèÿ.
return;
}
 
 
 
field_id = q.record().indexOf(tr("ID"));
field_ip = q.record().indexOf(tr("IP"));
field_user_name = q.record().indexOf(tr("Ëîãèí"));
field_password = q.record().indexOf(tr("Ïàðîëü"));
 
while (q.next()){
QString ID_str, IP_str, user_name_str, password_str;
QTreeWidgetItem * itm_tmp;
IP_str = q.value(field_ip).asString();
user_name_str = q.value(field_user_name).asString();
password_str = q.value(field_password).asString();
 
itm_tmp = new QTreeWidgetItem(ui->treeWidget_3);
itm_tmp->setText(0, IP_str);
itm_tmp->setCheckState(0, Qt::Checked );
 
 
 
 
 
TWmiVideoCard vCard;
 
 
 
vCard = MainWindow::getWmiVideoGard(IP_str, user_name_str, password_str);
 
if (!vCard.name.isEmpty()) {
QTreeWidgetItem * itm_video;
QTreeWidgetItem * itm_video_ram;
QTreeWidgetItem * itm_video_model;
QTreeWidgetItem * itm_video_manufacturer;
QString tmp_str;
tmp_str = tr("Âèäåîêàðòà: ");
tmp_str.append(vCard.name);
itm_video = new QTreeWidgetItem(itm_tmp);
itm_video->setText(0, tmp_str);
 
tmp_str = tr("Ïðîèçâîäèòåëü: ");
tmp_str.append(vCard.manufacturer);
 
itm_video_manufacturer = new QTreeWidgetItem(itm_video);
itm_video_manufacturer->setText(0, tmp_str);
 
itm_video_ram = new QTreeWidgetItem(itm_video);
 
tmp_str = tr("Ìîäåëü: ");
tmp_str.append(vCard.model);
itm_video_model = new QTreeWidgetItem(itm_video);
itm_video_model->setText(0, tmp_str);
 
 
 
tmp_str = tr("Âèäåîïàìÿòü (Ìá): ");
tmp_str.append(QVariant(vCard.video_ram /1048576).asString());
 
itm_video_ram->setText(0, tmp_str);
 
 
 
}
 
 
 
int i;
i++;
 
}
 
 
 
 
}
/trunk/DBViewer/mainwindow.ui
6,8 → 6,8
<rect>
<x>0</x>
<y>0</y>
<width>1094</width>
<height>691</height>
<width>1104</width>
<height>689</height>
</rect>
</property>
<property name="windowTitle">
566,8 → 566,17
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_14">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QTreeWidget" name="treeWidget_3">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit_2"/>
</item>
</layout>
585,7 → 594,7
<rect>
<x>0</x>
<y>0</y>
<width>1094</width>
<width>1104</width>
<height>20</height>
</rect>
</property>