/tags/0.1/Windows/Inventory.zip |
Новый файл |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/DBViewer/Save.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/DBViewer/Save.png |
=================================================================== |
--- trunk/DBViewer/Save.png (revision 0) |
+++ trunk/DBViewer/Save.png (revision 257) |
/trunk/DBViewer/Save.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/DBViewer/settingform.cpp |
=================================================================== |
--- trunk/DBViewer/settingform.cpp (revision 0) |
+++ trunk/DBViewer/settingform.cpp (revision 257) |
@@ -0,0 +1,10 @@ |
+#include "settingform.h" |
+ |
+// place your code here |
+settingForm::settingForm( ) |
+ : QWidget() |
+{ |
+ setupUi(this); |
+ |
+ // TODO |
+} |
/trunk/DBViewer/settingform.cpp |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/DBViewer/Open.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/DBViewer/Open.png |
=================================================================== |
--- trunk/DBViewer/Open.png (revision 0) |
+++ trunk/DBViewer/Open.png (revision 257) |
/trunk/DBViewer/Open.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/DBViewer/fileform.cpp |
=================================================================== |
--- trunk/DBViewer/fileform.cpp (revision 0) |
+++ trunk/DBViewer/fileform.cpp (revision 257) |
@@ -0,0 +1,120 @@ |
+#include "fileform.h" |
+#include "ui_fileform.h" |
+#include "mainwindow.h" |
+ |
+FileForm::FileForm(QWidget *parent) : |
+ QWidget(parent), |
+ ui(new Ui::FileForm) |
+{ |
+ ui->setupUi(this); |
+ FileForm::fdataIsChanged = false; |
+} |
+ |
+FileForm::~FileForm() |
+{ |
+ delete ui; |
+} |
+ |
+void FileForm::changeEvent(QEvent *e) |
+{ |
+ QWidget::changeEvent(e); |
+ switch (e->type()) { |
+ case QEvent::LanguageChange: |
+ ui->retranslateUi(this); |
+ break; |
+ default: |
+ break; |
+ } |
+} |
+ |
+ |
+ |
+void FileForm::on_pushButton_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Îòêðûòü ôàéë" |
+ QString fileName; |
+ QStringList fileName_list; |
+ int list_size; |
+ QFile file; |
+ QByteArray data_tmp; |
+ |
+ fileName = QFileDialog::getOpenFileName(this, |
+ tr("Open Image"), "", tr("All Files (*.*);;Image Files (*.png *.jpg *.bmp);;Text files (*.txt);;XML files (*.xml)")); //Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml) |
+ |
+ if (fileName.isEmpty()) return; |
+ file.setFileName(fileName); |
+ if (!file.open(QIODevice::ReadOnly)) return; |
+ Data.clear(); |
+ // Data = file.readAll(); |
+ QDataStream out(&Data,QIODevice::ReadWrite); |
+ fileName_list = fileName.split(QRegExp("[/\]"), QString::SkipEmptyParts); |
+ |
+ list_size = fileName_list.size(); |
+ |
+ fileName = fileName_list.last(); |
+ |
+ out << fileName; |
+ data_tmp = file.readAll(); |
+ out << data_tmp; |
+ file.close(); |
+ FileForm::fdataIsChanged = true; |
+ |
+} |
+ |
+void FileForm::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ôàéë" |
+ |
+ Data.clear(); |
+ FileForm::fdataIsChanged = true; |
+ |
+} |
+ |
+void FileForm::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ñîõðàíèòü ôàéë" |
+ |
+ QByteArray data_tmp; |
+ QFile file; |
+ QDataStream out(&Data,QIODevice::ReadOnly); |
+ QString fileName; |
+ QStringList fileName_list; |
+ if (Data.isEmpty()) return; |
+ out.device()->reset(); |
+ out >> fileName; |
+ fileName_list = fileName.split(QRegExp("[/\]"), QString::SkipEmptyParts); |
+ |
+ |
+ |
+ fileName = QFileDialog::getSaveFileName(this, tr("Save File"), |
+ fileName, |
+ tr("All Files (*.*);;Image Files (*.png *.jpg *.bmp);;Text files (*.txt);;XML files (*.xml)")); |
+ |
+ |
+ if (fileName.isEmpty()) return; |
+ |
+ |
+ file.setFileName(fileName); |
+ if (!file.open(QIODevice::WriteOnly)) return; |
+ |
+ |
+ // Data = file.readAll(); |
+ |
+ // out.device()->reset(); |
+ |
+ |
+ |
+ data_tmp.clear(); |
+ out >> data_tmp; |
+ int count; |
+ count = file.write(data_tmp); |
+ int size; |
+ size = file.size(); |
+ file.close(); |
+ FileForm::fdataIsChanged = true; |
+ |
+ |
+ |
+} |
+ |
+ void FileForm::setData(QByteArray new_data){ |
+ int i; |
+ |
+ Data = new_data; |
+ |
+ i++; |
+ } |
Index: trunk/DBViewer/database.cpp |
=================================================================== |
--- trunk/DBViewer/database.cpp (revision 0) |
+++ trunk/DBViewer/database.cpp (revision 257) |
@@ -0,0 +1,2008 @@ |
+#include "mainwindow.h" |
+#include "ui_mainwindow.h" |
+ |
+//ïðîâåðêà |
+ |
+void MainWindow::getDatabaseData(){ |
+int list_count; |
+ui->treeWidget_2->clear(); |
+if (rootItems.isEmpty()) return; |
+ |
+ |
+ |
+list_count = rootItems.count(); |
+ |
+for (int i=0; i < list_count; i++){ |
+ |
+ buildTree(rootItems.at(i)); |
+ |
+} |
+ |
+} |
+ |
+void MainWindow::buildTree(QTreeWidgetItem * model_item){ |
+ |
+ |
+ |
+ |
+QString model_name; |
+QString rootClassID; |
+QString rootClassInctance; |
+QFont font; |
+ |
+QTreeWidgetItem * item; |
+model_name = model_item->text(0); |
+if (model_item->checkState(0) == false) return; |
+ |
+//ui->treeWidget_2->clear(); |
+//font.setWeight(20); |
+font.setItalic(true); |
+item = new QTreeWidgetItem (ui->treeWidget_2); |
+item->setFont(0, font); |
+item->setText(0, model_name); |
+item->setTextColor(0, Qt::darkGreen); |
+root_items_list << item; // çàíîñèì â ñïèñîê êîðíåâûõ èòåìîâ |
+ |
+if (!(model_item->childCount() > 0)) return; |
+ |
+rootClassID = model_item->child(0)->text(1); |
+rootClassInctance = getClassInctance(rootClassID); |
+ |
+ |
+if (model_item->child(0)->checkState(0)) // åñëè â ìîäåëè êîðíåâîé êëàññ âûáðàí äëÿ îòîáðàæåíèÿ (ñòîèò ãàëî÷êà), òî |
+ { |
+ ///// QTreeWidgetItem * item_tmp; |
+ ///// item_tmp = new QTreeWidgetItem(item); // â äåðåâå, îòîáðàæàþùåì îáúåêòû êëàññîâ, ñîçäàåì íîâûé óçåë |
+ ///// item_tmp->setText(0, model_item->child(0)->text(0)); // ñ íàçâàíèåì êëàññà |
+ |
+ //showClassObjects(item_tmp, model_item->child(0)); // è âûâîäèì âñå îáúåêòû äàííîãî êëàññà |
+ |
+ ///// showObjects(item_tmp, model_item->child(0), tr("")); |
+ showObjects(item, model_item->child(0), tr("")); |
+ } |
+ |
+ |
+/*****************************************************/ |
+ |
+ |
+} |
+ |
+ |
+// ïîëó÷àåì èìÿ òàáëèöû - õðàíèëèùà îáúåêòîâ êëàññà |
+QString MainWindow::getClassInctance(QString class_id){ |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString result; |
+ QString classInctance; |
+ int field_inctance; |
+ bool ok; |
+ sql_str = tr("select * " |
+ " from ListOfClasses where ListOfClasses.ID = '" //îïðåäåëèì êëàññû, äëÿ êîòîðûõ êîðíåâîé ÿâëÿåòñÿ êîíòåéíåðîì |
+ ); |
+ sql_str.append(class_id); |
+ sql_str.append(tr("'")); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result; |
+ } |
+ field_inctance = q.record().indexOf(tr("TableWhithInstance")); |
+ while(q.next()){ |
+ |
+ classInctance = q.value(field_inctance).toString(); |
+ result.append(classInctance); |
+ } |
+ |
+ return result; |
+ |
+} |
+ |
+void MainWindow::showClassObjects(QTreeWidgetItem * parent_item, QTreeWidgetItem * model_item){ |
+ QString classID; // èäåíòèôèêàòîð êëàññà |
+ QString inctance; // èìÿ òàáëèöû, õðàíèëèùà |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString str_tmp; |
+ bool ok; |
+ int field_ID; |
+ int i; |
+ QIcon icon; |
+ classID = model_item->text(1); |
+ inctance = getClassInctance(classID); |
+ icon = model_item->icon(0); |
+ sql_str = tr("select * " |
+ " from " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ sql_str.append(inctance); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ field_ID = q.record().indexOf(tr("ID")); |
+ |
+ |
+ while(q.next()){ |
+ if (q.record().count() > 1) |
+ { |
+ QString value_tmp; |
+ QString ID_tmp; |
+ QTreeWidgetItem * itm; |
+ ID_tmp = q.value(field_ID).toString(); // îïðåäåëÿåì èäåíòèôèêàòîð îáúåêòà |
+ value_tmp = q.value(1).toString(); // îïðåäåëÿåì èìÿ îáúåêòà (äîëæíî õðàíèòüñÿ â ïåðâîì ïîëå) |
+ itm = new QTreeWidgetItem(parent_item); // äîáàâëÿåì â äåðåâî óçåë, ñîîòâåòñòâóþùèé îáúåêòó |
+ itm->setText(0, value_tmp); |
+ |
+ itm->setIcon(0, icon); |
+ |
+ for (int i; i < model_item->childCount(); i++) // ïðîâåðÿåì, åñòü ëè ó êëàññà äî÷åðíèå êëàññû |
+ { |
+ QTreeWidgetItem * model_item_tmp; // åñëè åñòü |
+ model_item_tmp = model_item->child(i); // îòîáðàæàåì îáúåêòû äî÷åðíèõ êëàññîâ |
+ MainWindow::showObjectChildrens(ID_tmp, itm, model_item_tmp); |
+ |
+ } |
+ } |
+ |
+ } |
+ |
+ |
+ i++; |
+} |
+ |
+ |
+ |
+void MainWindow::showObjectChildrens(QString object_ID, QTreeWidgetItem * object_item, QTreeWidgetItem * model_item){ // îòîáðàçèì îáúåêòû êëàññîâà |
+ |
+ QString classID; // èäåíòèôèêàòîð êëàññà |
+ |
+ QString inctance; // èìÿ òàáëèöû, õðàíèëèùà |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString str_tmp; |
+ bool ok; |
+ classID = model_item->text(1); |
+ inctance = getClassInctance(classID); |
+ |
+ sql_str = tr("select * " |
+ " from '" //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ sql_str.append(inctance); |
+ sql_str.append(tr("' where ")); |
+ |
+ |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+} |
+ |
+ |
+ |
+// |
+void MainWindow::showObjects(QTreeWidgetItem * parent_object_item, QTreeWidgetItem * model_item, QString filtr){ |
+ QString classID; // èäåíòèôèêàòîð êëàññà |
+ QString parentClassID; // èäåíòèôèêàòîð ðîäèòåëüñêîãî êëàññà |
+ QString pointerField; // èìÿ ïîëÿ-óêàçàòåëÿ íà ðîäèòåëüñêèé êëàññ |
+ QString inctance; // èìÿ òàáëèöû, õðàíèëèùà |
+ QString className; // èìÿ êëàññà |
+ QString modelID; // èäåíòèôèêàòîð ìîäåëè |
+ QString add_filtr; // äîïîëíèòåëüíûé ôèëüòð |
+ int field_ID; |
+ int icon_field_index; |
+ bool filtr_empty; |
+ bool ok; |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString str_tmp; |
+ QTreeWidgetItem * title_item; |
+ QFont font; |
+ QIcon icon; |
+ // font.setWeight(40); |
+ font.setBold(true); |
+ filtr_empty = filtr.isEmpty(); |
+ |
+ classID = model_item->text(1); |
+ modelID = model_item->text(6); |
+ add_filtr = MainWindow::getFiltrString(modelID, classID); |
+ |
+ |
+ icon = model_item->icon(0); |
+ |
+ parentClassID = model_item->parent()->text(1); |
+ |
+ pointerField = getPointerFieldName(parentClassID, classID); |
+ |
+ className = model_item->text(0); |
+ inctance = getClassInctance(classID); |
+ |
+ if (!model_item->checkState(0)) return; |
+ |
+ title_item = new QTreeWidgetItem(parent_object_item); |
+ title_item->setFont(0, font); |
+ title_item->setText(0, className); |
+ title_item->setText(1, tr("class")); |
+ title_item->setText(2, classID); |
+ title_item->setText(3, inctance); |
+ title_item->setText(4, pointerField); |
+ title_item->setText(5, add_filtr); // çàïîìíèì ôèëüòð äëÿ êëàññà â äåðåâå ñ äàííûìè |
+ title_item->setTextColor(0, Qt::darkBlue); |
+ |
+ title_item->setIcon(0, icon); |
+ |
+ |
+ sql_str = tr("select * " |
+ " from " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ sql_str.append(inctance); |
+ |
+ |
+ if (filtr.isEmpty() && (!add_filtr.isEmpty())) // ôèëüòð ïóñòîé, äîïîëíèòåëüíûé ôèëüòð íå ïóñòîé |
+ { |
+ filtr.append(tr ("where ")); |
+ filtr.append(add_filtr); |
+ } |
+ |
+ |
+ if (!filtr.isEmpty()) { // åñëè ôèëüòð íå ïóñòîé |
+ sql_str.append(tr(" ")); |
+ sql_str.append(filtr); // äîáàâëÿåì â çàïðîñ ôèëüòð |
+ } |
+ |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QString debug_str; |
+ debug_str.append(tr("ôóí showObjects(): Database Error ")); |
+ debug_str.append(tr(" õð: ")); |
+ debug_str.append(inctance); |
+ debug_str.append(tr(" ô: ")); |
+ debug_str.append(filtr); |
+ debug_str.append(q.lastError().text()); |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("ôóíêöèÿ showObjects(): Database Error"), // Çàãîëîâîê. |
+ debug_str |
+ // q.lastError().text() |
+ ); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ field_ID = q.record().indexOf(tr("ID")); |
+ |
+ icon_field_index = q.record().indexOf(tr("Icon")); |
+ /* |
+ if (q.size() <= 0) return; |
+ title_item = new QTreeWidgetItem(parent_object_item); |
+ title_item->setFont(0, font); |
+ title_item->setText(0, className); |
+ */ |
+ |
+ while(q.next()){ |
+ if (q.record().count() > 1) |
+ { |
+ QString value_tmp; |
+ QString ID_tmp; |
+ QTreeWidgetItem * itm; |
+ ID_tmp = q.value(field_ID).toString(); // îïðåäåëÿåì èäåíòèôèêàòîð îáúåêòà |
+ value_tmp = q.value(1).toString(); // îïðåäåëÿåì èìÿ îáúåêòà (äîëæíî õðàíèòüñÿ â ïåðâîì ïîëå) |
+ // itm = new QTreeWidgetItem(parent_object_item); // äîáàâëÿåì â äåðåâî óçåë, ñîîòâåòñòâóþùèé îáúåêòó |
+ itm = new QTreeWidgetItem(title_item); // äîáàâëÿåì â äåðåâî óçåë, ñîîòâåòñòâóþùèé îáúåêòó |
+ itm->setText(0, value_tmp); |
+ itm->setText(1, tr("object")); |
+ itm->setText(2, ID_tmp); |
+ |
+ |
+ if (icon_field_index != -1){ // åñëè èìååòñÿ ïîëå ñ èêîíêàìè |
+ QVariant data; |
+ QByteArray bytes; |
+ QPixmap pix; |
+ QIcon icn; |
+ QMap <QString, QPixmap> pixmap_map; |
+ QList <QString> id_list; |
+ QList <QPixmap> pixmap_list; |
+ pixmap_map = MainWindow::getObjectsIcon(inctance); |
+ if (!pixmap_map.isEmpty()) { |
+ id_list = pixmap_map.keys(); |
+ pixmap_list = pixmap_map.values(); |
+ } |
+ if (id_list.indexOf(ID_tmp) != -1) { |
+ pix = pixmap_list.at(id_list.indexOf(ID_tmp)); |
+ } |
+ // data = q.record().value(icon_field_index); |
+ // bytes = q.record().value(icon_field_index).toByteArray(); |
+ // if (data.isValid() && (!data.isNull())) { |
+ // if (!bytes.isEmpty()){ |
+ // pix.loadFromData(data.toByteArray()); |
+ // pix.loadFromData(bytes); |
+ if (pix.height() > 128) pix = pix.scaledToHeight(128); |
+ icn.addPixmap(pix); |
+ itm->setIcon(0, icn); |
+ // } |
+ |
+ |
+ |
+ } |
+ |
+ |
+ |
+// itm->setIcon(0, icon); |
+ |
+ |
+ for (int i=0; i < model_item->childCount(); i++) // ïðîâåðÿåì, åñòü ëè ó êëàññà äî÷åðíèå êëàññû |
+ { |
+ QTreeWidgetItem * model_item_tmp; // åñëè åñòü |
+ QString pointer_name; |
+ QString filtr_tmp; |
+ bool pointer_isEmpty; |
+ model_item_tmp = model_item->child(i); // îòîáðàæàåì îáúåêòû äî÷åðíèõ êëàññîâ |
+ pointer_name = getPointerFieldName(classID, model_item->child(i)->text(1)); |
+ itm->setText(4, pointer_name); |
+ |
+ // title_item->setText(4, pointer_name); |
+ |
+ |
+ pointer_isEmpty = pointer_name.isEmpty(); |
+ filtr_tmp = tr("where "); |
+ filtr_tmp.append(tr("`")); |
+ filtr_tmp.append(pointer_name); |
+ filtr_tmp.append(tr("` = '")); |
+ filtr_tmp.append(ID_tmp); |
+ filtr_tmp.append(tr("'")); |
+ showObjects(itm, model_item_tmp, filtr_tmp); |
+ //MainWindow::showObjectChildrens(ID_tmp, itm, model_item_tmp); |
+ |
+ } |
+ |
+ |
+ } |
+ |
+ } |
+ |
+ |
+ |
+ |
+ for (int i; i < model_item->childCount(); i++) // ïðîâåðÿåì, åñòü ëè ó êëàññà äî÷åðíèå êëàññû |
+ { |
+ |
+ |
+ } |
+ |
+} |
+ |
+ |
+QString MainWindow::getPointerFieldName(QString parent_class_id, QString chield_class_id){ |
+ |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString str_tmp; |
+ QString field; |
+ QString result; |
+ int field_name; |
+ bool ok; |
+ sql_str = tr("select * " |
+ " from `DescriptionOfClasses` where `DescriptionOfClasses`.`FieldType` = 'pointer' and `DescriptionOfClasses`.`DefaultValue` = " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ |
+ sql_str.append(tr("'")); |
+ sql_str.append(parent_class_id); |
+ sql_str.append(tr("' ")); |
+ sql_str.append(tr(" and `DescriptionOfClasses`.`ClassIdentifer` = '")); |
+ sql_str.append(chield_class_id); |
+ sql_str.append(tr("'")); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result; |
+ } |
+field_name = q.record().indexOf(tr("FieldName")); |
+while(q.next()){ |
+ result = q.value(field_name).toString(); |
+ } |
+return result; |
+} |
+ |
+ |
+ |
+void MainWindow::on_treeWidget_2_itemClicked ( QTreeWidgetItem * item, int column ){ |
+QString item_type; // òèï óçëà (èìÿ êëàññà èäè îáúåêò) |
+QString parent_object_id; |
+int i; |
+QTreeWidgetItem * parent_item; |
+item_type = item->text(1); |
+parent_item = item->parent(); |
+ |
+QString class_id; // èäåíòèôèêàòîð âûáðàííîãî êëàññà |
+QString inctance; |
+QString filtr_tmp; |
+QMap <QString, QString> pointersList; |
+QStringList dateFieldList; // ñïèñîê èìåí ïîëåé ñ òèïîì "DATE" |
+QStringList boolFieldList; // ñïèñîê èìåí ïîëåé ñ òèïîì "BOOL" |
+QStringList fileFieldList; // ñïèñîê èìåí ïîëåé, â êîòîðûõ õðàíÿòñÿ ôàéëû |
+QString pointer_name; // ñïèñîê èìåí ïîëåé |
+ |
+if (item_type == tr("object") || item_type == tr("class")){ |
+ |
+disconnect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex))); |
+ |
+static QList<int> colomns_indexes; // ñïèñîê íîìåðîâ ñòîëáöîâ òàáëèöû ñ íåñòàíäàðòíûìè äåëåãàòàìè |
+static QList<int> date_colomns_indexes; // ñïèñîê íîìåðîâ ñòîëáöîâ òàáëèöû ñ äåëåãàòàìè äëÿ òèïà "DATE" |
+static QList <int> bool_colomns_indexes; // ñïèñîê íîìåðîâ ñòîëáöîâ òàáëèöû ñ äåëåãàòàìè äëÿ òèïà "BOOL" |
+static QList <int> file_colomns_indexes; // ñïèñîê íîìåðîâ ñòîëáöîâ òàáëèöû, â êîòîðûõ õðàíÿòüñÿ ôàéëû |
+ |
+static QList<SpinBoxDelegate *> spin_delegate_list;// ñïèñîê óêàçàòåëåé íà íåñòàíäàðòíûå äåëåãàòû |
+static int icon_index = -1; // èíäåêñ ñòîëáöà ñ èêîíêàìè |
+ |
+ |
+SpinBoxDelegate * spin_delegate_tmp; |
+ |
+// Ñïåðâà "î÷èñòèì" òàáëèöó îò íåñòàíäàðòíûõ äåëåãàòîâ |
+ |
+if (icon_index != -1) { |
+ ui->tableView->setItemDelegateForColumn(icon_index, &standart_delegate); // è ïðèñâàèâàåì ñòàíäàðòíûé äåëåãàò |
+ icon_index = -1; |
+ } |
+ |
+for (i=0; i < colomns_indexes.size(); i++){ // äëÿ âñåõ ïîëåé-óêàçàòåëåé: |
+ ui->tableView->setItemDelegateForColumn(colomns_indexes.at(i), &standart_delegate ); // è ïðèñâàèâàåì ñòàíäàðòíûé äåëåãàò |
+// ui->tableView->setItemDelegateForColumn(colomns_indexes.at(i), &picture_delegate); |
+ |
+} |
+colomns_indexes.clear(); // î÷èùàåì ñïèñîê ñòîëáöîâ ñ íåñòàíäàðòíûìè äåëåãàòàìè |
+ |
+ |
+// "Î÷èñòèì" òàáëèöó îò äåëåãàòîâ äëÿ õðàíåíèÿ ôàéëîâ |
+ |
+for (i=0; i < file_colomns_indexes.size(); i++){ // äëÿ âñåõ ïîëåé-óêàçàòåëåé: |
+ ui->tableView->setItemDelegateForColumn(file_colomns_indexes.at(i), &standart_delegate ); // è ïðèñâàèâàåì ñòàíäàðòíûé äåëåãàò |
+} |
+file_colomns_indexes.clear(); |
+ |
+ |
+// "Î÷èñòèì" òàáëèöó îò äåëåãàòîâ äëÿ òèïà "DATE" |
+for (i=0; i < date_colomns_indexes.size(); i++){ // äëÿ âñåõ ïîëåé-óêàçàòåëåé: |
+ ui->tableView->setItemDelegateForColumn(date_colomns_indexes.at(i), &standart_delegate ); // è ïðèñâàèâàåì ñòàíäàðòíûé äåëåãàò |
+// ui->tableView->setItemDelegateForColumn(colomns_indexes.at(i), &picture_delegate); |
+ |
+} |
+ |
+date_colomns_indexes.clear(); |
+ |
+// "Î÷èñòèì" òàáëèöó îò äåëåãàòîâ äëÿ òèïà "BOOL" |
+for (i=0; i < bool_colomns_indexes.size(); i++){ // äëÿ âñåõ ïîëåé-óêàçàòåëåé: |
+ ui->tableView->setItemDelegateForColumn(bool_colomns_indexes.at(i), &standart_delegate ); // è ïðèñâàèâàåì ñòàíäàðòíûé äåëåãàò |
+// ui->tableView->setItemDelegateForColumn(colomns_indexes.at(i), &picture_delegate); |
+ |
+} |
+ |
+bool_colomns_indexes.clear(); |
+boolFieldsIndexes_global.clear(); |
+ |
+if (item_type == tr("object")) |
+ { |
+ QString ID; |
+ ui->pushButton->setEnabled(false); |
+ ui->pushButton_2->setEnabled(false); |
+ |
+ class_id = parent_item->text(2); |
+ ID = item->text(2); |
+ inctance = parent_item->text(3); |
+ delete sql_mogel; |
+ |
+ sql_mogel = new MyModel(); |
+ |
+ sql_mogel->setTable(inctance); |
+ // sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange); |
+ sql_mogel->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ |
+ filtr_tmp.append(tr("`")); |
+ filtr_tmp.append(tr("ID")); |
+ filtr_tmp.append(tr("`")); |
+ filtr_tmp.append(tr(" = '")); |
+ filtr_tmp.append(ID); |
+ filtr_tmp.append(tr("'")); |
+ |
+ } |
+if (item_type == tr("class")) |
+ { |
+ QString parent_object_id; // èäåíòèôèêàòîð ðîäèòåëüñêîãî îáúåêòà |
+ |
+ QString parent_class_inctance; |
+ QString class_filter; |
+ |
+ |
+ ui->pushButton->setEnabled(true); |
+ ui->pushButton_2->setEnabled(true); |
+ |
+ parent_object_id = parent_item->text(2); |
+ |
+ parentObject_id = parent_item->text(2); |
+ |
+ class_id = item->text(2); |
+ inctance = item->text(3); |
+ class_filter = item->text(5); |
+ |
+ pointer_name = item->text(4); |
+ delete sql_mogel; |
+ |
+ sql_mogel = new MyModel(); |
+ |
+ // sql_mogel = new QSqlTableModel(this); |
+ sql_mogel->setTable(inctance); |
+ // sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange); |
+ sql_mogel->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ |
+ if (!parent_object_id.isEmpty()) |
+ { |
+ filtr_tmp.append(tr("`")); |
+ filtr_tmp.append(pointer_name); |
+ filtr_tmp.append(tr("`")); |
+ filtr_tmp.append(tr(" = '")); |
+ filtr_tmp.append(parent_object_id); |
+ filtr_tmp.append(tr("'")); |
+ |
+ |
+ if (!class_filter.isEmpty()) // åñëè ôèëüòð äëÿ êëàññà íå ïóñòîé |
+ { |
+ filtr_tmp.append(tr(" and ")); |
+ filtr_tmp.append(class_filter); // äîáàâèì è ôèëüòð äëÿ êëàññà (êîòîðûé óêàçûâàëè â äåðåâå ìîäåëåé) |
+ |
+ } |
+ |
+ |
+ |
+ |
+ } |
+ else if(!class_filter.isEmpty()) // åñëè ôèëüòð äëÿ êëàññà íå ïóñòîé, à ôèëüòð ïóñòîé |
+ { |
+ filtr_tmp.append(class_filter); // äîáàâèì è ôèëüòð äëÿ êëàññà (êîòîðûé óêàçûâàëè â äåðåâå ìîäåëåé) |
+ } |
+ |
+ } |
+ |
+ |
+ |
+pointersList = getPointersList(class_id); // ïîëó÷àåì ñïèñîê ïîëåé-óêàçàòåëåé |
+dateFieldList = getDataFieldList(class_id); // ïîëó÷àåì ñïèñîê ïîëåé c òèïîì "DATE" |
+boolFieldList = getBoolFieldList(class_id); // ïîëó÷àåì ñïèñîê ïîëåé c òèïîì "BOOL" |
+fileFieldList = getFileFieldList(class_id); // ïîëó÷àåì ñïèñîê ïîëåé, â êîòîðûõ õðàíÿòüñÿ ôàéëû |
+ |
+icon_index = getIconFieldIndex(inctance); // |
+if (icon_index != -1) ui->tableView->setItemDelegateForColumn(icon_index, iconDelegate); |
+sql_mogel->setIconIndex(icon_index); |
+ |
+QMap <int, QString> pointersToModel; |
+ |
+ |
+ |
+ |
+QMap <int, QString> filesFieldsToModel; |
+for (int i=0; i < fileFieldList.count(); i++){ // äëÿ âñåõ ïîëåé, õðàíÿùèõ ôàéëû |
+ // static FileDelegate flDelegate; |
+ // static TimeEditDelegate dateDelegate("01.10.2010"); |
+ QString fileFieldName; // èìÿ ïîëÿ |
+ int fileFieldIndex; // |
+ fileFieldName = fileFieldList.at(i); // îïðåäåëÿåì èìÿ ïîëÿ, õðàíÿùåãî ôàéë |
+ fileFieldIndex = sql_mogel->record().indexOf(fileFieldName); // îïðåäåëÿåì íîìåð ñòîëáöà â ìîäåëå |
+ filesFieldsToModel.insert(fileFieldIndex, fileFieldName); |
+ file_colomns_indexes.append(fileFieldIndex);// çàïîìíèì íîìåð ñòîëáöà ñ äåëåãàòîì äëÿ òèïà "file" |
+ ui->tableView->setItemDelegateForColumn(fileFieldIndex, fileDelegate); |
+ |
+} |
+sql_mogel->setFilesFields(filesFieldsToModel);// ïåðåäàåì ìîäåëè ñâÿçàííûé ñïèñîê ñ íîìåðàìè è èìåíàìè ñòîëáöîâ, õðàíÿùèõ ôàéëû |
+ |
+ |
+ |
+ |
+for (int i=0; i < dateFieldList.count(); i++){ // äëÿ âñåõ ïîëåé ñ òèïîì "DATA" |
+ static MyDEDelegate dateDelegate; |
+ // static TimeEditDelegate dateDelegate("01.10.2010"); |
+ QString dateFieldName; // èìÿ ïîëÿ |
+ int dataFieldIndex; // |
+ dateFieldName = dateFieldList.at(i); // îïðåäåëÿåì èìÿ ïîëÿ ñ òèïîì "DATA" |
+ dataFieldIndex = sql_mogel->record().indexOf(dateFieldName); // îïðåäåëÿåì íîìåð ñòîëáöà â ìîäåëå |
+ date_colomns_indexes.append(dataFieldIndex);// çàïîìíèì íîìåð ñòîëáöà ñ äåëåãàòîì äëÿ òèïà "DATA" |
+ ui->tableView->setItemDelegateForColumn(dataFieldIndex, &dateDelegate); |
+ |
+} |
+ |
+ |
+for (int i=0; i < boolFieldList.count(); i++){ // äëÿ âñåõ ïîëåé ñ òèïîì "BOOL" |
+ // // // // static MyDEDelegate dateDelegate; |
+ // static TimeEditDelegate dateDelegate("01.10.2010"); |
+ QString boolFieldName; // èìÿ ïîëÿ |
+ int boolFieldIndex; // |
+ boolFieldName = boolFieldList.at(i); // îïðåäåëÿåì èìÿ ïîëÿ ñ òèïîì "BOOL" |
+ boolFieldIndex = sql_mogel->record().indexOf(boolFieldName); // îïðåäåëÿåì íîìåð ñòîëáöà â ìîäåëå |
+ bool_colomns_indexes.append(boolFieldIndex);// çàïîìíèì íîìåð ñòîëáöà ñ òèïîì "DATA" |
+ // ui->tableView->setItemDelegateForColumn(dataFieldIndex, &dateDelegate); |
+ |
+} |
+ |
+sql_mogel->setBooleansList(bool_colomns_indexes); |
+boolFieldsIndexes_global = bool_colomns_indexes; |
+ |
+for (int i=0; i < spin_delegate_list.count(); i++){ // óäàëÿåì íåñòàíäàðòíûå äåëåãàòû |
+delete spin_delegate_list.at(i); |
+ } |
+ |
+spin_delegate_list.clear(); // î÷èùàåì ñïèñîê óêàçàòåëåé íà íåñòàíäàðòíûå äåëåãàòû |
+ |
+QStringList pointersNames; |
+pointersNames = pointersList.keys(); //çäåñü ñïèñîê èìåí ïîëåé-óêàçàòåëåé íà ðîäèòåëüñêèå êëàññû |
+ |
+ |
+ |
+ |
+ |
+// ui->tableView->setItemDelegateForColumn(2, picture_delegate); |
+ |
+// ui->tableView->setRowHeight(1, 100); |
+ |
+ |
+ |
+ |
+ |
+QStringList parentInctancesList = pointersList.values(); // çäåñü ñïèñîê ñîîòâåòñòâóþùèõ õðàíèëèù |
+ |
+for (i=0; i < pointersNames.size(); i++){ // äëÿ âñåõ ïîëåé-óêàçàòåëåé: |
+ QString pointerName; |
+ |
+ int pointerIndex; |
+ pointerName = pointersNames.at(i); // îïðåäåëÿåì èìÿ ïîëÿ-óêàçàòåëÿ |
+ pointerIndex = sql_mogel->record().indexOf(pointerName); // îïðåäåëÿåì íîìåð ñòîëáöà â ìîäåëå |
+ colomns_indexes.append(pointerIndex); // çàïîìíèì íîìåð ñòîëáöà ñ íåñòàíäàðòíûì äåëåãàòîì |
+ spin_delegate_tmp = new SpinBoxDelegate(); |
+ |
+ // // spinDelegate.setInctance(parentInctancesList.at(i)); // äåëåãàòó ïåðåäàåì èìÿ õðàíèëèùà îáúåêòîâ ðîäèòåëüñêîãî êëàññà |
+ // // spinDelegate.getItems(); // ïðîñèì äåëåãàòà ñîñòàâèòü ñïèñîê îáúåêòîâ â õðàíèëèùå |
+ |
+ spin_delegate_tmp->setInctance(parentInctancesList.at(i)); |
+ spin_delegate_tmp->getItems(); |
+ |
+ spin_delegate_list.append(spin_delegate_tmp); |
+ |
+ // // ui->tableView->setItemDelegateForColumn(pointerIndex, &spinDelegate); // è ïðèñâàèâàåì åãî ñîîòâåòñòâóþùåìó ñòîëáöó íàøåé òàáëèöû |
+ |
+ ui->tableView->setItemDelegateForColumn(pointerIndex, spin_delegate_tmp); |
+ |
+ pointersToModel.insert(pointerIndex, parentInctancesList.at(i)); // ôîðìèðóåì ñïèñîê ñòîëáöîâ ñ óêàçàòåëÿìè |
+} |
+ |
+sql_mogel->setPointers(pointersToModel); // ïåðåäàåì ñïèñîê óêàçàòåëåé ìîäåëå |
+ |
+pointer_index = sql_mogel->record().indexOf(pointer_name); // ýòî ãëîáàëüíàÿ ïåðåìåííàÿ, íå òðîãàåì, íóæíà! :-) |
+ |
+ |
+ |
+ |
+sql_mogel->setFilter(filtr_tmp); |
+sql_mogel->setSort(1, Qt::AscendingOrder); |
+sql_mogel->select(); |
+ |
+ |
+ |
+connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex))); |
+ |
+ui->tableView->setModel(sql_mogel); |
+ui->tableView->hideColumn(0); |
+ui->tableView->resizeColumnsToContents(); |
+ui->tableView->resizeRowsToContents(); |
+ |
+ |
+ |
+ |
+ |
+ } |
+ |
+} |
+ |
+ |
+void MainWindow::on_pushButton_clicked(){ // íàæàòèå êíîïêè "äîáàâèòü ñòðîêó" |
+ int row = sql_mogel->rowCount(); |
+ sql_mogel->insertRows(row, 1); |
+ sql_mogel->setData(sql_mogel->index(row, 1), QVariant(tr("íå îïðåäåëåíî")), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
+ if (pointer_index > 0) { |
+ sql_mogel->setData(sql_mogel->index(row, pointer_index), QVariant(parentObject_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
+ } |
+ // sql_mogel->submitAll(); |
+ |
+} |
+ |
+void MainWindow::on_pushButton_2_clicked(){ // íàæàòèå êíîïêè "Óäàëèòü âûäåëåííûå îáúåêòû" |
+int i; |
+i++; |
+QModelIndex model_index; |
+QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
+QModelIndexList indexes = selectionModel->selectedIndexes(); |
+QList<int> selectedRows; |
+selectedRows.clear(); |
+foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
+ if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
+ |
+} |
+qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
+ |
+ |
+for (int m =0; m < selectedRows.size(); ++m){ |
+ |
+// ClassEditor::removeClass(selectedRows.at(m)); |
+ |
+sql_mogel->removeRow(selectedRows.at(m)); |
+ |
+} |
+sql_mogel->submitAll(); |
+getDatabaseData(); |
+ |
+} |
+ |
+ |
+void MainWindow::on_pushButton_3_clicked(){ // íàæàòèå êíîïêè "Ïðèìåíèòü" |
+ int i; |
+ i++; |
+ sql_mogel->submitAll(); |
+ getDatabaseData(); |
+ ui->pushButton_3->setEnabled(false); |
+ ui->pushButton_4->setEnabled(false); |
+ sql_mogel->select(); |
+ |
+} |
+ |
+ |
+void MainWindow::on_pushButton_4_clicked(){ // íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" |
+ int i; |
+ i++; |
+ sql_mogel->select(); |
+ ui->pushButton_3->setEnabled(false); |
+ ui->pushButton_4->setEnabled(false); |
+ ui->tableView_2->resizeRowsToContents(); |
+ ui->tableView_2->resizeColumnsToContents(); |
+} |
+ |
+ |
+void MainWindow::on_pushButton_5_clicked(){// íàæàòèå êíîïêè "Äîáàâèòü ìîäåëü " |
+ |
+ int i; |
+ i++; |
+ int row = model_for_ListModelsTable->rowCount(); |
+ model_for_ListModelsTable->insertRows(row, 1); |
+ model_for_ListModelsTable->setData(model_for_ListModelsTable->index(row, 1), QVariant(tr("Íîâàÿ ìîäåëü")), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
+ // model_for_ListModelsTable->setData(sql_mogel->index(row, pointer_index), QVariant(parentObject_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
+ |
+ // sql_mogel->submitAll(); |
+ |
+ |
+} |
+ |
+void MainWindow::on_pushButton_6_clicked(){// íàæàòèå êíîïêè "Óäàëèòü ìîäåëü " |
+ |
+ QModelIndex model_index; |
+ QItemSelectionModel *selectionModel = ui->tableView_2->selectionModel(); |
+ QModelIndexList indexes = selectionModel->selectedIndexes(); |
+ QList<int> selectedRows; |
+ selectedRows.clear(); |
+ foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
+ if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
+ |
+ } |
+ qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
+ |
+ |
+ for (int m =0; m < selectedRows.size(); ++m){ |
+ |
+ // ClassEditor::removeClass(selectedRows.at(m)); |
+ |
+ model_for_ListModelsTable->removeRow(selectedRows.at(m)); |
+ |
+ } |
+ model_for_ListModelsTable->submitAll(); |
+ ui->pushButton_7->setEnabled(true); |
+ // getDatabaseData(); |
+ |
+} |
+ |
+ |
+void MainWindow::on_pushButton_7_clicked(){// íàæàòèå êíîïêè "Ïðèìåíèòü" |
+model_for_ListModelsTable->submitAll(); |
+ui->pushButton_7->setEnabled(false); |
+ui->pushButton_8->setEnabled(false); |
+model_is_build = false; |
+MainWindow::readModels(); |
+model_is_build = true; |
+MainWindow::getDatabaseData(); |
+} |
+ |
+void MainWindow::on_pushButton_8_clicked(){// íàæàòèå êíîïêè "Îòìåíèòü" (íà âêëàäêå ìîäåëåé) |
+model_for_ListModelsTable->select(); |
+ui->pushButton_7->setEnabled(false); |
+ui->pushButton_8->setEnabled(false); |
+ |
+} |
+ |
+ |
+ void MainWindow::on_pushButton_9_clicked()// íàæàòèå êíîïêè "Äîáàâèòü ôèëüòð" (íà âêëàäêå ìîäåëåé) |
+ { |
+ QString class_id; |
+ QString model_id; |
+ |
+ |
+ class_id = ui->treeWidget->currentItem()->text(1); |
+ model_id = ui->treeWidget->currentItem()->text(6); |
+ int row = filter_model->rowCount(); |
+ filter_model->insertRows(row, 1); |
+ filter_model->setData(filter_model->index(row, 1), QVariant(model_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Model ID" |
+ filter_model->setData(filter_model->index(row, 2), QVariant(class_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Class ID" |
+ ui->pushButton_11->setEnabled(true); |
+ ui->pushButton_12->setEnabled(true); |
+ |
+ |
+ } |
+ |
+ void MainWindow::on_pushButton_10_clicked()// íàæàòèå êíîïêè "Óäàëèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ) |
+ { |
+ QModelIndex model_index; |
+ QItemSelectionModel *selectionModel = ui->tableView_3->selectionModel(); |
+ QModelIndexList indexes = selectionModel->selectedIndexes(); |
+ QList<int> selectedRows; |
+ selectedRows.clear(); |
+ foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
+ if (!selectedRows.contains(model_index.row()) /*&& (model_index.column()==1)*/) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
+ |
+ } |
+ qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
+ |
+ |
+ for (int m =0; m < selectedRows.size(); ++m){ |
+ |
+ // ClassEditor::removeClass(selectedRows.at(m)); |
+ |
+ filter_model->removeRow(selectedRows.at(m)); |
+ |
+ } |
+ filter_model->submitAll(); |
+ |
+ filter_model->sort(0,Qt::AscendingOrder); |
+ // getDatabaseData(); |
+ model_is_build = false; |
+ MainWindow::readModels(); |
+ model_is_build = true; |
+ MainWindow::getDatabaseData(); |
+ |
+ disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
+ delete filter_model; |
+ |
+ filter_model = new QSqlTableModel(); |
+ filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ /// filter_model = new MyModel(); |
+ |
+ connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
+ |
+ |
+ |
+ |
+ } |
+ |
+ void MainWindow::on_pushButton_11_clicked()// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ôèëüòðîâ) |
+ { |
+ filter_model->submitAll(); |
+ filter_model->sort(0,Qt::AscendingOrder); |
+ ui->pushButton_11->setEnabled(false); |
+ ui->pushButton_12->setEnabled(false); |
+ |
+ model_is_build = false; |
+ MainWindow::readModels(); |
+ model_is_build = true; |
+ MainWindow::getDatabaseData(); |
+ disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
+ delete filter_model; |
+ |
+ filter_model = new QSqlTableModel(); |
+ filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ /// filter_model = new MyModel(); |
+ |
+ connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
+ |
+ |
+ |
+ } |
+ |
+ void MainWindow::on_pushButton_12_clicked()// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ) |
+ { |
+ ui->tableView_3->setModel(filter_model); |
+ filter_model->select(); |
+ |
+ ui->pushButton_11->setEnabled(false); |
+ ui->pushButton_12->setEnabled(false); |
+ } |
+ |
+ void MainWindow::on_pushButton_13_clicked()// íàæàòèå êíîïêè "Ñôîðìèðîâàòü êðàòêèé îò÷åò" (íà âêëàäêå îò÷åòîâ) |
+ { |
+ buildReport(false); |
+ |
+ } |
+ |
+ void MainWindow::on_pushButton_14_clicked()// íàæàòèå êíîïêè "Ñôîðìèðîâàòü ïîëíûé îò÷åò" (íà âêëàäêå îò÷åòîâ) |
+ { |
+ buildReport(true); |
+ |
+ } |
+ |
+ void MainWindow::on_pushButton_15_clicked()// íàæàòèå êíîïêè "Ïå÷àòü" (íà âêëàäêå îò÷åòîâ) |
+ { |
+ QPrinter printer; |
+ QPrintDialog *dlg = new QPrintDialog(&printer, this); |
+ if (dlg->exec() !=QDialog::Accepted) return; |
+ doc->print(&printer); |
+ |
+ } |
+ |
+ |
+ void MainWindow::on_pushButton_16_clicked()// íàæàòèå êíîïêè "Ïå÷àòü â PDF" (íà âêëàäêå îò÷åòîâ) |
+ { |
+ QString fileName = QFileDialog::getSaveFileName(this, "Export PDF", "", "PDF Files (*.pdf)"); |
+ if(!fileName.isEmpty()){ |
+ if (QFileInfo(fileName).suffix().isEmpty()) |
+ fileName.append(".pdf"); |
+ QPrinter printer(QPrinter::HighResolution); |
+ printer.setOutputFormat(QPrinter::PdfFormat); |
+ printer.setOutputFileName(fileName); |
+ doc->print(&printer); |
+ } |
+ |
+ } |
+ |
+ void MainWindow::on_pushButton_17_clicked()// íàæàòèå êíîïêè "Ýêñïîðò â OpenOffice" (íà âêëàäêå îò÷åòîâ) |
+ |
+ { |
+ QString fileName = QFileDialog::getSaveFileName(this, "Export ODT", "", "OpenOffice document (*.odt)"); |
+ |
+ if(!fileName.isEmpty()){ |
+ if (QFileInfo(fileName).suffix().isEmpty()) |
+ fileName.append(".odt"); |
+ (bool)QTextDocumentWriter(fileName).write(doc); |
+ |
+ } |
+ |
+ |
+ } |
+ |
+ |
+ 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 admin --password=samba //192.168.0.101 \"select * from ")); //Win32_Product\"")); |
+ program.append(ui->comboBox_2->currentText()); |
+ program.append(tr("\"")); |
+ |
+ int i; |
+ i++; |
+ wmiProcess.start(program); |
+ */ |
+ |
+ TWmiVideoCard vCard; |
+ |
+ |
+ |
+ vCard = MainWindow::getWmiVideoGard("192.168.0.11", tr("Àäìèíèñòðàòîð"), "!s-Leg01@Z"); |
+ int i; |
+ i++; |
+ |
+ |
+ |
+ } |
+ |
+ |
+void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò |
+int i; |
+i++; |
+ |
+if (sql_mogel->iconIndex() !=-1) { |
+ ui->tableView->resizeColumnsToContents(); |
+ ui->tableView->resizeRowsToContents(); |
+ } |
+ |
+if ((topLeft == bottomRight) && (boolFieldsIndexes_global.indexOf(topLeft.column()) != -1)) |
+{ |
+ ui->pushButton_3->setEnabled(false); |
+ ui->pushButton_4->setEnabled(false); |
+return; |
+} |
+ |
+ |
+ui->pushButton_3->setEnabled(true); |
+ui->pushButton_4->setEnabled(true); |
+ |
+} |
+ |
+void MainWindow::on_model_for_ListModelsTable_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò |
+ |
+ui->pushButton_7->setEnabled(true); |
+ui->pushButton_8->setEnabled(true); |
+} |
+ |
+ |
+ |
+ |
+void MainWindow::on_filter_model_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) // èçìåíèëè ñâîéñòâà ôèëüòðà èëè äîáàâèëè íîâûé ôèëüòð |
+ |
+{ |
+ ui->pushButton_11->setEnabled(true); |
+ ui->pushButton_12->setEnabled(true); |
+} |
+ |
+ |
+ |
+ |
+ |
+// ïîëó÷àåì ñïèñîê âñåõ ïîëåé-óêàçàòåëåé, â êà÷åñòâå êëþ÷åé ïîëó÷èì èìåíà ïîëåé-óêàçàòåëåé |
+// â êà÷åñòâå çíà÷åíèé ïîëó÷èì ñïèñîê òàáëèö-õðàíèëèù îáúåêòîâ ðîäèòåëüñêèõ êëàññîâ |
+ |
+QMap <QString, QString> MainWindow::getPointersList(QString class_id){ |
+ QMap <QString, QString> result_map; |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString str_tmp; |
+ QString field; |
+ QString result; |
+ int field_name, field_default_value; |
+ bool ok; |
+ sql_str = tr("select * " |
+ " from `DescriptionOfClasses` where `DescriptionOfClasses`.`FieldType` = 'pointer' and `DescriptionOfClasses`.`ClassIdentifer` = " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ |
+ sql_str.append(tr("'")); |
+ sql_str.append(class_id); |
+ sql_str.append(tr("' ")); |
+ // sql_str.append(tr(" and `DescriptionOfClasses`.`ClassIdentifer` = '")); |
+ // sql_str.append(chield_class_id); |
+ // sql_str.append(tr("'")); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_map; |
+ } |
+field_name = q.record().indexOf(tr("FieldName")); |
+field_default_value = q.record().indexOf(tr("DefaultValue")); |
+while(q.next()){ |
+ QString pointerFieldName; |
+ QString parentClassID; |
+ QString parentClassInctance; |
+ |
+ pointerFieldName = q.value(field_name).toString(); |
+ parentClassID = q.value(field_default_value).toString(); |
+ parentClassInctance = getClassInctance(parentClassID); |
+ result_map.insert(pointerFieldName, parentClassInctance); |
+ |
+ |
+ } |
+ |
+return result_map; |
+} |
+ |
+ |
+ |
+ |
+ |
+QStringList MainWindow::getDataFieldList(QString class_id){ // ïîëó÷àåì ñïèñîê âñåõ ïîëåé c òèïîì "Äàòà", â êà÷åñòâå êëþ÷åé ïîëó÷èì èìåíà ïîëåé |
+ // â êà÷åñòâå çíà÷åíèé ïîëó÷èì ñïèñîê òàáëèö-õðàíèëèù îáúåêòîâ ðîäèòåëüñêèõ êëàññîâ |
+ |
+ QStringList result_str; |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString str_tmp; |
+ QString field; |
+ QString result; |
+ int field_name, field_default_value; |
+ bool ok; |
+ sql_str = tr("select * " |
+ " from `DescriptionOfClasses` where `DescriptionOfClasses`.`FieldType` = 'DATE' and `DescriptionOfClasses`.`ClassIdentifer` = " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ |
+ sql_str.append(tr("'")); |
+ sql_str.append(class_id); |
+ sql_str.append(tr("' ")); |
+ // sql_str.append(tr(" and `DescriptionOfClasses`.`ClassIdentifer` = '")); |
+ // sql_str.append(chield_class_id); |
+ // sql_str.append(tr("'")); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_str; |
+ } |
+field_name = q.record().indexOf(tr("FieldName")); |
+// field_default_value = q.record().indexOf(tr("DefaultValue")); |
+while(q.next()){ |
+ QString DataFieldName; |
+ |
+ DataFieldName = q.value(field_name).toString(); |
+ result_str.append(DataFieldName); |
+ |
+ |
+ } |
+ |
+return result_str; |
+} |
+ |
+ |
+ |
+int MainWindow::getIconFieldIndex(QString inctance){ // ïîëó÷àåì íîìåð ñòîëáöà ñ èêîíêàìè |
+ |
+ QSqlQuery q; |
+ bool ok; |
+ int icon_field; |
+ QString sql_str; |
+ sql_str = tr("select * from `"); //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ sql_str.append(inctance); |
+ sql_str.append(tr("`")); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ return -1; |
+ } |
+ |
+ icon_field = q.record().indexOf(tr("Icon")); |
+ return icon_field; |
+ |
+ |
+} |
+ |
+ |
+QStringList MainWindow::getFileFieldList(QString class_id){ // ïîëó÷àåì ñïèñîê âñåõ ïîëåé, â êîòîðûõ õðàíÿòüñÿ ôàéëû |
+QStringList result_str; |
+QSqlQuery q; |
+QString sql_str; |
+bool ok; |
+ int field_name, field_default_value; |
+ sql_str = tr("select * " |
+ " from `DescriptionOfClasses` where `DescriptionOfClasses`.`Comment` = 'file' and `DescriptionOfClasses`.`ClassIdentifer` = " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ sql_str.append(tr("'")); |
+ sql_str.append(class_id); |
+ sql_str.append(tr("' ")); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_str; |
+ } |
+ |
+ field_name = q.record().indexOf(tr("FieldName")); |
+ // field_default_value = q.record().indexOf(tr("DefaultValue")); |
+ while(q.next()){ |
+ QString FileFieldName; |
+ |
+ FileFieldName = q.value(field_name).toString(); |
+ result_str.append(FileFieldName); |
+ |
+ |
+ } |
+ |
+ return result_str; |
+ |
+} |
+ |
+ |
+ |
+QStringList MainWindow::getBoolFieldList(QString class_id){ // ïîëó÷àåì ñïèñîê âñåõ ïîëåé c òèïîì "bool" |
+ |
+ QStringList result_str; |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString str_tmp; |
+ QString field; |
+ QString result; |
+ int field_name, field_default_value; |
+ bool ok; |
+ sql_str = tr("select * " |
+ " from `DescriptionOfClasses` where `DescriptionOfClasses`.`FieldType` = 'BOOL' and `DescriptionOfClasses`.`ClassIdentifer` = " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ |
+ sql_str.append(tr("'")); |
+ sql_str.append(class_id); |
+ sql_str.append(tr("' ")); |
+ // sql_str.append(tr(" and `DescriptionOfClasses`.`ClassIdentifer` = '")); |
+ // sql_str.append(chield_class_id); |
+ // sql_str.append(tr("'")); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_str; |
+ } |
+field_name = q.record().indexOf(tr("FieldName")); |
+// field_default_value = q.record().indexOf(tr("DefaultValue")); |
+while(q.next()){ |
+ QString DataFieldName; |
+ |
+ DataFieldName = q.value(field_name).toString(); |
+ result_str.append(DataFieldName); |
+ |
+ |
+ } |
+ |
+return result_str; |
+} |
+ |
+ |
+ |
+ |
+ |
+// Ñ÷èòûâàåì íàñòðîéêè |
+ |
+void MainWindow::readSettings() |
+{ |
+ QSettings settings("Trolltech", "Application Example"); |
+ baseName = settings.value("baseName", "an_db").toString(); |
+ userName = settings.value("userName", "an").toString(); |
+ password = settings.value("password", "393939").toString(); |
+ tableName = settings.value("tableName", "inventar").toString(); |
+ hostName = settings.value("hostName", "server").toString(); |
+// resize(size); |
+// move(pos);tableName |
+} |
+ |
+ |
+void MainWindow::writeSettings() |
+{ |
+ QSettings settings("Trolltech", "Application Example"); |
+ settings.setValue("baseName", baseName); |
+ settings.setValue("userName", userName); |
+ settings.setValue("password", password); |
+ settings.setValue("tableName", tableName); |
+ settings.setValue("hostName", hostName); |
+} |
+ |
+ |
+ |
+void MainWindow::applySetting() |
+{ |
+ bool ok; |
+ baseName = setFrm.lineEdit->text(); |
+ userName = setFrm.lineEdit_2->text(); |
+ password = setFrm.lineEdit_3->text(); |
+ // tableName = setFrm->lineEdit_4->text(); |
+ hostName = setFrm.lineEdit_5->text(); |
+ writeSettings(); |
+ |
+ |
+ ok=openDataBase(); |
+ if (!ok) return; |
+ // // // ui->treeWidget->clear(); // î÷èùàåì äåðåâî ñ ìîäåëüþ |
+ |
+ // // // buildPreviewModel(tr("Ìîÿ ìîäåëü"), tr("1")); |
+ |
+ model_is_build = false; |
+ |
+ class_list_map.clear(); // î÷èùàåì ñïèñîê êëàññîâ |
+ rootItems.clear(); |
+ models_items.clear(); |
+ |
+ disconnect(model_for_ListModelsTable, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_model_for_ListModelsTable_dataChanged(QModelIndex,QModelIndex))); |
+ delete model_for_ListModelsTable; |
+ |
+ initListModelsTablle(); |
+ |
+ connect(model_for_ListModelsTable, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_model_for_ListModelsTable_dataChanged(QModelIndex,QModelIndex))); |
+ |
+ ui->treeWidget->clear(); |
+ initComboBox(); |
+ // model_for_ListModelsTable->select(); |
+ MainWindow::readModels(); |
+ |
+ |
+ |
+ // // // getDatabaseData(); |
+ // delete setFrm; |
+ |
+ |
+ model_is_build = true; |
+ getDatabaseData(); |
+ setFrm.close(); |
+} |
+ |
+ |
+void MainWindow::getSetting() |
+{ |
+ // setFrm = new settingForm; |
+ // // // connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting())); |
+ setFrm.lineEdit->setText(baseName); |
+ setFrm.lineEdit_2->setText(userName); |
+ setFrm.lineEdit_3->setText(password); |
+// setFrm->lineEdit_4->setText(tableName); |
+ setFrm.lineEdit_5->setText(hostName); |
+ setFrm.show(); |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+void MainWindow::readModels(){ |
+ |
+ int row = model_for_ListModelsTable->rowCount(); |
+ QList <QTreeWidgetItem*> modelsItemsList; |
+ QList <int> row_list; |
+ modelsItemsList = models_items.values(); |
+ |
+ row_list = models_items.keys(); |
+ |
+ |
+ |
+ rootItems.clear(); |
+ root_items_list.clear(); |
+ ui->treeWidget->clear(); |
+for (int i=0; i < row; i++){ |
+ QTreeWidgetItem * item_tmp; |
+ QString modelName; |
+ QString model_id; |
+ |
+ bool enabled; |
+ |
+ |
+ |
+ //models_items.values(); |
+ // modelString = |
+ |
+ modelName = model_for_ListModelsTable->data(model_for_ListModelsTable->index(i, 1)).toString(); |
+ model_id = model_for_ListModelsTable->data(model_for_ListModelsTable->index(i, 0)).toString(); |
+ |
+ enabled = model_for_ListModelsTable->data(model_for_ListModelsTable->index(i, 3)).toBool(); |
+ item_tmp = new QTreeWidgetItem(ui->treeWidget); |
+ item_tmp->setText(0, modelName); |
+ item_tmp->setText(4, QVariant(i).toString()); // çàïèøåì â 4 êîëîíêó íîìåðñòðîêè ìîäåëè â òàáëèöå ìîäåëåé |
+ item_tmp->setText(6, model_id); |
+ if (enabled) item_tmp->setCheckState(0,Qt::Checked); |
+ else item_tmp->setCheckState(0,Qt::Unchecked); |
+ |
+ root_items_list << item_tmp; |
+ |
+ rootItems.append(item_tmp); |
+ |
+ models_items[i] =item_tmp ; |
+ |
+ |
+ modelString = model_for_ListModelsTable->data(model_for_ListModelsTable->index(i, 2)).toString(); |
+ if (modelString.isEmpty()) continue; |
+ else setupModelData(modelString.split(QString("\n")), item_tmp, i, model_id); // ñòðîèì ìîäåëü |
+ |
+ } |
+ |
+} |
+ |
+ |
+ |
+ |
+QMap <QString, QPixmap> MainWindow::getClassesIcons(){ // ïîëó÷àåì ñïèñîê èêîíîê äëÿ êëàññîâ |
+ // â êà÷åñòâå êëþ÷à ïîëó÷èì ID êëàññà, à â êà÷åñòâå çíà÷åíèé - èçîáðàæåíèÿ èêîíîê |
+ |
+QMap <QString, QPixmap> result_map; |
+QSqlQuery q; |
+QString sql_str; |
+QString str_tmp; |
+QString field; |
+QString result; |
+int field_id, field_icon; |
+bool ok; |
+sql_str = tr("select * " |
+ " from `ListOfClasses` " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ |
+q.prepare(sql_str); |
+ |
+ok = q.exec(); |
+if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_map; |
+ } |
+field_id = q.record().indexOf(tr("ID")); |
+field_icon = q.record().indexOf(tr("Icon")); |
+while(q.next()){ |
+ QString classID; |
+ QByteArray loadimage = q.value(field_icon).toByteArray(); |
+ classID = q.value(field_id).toString(); |
+ if( !loadimage.isEmpty() ) |
+ { |
+ QPixmap pixmap; |
+ pixmap.loadFromData(loadimage); |
+ result_map.insert(classID, pixmap); |
+ |
+ } |
+ else continue; |
+ |
+ |
+ |
+ } |
+ |
+return result_map; |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+QMap <QString, QPixmap> MainWindow::getObjectsIcon(QString inctance){ // ïîëó÷àåì ñïèñîê èêîíîê äëÿ îáúåêòîâ |
+ // â êà÷åñòâå êëþ÷à ïîëó÷èì ID îáúåêòà, à â êà÷åñòâå çíà÷åíèé - èçîáðàæåíèÿ èêîíîê |
+QMap <QString, QPixmap> result_map; |
+QSqlQuery q; |
+QString sql_str; |
+QString str_tmp; |
+int field_id, field_icon; |
+bool ok; |
+sql_str = tr("select `ID`, `Icon` " |
+ " from `" //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+sql_str.append(inctance); |
+sql_str.append(tr("`")); |
+ |
+q.prepare(sql_str); |
+ |
+ok = q.exec(); |
+if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_map; |
+ } |
+ |
+field_id = q.record().indexOf(tr("ID")); |
+field_icon = q.record().indexOf(tr("Icon")); |
+ |
+while(q.next()){ |
+ QString objectID; |
+ QByteArray loadimage = q.value(field_icon).toByteArray(); |
+ objectID = q.value(field_id).toString(); |
+ if( !loadimage.isEmpty() ) |
+ { |
+ QPixmap pixmap; |
+ pixmap.loadFromData(loadimage); |
+ result_map.insert(objectID, pixmap); |
+ |
+ } |
+ else continue; |
+ |
+ |
+ |
+ } |
+return result_map; |
+} |
+ |
+ |
+ |
+ |
+QString MainWindow::getFiltrString(QString model_id, QString class_id){ // ïîëó÷àåì ñòðîêó-ôèëüòð äëÿ äàííîãî êëàññà äàííîé ìîäåëè |
+ |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString result_str; |
+ sql_str = tr("select * from `Filters` where `Filters`.`Model_ID` = '"); |
+ sql_str.append(model_id); |
+ sql_str.append(tr("' and `Filters`.`Class_ID` = '")); |
+ sql_str.append(class_id); |
+ sql_str.append(tr("' order by `Filters`.`ID`")); |
+ bool ok; |
+ ok = q.prepare(sql_str); |
+ ok = q.exec(); |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_str; |
+ } |
+ result_str.clear(); |
+ while(q.next()){ |
+ QString Condition, FieldName, ConditionalSymbol, ValueForComparison, PostCondition; |
+ Condition = q.record().value(3).toString(); |
+ FieldName = q.record().value(4).toString(); |
+ ConditionalSymbol = q.record().value(5).toString(); |
+ ValueForComparison = q.record().value(6).toString(); |
+ PostCondition = q.record().value(7).toString(); |
+ |
+ |
+ result_str.append(Condition); |
+ result_str.append(tr(" `")); |
+ result_str.append(FieldName); |
+ result_str.append(tr("`")); |
+ result_str.append(ConditionalSymbol); |
+ |
+ if (!ValueForComparison.isEmpty()) { |
+ result_str.append(tr("'")); |
+ result_str.append(ValueForComparison); |
+ result_str.append(tr("' ")); |
+ } |
+ result_str.append(PostCondition); |
+ |
+ |
+ } |
+ |
+ |
+ return result_str; |
+ |
+} |
+ |
+ |
+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; |
+TWmiMatherBoard mBoard; |
+TWmiProcessor processor; |
+QList<TWmiMemoryModul> memory_moduls; |
+QList<TWmiHDD> hdd_list; |
+QList<TWmiCDROM> cdrom_list; |
+QList<TWmiNetCard> netcadr_list; |
+QList<TWmiSoundCard> soundcard_list; |
+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); |
+ tmp_str.append(tr(" ")); |
+ tmp_str.append(QVariant(vCard.video_ram/1024/1024).asString()); |
+ tmp_str.append(tr(" ÌÁò")); |
+ 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); |
+ |
+ |
+ |
+ } |
+ |
+ |
+mBoard = MainWindow::getWmiMatherBoard(IP_str, user_name_str, password_str); |
+if (!mBoard.manufacturer.isEmpty()) { |
+ QTreeWidgetItem * itm_maherBoard; |
+ QTreeWidgetItem * itm_maherBoard_model; |
+ QTreeWidgetItem * itm_maherBoard_manufacturer; |
+ QString tmp_str; |
+ tmp_str = tr("Ìàòåðèíñêàÿ ïëàòà: "); |
+ tmp_str.append(mBoard.manufacturer); |
+ tmp_str.append( tr(" ")); |
+ tmp_str.append(mBoard.model); |
+ itm_maherBoard = new QTreeWidgetItem(itm_tmp); |
+ itm_maherBoard->setText(0, tmp_str); |
+ |
+ tmp_str = tr("Ïðîèçâîäèòåëü: "); |
+ tmp_str.append(mBoard.manufacturer); |
+ |
+ itm_maherBoard_manufacturer = new QTreeWidgetItem(itm_maherBoard); |
+ itm_maherBoard_manufacturer->setText(0, tmp_str); |
+ |
+ itm_maherBoard_model = new QTreeWidgetItem(itm_maherBoard); |
+ |
+ tmp_str = tr("Ìîäåëü: "); |
+ tmp_str.append(mBoard.model); |
+ |
+ itm_maherBoard_model->setText(0, tmp_str); |
+ |
+ |
+ } |
+ |
+processor = MainWindow::getWmiProcessor(IP_str, user_name_str, password_str); |
+if (!processor.manufacturer.isEmpty()){ |
+ |
+ QTreeWidgetItem * itm_processor; |
+ QTreeWidgetItem * itm_processor_manufacturer; |
+ QTreeWidgetItem * itm_processor_clockSpeed; |
+ QTreeWidgetItem * itm_processor_socket; |
+ |
+ |
+ QString tmp_str; |
+ tmp_str = tr("Ïðîöåññîð: "); |
+ tmp_str.append(processor.name); |
+ |
+ itm_processor = new QTreeWidgetItem(itm_tmp); |
+ itm_processor->setText(0, tmp_str); |
+ |
+ tmp_str = tr("Ïðîèçâîäèòåëü: "); |
+ tmp_str.append(processor.manufacturer); |
+ itm_processor_manufacturer = new QTreeWidgetItem(itm_processor); |
+ itm_processor_manufacturer->setText(0, tmp_str); |
+ |
+ tmp_str = tr("×àñòîòà: "); |
+ tmp_str.append(QVariant(processor.clockSpeed).asString()); |
+ tmp_str.append(tr(" ÌÃö")); |
+ itm_processor_clockSpeed = new QTreeWidgetItem(itm_processor); |
+ itm_processor_clockSpeed->setText(0, tmp_str); |
+ |
+ |
+ tmp_str = tr("Ñîêåò: "); |
+ tmp_str.append(processor.socket); |
+ itm_processor_socket = new QTreeWidgetItem(itm_processor); |
+ itm_processor_socket->setText(0, tmp_str); |
+ |
+ } |
+ |
+ |
+memory_moduls = MainWindow::getWmiRAM(IP_str, user_name_str, password_str); |
+ |
+if (!memory_moduls.isEmpty()){ |
+ QTreeWidgetItem * itm_ram; |
+ int sum_cap=0; |
+ itm_ram = new QTreeWidgetItem(itm_tmp); |
+ |
+ |
+ 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("Ìîäóëü ïàìÿòè: "); |
+ sum_cap = sum_cap + memory_moduls.at(i).capacity/1024/1024; |
+ tmp_str.append(QVariant(memory_moduls.at(i).capacity/1024/1024).asString()); |
+ |
+ tmp_str.append(tr(" ÌÁò")); |
+ itm_ram_modul = new QTreeWidgetItem(itm_ram); |
+ itm_ram_modul->setText(0, tmp_str); |
+ |
+ |
+ } |
+ QString cap_str; |
+ cap_str = tr("Îáúåì ïàìÿòè: "); |
+ cap_str.append(QVariant(sum_cap).asString()); |
+ cap_str.append(tr(" ÌÁò")); |
+ itm_ram->setText(0, cap_str); |
+ |
+} |
+ |
+ |
+hdd_list = MainWindow::getWmiHDD(IP_str, user_name_str, password_str); |
+ |
+ |
+if (!hdd_list.isEmpty()){ |
+ QTreeWidgetItem * itm_hdd_list; |
+ int sum_cap = 0; |
+ itm_hdd_list = new QTreeWidgetItem(itm_tmp); |
+ |
+ |
+ for (int i = 0; i < hdd_list.count(); i++){ |
+ |
+ QTreeWidgetItem * itm_hdd; |
+ QTreeWidgetItem * itm_hdd_man; |
+ QTreeWidgetItem * itm_hdd_cap; |
+ QTreeWidgetItem * itm_hdd_serNum; |
+ QTreeWidgetItem * itm_hdd_size; // îáúåì ïàìÿòè |
+ long size_lng; |
+ QString tmp_str; |
+ tmp_str = tr("Ƹñòêèé äèñê: "); |
+ sum_cap = sum_cap + hdd_list.at(i).size/1000/1000; |
+ |
+ tmp_str.append(hdd_list.at(i).caption); |
+ tmp_str.append(tr(" ")); |
+ size_lng = hdd_list.at(i).size; |
+ size_lng = size_lng/1000/1000; |
+ |
+ tmp_str.append(QVariant(int(size_lng)).asString()); |
+ tmp_str.append(tr(" ÌÁò s/n: ")); |
+ |
+ tmp_str.append(hdd_list.at(i).serialNumber); |
+ |
+ itm_hdd = new QTreeWidgetItem(itm_hdd_list); |
+ itm_hdd->setText(0, tmp_str); |
+ |
+ |
+ tmp_str = tr("Ìîäåëü: "); |
+ tmp_str.append((hdd_list.at(i).caption)); |
+ |
+ itm_hdd_cap = new QTreeWidgetItem(itm_hdd); |
+ itm_hdd_cap->setText(0, tmp_str); |
+ |
+ tmp_str = tr("Ïðîèçâîäèòåëü: "); |
+ tmp_str.append((hdd_list.at(i).manufacturer)); |
+ |
+ itm_hdd_man = new QTreeWidgetItem(itm_hdd); |
+ itm_hdd_man->setText(0, tmp_str); |
+ |
+ tmp_str = tr("Ðàçìåð äèñêà: "); |
+ tmp_str.append(QVariant(int(size_lng)).asString()); |
+ tmp_str.append(tr(" ÌÁò")); |
+ |
+ itm_hdd_size = new QTreeWidgetItem(itm_hdd); |
+ itm_hdd_size->setText(0, tmp_str); |
+ |
+ tmp_str = tr("Ñåðèéíûé íîìåð: "); |
+ tmp_str.append((hdd_list.at(i).serialNumber)); |
+ itm_hdd_serNum = itm_hdd_size = new QTreeWidgetItem(itm_hdd); |
+ itm_hdd_serNum->setText(0, tmp_str); |
+ |
+ |
+ } |
+ QString cap_str; |
+ cap_str = tr("Îáùèé îáú¸ì äèñêîâîãî ïðîñòðàíñòâà: "); |
+ cap_str.append(QVariant(sum_cap).asString()); |
+ cap_str.append(tr(" ÌÁò")); |
+ itm_hdd_list->setText(0, cap_str); |
+ |
+} |
+ |
+ |
+cdrom_list = MainWindow::getWmiCDROM(IP_str, user_name_str, password_str); |
+ |
+ |
+if (!cdrom_list.isEmpty()){ |
+ QTreeWidgetItem * itm_cdrom_list; |
+ |
+ itm_cdrom_list = new QTreeWidgetItem(itm_tmp); |
+ itm_cdrom_list->setText(0, tr("CD/DVD Ïðèâîäû:")); |
+ |
+ |
+ for (int i = 0; i < cdrom_list.count(); i++){ |
+ |
+ QTreeWidgetItem * itm_cdrom; |
+ QTreeWidgetItem * itm_cdrom_man; |
+ QTreeWidgetItem * itm_cdrom_cap; |
+ QString tmp_str; |
+ tmp_str = tr("Ïðèâîä: "); |
+ tmp_str.append(cdrom_list.at(i).name); |
+ |
+ itm_cdrom = new QTreeWidgetItem(itm_cdrom_list); |
+ itm_cdrom->setText(0, tmp_str); |
+ |
+ tmp_str = tr("Ìîäåëü: "); |
+ tmp_str.append(cdrom_list.at(i).name); |
+ |
+ |
+ itm_cdrom_cap = new QTreeWidgetItem( itm_cdrom); |
+ itm_cdrom_cap->setText(0, tmp_str); |
+ |
+ |
+ tmp_str = tr("Ïðîèçâîäèòåëü: "); |
+ tmp_str.append(cdrom_list.at(i).manufacturer); |
+ itm_cdrom_man = new QTreeWidgetItem( itm_cdrom); |
+ itm_cdrom_man->setText(0, tmp_str); |
+ |
+ ui->treeWidget_3->expandItem( itm_cdrom_list); |
+ |
+ } |
+ |
+ |
+ |
+} |
+ |
+ |
+netcadr_list = MainWindow::getWmiNetCard(IP_str, user_name_str, password_str); |
+ |
+ |
+if (!netcadr_list.isEmpty()){ |
+ QTreeWidgetItem * itm_netCard_list; |
+ |
+ itm_netCard_list = new QTreeWidgetItem(itm_tmp); |
+ itm_netCard_list->setText(0, tr("Ñåòåâûå êàðòû:")); |
+ |
+ |
+ for (int i = 0; i < cdrom_list.count(); i++){ |
+ |
+ QTreeWidgetItem * itm_net_card; |
+ QTreeWidgetItem * itm_net_card_mac; |
+ QTreeWidgetItem * itm_net_card_cap; |
+ QString tmp_str; |
+ tmp_str = tr("Ñåòåâàÿ êàðòà: "); |
+ tmp_str.append(netcadr_list.at(i).caption); |
+ |
+ itm_net_card = new QTreeWidgetItem(itm_netCard_list); |
+ itm_net_card->setText(0, tmp_str); |
+ |
+ |
+ tmp_str = tr("Ìîäåëü: "); |
+ tmp_str.append(netcadr_list.at(i).caption); |
+ |
+ |
+ itm_net_card_cap = new QTreeWidgetItem(itm_net_card); |
+ itm_net_card_cap->setText(0, tmp_str); |
+ |
+ |
+ tmp_str = tr("MAC àäðåñ: "); |
+ tmp_str.append(netcadr_list.at(i).MACAddress); |
+ itm_net_card_mac = new QTreeWidgetItem(itm_net_card); |
+ itm_net_card_mac->setText(0, tmp_str); |
+ |
+ ui->treeWidget_3->expandItem( itm_netCard_list); |
+ |
+ } |
+ |
+ } |
+ |
+soundcard_list = MainWindow::getWmiSoundCard(IP_str, user_name_str, password_str); |
+ |
+if (!soundcard_list.isEmpty()){ |
+ QTreeWidgetItem * itm_soundCard_list; |
+ |
+ itm_soundCard_list = new QTreeWidgetItem(itm_tmp); |
+ itm_soundCard_list->setText(0, tr("Çâóêîâûå êàðòû:")); |
+ |
+ |
+ for (int i = 0; i < cdrom_list.count(); i++){ |
+ |
+ QTreeWidgetItem * itm_sound_card; |
+ //QTreeWidgetItem * itm_net_card_mac; |
+ //QTreeWidgetItem * itm_sou_card_cap; |
+ QString tmp_str; |
+ tmp_str = tr("Çâóêîâàÿ êàðòà: "); |
+ tmp_str.append(soundcard_list.at(i).caption); |
+ |
+ itm_sound_card = new QTreeWidgetItem(itm_soundCard_list); |
+ itm_sound_card->setText(0, tmp_str); |
+ |
+ |
+ |
+ |
+ ui->treeWidget_3->expandItem( itm_soundCard_list); |
+ |
+ } |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ } |
+ |
+ui->treeWidget_3->expandItem(itm_tmp); |
+// itm_tmp->setChildIndicatorPolicy(QTreeWidget:: |
+int i; |
+i++; |
+ |
+ |
+ } //while |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
Index: trunk/DBViewer/Delete.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/DBViewer/Delete.png |
=================================================================== |
--- trunk/DBViewer/Delete.png (revision 0) |
+++ trunk/DBViewer/Delete.png (revision 257) |
/trunk/DBViewer/Delete.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/DBViewer/mymodel.cpp |
=================================================================== |
--- trunk/DBViewer/mymodel.cpp (revision 0) |
+++ trunk/DBViewer/mymodel.cpp (revision 257) |
@@ -0,0 +1,248 @@ |
+#include "mymodel.h" |
+ |
+MyModel::MyModel(QObject *parent) : |
+ QSqlTableModel(parent) |
+{ |
+ setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ icon_index = -1; |
+} |
+ |
+Qt::ItemFlags MyModel::flags( |
+ const QModelIndex &index) const { |
+Qt::ItemFlags flags = QSqlTableModel::flags(index); |
+ |
+ |
+ |
+ |
+/*********************************************** |
+ |
+if ((index.column() != 3) && (index.column() != 0)) |
+ flags |= Qt::ItemIsEditable; |
+//if (index.column() == 4) |
+// flags |= Qt::ItemIsUserCheckable; |
+else |
+{ |
+ if ((index.column() == 3) || (index.column() == 0)) flags &= ~Qt::ItemIsEditable; // çàïðåùàåì ðåäàêòèðîâàíèå òðåòüåãî ñòîëáöà |
+} |
+ |
+*************************************************/ |
+ |
+ if (bolleans_list.indexOf(index.column()) != -1) |
+{ |
+ flags |= Qt::ItemIsUserCheckable; // åñëè â ñòîëáöå òèï "BOOL", äåëàåì åãî âèáèðàåìûì |
+ //flags |= Qt::ItemIsEnabled; |
+ flags &= ~Qt::ItemIsEditable; |
+ } |
+ |
+ return flags; // òåêóùèé ñòîëáåö |
+ |
+ |
+} |
+ |
+ |
+bool MyModel::setData(const QModelIndex &index, const QVariant &value, int role) { |
+ bool lResult = false; |
+ if (bolleans_list.indexOf(index.column()) != -1) { |
+ |
+ lResult = QSqlTableModel::setData(index, value, Qt::EditRole); |
+ |
+ MyModel::submitAll(); |
+ |
+ } |
+ |
+ |
+ |
+ |
+ |
+ |
+else |
+ { |
+ lResult = QSqlTableModel::setData(index, value, role); |
+ if (lResult) { |
+ QModelIndex newindex; |
+ QSqlRecord rec = record(index.row()); |
+ |
+ if (value.isNull()) { |
+ rec.setNull(index.column()); |
+ |
+ } |
+ else rec.setValue(index.column(), value); |
+ |
+ rec.setGenerated(index.column(), true); |
+ lResult = updateRowInTable(index.row(), rec); |
+ |
+ |
+ |
+ |
+ |
+ |
+ } |
+ if (value.isNull()) { |
+ select(); |
+ emit dataChanged(index, index); |
+ } |
+ |
+ } |
+ |
+ return lResult; |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+QVariant MyModel::data(const QModelIndex &index, int role) const { |
+ |
+ QHash<int, bool> check; |
+ QVariant value = QSqlTableModel::data(index, role); |
+ QList <int> keys; |
+ QStringList values; |
+ QList <int> files_keys; |
+ QStringList files_values; |
+ keys = pointers_map.keys(); // ñïèñîê ñòîëáöîâ ñ óêàçàòåëÿìè |
+ values = pointers_map.values(); // ñïèñîê òàáëèö-õðàíèëèù îáúåêòîâ ðîäèòåëüñêèõ êëàññîâ |
+ files_keys = files_map.keys(); // ñïèñîê íîìåðîâ ñòîëáöîâ, õðàíÿùèõ ôàéëû |
+ files_values = files_map.values(); // ñïèñîê èìåò ñòîëáöîâ, õðàíÿùèõ ôàéëû |
+ |
+switch (role) { |
+ case Qt::DisplayRole: |
+ { |
+ //if (check.contains(index.column()) && check.value(index.column())) |
+ // return value.toInt() != 0 ? tr("Yes") : tr("No"); |
+ if (bolleans_list.indexOf(index.column()) != -1) |
+ { |
+ return value.toInt() != 0 ? tr("Äà") : tr("Íåò"); // äëÿ êîëîíîê ñ òèïîì "BOOL" |
+ } |
+ int index_of_list; |
+ index_of_list = keys.indexOf(index.column()); |
+ |
+ if (index_of_list == -1){ // ñòîëáåö íå ÿâëÿåòñÿ óêàçàòåëåì, ïðîâåðèì, ìîæåò îí õðàíèò ôàéë |
+ index_of_list = files_keys.indexOf(index.column()); |
+ if (index_of_list == -1) return value; // íåò, ñòîëáåö íå õðàíèò ôàéë |
+ QString file_name; |
+ QByteArray data_tmp; |
+ data_tmp = value.toByteArray(); |
+ if (data_tmp.isEmpty() || data_tmp.isNull()) return value; |
+ else { |
+ QDataStream out (&data_tmp,QIODevice::ReadOnly); |
+ out >> file_name; |
+ return file_name; |
+ } |
+ } |
+ else { |
+ QString parentInctance; |
+ QSqlQuery q; |
+ QString sql_str; |
+ bool ok; |
+ parentInctance = values.at(index_of_list); |
+ sql_str = tr("select * from `"); |
+ sql_str.append(parentInctance); |
+ sql_str.append(tr("` ")); |
+ sql_str.append(tr("where `ID` = ")); |
+ sql_str.append(value.toString()); |
+ q.prepare(sql_str); |
+ ok = q.exec(); |
+ |
+ if (ok) { |
+ while(q.next()){ |
+ QString object_name = q.value(1).toString(); |
+ if (!object_name.isEmpty()) return object_name; |
+ |
+ } |
+ } |
+ int ii; |
+ ii++; |
+ |
+ |
+ } |
+ return value; |
+ |
+ } |
+ // if (index.column() == 1) |
+ // return value.toString().prepend(tr("¹ ")); |
+ |
+ |
+ case Qt::EditRole: |
+ if (bolleans_list.indexOf(index.column()) == -1) return value; // òåêóùèé ñòîëáåö |
+ |
+ else { |
+ return value.toInt() != 0 ? tr("Äà") : tr("Íåò"); |
+ |
+ } |
+ ///return value; |
+ // if (index.column() == 1) |
+ // return value.toString().prepend(tr("¹ ")); |
+ |
+ |
+ |
+ |
+ case Qt::TextColorRole: |
+ if(index.column() == 1) |
+ return qVariantFromValue(QColor(Qt::blue)); |
+ else |
+ return value; |
+ case Qt::TextAlignmentRole: return value; |
+ case Qt::FontRole: |
+ if(index.column() == 1) { |
+ QFont font = QFont("Helvetica", 16, QFont::Bold); |
+ return qVariantFromValue(font); |
+ }else |
+ return value; |
+ |
+ case Qt::BackgroundColorRole: { |
+ int a = (index.row() % 2) ? 14 : 0; |
+ if(index.column() == 2) |
+ return qVariantFromValue(QColor(220,240-a,230-a)); |
+ else if(index.column() == 4) |
+ return qVariantFromValue(QColor(200,220-a,255-a)); |
+ else |
+ return value; |
+ } |
+ |
+ |
+ |
+ case Qt::CheckStateRole: |
+ { |
+ |
+ if (bolleans_list.indexOf(index.column()) == -1) return value; // òåêóùèé ñòîëáåö |
+ |
+ else |
+ { |
+ return (QSqlQueryModel::data(index).toInt() != 0) ? Qt::Checked : Qt::Unchecked; |
+ } |
+ } |
+ |
+ case Qt::SizeHintRole: |
+ { |
+ |
+ int height = value.toSize().height(); |
+ int widht = value.toSize().width(); |
+ if(index.column() == icon_index) { |
+ QVariant currentImage = QSqlTableModel::data(index, 0); |
+ QByteArray bytes = currentImage.toByteArray(); |
+ QPixmap pxmp; |
+ |
+ |
+ if (currentImage.isValid()) { |
+ pxmp.loadFromData(bytes); |
+ if (height < pxmp.height()) height = pxmp.height() +10; |
+ if (widht < pxmp.width()) widht = pxmp.width() +10; |
+ return QVariant(QSize(widht, height)); |
+ |
+ } |
+ else return value; |
+ |
+ } |
+ |
+ |
+ |
+ return value; |
+ } |
+ } |
+ return value; |
+} |
+ |
+ |
Index: trunk/DBViewer/settingform.h |
=================================================================== |
--- trunk/DBViewer/settingform.h (revision 0) |
+++ trunk/DBViewer/settingform.h (revision 257) |
@@ -0,0 +1,15 @@ |
+#ifndef __SETTINGFORM_H__ |
+#define __SETTINGFORM_H__ |
+#include <QWidget> |
+#include "ui_settingform.h" |
+// place your code here |
+class settingForm : public QWidget, public Ui::settingForm |
+{ |
+Q_OBJECT |
+public: |
+ settingForm(); |
+ |
+ private slots: |
+// void on_pushButton_clicked(); |
+}; |
+#endif // __SETTINGFORM_H__ |
/trunk/DBViewer/settingform.h |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/DBViewer/iconform.ui |
=================================================================== |
--- trunk/DBViewer/iconform.ui (revision 0) |
+++ trunk/DBViewer/iconform.ui (revision 257) |
@@ -0,0 +1,74 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>IconForm</class> |
+ <widget class="QWidget" name="IconForm"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>133</width> |
+ <height>69</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Form</string> |
+ </property> |
+ <property name="autoFillBackground"> |
+ <bool>true</bool> |
+ </property> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>31</width> |
+ <height>31</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="icon"> |
+ <iconset resource="dbviewer.qrc"> |
+ <normaloff>:/Open.png</normaloff>:/Open.png</iconset> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="pushButton_2"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>30</x> |
+ <y>0</y> |
+ <width>31</width> |
+ <height>30</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="icon"> |
+ <iconset resource="dbviewer.qrc"> |
+ <normaloff>:/Delete.png</normaloff>:/Delete.png</iconset> |
+ </property> |
+ </widget> |
+ <widget class="QLabel" name="label"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>70</x> |
+ <y>0</y> |
+ <width>61</width> |
+ <height>71</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="pixmap"> |
+ <pixmap>pc.png</pixmap> |
+ </property> |
+ </widget> |
+ </widget> |
+ <resources> |
+ <include location="dbviewer.qrc"/> |
+ </resources> |
+ <connections/> |
+</ui> |
Index: trunk/DBViewer/mainwindow.ui |
=================================================================== |
--- trunk/DBViewer/mainwindow.ui (revision 0) |
+++ trunk/DBViewer/mainwindow.ui (revision 257) |
@@ -0,0 +1,627 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>MainWindow</class> |
+ <widget class="QMainWindow" name="MainWindow"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>1104</width> |
+ <height>689</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>MainWindow</string> |
+ </property> |
+ <widget class="QWidget" name="centralWidget"> |
+ <widget class="QWidget" name="verticalLayoutWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>20</y> |
+ <width>1081</width> |
+ <height>611</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout"> |
+ <item> |
+ <widget class="QTabWidget" name="tabWidget"> |
+ <property name="currentIndex"> |
+ <number>0</number> |
+ </property> |
+ <widget class="QWidget" name="tab"> |
+ <attribute name="title"> |
+ <string>Данные</string> |
+ </attribute> |
+ <widget class="QWidget" name="horizontalLayoutWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>10</y> |
+ <width>1061</width> |
+ <height>561</height> |
+ </rect> |
+ </property> |
+ <layout class="QHBoxLayout" name="horizontalLayout"> |
+ <item> |
+ <widget class="QTreeWidget" name="treeWidget_2"> |
+ <property name="maximumSize"> |
+ <size> |
+ <width>400</width> |
+ <height>16777215</height> |
+ </size> |
+ </property> |
+ <column> |
+ <property name="text"> |
+ <string notr="true">1</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Тип узла</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>ID</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Хранилище</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Поле-указатель</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Фильтр</string> |
+ </property> |
+ </column> |
+ </widget> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_2"> |
+ <item> |
+ <widget class="QTableView" name="tableView"> |
+ <property name="sizePolicy"> |
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
+ <horstretch>3</horstretch> |
+ <verstretch>0</verstretch> |
+ </sizepolicy> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <layout class="QHBoxLayout" name="horizontalLayout_2"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_3"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="text"> |
+ <string>Добавить новый объект</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_3"> |
+ <property name="text"> |
+ <string>Применить</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <spacer name="horizontalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Horizontal</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>40</width> |
+ <height>20</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_4"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_2"> |
+ <property name="text"> |
+ <string>Удалить объект</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_4"> |
+ <property name="text"> |
+ <string>Сбросить изменения</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_2"> |
+ <attribute name="title"> |
+ <string>Модели</string> |
+ </attribute> |
+ <widget class="QWidget" name="horizontalLayoutWidget_2"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>9</y> |
+ <width>1051</width> |
+ <height>561</height> |
+ </rect> |
+ </property> |
+ <layout class="QHBoxLayout" name="horizontalLayout_3"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_5"> |
+ <item> |
+ <widget class="QTreeWidget" name="treeWidget"> |
+ <column> |
+ <property name="text"> |
+ <string notr="true">Имя класа</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>ID класса</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Ном. стр.</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Ур. вл.</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>row</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Фильтр</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>ID модели</string> |
+ </property> |
+ </column> |
+ </widget> |
+ </item> |
+ <item> |
+ <layout class="QHBoxLayout" name="horizontalLayout_4"> |
+ <item> |
+ <widget class="QComboBox" name="comboBox"> |
+ <property name="enabled"> |
+ <bool>false</bool> |
+ </property> |
+ <property name="editable"> |
+ <bool>false</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label"> |
+ <property name="text"> |
+ <string>ID</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_8"> |
+ <item> |
+ <widget class="QLabel" name="label_2"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>16</pointsize> |
+ <weight>75</weight> |
+ <italic>true</italic> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Модели</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QTableView" name="tableView_2"/> |
+ </item> |
+ <item> |
+ <layout class="QHBoxLayout" name="horizontalLayout_5"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_6"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_5"> |
+ <property name="text"> |
+ <string>Добавить модель</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_7"> |
+ <property name="text"> |
+ <string>Применить</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <spacer name="horizontalSpacer_2"> |
+ <property name="orientation"> |
+ <enum>Qt::Horizontal</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>40</width> |
+ <height>20</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_7"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_6"> |
+ <property name="text"> |
+ <string>Удалить модель</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_8"> |
+ <property name="text"> |
+ <string>Сбросить изменения</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_5"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>16</pointsize> |
+ <weight>75</weight> |
+ <italic>true</italic> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Фильтры</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QTableView" name="tableView_3"/> |
+ </item> |
+ <item> |
+ <layout class="QHBoxLayout" name="horizontalLayout_6"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_9"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_9"> |
+ <property name="text"> |
+ <string>Добавить фильтр</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_11"> |
+ <property name="text"> |
+ <string>Применить</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <spacer name="horizontalSpacer_3"> |
+ <property name="orientation"> |
+ <enum>Qt::Horizontal</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>40</width> |
+ <height>20</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_10"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_10"> |
+ <property name="text"> |
+ <string>Удалить фильтр</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_12"> |
+ <property name="text"> |
+ <string>Сбросить изменения</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_3"> |
+ <attribute name="title"> |
+ <string>Отчет</string> |
+ </attribute> |
+ <widget class="QWidget" name="horizontalLayoutWidget_3"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>1051</width> |
+ <height>561</height> |
+ </rect> |
+ </property> |
+ <layout class="QHBoxLayout" name="horizontalLayout_7"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_11"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_13"> |
+ <property name="text"> |
+ <string>Сформировать краткий отчёт</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_14"> |
+ <property name="text"> |
+ <string>Сформировать подробный отчёт</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_15"> |
+ <property name="text"> |
+ <string>Печать</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_16"> |
+ <property name="text"> |
+ <string>Печать в PDF</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_17"> |
+ <property name="text"> |
+ <string>Экспортировать OpenOffice</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_12"> |
+ <item> |
+ <widget class="QTextEdit" name="textEdit"/> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_4"> |
+ <attribute name="title"> |
+ <string>WMI</string> |
+ </attribute> |
+ <widget class="QWidget" name="horizontalLayoutWidget_4"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>9</x> |
+ <y>9</y> |
+ <width>1051</width> |
+ <height>561</height> |
+ </rect> |
+ </property> |
+ <layout class="QHBoxLayout" name="horizontalLayout_8"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_13"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_18"> |
+ <property name="text"> |
+ <string>Выполнить WMI запрос</string> |
+ </property> |
+ </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> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <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> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <widget class="QMenuBar" name="menuBar"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>1104</width> |
+ <height>20</height> |
+ </rect> |
+ </property> |
+ <widget class="QMenu" name="menu"> |
+ <property name="title"> |
+ <string>База данных</string> |
+ </property> |
+ <addaction name="getsettingAct"/> |
+ </widget> |
+ <addaction name="menu"/> |
+ </widget> |
+ <widget class="QToolBar" name="mainToolBar"> |
+ <attribute name="toolBarArea"> |
+ <enum>TopToolBarArea</enum> |
+ </attribute> |
+ <attribute name="toolBarBreak"> |
+ <bool>false</bool> |
+ </attribute> |
+ </widget> |
+ <widget class="QStatusBar" name="statusBar"/> |
+ <action name="getsettingAct"> |
+ <property name="text"> |
+ <string>Параметры соединения</string> |
+ </property> |
+ </action> |
+ </widget> |
+ <layoutdefault spacing="6" margin="11"/> |
+ <resources/> |
+ <connections/> |
+</ui> |
Index: trunk/DBViewer/fileform.h |
=================================================================== |
--- trunk/DBViewer/fileform.h (revision 0) |
+++ trunk/DBViewer/fileform.h (revision 257) |
@@ -0,0 +1,34 @@ |
+#ifndef FILEFORM_H |
+#define FILEFORM_H |
+ |
+#include <QWidget> |
+ |
+namespace Ui { |
+ class FileForm; |
+} |
+ |
+class FileForm : public QWidget { |
+ Q_OBJECT |
+public: |
+ FileForm(QWidget *parent = 0); |
+ ~FileForm(); |
+ void setData(QByteArray new_data); |
+ QByteArray data(){return Data;} |
+ bool dataIsChanged(){return fdataIsChanged;} |
+ |
+protected: |
+ void changeEvent(QEvent *e); |
+ |
+private: |
+ Ui::FileForm *ui; |
+ QByteArray Data; |
+ bool fdataIsChanged; |
+ |
+private slots: |
+ void on_pushButton_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü ôàéë" |
+ void on_pushButton_2_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ôàéë" |
+ void on_pushButton_3_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ñîõðàíèòü ôàéë" |
+ |
+}; |
+ |
+#endif // FILEFORM_H |
Index: trunk/DBViewer/treedelegateform.ui |
=================================================================== |
--- trunk/DBViewer/treedelegateform.ui (revision 0) |
+++ trunk/DBViewer/treedelegateform.ui (revision 257) |
@@ -0,0 +1,60 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>TreeDelegateForm</class> |
+ <widget class="QWidget" name="TreeDelegateForm"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>704</width> |
+ <height>202</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Form</string> |
+ </property> |
+ <widget class="QWidget" name="verticalLayoutWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>681</width> |
+ <height>181</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout"> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit"/> |
+ </item> |
+ <item> |
+ <layout class="QHBoxLayout" name="horizontalLayout"> |
+ <item> |
+ <widget class="QComboBox" name="comboBox"/> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_2"/> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_2"/> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <resources/> |
+ <connections/> |
+</ui> |
Index: trunk/DBViewer/delegate.cpp |
=================================================================== |
--- trunk/DBViewer/delegate.cpp (revision 0) |
+++ trunk/DBViewer/delegate.cpp (revision 257) |
@@ -0,0 +1,1428 @@ |
+ |
+ |
+/**************************************************************************** |
+** |
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
+** All rights reserved. |
+** Contact: Nokia Corporation (qt-info@nokia.com) |
+** |
+** This file is part of the examples of the Qt Toolkit. |
+** |
+** $QT_BEGIN_LICENSE:LGPL$ |
+** Commercial Usage |
+** Licensees holding valid Qt Commercial licenses may use this file in |
+** accordance with the Qt Commercial License Agreement provided with the |
+** Software or, alternatively, in accordance with the terms contained in |
+** a written agreement between you and Nokia. |
+** |
+** GNU Lesser General Public License Usage |
+** Alternatively, this file may be used under the terms of the GNU Lesser |
+** General Public License version 2.1 as published by the Free Software |
+** Foundation and appearing in the file LICENSE.LGPL included in the |
+** packaging of this file. Please review the following information to |
+** ensure the GNU Lesser General Public License version 2.1 requirements |
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
+** |
+** In addition, as a special exception, Nokia gives you certain additional |
+** rights. These rights are described in the Nokia Qt LGPL Exception |
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
+** |
+** GNU General Public License Usage |
+** Alternatively, this file may be used under the terms of the GNU |
+** General Public License version 3.0 as published by the Free Software |
+** Foundation and appearing in the file LICENSE.GPL included in the |
+** packaging of this file. Please review the following information to |
+** ensure the GNU General Public License version 3.0 requirements will be |
+** met: http://www.gnu.org/copyleft/gpl.html. |
+** |
+** If you have questions regarding the use of this file, please contact |
+** Nokia at qt-info@nokia.com. |
+** $QT_END_LICENSE$ |
+** |
+****************************************************************************/ |
+ |
+/* |
+ delegate.cpp |
+ |
+ A delegate that allows the user to change integer values from the model |
+ using a spin box widget. |
+*/ |
+ |
+#include <QtGui> |
+ |
+#include "delegate.h" |
+ |
+ |
+//! [0] |
+SpinBoxDelegate::SpinBoxDelegate(QObject *parent) |
+ : QItemDelegate(parent) |
+{ |
+} |
+//! [0] |
+ |
+void SpinBoxDelegate::setInctance(QString newInctance){ |
+ inctance = newInctance; |
+} |
+ |
+void SpinBoxDelegate::getItems(){ |
+ QMap <QString, QString> result_map; |
+ QSqlQuery q; |
+ QString query_str; |
+ bool ok; |
+ |
+ if (SpinBoxDelegate::inctance.isEmpty()) |
+ { |
+ items.clear(); |
+ return; |
+ } |
+ |
+ query_str = tr("select * from `"); |
+ query_str.append(inctance); |
+ query_str.append( tr("`")); |
+ |
+ q.prepare(query_str); |
+ |
+ |
+ ok = q.exec(); |
+ |
+ |
+ |
+ |
+ if (!ok) { |
+ /* |
+ QString error_str; |
+ error_str = tr("íå óäàëîñü ïîëó÷èòü ñïèñîê îáúåêòîâ èç òàáëèöû "); |
+ error_str.append(inctance); |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ // tr("íå óäàëîñü ïîëó÷èòü ñïèñîê îáúåêòîâ èç òàáëèöû ")); // Òåêñò ñîîáùåíèÿ. |
+ |
+ */ |
+ items.clear(); |
+ return; |
+ } |
+ |
+ |
+ // field_inctance = q.record().indexOf(tr("TableWhithInstance")); |
+ items.clear(); |
+ while(q.next()){ |
+ |
+ QString ID; |
+ QString Name; |
+ ID = q.value(0).toString(); // îïðåäåëÿåì ID |
+ Name = q.value(1).toString(); // îïðåäåëÿåì Name |
+ items.insert(ID, Name); |
+ } |
+ |
+ |
+ // return result_map; |
+} |
+ |
+ |
+//! [1] |
+QWidget *SpinBoxDelegate::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex &/* index */) const |
+{ |
+ //QSpinBox *editor = new QSpinBox(parent); |
+ //editor->setMinimum(0); |
+ //editor->setMaximum(100); |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ |
+ // getItems(); |
+ |
+ |
+ |
+ |
+ |
+ ID_list = items.keys(); |
+ Name_list = items.values(); |
+ |
+ QComboBox *editor = new QComboBox(parent); |
+ |
+/* |
+ editor->addItem("0"); |
+ editor->addItem("1"); |
+ editor->addItem("2"); |
+ editor->addItem("3"); |
+ editor->addItem("4"); |
+ editor->addItem("5"); |
+ editor->addItem("6"); |
+ editor->addItem("7"); |
+ editor->addItem("8"); |
+ editor->addItem("9"); |
+*/ |
+ |
+// editor->addItem("0"); |
+ |
+ editor->addItems(Name_list); |
+// editor->setEditable(false); |
+ return editor; |
+} |
+//! [1] |
+ |
+//! [2] |
+void SpinBoxDelegate::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+{ |
+ // int value = index.model()->data(index, Qt::EditRole).toInt(); |
+ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->setValue(value); |
+QString value = index.model()->data(index, Qt::EditRole).toString(); |
+ |
+QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ |
+QStringList ID_list; |
+QStringList Name_list; |
+int curr_index; |
+ |
+ID_list = items.keys(); |
+Name_list = items.values(); |
+ |
+curr_index = ID_list.indexOf(value); |
+if (curr_index==-1) return; |
+comboBox->setCurrentIndex(curr_index); |
+/**************************************************** |
+if (value == "0") comboBox->setCurrentIndex(0); |
+if (value == "1") comboBox->setCurrentIndex(1); |
+if (value == "2") comboBox->setCurrentIndex(2); |
+if (value == "3") comboBox->setCurrentIndex(3); |
+if (value == "4") comboBox->setCurrentIndex(4); |
+if (value == "5") comboBox->setCurrentIndex(5); |
+if (value == "6") comboBox->setCurrentIndex(6); |
+if (value == "7") comboBox->setCurrentIndex(7); |
+if (value == "8") comboBox->setCurrentIndex(8); |
+if (value == "9") comboBox->setCurrentIndex(9); |
+******************************************************/ |
+comboBox->setEditable(false); |
+ |
+ |
+//comboBox->setItemText(0, value); |
+ |
+} |
+//! [2] |
+ |
+//! [3] |
+void SpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const |
+{ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->interpretText(); |
+ // int value = spinBox->value(); |
+ |
+ // model->setData(index, value, Qt::EditRole); |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ |
+ QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ int currIndex; |
+ currIndex = comboBox->currentIndex(); |
+ if (currIndex==-1) return; |
+ // QString value = comboBox->itemText(currIndex); |
+ |
+ ID_list = items.keys(); |
+ Name_list = items.values(); |
+ |
+ QString value = ID_list.at(currIndex); |
+ model->setData(index, value, Qt::EditRole); |
+} |
+//! [3] |
+ |
+//! [4] |
+void SpinBoxDelegate::updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &/* index */) const |
+{ |
+ editor->setGeometry(option.rect); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+//! [0] |
+FilterSpinBoxDelegate::FilterSpinBoxDelegate(QObject *parent) |
+ : QItemDelegate(parent) |
+{ |
+} |
+//! [0] |
+ |
+void FilterSpinBoxDelegate::setClassID(QString newClassID){ |
+ class_id = newClassID; |
+} |
+ |
+void FilterSpinBoxDelegate::getItems(){ |
+ QMap <QString, QString> result_map; |
+ QSqlQuery q; |
+ QString query_str; |
+ bool ok; |
+ |
+ if (FilterSpinBoxDelegate::class_id.isEmpty()) |
+ { |
+ items.clear(); |
+ return; |
+ } |
+ |
+ query_str = tr("select * from `DescriptionOfClasses` where `ClassIdentifer` = '"); |
+ query_str.append(class_id); |
+ query_str.append( tr("'")); |
+ |
+ q.prepare(query_str); |
+ |
+ |
+ ok = q.exec(); |
+ |
+ |
+ |
+ |
+ if (!ok) { |
+ /* |
+ QString error_str; |
+ error_str = tr("íå óäàëîñü ïîëó÷èòü ñïèñîê îáúåêòîâ èç òàáëèöû "); |
+ error_str.append(inctance); |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ // tr("íå óäàëîñü ïîëó÷èòü ñïèñîê îáúåêòîâ èç òàáëèöû ")); // Òåêñò ñîîáùåíèÿ. |
+ |
+ */ |
+ items.clear(); |
+ return; |
+ } |
+ |
+ |
+ // field_inctance = q.record().indexOf(tr("TableWhithInstance")); |
+ items.clear(); |
+ while(q.next()){ |
+ |
+ QString ID; |
+ QString Name; |
+ ID = q.value(0).toString(); // îïðåäåëÿåì ID |
+ Name = q.value(1).toString(); // îïðåäåëÿåì Name |
+ items.insert(ID, Name); |
+ } |
+ |
+ |
+ // return result_map; |
+} |
+ |
+ |
+//! [1] |
+QWidget *FilterSpinBoxDelegate::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex &/* index */) const |
+{ |
+ //QSpinBox *editor = new QSpinBox(parent); |
+ //editor->setMinimum(0); |
+ //editor->setMaximum(100); |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ |
+ // getItems(); |
+ |
+ |
+ |
+ |
+ |
+ ID_list = items.keys(); |
+ Name_list = items.values(); |
+ |
+ QComboBox *editor = new QComboBox(parent); |
+ |
+/* |
+ editor->addItem("0"); |
+ editor->addItem("1"); |
+ editor->addItem("2"); |
+ editor->addItem("3"); |
+ editor->addItem("4"); |
+ editor->addItem("5"); |
+ editor->addItem("6"); |
+ editor->addItem("7"); |
+ editor->addItem("8"); |
+ editor->addItem("9"); |
+*/ |
+ |
+// editor->addItem("0"); |
+ |
+ editor->addItems(Name_list); |
+// editor->setEditable(false); |
+ return editor; |
+} |
+//! [1] |
+ |
+//! [2] |
+void FilterSpinBoxDelegate::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+{ |
+ // int value = index.model()->data(index, Qt::EditRole).toInt(); |
+ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->setValue(value); |
+QString value = index.model()->data(index, Qt::EditRole).toString(); |
+ |
+QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ |
+QStringList ID_list; |
+QStringList Name_list; |
+int curr_index; |
+ |
+ID_list = items.keys(); |
+Name_list = items.values(); |
+ |
+curr_index = ID_list.indexOf(value); |
+if (curr_index==-1) return; |
+comboBox->setCurrentIndex(curr_index); |
+/**************************************************** |
+if (value == "0") comboBox->setCurrentIndex(0); |
+if (value == "1") comboBox->setCurrentIndex(1); |
+if (value == "2") comboBox->setCurrentIndex(2); |
+if (value == "3") comboBox->setCurrentIndex(3); |
+if (value == "4") comboBox->setCurrentIndex(4); |
+if (value == "5") comboBox->setCurrentIndex(5); |
+if (value == "6") comboBox->setCurrentIndex(6); |
+if (value == "7") comboBox->setCurrentIndex(7); |
+if (value == "8") comboBox->setCurrentIndex(8); |
+if (value == "9") comboBox->setCurrentIndex(9); |
+******************************************************/ |
+comboBox->setEditable(false); |
+ |
+ |
+//comboBox->setItemText(0, value); |
+ |
+} |
+//! [2] |
+ |
+//! [3] |
+void FilterSpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const |
+{ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->interpretText(); |
+ // int value = spinBox->value(); |
+ |
+ // model->setData(index, value, Qt::EditRole); |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ |
+ QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ int currIndex; |
+ currIndex = comboBox->currentIndex(); |
+ if (currIndex==-1) return; |
+ // QString value = comboBox->itemText(currIndex); |
+ |
+ ID_list = items.keys(); |
+ Name_list = items.values(); |
+ |
+ // QString value = ID_list.at(currIndex); |
+ QString value = Name_list.at(currIndex); |
+ model->setData(index, value, Qt::EditRole); |
+} |
+//! [3] |
+ |
+//! [4] |
+void FilterSpinBoxDelegate::updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &/* index */) const |
+{ |
+ editor->setGeometry(option.rect); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+//! [0] |
+FilterConditionDelegate::FilterConditionDelegate(QObject *parent) |
+ : QItemDelegate(parent) |
+{ |
+} |
+//! [0] |
+ |
+void FilterConditionDelegate::setClassID(QString newClassID){ |
+ class_id = newClassID; |
+} |
+ |
+ |
+ |
+//! [1] |
+QWidget *FilterConditionDelegate::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex &/* index */) const |
+{ |
+ QStringList Name_list; |
+ |
+ Name_list = items; |
+ |
+ QComboBox *editor = new QComboBox(parent); |
+ |
+/* |
+ editor->addItem("0"); |
+ editor->addItem("1"); |
+ editor->addItem("2"); |
+ editor->addItem("3"); |
+ editor->addItem("4"); |
+ editor->addItem("5"); |
+ editor->addItem("6"); |
+ editor->addItem("7"); |
+ editor->addItem("8"); |
+ editor->addItem("9"); |
+*/ |
+ |
+// editor->addItem("0"); |
+ |
+ editor->addItems(Name_list); |
+// editor->setEditable(false); |
+ return editor; |
+} |
+//! [1] |
+ |
+//! [2] |
+void FilterConditionDelegate::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+{ |
+ // int value = index.model()->data(index, Qt::EditRole).toInt(); |
+ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->setValue(value); |
+QString value = index.model()->data(index, Qt::EditRole).toString(); |
+ |
+QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ |
+//QStringList ID_list; |
+//QStringList Name_list; |
+int curr_index; |
+ |
+//ID_list = items.keys(); |
+//Name_list = items.values(); |
+ |
+curr_index = items.indexOf(value); |
+if (curr_index==-1) return; |
+comboBox->setCurrentIndex(curr_index); |
+/**************************************************** |
+if (value == "0") comboBox->setCurrentIndex(0); |
+if (value == "1") comboBox->setCurrentIndex(1); |
+if (value == "2") comboBox->setCurrentIndex(2); |
+if (value == "3") comboBox->setCurrentIndex(3); |
+if (value == "4") comboBox->setCurrentIndex(4); |
+if (value == "5") comboBox->setCurrentIndex(5); |
+if (value == "6") comboBox->setCurrentIndex(6); |
+if (value == "7") comboBox->setCurrentIndex(7); |
+if (value == "8") comboBox->setCurrentIndex(8); |
+if (value == "9") comboBox->setCurrentIndex(9); |
+******************************************************/ |
+comboBox->setEditable(false); |
+ |
+ |
+//comboBox->setItemText(0, value); |
+ |
+} |
+//! [2] |
+ |
+//! [3] |
+void FilterConditionDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const |
+{ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->interpretText(); |
+ // int value = spinBox->value(); |
+ |
+ // model->setData(index, value, Qt::EditRole); |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ |
+ QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ int currIndex; |
+ currIndex = comboBox->currentIndex(); |
+ if (currIndex==-1) return; |
+ // QString value = comboBox->itemText(currIndex); |
+ |
+ // ID_list = items.keys(); |
+ // Name_list = items.values(); |
+ |
+ // QString value = ID_list.at(currIndex); |
+ QString value = items.at(currIndex); |
+ model->setData(index, value, Qt::EditRole); |
+} |
+//! [3] |
+ |
+//! [4] |
+void FilterConditionDelegate::updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &/* index */) const |
+{ |
+ editor->setGeometry(option.rect); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+FilterValueDelegate::FilterValueDelegate(QObject *parent) |
+ : QItemDelegate(parent) |
+{ |
+} |
+//! [0] |
+ |
+void FilterValueDelegate::setClassID(QString newClassID){ |
+ class_id = newClassID; |
+} |
+ |
+ |
+ |
+// ïîëó÷àåì èìÿ òàáëèöû - õðàíèëèùà îáúåêòîâ êëàññà |
+QString FilterValueDelegate::getClassInctanc(QString class_id){ |
+ |
+ |
+ |
+ |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString result; |
+ QString classInctance; |
+ int field_inctance; |
+ bool ok; |
+ sql_str = tr("select * " |
+ " from ListOfClasses where ListOfClasses.ID = '" //îïðåäåëèì êëàññû, äëÿ êîòîðûõ êîðíåâîé ÿâëÿåòñÿ êîíòåéíåðîì |
+ ); |
+ sql_str.append(class_id); |
+ sql_str.append(tr("'")); |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ |
+ if (!ok) return result; |
+ |
+ /* |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result; |
+ } |
+ |
+ */ |
+ |
+ |
+ |
+ |
+ field_inctance = q.record().indexOf(tr("TableWhithInstance")); |
+ while(q.next()){ |
+ |
+ classInctance = q.value(field_inctance).toString(); |
+ result.append(classInctance); |
+ } |
+ |
+ return result; |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ QString FilterValueDelegate::getFieldType(QString class_id, QString fieldName)//îïðåäåëÿåì òèï äàííûõ ïîëÿ |
+ { |
+ |
+ } |
+ |
+ QMap<QString, QString> FilterValueDelegate::getItems(QString inctance){ // âîçâðàùàåì ñïèñîê âñåõ çíà÷åíèé èç òàáëèöû-õðàíèëèùà |
+ QSqlQuery q; |
+ QString sql_str; |
+ QStringList keys_list; |
+ QStringList values_list; |
+ QMap<QString, QString> result_map; |
+ |
+ |
+ |
+ |
+ bool ok; |
+ sql_str = tr("select * from `"); |
+ sql_str.append(inctance); |
+ sql_str.append(tr("`")); |
+ ok = q.prepare(sql_str); |
+ ok = q.exec(); |
+ if(!ok) return result_map; |
+ while (q.next()){ |
+ QString key_tmp; |
+ QString value_tmp; |
+ |
+ key_tmp = q.record().value(0).asString(); //îïðåäåëÿåì id îáúåêòà |
+ //keys_list.append(tmp_str); // äîáàâèì â ñïèñîê êëþ÷åé |
+ |
+ value_tmp = q.record().value(1).asString(); //îïðåäåëÿåì èìÿ îáúåêòà |
+ |
+ result_map.insert(key_tmp, value_tmp); |
+ // values_list.append(tmp_str); |
+ |
+ |
+ } |
+ |
+ |
+ |
+ |
+ |
+ return result_map; |
+ |
+ } |
+ |
+ |
+ |
+ |
+//! [1] |
+QWidget *FilterValueDelegate::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex &/* index */) const |
+{ |
+ QStringList Name_list; |
+ |
+ Name_list = items; |
+ |
+ QComboBox *editor = new QComboBox(parent); |
+ |
+/* |
+ editor->addItem("0"); |
+ editor->addItem("1"); |
+ editor->addItem("2"); |
+ editor->addItem("3"); |
+ editor->addItem("4"); |
+ editor->addItem("5"); |
+ editor->addItem("6"); |
+ editor->addItem("7"); |
+ editor->addItem("8"); |
+ editor->addItem("9"); |
+*/ |
+ |
+// editor->addItem("0"); |
+ |
+// // // editor->addItems(Name_list); |
+ editor->setEditable(true); |
+ return editor; |
+} |
+//! [1] |
+ |
+ |
+ |
+ |
+TField FilterValueDelegate::getField(const QModelIndex &index) // ïî èíäåêñó (â òàáëèöå ôèëüòðîâ) ïîëó÷èì èíôîðìàöèþ î ïîëå |
+{ |
+ const QAbstractItemModel * model = index.model(); |
+ |
+ TField field_result; |
+ QSqlQuery q; |
+ QString sql_str; |
+ bool ok; |
+ |
+ |
+ // QString fieldName = index.model()->data(model->index(index.row(),4), Qt::EditRole).toString(); |
+ // QString class_id = index.model()->data(model->index(index.row(),2), Qt::EditRole).toString(); |
+ field_result.FieldName = index.model()->data(model->index(index.row(),4), Qt::EditRole).toString(); |
+ field_result.ClassIdentifer = index.model()->data(model->index(index.row(),2), Qt::EditRole).toString(); |
+ |
+ sql_str = tr("select * from `DescriptionOfClasses` where `ClassIdentifer` = '"); |
+ sql_str.append(field_result.ClassIdentifer); |
+ sql_str.append(tr("' and `FieldName` = '")); |
+ sql_str.append(field_result.FieldName); |
+ sql_str.append(tr("'")); |
+ |
+ ok = q.prepare(sql_str); |
+ |
+ if(!ok) return field_result; |
+ |
+ ok = q.exec(); |
+ |
+ if(!ok) return field_result; |
+ |
+ int ID_index = q.record().indexOf(tr("ID")); |
+ |
+ int FieldAlias_index = q.record().indexOf(tr("FieldAlias")); |
+ |
+ int FieldType_index = q.record().indexOf(tr("FieldType")); |
+ |
+ int DefaultValue_index = q.record().indexOf(tr("DefaultValue")); |
+ |
+ int Comment_index = q.record().indexOf(tr("Comment")); |
+ |
+ |
+ |
+ while(q.next()){ |
+ field_result.ID = q.value(ID_index).asString(); |
+ field_result.FieldAlias = q.value(FieldAlias_index).asString(); |
+ field_result.FieldType = q.value(FieldType_index).asString(); |
+ field_result.DefaultValue = q.value(DefaultValue_index).asString(); |
+ field_result.Comment = q.value(Comment_index).asString(); |
+ } |
+ |
+ return field_result; |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+//! [2] |
+void FilterValueDelegate::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+{ |
+ // int value = index.model()->data(index, Qt::EditRole).toInt(); |
+ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->setValue(value); |
+ |
+ |
+const QAbstractItemModel * model = index.model(); |
+ |
+ |
+QString value = index.model()->data(index, Qt::EditRole).toString(); |
+QString class_id = index.model()->data(model->index(index.row(),2), Qt::EditRole).toString(); |
+QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+QString inctance; //õðàíèëèùå îáúåêòîâ êëàññà |
+QString fieldName;//èìÿ ïîëÿ |
+QSqlQuery q; |
+QString sql_str; |
+QStringList itemsList; |
+bool ok; |
+TField Field; |
+ |
+Field = getField(index); |
+ |
+ |
+if (Field.FieldType == tr("pointer")){ // åñëè äàííîå ïîëå õðàíèò óêàçàòåëè íà êëàññ-êîíòåéíåð |
+ QString parent_inctance; |
+ QMap<QString, QString> items_map; |
+ QStringList items_list; |
+ |
+ parent_inctance = getClassInctanc(Field.DefaultValue);// îïðåäåëÿåì õðàíèëèùå îáúåêòîâ êëàññà-êîíòåéíåðà |
+ items_map = getItems(parent_inctance); |
+ items_list = items_map.values(); |
+ |
+ comboBox->addItems(items_list); |
+ if (items_list.indexOf(value)!=-1) comboBox->setCurrentIndex(items_list.indexOf(value)); |
+ return; |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+fieldName = index.model()->data(model->index(index.row(),4), Qt::EditRole).toString(); |
+ |
+ |
+inctance = FilterValueDelegate::getClassInctanc(class_id); |
+if (!inctance.isEmpty() && !fieldName.isEmpty()){ |
+sql_str = tr("select `"); |
+sql_str.append(fieldName); |
+sql_str.append(tr("` from `")); |
+sql_str.append(inctance); |
+sql_str.append(tr("`")); |
+ok = q.prepare(sql_str); |
+ok = q.exec(); |
+ |
+while(q.next()){ |
+QString tmp_str; |
+tmp_str = q.record().value(fieldName).asString(); |
+itemsList.append(tmp_str); |
+FilterValueDelegate::items.append(tmp_str); |
+ } |
+if(!itemsList.isEmpty()) { |
+ comboBox->addItems(itemsList); |
+ items = itemsList; // ãëîáàëüãàÿ ïåðåìåííàÿ |
+ } |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+//QStringList ID_list; |
+//QStringList Name_list; |
+int curr_index; |
+ |
+//ID_list = items.keys(); |
+//Name_list = items.values(); |
+ |
+curr_index = itemsList.indexOf(value); |
+if (curr_index==-1) return; |
+comboBox->setCurrentIndex(curr_index); |
+/**************************************************** |
+if (value == "0") comboBox->setCurrentIndex(0); |
+if (value == "1") comboBox->setCurrentIndex(1); |
+if (value == "2") comboBox->setCurrentIndex(2); |
+if (value == "3") comboBox->setCurrentIndex(3); |
+if (value == "4") comboBox->setCurrentIndex(4); |
+if (value == "5") comboBox->setCurrentIndex(5); |
+if (value == "6") comboBox->setCurrentIndex(6); |
+if (value == "7") comboBox->setCurrentIndex(7); |
+if (value == "8") comboBox->setCurrentIndex(8); |
+if (value == "9") comboBox->setCurrentIndex(9); |
+******************************************************/ |
+comboBox->setEditable(true); |
+ |
+ |
+//comboBox->setItemText(0, value); |
+ |
+} |
+//! [2] |
+ |
+//! [3] |
+void FilterValueDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const |
+{ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->interpretText(); |
+ // int value = spinBox->value(); |
+ |
+ // model->setData(index, value, Qt::EditRole); |
+ |
+ QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ int currIndex; |
+ currIndex = comboBox->currentIndex(); |
+ |
+ if (currIndex==-1) return; |
+ |
+ QString new_value = comboBox->itemText(currIndex); |
+ |
+ QString curr_value = model->data(index, Qt::EditRole).toString();//òåêóùåå çíà÷åíèå â ìîäåëè |
+ |
+ |
+ |
+ QString class_id = model->data(model->index(index.row(),2), Qt::EditRole).toString();//îïðåäåëèì êëàññ, ê êîòîðîìó ïðåíàäëåæèò ïîëå |
+ |
+ |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ |
+ |
+ TField Field; |
+ |
+ Field = getField(index); |
+ |
+ if(Field.FieldType==tr("pointer")){ |
+ QString parent_inctance; |
+ QMap<QString, QString> items_map; |
+ QStringList keys_list; // ñïèñîê ID îáúåêòîâ ðîäèòåëüñêîãî êëàññà |
+ QStringList values_list; //ñïèñîê èìåí îáúåêòîâ ðîäèòåëüñêîãî êëàññà |
+ |
+ |
+ |
+ parent_inctance = getClassInctanc(Field.DefaultValue);// îïðåäåëÿåì õðàíèëèùå îáúåêòîâ êëàññà-êîíòåéíåðà |
+ items_map = getItems(parent_inctance); // |
+ keys_list = items_map.keys(); |
+ values_list = items_map.values(); |
+ |
+ if( values_list.indexOf(new_value)!=-1){ // |
+ |
+ QString new_key = keys_list.at(values_list.indexOf(new_value)); // îïðåäåëÿåì íîâîå ØÂ |
+ if (new_key != curr_value) model->setData(index, new_key, Qt::EditRole); |
+ return; |
+ } |
+ |
+ |
+ |
+ |
+ } |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ // QString new_value = comboBox->itemText(currIndex); |
+ |
+ |
+ |
+ |
+ // ID_list = items.keys(); |
+ // Name_list = items.values(); |
+ |
+ // QString value = ID_list.at(currIndex); |
+ // QString value = items.at(currIndex); |
+ model->setData(index, new_value, Qt::EditRole); |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+//! [3] |
+ |
+//! [4] |
+void FilterValueDelegate::updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &/* index */) const |
+{ |
+ editor->setGeometry(option.rect); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+//! [4] |
+MyDEDelegate::MyDEDelegate( |
+ bool calpopup, |
+ QObject *parent) |
+ : QItemDelegate(parent), |
+ m_calpopup(calpopup) { |
+ } |
+ |
+ QWidget *MyDEDelegate::createEditor( |
+ QWidget *parent, |
+ const QStyleOptionViewItem& /* option */, |
+ const QModelIndex& /* index */) const { |
+ QDateEdit *editor = new QDateEdit(parent); |
+ editor->setCalendarPopup(m_calpopup); |
+ editor->installEventFilter(const_cast<MyDEDelegate*>(this)); |
+ return editor; |
+ } |
+ |
+ void MyDEDelegate::setEditorData( |
+ QWidget *editor, |
+ const QModelIndex &index) const { |
+ QDate value = index.model()->data( |
+ index, Qt::EditRole).toDate(); |
+ QDateEdit *de = static_cast<QDateEdit*>(editor); |
+ de->setDate(value); |
+ } |
+ |
+ void MyDEDelegate::setModelData( |
+ QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex& index) const { |
+ QDateEdit *de = static_cast<QDateEdit*>(editor); |
+ de->interpretText(); |
+ QDate value = de->date(); |
+ model->setData(index, value); |
+ } |
+ |
+ void MyDEDelegate::updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex& /* index */) const { |
+ |
+ |
+ |
+ editor->setGeometry(option.rect); |
+ } |
+ |
+ |
+ |
+ |
+ |
+ CPictureDelegate::CPictureDelegate( QObject * parent ) : QItemDelegate(parent) |
+ { |
+ } |
+ |
+ void CPictureDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const |
+ { |
+ m_pxPicture.fill( QColor(Qt::white) ); |
+ |
+ const QAbstractItemModel * model = index.model(); |
+ QString sFileName = model->data( index, Qt::DisplayRole ).toString(); |
+ |
+ if ( !sFileName.isEmpty() ) |
+ m_pxPicture.load( sFileName ); |
+ else { |
+ //QItemDelegate::paint(painter, option, index); |
+ return; |
+ } |
+ |
+ QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ? |
+ ((option.state & QStyle::State_Active) ? QPalette::Normal : QPalette::Inactive ) : |
+ QPalette::Disabled; |
+ |
+ if (option.state & QStyle::State_Selected) |
+ painter->fillRect(option.rect, option.palette.color(cg, QPalette::Highlight)); |
+ |
+ int nX = option.rect.x() + ( ( option.rect.width() - m_pxPicture.rect().width() ) / 2 ); |
+ int nY = option.rect.y() + ( ( option.rect.height() - m_pxPicture.rect().height() ) / 2 ); |
+ painter->drawPixmap( nX, nY, m_pxPicture ); |
+ |
+ |
+ //// drawFocus(painter, option, option.rect.adjusted(0, 0, -1, -1)); // since we draw the grid ourselves |
+ |
+ /* |
+ QPen pen = painter->pen(); |
+ painter->setPen(option.palette.color(QPalette::Mid)); |
+ painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight()); |
+ painter->drawLine(option.rect.topRight(), option.rect.bottomRight()); |
+ painter->setPen(pen); |
+ */ |
+ } |
+ |
+ |
+ |
+ |
+ void TimeEditDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const |
+ { |
+ int datetime = index.model()->data(index, Qt::DisplayRole).toInt(); |
+ |
+ QString indexvalue = ""; |
+ |
+ if (datetime > 0) |
+ { |
+ QDateTime dateTime2 = QDateTime(); |
+ dateTime2.setTime_t(datetime); |
+ indexvalue = dateTime2.toString(this->timeformat); |
+ } |
+ else |
+ { |
+ indexvalue = tr("Date not set"); |
+ } |
+ |
+ Q_ASSERT(index.isValid()); |
+ |
+ QStyleOptionViewItemV3 opt = setOptions(index, option); |
+ |
+ const QStyleOptionViewItemV2 *v2 = qstyleoption_cast<const QStyleOptionViewItemV2 *>(&option); |
+ opt.features = v2 ? v2->features |
+ : QStyleOptionViewItemV2::ViewItemFeatures(QStyleOptionViewItemV2::None); |
+ const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const QStyleOptionViewItemV3 *>(&option); |
+ opt.locale = v3 ? v3->locale : QLocale(); |
+ opt.widget = v3 ? v3->widget : 0; |
+ |
+ // prepare |
+ painter->save(); |
+ |
+ painter->setClipRect(opt.rect); |
+ |
+ // get the data and the rectangles |
+ QVariant value; |
+ |
+ QPixmap pixmap; |
+ QRect decorationRect; |
+ value = index.data(Qt::DecorationRole); |
+ |
+ QString text; |
+ QRect displayRect; |
+ value = index.data(Qt::DisplayRole); |
+ if (value.isValid()) { |
+ text = indexvalue; |
+ displayRect = textRectangle(painter, option.rect, opt.font, text); |
+ } |
+ |
+ QRect checkRect; |
+ Qt::CheckState checkState = Qt::Unchecked; |
+ value = index.data(Qt::CheckStateRole); |
+ if (value.isValid()) { |
+ checkState = static_cast<Qt::CheckState>(value.toInt()); |
+ checkRect = check(opt, opt.rect, value); |
+ } |
+ |
+ // do the layout |
+ doLayout(opt, &checkRect, &decorationRect, &displayRect, false); |
+ // draw the item |
+ |
+ drawBackground(painter, opt, index); |
+ drawCheck(painter, opt, checkRect, checkState); |
+ drawDecoration(painter, opt, decorationRect, pixmap); |
+ drawDisplay(painter, opt, displayRect, text); |
+ drawFocus(painter, opt, displayRect); |
+ |
+ // done |
+ painter->restore(); |
+ } |
+ |
+ |
+ |
+ |
+ |
+ |
+ IconDelegate::IconDelegate( QObject * parent ) : QItemDelegate(parent) |
+ { |
+ } |
+ |
+ |
+ |
+ |
+ |
+ QWidget *IconDelegate::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex & /* index */) const |
+ { |
+ |
+ IconForm *editor = new IconForm(parent); |
+ |
+ return editor; |
+ |
+ } |
+ |
+ |
+ |
+ |
+ void IconDelegate::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+ { |
+ |
+ |
+ const QAbstractItemModel * model = index.model(); |
+ IconForm *icnFrm = static_cast<IconForm*>(editor); |
+ QVariant currentImage = model->data(index,0); |
+ QByteArray bytes = currentImage.toByteArray(); |
+ if (currentImage.isValid()) { |
+ m_pxPicture.loadFromData(bytes); |
+ } |
+ else { |
+ //QItemDelegate::paint(painter, option, index); |
+ |
+ |
+ return; |
+ } |
+ icnFrm->setPixmap(m_pxPicture); |
+ // tblView->setRowHeight(index.row(), icnFrm->geometry().height()); |
+ } |
+ |
+ |
+ |
+ |
+ void IconDelegate::setModelData( |
+ QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex& index) const { |
+ IconForm *icnFrm = static_cast<IconForm*>(editor); |
+ if (!(icnFrm->dataIsChanged())) return; |
+ |
+ m_pxPicture = icnFrm->pixmap(); |
+ QImage currentImage = m_pxPicture.toImage(); |
+ QByteArray bytes; |
+ QBuffer buffer(&bytes); |
+ buffer.open(QIODevice::WriteOnly); |
+ currentImage.save(&buffer, "PNG"); |
+ |
+ |
+ |
+ |
+ model->setData(index, QVariant (bytes), Qt::EditRole); |
+ |
+ // int widht = m_pxPicture.width(); |
+ // int heigh = m_pxPicture.height(); |
+ // tblView->setRowHeight(index.row(), heigh + 10); |
+ // model->submitAll(); |
+ |
+ |
+ |
+ |
+ // model->setData(index, value); |
+ } |
+ |
+ |
+ |
+ void IconDelegate::updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex& /* index */) const { |
+ |
+ |
+ // QRect r(option.rect.x() + option.rect.width()/2 - 7, option.rect.y() + option.rect.height()/2 - 7, 150, 100); |
+ // editor->setGeometry(r); |
+ |
+ editor->setGeometry(option.rect); |
+ } |
+ |
+ |
+ |
+ |
+ void IconDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const |
+ { |
+ |
+ |
+ m_pxPicture.fill( QColor(Qt::white) ); |
+ |
+ const QAbstractItemModel * model = index.model(); |
+ QString sFileName = model->data( index, Qt::DisplayRole ).toString(); |
+ |
+ QVariant currentImage = model->data(index,0); |
+ |
+ |
+ QByteArray bytes = currentImage.toByteArray(); |
+ // QImage image; |
+ // image.loadFromData(bytes); |
+ |
+ |
+ if (currentImage.isValid()) { |
+ m_pxPicture.loadFromData(bytes); |
+ |
+ } |
+ else { |
+ //QItemDelegate::paint(painter, option, index); |
+ return; |
+ } |
+ |
+ |
+ |
+ |
+ |
+ /* |
+ |
+ if ( !sFileName.isEmpty() ) |
+ m_pxPicture.load( sFileName ); |
+ else { |
+ //QItemDelegate::paint(painter, option, index); |
+ return; |
+ } |
+*/ |
+ |
+ |
+ |
+ |
+ |
+ QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ? |
+ ((option.state & QStyle::State_Active) ? QPalette::Normal : QPalette::Inactive ) : |
+ QPalette::Disabled; |
+ |
+ if (option.state & QStyle::State_Selected) |
+ |
+ |
+ painter->fillRect(option.rect, option.palette.color(cg, QPalette::Highlight)); |
+ |
+ |
+ |
+ int nX = option.rect.x() + ( ( option.rect.width() - m_pxPicture.rect().width() ) / 2 ); |
+ int nY = option.rect.y() + ( ( option.rect.height() - m_pxPicture.rect().height() ) / 2 ); |
+ // painter->setRenderHint(QPainter::Antialiasing); |
+ painter->drawPixmap( nX, nY, m_pxPicture ); |
+ |
+ // drawFocus(painter, option, option.rect.adjusted(0, 0, -1, -1)); // since we draw the grid ourselves |
+ |
+ /* |
+ QPen pen = painter->pen(); |
+ painter->setPen(option.palette.color(QPalette::Mid)); |
+ painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight()); |
+ painter->drawLine(option.rect.topRight(), option.rect.bottomRight()); |
+ painter->setPen(pen); |
+ */ |
+} |
+ |
+ |
+ void IconDelegate::setTableView(QTableView* table){ |
+ tblView = table; |
+ } |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ FileDelegate::FileDelegate( QObject * parent ) : QItemDelegate(parent) |
+ { |
+ } |
+ |
+ |
+ |
+ |
+ |
+ QWidget *FileDelegate::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex & /* index */) const |
+ { |
+ |
+ FileForm *editor = new FileForm(parent); |
+ |
+ return editor; |
+ |
+ } |
+ |
+ |
+ |
+ |
+ void FileDelegate::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+ { |
+ |
+ |
+ const QAbstractItemModel * model = index.model(); |
+ FileForm *flFrm = static_cast<FileForm*>(editor); |
+ QVariant currentData = model->data(index,Qt::EditRole); |
+ |
+ // QVariant currentData = QSqlTableModel::data(index, 0); |
+ QByteArray bytes = currentData.toByteArray(); |
+ if (currentData.isValid()) flFrm->setData(bytes); |
+ else return; |
+ |
+ } |
+ |
+ |
+ |
+ |
+void FileDelegate::setModelData( |
+ QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex& index) const { |
+ FileForm *flFrm = static_cast<FileForm*>(editor); |
+ if (!(flFrm->dataIsChanged())) return; |
+ |
+ m_Data = flFrm->data(); |
+ if (!m_Data.isEmpty()) { // åñëè ìàññèâ íå ïóñòîé |
+ model->setData(index, QVariant (m_Data), Qt::EditRole); |
+ |
+ } |
+ else { // åñëè ìàññèâ ïóñòîé (ôàéë óäàëèëè) |
+ QVariant val_null; |
+ model->setData(index, val_null, Qt::EditRole); |
+ |
+ } |
+ |
+ |
+ |
+ } |
+ |
+ |
+ |
+ void FileDelegate::updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex& /* index */) const { |
+ |
+ |
+ // QRect r(option.rect.x() + option.rect.width()/2 - 7, option.rect.y() + option.rect.height()/2 - 7, 150, 100); |
+ // editor->setGeometry(r); |
+ |
+ editor->setGeometry(option.rect); |
+ } |
+ |
+ |
+ |
+ |
Index: trunk/DBViewer/dbviewer.qrc |
=================================================================== |
--- trunk/DBViewer/dbviewer.qrc (revision 0) |
+++ trunk/DBViewer/dbviewer.qrc (revision 257) |
@@ -0,0 +1,8 @@ |
+<RCC> |
+ <qresource prefix="/"> |
+ <file>model.txt</file> |
+ <file>Open.png</file> |
+ <file>Delete.png</file> |
+ <file>Save.png</file> |
+ </qresource> |
+</RCC> |
Index: trunk/DBViewer/mymodel.h |
=================================================================== |
--- trunk/DBViewer/mymodel.h (revision 0) |
+++ trunk/DBViewer/mymodel.h (revision 257) |
@@ -0,0 +1,45 @@ |
+#ifndef MYMODEL_H |
+#define MYMODEL_H |
+ |
+#include <QObject> |
+#include <QtGui> |
+#include <QSqlQueryModel> |
+#include <QSqlQuery> |
+#include <QSqlTableModel> |
+#include <QMap> |
+ |
+class MyModel : public QSqlTableModel { |
+Q_OBJECT |
+public: |
+ explicit MyModel(QObject *parent = 0); |
+ Qt::ItemFlags flags(const QModelIndex &index) const; |
+ bool setData(const QModelIndex &, const QVariant &, int); |
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
+ void setPointers(QMap <int, QString> newPointers){pointers_map = newPointers;} |
+ void setFilesFields(QMap <int, QString> newFilesFields){files_map = newFilesFields;} |
+ |
+ QMap <int, QString> pointers(){return pointers_map;} |
+ QMap <int, QString> filesFields (){return files_map;} |
+ void setBooleansList(QList <int> newBoolList){bolleans_list = newBoolList;} |
+ |
+ void setIconIndex(int new_index){icon_index = new_index;} |
+ int iconIndex(){return icon_index;} |
+ |
+private: |
+ QMap <int, QString> pointers_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ ñ óêàçàòåëÿìè |
+ // à â êà÷åñòâå çíà÷åíèé - èìåíà òàáëèö - õðàíèëèù îáúåêòîâ ðîäèòåëüñêîãî êëàññà |
+ QMap <int, QString> files_map; // â ýòîì ñâÿçàííîì ñïèñêå áóäåõ õðàíèòü â êà÷åñòâå êëþ÷à íîìåðÿ ñòîëáöîâ, õðàíÿùèõ ôàéëû |
+ // à â êà÷åñòâå çíà÷åíèé - èìåíà ñòîëáöîâ |
+ |
+ QList <int> bolleans_list; // ñïèñîê ïîëåé ñ òèïîì "bool" |
+ |
+ |
+ int icon_index; // íîìåð ñòîëáöà, â êîòîðîì õðàíÿòüñÿ èêîíêè |
+ |
+signals: |
+ |
+public slots: |
+ |
+}; |
+ |
+#endif // MYMODEL_H |
Index: trunk/DBViewer/mainwindow.cpp |
=================================================================== |
--- trunk/DBViewer/mainwindow.cpp (revision 0) |
+++ trunk/DBViewer/mainwindow.cpp (revision 257) |
@@ -0,0 +1,2529 @@ |
+#include "mainwindow.h" |
+#include "ui_mainwindow.h" |
+ |
+MainWindow::MainWindow(QWidget *parent) : |
+ QMainWindow(parent), |
+ ui(new Ui::MainWindow) |
+{ |
+ ui->setupUi(this); |
+/* |
+ QPalette p = this->palette(); |
+ p.setBrush(this->backgroundRole(), QBrush(QColor(255,255,255,128))); |
+ this->setAutoFillBackground(true); |
+ this->setPalette(p); |
+*/ |
+ |
+ ui->centralWidget->setLayout(ui->verticalLayout); |
+ ui->tab->setLayout(ui->horizontalLayout); |
+ ui->tab_2->setLayout(ui->horizontalLayout_3); |
+ ui->tab_3->setLayout(ui->horizontalLayout_7); |
+ ui->tab_4->setLayout(ui->horizontalLayout_8); |
+ // connect( ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_currentIndexChanged(int))); |
+ model_is_build = false; |
+ // MainWindow::readModel(); |
+ |
+ //QString model_str; |
+ |
+ |
+ /* |
+ MainWindow::creatModelString(); |
+ int i; |
+ i++; |
+ QFile file_tmp("./temp.txt"); |
+ bool ok; |
+ ok = file_tmp.open(QIODevice::ReadWrite | QIODevice::Text); |
+ QTextStream out(&file_tmp); |
+ out << MainWindow::modelString; |
+ file_tmp.close(); |
+*/ |
+ |
+ |
+ |
+ |
+ ui->treeWidget->setAlternatingRowColors(true); |
+ ui->treeWidget_2->setAlternatingRowColors(true); |
+ |
+ ui->treeWidget->setIconSize(QSize(30,30)); |
+ ui->treeWidget->setColumnWidth(0, 400); |
+ ui->treeWidget_2->setIconSize(QSize(128,128)); |
+ |
+ MainWindow::readSettings(); |
+ |
+ MainWindow::openDataBase(); |
+ |
+ classesIcons = MainWindow::getClassesIcons(); // ïîëó÷èì èêîíêè äëÿ êëàññîâ |
+ |
+ MainWindow::initComboBox(); |
+ |
+// MainWindow::buildPreviewModel(tr("Ìîÿ ìîäåëü"), tr("11")); |
+ |
+ MainWindow::initListModelsTablle(); |
+ |
+ MainWindow::readModels(); |
+ |
+ initWmiTree(); |
+ |
+ |
+ // MainWindow::creatModelString(); |
+ //int i; |
+ //i++; |
+ |
+ /* |
+ QFile file_tmp("./modelstring.txt"); |
+ bool ok; |
+ file_tmp.remove(); |
+ ok = file_tmp.open(QIODevice::ReadWrite | QIODevice::Text); |
+ QTextStream out(&file_tmp); |
+ out.setCodec("cp1251"); |
+ out << MainWindow::modelString; |
+ file_tmp.close(); |
+ */ |
+ |
+ |
+ ui->treeWidget_2->hideColumn(1); |
+ ui->treeWidget_2->hideColumn(2); |
+ ui->treeWidget_2->hideColumn(3); |
+ ui->treeWidget_2->hideColumn(4); |
+ ui->treeWidget_2->hideColumn(5); |
+ |
+ |
+ getDatabaseData(); |
+ //// sql_mogel = new QSqlTableModel(); |
+ sql_mogel = new MyModel(); |
+ |
+ /// filter_model = new MyModel(); |
+ filter_model = new QSqlTableModel(); |
+ filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ |
+ model_is_build = true; |
+ 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())); |
+ connect(&wmiProcess, SIGNAL(readyReadStandardError()), this, SLOT(readStandartProcessError())); |
+ |
+ |
+ ui->pushButton_3->setEnabled(false); |
+ ui->pushButton_4->setEnabled(false); |
+ |
+ |
+ ui->pushButton_9->setEnabled(false); |
+ ui->pushButton_10->setEnabled(false); |
+ ui->pushButton_11->setEnabled(false); |
+ ui->pushButton_12->setEnabled(false); |
+ |
+ // setFrm.show(); |
+ |
+ // treeForm.show(); |
+ |
+ connect(ui->getsettingAct, SIGNAL(triggered()), this, SLOT(getSetting())); // âûáîð â ãëàâíîé ôîðìå â ìåíþ "Áàçà äàííûõ" ïóíêòà "Ïàðàìåòðû ñîåäèíåíèÿ" |
+ connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting())); |
+ |
+ // connect(ui->tableView_2,SIGNAL(activated(QModelIndex)),ui->tableView_2,SLOT(edit(QModelIndex))); |
+ |
+ picture_delegate = new CPictureDelegate(this); |
+ iconDelegate = new IconDelegate(this); |
+ fileDelegate = new FileDelegate(this); |
+ |
+ // fileForm.show(); |
+ |
+ doc = ui->textEdit->document(); |
+ cursor = new QTextCursor(doc); |
+ // buildReport(true); |
+ |
+ all_reading = false; // íåò ïðî÷èòàííûõ äàííûõ èç ïðîöåññà |
+// wmiThread = new WmiThread(this); |
+ |
+} |
+ |
+MainWindow::~MainWindow() |
+{ |
+ delete sql_mogel; |
+ delete filter_model; |
+ delete ui; |
+ delete model_for_ListModelsTable; |
+} |
+ |
+void MainWindow::changeEvent(QEvent *e) |
+{ |
+ QMainWindow::changeEvent(e); |
+ switch (e->type()) { |
+ case QEvent::LanguageChange: |
+ ui->retranslateUi(this); |
+ break; |
+ default: |
+ break; |
+ } |
+} |
+ |
+ |
+bool MainWindow::readModel(){ |
+ bool result; |
+ QString model_str; |
+ QFile file("modelstring.txt"); |
+ // QFile file("model.txt"); |
+ rootItem1 = new QTreeWidgetItem(ui->treeWidget); |
+ rootItem1->setText(0, tr("Óðîâåíü 1")); |
+ // rootItem2 = new QTreeWidgetItem(rootItem1); |
+ // rootItem2->setText(0, tr("óðîâåíü 2")); |
+ rootItem1->setCheckState(0,Qt::Checked); |
+ // rootItem2->setCheckState(0,Qt::Checked); |
+ |
+ |
+ |
+ result = file.open(QIODevice::ReadOnly); |
+ if (result) { |
+ model_str = QString(tr(file.readAll())); |
+ } |
+ |
+ setupModelData(model_str.split(QString("\n")), rootItem1, -1, tr("1")); |
+ |
+ |
+ return result; |
+ |
+} |
+ |
+ |
+void MainWindow::setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row, QString model_id) |
+{ |
+ QList<QTreeWidgetItem*> parents; |
+ QList<int> indentations; |
+ parents << parent; |
+ indentations << 0; |
+ |
+ int number = 0; |
+ |
+ while (number < lines.count()) { |
+ int position = 0; |
+ while (position < lines[number].length()) { |
+ if (lines[number].mid(position, 1) != " ") |
+ break; |
+ position++; |
+ } |
+ |
+ QString lineData = lines[number].mid(position).trimmed(); |
+ |
+ if (!lineData.isEmpty()) { |
+ // Read the column data from the rest of the line. |
+ QStringList columnStrings = lineData.split("\t", QString::SkipEmptyParts); |
+ QList<QVariant> columnData; |
+ for (int column = 0; column < columnStrings.count(); ++column) |
+ columnData << columnStrings[column]; |
+ |
+ if (position > indentations.last()) { |
+ // The last child of the current parent is now the new parent |
+ // unless the current parent has no children. |
+ |
+ if (parents.last()->childCount() > 0) { |
+ parents << parents.last()->child(parents.last()->childCount()-1); |
+ indentations << position; |
+ } |
+ } else { |
+ while (position < indentations.last() && parents.count() > 0) { |
+ parents.pop_back(); |
+ indentations.pop_back(); |
+ } |
+ } |
+ |
+ // Append a new item to the current parent's list of children. |
+ // // // parents.last()->appendChild(new QTreeWidgetItem(columnData, parents.last())); |
+ QTreeWidgetItem* itm_tmp; |
+ itm_tmp = new QTreeWidgetItem( parents.last()); |
+ // itm_tmp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled); |
+ |
+/* |
+ QLineEdit * edit_line; |
+ edit_line = new QLineEdit(this); |
+ ui->treeWidget->setItemWidget(itm_tmp, 5, edit_line); |
+*/ |
+//static QStandartDelegate delegate; |
+ ui->treeWidget->setItemDelegateForColumn(5, &standart_delegate); |
+ |
+ |
+ itm_tmp->setText(0, QString(columnData.at(0).toString())); |
+ if (columnData.at(1).toString() == "true") { |
+ itm_tmp->setCheckState(0,Qt::Checked); |
+ } |
+ else itm_tmp->setCheckState(0,Qt::Unchecked); |
+ if (columnData.count()>2) |
+ { |
+ QString class_id; |
+ QString filtr_str; |
+ QPixmap pxmp; |
+ QIcon icon; |
+ class_id = QString(columnData.at(2).toString()); |
+ pxmp = MainWindow::classesIcons.value(class_id); |
+ |
+ // itm_tmp->setText(1, QString(columnData.at(2).toString())); // id êëàññà |
+ itm_tmp->setText(1, class_id); // id êëàññà |
+ itm_tmp->setText(6, model_id); // id ìîäåëè |
+ itm_tmp->setText(2, QVariant(number).toString()); // íîìåð ñòðîêè â ôàéëå-ìîäåëè îòîáðàæåíèÿ |
+ itm_tmp->setText(3, QVariant(indentations.size()).toString()); // óðîâåíü âëîæåíèÿ |
+ itm_tmp->setText(4, QVariant(row).toString()); // íîìåð ñòðîêè â ôàéëå |
+ filtr_str = getFiltrString(model_id,class_id); |
+ itm_tmp->setText(5,filtr_str); |
+ |
+ if (!pxmp.isNull()) |
+ { |
+ icon.addPixmap(pxmp); |
+ itm_tmp->setIcon(0, icon); |
+ } |
+ } |
+ } |
+ |
+ number++; |
+ } |
+} |
+ |
+ |
+/* |
+void MainWindow::openBase() |
+{ |
+ |
+ db = QSqlDatabase::addDatabase("QMYSQL"); |
+ pdb = &db; |
+ raportFrm.pdb = &db; |
+ |
+ pdb->setHostName(hostName); |
+ pdb->setDatabaseName(baseName); |
+ pdb->setUserName(userName); |
+ pdb->setPassword(password); |
+ bool ok = pdb->open(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ pdb->lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ if (ok) |
+ {lineEdit-> insert(tr("Áàçà óñïåøíî îòêðûòà")); |
+ } |
+ else {lineEdit-> insert(tr("Áàçà íåäîñòóïíà. Êîä îøèáêè: ")); |
+ lineEdit-> insert(pdb->lastError().text()); |
+ } |
+ |
+ |
+ |
+ model = new QSqlTableModel(this); |
+ model->setTable(tableName); |
+ |
+ model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ model->setSort(0, Qt::AscendingOrder); |
+ |
+ model->select(); |
+ |
+ |
+ QSqlField field(tr("age"), QVariant::Int); |
+ field.setValue(QString(tr("123"))); |
+ |
+ bool okey; |
+ int index; |
+ QSqlRecord record; |
+ |
+ |
+ tableView->setModel(model); |
+ view.setModel(model); |
+ |
+ |
+ tableView->setAlternatingRowColors(true); |
+ view.setAlternatingRowColors(true); |
+ |
+ tableView->resizeColumnsToContents(); |
+ |
+ |
+ view.resizeColumnsToContents(); |
+ |
+ tableView->show(); |
+ |
+ |
+ |
+ initTreeWidget(); |
+} |
+*/ |
+ |
+ |
+QString MainWindow::creatModelString(QTreeWidgetItem* model){ |
+ |
+ MainWindow::modelString.clear(); // î÷èùàåì ñòðîêó ìîäåëè |
+ // for (int i =0; i < rootItem1->childCount(); ++i ) |
+ |
+ {MainWindow::addChildsString(model, 0);} |
+ |
+ return MainWindow::modelString; |
+// {MainWindow::addChildsString(ui->treeWidget, 0);} |
+ /* |
+ int root_item_child_count; |
+ int i; |
+ root_item_child_count = rootItem1->childCount(); |
+ i++; |
+*/ |
+} |
+ |
+ |
+void MainWindow::addChildsString(QTreeWidgetItem *parentItem, int level){ |
+ int child_count; |
+ child_count = parentItem->childCount(); |
+ for (int i=0; i < child_count; ++i){ |
+ for (int m=0; m < level; ++m){ |
+ modelString.append(tr(" ")); // ÷åòûðå ïðîáåëà - ïðèçíàê òîãî, ÷òî ýòî íîâûé óðîâåíü âëîæåíèÿ |
+ } |
+ modelString.append(parentItem->child(i)->text(0)); // â ïåðâîé êîëîíêå - èìÿ êëàññà |
+ modelString.append(tr("\t\t\t\t")); // ÷åòûðå òàáóëÿöèè - ïðèçíàê íîâîãî ñòîëáöà |
+ if (parentItem->child(i)->checkState(0) == Qt::Checked) {modelString.append(tr("true"));} // åñëè ãàëî÷êà ñòîèò, çàíîñèì "true", ýëåìåíòû êëàññà â ïðåäñòàâëåíèè îòîáðàæàòüñÿ áóäóò |
+ else {modelString.append(tr("false"));} // åñëè êëàññ íå âûáðàí - çàíîñèì "false", ýëåìåíòû êëàññà â ïðåäñòàâëåíèè îòîáðàæàòüñÿ íå áóäóò |
+ modelString.append(tr("\t\t\t\t")); // ÷åòûðå òàáóëÿöèè - ïðèçíàê íîâîãî ñòîëáöà |
+ modelString.append(parentItem->child(i)->text(1)); // âî âòîðîé êîëîíêå - ID êëàññà |
+ modelString.append(tr("\n")); // êîíåö ñòðîêè |
+ if (parentItem->child(i)->childCount() > 0) { MainWindow::addChildsString(parentItem->child(i), level+1);} |
+ |
+ } |
+int i; |
+i++; |
+} |
+ |
+ |
+bool MainWindow::openDataBase(){ |
+ QString errorString; |
+ sql = QSqlDatabase::addDatabase("QMYSQL"); |
+// sql.setDatabaseName(tr("an_db")); |
+ |
+ // // // sql.setDatabaseName(tr("inventory")); |
+ |
+ sql.setDatabaseName(baseName); |
+ |
+ |
+ |
+ // // // sql.setHostName(tr("localhost")); |
+ |
+ sql.setHostName(hostName); |
+ |
+ |
+ // // // sql.setUserName(tr("an")); |
+ |
+ sql.setUserName(userName); |
+ |
+ |
+ |
+ // // // sql.setPassword(tr("393939")); |
+ |
+ |
+ sql.setPassword(password); |
+ |
+ |
+ |
+ bool ok; |
+ ok = sql.open(); |
+ |
+ /* |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lastError().text() ); // Òåêñò ñîîáùåíèÿ. |
+ |
+ |
+ } |
+ |
+*/ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+else { |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Connect"), // Çàãîëîâîê. |
+ QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ. |
+ |
+ |
+ |
+ |
+ |
+ } |
+ |
+ return ok; |
+} |
+ |
+ |
+bool MainWindow::buildPreviewModel(QString modelName, QString rootClassID){ |
+QSqlQuery q; |
+QString sql_str; |
+QString field_name_str; |
+QString root_class_name; |
+//bool ok; |
+//int field_name; |
+ |
+//ui->treeWidget->clear(); |
+ |
+root_class_name = MainWindow::ClassName(rootClassID); // îïðåäåëÿåì èìÿ êëàññà |
+ |
+ |
+rootItem1 = new QTreeWidgetItem(ui->treeWidget); |
+ root_items_list << rootItem1; |
+ rootItem1->setText(0, modelName); |
+ |
+ rootItem1->setCheckState(0,Qt::Checked); |
+ rootItems.append(rootItem1); |
+ |
+ |
+ |
+ rootItem2 = new QTreeWidgetItem(rootItem1); |
+ rootItem2->setText(0, root_class_name); |
+ rootItem2->setText(1, rootClassID); |
+ rootItem2->setCheckState(0,Qt::Checked); |
+ |
+ addChildsItems(rootItem2, -1); |
+ |
+ |
+/* |
+ |
+sql_str = tr("select * " |
+ " from DescriptionOfClasses where DescriptionOfClasses.DefaultValue = '" //îïðåäåëèì êëàññû, äëÿ êîòîðûõ êîðíåâîé ÿâëÿåòñÿ êîíòåéíåðîì |
+ ); |
+sql_str.append(rootClassID); |
+ |
+sql_str.append(tr("' and DescriptionOfClasses.FieldType = 'pointer' ")); |
+ |
+q.prepare(sql_str); |
+ |
+ok = q.exec(); |
+if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+field_name = q.record().indexOf(tr("FieldName")); |
+while(q.next()){ |
+ |
+ field_name_str = q.value(field_name).toString(); |
+ |
+ } |
+ |
+ |
+ |
+ |
+*/ |
+ |
+ |
+} |
+ |
+ |
+bool MainWindow::rebuildPreviewModel(QTreeWidgetItem* root_item, QString rootClassID, int row){ |
+QSqlQuery q; |
+QString sql_str; |
+QString field_name_str; |
+QString root_class_name; |
+//bool ok; |
+//int field_name; |
+ |
+//ui->treeWidget->clear(); |
+ |
+root_class_name = MainWindow::ClassName(rootClassID); // îïðåäåëÿåì èìÿ êëàññà |
+ |
+ |
+// rootItem1 = new QTreeWidgetItem(ui->treeWidget); |
+// root_items_list << rootItem1; |
+// rootItem1->setText(0, modelName); |
+ |
+// rootItem1->setCheckState(0,Qt::Checked); |
+// rootItems.append(rootItem1); |
+ |
+// root_item->removeChild(root_item->child(0)); // î÷èùàåì ñïèñîê äî÷åðíèõ êëàññîâ |
+if (root_item->childCount()==0){ // íåò êîðíåâîãî êëàññà, ñîçäàäèì åãî |
+ QTreeWidgetItem* item_tmp; |
+ item_tmp = new QTreeWidgetItem (root_item); |
+ item_tmp->setText(4, QVariant(row).toString()); |
+ |
+} |
+ |
+if (root_item->childCount()==1){ // êîðíåâîé êëàññ åñòü è îí ïóñòîé, î÷èùàòü åãî íå íàäî |
+root_item->child(0)->setText(0, root_class_name); |
+root_item->child(0)->setText(1, rootClassID); |
+root_item->child(0)->setCheckState(0,Qt::Checked); |
+root_item->setText(4, QVariant(row).toString()); |
+ |
+} |
+ |
+ |
+ |
+//delete rootItem2; |
+ |
+ |
+// rootItem2 = new QTreeWidgetItem(rootItem1); |
+ |
+ |
+ |
+// rootItem2->setText(0, root_class_name); |
+// rootItem2->setText(1, rootClassID); |
+// rootItem2->setCheckState(0,Qt::Checked); |
+ |
+int child_count = root_item->child(0)->childCount(); |
+ |
+ |
+for (int i=0; i < child_count; i++){ // åñëè êîðíåâîé êëàññ åñòü è íå ïóñòîé, î÷èùàåì åãî |
+ root_item->child(0)->removeChild(root_item->child(0)->child(0)); |
+} |
+ |
+child_count = root_item->child(0)->childCount(); |
+addChildsItems(root_item->child(0), row); |
+/* |
+sql_str = tr("select * " |
+ " from DescriptionOfClasses where DescriptionOfClasses.DefaultValue = '" //îïðåäåëèì êëàññû, äëÿ êîòîðûõ êîðíåâîé ÿâëÿåòñÿ êîíòåéíåðîì |
+ ); |
+sql_str.append(rootClassID); |
+ |
+sql_str.append(tr("' and DescriptionOfClasses.FieldType = 'pointer' ")); |
+ |
+q.prepare(sql_str); |
+ |
+ok = q.exec(); |
+if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+field_name = q.record().indexOf(tr("FieldName")); |
+while(q.next()){ |
+ |
+ field_name_str = q.value(field_name).toString(); |
+ |
+ } |
+ |
+*/ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+QString MainWindow::ClassName(QString class_id){ //âîçâðàùàåò èìÿ êëàññà ïî åãî ID |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString class_name_str; |
+ bool ok; |
+ int field_class_name; |
+ |
+ sql_str = tr("select * " |
+ " from ListOfClasses where ListOfClasses.ID = '" //îïðåäåëèì êëàññû, äëÿ êîòîðûõ êîðíåâîé ÿâëÿåòñÿ êîíòåéíåðîì |
+ ); |
+ |
+ sql_str.append(class_id); |
+ sql_str.append(tr("' ")); |
+ |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ |
+ field_class_name = q.record().indexOf(tr("ClassName")); |
+ while(q.next()){ |
+ |
+ class_name_str = q.value(field_class_name).toString(); |
+ |
+ } |
+ |
+ return class_name_str; |
+ |
+} |
+ |
+void MainWindow::addChildsItems(QTreeWidgetItem *perent_class_item, int row){ // äîáîâëÿåì ê ýëåìåíòó äåðåâà â êà÷åñòâå äî÷åðíèõ ýëåìåíòîâ âñå êëàññû, äëÿ êîòîðûõ êëàññ ýëåìåíòà ÿâëÿåòñÿ êîíòåéíåðîì |
+QStringList chields_list; |
+QString parent_ID; |
+QTreeWidgetItem *Item_tmp; |
+parent_ID = perent_class_item->text(1); |
+int chields_count, i; |
+ |
+chields_list = MainWindow::classChields(parent_ID); |
+if(chields_list.isEmpty()) return; |
+chields_count = chields_list.size(); |
+for (int l = 0; l < chields_count; ++l){ |
+ QString chield_class_name, chield_id; |
+ chield_id = chields_list.at(l); |
+ chield_class_name = MainWindow::ClassName(chield_id); |
+ Item_tmp = new QTreeWidgetItem(perent_class_item); |
+ Item_tmp->setText(0, chield_class_name); |
+ Item_tmp->setText(1, chield_id); |
+ Item_tmp->setCheckState(0, Qt::Checked); |
+ Item_tmp->setText(4, QVariant(row).toString()); |
+ MainWindow::addChildsItems(Item_tmp, row); |
+} |
+ |
+i++; |
+ |
+} |
+ |
+ |
+/******************************************************** |
+* Ôóíêöèÿ âîçâðàùàåò ñïèñîê "äî÷åðíèõ" êëàññîâ |
+* |
+* |
+* |
+********************************************************/ |
+ |
+QStringList MainWindow::classChields(QString class_id){ |
+ // QMap<QString, QString> map; |
+ // TClass class_tmp; |
+ // QList <TClass> chields_class_list; // ñïèñîê äî÷åðíèõ êëàññîâ |
+ QStringList result; |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString classIdentifer_str; // â ýòîì ïîëå ëåæèò èäåíòèôèêàòîð êëàññà-êîíòåéíåðà |
+ QString field_id_str; |
+ bool ok; |
+ int field_classIdentifer; |
+ sql_str = tr("select * " |
+ " from DescriptionOfClasses where DescriptionOfClasses.DefaultValue = '" //îïðåäåëèì êëàññû, äëÿ êîòîðûõ êîðíåâîé ÿâëÿåòñÿ êîíòåéíåðîì |
+ ); |
+ sql_str.append(class_id); |
+ |
+ sql_str.append(tr("' and DescriptionOfClasses.FieldType = 'pointer' ")); |
+ |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ field_classIdentifer = q.record().indexOf(tr("ClassIdentifer")); |
+ while(q.next()){ |
+ |
+ classIdentifer_str = q.value(field_classIdentifer).toString(); |
+ result.append(classIdentifer_str); |
+ } |
+ |
+ return result; |
+ |
+ } |
+ |
+ |
+QMap <QString, QString> MainWindow::getClassList(){ // ïîëó÷àåì ñïèñîê êëàññîâ |
+QMap <QString, QString> result_map; |
+QSqlQuery q; |
+QString sql_str; |
+QString class_name_str, class_id_str; |
+ |
+int field_class_id, field_class_name; |
+bool ok; |
+sql_str = tr("select * " |
+ " from ListOfClasses " //îïðåäåëèì êëàññû, äëÿ êîòîðûõ êîðíåâîé ÿâëÿåòñÿ êîíòåéíåðîì |
+ ); |
+ q.prepare(sql_str); |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_map; // åñëè îøèáêà - âîçâðàùàåì ïóñòîé ñïèñîê |
+ } |
+field_class_id = q.record().indexOf(tr("ID")); |
+field_class_name = q.record().indexOf(tr("ClassName")); |
+ |
+while(q.next()){ |
+ |
+ class_name_str = q.value(field_class_name).toString(); |
+ class_id_str = q.value(field_class_id).toString(); |
+ result_map[class_id_str] = class_name_str; |
+ } |
+ return result_map; |
+} |
+ |
+ |
+ |
+ |
+ |
+void MainWindow::initComboBox(){ |
+ |
+ |
+ QStringList classesNameList; |
+ QStringList classesID_list; |
+ QStringList tmp_stringList; |
+ |
+ |
+ |
+ QString tmp_str; |
+ |
+ class_list_map = MainWindow::getClassList(); |
+ classesID_list = class_list_map.keys(); |
+ classesNameList = class_list_map.values(); |
+ QMapIterator<QString, QString> interator(class_list_map); |
+// ui->comboBox->addItems(classesID_list); |
+ // ui->comboBox->addItems(classesNameList); |
+ |
+ while (interator.hasNext()) { |
+ interator.next(); |
+ tmp_str = interator.value(); |
+ tmp_str.append(tr(" \t(ID=")); |
+ tmp_str.append(interator.key()); |
+ tmp_str.append(tr(")")); |
+ tmp_stringList << tmp_str; |
+ |
+ } |
+ tmp_stringList << tr("íå çàäàíî"); |
+// int count = ui->comboBox->count(); |
+ |
+ ui->comboBox->clear(); |
+ ui->comboBox->addItems(tmp_stringList); |
+ |
+ |
+} |
+ |
+ |
+void MainWindow::on_comboBox_currentIndexChanged( int index ){ |
+QStringList classesNameList; |
+QStringList classesID_list; |
+QString ID_str; |
+if (index == -1) return;// èíäåêñ íå âåðíûé èëè èíäåêñ ñòðîêè "íå îïðåäåëåíî" |
+if (ui->comboBox->itemText(index) == tr("íå çàäàíî")) return; |
+if (!comboBox_slot_enable) return; // èíäåêñ ïîìåíÿëà ïðîãðàììà, îí íå áûë èçìåíåí âðó÷íóþ, âûõîäèì |
+int row; |
+ |
+classesID_list = class_list_map.keys(); |
+classesNameList = class_list_map.values(); |
+ID_str = classesID_list[index]; |
+ui->label->setText(ID_str); |
+if (root_items_list.indexOf(ui->treeWidget->currentItem()) != -1) |
+{ |
+ row = QVariant(ui->treeWidget->currentItem()->text(4)).toInt(); |
+ model_is_build = false; // ÷òîáû íå âûçûâàëîñü ñîáûòèå on_treeWidget_itemChanged |
+ rebuildPreviewModel(ui->treeWidget->currentItem(), ID_str, row); |
+ model_is_build = true; // òåïåðü ïóñòü âûçûâàåòñÿ |
+ QString mdl_str = MainWindow::creatModelString(ui->treeWidget->currentItem()); // |
+ model_for_ListModelsTable->setData(model_for_ListModelsTable->index(row, 2), QVariant(mdl_str)); |
+} |
+ getDatabaseData(); |
+ |
+ |
+} |
+ |
+void MainWindow::on_treeWidget_itemChanged ( QTreeWidgetItem * item, int column ){ |
+ int i; |
+ i++; |
+ QTreeWidgetItem * item_tmp; |
+ QString mdl_str; |
+ QString row; // íîìåð ñòðîêè â òàáëèöå ìîäåëåé, ñîîòâåòñòâóþùèé èçìåíåííîé ìîäåëå |
+ QList <QTreeWidgetItem *> mdl_itm_list; |
+ QList <int> rows_list; |
+ |
+ |
+ if ((column) == 0 && (model_is_build)) { |
+ // if (!model_is_build) return; // ìîäåëü åù¸ íå ïîñòðîåíà |
+ |
+ mdl_itm_list = models_items.values(); |
+ rows_list = models_items.keys(); |
+ row= item->text(4); |
+ |
+ |
+ if ( mdl_itm_list.indexOf(item) != -1){ // èçìåí¸í êîðíåâîé èòåì (ñàìà ìîäåëü) |
+ if (item->checkState(0)) model_for_ListModelsTable->setData(model_for_ListModelsTable->index(QVariant(row).toInt(), 3), QVariant(1)); |
+ else model_for_ListModelsTable->setData(model_for_ListModelsTable->index(QVariant(row).toInt(), 3), QVariant(0)); |
+ } |
+ |
+ |
+ |
+ |
+ if (!row.isEmpty()){ |
+ |
+ |
+ int row_int; |
+ row_int = QVariant(row).toInt(); |
+ if (rows_list.indexOf(row_int) != -1) |
+ { |
+ item_tmp = models_items[row_int]; |
+ mdl_str = MainWindow::creatModelString(item_tmp); |
+ model_for_ListModelsTable->setData(model_for_ListModelsTable->index(row_int, 2), QVariant(mdl_str)); |
+ } |
+ |
+ |
+ } |
+ |
+ |
+} |
+ |
+/* |
+ QTreeWidgetItem * item_tmp; |
+ item_tmp = item; |
+ while (item_tmp ){ |
+ item_tmp = item_tmp->parent(); |
+ } |
+ */ |
+ if ((column) == 0 && (model_is_build)) getDatabaseData(); |
+ |
+ |
+} |
+ |
+ |
+void MainWindow::on_treeWidget_itemClicked ( QTreeWidgetItem * item, int column ){ |
+ int i; |
+ i++; |
+ if (root_items_list.indexOf(item) != -1) { // Åñëè âûáðàííûé èòåì ñîäåðæèò íàçâàíèå ìîäåëè |
+ QStringList classesNameList; |
+ QStringList classesID_list; |
+ |
+ ui->pushButton_9->setEnabled(false); |
+ ui->pushButton_10->setEnabled(false); |
+ ui->pushButton_11->setEnabled(false); |
+ ui->pushButton_12->setEnabled(false); |
+ // ui->tableView->reset(); |
+ // MainWindow::filtr_model->clear(); |
+ disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
+ delete filter_model; |
+ |
+ filter_model = new QSqlTableModel(); |
+ /// filter_model = new MyModel(); |
+ filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ |
+ connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
+ int index; |
+ classesID_list = class_list_map.keys(); |
+ classesNameList = class_list_map.values(); |
+ if (item->childCount()>0) index = classesID_list.indexOf(item->child(0)->text(1)); // åñëè ìîäåëü íå ïóñòàÿ, óçíàåì êîðíåâîé êëàññ |
+ else { // åñëè ïóñòàÿ |
+ index = classesID_list.count(); |
+ comboBox_slot_enable = false; // ÷òîáû ñëîò comboBox íå ìåíÿë ñòðîêó ìîäåëè |
+ ui->comboBox->setCurrentIndex(index); |
+ ui->comboBox->setEnabled(true); |
+ comboBox_slot_enable = true; |
+ return; |
+ |
+ } |
+ comboBox_slot_enable = false; // ÷òîáû ñëîò comboBox íå ìåíÿë ñòðîêó ìîäåëè |
+ if (index != -1) ui->comboBox->setCurrentIndex(index); |
+ comboBox_slot_enable = true; |
+ ui->comboBox->setEnabled(true); |
+ |
+ |
+ } |
+ // if ((rootItem1) == (item) ) ui->comboBox->setEnabled(true); |
+else // âûáðàííûé èòåì ñîäåðæèò íàçâàíèå êëàññà |
+ { |
+ QString class_id; |
+ QString model_id; |
+ QString filtr_str; |
+ QString inctance; |
+ QStringList conditionList; |
+ class_id = item->text(1); |
+ model_id = item->text(6); |
+ inctance = MainWindow::getClassInctance(class_id); |
+ |
+ filtr_str = tr("`Model_ID` = "); |
+ filtr_str.append(model_id); |
+ filtr_str.append(tr(" AND `Class_ID` = ")); |
+ filtr_str.append(class_id); |
+ // filtr_str.append(tr("`")); |
+ |
+ disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
+ delete filter_model; |
+ /// filter_model = new MyModel(); |
+ |
+ filter_model = new QSqlTableModel(); |
+ filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ |
+ connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex))); |
+ filter_model->setTable(tr("Filters")); |
+ filter_model->setFilter(filtr_str); |
+ |
+ |
+ |
+ filter_model->select(); |
+ |
+ filter_model->sort(0,Qt::AscendingOrder); |
+ |
+ ui->tableView_3->setModel(filter_model); |
+ |
+ |
+ ui->tableView_3->hideColumn(0); |
+ ui->tableView_3->hideColumn(1); |
+ ui->tableView_3->hideColumn(2); |
+ |
+ |
+ filterSpinDelegate.setClassID(class_id); |
+ filterSpinDelegate.getItems(); |
+ ui->tableView_3->setItemDelegateForColumn(4, &filterSpinDelegate); |
+ |
+ // ui->tableView_3->setItemDelegate(); |
+ conditionList <<"" << "and" << "or" << "(" << "and (" << "or ("; |
+ filterConditionDelegate.setItems(conditionList); |
+ ui->tableView_3->setItemDelegateForColumn(3, &filterConditionDelegate); |
+ |
+ conditionList.clear(); |
+ conditionList <<"" << "=" << "<" << ">" << "IS NULL" << "IS NOT NULL"; |
+ filterConditionDelegate_1.setItems(conditionList); |
+ ui->tableView_3->setItemDelegateForColumn(5, &filterConditionDelegate_1); |
+ |
+ |
+ |
+ |
+ conditionList.clear(); |
+ conditionList <<"" << ")"; |
+ filterConditionDelegate_2.setItems(conditionList); |
+ ui->tableView_3->setItemDelegateForColumn(7, &filterConditionDelegate_2); |
+ |
+ ui->tableView_3->setItemDelegateForColumn(6, &filterValueDelegate); |
+ |
+ |
+ |
+ |
+ ui->pushButton_9->setEnabled(true); |
+ ui->pushButton_10->setEnabled(true); |
+ |
+ ui->comboBox->setEnabled(false); |
+ |
+ |
+ } |
+} |
+ |
+QMap <QString, QString> MainWindow::getFieldsList(QString class_id){ // ïîëó÷àåì ñïèñîê ïîëåé êëàññà |
+ |
+} |
+ |
+ |
+void MainWindow::initListModelsTablle(){ |
+ model_for_ListModelsTable = new QSqlTableModel(); |
+ |
+ model_for_ListModelsTable->setTable(tr("ListOfModels")); |
+ // model_for_ListModelsTable->setEditStrategy(QSqlTableModel::OnFieldChange); |
+ model_for_ListModelsTable->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ ui->tableView_2->setModel(model_for_ListModelsTable); |
+ |
+ model_for_ListModelsTable->select(); |
+ |
+ |
+ ui->treeWidget->hideColumn(1); |
+ ui->treeWidget->hideColumn(2); |
+ ui->treeWidget->hideColumn(3); |
+ ui->treeWidget->hideColumn(4); |
+// ui->treeWidget->hideColumn(5); |
+ ui->treeWidget->hideColumn(6); |
+ |
+ ui->tableView_2->hideColumn(0); |
+ ui->tableView_2->hideColumn(2); |
+ ui->tableView_2->hideColumn(3); |
+ ui->tableView_2->hideColumn(4); |
+ |
+ ui->tableView_2->resizeColumnsToContents(); |
+ ui->tableView_2->setAlternatingRowColors(true); |
+ |
+ ui->pushButton_7->setEnabled(false); |
+ ui->pushButton_8->setEnabled(false); |
+ |
+ |
+} |
+ |
+void MainWindow::buildReport(bool advanced){ |
+ |
+ // QTreeWidgetItem * hitm; |
+ |
+ // hitm = ui->treeWidget_2->headerItem(); |
+ |
+ // int count = root_items_list.count(); |
+ |
+ //int count = ui->treeWidget_2->rootIndex(); |
+ |
+ |
+ doc->clear();//î÷èùàåì äîêóìåíò |
+ |
+ int list_count; |
+ if (rootItems.isEmpty()) return; |
+ |
+ |
+ |
+ list_count = rootItems.count(); |
+ |
+ for (int i=0; i < list_count; i++){ |
+ |
+ getReport(rootItems.at(i), advanced); |
+ |
+ |
+ |
+ } |
+ // (bool)QTextDocumentWriter("raport.odt").write(doc); |
+} |
+ |
+ |
+void MainWindow::getReport(QTreeWidgetItem * model_item, bool advanced){ // ñîçäàåò îò÷åò äëÿ êîíêðåòíîé ìîäåëè |
+ |
+ |
+ // QTextDocument doc; |
+ // QTextCursor cursor(&doc); |
+ QTextCharFormat char_fmt; |
+ bool ok; |
+ |
+ /************** |
+ |
+ // char_fmt.setBackground(Qt::red); |
+ cursor.insertText(tr("Ì1\n"),char_fmt); |
+ QImage img; |
+ ok = img.load("./hdd5.png"); |
+ doc.addResource(QTextDocument::ImageResource, QUrl("myimage"), img); |
+ cursor.insertImage("myimage"); |
+ cursor.insertText(tr("Æåñòêèé äèñê\n"),char_fmt); |
+ |
+ (bool)QTextDocumentWriter("test.odt").write(&doc); |
+ ***************/ |
+ |
+ QString model_name; |
+ QString rootClassID; |
+ QString rootClassInctance; |
+ QFont font; |
+ QBrush brush; |
+ |
+ brush.setColor(Qt::darkRed); |
+ char_fmt.setForeground(brush); |
+ font.setBold(true); |
+ char_fmt.setFont(font); |
+ |
+ model_name = model_item->text(0); |
+ if (model_item->checkState(0) == false) return; // ìîäåëü íå âûäåëåíà äëÿ îòîáðàæåíèÿ |
+ |
+ |
+ newPage(); |
+/******************* |
+ QTextBlockFormat textFormat; |
+ textFormat.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore); |
+ cursor->setBlockFormat(textFormat); |
+ |
+ cursor->insertText(tr("Íîâàÿ ñòðàíèöà")); |
+ cursor->insertBlock(); |
+ |
+ textFormat.setPageBreakPolicy(QTextFormat::PageBreak_Auto); |
+ cursor->setBlockFormat(textFormat); |
+********************/ |
+ |
+ |
+ |
+ if (!(model_item->childCount() > 0)) return; // ìîäåëü ïóñòà (íå ñîäåðæèò êëàññîâ) |
+ |
+ rootClassID = model_item->child(0)->text(1); |
+ rootClassInctance = getClassInctance(rootClassID); |
+ |
+ cursor->insertText(model_name, char_fmt); |
+ cursor->insertText(tr("\n")); |
+ |
+ if (model_item->child(0)->checkState(0)) // åñëè â ìîäåëè êîðíåâîé êëàññ âûáðàí äëÿ îòîáðàæåíèÿ (ñòîèò ãàëî÷êà), òî |
+ { |
+ ///// QTreeWidgetItem * item_tmp; |
+ ///// item_tmp = new QTreeWidgetItem(item); // â äåðåâå, îòîáðàæàþùåì îáúåêòû êëàññîâ, ñîçäàåì íîâûé óçåë |
+ ///// item_tmp->setText(0, model_item->child(0)->text(0)); // ñ íàçâàíèåì êëàññà |
+ |
+ //showClassObjects(item_tmp, model_item->child(0)); // è âûâîäèì âñå îáúåêòû äàííîãî êëàññà |
+ |
+ ///// showObjects(item_tmp, model_item->child(0), tr("")); |
+ printChild(model_item->child(0), tr(""), advanced, 1); |
+ |
+ } |
+ |
+ |
+ |
+ |
+} |
+ |
+void MainWindow::printChild(QTreeWidgetItem * model_item, QString filtr, bool advanced, int pos){//â ðàïîðò äîáàâëÿåì äî÷åðíèå êëàññû |
+ QString classID; // èäåíòèôèêàòîð êëàññà |
+ QString parentClassID; // èäåíòèôèêàòîð ðîäèòåëüñêîãî êëàññà |
+ QString pointerField; // èìÿ ïîëÿ-óêàçàòåëÿ íà ðîäèòåëüñêèé êëàññ |
+ QString inctance; // èìÿ òàáëèöû, õðàíèëèùà |
+ QString className; // èìÿ êëàññà |
+ QString modelID; // èäåíòèôèêàòîð ìîäåëè |
+ QString add_filtr; // äîïîëíèòåëüíûé ôèëüòð |
+ int field_ID; |
+ int icon_field_index; |
+ bool filtr_empty; |
+ bool ok; |
+ QSqlQuery q; |
+ QString sql_str; |
+ QString str_tmp; |
+ QTreeWidgetItem * title_item; |
+ |
+ QIcon icon; |
+ QMap<QString, QString> fieldsTypesList;//çäåñü â êà÷åñòâå êëþ÷å áóäåì õðàíèòü èìåíà ïîëåé, çíà÷åíèÿìè áóäóò èõ òèïû |
+ //QList<TField> FieldsList; //ñïèñîê ïîëåé êëàññà |
+ |
+ |
+ |
+ |
+// // // font.setBold(true); |
+ filtr_empty = filtr.isEmpty(); |
+ |
+ classID = model_item->text(1); |
+ modelID = model_item->text(6); |
+ add_filtr = MainWindow::getFiltrString(modelID, classID); |
+ |
+ |
+ icon = model_item->icon(0); |
+ |
+ parentClassID = model_item->parent()->text(1); |
+ |
+ pointerField = getPointerFieldName(parentClassID, classID); |
+ |
+ className = model_item->text(0); |
+ inctance = getClassInctance(classID); |
+ |
+ if (!model_item->checkState(0)) return; |
+ |
+ |
+ |
+ |
+ QTextCharFormat charFormatItalic, charFormatBase, charFormatItalicBold, charFormatItalicOnly; |
+ QTextTableFormat tableFormat; |
+ |
+ |
+// QPen pen; |
+ QBrush brush; |
+ QFont font; |
+ // pen.setColor(Qt::red); |
+ // charFormatItalic.setTextOutline(pen); |
+ |
+ //QFont font; |
+ |
+ brush.setColor(Qt::blue); |
+ |
+ font.setItalic(true); |
+ |
+ charFormatItalicOnly.setFont(font); |
+ //charFormatItalic.setFontItalic(true); |
+ |
+ font.setBold(true);///////////////// |
+ charFormatItalic.setFont(font); |
+ |
+ |
+ charFormatItalic.setForeground(brush); |
+ |
+ |
+ |
+ charFormatItalicBold.setFont(font); |
+ charFormatItalicBold.setForeground(brush); |
+ |
+ |
+ |
+ //charFormatItalic.setFontWeight(16); |
+ pos++; |
+ for(int i=0; i<pos; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû |
+ cursor->insertText(className, charFormatItalic); |
+ cursor->setCharFormat(charFormatBase); |
+ cursor->insertText(tr("\n")); |
+ |
+ |
+ |
+ sql_str = tr("select * " |
+ " from " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ sql_str.append(inctance); |
+ |
+ |
+ if (filtr.isEmpty() && (!add_filtr.isEmpty())) // ôèëüòð ïóñòîé, äîïîëíèòåëüíûé ôèëüòð íå ïóñòîé |
+ { |
+ filtr.append(tr ("where ")); |
+ filtr.append(add_filtr); |
+ } |
+ |
+ |
+ if (!filtr.isEmpty()) { // åñëè ôèëüòð íå ïóñòîé |
+ sql_str.append(tr(" ")); |
+ sql_str.append(filtr); // äîáàâëÿåì â çàïðîñ ôèëüòð |
+ } |
+ |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ |
+ if (!ok) { |
+ QString debug_str; |
+ debug_str.append(tr("ôóí showObjects(): Database Error ")); |
+ debug_str.append(tr(" õð: ")); |
+ debug_str.append(inctance); |
+ debug_str.append(tr(" ô: ")); |
+ debug_str.append(filtr); |
+ debug_str.append(q.lastError().text()); |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("ôóíêöèÿ showObjects(): Database Error"), // Çàãîëîâîê. |
+ debug_str |
+ // q.lastError().text() |
+ ); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ field_ID = q.record().indexOf(tr("ID")); |
+ |
+ icon_field_index = q.record().indexOf(tr("Icon")); |
+ |
+ int k=0; |
+ QStringList fieldsNamesList;// ñïèñîê èì¸í ïîëåé òàáëèöû |
+ QList<TField> FieldsList; //ñïèñîê ïîëåé êëàññà |
+ QMap<QString, TField> fieldsMap;// çäåñü áóäåì â êà÷åñòâå êëþ÷åé õðàíèòü èìåíà ïîëåé, à â êà÷åñòâå çíà÷åíèé - íåïîñðåäñòâåííî ñîîòâåòñòâóþùèå ïîëÿ |
+ QMap <QString, QString> fieldsValues;// çäåñü áóäåì õðàíèòü çíà÷åíèÿ ïîëåé, êëþ÷àìè áóäóò ñëóæèòü èìåíà ïîëåé |
+ FieldsList = getFieldList(classID); // ïîëó÷àåì ñïèñîê ïîëåé |
+ |
+ |
+ |
+ |
+ |
+ if(FieldsList.count()>0){ |
+ for(int i=0; i < FieldsList.count(); i++){ //ñîñòàâèì ïàðû (èìÿ ïîëÿ-òèï ïîëÿ) |
+ fieldsTypesList.insert(FieldsList.at(i).FieldName, FieldsList.at(i).FieldType); |
+ fieldsMap.insert(FieldsList.at(i).FieldName, FieldsList.at(i)); |
+ } |
+ |
+ // fieldsNamesList = fieldsTypesList.keys(); // ïîëó÷èì ñïèñîê èìåí ïîëåé |
+ } |
+ |
+// icon_field_index = fieldsNamesList.indexOf(tr("Icon"));//îïðåäåëèì èíäåêñ ïîëÿ ñ èêîíêîé |
+ |
+ |
+ |
+ while(!q.record().fieldName(k).isEmpty()){// ïîêà íå ïåðåáåð¸ì âñå ïîëÿ |
+ fieldsNamesList.append(q.record().fieldName(k++)); |
+ } |
+ |
+ |
+//icon_field_index = fieldsNamesList.indexOf(tr("Icon"));//îïðåäåëèì èíäåêñ ïîëÿ ñ èêîíêîé |
+ |
+ |
+ while(q.next()){ |
+ if (q.record().count() > 1) |
+ { |
+ QString value_tmp; |
+ QString ID_tmp; |
+ QString space; |
+ |
+ // // // // QTreeWidgetItem * itm; |
+ ID_tmp = q.value(field_ID).toString(); // îïðåäåëÿåì èäåíòèôèêàòîð îáúåêòà |
+ value_tmp = q.value(1).toString(); // îïðåäåëÿåì èìÿ îáúåêòà (äîëæíî õðàíèòüñÿ â ïåðâîì ïîëå) |
+ // itm = new QTreeWidgetItem(parent_object_item); // äîáàâëÿåì â äåðåâî óçåë, ñîîòâåòñòâóþùèé îáúåêòó |
+ |
+ |
+ |
+ |
+ /*************************** |
+ itm = new QTreeWidgetItem(title_item); // äîáàâëÿåì â äåðåâî óçåë, ñîîòâåòñòâóþùèé îáúåêòó |
+ itm->setText(0, value_tmp); |
+ itm->setText(1, tr("object")); |
+ itm->setText(2, ID_tmp); |
+ ******************************/ |
+ |
+ if (icon_field_index != -1){ // åñëè èìååòñÿ ïîëå ñ èêîíêàìè |
+ |
+ QVariant data; |
+ QByteArray bytes; |
+ QPixmap pix; |
+ QIcon icn; |
+ QMap <QString, QPixmap> pixmap_map; |
+ QList <QString> id_list; |
+ QList <QPixmap> pixmap_list; |
+ pixmap_map = MainWindow::getObjectsIcon(inctance); |
+ if (!pixmap_map.isEmpty()) { |
+ id_list = pixmap_map.keys(); |
+ pixmap_list = pixmap_map.values(); |
+ } |
+ if (id_list.indexOf(ID_tmp) != -1) { |
+ pix = pixmap_list.at(id_list.indexOf(ID_tmp)); |
+ } |
+ // data = q.record().value(icon_field_index); |
+ // bytes = q.record().value(icon_field_index).toByteArray(); |
+ // if (data.isValid() && (!data.isNull())) { |
+ // if (!bytes.isEmpty()){ |
+ // pix.loadFromData(data.toByteArray()); |
+ // pix.loadFromData(bytes); |
+ |
+ |
+ if(!pix.isNull()) { |
+ if (pix.height() > 128) pix = pix.scaledToHeight(128); |
+ QString fname = value_tmp; |
+ fname.append(tr(".png")); |
+ |
+ |
+ pix.toImage().save(fname); |
+ doc->addResource(QTextDocument::ImageResource, QUrl(fname), pix.toImage()); |
+ |
+ // for(int i=0; i<pos; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû |
+ |
+ |
+ for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû |
+ cursor->insertImage(fname); |
+ // cursor->insertText(tr("\n")); |
+ |
+ } |
+ else for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû |
+ |
+ |
+ |
+ |
+ // // // icn.addPixmap(pix); |
+ // // // itm->setIcon(0, icn); |
+ // } |
+ |
+ |
+ } |
+ |
+ else for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû |
+ cursor->insertText( value_tmp); |
+ cursor->insertText( tr("\n")); |
+ |
+ |
+ |
+ // q.first(); |
+ |
+ |
+ if(advanced && (fieldsNamesList.count()>0)){ // åñëè îò÷åò ðàñøèðåííûé |
+ |
+ QString tmp_string; |
+ sql_str.clear(); |
+ |
+ // // // QTextTable *table = cursor->insertTable(fieldsNamesList.count()-2, 2);// ñîçäàäèì òàáëèöó äëÿ ïîëåé êëàññà, êðîìå ïåðâûõ äâóõ (ID è íàçâàíèå îáúåêòà) |
+ |
+ |
+ |
+ /************************ |
+ QTextTable *table = cursor->insertTable(fieldsNamesList.count(), 2);// ñîçäàäèì òàáëèöó äëÿ ïîëåé êëàññà, êðîìå ïåðâûõ äâóõ (ID è íàçâàíèå îáúåêòà) |
+ |
+ ************************/ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ // cursor->insertText(tr("Ïðîâåðêà òàáëèöû")); |
+ |
+ |
+ // *cursor = table->cellAt(0,1).firstCursorPosition(); |
+ // cursor->insertText(tr("Ïðîâåðêà òàáëèöû 2")); |
+ // *cursor = table->cellAt(1,1).lastCursorPosition(); |
+ // cursor->insertText(tr("Ïðîâåðêà òàáëèöû 4")); |
+ |
+ |
+ // cursor->movePosition(QTextCursor::End); |
+ |
+ |
+ |
+ //table->cellAt(1,1).firstCursorPosition().insertText(tr("1")); |
+ //table->cellAt(1,2).firstCursorPosition().insertText(tr("2")); |
+ //table->cellAt(2,1).firstCursorPosition().insertText(tr("3")); |
+ |
+ //table->cellAt(2,2).firstCursorPosition().insertText(tr("4")); |
+ // cursor->insertText(tr("1 \t 2")); |
+ // cursor->insertText(tr("3 \t 4")); |
+ |
+ for(int i=0; i < fieldsNamesList.count(); i++) |
+ { |
+ |
+ |
+ if (fieldsNamesList.at(i)== tr("Icon") || fieldsNamesList.at(i)== tr("ID")) { tmp_string = tr("íå âîçìîæíî îòîáðàçèòü"); |
+ continue; |
+ } |
+ |
+ QString fieldType; |
+ fieldType = fieldsTypesList.value(fieldsNamesList.at(i)); //îïðåäåëÿåì òèï ïîëÿ |
+ if(fieldType == tr("pointer")) // åñëè òèï ïîëÿ - óêàçàòåëü |
+ { |
+ QSqlQuery q_tmp; |
+ QString sql_str; |
+ // QString val_str; |
+ QString parent_class_id;// èäåíòèôèêàòîð êëàññà, íà îáúåêòû êîòîðîãî ññûëàåòñÿ ïîëå |
+ QString parent_class_inctance; // õðàíèëèùå îáúåêòîâ ðîäèòåëüñêîãî êëàññà |
+ bool ok; |
+ TField field_tmp; |
+ field_tmp = fieldsMap.value(fieldsNamesList.at(i)); |
+ parent_class_id = field_tmp.DefaultValue; |
+ if (parent_class_id.isEmpty()) continue; // íå ñìîãëè îïðåäåëèòü id ðîäèòåëüñêîãî êëàññà |
+ else parent_class_inctance = getClassInctance(parent_class_id); |
+ if (parent_class_inctance.isEmpty()) continue; // íå ñìîãëè îïðåäåëèòü id ðîäèòåëüñêîãî êëàññà |
+ sql_str = tr("select * from `"); |
+ sql_str.append(parent_class_inctance); |
+ sql_str.append(tr("` where `ID` = '")); |
+ sql_str.append(q.record().value(i).asString()); |
+ sql_str.append(tr("'")); |
+ ok = q_tmp.prepare(sql_str); |
+ ok = q_tmp.exec(); |
+ |
+ if (!ok) { |
+ QString debug_str; |
+ debug_str.append(tr("ôóí showObjects(): Database Error ")); |
+ debug_str.append(tr(" õð: ")); |
+ debug_str.append(inctance); |
+ debug_str.append(tr(" ô: ")); |
+ debug_str.append(filtr); |
+ debug_str.append(q.lastError().text()); |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("ôóíêöèÿ showObjects(): Database Error"), // Çàãîëîâîê. |
+ debug_str |
+ // q.lastError().text() |
+ ); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ tmp_string.clear(); |
+ while (q_tmp.next()){ |
+ tmp_string = q_tmp.record().value(1).asString(); |
+ |
+ } |
+ |
+ fieldsValues.insert(fieldsNamesList.at(i), tmp_string);// äîáàâëÿåì çíà÷åíèå â ñïèñîê çíà÷åíèé |
+ |
+ continue;// ïåðåõîäèì ê ñëåäóþùåé èíòåðàöèè |
+ |
+ } // äàëüøå åñëè òèï ïîëÿ íå pointer |
+ |
+ if(fieldType == tr("file")){ // åñëè òèï ïîëÿ - ôàéë, íå áóäåì îòîáðàæàòü |
+ |
+ tmp_string = tr("íå âîçìîæíî îòîáðàçèòü"); |
+ continue; |
+ |
+ } |
+ |
+ tmp_string = q.record().value(i).asString(); // ýòî íå èêîíêà, íå ôàéë è íå ïîëå-óêàçàòåëü, ïðîñòî îòîáðàæàåì çíà÷åíèå |
+ fieldsValues.insert(fieldsNamesList.at(i), tmp_string);// äîáàâëÿåì çíà÷åíèå â ñïèñîê çíà÷åíèé |
+ |
+ |
+ } |
+ |
+ |
+ |
+ |
+ |
+ // for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû |
+ tableFormat.setAlignment(Qt::AlignLeft); |
+ tableFormat.setBackground(QColor("#e0e0e0")); |
+ // tableFormat.setCellPadding(2); |
+ // tableFormat.setCellSpacing(4); |
+ tableFormat.setLeftMargin(pos*7); |
+ tableFormat.setBorder(1); |
+ tableFormat.setBorderStyle( QTextFrameFormat::BorderStyle_Solid); |
+ |
+ QTextTable *table = cursor->insertTable(fieldsValues.count(), 2, tableFormat);// ñîçäàäèì òàáëèöó äëÿ ïîëåé êëàññà, êðîìå ïåðâûõ äâóõ (ID è íàçâàíèå îáúåêòà) |
+ // table->setFormat(tableFormat); |
+ |
+ |
+ for(int i=0; i < fieldsValues.count(); i++){ // ïðîïóñòèì ïîëÿ: ID è ïîëå, ñîäåðæàùåå èìÿ îáúåêòà (îíî è òàê óæå îòîáðàæåíî) |
+ QStringList keys_list = fieldsValues.keys(); |
+ QStringList values_list = fieldsValues.values(); |
+ *cursor = table->cellAt(i,0).firstCursorPosition();// ñòðîêà i-òàÿ, ñòîëáåö ïåðâûé |
+ cursor->insertText(keys_list.at(i), charFormatItalicOnly);//ñþäà çàíîñèì èìÿ ïîëÿ |
+ *cursor = table->cellAt(i,1).firstCursorPosition();// ñòðîêà i-òàÿ, ñòîëáåö âòîðîé |
+ cursor->insertText(values_list.at(i));//ñþäà çàíîñèì èìÿ ïîëÿ |
+ } |
+ |
+ // table->setFormat(tableFormat); |
+ cursor->movePosition(QTextCursor::End);//âûõîäèì èç òàáëèöû |
+ cursor->insertText( tr("\n")); |
+ |
+ |
+ |
+/****************************** |
+ |
+ table = cursor->insertTable(fieldsNamesList.count(), 2);// ñîçäàäèì òàáëèöó äëÿ ïîëåé êëàññà, êðîìå ïåðâûõ äâóõ (ID è íàçâàíèå îáúåêòà) |
+ |
+ for(int i=2; i < fieldsNamesList.count(); i++){ // ïðîïóñòèì ïîëÿ: ID è ïîëå, ñîäåðæàùåå èìÿ îáúåêòà (îíî è òàê óæå îòîáðàæåíî) |
+ // if (i !=icon_field_index) tmp_string = q.record().value(i).asString(); // åñëè ýòî íå èêîíêà, òî ñ÷èòûâàåì çíà÷åíèå êàê ñòðîêó |
+ if (i !=icon_field_index) tmp_string = q.record().value(i).asString(); // åñëè ýòî íå èêîíêà, òî ñ÷èòûâàåì çíà÷åíèå êàê ñòðîêó |
+ |
+ |
+ else tmp_string = tr("íåâîçìîæíî îòîáðàçèòü"); |
+ //// if (i !=icon_field_index) { |
+ for(int i=0; i<pos+2; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû |
+ *cursor = table->cellAt(i-2,0).firstCursorPosition();// ñòðîêà i-òàÿ, ñòîëáåö ïåðâûé |
+ cursor->insertText( fieldsNamesList.at(i));//ñþäà çàíîñèì èìÿ ïîëÿ |
+ *cursor = table->cellAt(i-2,1).firstCursorPosition();// ñòðîêà i-òàÿ, ñòîëáåö âòîðîé |
+ //cursor->insertText( tr(":\t")); |
+ |
+ cursor->insertText(tmp_string);//ñþäà çíà÷åíèå ïîëÿ |
+ // cursor->insertText( tr("\n")); |
+ } |
+ |
+ //// } |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ cursor->movePosition(QTextCursor::End);//âûõîäèì èç òàáëèöû |
+ cursor->insertText( tr("\n")); |
+ |
+ *********************************/ |
+ |
+ } |
+ |
+ |
+ |
+ /******************************************************** |
+ textFormat.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore); |
+ cursor->setBlockFormat(textFormat); |
+ |
+ cursor->insertText(tr("Íîâàÿ ñòðàíèöà ")); |
+ cursor->insertBlock(); |
+ |
+ textFormat.setPageBreakPolicy(QTextFormat::PageBreak_Auto); |
+ cursor->setBlockFormat(textFormat); |
+ **********************************************************/ |
+ |
+ |
+// itm->setIcon(0, icon); |
+ |
+ |
+ for (int i=0; i < model_item->childCount(); i++) // ïðîâåðÿåì, åñòü ëè ó êëàññà äî÷åðíèå êëàññû |
+ { |
+ QTreeWidgetItem * model_item_tmp; // åñëè åñòü |
+ QString pointer_name; |
+ QString filtr_tmp; |
+ bool pointer_isEmpty; |
+ model_item_tmp = model_item->child(i); // îòîáðàæàåì îáúåêòû äî÷åðíèõ êëàññîâ |
+ pointer_name = getPointerFieldName(classID, model_item->child(i)->text(1)); |
+ // // // // itm->setText(4, pointer_name); |
+ |
+ // title_item->setText(4, pointer_name); |
+ |
+ |
+ pointer_isEmpty = pointer_name.isEmpty(); |
+ filtr_tmp = tr("where "); |
+ filtr_tmp.append(tr("`")); |
+ filtr_tmp.append(pointer_name); |
+ filtr_tmp.append(tr("` = '")); |
+ filtr_tmp.append(ID_tmp); |
+ filtr_tmp.append(tr("'")); |
+ |
+ printChild(model_item_tmp, filtr_tmp, advanced, pos+1); |
+ |
+ // // // // showObjects(itm, model_item_tmp, filtr_tmp); |
+ //MainWindow::showObjectChildrens(ID_tmp, itm, model_item_tmp); |
+ |
+ } |
+// if(pos==2) newPage(); // åñëè ýòî êîðíåâîé êëàññ, âñòàâèì ðàçäåë ñòðàíèöû |
+ |
+ } |
+ |
+ } |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+void MainWindow::newPage(int page_number){ //âñòàâëÿåì â äîêóìåíò íîâóþ ñòðàíèöó |
+ |
+ QTextBlockFormat textFormat; |
+ textFormat.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore); |
+ cursor->setBlockFormat(textFormat); |
+ |
+ cursor->insertText(tr("Íîâàÿ ñòðàíèöà %1").arg(page_number)); |
+ cursor->insertBlock(); |
+ |
+ textFormat.setPageBreakPolicy(QTextFormat::PageBreak_Auto); |
+ cursor->setBlockFormat(textFormat); |
+ |
+ |
+} |
+void MainWindow::newPage(){ //âñòàâëÿåì â äîêóìåíò íîâóþ ñòðàíèöó |
+ |
+ QTextBlockFormat textFormat; |
+ textFormat.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore); |
+ cursor->setBlockFormat(textFormat); |
+ |
+ //cursor->insertText(tr("Íîâàÿ ñòðàíèöà %1").arg(page_number)); |
+ cursor->insertBlock(); |
+ |
+ textFormat.setPageBreakPolicy(QTextFormat::PageBreak_Auto); |
+ cursor->setBlockFormat(textFormat); |
+ |
+ |
+} |
+ |
+QList<TField> MainWindow::getFieldList(QString class_id){// ïîëó÷àåì ñïèñîê ïîëåé êëàññà |
+ |
+ QSqlQuery q; |
+ QString sql_str; |
+ QList<TField> result_list; |
+ |
+ int field_id, field_name, field_alias, field_type, field_default_value, field_classIdentifer, field_comment; |
+ |
+ bool ok; |
+ sql_str = tr("select * " |
+ " from `DescriptionOfClasses` where `DescriptionOfClasses`.`ClassIdentifer` = " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà |
+ ); |
+ |
+ sql_str.append(tr("'")); |
+ sql_str.append(class_id); |
+ sql_str.append(tr("' ")); |
+ ok = q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ return result_list; |
+ } |
+ |
+ |
+ field_id = q.record().indexOf(tr("ID")); |
+ field_name = q.record().indexOf(tr("FieldName")); |
+ field_alias = q.record().indexOf(tr("FieldAlias")); |
+ field_type = q.record().indexOf(tr("FieldType")); |
+ field_default_value = q.record().indexOf(tr("DefaultValue")); |
+ field_classIdentifer = q.record().indexOf(tr("ClassIdentifer")); |
+ field_comment = q.record().indexOf(tr("Comment")); |
+ |
+ while(q.next()){ |
+ |
+ TField field_tmp; |
+ field_tmp.ID = q.value(field_id).toString(); |
+ field_tmp.FieldName = q.value(field_name).toString(); |
+ field_tmp.FieldAlias = q.value(field_alias).toString(); |
+ field_tmp.FieldType = q.value(field_type).toString(); |
+ field_tmp.DefaultValue = q.value(field_default_value).toString(); |
+ field_tmp.ClassIdentifer = q.value(field_classIdentifer).toString(); |
+ field_tmp.Comment = q.value(field_comment).toString(); |
+ result_list << field_tmp; |
+ |
+ |
+ |
+ |
+ // parentClassID = q.value(field_default_value).toString(); |
+ // parentClassInctance = getClassInctance(parentClassID); |
+ // result_map.insert(pointerFieldName, parentClassInctance); |
+ |
+ |
+ |
+ } |
+ |
+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); |
+ all_reading = true; |
+ |
+} |
+ |
+void MainWindow::readStandartProcessError(){ |
+ QTextDocument * wmiDoc = ui->textEdit_2->document(); |
+ QTextCursor * wmiCursor; |
+ wmiCursor = new QTextCursor(wmiDoc); |
+ QString str; |
+ |
+ QByteArray arr; |
+ arr = wmiProcess.readAllStandardError(); |
+ str = QString(tr(arr)); |
+ wmiCursor->insertText(str); |
+ wmiCursor->insertText(tr("\n")); |
+ |
+} |
+ |
+ |
+ |
+TWmiVideoCard MainWindow::getWmiVideoGard(QString host, QString user_name, QString password){ |
+ TWmiVideoCard result; |
+ bool ok; |
+ QString ansver_string; |
+// wmiThread.moveToThread(&wmiThread); |
+ wmiThread.setHost(host); // çàäàåì õîñò |
+ wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
+ wmiThread.setPassword( password); |
+ wmiThread.setWmiString(tr("select Name, AdapterCompatibility, AdapterRAM, VideoProcessor from Win32_VideoController")); |
+ wmiThread.start(QThread::NormalPriority); |
+ //for (;;) {if (wmiThread.isStopped()) break;} |
+ int t; |
+ t++; |
+ |
+ |
+ 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("|"); |
+ tmp_str = split_new_line.at(2); |
+ values_list = tmp_str.split("|"); |
+ int index_tmp; |
+ index_tmp = fields_list.indexOf(tr("AdapterCompatibility")); // ïðîèçâîäèòåëü |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.manufacturer = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("Name")); // íàçâàíèå âèäåîêàðòû |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.name = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("VideoProcessor")); // ìîäåëü |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.model = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("AdapterRAM")); // ìîäåëü |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.video_ram = QVariant(values_list.at(index_tmp)).asInt(); |
+ return result; |
+ } |
+ else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
+ int m; |
+ m++; |
+ } |
+ else { |
+ |
+ wmiThread.terminate(); |
+ /********************* |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ **********************/ |
+ } |
+ |
+ /* |
+ |
+ 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 admin --password=samba //192.168.0.101 \"select * from ")); //Win32_Product\"")); |
+ program.append(ui->comboBox_2->currentText()); |
+ program.append(tr("\"")); |
+ all_reading = false; |
+ int i; |
+ i++; |
+ wmiProcess.start(program); |
+ |
+ |
+ |
+ while (!all_reading){}; //æäåì, ïîêà íå ñ÷èòàåòñÿ ðåçóëüòàò çàïðîñà |
+ |
+*/ |
+ return result; |
+ |
+ } |
+ |
+ |
+TWmiMatherBoard MainWindow::getWmiMatherBoard(QString host, QString user_name, QString password){ |
+TWmiMatherBoard result; |
+bool ok; |
+QString ansver_string; |
+wmiThread.setHost(host); // çàäàåì õîñò |
+wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
+wmiThread.setPassword( password); |
+wmiThread.setWmiString(tr("SELECT Manufacturer, Product FROM Win32_BaseBoard")); |
+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("|"); |
+ tmp_str = split_new_line.at(2); |
+ values_list = tmp_str.split("|"); |
+ int index_tmp; |
+ index_tmp = fields_list.indexOf(tr("Manufacturer")); // ïðîèçâîäèòåëü |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.manufacturer = values_list.at(index_tmp); |
+ // index_tmp = fields_list.indexOf(tr("Name")); // íàçâàíèå âèäåîêàðòû |
+ // if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.name = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("Product")); // ìîäåëü |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.model = values_list.at(index_tmp); |
+ // index_tmp = fields_list.indexOf(tr("AdapterRAM")); // ìîäåëü |
+ // if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.video_ram = QVariant(values_list.at(index_tmp)).asInt(); |
+ return result; |
+ } |
+ else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
+ int m; |
+ m++; |
+ } |
+ else { |
+ wmiThread.terminate(); |
+ /*********************** |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ **********************/ |
+ } |
+ |
+ |
+ |
+ return result; |
+ |
+} |
+ |
+ |
+TWmiProcessor MainWindow::getWmiProcessor(QString host, QString user_name, QString password){ |
+TWmiProcessor result; |
+bool ok; |
+QString ansver_string; |
+wmiThread.setHost(host); // çàäàåì õîñò |
+wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
+wmiThread.setPassword( password); |
+wmiThread.setWmiString(tr("SELECT Name, Manufacturer, CurrentClockSpeed, SocketDesignation FROM Win32_Processor")); |
+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("|"); |
+ tmp_str = split_new_line.at(2); |
+ values_list = tmp_str.split("|"); |
+ int index_tmp; |
+ index_tmp = fields_list.indexOf(tr("Manufacturer")); // ïðîèçâîäèòåëü ïðîöåññîðà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.manufacturer = values_list.at(index_tmp); |
+ |
+ index_tmp = fields_list.indexOf(tr("Name")); // íàçâàíèå ïðîöåññîðà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.name = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("SocketDesignation")); // ñîêåò |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.socket = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("CurrentClockSpeed")); // ÷àñòîòà ïðîöåññîðà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) result.clockSpeed = QVariant(values_list.at(index_tmp)).asInt(); |
+ |
+ |
+ |
+ |
+ |
+ return result; |
+ } |
+ else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
+ int m; |
+ m++; |
+ } |
+ else { |
+ |
+ wmiThread.terminate(); |
+ /************************ |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ ********************/ |
+ } |
+ |
+ |
+ |
+ return result; |
+ |
+ |
+ |
+} |
+ |
+ |
+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.terminate(); |
+ /********************* |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ ****************/ |
+} |
+ |
+ |
+ |
+return result; |
+} |
+ |
+ |
+QList<TWmiHDD> MainWindow::getWmiHDD(QString host, QString user_name, QString password) |
+{ |
+QList<TWmiHDD> result; |
+TWmiHDD hdd_tmp; |
+bool ok; |
+QString ansver_string; |
+ |
+QList<ThddSerialNumber> serNum_list; |
+serNum_list = MainWindow::getHDDSerNum(host, user_name, password); // îïðåäåëÿåì ñåðèéíûå íîìåðà äèñêîâ |
+ |
+ |
+ |
+ |
+wmiThread.setHost(host); // çàäàåì õîñò |
+wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
+wmiThread.setPassword( password); |
+wmiThread.setWmiString(tr("SELECT Caption, Manufacturer, Size, DeviceID from Win32_DiskDrive")); |
+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++) |
+ { |
+ hdd_tmp.caption = ""; |
+ hdd_tmp.deviceID=""; |
+ hdd_tmp.manufacturer=""; |
+ hdd_tmp.serialNumber=""; |
+ hdd_tmp.size=0; |
+ tmp_str = split_new_line.at(i); |
+ values_list = tmp_str.split("|"); |
+ int index_tmp; |
+ index_tmp = fields_list.indexOf(tr("Caption")); // íàçâàíèå äèñêà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) hdd_tmp.caption = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("Manufacturer")); // ïðîèçâîäèòåëü äèñêà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) hdd_tmp.manufacturer = values_list.at(index_tmp); |
+ |
+ |
+ |
+ |
+ index_tmp = fields_list.indexOf(tr("Size")); // Ðàçìåð äèñêà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) { |
+ |
+ QString size_str; |
+ bool ok; |
+ size_str = values_list.at(index_tmp); |
+ int size_int=0; |
+ long size_lng; |
+ size_int = size_str.toInt(&ok); |
+ size_lng = size_str.toLong(&ok); |
+ hdd_tmp.size= size_lng; |
+ } |
+ |
+ |
+ |
+ |
+ index_tmp = fields_list.indexOf(tr("DeviceID")); // èäåíòèôèêàòîð äèñêà äèñêà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) { |
+ hdd_tmp.deviceID = values_list.at(index_tmp); |
+ for (int k=0; k < serNum_list.count(); k++){ |
+ if ((serNum_list.at(k).deviceID == hdd_tmp.deviceID)&&(serNum_list.at(k).deviceID !="")) hdd_tmp.serialNumber = serNum_list.at(k).serialNumber; |
+ } |
+ |
+ } |
+ result << hdd_tmp; |
+ |
+ |
+ |
+ |
+ }; |
+ |
+ return result; |
+ } |
+ else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
+ int m; |
+ m++; |
+} |
+else { |
+ wmiThread.terminate(); |
+ /*********************** |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ ***************************/ |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+return result; |
+ |
+} |
+ |
+ |
+ |
+QList<ThddSerialNumber> MainWindow::getHDDSerNum(QString host, QString user_name, QString password){ |
+ |
+ QList<ThddSerialNumber> result; |
+ ThddSerialNumber serNum_tmp; |
+ bool ok; |
+ QString ansver_string; |
+ |
+ |
+ wmiThread.setHost(host); // çàäàåì õîñò |
+ wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
+ wmiThread.setPassword( password); |
+ wmiThread.setWmiString(tr("SELECT SerialNumber, Tag FROM Win32_PhysicalMedia")); |
+ 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++) |
+ { |
+ serNum_tmp.serialNumber = ""; |
+ serNum_tmp.deviceID = ""; |
+ tmp_str = split_new_line.at(i); |
+ values_list = tmp_str.split("|"); |
+ int index_tmp; |
+ index_tmp = fields_list.indexOf(tr("SerialNumber")); // ñåðèéíûé íîìåð äèñêà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) serNum_tmp.serialNumber = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("Tag")); // èäåíòèôèêàòîð äèñêà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) serNum_tmp.deviceID = values_list.at(index_tmp); |
+ |
+ result << serNum_tmp; |
+ |
+ }; |
+ |
+ return result; |
+ } |
+ else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
+ int m; |
+ m++; |
+ } |
+ else { |
+ wmiThread.terminate(); |
+ /**************************** |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ *************************/ |
+ } |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+QList<TWmiCDROM> MainWindow::getWmiCDROM(QString host, QString user_name, QString password) |
+{ |
+QList<TWmiCDROM> result; |
+TWmiCDROM cdrom_tmp; |
+bool ok; |
+QString ansver_string; |
+ |
+ |
+wmiThread.setHost(host); // çàäàåì õîñò |
+wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
+wmiThread.setPassword( password); |
+wmiThread.setWmiString(tr("select Caption, Manufacturer from Win32_CDRomDrive")); |
+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++) |
+ { |
+ cdrom_tmp.name = ""; |
+ cdrom_tmp.manufacturer = ""; |
+ tmp_str = split_new_line.at(i); |
+ values_list = tmp_str.split("|"); |
+ int index_tmp; |
+ index_tmp = fields_list.indexOf(tr("Caption")); // íàèìåíîâàíèå ïðèíòåðà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) cdrom_tmp.name = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("Manufacturer")); // ïðîèçâîäèòåëü äèñêà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) cdrom_tmp.manufacturer = values_list.at(index_tmp); |
+ |
+ result << cdrom_tmp; |
+ |
+ }; |
+ |
+ return result; |
+ } |
+ else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
+ int m; |
+ m++; |
+} |
+else { |
+ wmiThread.terminate(); |
+ return result; |
+ /********* |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ *******/ |
+} |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+QList<TWmiNetCard> MainWindow::getWmiNetCard(QString host, QString user_name, QString password){ |
+ |
+QList<TWmiNetCard> result; |
+TWmiNetCard netCard_tmp; |
+bool ok; |
+QString ansver_string; |
+wmiThread.setHost(host); // çàäàåì õîñò |
+wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
+wmiThread.setPassword( password); |
+wmiThread.setWmiString(tr("Select Description, Caption, MACAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")); |
+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++) |
+ { |
+ netCard_tmp.caption = ""; |
+ netCard_tmp.MACAddress= ""; |
+ tmp_str = split_new_line.at(i); |
+ values_list = tmp_str.split("|"); |
+ int index_tmp; |
+ index_tmp = fields_list.indexOf(tr("Description")); // íàèìåíîâàíèå ïðèíòåðà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) netCard_tmp.caption = values_list.at(index_tmp); |
+ index_tmp = fields_list.indexOf(tr("MACAddress")); // ïðîèçâîäèòåëü äèñêà |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) netCard_tmp.MACAddress = values_list.at(index_tmp); |
+ |
+ result << netCard_tmp; |
+ |
+ }; |
+ |
+ return result; |
+ } |
+ else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
+ int m; |
+ m++; |
+ } |
+else { |
+ wmiThread.terminate(); |
+ return result; |
+ /********* |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ *******/ |
+ } |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+QList<TWmiSoundCard> MainWindow::getWmiSoundCard(QString host, QString user_name, QString password) |
+{ |
+ QList<TWmiSoundCard> result; |
+ TWmiSoundCard soundCard_tmp; |
+ bool ok; |
+ QString ansver_string; |
+ wmiThread.setHost(host); // çàäàåì õîñò |
+ wmiThread.setUser(user_name);//çàäàåì èìÿ ïîëüçîâàòåëÿ |
+ wmiThread.setPassword( password); |
+ wmiThread.setWmiString(tr("Select Caption, Name from Win32_SoundDevice")); |
+ 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++) |
+ { |
+ soundCard_tmp.caption = ""; |
+ tmp_str = split_new_line.at(i); |
+ values_list = tmp_str.split("|"); |
+ int index_tmp; |
+ index_tmp = fields_list.indexOf(tr("Caption")); // íàèìåíîâàíèå çâóêîâîé êàðòû |
+ if ((index_tmp!=-1) && (index_tmp < values_list.count())) soundCard_tmp.caption = values_list.at(index_tmp); |
+ |
+ |
+ result << soundCard_tmp; |
+ |
+ }; |
+ |
+ return result; |
+ } |
+ else return result; //ïîëó÷èëè íå êîððåêòíûé îòâåò |
+ int m; |
+ m++; |
+ } |
+ else { |
+ wmiThread.terminate(); |
+ return result; |
+ /********* |
+ wmiThread.stop(); |
+ ok = wmiThread.wait(10000); |
+ int k; |
+ k++; |
+ *******/ |
+ } |
+ |
+ |
+ return result; |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
Index: trunk/DBViewer/iconform.cpp |
=================================================================== |
--- trunk/DBViewer/iconform.cpp (revision 0) |
+++ trunk/DBViewer/iconform.cpp (revision 257) |
@@ -0,0 +1,73 @@ |
+#include "iconform.h" |
+#include "ui_iconform.h" |
+#include "mainwindow.h" |
+ |
+ |
+IconForm::IconForm(QWidget *parent) : |
+ QWidget(parent), |
+ ui(new Ui::IconForm) |
+{ |
+ ui->setupUi(this); |
+ IconForm::fdataIsChanged = false; |
+} |
+ |
+IconForm::~IconForm() |
+{ |
+ delete ui; |
+} |
+ |
+void IconForm::changeEvent(QEvent *e) |
+{ |
+ QWidget::changeEvent(e); |
+ switch (e->type()) { |
+ case QEvent::LanguageChange: |
+ ui->retranslateUi(this); |
+ break; |
+ default: |
+ break; |
+ } |
+} |
+ |
+ |
+void IconForm::on_pushButton_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó" |
+ |
+ QString fileName; |
+ fileName = QFileDialog::getOpenFileName(this, |
+ tr("Open Image"), "", tr("Image Files (*.png *.jpg *.bmp)")); |
+ |
+ if (fileName.isEmpty()) return; |
+ Pixmap.load(fileName); |
+ if (Pixmap.height() > 128) Pixmap = Pixmap.scaledToHeight(128); |
+ |
+ ui->label->setPixmap(Pixmap); |
+ IconForm::fdataIsChanged = true; |
+// IconForm::close(); |
+} |
+ |
+void IconForm::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü èêîíêó" |
+ |
+ QPixmap pix_tmp; |
+ Pixmap = pix_tmp; |
+ ui->label->setPixmap(Pixmap); |
+ IconForm::fdataIsChanged = true; |
+ |
+ } |
+ |
+ |
+ |
+ |
+void IconForm::setPixmap (QPixmap newPixmap){ |
+Pixmap = newPixmap; |
+ ui->label->setPixmap(Pixmap); |
+ |
+} |
+ |
+ |
+QPixmap IconForm::pixmap (){ |
+ return Pixmap; |
+} |
+ |
+ |
+bool IconForm::dataIsChanged(){ |
+ return IconForm::fdataIsChanged; |
+} |
Index: trunk/DBViewer/treedelegateform.cpp |
=================================================================== |
--- trunk/DBViewer/treedelegateform.cpp (revision 0) |
+++ trunk/DBViewer/treedelegateform.cpp (revision 257) |
@@ -0,0 +1,15 @@ |
+#include "treedelegateform.h" |
+#include "ui_treedelegateform.h" |
+ |
+TreeDelegateForm::TreeDelegateForm(QWidget *parent) : |
+ QWidget(parent), |
+ ui(new Ui::TreeDelegateForm) |
+{ |
+ ui->setupUi(this); |
+ //this->layout()->addChildLayout(ui->verticalLayout); |
+} |
+ |
+TreeDelegateForm::~TreeDelegateForm() |
+{ |
+ delete ui; |
+} |
Index: trunk/DBViewer/delegate.h |
=================================================================== |
--- trunk/DBViewer/delegate.h (revision 0) |
+++ trunk/DBViewer/delegate.h (revision 257) |
@@ -0,0 +1,325 @@ |
+#ifndef DELEGATE_H |
+#define DELEGATE_H |
+ |
+#include <QItemDelegate> |
+#include <QModelIndex> |
+#include <QObject> |
+#include <QSize> |
+#include <QSpinBox> |
+#include <QSqlQuery> |
+#include <QtSql> |
+#include <QtGui> |
+#include <QSqlDatabase> |
+#include <QMessageBox> |
+ |
+#include "iconform.h" |
+#include "fileform.h" |
+ |
+//#include <QMainWindow> |
+//! [0] |
+ |
+ |
+typedef struct field { |
+ |
+ QString ID; |
+ QString FieldName; |
+ QString FieldAlias; |
+ QString FieldType; |
+ QString DefaultValue; |
+ QString ClassIdentifer; |
+ QString Comment; |
+ |
+ } TField; // ýòà ñòðóêòóðà îïèñûâàåò ïîëå |
+ |
+ |
+ |
+class SpinBoxDelegate : public QItemDelegate |
+{ |
+ Q_OBJECT |
+ |
+public: |
+ SpinBoxDelegate(QObject *parent = 0); |
+ |
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, const QModelIndex &index) const; |
+ void setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ void updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+ |
+ |
+ |
+ void setInctance(QString newInctance); |
+ void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê |
+ |
+ |
+ |
+ |
+private: |
+ |
+ |
+ QString inctance; // òàáëèöà-õðàíèëèùå, îòêóäà áóäåì áðàòü ñïèñîê |
+ QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID |
+ |
+}; |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+class FilterConditionDelegate : public QItemDelegate |
+{ |
+ Q_OBJECT |
+ |
+public: |
+ FilterConditionDelegate(QObject *parent = 0); |
+ |
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, const QModelIndex &index) const; |
+ void setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ void updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+ |
+ |
+ |
+ void setClassID(QString newClassID); |
+// void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê |
+ |
+ void setItems(QStringList new_items){items = new_items;} |
+ |
+ |
+private: |
+ |
+ |
+ QString class_id; // òàáëèöà-õðàíèëèùå, îòêóäà áóäåì áðàòü ñïèñîê |
+// QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID |
+ QStringList items; // ñïèñîê |
+}; |
+ |
+ |
+ |
+class FilterValueDelegate : public QItemDelegate |
+{ |
+ Q_OBJECT |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+public: |
+ FilterValueDelegate(QObject *parent = 0); |
+ |
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, const QModelIndex &index) const; |
+ void setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ void updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+ |
+ |
+ |
+ void setClassID(QString newClassID); |
+// void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê |
+ |
+ void setItems(QStringList new_items){items = new_items;} |
+ |
+ |
+private: |
+ |
+ |
+ QString class_id; // òàáëèöà-õðàíèëèùå, îòêóäà áóäåì áðàòü ñïèñîê |
+// QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID |
+mutable QStringList items; // ñïèñîê |
+static QString getClassInctanc(QString class_id);//îïðåäåëÿåì õðàíèëèùå îáúåêòîâ |
+static QString getFieldType(QString class_id, QString fieldName);//îïðåäåëÿåì òèï äàííûõ ïîëÿ |
+static TField getField(const QModelIndex &index); // ïî èíäåêñó (â òàáëèöå ôèëüòðîâ) ïîëó÷èì èíôîðìàöèþ î ïîëå |
+static QMap<QString, QString> getItems(QString inctance); // âîçâðàùàåì ñïèñîê âñåõ çíà÷åíèé èç òàáëèöû-õðàíèëèùà |
+ |
+}; |
+ |
+ |
+ |
+ |
+//! [0] |
+class FilterSpinBoxDelegate : public QItemDelegate |
+{ |
+ Q_OBJECT |
+ |
+public: |
+ FilterSpinBoxDelegate(QObject *parent = 0); |
+ |
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, const QModelIndex &index) const; |
+ void setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ void updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+ |
+ |
+ |
+ void setClassID(QString newClassID); |
+ void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê |
+ |
+ |
+ |
+ |
+private: |
+ |
+ |
+ QString class_id; // òàáëèöà-õðàíèëèùå, îòêóäà áóäåì áðàòü ñïèñîê |
+ QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID |
+}; |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+//! [0] |
+ |
+class MyDEDelegate : public QItemDelegate { |
+ Q_OBJECT |
+ public: |
+ MyDEDelegate(bool calpopup = true, |
+ QObject *parent = 0); |
+ QWidget *createEditor( |
+ QWidget *parent, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ void setEditorData(QWidget *editor, |
+ const QModelIndex &index) const; |
+ void setModelData(QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ void updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ private: |
+ bool m_calpopup; |
+ }; |
+ |
+ |
+class CPictureDelegate : public QItemDelegate |
+{ |
+ mutable QPixmap m_pxPicture; |
+ public: |
+ CPictureDelegate( QObject *parent ); |
+ |
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+}; |
+ |
+ |
+class IconDelegate : public QItemDelegate |
+{ |
+ mutable QPixmap m_pxPicture; |
+private: |
+ QTableView *tblView; |
+ |
+public: |
+ IconDelegate ( QObject *parent ); |
+ |
+ QWidget *createEditor( |
+ QWidget *parent, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, |
+ const QModelIndex &index) const; |
+ |
+ void setModelData(QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ |
+ void updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setTableView(QTableView* table); |
+ |
+ |
+ //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+}; |
+ |
+class FileDelegate : public QItemDelegate |
+{ |
+ mutable QByteArray m_Data; |
+private: |
+ // QTableView *tblView; |
+ |
+public: |
+ FileDelegate ( QObject *parent ); |
+ |
+ QWidget *createEditor( |
+ QWidget *parent, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, |
+ const QModelIndex &index) const; |
+ |
+ void setModelData(QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ |
+ void updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+/* |
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+*/ |
+ |
+ |
+ |
+// void setTableView(QTableView* table); |
+ |
+ |
+ //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+}; |
+ |
+class TimeEditDelegate : public QItemDelegate |
+ { |
+ Q_OBJECT |
+ |
+ public: |
+ TimeEditDelegate(const QString timeFormat = "dd.MM.yyyy hh:mm:ss",QObject *parent = 0) : QItemDelegate(parent) {this->timeformat = timeFormat;}; |
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ private: |
+ QString timeformat; |
+ }; |
+ |
+ |
+#endif // DELEGATE_H |
Index: trunk/DBViewer/mainwindow.h |
=================================================================== |
--- trunk/DBViewer/mainwindow.h (revision 0) |
+++ trunk/DBViewer/mainwindow.h (revision 257) |
@@ -0,0 +1,334 @@ |
+#ifndef MAINWINDOW_H |
+#define MAINWINDOW_H |
+ |
+ |
+//#include "mysql.h" |
+ |
+#include "mymodel.h" |
+#include "settingform.h" |
+#include "delegate.h" |
+// #include "fileform.h" |
+#include "treedelegateform.h" |
+#include "wmithread.h" |
+ |
+ |
+#include <QMainWindow> |
+#include <QStandardItemModel> |
+#include <QStandardItem> |
+#include <QTreeWidgetItem> |
+#include <QTextCodec> |
+#include <QSqlDatabase> |
+ |
+#include <QtGui> |
+#include <QString> |
+#include <QtSql> |
+#include <QFont> |
+#include <QColor> |
+#include <QItemDelegate> |
+#include <QList> |
+#include <QPalette> |
+ |
+ |
+ |
+/* |
+#include <QSqlField> |
+#include <QSqlRecord> |
+#include <QSqlTableModel> |
+#include <QSqlQueryModel> |
+#include <QTableView> |
+#include <QSqlDriverPlugin> |
+#include <QIcon> |
+#include <QVariant> |
+#include <QProcess> |
+#include <QByteArray> |
+*/ |
+ |
+typedef struct Class { |
+ QString name; |
+ QString ID; |
+ |
+} TClass; |
+ |
+ |
+ |
+typedef struct wmiVideoCard { |
+ QString name; // íàçâàíèå âèäåîêàðòû |
+ QString manufacturer; // ïðîèçâîäèòåëü |
+ QString model; |
+ int video_ram; |
+ |
+} TWmiVideoCard; |
+ |
+ |
+ |
+ |
+typedef struct wmiMatherBoard { |
+ // QString name; // íàçâàíèå âèäåîêàðòû |
+ QString manufacturer; // ïðîèçâîäèòåëü |
+ QString model; |
+ //int video_ram; |
+ |
+} TWmiMatherBoard; |
+ |
+ |
+typedef struct wmiProcessor { |
+ QString name; // íàçâàíèå ïðîöåññîðà |
+ QString manufacturer; // ïðîèçâîäèòåëü |
+ int clockSpeed; |
+ QString socket; |
+ |
+ //int video_ram; |
+ |
+} TWmiProcessor; |
+ |
+ |
+typedef struct wmiMemoryModul { |
+ QString bankLabel; // íîìåð áàíêè |
+ int capacity; // ðàçìåð |
+ |
+} TWmiMemoryModul; |
+ |
+typedef struct wmiHDD { |
+ QString caption; // íàèìåíîâàíèå äèñêà |
+ long size; // ðàçìåð |
+ QString manufacturer; // ïðîèçâîäèòåëü |
+ QString serialNumber; // ñåðèéíûé íîìåð äèñêà |
+ QString deviceID; // èäåíòèôèêàòîð äèñêà â ñèñòåìå |
+ |
+} TWmiHDD; |
+ |
+typedef struct hddSerialNumber { |
+ QString serialNumber; // ñåðèéíûé íîìåð äèñêà |
+ QString deviceID; // èäåíòèôèêàòîð äèñêà â ñèñòåìå |
+ |
+} ThddSerialNumber; |
+ |
+ |
+ |
+typedef struct wmiCDROM { |
+ QString name; // íàçâàíèå âèäåîêàðòû |
+ QString manufacturer; // ïðîèçâîäèòåëü |
+ |
+} TWmiCDROM; |
+ |
+ |
+typedef struct wmiNetCard { |
+ QString caption; // íàçâàíèå âèäåîêàðòû |
+ QString MACAddress; // ïðîèçâîäèòåëü |
+ |
+} TWmiNetCard; |
+ |
+typedef struct wmiSoundCard { |
+ QString caption; // íàçâàíèå âèäåîêàðòû |
+ // QString MACAddress; // ïðîèçâîäèòåëü |
+ |
+} TWmiSoundCard; |
+ |
+namespace Ui { |
+ class MainWindow; |
+} |
+ |
+class MainWindow : public QMainWindow { |
+ Q_OBJECT |
+public: |
+ MainWindow(QWidget *parent = 0); |
+ ~MainWindow(); |
+ |
+protected: |
+ void changeEvent(QEvent *e); |
+ |
+private: |
+ Ui::MainWindow *ui; |
+ //FileForm fileForm; |
+ |
+volatile bool all_reading; |
+ |
+ TreeDelegateForm treeForm; |
+ |
+ settingForm setFrm; |
+//ïåðåìåííûå äëÿ ñîåäèíåíèÿ ñ áàçîé |
+ QString baseName; |
+ QString hostName; |
+ QString userName; |
+ QString password; |
+ QString tableName; |
+ |
+ void readSettings(); |
+ void writeSettings(); |
+ |
+ |
+ QProcess wmiProcess; |
+ QList<QTreeWidgetItem *> root_items_list; |
+ QStandardItemModel *model; |
+ QStandardItem *item; |
+ 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; // ñòðîêà, îïèñûâàþùàÿ ìîäåëü ïðåäñòàâëåíèÿ |
+ void addChildsString(QTreeWidgetItem *parentItem, int level); |
+ |
+ QSqlDatabase sql; |
+ bool model_is_build; // ôëàã ãîâîðèò, ïîñòðîåíà ëè ìîäêëü (true) èëè íåò (false) |
+ |
+ bool openDataBase(); |
+ bool buildPreviewModel(QString modelName, QString rootClassID); |
+ |
+ bool rebuildPreviewModel(QTreeWidgetItem* root_item, QString rootClassID, int row); |
+ |
+ QString ClassName(QString class_id); //âîçâðàùàåò èìÿ êëàññà ïî åãî ID |
+ void addChildsItems(QTreeWidgetItem *perent_class_item, int row); // äîáîâëÿåì ê ýëåìåíòó äåðåâà â êà÷åñòâå äî÷åðíèõ ýëåìåíòîâ âñå êëàññû, äëÿ êîòîðûõ êëàññ ýëåìåíòà ÿâëÿåòñÿ êîíòåéíåðîì |
+ QStringList classChields(QString class_id); |
+ QMap <QString, QString> getClassList(); // ïîëó÷àåì ñïèñîê êëàññîâ |
+ QMap <QString, QString> getFieldsList(QString class_id); // ïîëó÷àåì ñïèñîê ïîëåé êëàññà |
+ void initComboBox(); |
+ QList<QTreeWidgetItem *> rootItems; // ñïèñîê óêàçàòåëåé êîðíåâûõ óçëîâ (ìîäåëåé) |
+ 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); |
+ QList<TWmiHDD> getWmiHDD(QString host, QString user_name, QString password); |
+ QList<ThddSerialNumber> getHDDSerNum(QString host, QString user_name, QString password); |
+ |
+ QList<TWmiCDROM> getWmiCDROM(QString host, QString user_name, QString password); |
+ QList<TWmiNetCard> getWmiNetCard(QString host, QString user_name, QString password); |
+ QList<TWmiSoundCard> getWmiSoundCard(QString host, QString user_name, QString password); |
+ |
+ |
+ |
+ |
+ |
+ |
+ WmiThread wmiThread; |
+ /////// QSqlTableModel * sql_mogel; |
+ |
+ MyModel * sql_mogel; |
+ //// MyModel * filter_model; |
+ |
+ QSqlTableModel * filter_model; |
+ |
+ QSqlTableModel * model_for_ListModelsTable; |
+ |
+ void initListModelsTablle(); |
+ void readModels(); // ñ÷èòûâàåì ñïèñîê ìîäåëåé èç áàçû äàííûõ è ñòðîèì äåðåâî ìîäåëåé |
+ |
+ int pointer_index; //èíäåêñ ïîëÿ-óêàçàòåëÿ íà ðîäèòåëüñêèé êëàññ |
+ QString parentObject_id; |
+ |
+ |
+ QMap <QString, QString> class_list_map; |
+ QMap <int, QTreeWidgetItem*> models_items; // ñïèñîê èòåìîâ (êîðíåâûõ )ìîäåëåé è ñîîòâåòñòâóþùèõ èì ñòðîê â òàáëèöå ìîäåëåé |
+ void getDatabaseData(); |
+ void buildTree(QTreeWidgetItem * model_item); |
+ QString getClassInctance(QString class_id); // ïîëó÷àåì èìÿ òàáëèöû - õðàíèëèùà îáúåêòîâ êëàññà |
+ void showClassObjects(QTreeWidgetItem * parent_item, QTreeWidgetItem * model_item); // îòîáðàçèì îáúåêòû êëàññîâà |
+ void showObjectChildrens(QString object_ID, QTreeWidgetItem * object_item, QTreeWidgetItem * model_item); // îòîáðàçèì îáúåêòû êëàññîâà |
+ void showObjects(QTreeWidgetItem * parent_object_item, QTreeWidgetItem * model_item, QString filtr);// // îòîáðàçèì îáúåêòû êëàññîâà |
+ QString getPointerFieldName(QString parent_class_id, QString chield_class_id); // îïðåäåëÿåì èìÿ ïîëÿ, â êîòîðîì õðÿíÿòñÿ óêàçàòåëè íà îáúåêòû ðîäèòåëüñêîãî êëàññà |
+ |
+ QMap <QString, QString> getPointersList(QString class_id); // ïîëó÷àåì ñïèñîê âñåõ ïîëåé-óêàçàòåëåé, â êà÷åñòâå êëþ÷åé ïîëó÷èì èìåíà ïîëåé-óêàçàòåëåé |
+ // â êà÷åñòâå çíà÷åíèé ïîëó÷èì ñïèñîê òàáëèö-õðàíèëèù îáúåêòîâ ðîäèòåëüñêèõ êëàññîâ |
+ |
+ |
+ QMap <QString, QPixmap> getClassesIcons(); // ïîëó÷àåì ñïèñîê èêîíîê äëÿ êëàññîâ |
+ // â êà÷åñòâå êëþ÷à ïîëó÷èì ID êëàññà, à â êà÷åñòâå çíà÷åíèé - èçîáðàæåíèÿ èêîíîê |
+ |
+ |
+ QMap <QString, QPixmap> getObjectsIcon(QString inctance); // ïîëó÷àåì ñïèñîê èêîíîê äëÿ îáúåêòîâ |
+ // â êà÷åñòâå êëþ÷à ïîëó÷èì ID îáúåêòà, à â êà÷åñòâå çíà÷åíèé - èçîáðàæåíèÿ èêîíîê |
+ |
+ |
+ QStringList getDataFieldList(QString class_id); // ïîëó÷àåì ñïèñîê âñåõ ïîëåé c òèïîì "Äàòà" |
+ |
+ |
+ |
+ QStringList getBoolFieldList(QString class_id); // ïîëó÷àåì ñïèñîê âñåõ ïîëåé c òèïîì "bool" |
+ |
+ |
+ QStringList getFileFieldList(QString class_id); // ïîëó÷àåì ñïèñîê âñåõ ïîëåé, â êîòîðûõ õðàíÿòüñÿ ôàéëû" |
+ |
+ |
+ QString getFiltrString(QString model_id, QString class_id); // ïîëó÷àåì ñòðîêó-ôèëüòð äëÿ äàííîãî êëàññà äàííîé ìîäåëè |
+ |
+ |
+ QList<TField> getFieldList(QString class_id);// ïîëó÷àåì ñïèñîê ïîëåé êëàññà |
+ |
+ |
+ int getIconFieldIndex(QString inctance); // ïîëó÷àåì íîìåð ñòîëáöà ñ èêîíêàìè |
+ |
+ |
+ void buildReport(bool advanced); // ñîçäàåì îò÷åò è ýêñïîðòèðóåì â OpenOffice, ïåðåìåííàÿ advanced óêàçûâàåò áóäåò ëè îò÷åò ðàñøèðåííûì |
+ // QTreeWidgetItem * model_item |
+ |
+ void getReport(QTreeWidgetItem * model_item, bool advanced); // ñîçäàåò îò÷åò äëÿ êîíêðåòíîé ìîäåëè ïåðåìåííàÿ advanced óêàçûâàåò áóäåò ëè îò÷åò ðàñøèðåííûì |
+ |
+ void printChild(QTreeWidgetItem * model_item, QString filtr, bool advanced, int pos);//â ðàïîðò äîáàâëÿåì äî÷åðíèå êëàññû |
+ |
+ void newPage(int page_number);//â ðàïîðò âñòàâëÿåì íîâóþ ñòðàíèöó |
+ void newPage();//â ðàïîðò âñòàâëÿåì íîâóþ ñòðàíèöó |
+ |
+ SpinBoxDelegate spinDelegate; |
+ QItemDelegate standart_delegate; |
+ CPictureDelegate * picture_delegate; |
+ IconDelegate * iconDelegate; |
+ FileDelegate * fileDelegate; // äåëåãàò äëÿ òàáëèöû ñ ôèëüòðàìè, áóäåò îòîáðàæàòü ñïèñîê ïîëåé êëàññà |
+ FilterSpinBoxDelegate filterSpinDelegate; |
+ FilterConditionDelegate filterConditionDelegate, filterConditionDelegate_1, filterConditionDelegate_2; |
+ FilterValueDelegate filterValueDelegate; // äåëåãàò äëÿ òàáëèöû ñ ôèëüòðàìè, áóäåò îòîáðàæàòü ñïèñîê çíà÷åíèé îáúåêòîâ êëàññà |
+ |
+ bool comboBox_slot_enable; // äëÿ áëîêèðîâêè ñëîòà, êîãäà ìåíÿåì item_index èç ïðîãðàììû, à íå âðó÷íóþ |
+ QList <int> boolFieldsIndexes_global; // ñïèñîê íîìåðîâ ñòîëáöîâ ñ òèïîì "BOOL" |
+ |
+ QMap <QString, QPixmap> classesIcons; |
+ |
+ QTextDocument * doc; |
+ QTextCursor * cursor; |
+ |
+ |
+ |
+private slots: |
+ void on_comboBox_currentIndexChanged( int index ); |
+ void on_treeWidget_itemChanged ( QTreeWidgetItem * item, int column ); |
+ void on_treeWidget_itemClicked ( QTreeWidgetItem * item, int column ); |
+ void on_treeWidget_2_itemClicked ( QTreeWidgetItem * item, int column ); |
+ void on_pushButton_clicked(); // íàæàòèå êíîïêè "Äîáàâèòü îáúåêò" |
+ void on_pushButton_2_clicked();// íàæàòèå êíîïêè "Óäàëèòü âûäåëåííûå îáúåêòû" |
+ void on_pushButton_3_clicked();// íàæàòèå êíîïêè "Ïðèìåíèòü" |
+ void on_pushButton_4_clicked();// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" |
+ void on_pushButton_5_clicked();// íàæàòèå êíîïêè "Äîáàâèòü ìîäåëü " |
+ void on_pushButton_6_clicked();// íàæàòèå êíîïêè "Óäàëèòü ìîäåëü " |
+ void on_pushButton_7_clicked();// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ìîäåëåé) |
+ void on_pushButton_8_clicked();// íàæàòèå êíîïêè "Îòìåíèòü" (íà âêëàäêå ìîäåëåé) |
+ void on_pushButton_9_clicked();// íàæàòèå êíîïêè "Äîáàâèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ) |
+ void on_pushButton_10_clicked();// íàæàòèå êíîïêè "Óäàëèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ) |
+ void on_pushButton_11_clicked();// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ôèëüòðîâ) |
+ void on_pushButton_12_clicked();// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ) |
+ void on_pushButton_13_clicked();// íàæàòèå êíîïêè "Ñôîðìèðîâàòü êðàòêèé îò÷åò" (íà âêëàäêå îò÷åòîâ) |
+ void on_pushButton_14_clicked();// íàæàòèå êíîïêè "Ñôîðìèðîâàòü ïîëíûé îò÷åò" (íà âêëàäêå îò÷åòîâ) |
+ 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(); |
+ |
+ |
+ |
+ |
+}; |
+ |
+ |
+ |
+ |
+#endif // MAINWINDOW_H |
Index: trunk/DBViewer/iconform.h |
=================================================================== |
--- trunk/DBViewer/iconform.h (revision 0) |
+++ trunk/DBViewer/iconform.h (revision 257) |
@@ -0,0 +1,32 @@ |
+#ifndef ICONFORM_H |
+#define ICONFORM_H |
+ |
+#include <QWidget> |
+ |
+namespace Ui { |
+ class IconForm; |
+} |
+ |
+class IconForm : public QWidget { |
+ Q_OBJECT |
+public: |
+ IconForm(QWidget *parent = 0); |
+ ~IconForm(); |
+ void setPixmap (QPixmap newPixmap); |
+ // void clearPixmap(); |
+ QPixmap pixmap (); |
+ bool dataIsChanged(); |
+protected: |
+ void changeEvent(QEvent *e); |
+ |
+private: |
+ Ui::IconForm *ui; |
+ QPixmap Pixmap; |
+ bool fdataIsChanged; |
+private slots: |
+ |
+ void on_pushButton_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó" |
+ void on_pushButton_2_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó" |
+ |
+}; |
+#endif // ICONFORM_H |
Index: trunk/DBViewer/treedelegateform.h |
=================================================================== |
--- trunk/DBViewer/treedelegateform.h (revision 0) |
+++ trunk/DBViewer/treedelegateform.h (revision 257) |
@@ -0,0 +1,27 @@ |
+#ifndef TREEDELEGATEFORM_H |
+#define TREEDELEGATEFORM_H |
+ |
+#include <QWidget> |
+ |
+namespace Ui { |
+ class TreeDelegateForm; |
+} |
+ |
+class TreeDelegateForm : public QWidget |
+{ |
+ Q_OBJECT |
+ |
+public: |
+ explicit TreeDelegateForm(QWidget *parent = 0); |
+ ~TreeDelegateForm(); |
+ void setClassID(QString new_class_id){class_id = new_class_id;} //óñòàíàâëèâàåò èäåíòèôèêàòîð êëàññà, ê îáúåêòàì êîòîðîãî áóäåò ïðèìåíÿòüñÿ ôèëüòð |
+ QString classID(){return class_id;}//âîçâðàùàåò èäåíòèôèêàòîð êëàññà |
+private: |
+ Ui::TreeDelegateForm *ui; |
+ QString class_id; //èäåíòèôèêàòîð êëàññà, ê îáúåêòàì êîòîðîãî áóäåò ïðèìåíÿòüñÿ ôèëüòð |
+ |
+ |
+ |
+}; |
+ |
+#endif // TREEDELEGATEFORM_H |
Index: trunk/DBViewer/wmithread.cpp |
=================================================================== |
--- trunk/DBViewer/wmithread.cpp (revision 0) |
+++ trunk/DBViewer/wmithread.cpp (revision 257) |
@@ -0,0 +1,77 @@ |
+#include "wmithread.h" |
+ |
+WmiThread::WmiThread(QObject *parent) : |
+ QThread(parent) |
+{ |
+ // woker.moveToThread(this); |
+ mutex.lock(); |
+ stopped = false; |
+ mutex.unlock(); |
+ |
+ // connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput())); |
+ // connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(readStandartProcessError())); |
+ |
+ |
+ |
+} |
+ |
+void WmiThread::run(){ |
+ |
+ |
+ QEventLoop loop; // = new QEventLoop(); |
+ Woker woker; // îáúåêò äëÿ ðàáîòû â òåëå ïîòîêà |
+ |
+ // connect(&woker, SIGNAL(workEnd()), this, SLOT(wokerIsStopped())); |
+connect(&woker, SIGNAL(workEnd()), &loop, SLOT(quit())); |
+ |
+ |
+ QString query_string; |
+// error = false; //ñáðîñèì ôëàã îøèáêè |
+ query_string = tr("wmic -U "); |
+ query_string.append(user_name); |
+ query_string.append("%\""); |
+ query_string.append(password); |
+ query_string.append("\""); |
+ query_string.append(tr(" //")); |
+ query_string.append(host); |
+ query_string.append(tr(" \"")); |
+ query_string.append(wmi_string); |
+ query_string.append(tr("\"")); |
+ // process.start(query_string); |
+// process.start("ls\n"); |
+// while (!stopped) {;} |
+ |
+ qDebug() << query_string; |
+ woker.setProcessString(query_string); |
+ woker.startProcess(); |
+ |
+ loop.exec(); |
+ p_buffer = woker.workBuffer(); |
+} |
+ |
+void WmiThread::stop(){ |
+ mutex.lock(); |
+ stopped = true; |
+ mutex.unlock(); |
+} |
+ |
+void WmiThread::readStandartProcessOutput(){ |
+p_buffer = process.readAllStandardOutput(); |
+ qDebug() << QString(p_buffer); |
+mutex.lock(); |
+stopped = true; |
+mutex.unlock(); |
+process.close(); |
+exit(); |
+} |
+ |
+void WmiThread::readStandartProcessError(){ |
+p_buffer = process.readAllStandardError(); |
+error = true; // åñëè îøèáêà, óñòàíîâèì ôëàã îøèáêè âûïîëíåíèÿ WMI-çàïðîñà |
+} |
+ |
+/* |
+void WmiThread::wokerIsStopped(){ |
+exit(); |
+} |
+*/ |
Index: trunk/DBViewer/main.cpp |
=================================================================== |
--- trunk/DBViewer/main.cpp (revision 0) |
+++ trunk/DBViewer/main.cpp (revision 257) |
@@ -0,0 +1,15 @@ |
+#include <QtGui/QApplication> |
+#include "mainwindow.h" |
+ |
+int main(int argc, char *argv[]) |
+{ |
+ Q_INIT_RESOURCE(dbviewer); |
+ |
+ QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
+ QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
+ QTextCodec::setCodecForTr(codec); |
+ QApplication a(argc, argv); |
+ MainWindow w; |
+ w.show(); |
+ return a.exec(); |
+} |
Index: trunk/DBViewer/DBViewer.pro |
=================================================================== |
--- trunk/DBViewer/DBViewer.pro (revision 0) |
+++ trunk/DBViewer/DBViewer.pro (revision 257) |
@@ -0,0 +1,42 @@ |
+# ------------------------------------------------- |
+# Project created by QtCreator 2010-09-10T12:38:15 |
+# ------------------------------------------------- |
+QT += network \ |
+ opengl \ |
+ sql \ |
+ script \ |
+ scripttools \ |
+ svg \ |
+ xml \ |
+ xmlpatterns \ |
+ thread\ |
+# multimedia \ |
+ qt3support |
+TARGET = DBViewer |
+TEMPLATE = app |
+SOURCES += main.cpp \ |
+ mainwindow.cpp \ |
+ database.cpp \ |
+ delegate.cpp \ |
+ mymodel.cpp \ |
+ settingform.cpp \ |
+ iconform.cpp \ |
+ fileform.cpp \ |
+ treedelegateform.cpp \ |
+ wmithread.cpp \ |
+ woker.cpp |
+HEADERS += mainwindow.h \ |
+ delegate.h \ |
+ mymodel.h \ |
+ settingform.h \ |
+ iconform.h \ |
+ fileform.h \ |
+ treedelegateform.h \ |
+ wmithread.h \ |
+ woker.h |
+FORMS += mainwindow.ui \ |
+ settingform.ui \ |
+ iconform.ui \ |
+ fileform.ui \ |
+ treedelegateform.ui |
+RESOURCES += dbviewer.qrc |
Index: trunk/DBViewer/woker.cpp |
=================================================================== |
--- trunk/DBViewer/woker.cpp (revision 0) |
+++ trunk/DBViewer/woker.cpp (revision 257) |
@@ -0,0 +1,26 @@ |
+#include "woker.h" |
+ |
+Woker::Woker(QObject *parent) : |
+ QObject(parent) |
+{ |
+ connect(&work_process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput())); |
+ connect(&work_process, SIGNAL(readyReadStandardError()), this, SLOT(readStandartProcessError())); |
+ // work_process.start("ls\n"); |
+ |
+} |
+void Woker::readStandartProcessOutput(){ |
+work_buffer = work_process.readAllStandardOutput(); |
+ qDebug() << QString(work_buffer); |
+//mutex.lock(); |
+//stopped = true; |
+//mutex.unlock(); |
+work_process.close(); |
+//stopThread(); |
+emit workEnd(); |
+ |
+} |
+ |
+void Woker::readStandartProcessError(){ |
+work_buffer = work_process.readAllStandardError(); |
+//error = true; // если ошибка, установим флаг ошибки выполнения WMI-запроса |
+} |
Index: trunk/DBViewer/wmithread.h |
=================================================================== |
--- trunk/DBViewer/wmithread.h (revision 0) |
+++ trunk/DBViewer/wmithread.h (revision 257) |
@@ -0,0 +1,70 @@ |
+#ifndef WMITHREAD_H |
+#define WMITHREAD_H |
+ |
+#include <QThread> |
+#include <QProcess> |
+#include <QMutex> |
+#include <QDebug> |
+#include <QEventLoop> |
+#include "woker.h" |
+ |
+class WmiThread : public QThread |
+{ |
+ Q_OBJECT |
+public: |
+ explicit WmiThread(QObject *parent = 0); |
+ void run(); |
+ void stop(); |
+ void setHost(QString new_host){host = new_host;} |
+ void setUser(QString new_user){user_name = new_user;} |
+ void setPassword(QString new_password){password = new_password;} |
+ QByteArray buffer(){return p_buffer;} |
+ void clearBuffer(){p_buffer.clear();} |
+ bool isError(){return error;} |
+ bool isStopped(){ |
+ mutex.lock(); |
+ return stopped; |
+ mutex.unlock(); |
+ |
+ } |
+ void setWmiString(QString new_wmi_string){wmi_string = new_wmi_string;} |
+ QString resultString(){ |
+ |
+ QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
+ QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
+ QTextCodec::setCodecForTr(codecUTF); |
+ QString tmp_str; |
+ tmp_str = tr(p_buffer); |
+ QTextCodec::setCodecForTr(codec); |
+ // return QString(tr(p_buffer)); |
+ return tmp_str; |
+ } |
+volatile bool stopped; |
+private: |
+ |
+ volatile bool error; |
+ |
+ QProcess process; |
+ QString host; |
+ QString user_name; |
+ QString password; |
+ QMutex mutex; |
+ QByteArray p_buffer; //çäåñü áóäåì õðàíèòü äàííûå, ñ÷èòàííûå èç ñòàíäàðòíîãî ïîòîêà äëÿ ÷òåíèÿ (ïðîöåññà) |
+ QString wmi_string; //çäåñü áóäåì õðàíèòü wmi-çàïðîñ |
+ QEventLoop *loop; |
+ |
+signals: |
+ void stop_now(); |
+ |
+public slots: |
+ void readStandartProcessOutput(); |
+ void readStandartProcessError(); |
+ // void wokerIsStopped(); |
+ |
+private slots: |
+ |
+ |
+ |
+}; |
+ |
+#endif // WMITHREAD_H |
Index: trunk/DBViewer/woker.h |
=================================================================== |
--- trunk/DBViewer/woker.h (revision 0) |
+++ trunk/DBViewer/woker.h (revision 257) |
@@ -0,0 +1,32 @@ |
+#ifndef WOKER_H |
+#define WOKER_H |
+ |
+#include <QObject> |
+#include <QProcess> |
+#include <QMutex> |
+#include <QDebug> |
+ |
+ |
+class Woker : public QObject |
+{ |
+ Q_OBJECT |
+public: |
+ explicit Woker(QObject *parent = 0); |
+ void startProcess(){work_process.start(process_string);} |
+ void setProcessString(QString new_string){process_string = new_string;}; |
+ QByteArray workBuffer(){return work_buffer;} |
+ |
+private: |
+ QProcess work_process; |
+ QByteArray work_buffer; //здесь будем хранить данные, считанные из стандартного потока для чтения (процесса) |
+ QString process_string; //ñòðîêà áóäåò ñîäåðæàòü òåêñò çàïðîñà (êîìàíäó) |
+ |
+ |
+signals: |
+ void workEnd(); |
+public slots: |
+ void readStandartProcessOutput(); |
+ void readStandartProcessError(); |
+}; |
+ |
+#endif // WOKER_H |
Index: trunk/DBViewer/settingform.ui |
=================================================================== |
--- trunk/DBViewer/settingform.ui (revision 0) |
+++ trunk/DBViewer/settingform.ui (revision 257) |
@@ -0,0 +1,91 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>settingForm</class> |
+ <widget class="QWidget" name="settingForm"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>180</width> |
+ <height>306</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Параметры соединения</string> |
+ </property> |
+ <widget class="QWidget" name="verticalLayout"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>171</width> |
+ <height>336</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label"> |
+ <property name="text"> |
+ <string>Имя базы данных</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_2"> |
+ <property name="text"> |
+ <string>Имя пользователя</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_2"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_3"> |
+ <property name="text"> |
+ <string>Пароль</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_3"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_5"> |
+ <property name="text"> |
+ <string>Имя сервера</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_5"/> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="text"> |
+ <string>Применить</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <resources/> |
+ <connections/> |
+</ui> |
/trunk/DBViewer/settingform.ui |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/DBViewer/model.txt |
=================================================================== |
--- trunk/DBViewer/model.txt (revision 0) |
+++ trunk/DBViewer/model.txt (revision 257) |
@@ -0,0 +1,6 @@ |
+Hello!!! true 1 |
+ Îòäåë true 2 |
+ Ñîòðóäíèê false 3 |
+ SubSubstring2 true 4 |
+ SubSubstring3 false 5 |
+Bay true 688 |
Index: trunk/DBViewer/fileform.ui |
=================================================================== |
--- trunk/DBViewer/fileform.ui (revision 0) |
+++ trunk/DBViewer/fileform.ui (revision 257) |
@@ -0,0 +1,72 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>FileForm</class> |
+ <widget class="QWidget" name="FileForm"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>92</width> |
+ <height>32</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Form</string> |
+ </property> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>31</width> |
+ <height>30</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="icon"> |
+ <iconset resource="dbviewer.qrc"> |
+ <normaloff>:/Open.png</normaloff>:/Open.png</iconset> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="pushButton_2"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>30</x> |
+ <y>0</y> |
+ <width>31</width> |
+ <height>30</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="icon"> |
+ <iconset resource="dbviewer.qrc"> |
+ <normaloff>:/Delete.png</normaloff>:/Delete.png</iconset> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="pushButton_3"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>60</x> |
+ <y>0</y> |
+ <width>31</width> |
+ <height>30</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="icon"> |
+ <iconset resource="dbviewer.qrc"> |
+ <normaloff>:/Save.png</normaloff>:/Save.png</iconset> |
+ </property> |
+ </widget> |
+ </widget> |
+ <resources> |
+ <include location="dbviewer.qrc"/> |
+ </resources> |
+ <connections/> |
+</ui> |
Index: trunk/source_code/ui/settingform.ui |
=================================================================== |
--- trunk/source_code/ui/settingform.ui (revision 0) |
+++ trunk/source_code/ui/settingform.ui (revision 257) |
@@ -0,0 +1,100 @@ |
+<ui version="4.0" > |
+ <class>settingForm</class> |
+ <widget class="QWidget" name="settingForm" > |
+ <property name="geometry" > |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>180</width> |
+ <height>306</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle" > |
+ <string>Параметры соединения</string> |
+ </property> |
+ <widget class="QWidget" name="verticalLayout" > |
+ <property name="geometry" > |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>161</width> |
+ <height>291</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" > |
+ <item> |
+ <widget class="QLabel" name="label" > |
+ <property name="text" > |
+ <string>Имя базы данных</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit" /> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_2" > |
+ <property name="text" > |
+ <string>Имя пользователя</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_2" /> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_3" > |
+ <property name="text" > |
+ <string>Пароль</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_3" /> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_4" > |
+ <property name="text" > |
+ <string>Имя таблицы</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_4" /> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_5" > |
+ <property name="text" > |
+ <string>Имя сервера</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_5" /> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton" > |
+ <property name="text" > |
+ <string>Применить</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation" > |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" > |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <resources/> |
+ <connections/> |
+</ui> |
/trunk/source_code/ui/settingform.ui |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/ui/addsotrydnikform.ui |
=================================================================== |
--- trunk/source_code/ui/addsotrydnikform.ui (revision 0) |
+++ trunk/source_code/ui/addsotrydnikform.ui (revision 257) |
@@ -0,0 +1,91 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>addsotrydnikform</class> |
+ <widget class="QDialog" name="addsotrydnikform"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>281</width> |
+ <height>113</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Новый сотрудник</string> |
+ </property> |
+ <widget class="QWidget" name="verticalLayoutWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>261</width> |
+ <height>91</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout"> |
+ <item> |
+ <widget class="QLabel" name="label"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>12</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Введите ФИО сотрудника</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit"/> |
+ </item> |
+ <item> |
+ <widget class="QDialogButtonBox" name="buttonBox"> |
+ <property name="orientation"> |
+ <enum>Qt::Horizontal</enum> |
+ </property> |
+ <property name="standardButtons"> |
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <resources/> |
+ <connections> |
+ <connection> |
+ <sender>buttonBox</sender> |
+ <signal>rejected()</signal> |
+ <receiver>addsotrydnikform</receiver> |
+ <slot>close()</slot> |
+ <hints> |
+ <hint type="sourcelabel"> |
+ <x>140</x> |
+ <y>75</y> |
+ </hint> |
+ <hint type="destinationlabel"> |
+ <x>140</x> |
+ <y>56</y> |
+ </hint> |
+ </hints> |
+ </connection> |
+ </connections> |
+</ui> |
/trunk/source_code/ui/addsotrydnikform.ui |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/ui/form.ui |
=================================================================== |
--- trunk/source_code/ui/form.ui (revision 0) |
+++ trunk/source_code/ui/form.ui (revision 257) |
@@ -0,0 +1,144 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>Form</class> |
+ <widget class="QWidget" name="Form"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>979</width> |
+ <height>547</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Form</string> |
+ </property> |
+ <widget class="QTextEdit" name="textEdit"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>20</y> |
+ <width>961</width> |
+ <height>441</height> |
+ </rect> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="wmiButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>470</y> |
+ <width>130</width> |
+ <height>31</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>WMI запрос</string> |
+ </property> |
+ </widget> |
+ <widget class="QLineEdit" name="lineEdit"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>500</y> |
+ <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/> |
+</ui> |
Index: trunk/source_code/ui/addotdelform.ui |
=================================================================== |
--- trunk/source_code/ui/addotdelform.ui (revision 0) |
+++ trunk/source_code/ui/addotdelform.ui (revision 257) |
@@ -0,0 +1,108 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>addotdelform</class> |
+ <widget class="QDialog" name="addotdelform"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>303</width> |
+ <height>162</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Создание нового отдела</string> |
+ </property> |
+ <widget class="QWidget" name="verticalLayoutWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>284</width> |
+ <height>141</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout"> |
+ <item> |
+ <widget class="QLabel" name="label"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>12</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Введите название нового отдела</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_2"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>12</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Введите описание отдела</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_2"/> |
+ </item> |
+ <item> |
+ <widget class="QDialogButtonBox" name="buttonBox"> |
+ <property name="standardButtons"> |
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <resources/> |
+ <connections> |
+ <connection> |
+ <sender>buttonBox</sender> |
+ <signal>rejected()</signal> |
+ <receiver>addotdelform</receiver> |
+ <slot>close()</slot> |
+ <hints> |
+ <hint type="sourcelabel"> |
+ <x>151</x> |
+ <y>75</y> |
+ </hint> |
+ <hint type="destinationlabel"> |
+ <x>151</x> |
+ <y>55</y> |
+ </hint> |
+ </hints> |
+ </connection> |
+ </connections> |
+</ui> |
/trunk/source_code/ui/addotdelform.ui |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/ui/addmemoryform.ui |
=================================================================== |
--- trunk/source_code/ui/addmemoryform.ui (revision 0) |
+++ trunk/source_code/ui/addmemoryform.ui (revision 257) |
@@ -0,0 +1,1910 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>addmemoryForm</class> |
+ <widget class="QWidget" name="addmemoryForm"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>890</width> |
+ <height>567</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Добавить блок памяти</string> |
+ </property> |
+ <widget class="QTabWidget" name="tabWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>20</x> |
+ <y>10</y> |
+ <width>831</width> |
+ <height>291</height> |
+ </rect> |
+ </property> |
+ <property name="tabPosition"> |
+ <enum>QTabWidget::North</enum> |
+ </property> |
+ <property name="currentIndex"> |
+ <number>5</number> |
+ </property> |
+ <widget class="QWidget" name="tab"> |
+ <attribute name="title"> |
+ <string>Память</string> |
+ </attribute> |
+ <widget class="QFrame" name="frame"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>360</x> |
+ <y>10</y> |
+ <width>301</width> |
+ <height>80</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QDateEdit" name="dateEdit"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>110</width> |
+ <height>25</height> |
+ </rect> |
+ </property> |
+ </widget> |
+ </widget> |
+ <widget class="QFrame" name="frame_2"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>341</width> |
+ <height>231</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QWidget" name="verticalLayout_5"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>160</y> |
+ <width>281</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_6"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Системный блок</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_4"> |
+ <property name="modelColumn"> |
+ <number>0</number> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>20</y> |
+ <width>123</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Производитель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="layoutWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>140</x> |
+ <y>20</y> |
+ <width>89</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_4"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Тип памяти</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_3"> |
+ <item> |
+ <property name="text"> |
+ <string>DDRII</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>DDR</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>DIMM</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>SIMM</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>RIMM</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_2"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>240</x> |
+ <y>20</y> |
+ <width>85</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <property name="topMargin"> |
+ <number>0</number> |
+ </property> |
+ <item> |
+ <widget class="QLabel" name="label_5"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Объём, Mb</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_2"> |
+ <item> |
+ <property name="text"> |
+ <string>2048</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>1024</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>512</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>256</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>128</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>64</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>32</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>16</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>8</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>4</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_2"> |
+ <attribute name="title"> |
+ <string>Винчестеры</string> |
+ </attribute> |
+ <widget class="QFrame" name="frame_5"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>561</width> |
+ <height>241</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QWidget" name="verticalLayout_13"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>123</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_17"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Производитель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_13"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_14"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>140</x> |
+ <y>10</y> |
+ <width>101</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_18"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Интерфейс</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_14"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>IDE</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>SATA</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_15"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>250</x> |
+ <y>10</y> |
+ <width>111</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_19"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Объем (Гб)</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_15"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>20</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>40</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>60</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>80</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>120</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>160</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_3"> |
+ <attribute name="title"> |
+ <string>Процессоры</string> |
+ </attribute> |
+ <widget class="QFrame" name="frame_4"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>531</width> |
+ <height>231</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QWidget" name="verticalLayout_9"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>123</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_13"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Производитель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_9"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_10"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>220</x> |
+ <y>10</y> |
+ <width>115</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_14"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Частота (МГц)</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_10"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>1500</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>2000</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_11"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>340</x> |
+ <y>10</y> |
+ <width>96</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_15"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Слот</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_11"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>SocketA</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>s976</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_12"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>140</x> |
+ <y>10</y> |
+ <width>100</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_16"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Модель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_12"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_4"> |
+ <attribute name="title"> |
+ <string>Материнки</string> |
+ </attribute> |
+ <widget class="QFrame" name="frame_3"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>611</width> |
+ <height>231</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QWidget" name="verticalLayout_3"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>20</x> |
+ <y>20</y> |
+ <width>123</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_9"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Производитель</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_5"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_6"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>140</x> |
+ <y>20</y> |
+ <width>111</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_10"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Модель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_6"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_7"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>260</x> |
+ <y>20</y> |
+ <width>111</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_11"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Слот</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_7"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>Socet A</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>Socrt 749</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_8"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>380</x> |
+ <y>20</y> |
+ <width>114</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_12"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Частота шины</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_8"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>66</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>100</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>133</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>333</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>400</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_6"> |
+ <attribute name="title"> |
+ <string>CD/DVD приводы</string> |
+ </attribute> |
+ <widget class="QFrame" name="frame_6"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>441</width> |
+ <height>211</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QWidget" name="verticalLayout_16"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>100</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_20"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Тип</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_16"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>CD</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>CD-R</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>CD-RW</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>DVD</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>DVD-R</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>DVD-RW</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_17"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>110</x> |
+ <y>10</y> |
+ <width>131</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_21"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Производитель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_17"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_18"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>250</x> |
+ <y>10</y> |
+ <width>100</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_22"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Скорость</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_18"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_7"> |
+ <attribute name="title"> |
+ <string>Видеокарты</string> |
+ </attribute> |
+ <widget class="QFrame" name="frame_7"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>611</width> |
+ <height>201</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QWidget" name="verticalLayoutWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>131</width> |
+ <height>80</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_19"> |
+ <item> |
+ <widget class="QLabel" name="label_23"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Производитель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_19"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayoutWidget_2"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>140</x> |
+ <y>10</y> |
+ <width>100</width> |
+ <height>80</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_20"> |
+ <item> |
+ <widget class="QLabel" name="label_24"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Модель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_20"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_2"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayoutWidget_3"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>240</x> |
+ <y>10</y> |
+ <width>101</width> |
+ <height>80</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_21"> |
+ <item> |
+ <widget class="QLabel" name="label_25"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Интерфейс</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_21"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_3"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayoutWidget_4"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>340</x> |
+ <y>10</y> |
+ <width>100</width> |
+ <height>80</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_22"> |
+ <item> |
+ <widget class="QLabel" name="label_26"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Память</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_22"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_4"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_8"> |
+ <attribute name="title"> |
+ <string>Звуковые карты</string> |
+ </attribute> |
+ <widget class="QFrame" name="frame_8"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>591</width> |
+ <height>191</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QWidget" name="verticalLayoutWidget_5"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>131</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_23"> |
+ <item> |
+ <widget class="QLabel" name="label_27"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Производитель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_23"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_5"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayoutWidget_6"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>160</x> |
+ <y>10</y> |
+ <width>131</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_24"> |
+ <item> |
+ <widget class="QLabel" name="label_28"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Модель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_24"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_6"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_9"> |
+ <attribute name="title"> |
+ <string>Сетевые карты</string> |
+ </attribute> |
+ <widget class="QFrame" name="frame_9"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>501</width> |
+ <height>131</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <widget class="QWidget" name="verticalLayoutWidget_7"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>131</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_25"> |
+ <item> |
+ <widget class="QLabel" name="label_29"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Производитель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_25"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_7"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayoutWidget_8"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>150</x> |
+ <y>10</y> |
+ <width>131</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_26"> |
+ <item> |
+ <widget class="QLabel" name="label_30"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Модель</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_26"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_8"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayoutWidget_9"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>290</x> |
+ <y>10</y> |
+ <width>203</width> |
+ <height>61</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_27"> |
+ <item> |
+ <widget class="QLabel" name="label_31"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Скорость передачи (Mbit)</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QComboBox" name="comboBox_27"> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <property name="currentIndex"> |
+ <number>1</number> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>10</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>100</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>1000</string> |
+ </property> |
+ </item> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_9"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <widget class="QWidget" name="tab_5"> |
+ <attribute name="title"> |
+ <string>Сотрудники</string> |
+ </attribute> |
+ </widget> |
+ </widget> |
+ <widget class="QTreeWidget" name="treeWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>447</y> |
+ <width>641</width> |
+ <height>94</height> |
+ </rect> |
+ </property> |
+ <column> |
+ <property name="text"> |
+ <string>Отдел</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Сотрудник</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Инвентарный номер</string> |
+ </property> |
+ </column> |
+ </widget> |
+ <widget class="QLabel" name="label_7"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>20</x> |
+ <y>340</y> |
+ <width>191</width> |
+ <height>20</height> |
+ </rect> |
+ </property> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Системный блок не выбран</string> |
+ </property> |
+ </widget> |
+ <widget class="QLabel" name="label_8"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>20</x> |
+ <y>320</y> |
+ <width>301</width> |
+ <height>18</height> |
+ </rect> |
+ </property> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Инвентарный номер системного блока:</string> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="enabled"> |
+ <bool>false</bool> |
+ </property> |
+ <property name="geometry"> |
+ <rect> |
+ <x>20</x> |
+ <y>370</y> |
+ <width>281</width> |
+ <height>25</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>Добавить</string> |
+ </property> |
+ </widget> |
+ <widget class="QWidget" name="verticalLayout_4"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>340</x> |
+ <y>320</y> |
+ <width>301</width> |
+ <height>118</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_3"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Инвентарный номер компонента</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_2"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Серийный номер компонента</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_2"/> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <resources/> |
+ <connections/> |
+</ui> |
Index: trunk/source_code/ui/addsysblockform.ui |
=================================================================== |
--- trunk/source_code/ui/addsysblockform.ui (revision 0) |
+++ trunk/source_code/ui/addsysblockform.ui (revision 257) |
@@ -0,0 +1,232 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>addsysblockform</class> |
+ <widget class="QDialog" name="addsysblockform"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>360</width> |
+ <height>227</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Добовление системного блока на склад</string> |
+ </property> |
+ <widget class="QLabel" name="label"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>321</width> |
+ <height>31</height> |
+ </rect> |
+ </property> |
+ <property name="font"> |
+ <font> |
+ <pointsize>12</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Введите данные системного блока</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ <widget class="QDialogButtonBox" name="buttonBox"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>20</x> |
+ <y>190</y> |
+ <width>321</width> |
+ <height>32</height> |
+ </rect> |
+ </property> |
+ <property name="standardButtons"> |
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
+ </property> |
+ </widget> |
+ <widget class="QFrame" name="frame"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>20</x> |
+ <y>40</y> |
+ <width>321</width> |
+ <height>141</height> |
+ </rect> |
+ </property> |
+ <property name="frameShape"> |
+ <enum>QFrame::StyledPanel</enum> |
+ </property> |
+ <property name="frameShadow"> |
+ <enum>QFrame::Raised</enum> |
+ </property> |
+ <property name="lineWidth"> |
+ <number>1</number> |
+ </property> |
+ <property name="midLineWidth"> |
+ <number>0</number> |
+ </property> |
+ <widget class="QWidget" name="horizontalLayoutWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>301</width> |
+ <height>121</height> |
+ </rect> |
+ </property> |
+ <layout class="QHBoxLayout" name="horizontalLayout"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout"> |
+ <item> |
+ <widget class="QLabel" name="label_2"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>12</pointsize> |
+ <weight>50</weight> |
+ <bold>false</bold> |
+ <kerning>false</kerning> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Серийный номер</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_3"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>12</pointsize> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Инвентарный номер</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_2"/> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <spacer name="horizontalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Horizontal</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>40</width> |
+ <height>20</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_2"> |
+ <item> |
+ <widget class="QLabel" name="label_4"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>12</pointsize> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Дата покупки</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QDateEdit" name="dateEdit"> |
+ <property name="displayFormat"> |
+ <string>dd.MM.yyyy</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_5"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>12</pointsize> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Срок гарантии</string> |
+ </property> |
+ <property name="alignment"> |
+ <set>Qt::AlignCenter</set> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QSpinBox" name="spinBox"/> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_2"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ </widget> |
+ <resources/> |
+ <connections> |
+ <connection> |
+ <sender>buttonBox</sender> |
+ <signal>rejected()</signal> |
+ <receiver>addsysblockform</receiver> |
+ <slot>close()</slot> |
+ <hints> |
+ <hint type="sourcelabel"> |
+ <x>199</x> |
+ <y>274</y> |
+ </hint> |
+ <hint type="destinationlabel"> |
+ <x>199</x> |
+ <y>149</y> |
+ </hint> |
+ </hints> |
+ </connection> |
+ </connections> |
+</ui> |
/trunk/source_code/ui/addsysblockform.ui |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/ui/newfile.ui |
=================================================================== |
--- trunk/source_code/ui/newfile.ui (revision 0) |
+++ trunk/source_code/ui/newfile.ui (revision 257) |
@@ -0,0 +1,34 @@ |
+<ui version="4.0" > |
+ <author></author> |
+ <comment></comment> |
+ <exportmacro></exportmacro> |
+ <class>MainWindow</class> |
+ <widget class="QMainWindow" name="MainWindow" > |
+ <property name="geometry" > |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>598</width> |
+ <height>388</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle" > |
+ <string>MainWindow</string> |
+ </property> |
+ <widget class="QWidget" name="centralwidget" /> |
+ <widget class="QMenuBar" name="menubar" > |
+ <property name="geometry" > |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>598</width> |
+ <height>28</height> |
+ </rect> |
+ </property> |
+ </widget> |
+ <widget class="QStatusBar" name="statusbar" /> |
+ </widget> |
+ <pixmapfunction></pixmapfunction> |
+ <resources/> |
+ <connections/> |
+</ui> |
Index: trunk/source_code/ui/raportform.ui |
=================================================================== |
--- trunk/source_code/ui/raportform.ui (revision 0) |
+++ trunk/source_code/ui/raportform.ui (revision 257) |
@@ -0,0 +1,73 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>raportWindow</class> |
+ <widget class="QMainWindow" name="raportWindow"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>982</width> |
+ <height>407</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Рапорт</string> |
+ </property> |
+ <widget class="QWidget" name="centralwidget"> |
+ <widget class="QTextEdit" name="textEdit"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>851</width> |
+ <height>331</height> |
+ </rect> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>870</x> |
+ <y>0</y> |
+ <width>111</width> |
+ <height>31</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>Рапорт</string> |
+ </property> |
+ </widget> |
+ </widget> |
+ <widget class="QMenuBar" name="menubar"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>982</width> |
+ <height>28</height> |
+ </rect> |
+ </property> |
+ <widget class="QMenu" name="menu"> |
+ <property name="title"> |
+ <string>Файл</string> |
+ </property> |
+ <addaction name="printAction"/> |
+ <addaction name="printPdfAction"/> |
+ </widget> |
+ <addaction name="menu"/> |
+ </widget> |
+ <widget class="QStatusBar" name="statusbar"/> |
+ <action name="printAction"> |
+ <property name="text"> |
+ <string>Печатать</string> |
+ </property> |
+ </action> |
+ <action name="printPdfAction"> |
+ <property name="text"> |
+ <string>Печатать в PDF</string> |
+ </property> |
+ </action> |
+ </widget> |
+ <resources/> |
+ <connections/> |
+</ui> |
Index: trunk/source_code/ui/mainwindow.ui |
=================================================================== |
--- trunk/source_code/ui/mainwindow.ui (revision 0) |
+++ trunk/source_code/ui/mainwindow.ui (revision 257) |
@@ -0,0 +1,390 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>MainWindow</class> |
+ <widget class="QMainWindow" name="MainWindow"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>1250</width> |
+ <height>703</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>MainWindow</string> |
+ </property> |
+ <widget class="QWidget" name="centralwidget"> |
+ <widget class="QLineEdit" name="lineEdit"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>620</y> |
+ <width>113</width> |
+ <height>25</height> |
+ </rect> |
+ </property> |
+ </widget> |
+ <widget class="QLineEdit" name="lineEdit_2"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>530</y> |
+ <width>113</width> |
+ <height>21</height> |
+ </rect> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="FiltrButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>130</x> |
+ <y>530</y> |
+ <width>131</width> |
+ <height>25</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>Применить фильтр</string> |
+ </property> |
+ </widget> |
+ <widget class="QComboBox" name="comboBox"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>140</x> |
+ <y>590</y> |
+ <width>121</width> |
+ <height>22</height> |
+ </rect> |
+ </property> |
+ <property name="editable"> |
+ <bool>true</bool> |
+ </property> |
+ <item> |
+ <property name="text"> |
+ <string>Михайленко</string> |
+ </property> |
+ </item> |
+ <item> |
+ <property name="text"> |
+ <string>Марченко</string> |
+ </property> |
+ </item> |
+ </widget> |
+ <widget class="QPushButton" name="hiddenButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>560</y> |
+ <width>121</width> |
+ <height>25</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>Скрыть строки</string> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="showButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>150</x> |
+ <y>560</y> |
+ <width>111</width> |
+ <height>25</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>Показывать всё</string> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="appyButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>590</y> |
+ <width>121</width> |
+ <height>25</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>Применить</string> |
+ </property> |
+ </widget> |
+ <widget class="QTableView" name="tableView"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>270</x> |
+ <y>530</y> |
+ <width>431</width> |
+ <height>111</height> |
+ </rect> |
+ </property> |
+ </widget> |
+ <widget class="QTreeWidget" name="treeWidget"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>0</y> |
+ <width>1231</width> |
+ <height>521</height> |
+ </rect> |
+ </property> |
+ <property name="font"> |
+ <font> |
+ <pointsize>9</pointsize> |
+ </font> |
+ </property> |
+ <property name="alternatingRowColors"> |
+ <bool>true</bool> |
+ </property> |
+ <property name="iconSize"> |
+ <size> |
+ <width>128</width> |
+ <height>128</height> |
+ </size> |
+ </property> |
+ <property name="animated"> |
+ <bool>false</bool> |
+ </property> |
+ <property name="columnCount"> |
+ <number>12</number> |
+ </property> |
+ <attribute name="headerDefaultSectionSize"> |
+ <number>100</number> |
+ </attribute> |
+ <attribute name="headerDefaultSectionSize"> |
+ <number>100</number> |
+ </attribute> |
+ <column> |
+ <property name="text"> |
+ <string>Отделы</string> |
+ </property> |
+ <property name="font"> |
+ <font> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="background"> |
+ <color> |
+ <red>170</red> |
+ <green>170</green> |
+ <blue>255</blue> |
+ </color> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Сотрудники</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>ID</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Оборудование</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Процессор</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Материнка</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Память</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Винчестер</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Привод</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Видеокарта</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Звуковая карта</string> |
+ </property> |
+ </column> |
+ <column> |
+ <property name="text"> |
+ <string>Сетевая карта</string> |
+ </property> |
+ </column> |
+ </widget> |
+ <widget class="QPushButton" name="createButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>140</x> |
+ <y>620</y> |
+ <width>121</width> |
+ <height>23</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>Создать базу</string> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="exportButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>710</x> |
+ <y>530</y> |
+ <width>221</width> |
+ <height>31</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>Экспортировать в Calc</string> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="wmiButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>710</x> |
+ <y>570</y> |
+ <width>221</width> |
+ <height>31</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string>WMI Запрос</string> |
+ </property> |
+ </widget> |
+ </widget> |
+ <widget class="QMenuBar" name="menubar"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>1250</width> |
+ <height>25</height> |
+ </rect> |
+ </property> |
+ <widget class="QMenu" name="menu"> |
+ <property name="title"> |
+ <string>База</string> |
+ </property> |
+ <widget class="QMenu" name="menu_3"> |
+ <property name="title"> |
+ <string>Комплектующие</string> |
+ </property> |
+ <addaction name="openMemoryTableAct"/> |
+ <addaction name="action_6"/> |
+ <addaction name="action_7"/> |
+ <addaction name="action_8"/> |
+ </widget> |
+ <widget class="QMenu" name="menu_4"> |
+ <property name="title"> |
+ <string>Периферия</string> |
+ </property> |
+ <addaction name="action_12"/> |
+ <addaction name="action_13"/> |
+ <addaction name="action_14"/> |
+ </widget> |
+ <addaction name="getsettingAct"/> |
+ <addaction name="openBaseAct"/> |
+ <addaction name="separator"/> |
+ <addaction name="menu_3"/> |
+ <addaction name="separator"/> |
+ <addaction name="menu_4"/> |
+ <addaction name="separator"/> |
+ </widget> |
+ <widget class="QMenu" name="menu_2"> |
+ <property name="title"> |
+ <string>Таблица</string> |
+ </property> |
+ <addaction name="addStringAct"/> |
+ <addaction name="addColomAct"/> |
+ <addaction name="separator"/> |
+ <addaction name="delStringAct"/> |
+ </widget> |
+ <addaction name="menu"/> |
+ <addaction name="menu_2"/> |
+ </widget> |
+ <widget class="QStatusBar" name="statusbar"/> |
+ <action name="getsettingAct"> |
+ <property name="text"> |
+ <string>Параметры соединения</string> |
+ </property> |
+ </action> |
+ <action name="openBaseAct"> |
+ <property name="text"> |
+ <string>Открыть</string> |
+ </property> |
+ </action> |
+ <action name="addStringAct"> |
+ <property name="text"> |
+ <string>Добавить строку</string> |
+ </property> |
+ </action> |
+ <action name="addColomAct"> |
+ <property name="text"> |
+ <string>Добавить столбец</string> |
+ </property> |
+ </action> |
+ <action name="delStringAct"> |
+ <property name="text"> |
+ <string>Удалить строку</string> |
+ </property> |
+ </action> |
+ <action name="action_3"> |
+ <property name="text"> |
+ <string>Память</string> |
+ </property> |
+ </action> |
+ <action name="openMemoryTableAct"> |
+ <property name="text"> |
+ <string>Модули памяти</string> |
+ </property> |
+ </action> |
+ <action name="action_6"> |
+ <property name="text"> |
+ <string>Материнские платы</string> |
+ </property> |
+ </action> |
+ <action name="action_7"> |
+ <property name="text"> |
+ <string>Процессоры</string> |
+ </property> |
+ </action> |
+ <action name="action_8"> |
+ <property name="text"> |
+ <string>Жесткие диски</string> |
+ </property> |
+ </action> |
+ <action name="action_12"> |
+ <property name="text"> |
+ <string>Принтеры</string> |
+ </property> |
+ </action> |
+ <action name="action_13"> |
+ <property name="text"> |
+ <string>Сканеры</string> |
+ </property> |
+ </action> |
+ <action name="action_14"> |
+ <property name="text"> |
+ <string>МФУ</string> |
+ </property> |
+ </action> |
+ </widget> |
+ <resources/> |
+ <connections/> |
+</ui> |
/trunk/source_code/ui/mainwindow.ui |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/baza3.pro |
=================================================================== |
--- trunk/source_code/baza3.pro (revision 0) |
+++ trunk/source_code/baza3.pro (revision 257) |
@@ -0,0 +1,42 @@ |
+TEMPLATE = app |
+QT = gui \ |
+ core \ |
+ sql \ |
+ network \ |
+ qt3support |
+CONFIG += qt \ |
+ debug \ |
+ warn_on \ |
+ console \ |
+ exceptions |
+DESTDIR = bin |
+OBJECTS_DIR = build |
+MOC_DIR = build |
+UI_DIR = build |
+FORMS = ui/mainwindow.ui \ |
+ ui/settingform.ui \ |
+ ui/addmemoryform.ui \ |
+ ui/addotdelform.ui \ |
+ ui/addsysblockform.ui \ |
+ ui/addsotrydnikform.ui \ |
+ ui/raportform.ui \ |
+ ui/form.ui |
+HEADERS = src/mainwindowimpl.h \ |
+ src/settingform.h \ |
+ src/addmemoryform.h \ |
+ src/addotdelform.h \ |
+ src/addsotrydnikform.h \ |
+ src/addsysblockform.h \ |
+ src/raportform.h \ |
+ src/form.h |
+SOURCES = src/mainwindowimpl.cpp \ |
+ src/main.cpp \ |
+ src/settingform.cpp \ |
+ src/addmemoryform.cpp \ |
+ src/slots.cpp \ |
+ src/actions.cpp \ |
+ src/addotdelform.cpp \ |
+ src/addsotrydnikform.cpp \ |
+ src/addsysblockform.cpp \ |
+ src/raportform.cpp \ |
+ src/form.cpp |
/trunk/source_code/baza3.pro |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/addsotrydnikform.cpp |
=================================================================== |
--- trunk/source_code/src/addsotrydnikform.cpp (revision 0) |
+++ trunk/source_code/src/addsotrydnikform.cpp (revision 257) |
@@ -0,0 +1,61 @@ |
+#include "addsotrydnikform.h" |
+#include "mainwindowimpl.h" |
+// place your code here |
+ |
+addsotrydnikForm::addsotrydnikForm() |
+ : QDialog() |
+{ |
+// QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+ setupUi(this); |
+// proizv_list = getManufacturiesList(); |
+// comboBox->addItems(proizv_list); |
+ // TODO |
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(addNewSotrydnikSlot())); |
+ |
+} |
+ |
+ |
+ |
+void addsotrydnikForm::closeEvent ( QCloseEvent * event ) { |
+ emit formClose(); |
+} |
+ |
+void addsotrydnikForm::addNewSotrydnikSlot(){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_fio, field_identifikator, field_identifikator_otdela; |
+ QString id, fio, id_otdela; |
+ bool ok; |
+ if (lineEdit->text()==""){ |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà äîáîâëåíèÿ ñîòðóäíèêà"), // Çàãîëîâîê. |
+ tr("Âû íå ââåëè ÔÈÎ ñîòðóäíèêà!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ |
+ sqltext = tr("select * from sotrydniki where sotrydniki.ÔÈÎ = \""); |
+ sqltext.append(lineEdit->text()); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ ok = q.exec(); |
+ field_fio = q.record().indexOf(tr("ÔÈÎ")); |
+ if (q.next()) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà äîáîâëåíèÿ ñîòðóäíèêà"), // Çàãîëîâîê. |
+ tr("Ñîòðóäíèê ñ òàêèì ÔÈÎ ñóùåñòâóåò!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ else { |
+ q.clear(); |
+ q.prepare(tr("insert into sotrydniki (ÔÈÎ, Èäåíòèôèêàòîð_îòäåëà) " |
+ "values (:fio, :id_otd)")); |
+ q.bindValue(tr(":fio"), lineEdit->text()); |
+ q.bindValue(tr(":id_otd"), IdOtdela); |
+ ok = q.exec(); |
+ emit componentAdd(); |
+ close();} |
+ |
+} |
\ No newline at end of file |
/trunk/source_code/src/addsotrydnikform.cpp |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/main.cpp |
=================================================================== |
--- trunk/source_code/src/main.cpp (revision 0) |
+++ trunk/source_code/src/main.cpp (revision 257) |
@@ -0,0 +1,21 @@ |
+#include <QApplication> |
+#include <QtGui> |
+#include "mainwindowimpl.h" |
+// |
+int main(int argc, char ** argv) |
+{ |
+ |
+ QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
+ QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
+ QTextCodec::setCodecForTr(codec); |
+// QTextCodec::setCodecForCStrings(codec); |
+// QTextCodec::setCodecForLocale(codec); |
+ QApplication app( argc, argv ); |
+ MainWindowImpl win; |
+ win.show(); |
+ app.addLibraryPath("/usr/lib64/qt4/plugins/sqldrivers"); |
+ app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) ); |
+ return app.exec(); |
+ |
+} |
+ |
/trunk/source_code/src/main.cpp |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/addsysblockform.cpp |
=================================================================== |
--- trunk/source_code/src/addsysblockform.cpp (revision 0) |
+++ trunk/source_code/src/addsysblockform.cpp (revision 257) |
@@ -0,0 +1,67 @@ |
+#include "addsysblockform.h" |
+#include "mainwindowimpl.h" |
+// place your code here |
+ |
+ |
+addsysblockForm::addsysblockForm() |
+ : QDialog(){ |
+ setupUi(this); |
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(addNewSysBlockSlot())); |
+ } |
+ |
+void addsysblockForm::closeEvent ( QCloseEvent * event ) { |
+ emit formClose(); |
+} |
+ |
+void addsysblockForm::addNewSysBlockSlot(){ |
+ int i; |
+ i++; |
+ //test cvs |
+ QDate data_p; |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_fio, field_identifikator, field_inventar_num; |
+ QString serial_num, inventar_num, data_str, garant_str, id, fio, id_otdela; |
+ bool ok; |
+ if (lineEdit_2->text()==""){ |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà äîáîâëåíèÿ ñèñòåìíîãî áëîêà íà ñêëàä"), // Çàãîëîâîê. |
+ tr("Âû íå ââåëè èíâåíòàðíûé íîìåð ñèñòåìíîãî áëîêà!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ |
+ sqltext = tr("select * from system_blocks where system_blocks.Èíâåíòàðíûé_íîìåð = \""); |
+ sqltext.append(lineEdit_2->text()); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ ok = q.exec(); |
+ field_inventar_num = q.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+if (q.next()) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà äîáîâëåíèÿ ñèñòåìíîãî áëîêà íà ñêëàä!"), // Çàãîëîâîê. |
+ tr("Ñèñòåìíûé áëîê ñ òàêèì èíâåíòàðíûì íîìåðîì óæå åñòü â áàçå äàííûõ!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ else { |
+ q.clear(); |
+ data_p = dateEdit->date(); |
+ data_str = data_p.toString(tr("yyyy-MM-dd")); |
+ garant_str = QVariant(spinBox->value()).toString(); |
+ q.prepare(tr("insert into system_blocks (Ñåðèéíûé_íîìåð, Èíâåíòàðíûé_íîìåð, Äàòà_ïîêóïêè, Ñðîê_ãàðàíòèè, Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà) " |
+ "values (:ser_num, :inv_num, :date, :garant, :id_otv_lica)")); |
+ q.bindValue(tr(":ser_num"), lineEdit->text()); |
+ q.bindValue(tr(":inv_num"), lineEdit_2->text()); |
+ q.bindValue(tr(":date"), data_str); |
+ q.bindValue(tr(":garant"), garant_str); |
+ q.bindValue(tr(":id_otv_lica"), tr("1")); |
+ ok = q.exec(); |
+ emit componentAdd(); |
+ close(); |
+ } |
+ |
+ |
+} |
+ |
/trunk/source_code/src/addsysblockform.cpp |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/addsotrydnikform.h |
=================================================================== |
--- trunk/source_code/src/addsotrydnikform.h (revision 0) |
+++ trunk/source_code/src/addsotrydnikform.h (revision 257) |
@@ -0,0 +1,34 @@ |
+#ifndef __ADDSOTRYDNIKFORM_H__ |
+#define __ADDSOTRYDNIKFORM_H__ |
+ |
+// place your code here |
+#include <QDialog> |
+#include <QtGui> |
+#include <QtSql> |
+#include "ui_addsotrydnikform.h" |
+ |
+class addsotrydnikForm : public QDialog, public Ui::addsotrydnikform |
+{ |
+Q_OBJECT |
+ public: |
+ addsotrydnikForm(); |
+ QString IdOtdela; |
+ |
+ |
+signals: |
+ void formClose(); |
+ void componentAdd(); |
+ |
+private slots: |
+ void addNewSotrydnikSlot(); |
+ |
+private: |
+ |
+protected: |
+ void closeEvent( QCloseEvent * event ); |
+ |
+ |
+}; |
+ |
+ |
+#endif // __ADDSOTRYDNIKFORM_H__ |
/trunk/source_code/src/addsotrydnikform.h |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/raportform.cpp |
=================================================================== |
--- trunk/source_code/src/raportform.cpp (revision 0) |
+++ trunk/source_code/src/raportform.cpp (revision 257) |
@@ -0,0 +1,1134 @@ |
+#include "raportform.h" |
+///#include "mainwindowimpl.h" |
+ |
+#define ENTER cursor->insertBlock(); |
+// place your code here |
+/////raportForm::raportForm( QWidget * parent, Qt::WFlags f) |
+///// : QMainWindow(parent, f) |
+raportForm::raportForm() |
+///// : QMainWindow(parent, f) |
+ : QMainWindow() |
+ { |
+ setupUi(this); |
+ connect(printAction, SIGNAL(triggered()), this, SLOT(on_print_raport())); |
+ connect(printPdfAction, SIGNAL(triggered()), this, SLOT(on_print_raport_to_pdf())); |
+ |
+ |
+ |
+ } |
+ |
+ |
+ |
+raportForm::~raportForm() |
+{ |
+ |
+} |
+ |
+void raportForm::create_raport() |
+{ |
+ |
+// raportForm::textEdit.setText('1'); |
+// textEdit.setText("hello!"); |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+void raportForm::on_pushButton_clicked() |
+{ |
+/* |
+ textEdit->setText(tr("Ñèáãèïðîñåëüõîçìàø")); |
+ document = textEdit->document(); |
+ cursor = new QTextCursor(document); |
+ cursor->movePosition(QTextCursor::Start); |
+ QTextCharFormat format(cursor->charFormat()); |
+ //format.setFontFamily("Courier"); |
+ format.setFontFamily("Arial"); |
+ //format.setFontItalic(false); |
+ |
+ format.setFontWeight(QFont::Normal); |
+ QTextCharFormat boldFormat = format; |
+ boldFormat.setFontWeight(QFont::Bold); |
+ //boldFormat.setFontItalic(true); |
+//// cursor->insertText(tr("Ì1"), boldFormat); |
+//// cursor->insertBlock(); |
+//// cursor->insertText(tr("Þøêîâ"), format); |
+ ENTER |
+ |
+int fieldName, fieldID; |
+// QTreeWidgetItem *otdelItem; |
+ bool ok; |
+ //ok= pdb->isOpen(); |
+ QSqlQuery q; |
+ ok = q.prepare(tr("select * from otdeli"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id, user_name; |
+ ok = q.exec(); |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ otdel_id = q.value(fieldID).toString(); |
+ cursor->insertText(otdel, format); |
+ ENTER |
+ |
+// otdelItem = new QTreeWidgetItem(addmemoryForm::treeWidget); |
+// otdelItem->setText(0, otdel); |
+// addmemoryForm::SotrydnikiOtdela(otdel_id, otdelItem); |
+ } |
+// print_raport(); |
+// print_raport_to_pdf(); |
+ QList<TOtdel> otdel_list_local; |
+ |
+ otdel_list_local = get_otdel_list(); |
+ QString otdel_name; |
+ |
+ for (int i = 0; i < otdel_list_local.size(); ++i) { |
+ otdel_name = otdel_list_local.at(i).name; |
+ cursor->insertText(otdel_name, format); |
+ ENTER |
+ otdel_id = otdel_list_local.at(i).ID; |
+ cursor->insertText(otdel_id, format); |
+ ENTER |
+ } |
+*/ |
+ bild_raport(); |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+void raportForm::print_raport() |
+{ |
+ QTextDocument *document = textEdit->document(); |
+ QPrinter printer; |
+ |
+ QPrintDialog *dlg = new QPrintDialog(&printer, this); |
+ if (dlg->exec() != QDialog::Accepted) |
+ return; |
+ |
+ document->print(&printer); |
+} |
+ |
+void raportForm::print_raport_to_pdf() |
+{ |
+ |
+ QString fileName = QFileDialog::getSaveFileName(this, "Export PDF", |
+ QString(), "*.pdf"); |
+ if (!fileName.isEmpty()) { |
+ if (QFileInfo(fileName).suffix().isEmpty()) |
+ fileName.append(".pdf"); |
+ QPrinter printer(QPrinter::HighResolution); |
+ printer.setOutputFormat(QPrinter::PdfFormat); |
+ printer.setOutputFileName(fileName); |
+ textEdit->document()->print(&printer); |
+ } |
+} |
+ |
+ |
+/* |
+QStringList raportForm::get_otgel_list() |
+{ |
+ |
+ struct otdel otdel_tmp; |
+ int fieldName, fieldID; |
+ QString int_otdel_id; |
+ QStringList tmp; |
+// QTreeWidgetItem *otdelItem; |
+ QSqlQuery q(tr("select * from Îòäåëû"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id; |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ otdel_list.clear(); //î÷èùàåì ñïèñîê |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ tmp.append(otdel); |
+ int_otdel_id = q.value(fieldID).toString(); |
+ otdel_tmp.name = otdel; |
+ otdel_tmp.ID = int_otdel_id; |
+ otdel_list.append(otdel_tmp); |
+// otdel_id = q.value(fieldID).toString(); |
+// otdelItem = new QTreeWidgetItem(addmemoryForm::treeWidget); |
+// otdelItem->setText(0, otdel); |
+// addmemoryForm::SotrydnikiOtdela(otdel_id, otdelItem); |
+ |
+ } |
+ return tmp; |
+} |
+*/ |
+ |
+ |
+TSibgipro raportForm::get_sibgipro(){ |
+// TOtdel otdel_tmp; |
+ TSibgipro sibgipro_tmp; |
+// int fieldName, fieldID; |
+// QVariant int_otdel_id; |
+// QStringList tmp; |
+// bool ok; |
+ //ok= pdb->isOpen(); |
+// QSqlQuery q; |
+// ok = q.prepare(tr("select * from Îòäåëû"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+// QString otdel, otdel_id; |
+// ok = q.exec(); |
+// if (!ok) { |
+// QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+// this, // Ðîäèòåëüñêèé âèäæåò. |
+// QObject::tr("Database Error"), // Çàãîëîâîê. |
+// pdb->lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+// } |
+// fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+// fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+// while (q.next()){ |
+// otdel = q.value(fieldName).toString(); |
+// otdel_id = q.value(fieldID).toString(); |
+// int_otdel_id = q.value(fieldID); |
+// otdel_tmp.name = otdel; |
+// otdel_tmp.ID = int_otdel_id; |
+// sibgipro_tmp.otdel_list.append(otdel_tmp); |
+// } |
+ sibgipro_tmp.otdel_list = get_otdel_list(); |
+ return sibgipro_tmp; |
+} |
+ |
+QList<TOtdel> raportForm::get_otdel_list(){ |
+ TOtdel otdel_tmp; |
+ QList<TOtdel> otdel_list_rtrn; |
+ int fieldName, fieldID; |
+ QString int_otdel_id; |
+ QStringList tmp; |
+ bool ok; |
+ |
+ |
+ |
+ //ok= pdb->isOpen(); |
+ QSqlQuery q; |
+ ok = q.prepare(tr("select * from otdeli"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id; |
+ ok = q.exec(); |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ pdb->lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ otdel_id = q.value(fieldID).toString(); |
+ int_otdel_id = q.value(fieldID).toString(); |
+ otdel_tmp.name = otdel; |
+ otdel_tmp.ID = int_otdel_id; |
+ otdel_tmp.user_list = get_user_list(int_otdel_id); |
+ otdel_list_rtrn.append(otdel_tmp); |
+ } |
+ |
+ return otdel_list_rtrn; |
+} |
+ |
+QList<TUser> raportForm::get_user_list(QString otdel_ID) |
+{ |
+ TUser user_tmp; |
+ QList<TUser> user_list_rtrn; |
+ |
+ int field_fio_sotrydnika, field_id_sotrydnika; |
+ QString fio_sotrydnika_otdela, id_sotrydnika_otdela, oboryd; |
+ QSqlQuery qsotrydnikiOtdela; |
+ QString sqlQueryString; |
+ QTreeWidgetItem *treeItem_sotrydnika; |
+ sqlQueryString = tr("select Èäåíòèôèêàòîð, ÔÈÎ from sotrydniki where Èäåíòèôèêàòîð_îòäåëà="); |
+ sqlQueryString.append(otdel_ID); |
+ qsotrydnikiOtdela.prepare(sqlQueryString); |
+ qsotrydnikiOtdela.exec(); |
+ field_fio_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("ÔÈÎ")); |
+ field_id_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (qsotrydnikiOtdela.next()) |
+ { |
+ QList <TSystemBlock> sys_block_list_tmp; |
+ QString id_user; |
+// fio_sotrydnika_otdela = qsotrydnikiOtdela.value(field_fio_sotrydnika).toString(); |
+// id_sotrydnika_otdela = qsotrydnikiOtdela.value(field_id_sotrydnika).toString(); |
+ user_tmp.name = qsotrydnikiOtdela.value(field_fio_sotrydnika).toString(); |
+ id_user = qsotrydnikiOtdela.value(field_id_sotrydnika).toString(); |
+ user_tmp.ID = id_user; |
+ // user_list_rtrn.append(user_tmp); |
+ sys_block_list_tmp = get_sys_block_list(id_user); |
+ user_tmp.system_block_list = sys_block_list_tmp; |
+// treeItem_sotrydnika = new QTreeWidgetItem(itemOtdela); |
+// treeItem_sotrydnika->setText(1, fio_sotrydnika_otdela ); |
+ user_list_rtrn.append(user_tmp); |
+ } |
+ return user_list_rtrn; |
+} |
+ |
+ |
+void raportForm::bild_raport(){ |
+ TSibgipro sgshm; |
+ QList <TOtdel> sgshm_otdel_list; |
+ QString otdel_name, otdel_id, user_name; |
+ document = textEdit->document(); |
+ cursor = new QTextCursor(document); |
+ cursor->movePosition(QTextCursor::Start); |
+ QTextCharFormat format(cursor->charFormat()); |
+ //format.setFontFamily("Courier"); |
+ format.setFontFamily("Arial"); |
+ //format.setFontItalic(false); |
+ |
+ format.setFontWeight(QFont::Normal); |
+ QTextCharFormat boldFormat = format; |
+ boldFormat.setFontWeight(QFont::Bold); |
+ |
+ QTextCharFormat italicFormat = format; |
+ //format.setFontFamily("Courier"); |
+// format.setFontFamily("Arial"); |
+ italicFormat.setFontItalic(true); |
+ |
+ |
+ |
+ sgshm = get_sibgipro(); |
+ sgshm_otdel_list = sgshm.otdel_list; |
+ |
+ |
+ for (int i = 0; i < sgshm_otdel_list.size(); ++i) { |
+ otdel_name = sgshm_otdel_list.at(i).name; |
+ |
+///// cursor->insertText(otdel_name, boldFormat); |
+///// ENTER |
+ otdel_id = sgshm_otdel_list.at(i).ID; |
+///// cursor->insertText(otdel_id, format); |
+///// ENTER |
+ |
+ for (int m = 0; m < sgshm_otdel_list.at(i).user_list.size(); ++m) |
+ { |
+ QString sys_id, sys_inv_num, sys_ser_num; |
+// int k_tmp; |
+ user_name = sgshm_otdel_list.at(i).user_list.at(m).name; |
+ cursor->insertText(otdel_name, format); |
+ ENTER |
+ cursor->insertText(user_name, boldFormat); |
+ ENTER |
+// k_tmp = ; |
+ for (int k = 0; k < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.size(); ++k) |
+ { |
+ |
+ sys_id = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).ID; |
+ sys_inv_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).inv_num; |
+ sys_ser_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).ser_num; |
+ cursor->insertText(tr("Ñèñòåìíûé áëîê:"), format); |
+// ENTER |
+ cursor->insertText(tr(" èíâ. íîìåð: "), italicFormat); |
+ cursor->insertText(sys_inv_num, format); |
+ cursor->insertText(tr(" ñåð. íîìåð: "), italicFormat); |
+ cursor->insertText(sys_ser_num, format); |
+ |
+ ENTER |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).mb_list.size(); ++l) |
+ { |
+ QString mb_proizvoditel, mb_model; |
+ mb_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).mb_list.at(l).proizvoditel; |
+ mb_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).mb_list.at(l).model; |
+ cursor->insertText(tr(" Ìàòåðèíñêàÿ ïëàòà: "), format); |
+ cursor->insertText(mb_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(mb_model, format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).cpu_list.size(); ++l) |
+ { |
+ QString cpu_proizvoditel, cpu_model, cpu_fqr; |
+ cpu_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).cpu_list.at(l).proizvoditel; |
+ cpu_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).cpu_list.at(l).model; |
+ cpu_fqr = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).cpu_list.at(l).fqr; |
+ cursor->insertText(tr(" Ïðîöåññîð: "), format); |
+ cursor->insertText(cpu_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(cpu_model, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(cpu_fqr, format); |
+ cursor->insertText(tr(" ÌÃö"), format); |
+ ENTER |
+ } |
+ |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).memory_list.size(); ++l) |
+ { |
+ QString memory_proizvoditel, memory_tip, memory_obem; |
+ memory_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).memory_list.at(l).proizvoditel; |
+ memory_tip = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).memory_list.at(l).tip; |
+ memory_obem = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).memory_list.at(l).obem; |
+ cursor->insertText(tr(" Ìîäóëü ïàìÿòè: "), format); |
+ cursor->insertText(memory_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(memory_tip, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(memory_obem, format); |
+ cursor->insertText(tr(" ÌÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).harddisc_list.size(); ++l) |
+ { |
+ QString hdd_proizvoditel, hdd_model, hdd_obem; |
+ hdd_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).harddisc_list.at(l).proizvoditel; |
+ hdd_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).harddisc_list.at(l).model; |
+ hdd_obem = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).harddisc_list.at(l).obem; |
+ cursor->insertText(tr(" Æåñòêèé äèñê: "), format); |
+ cursor->insertText(hdd_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(hdd_model, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(hdd_obem, format); |
+ cursor->insertText(tr(" ÃÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.size(); ++l) |
+ { |
+ QString privod_proizvoditel, privod_model, privod_ID, privod_speed, privod_inv_num, privod_ser_num, privod_tip; |
+ privod_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.at(l).proizvoditel; |
+ privod_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.at(l).model; |
+ privod_speed = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.at(l).speed; |
+ privod_tip = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).privod_list.at(l).tip; |
+ cursor->insertText(tr(" Ïðèâîä: "), format); |
+ cursor->insertText(privod_tip, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(privod_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(privod_model, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(privod_speed, format); |
+ //cursor->insertText(tr(" ÃÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.size(); ++l) |
+ { |
+ QString videocard_proizvoditel, videocard_model, videocard_ID, videocard_ram_size, videocard_inv_num, videocard_ser_num, videocard_interfeis; |
+ videocard_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).proizvoditel; |
+ videocard_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).model; |
+ videocard_ram_size = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).memory_value; |
+ videocard_inv_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).inv_num; |
+ videocard_ser_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).ser_num; |
+ videocard_interfeis = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).interfeis; |
+ cursor->insertText(tr(" Âèäåîàäàïòåð: "), format); |
+ cursor->insertText(videocard_interfeis, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(videocard_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(videocard_model, format); |
+ cursor->insertText(tr(" "), format); |
+ cursor->insertText(videocard_ram_size, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(privod_speed, format); |
+ cursor->insertText(tr(" MÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.size(); ++l) |
+ { |
+ QString soundcard_proizvoditel, soundcard_model, soundcard_ID, soundcard_ram_size, soundcard_inv_num, soundcard_ser_num, soundcard_interfeis; |
+ soundcard_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.at(l).proizvoditel; |
+ soundcard_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.at(l).model; |
+// soundcard_ram_size = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).memory_value; |
+ soundcard_inv_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.at(l).inv_num; |
+ soundcard_ser_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).soundcard_list.at(l).ser_num; |
+// soundcard_interfeis = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).interfeis; |
+ cursor->insertText(tr(" Çâóêîâàÿ êàðòà: "), format); |
+ cursor->insertText(soundcard_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(videocard_proizvoditel, format); |
+// cursor->insertText(tr(" "), format); |
+ cursor->insertText(soundcard_model, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(videocard_ram_size, format); |
+// cursor->insertText(tr(" "), format); |
+// cursor->insertText(privod_speed, format); |
+// cursor->insertText(tr(" MÁ"), format); |
+ ENTER |
+ } |
+ |
+ for (int l = 0; l < sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.size(); ++l) |
+ { |
+ QString lancard_proizvoditel, lancard_model, lancard_ID, lancard_ram_size, lancard_inv_num, lancard_ser_num, landcard_interfeis; |
+ lancard_proizvoditel = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.at(l).proizvoditel; |
+ lancard_model = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.at(l).model; |
+// soundcard_ram_size = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).memory_value; |
+ lancard_inv_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.at(l).inv_num; |
+ lancard_ser_num = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).lancard_list.at(l).ser_num; |
+// soundcard_interfeis = sgshm_otdel_list.at(i).user_list.at(m).system_block_list.at(k).videocard_list.at(l).interfeis; |
+ cursor->insertText(tr(" Ñåòåâàÿ êàðòà: "), format); |
+ cursor->insertText(lancard_proizvoditel, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(videocard_proizvoditel, format); |
+// cursor->insertText(tr(" "), format); |
+ cursor->insertText(lancard_model, format); |
+ cursor->insertText(tr(" "), format); |
+// cursor->insertText(videocard_ram_size, format); |
+// cursor->insertText(tr(" "), format); |
+// cursor->insertText(privod_speed, format); |
+// cursor->insertText(tr(" MÁ"), format); |
+ ENTER |
+ } |
+ |
+ |
+ |
+ |
+ } |
+ |
+ ENTER |
+ ENTER |
+ |
+ |
+ } |
+ |
+ |
+ ENTER |
+ } |
+} |
+ |
+ |
+QList<TSystemBlock> raportForm::get_sys_block_list(QString id_otv_lica) |
+{ |
+ QList<TSystemBlock> sys_block_list_rtrn; |
+ TSystemBlock sys_block_tmp; |
+ QString result, prResult; |
+ QVariant data_tmp; |
+ QString sqlQueryText; |
+ QString serial_num, inventar_num, proizvoditel, model, system_block_id; |
+ QSqlQuery quer; |
+ QString MB_information, Memory_information, CPU_information, HDD_information, CD_DVD_information, Vidio_information; |
+ QString Sound_card_information, Lan_card_information; |
+ int field_serialNum, field_inventarNum, field_proizvoditel, field_model, field_system_block_id, field_data_pokypki; |
+// QSqlQuery qns(tr("SET NAMES utf8"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QTreeWidgetItem *itemSysBlock; |
+// sqlQueryText.reserve(300); |
+ sqlQueryText = tr("select system_blocks.Ñåðèéíûé_íîìåð, system_blocks.Èíâåíòàðíûé_íîìåð, system_blocks.Äàòà_ïîêóïêè, system_blocks.Èäåíòèôèêàòîð" |
+ " from system_blocks" |
+ " where system_blocks.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà ="); |
+ sqlQueryText.append(id_otv_lica); |
+// sqlQueryText.append(tr(" AND Ìàòåðèíñêèå_ïëàòû.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð")); |
+ quer.prepare(sqlQueryText); |
+// quer.prepare(tr("select Ñèñòåìíûå_áëîêè.Ñåðèéíûé_íîìåð, Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð,Ìàòåðèíñêèå_ïëàòû.Ïðîèçâîäèòåëü, Ìàòåðèíñêèå_ïëàòû.Ìîäåëü from Ñèñòåìíûå_áëîêè,Ìàòåðèíñêèå_ïëàòû where Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà = 4 AND Ìàòåðèíñêèå_ïëàòû.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð;")); |
+ quer.exec(); |
+ field_serialNum = quer.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventarNum = quer.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_system_block_id = quer.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+// field_proizvoditel = quer.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+// field_model = quer.record().indexOf(tr("Ìîäåëü")); |
+ while(quer.next()){ |
+ QList <TMatheboard> mb_list_tmp; |
+ QList <TMemory> memory_list_tmp; |
+ QList<TCpu> cpu_list_tmp; |
+ QList<THarddisc> harddisc_list_tmp; |
+ QList<TPrivod> privod_list_tmp; |
+ QList<TVideocard> videocard_list_tmp; |
+ QList<TSoundcard> soundcard_list_tmp; |
+ QList<TLancard> lancard_list_tmp; |
+ system_block_id = quer.value(field_system_block_id).toString(); //èäåíòèôèêàòîð ñèñòåìíîãî áëîêà |
+ sys_block_tmp.ID = system_block_id; |
+ prResult = ""; |
+ serial_num = quer.value(field_serialNum).toString(); |
+ sys_block_tmp.ser_num = serial_num; |
+ inventar_num = quer.value(field_inventarNum).toString(); |
+ sys_block_tmp.inv_num = inventar_num; |
+ mb_list_tmp = get_matheboard_list(system_block_id); |
+ sys_block_tmp.mb_list = mb_list_tmp; |
+ memory_list_tmp = get_memory_list(system_block_id); |
+ sys_block_tmp.memory_list = memory_list_tmp; |
+ cpu_list_tmp = get_cpu_list(system_block_id); |
+ sys_block_tmp.cpu_list = cpu_list_tmp; |
+ harddisc_list_tmp = get_harddisc_list(system_block_id); |
+ sys_block_tmp.harddisc_list = harddisc_list_tmp; |
+ privod_list_tmp = get_privod_list(system_block_id); |
+ sys_block_tmp.privod_list = privod_list_tmp; |
+ videocard_list_tmp = get_videocard_list(system_block_id); |
+ sys_block_tmp.videocard_list = videocard_list_tmp; |
+ soundcard_list_tmp = get_soundcard_list(system_block_id); |
+ sys_block_tmp.soundcard_list = soundcard_list_tmp; |
+ lancard_list_tmp = get_lancard_list(system_block_id); |
+ sys_block_tmp.lancard_list = lancard_list_tmp; |
+ |
+ sys_block_list_rtrn.append(sys_block_tmp); |
+ } |
+ return sys_block_list_rtrn; |
+} |
+ |
+ |
+QList<TMatheboard> raportForm::get_matheboard_list(QString id_system_block) |
+{ |
+ TMatheboard matheboard_tmp; |
+ QList<TMatheboard> mb_list_rtrn; |
+ QString result, tmp; |
+ QString MB_proizvoditel, MB_model, MB_identifikator, MB_serial_num, MB_inventar_num; |
+ QString MatheBoardSqlQueryText; |
+ QSqlQuery MatheBoardQuery; |
+ int field_proizvoditel, field_model, field_identifikator, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *itemMB, *itmMB_block; |
+ MatheBoardSqlQueryText = tr("select * " |
+ " from matheboards where matheboards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ MatheBoardSqlQueryText.append(id_system_block); |
+ MatheBoardQuery.prepare(MatheBoardSqlQueryText); |
+ MatheBoardQuery.exec(); |
+ field_identifikator = MatheBoardQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = MatheBoardQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = MatheBoardQuery.record().indexOf(tr("Ìîäåëü")); |
+ field_serial_num = MatheBoardQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = MatheBoardQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ |
+ |
+ while(MatheBoardQuery.next()){ |
+ tmp = ""; |
+ MB_identifikator = MatheBoardQuery.value(field_identifikator).toString(); |
+ MB_proizvoditel = MatheBoardQuery.value(field_proizvoditel).toString(); |
+ MB_model = MatheBoardQuery.value(field_model).toString(); |
+ MB_serial_num = MatheBoardQuery.value(field_serial_num).toString(); |
+ MB_inventar_num = MatheBoardQuery.value(field_inventar_num).toString(); |
+ |
+ matheboard_tmp.ID = MB_identifikator; |
+ matheboard_tmp.proizvoditel = MB_proizvoditel; |
+ matheboard_tmp.model = MB_model; |
+ matheboard_tmp.ser_num = MB_serial_num; |
+ matheboard_tmp.inv_num = MB_inventar_num; |
+ |
+ mb_list_rtrn.append(matheboard_tmp); |
+ |
+/* if (MB_proizvoditel != "") { |
+// tmp.append(tr("MB: ")); |
+ tmp.append(MB_proizvoditel); |
+ } |
+ if (MB_model != "") {tmp.append(tr(" ")); |
+ tmp.append(MB_model); |
+ tmp.append(tr(" "));} |
+ result.append(tmp); |
+ |
+ itemMB = new QTreeWidgetItem(itemSysBlock); |
+ itemMB->setIcon(4, matheboard_icon); |
+ itemMB->setText(4, tmp); |
+ itemMB->setText(12, MB_identifikator); |
+ itemMB->setText(13, id_systemBlock); |
+ itemMB->setText(14, id_otvetstvennogo_lica); |
+ itemMB->setText(2, tr("Ìàòåðèíñêàÿ ïëàòà")); |
+ itemMB->setText(3, MB_inventar_num); |
+ if (id_systemBlock !="1") itemSysBlock->setText(5, tmp); |
+*/ |
+ } |
+ return mb_list_rtrn; |
+} |
+ |
+QList<TMemory> raportForm::get_memory_list(QString id_system_block) |
+{ |
+ TMemory memory_tmp; |
+ QList <TMemory> memory_list_rtrn; |
+ QString result, tmp; |
+ QString Memiry_id, Memory_proizvoditel, Memory_type, Memory_obem, Memory_inventar_num, Memory_serial_num; |
+ QString MemorySqlQueryText; |
+ QSqlQuery MemoryQuery; |
+ int field_proizvoditel, field_type, field_obem, field_id, field_inventar_num, field_sereal_num; |
+// QTreeWidgetItem *itemMemory, *itemMemory_block; |
+ MemorySqlQueryText = tr("select memory.* " |
+ " from memory where memory.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ MemorySqlQueryText.append(id_system_block); |
+ MemoryQuery.prepare(MemorySqlQueryText); |
+ MemoryQuery.exec(); |
+ field_id = MemoryQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = MemoryQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_type = MemoryQuery.record().indexOf(tr("Òèï")); |
+ field_obem = MemoryQuery.record().indexOf(tr("Îáúåì")); |
+ field_inventar_num = MemoryQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_sereal_num = MemoryQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ while(MemoryQuery.next()){ |
+// tmp = tr("RAM: "); |
+ tmp = tr(""); |
+ Memiry_id = MemoryQuery.value(field_id).toString(); |
+ Memory_proizvoditel = MemoryQuery.value(field_proizvoditel).toString(); |
+ Memory_type = MemoryQuery.value(field_type).toString(); |
+ Memory_obem = MemoryQuery.value(field_obem).toString(); |
+ Memory_inventar_num = MemoryQuery.value(field_inventar_num).toString(); |
+ Memory_serial_num = MemoryQuery.value(field_sereal_num).toString(); |
+ memory_tmp.ID = Memiry_id; |
+ memory_tmp.proizvoditel = Memory_proizvoditel; |
+ memory_tmp.obem = Memory_obem; |
+ memory_tmp.tip = Memory_type; |
+ memory_tmp.inv_num = Memory_inventar_num; |
+ memory_tmp.ser_num = Memory_serial_num; |
+//// if (Memory_proizvoditel != "") { |
+//// tmp.append(Memory_proizvoditel);} |
+/* |
+ if (Memory_type != "") {tmp.append(tr(" ")); |
+ tmp.append(Memory_type); |
+ tmp.append(tr(" "));} |
+ if (Memory_obem != "") {tmp.append(tr(" ")); |
+ tmp.append(Memory_obem); |
+ tmp.append(tr("MB; "));} |
+ result.append(tmp); |
+*/ |
+ memory_list_rtrn.append(memory_tmp); |
+ } |
+ return memory_list_rtrn; |
+} |
+ |
+ |
+QList<TCpu> raportForm::get_cpu_list(QString id_system_block) |
+{ |
+ TCpu cpu_tmp; |
+ QList <TCpu> cpu_list_rtrn; |
+ QString CPU_id, CPU_proizvoditel, CPU_slot, CPU_fqr, CPU_inventar_num, CPU_serial_num, CPU_model; |
+ QString CpuSqlQueryText; |
+ QSqlQuery CpuQuery; |
+ int field_id, field_proizvoditel, field_slot, field_fqr, field_inventar_num, field_serial_num, field_model; |
+ CpuSqlQueryText = tr("select processors.* " |
+ " from processors where processors.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ CpuSqlQueryText.append(id_system_block); |
+ CpuQuery.prepare(CpuSqlQueryText); |
+ CpuQuery.exec(); |
+ field_id = CpuQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = CpuQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_slot = CpuQuery.record().indexOf(tr("Ñëîò")); |
+ field_fqr = CpuQuery.record().indexOf(tr("×àñòîòà")); |
+ field_inventar_num = CpuQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = CpuQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_model = CpuQuery.record().indexOf(tr("Ìîäåëü")); |
+ |
+ while(CpuQuery.next()){ |
+ CPU_id = CpuQuery.value(field_id).toString(); |
+ CPU_proizvoditel = CpuQuery.value(field_proizvoditel).toString(); |
+ CPU_slot = CpuQuery.value(field_slot).toString(); |
+ CPU_fqr = CpuQuery.value(field_fqr).toString(); |
+ CPU_inventar_num = CpuQuery.value(field_inventar_num).toString(); |
+ CPU_serial_num = CpuQuery.value(field_serial_num).toString(); |
+ CPU_model = CpuQuery.value(field_model).toString(); |
+ |
+ cpu_tmp.ID = CPU_id; |
+ cpu_tmp.proizvoditel = CPU_proizvoditel; |
+ cpu_tmp.slot = CPU_slot; |
+ cpu_tmp.fqr = CPU_fqr; |
+ cpu_tmp.inv_num = CPU_inventar_num; |
+ cpu_tmp.ser_num = CPU_serial_num; |
+ cpu_tmp.model = CPU_model; |
+ cpu_list_rtrn.append(cpu_tmp); |
+ } |
+ return cpu_list_rtrn; |
+} |
+ |
+QList<THarddisc> raportForm::get_harddisc_list(QString id_system_block) |
+{ |
+ QList<THarddisc> harddisc_list_rtrn; |
+ THarddisc harddisc_tmp; |
+ QString result, tmp; |
+ QString HDD_id, HDD_proizvoditel, HDD_interfeis, HDD_obem, HDD_inventar_num, HDD_serial_num; |
+ QString HDDSqlQueryText; |
+ QSqlQuery HDDQuery; |
+ int field_id, field_proizvoditel, field_interfeis, field_obem, field_inventar_num, field_serial_num; |
+ HDDSqlQueryText = tr("select harddiscs.* " |
+ " from harddiscs where harddiscs.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ HDDSqlQueryText.append(id_system_block); |
+ HDDQuery.prepare(HDDSqlQueryText); |
+ HDDQuery.exec(); |
+ field_id = HDDQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = HDDQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_interfeis = HDDQuery.record().indexOf(tr("Èíòåðôåéñ")); |
+ field_obem = HDDQuery.record().indexOf(tr("Îáúåì")); |
+ field_inventar_num = HDDQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = HDDQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ while(HDDQuery.next()){ |
+// tmp = tr("HDD: "); |
+ tmp = tr(""); |
+ HDD_id = HDDQuery.value(field_id).toString(); |
+ HDD_proizvoditel = HDDQuery.value(field_proizvoditel).toString(); |
+ HDD_interfeis = HDDQuery.value(field_interfeis).toString(); |
+ HDD_obem = HDDQuery.value(field_obem).toString(); |
+ HDD_inventar_num = HDDQuery.value(field_inventar_num).toString(); |
+ HDD_serial_num = HDDQuery.value(field_serial_num).toString(); |
+ harddisc_tmp.ID = HDD_id; |
+ harddisc_tmp.proizvoditel = HDD_proizvoditel; |
+ harddisc_tmp.interfeis = HDD_interfeis; |
+ harddisc_tmp.obem = HDD_obem; |
+ harddisc_tmp.inv_num = HDD_inventar_num; |
+ harddisc_tmp.ser_num = HDD_serial_num; |
+ harddisc_list_rtrn.append(harddisc_tmp); |
+ } |
+ |
+// if (result!="") itemSysBlock->setIcon(7, hdd_icon); |
+// if (id_systemBlock !="1") itemSysBlock->setText(7, result); |
+ return harddisc_list_rtrn; |
+ |
+} |
+ |
+ |
+QList<TPrivod> raportForm::get_privod_list(QString id_system_block) |
+{ |
+ TPrivod privod_tmp; |
+ QList<TPrivod> privod_list_rtrn; |
+ QString result, tmp; |
+ QString CD_DVD_id, CD_DVD_proizvoditel, CD_DVD_type, CD_DVD_speed, CD_DVD_serial_num, CD_DVD_inventar_num; |
+ QString CD_DVD_SqlQueryText; |
+ QSqlQuery CD_DVD_Query; |
+ int field_id, field_proizvoditel, field_type, field_speed, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *item_CD_DVD; |
+ QTreeWidgetItem *item_CD_DVD_block; |
+ CD_DVD_SqlQueryText = tr("select cd_dvd.* " |
+ " from cd_dvd where cd_dvd.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ CD_DVD_SqlQueryText.append(id_system_block); |
+ CD_DVD_Query.prepare(CD_DVD_SqlQueryText); |
+ CD_DVD_Query.exec(); |
+ field_id = CD_DVD_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = CD_DVD_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_type = CD_DVD_Query.record().indexOf(tr("Òèï")); |
+ field_speed = CD_DVD_Query.record().indexOf(tr("Ñêîðîñòü")); |
+ field_inventar_num = CD_DVD_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = CD_DVD_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+/* |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_CD_DVD_block = new QTreeWidgetItem(itemSysBlock); |
+ item_CD_DVD_block->setText(2, tr("ÏÐÈÂÎÄÛ")); |
+ item_CD_DVD_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+*/ |
+ |
+ while(CD_DVD_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ CD_DVD_id = CD_DVD_Query.value(field_id).toString(); |
+ CD_DVD_proizvoditel = CD_DVD_Query.value(field_proizvoditel).toString(); |
+ CD_DVD_type = CD_DVD_Query.value(field_type).toString(); |
+ CD_DVD_speed = CD_DVD_Query.value(field_speed).toString(); |
+ CD_DVD_serial_num = CD_DVD_Query.value(field_serial_num).toString(); |
+ CD_DVD_inventar_num = CD_DVD_Query.value(field_inventar_num).toString(); |
+ |
+ privod_tmp.ID = CD_DVD_id; |
+ privod_tmp.proizvoditel = CD_DVD_proizvoditel; |
+ privod_tmp.tip = CD_DVD_type; |
+ privod_tmp.speed = CD_DVD_speed; |
+ privod_tmp.inv_num = CD_DVD_inventar_num; |
+ privod_tmp.ser_num = CD_DVD_serial_num; |
+ privod_list_rtrn.append(privod_tmp); |
+/* |
+ |
+ if (CD_DVD_type != "") { |
+ tmp.append(CD_DVD_type);} |
+ if (CD_DVD_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(CD_DVD_proizvoditel); |
+ tmp.append(tr(" "));} |
+ if (CD_DVD_speed != "") {tmp.append(tr(" ")); |
+ tmp.append(CD_DVD_speed); |
+ tmp.append(tr(" "));} |
+ result.append(tmp); |
+ |
+if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_CD_DVD = new QTreeWidgetItem(item_CD_DVD_block); |
+ } |
+ else item_CD_DVD = new QTreeWidgetItem(itemSysBlock); |
+ |
+ item_CD_DVD->setText(2, tr("Ïðèâîä")); |
+ item_CD_DVD->setText(12, CD_DVD_id); |
+ item_CD_DVD->setText(13, id_systemBlock); |
+ item_CD_DVD->setText(14, id_otvetstvennogo_lica); |
+ item_CD_DVD->setIcon(4, cd_dvd_icon); |
+ item_CD_DVD->setText(4, tmp); |
+ item_CD_DVD->setText(3, CD_DVD_inventar_num); |
+*/ |
+ } |
+ |
+// if (id_systemBlock !="1") itemSysBlock->setText(8, result); |
+ return privod_list_rtrn; |
+ |
+} |
+ |
+ |
+QList<TVideocard> raportForm::get_videocard_list(QString id_system_block) |
+{ |
+ QList<TVideocard> videocard_list_rtrn; |
+ TVideocard videocard_tmp; |
+ QString result, tmp; |
+ QString Vidio_id, Vidio_proizvoditel, Vidio_model, Vidio_interfeis, Vidio_ram, Vidio_inventar_num, Vidio_sereal_num; |
+ QString Vidio_SqlQueryText; |
+ QSqlQuery Vidio_Query; |
+ int field_id, field_proizvoditel, field_model, field_interfeis, field_ram, field_inventar_num, field_sereal_num; |
+ QTreeWidgetItem *item_Vidio, *item_Vidio_block; |
+ Vidio_SqlQueryText = tr("select videocards.* " |
+ " from videocards where videocards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Vidio_SqlQueryText.append(id_system_block); |
+ Vidio_Query.prepare(Vidio_SqlQueryText); |
+ Vidio_Query.exec(); |
+ field_id = Vidio_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Vidio_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Vidio_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_interfeis = Vidio_Query.record().indexOf(tr("Èíòåðôåéñ")); |
+ field_ram = Vidio_Query.record().indexOf(tr("Ïàìÿòü")); |
+ field_inventar_num = Vidio_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_sereal_num = Vidio_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ |
+/* |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Vidio_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Vidio_block->setText(2, tr("ÂÈÄÅÎÊÀÐÒÛ")); |
+ item_Vidio_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+*/ |
+ |
+ |
+ while(Vidio_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Vidio_id = Vidio_Query.value(field_id).toString(); |
+ Vidio_proizvoditel = Vidio_Query.value(field_proizvoditel).toString(); |
+ Vidio_model = Vidio_Query.value(field_model).toString(); |
+ Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+ Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ Vidio_inventar_num = Vidio_Query.value(field_inventar_num).toString(); |
+ Vidio_sereal_num = Vidio_Query.value(field_sereal_num).toString(); |
+ |
+ |
+ videocard_tmp.ID = Vidio_id; |
+ videocard_tmp.proizvoditel = Vidio_proizvoditel; |
+ videocard_tmp.interfeis = Vidio_interfeis; |
+ videocard_tmp.model = Vidio_model; |
+ videocard_tmp.memory_value = Vidio_ram; |
+ videocard_tmp.inv_num = Vidio_inventar_num; |
+ videocard_tmp.ser_num = Vidio_sereal_num; |
+ |
+ videocard_list_rtrn.append(videocard_tmp); |
+ |
+/* |
+ if (Vidio_interfeis != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_interfeis);} |
+ if (Vidio_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_proizvoditel);} |
+ if (Vidio_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_model);} |
+ |
+ if (Vidio_ram !=""){tmp.append(tr(" ")); |
+ tmp.append(Vidio_ram); |
+ tmp.append(tr(" Mb")); |
+ |
+ } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Vidio = new QTreeWidgetItem(item_Vidio_block); |
+ } |
+ else item_Vidio = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// item_Vidio = new QTreeWidgetItem(itemSysBlock); |
+ |
+ item_Vidio->setText(2, tr("Âèäåîêàðòà")); |
+ item_Vidio->setText(12, Vidio_id); |
+ item_Vidio->setText(13, id_systemBlock); |
+ item_Vidio->setText(14, id_otvetstvennogo_lica); |
+ item_Vidio->setIcon(4, vidio_card_icon); |
+ item_Vidio->setText(4, tmp); |
+ item_Vidio->setText(3, Vidio_inventar_num); |
+*/ |
+ } |
+// if (id_systemBlock !="1") itemSysBlock->setText(9, result); |
+ return videocard_list_rtrn; |
+} |
+ |
+QList<TSoundcard> raportForm::get_soundcard_list(QString id_system_block) |
+{ |
+ TSoundcard soundcard_tmp; |
+ QList<TSoundcard> soundcard_list_rtrn; |
+ QString result, tmp; |
+ QString Sound_card_id, Sound_card_proizvoditel, Sound_card_model, Sound_card_inventar_num, Sound_card_serial_num; |
+ QString Sound_card_SqlQueryText; |
+ QSqlQuery Sound_card_Query; |
+ int field_id, field_proizvoditel, field_model, field_inventar_num, field_serial_num; |
+ QTreeWidgetItem *item_Sound_card, *item_Sound_card_block; |
+ Sound_card_SqlQueryText = tr("select soundcards.* " |
+ " from soundcards where soundcards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Sound_card_SqlQueryText.append(id_system_block); |
+ Sound_card_Query.prepare(Sound_card_SqlQueryText); |
+ Sound_card_Query.exec(); |
+ field_id = Sound_card_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Sound_card_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Sound_card_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_inventar_num = Sound_card_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = Sound_card_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+/* |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Sound_card_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Sound_card_block->setText(2, tr("ÇÂÓÊÎÂÛÅ ÊÀÐÒÛ")); |
+ item_Sound_card_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+*/ |
+ while(Sound_card_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Sound_card_id = Sound_card_Query.value(field_id).toString(); |
+ Sound_card_proizvoditel = Sound_card_Query.value(field_proizvoditel).toString(); |
+ Sound_card_model = Sound_card_Query.value(field_model).toString(); |
+ Sound_card_inventar_num = Sound_card_Query.value(field_inventar_num).toString(); |
+ Sound_card_serial_num = Sound_card_Query.value(field_serial_num).toString(); |
+ |
+ soundcard_tmp.ID = Sound_card_id; |
+ soundcard_tmp.proizvoditel = Sound_card_proizvoditel; |
+ soundcard_tmp.model = Sound_card_model; |
+ soundcard_tmp.inv_num = Sound_card_inventar_num; |
+ soundcard_tmp.ser_num = Sound_card_serial_num; |
+ |
+ soundcard_list_rtrn.append(soundcard_tmp); |
+// Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+// Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ |
+/* |
+ if (Sound_card_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Sound_card_proizvoditel);} |
+ |
+ if (Sound_card_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Sound_card_model);} |
+ |
+/// if (Vidio_ram !=""){tmp.append(tr(" ")); |
+/// tmp.append(Vidio_ram); |
+/// tmp.append(tr(" Mb")); |
+ |
+/// } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Sound_card = new QTreeWidgetItem(item_Sound_card_block); |
+ } |
+ else item_Sound_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// item_Sound_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+ item_Sound_card->setText(2, tr("Çâóêîâàÿ êàðòà")); |
+ item_Sound_card->setText(12, Sound_card_id); |
+ item_Sound_card->setText(13, id_systemBlock); |
+ item_Sound_card->setText(14, id_otvetstvennogo_lica); |
+ item_Sound_card->setIcon(4, sound_card_icon); |
+ item_Sound_card->setText(4, tmp); |
+ item_Sound_card->setText(3, Sound_card_inventar_num); |
+*/ |
+ } |
+// if (id_systemBlock !="1") itemSysBlock->setText(10, result); |
+ return soundcard_list_rtrn; |
+ |
+} |
+ |
+QList<TLancard> raportForm::get_lancard_list(QString id_system_block) |
+{ |
+ |
+ TLancard lancard_tmp; |
+ QList<TLancard> lancard_list_rtrn; |
+ QString result, tmp; |
+ QString Lan_card_id, Lan_card_proizvoditel, Lan_card_model, Lan_speed, Lan_inventar_num, Lan_serial_num; |
+ QString Lan_card_SqlQueryText; |
+ QSqlQuery Lan_card_Query; |
+ int field_id, field_proizvoditel, field_model, field_speed, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *item_Lan_card, *item_Lan_card_block; |
+ Lan_card_SqlQueryText = tr("select lancards.* " |
+ " from lancards where lancards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Lan_card_SqlQueryText.append(id_system_block); |
+ Lan_card_Query.prepare(Lan_card_SqlQueryText); |
+ Lan_card_Query.exec(); |
+ field_id = Lan_card_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Lan_card_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Lan_card_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_speed = Lan_card_Query.record().indexOf(tr("Ñêîðîñòü_ïåðåäà÷è_äàííûõ")); |
+ field_serial_num = Lan_card_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = Lan_card_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ |
+/* |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Lan_card_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Lan_card_block->setText(2, tr("ÑÅÒÅÂÛÅ ÊÀÐÒÛ")); |
+ item_Lan_card_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+*/ |
+ while(Lan_card_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Lan_card_id = Lan_card_Query.value(field_id).toString(); |
+ Lan_card_proizvoditel = Lan_card_Query.value(field_proizvoditel).toString(); |
+ Lan_card_model = Lan_card_Query.value(field_model).toString(); |
+ Lan_speed = Lan_card_Query.value(field_speed).toString(); |
+ Lan_inventar_num = Lan_card_Query.value(field_inventar_num).toString(); |
+ Lan_serial_num = Lan_card_Query.value(field_serial_num).toString(); |
+ |
+ lancard_tmp.ID = Lan_card_id; |
+ lancard_tmp.proizvoditel = Lan_card_proizvoditel; |
+ lancard_tmp.model = Lan_card_model; |
+ lancard_tmp.speed = Lan_speed; |
+ lancard_tmp.ser_num = Lan_serial_num; |
+ lancard_tmp.inv_num = Lan_inventar_num; |
+ |
+ lancard_list_rtrn.append(lancard_tmp); |
+// Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+// Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ |
+/* |
+ if (Lan_card_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_card_proizvoditel);} |
+ |
+ if (Lan_card_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_card_model);} |
+ |
+ if (Lan_speed != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_speed); |
+ tmp.append(tr(" Mbit"));} |
+ |
+ |
+/// if (Vidio_ram !=""){tmp.append(tr(" ")); |
+/// tmp.append(Vidio_ram); |
+/// tmp.append(tr(" Mb")); |
+ |
+/// } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Lan_card = new QTreeWidgetItem(item_Lan_card_block); |
+ } |
+ else item_Lan_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+// item_Lan_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+ item_Lan_card->setText(2, tr("Ñåòåâàÿ êàðòà")); |
+ item_Lan_card->setText(12, Lan_card_id); |
+ item_Lan_card->setText(13, id_systemBlock); |
+ item_Lan_card->setText(14, id_otvetstvennogo_lica); |
+ item_Lan_card->setIcon(4, lan_card_icon); |
+ item_Lan_card->setText(4, tmp); |
+ item_Lan_card->setText(3, Lan_inventar_num); |
+*/ |
+ } |
+// if (id_systemBlock !="1") itemSysBlock->setText(11, result); |
+ return lancard_list_rtrn; |
+ |
+} |
+ |
+void raportForm::on_print_raport() |
+{ |
+ print_raport(); |
+} |
+ |
+void raportForm::on_print_raport_to_pdf() |
+{ |
+ print_raport_to_pdf(); |
+} |
+ |
Index: trunk/source_code/src/addsysblockform.h |
=================================================================== |
--- trunk/source_code/src/addsysblockform.h (revision 0) |
+++ trunk/source_code/src/addsysblockform.h (revision 257) |
@@ -0,0 +1,32 @@ |
+#ifndef __ADDSYSBLOCKFORM_H__ |
+#define __ADDSYSBLOCKFORM_H__ |
+ |
+// place your code here |
+#include <QDialog> |
+#include <QtGui> |
+#include <QtSql> |
+#include "ui_addsysblockform.h" |
+ |
+class addsysblockForm : public QDialog, public Ui::addsysblockform |
+{ |
+Q_OBJECT |
+ public: |
+ addsysblockForm(); |
+ |
+ |
+signals: |
+ void formClose(); |
+ void componentAdd(); |
+ |
+private slots: |
+ void addNewSysBlockSlot(); |
+ |
+private: |
+ |
+protected: |
+ void closeEvent( QCloseEvent * event ); |
+ |
+ |
+}; |
+ |
+#endif // __ADDSYSBLOCKFORM_H__ |
/trunk/source_code/src/addsysblockform.h |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/mainwindowimpl.cpp |
=================================================================== |
--- trunk/source_code/src/mainwindowimpl.cpp (revision 0) |
+++ trunk/source_code/src/mainwindowimpl.cpp (revision 257) |
@@ -0,0 +1,1305 @@ |
+#include "mainwindowimpl.h" |
+//ïðîâåðêà |
+MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f) |
+ : QMainWindow(parent, f) |
+{ |
+ |
+ |
+ |
+ setupUi(this); |
+ fEnable_component_add = false; //ðåæèì äîáîâëåíèÿ êîìïîíåíòà îòêëþ÷åí |
+ fEnable_naznachit_otvetstv = false; |
+ curr_task = no_task; |
+ readSettings(); |
+ lineEdit->insert(baseName); |
+ metaDataAction = new QAction(tr("Èçìåíèòü"), treeWidget); |
+ addMemoryAction = new QAction(tr("Íîâûé ìîäóëü ïàìÿòè"), treeWidget); |
+ MB_na_skladAction = new QAction(tr("Ñäàòü íà ñêëàä"), treeWidget); |
+ new_sotrydnikAction = new QAction(tr("Íîâûé ñîòðóäíèê"), treeWidget); |
+ novoe_oborydovanieAction = new QAction(tr("Íîâîå îáîðóäîâàíèå"), treeWidget); |
+ pereimenovat_otdelAction = new QAction(tr("Ïåðåèìåíîâàòü îòäåë"), treeWidget); |
+ perevesti_sotrydnika_v_drygo1_otdelAction = new QAction(tr("Ïåðåâåñòè â äðóãîé îòäåë"), treeWidget); |
+ yvolit_sotrydnikaAction = new QAction(tr("Óâîëèòü ñîòðóäíèêà"), treeWidget); |
+ SpliterAction = new QAction(tr("Ïåðñîíàë"), treeWidget); |
+ naznachit_otvetstvennim_za_oborydovanieAction = new QAction(tr("Íàçíà÷èòü îòâåòñòâåííûì çà îáîðóäîâàíèå"), treeWidget); |
+ ystanovit_novie_complektyushieAction = new QAction(tr("Óñòàíîâèòü íîâûå êîìïëåêòóþùèå"), treeWidget); |
+ sozdat_otdelAction = new QAction(tr("Ñîçäàòü íîâûé îòäåë"), treeWidget); |
+ |
+ novaya_SYSTEM_BLOCK_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé ñèñòåìíûé áëîê íà ñêëàä"), treeWidget); |
+ novaya_MB_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ ìàòåðèíñêóþ ïëàòó íà ñêëàä"), treeWidget); |
+ novaya_RAM_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé ìîäóëü ïàìÿòè íà ñêëàä"), treeWidget); |
+ novaya_CPU_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé ïðîöåññîð íà ñêëàä"), treeWidget); |
+ novaya_HDD_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé âèí÷åñòåð íà ñêëàä"), treeWidget); |
+ novaya_CD_DVD_na_skladAction = new QAction(tr("Äîáàâèòü íîâûé ïðèâîä íà ñêëàä"), treeWidget); |
+ novaya_VIDEO_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ âèäåîêàðòó íà ñêëàä"), treeWidget); |
+ novaya_SoundCard_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ çâóêîâóþ êàðòó íà ñêëàä"), treeWidget); |
+ novaya_LAN_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ ñåòåâóþ êàðòó íà ñêëàä"), treeWidget); |
+ peredat_sys_block_pod_otveystvennostAction = new QAction(tr("Ïåðåäàòü ñèñòåìíûé áëîê ïîä îòâåòñòâåííîñòü ñîòðóäíèêà"), treeWidget); |
+ |
+ |
+// novaya_SoundCard_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ çâóêîâóþ êàðòó íà ñêëàä"), treeWidget); |
+// novaya_LAN_na_skladAction = new QAction(tr("Äîáàâèòü íîâóþ ñåòåâóþ êàðòó íà ñêëàä"), treeWidget); |
+ |
+ insert_MB_to_system_blockAction = new QAction(tr("Óñòàíîâèòü â ñèñòåìíûé áëîê"), treeWidget); |
+ |
+ treeWidget->addAction(metaDataAction); |
+ treeWidget->addAction(addMemoryAction); |
+ |
+ |
+ connect(insert_MB_to_system_blockAction, SIGNAL(triggered()), SLOT(insert_MB_to_system_block())); |
+ connect(novaya_MB_na_skladAction, SIGNAL(triggered()), SLOT(novaya_MB_na_sklad())); |
+ connect(novaya_RAM_na_skladAction, SIGNAL(triggered()), SLOT(novaya_RAM_na_sklad())); |
+ connect(novaya_CPU_na_skladAction, SIGNAL(triggered()), SLOT(novaya_CPU_na_sklad())); |
+ connect(novaya_HDD_na_skladAction, SIGNAL(triggered()), SLOT(novaya_HDD_na_sklad())); |
+ connect(novaya_CD_DVD_na_skladAction, SIGNAL(triggered()), SLOT(novaya_CD_DVD_na_sklad())); |
+ connect(novaya_VIDEO_na_skladAction, SIGNAL(triggered()), SLOT(novaya_VIDEO_na_sklad())); |
+ connect(novaya_SoundCard_na_skladAction, SIGNAL(triggered()), SLOT(novaya_SoundCard_na_sklad())); |
+ connect(novaya_LAN_na_skladAction, SIGNAL(triggered()), SLOT(novaya_LAN_na_sklad())); |
+ connect(novaya_SYSTEM_BLOCK_na_skladAction, SIGNAL(triggered()), SLOT(novaya_SYSTEM_BLOCK_na_sklad())); |
+ |
+ connect(peredat_sys_block_pod_otveystvennostAction, SIGNAL(triggered()), SLOT(peredat_sys_block_pod_otveystvennost())); |
+ |
+ connect(sozdat_otdelAction, SIGNAL(triggered()), SLOT(addNewOtdel())); |
+ |
+ |
+ connect(metaDataAction, SIGNAL(triggered()), SLOT(editTreeWidget())); |
+ connect(addMemoryAction, SIGNAL(triggered()), SLOT(addNewMemory())); |
+ connect(MB_na_skladAction, SIGNAL(triggered()), SLOT(move_to_sklad())); |
+ connect(new_sotrydnikAction, SIGNAL(triggered()), SLOT(new_sotrydnik())); |
+ connect(novoe_oborydovanieAction, SIGNAL(triggered()), SLOT(novoe_oborydovanie())); |
+ connect(pereimenovat_otdelAction, SIGNAL(triggered()), SLOT(pereimenovft_otdel())); |
+ connect(yvolit_sotrydnikaAction, SIGNAL(triggered()), SLOT(yvolit_sotrydnika())); |
+ connect(naznachit_otvetstvennim_za_oborydovanieAction, SIGNAL(triggered()), SLOT(naznachit_otvetstvennim_za_oborydovanie())); |
+ connect(ystanovit_novie_complektyushieAction, SIGNAL(triggered()), SLOT(ystanovit_novie_complektyushie())); |
+ treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); |
+ connect(openBaseAct, SIGNAL(triggered()), this, SLOT(openBase())); |
+ connect(openMemoryTableAct, SIGNAL(triggered()), this, SLOT(openMemoryTable())); |
+ connect(getsettingAct, SIGNAL(triggered()), this, SLOT(getSetting())); |
+ connect(addStringAct, SIGNAL(triggered()), this, SLOT(addString())); |
+ connect(delStringAct, SIGNAL(triggered()), this, SLOT(delString())); |
+ connect(FiltrButton, SIGNAL(clicked()), this, SLOT(filter())); |
+ connect(hiddenButton, SIGNAL(clicked()), this, SLOT(hiddenRow())); |
+ connect(showButton, SIGNAL(clicked()), this, SLOT(showRow())); |
+ connect(appyButton, SIGNAL(clicked()), this, SLOT(dbUpdate())); |
+ connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem *item, int column)), this, SLOT(dblClick(QTreeWidgetItem *item, int column))); |
+ connect(&addmemFrm, SIGNAL(componentAdd()), this, SLOT(refreshTree()));//ïðè çàêðûòèè ôîðìû addmemFrm îáíîâëÿåì treeWidget |
+ connect(&addotdelFrm, SIGNAL(componentAdd()), this, SLOT(refreshTree()));//ïðè çàêðûòèè ôîðìû addotdelFrm îáíîâëÿåì treeWidget |
+ connect(&addsotrydnikFrm, SIGNAL(componentAdd()), this, SLOT(refreshTree()));//ïðè çàêðûòèè ôîðìû addsotFrm îáíîâëÿåì treeWidget |
+ connect(&addsysblockFrm, SIGNAL(componentAdd()), this, SLOT(refreshTree()));//ïðè çàêðûòèè ôîðìû addsysblockFrm îáíîâëÿåì treeWidget |
+ |
+ connect(&addmemFrm, SIGNAL(formClose()), this, SLOT(on_addmemoryForm_formClose())); |
+ connect(&addotdelFrm, SIGNAL(formClose()), this, SLOT(on_addmemoryForm_formClose())); |
+ connect(&addsotrydnikFrm, SIGNAL(formClose()), this, SLOT(on_addmemoryForm_formClose())); |
+ connect(&addsysblockFrm, SIGNAL(formClose()), this, SLOT(on_addmemoryForm_formClose())); |
+ |
+ connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput())); |
+ |
+ comp_icon.addFile("./pc.png"); |
+///// hdd_icon.addFile("./gnome-dev-harddisk.png"); |
+ hdd_icon.addFile("./hdd5.png"); |
+ memory_icon.addFile("./memory1.png"); |
+ cd_dvd_icon.addFile("./cd_dvd3.png"); |
+// memory_icon.addFile("./gnome-dev-memory.png"); |
+ matheboard_icon.addFile("./icon_motherboard.png"); |
+ cpu_icon.addFile("./cpu3.png"); |
+ vidio_card_icon.addFile("./vidiocard2.png"); |
+ sound_card_icon.addFile("./soundcard1.png"); |
+ lan_card_icon.addFile("./lan1.png"); |
+ appyButton->setIcon(comp_icon); |
+ wmiFrm.show(); |
+///// for (int i = 0; i < 10; ++i) |
+///// items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); |
+///// treeWidget->insertTopLevelItems(0, items); |
+//////items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(tr("ÑÃÑÕÌ: %1")).arg(0)))); |
+/////////items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(tr("ÑÃÑÕÌ:"))))); |
+/////////items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(tr("ÇÀÎ:"))))); |
+/////////treeWidget->insertTopLevelItems(0, items); |
+ |
+//->itm = new QTreeWidgetItem(treeWidget); |
+//->itm->setText(0, tr("ÑÃÑÕÌ")); |
+/////////itm->setText(1, "hello1"); |
+//->QTreeWidgetItem *itm1 = new QTreeWidgetItem(itm); |
+//->itm1->setText(1, tr("M1")); |
+//->QTreeWidgetItem *itm1_1 = new QTreeWidgetItem(itm1); |
+//->itm1_1->setText(2, tr("Þð÷åíêî")); |
+//->QTreeWidgetItem *itm1_2 = new QTreeWidgetItem(itm1); |
+//->itm1_2->setText(2, tr("Þøêîâ")); |
+ |
+//->QTreeWidgetItem *itm2 = new QTreeWidgetItem(itm); |
+//->itm2->setText(1, tr("M2")); |
+//////treeWidget->insertTopLevelItem(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(tr("ÑÃÑÕÌ:"))))); |
+} |
+ |
+MainWindowImpl::~MainWindowImpl() |
+{ |
+ db.close(); |
+ delete pdb; |
+// delete setFrm; |
+} |
+ |
+ |
+void MainWindowImpl::delString() |
+{ |
+ QModelIndex index; |
+ int column, row; |
+ QSqlRecord record; |
+ index=view.currentIndex(); |
+ column=view.currentIndex().column(); |
+ row=view.currentIndex().row(); |
+ record = model->record(row); |
+ int UserNameIndex = record.indexOf(tr("Ïîëüçîâàòåëü")); |
+ QString ls_UserName=record.value(UserNameIndex).toString(); |
+ model->removeRows(row, 1); |
+} |
+ |
+// |
+void MainWindowImpl::openBase() |
+{ |
+ lineEdit->insert(tr("Îòêðûòü áàçó ")); |
+// db = new QSqlDatabase("QMYSQL"); |
+ db = QSqlDatabase::addDatabase("QMYSQL"); |
+ pdb = &db; |
+ raportFrm.pdb = &db; |
+// db->addDatabase("QMYSQL"); |
+//db = QSqlDatabase::addDatabase("QSQLITE"); |
+ pdb->setHostName(hostName); |
+ pdb->setDatabaseName(baseName); |
+ pdb->setUserName(userName); |
+ pdb->setPassword(password); |
+ bool ok = pdb->open(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ pdb->lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ if (ok) |
+ {lineEdit-> insert(tr("Áàçà óñïåøíî îòêðûòà")); |
+ } |
+ else {lineEdit-> insert(tr("Áàçà íåäîñòóïíà. Êîä îøèáêè: ")); |
+ lineEdit-> insert(pdb->lastError().text()); |
+ } |
+// QSqlQuery q; |
+// q.prepare(tr("set NAMES cp1251")); |
+ |
+// ok = q.exec(); |
+ model = new QSqlTableModel(this); |
+ model->setTable(tableName); |
+// model->setQuery(tr("select Ïðîèçâîäèòåëü, Ìîäåëü, Òèï, Îáúåì from memory")); |
+ |
+ //*** model->setEditStrategy(QSqlTableModel::OnFieldChange); |
+ model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ model->setSort(0, Qt::AscendingOrder); |
+ // model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'")); |
+ model->select(); |
+// model->setHeaderData(0, Qt::Horizontal, |
+// QObject::tr("Èìÿ\nïîëüçîâàòåëÿ")); |
+// model->setHeaderData(1, Qt::Horizontal, |
+// QObject::tr("Îòäåë")); |
+// model->setHeaderData(2, Qt::Horizontal, |
+// QObject::tr("IP àäðåñ")); |
+// model->setHeaderData(3, Qt::Horizontal, |
+// QObject::tr("Èíâåíòàííûé\níîìåð")); |
+// model->setHeaderData(4, Qt::Horizontal, |
+// QObject::tr("Îïåðàöèîííàÿ\nñèñòåìà")); |
+// view = new QTableView(); |
+ |
+ QSqlField field(tr("age"), QVariant::Int); |
+ field.setValue(QString(tr("123"))); |
+ |
+ bool okey; |
+ int index; |
+ QSqlRecord record; |
+ // record = model->record(); |
+ // record.append(field); |
+ // model->setRecord(0,record); |
+ // */ |
+ // model->record().append(field); |
+ // // // model->insertColumn(1); |
+ // // // model->setHeaderData(1, Qt::Horizontal, tr("Òåñò")); |
+ //, model->index(0,0)); |
+ /// model->setData(model->index(1,1), "12345"); |
+ tableView->setModel(model); |
+ view.setModel(model); |
+ //QItemDelegate mydelegate = new QItemDelegate (); |
+ // view.setItemDelegateForColumn(2, mydelegate); |
+ |
+ tableView->setAlternatingRowColors(true); |
+ view.setAlternatingRowColors(true); |
+ |
+ tableView->resizeColumnsToContents(); |
+ |
+// view->resizeRowsToContents(); |
+ view.resizeColumnsToContents(); |
+ |
+ tableView->show(); |
+ // tableView->hideColumn(0); |
+ // tableView->hideColumn(5); |
+ // tableView->hideColumn(6); |
+ |
+ view.show(); |
+ // view.hideColumn(0); |
+ |
+ // view.hideColumn(5); |
+ // view.hideColumn(6); |
+ |
+ |
+ initTreeWidget(); |
+} |
+ |
+void MainWindowImpl::openMemoryTable() |
+{ |
+ memory_model = new QSqlTableModel(); |
+ memory_model->setTable(tr("Ïàìÿòü")); |
+// memory_model->setTable(tableName); |
+ memory_model->setEditStrategy(QSqlTableModel::OnFieldChange); |
+// model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ memory_model->setSort(0, Qt::AscendingOrder); |
+ memory_model->select(); |
+ tableView->setModel(memory_model); |
+ tableView->setAlternatingRowColors(true); |
+ tableView->resizeColumnsToContents(); |
+ tableView->show(); |
+///// memory_view.setModel(memory_model); |
+///// memory_view.setAlternatingRowColors(true); |
+// view->resizeRowsToContents(); |
+///// memory_view.resizeColumnsToContents(); |
+///// memory_view.show(); |
+} |
+ |
+ |
+void MainWindowImpl::applySetting() |
+{ |
+ int i; |
+ i=5; |
+ lineEdit->insert(tr("Íàñòðîéêè ïîëó÷åíû!")); |
+ baseName = setFrm->lineEdit->text(); |
+ userName = setFrm->lineEdit_2->text(); |
+ password = setFrm->lineEdit_3->text(); |
+ tableName = setFrm->lineEdit_4->text(); |
+ hostName = setFrm->lineEdit_5->text(); |
+ i+=1; |
+ writeSettings(); |
+ setFrm->close(); |
+ delete setFrm; |
+} |
+ |
+void MainWindowImpl::writeSettings() |
+{ |
+ QSettings settings("Trolltech", "Application Example"); |
+ settings.setValue("baseName", baseName); |
+ settings.setValue("userName", userName); |
+ settings.setValue("password", password); |
+ settings.setValue("tableName", tableName); |
+ settings.setValue("hostName", hostName); |
+} |
+ |
+ |
+void MainWindowImpl::readSettings() |
+{ |
+ QSettings settings("Trolltech", "Application Example"); |
+ baseName = settings.value("baseName", "an_db").toString(); |
+ userName = settings.value("userName", "an").toString(); |
+ password = settings.value("password", "393939").toString(); |
+ tableName = settings.value("tableName", "inventar").toString(); |
+ hostName = settings.value("hostName", "server").toString(); |
+// resize(size); |
+// move(pos);tableName |
+} |
+ |
+void MainWindowImpl::getSetting() |
+{ |
+ setFrm = new settingForm; |
+ connect(setFrm->pushButton, SIGNAL(clicked()), this, SLOT(applySetting())); |
+ setFrm->lineEdit->setText(baseName); |
+ setFrm->lineEdit_2->setText(userName); |
+ setFrm->lineEdit_3->setText(password); |
+ setFrm->lineEdit_4->setText(tableName); |
+ setFrm->lineEdit_5->setText(hostName); |
+ setFrm->show(); |
+ |
+ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::addString() |
+{ |
+ QString query_begin=(tr("INSERT INTO ")); |
+// QString query_end=(tr(" VALUES('íå çàäàíî','íå çàäàíî','íå çàäàíî','íå çàäàíî',default)")); |
+ QString query_end=(tr(" VALUES()")); |
+ query_begin.append(tableName); |
+ query_begin.append(query_end); |
+ QSqlQuery query; |
+ query.prepare(query_begin); |
+// query.prepare(tr("INSERT INTO inventar VALUES('íå çàäàíî','íå çàäàíî','íå çàäàíî','íå çàäàíî',default)")); |
+// query.bindValue(":tab", "inventar"); |
+// if (!query.execBatch()) |
+// qDebug() << query.lastError(); |
+ query.exec(); |
+ model->select(); |
+// view->close(); |
+ view.setModel(model); |
+ //view->show(); |
+ lineEdit->insert(tr("Äîáàâèòü ñòðîêó!")); |
+} |
+ |
+//Ïðîöåäóðà ïðèìèíåíèÿ ôèëòðàöèè |
+void MainWindowImpl::filter() |
+{ |
+// int i; |
+// i++; |
+ model->setFilter(tr("Ïðèìå÷àíèÿ='Ìèõàéëåíêî'")); |
+ model->select(); |
+// view->close(); |
+ view.setModel(model); |
+} |
+//TEST CVS gh |
+void MainWindowImpl::hiddenRow() |
+{ |
+ int n; |
+ for(n=0;n<20;n++) view.setRowHidden(n,true); |
+} |
+ |
+ |
+void MainWindowImpl::showRow() |
+{ |
+ int n; |
+ for(n=0;n<20;n++) view.setRowHidden(n,false); |
+} |
+ |
+void MainWindowImpl::dbUpdate() |
+{ |
+ model->submitAll(); |
+ addString(); |
+} |
+ |
+ |
+void MainWindowImpl::novaya_MB_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(3); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::novaya_HDD_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(1); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::novaya_CD_DVD_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::novaya_VIDEO_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(5); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::novaya_RAM_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(0); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::novaya_SoundCard_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(6); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::novaya_LAN_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(7); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+} |
+ |
+ |
+ |
+ |
+void MainWindowImpl::novaya_CPU_na_sklad(){ |
+ addmemFrm.tabWidget->setCurrentIndex(2); |
+ addmemFrm.pushButton->setEnabled(true); |
+ addmemFrm.show(); |
+ addmemFrm.label_7->setText(tr("Íà ñêëàä")); |
+ addNewMemory(tr("Íà ñêëàä")); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::peredat_sys_block_pod_otveystvennost(){ |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñîòðóäíèêà "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñîòðóäíèêà (äâîéíûì êëèêîì ìûøêè), êîòîðûé áóäåò îòâåòñòâåííåí çà ñèñòåìíûé áëîê.")); |
+ fEnable_naznachit_otvetstv = true; |
+ curr_sys_block_id = treeWidget-> currentItem ()->text(12); |
+} |
+ |
+ |
+ |
+void MainWindowImpl::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column) |
+{ |
+ QString tmp; |
+ tmp = item->text(3); |
+ if (tmp !=""){ |
+ addmemFrm.pushButton->setEnabled(true); |
+ } |
+ else addmemFrm.pushButton->setEnabled(false); |
+ addmemFrm.label_7->setText(tmp); |
+} |
+ |
+ |
+ |
+void MainWindowImpl::editTreeWidget() |
+{ |
+ QString inventar_num; |
+ QTreeWidgetItem * currItem; |
+ int currColomn; |
+ int top_item_index; |
+ lineEdit->insert(tr("Ðåäàêòèðîâàòü")); |
+ currItem = treeWidget->currentItem (); |
+ top_item_index = treeWidget->indexOfTopLevelItem(currItem); |
+ currColomn = treeWidget->currentColumn(); |
+ MainWindowImpl::on_treeWidget_itemClicked(currItem, 3); //âûâîäèì íîìåð ñèñòåìíèêà íà ôîðìó |
+// inventar_num = tr("Èíâ.íîì: "); |
+ inventar_num.append(currItem ->text(3)); |
+ if (currColomn == 1){ |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addmemFrm.show(); |
+ }; |
+ if (inventar_num == "") return; |
+ lineEdit->insert(currItem ->text(currColomn)); |
+ switch(currColomn) |
+ { |
+ case 1://Ñîòðóäíèêè |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addmemFrm.show(); |
+ |
+ } |
+ break; |
+ |
+ |
+ case 4: //Ïðîöåññîð |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(2); |
+ addmemFrm.show(); |
+ } |
+ break; |
+ |
+ case 5: //Ìàòåðèíñêèå ïëàòû |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(3); |
+ addmemFrm.show(); |
+ } |
+ break; |
+ |
+ case 6: //Ïàìÿòü |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(0); |
+ addNewMemory(inventar_num); |
+// addmemFrm.show(); |
+ } |
+ break; |
+ |
+ case 7: //Âèí÷åñòåð |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(1); |
+ addmemFrm.show(); |
+ } |
+ break; |
+ |
+ |
+ case 2: break; |
+ defaul: break; |
+ } |
+ addmemFrm.treeWidget->clear(); |
+// addmemFrm.initTreeWidgrt(); |
+} |
+ |
+void MainWindowImpl::initTreeWidget()//íàñòðàèâàåì âèäæåò |
+{ |
+ QStringList treeHeaders;//ñïèñîê çàãîëîâêîâ treeWidget |
+ treeWidget->setColumnCount(15); |
+ treeHeaders << tr("Îòäåëû") //0 ñòîëáåö |
+ << tr("Ïåðñîíàë") //1 ñòîëáåö |
+ << tr("Îïèñàíèå") //2 ñòîëáåö |
+ << tr("Îáîðóäîâàíèå") //3 ñòîëáåö |
+ << tr("Ïðîöåññîð") //4 ñòîëáåö |
+ << tr("Ìàòåðèíêà") //5 ñòîëáåö |
+ << tr("Ïàìÿòü") //6 ñòîëáåö |
+ << tr("Âèí÷åñòåð") //7 ñòîëáåö |
+ << tr("Ïðèâîä") //8 ñòîëáåö |
+ << tr("Âèäåîêàðòà") //9 ñòîëáåö |
+ << tr("Çâóêîâàÿ êàðòà") //10 ñòîëáåö |
+ << tr("Ñåòåâàÿ êàðòà") //11 ñòîëáåö |
+ << tr("Èäåíòèôèêàòîð") //12 ñòîëáåö |
+ << tr("Èäåíòèôèêàòîð ñèñòåíîãî áëîêà") //13 ñòîëáåö |
+ << tr("ID îòâåòñòâííîãî ëèöà"); //14 ñòîëáåö |
+ treeWidget->setHeaderLabels(QStringList (treeHeaders)); |
+// treeWidget->setColumnHidden(2, true); |
+// treeWidget->setColumnHidden(12, true); |
+// treeWidget->setColumnHidden(13, true); |
+ treeWidget->clear(); |
+ addOtdels(); |
+ treeWidget->sortItems(0, Qt::AscendingOrder); |
+} |
+ |
+void MainWindowImpl::addOtdels() |
+{ |
+ int fieldName, fieldID; |
+ QTreeWidgetItem *otdelItem; |
+ QSqlQuery q(tr("select * from otdeli"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id; |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ otdel_id = q.value(fieldID).toString(); |
+ otdelItem = new QTreeWidgetItem(treeWidget); |
+ if (otdel == tr("Ñêëàä")) { otdelItem->setText(0, otdel); |
+ otdelItem->setText(2, tr("Ñêëàä")); |
+ otdelItem->setText(12, otdel_id); |
+ SotrydnikiOtdela(otdel_id, otdelItem); |
+ continue; |
+ } |
+ otdelItem->setText(0, otdel); |
+ otdelItem->setText(2, tr("Îòäåë")); |
+ otdelItem->setText(12, otdel_id); |
+ SotrydnikiOtdela(otdel_id, otdelItem); |
+ } |
+} |
+ |
+ |
+void MainWindowImpl::SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela) // ôîðìèðóåì ñïèñîê ñîòðóäíèêîâ îòäåëà |
+{ |
+ int field_fio_sotrydnika, field_id_sotrydnika; |
+ int kolichestvo_sotrudnikov=0; |
+ QString fio_sotrydnika_otdela, id_sotrydnika_otdela, oboryd; |
+ QSqlQuery qsotrydnikiOtdela; |
+ QString sqlQueryString; |
+ QTreeWidgetItem *treeItem_sotrydnika; |
+ sqlQueryString = tr("select Èäåíòèôèêàòîð, ÔÈÎ from sotrydniki where Èäåíòèôèêàòîð_îòäåëà="); |
+ sqlQueryString.append(id_otdela); |
+ qsotrydnikiOtdela.prepare(sqlQueryString); |
+ qsotrydnikiOtdela.exec(); |
+ field_fio_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("ÔÈÎ")); |
+ field_id_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (qsotrydnikiOtdela.next()) |
+ { |
+ fio_sotrydnika_otdela = qsotrydnikiOtdela.value(field_fio_sotrydnika).toString(); |
+ id_sotrydnika_otdela = qsotrydnikiOtdela.value(field_id_sotrydnika).toString(); |
+ |
+ |
+ treeItem_sotrydnika = new QTreeWidgetItem(itemOtdela); |
+ treeItem_sotrydnika->setText(1, fio_sotrydnika_otdela ); |
+ treeItem_sotrydnika->setText(2, tr("Ñîòðóäíèê")); |
+ treeItem_sotrydnika->setText(14, id_sotrydnika_otdela ); |
+ if (id_sotrydnika_otdela == "1"){ |
+ itm_sklad_system_blocks = new QTreeWidgetItem(treeItem_sotrydnika); |
+ itm_sklad_system_blocks->setText(2, tr("ÑÈÑÒÅÌÍÛÅ ÁËÎÊÈ")); |
+ itm_sklad_orgtehnika = new QTreeWidgetItem(treeItem_sotrydnika); |
+ itm_sklad_orgtehnika->setText(2, tr("ÎÐÃÒÅÕÍÈÊÀ")); |
+ itm_sklad_orgtehnika_printers = new QTreeWidgetItem(itm_sklad_orgtehnika); |
+ itm_sklad_orgtehnika_printers->setText(2, tr("ÏÐÈÍÒÅÐÛ")); |
+ itm_sklad_orgtehnika_mfy = new QTreeWidgetItem(itm_sklad_orgtehnika); |
+ itm_sklad_orgtehnika_mfy->setText(2, tr("ÌÔÓ")); |
+ itm_sklad_komplectyushie = new QTreeWidgetItem(treeItem_sotrydnika); |
+ itm_sklad_komplectyushie->setText(2, tr("ÊÎÌÏËÅÊÒÓÞÙÈÅ")); |
+ itm_sklad_orgtehnika_scaners = new QTreeWidgetItem(itm_sklad_orgtehnika); |
+ itm_sklad_orgtehnika_scaners->setText(2, tr("ÑÊÀÍÅÐÛ")); |
+ itm_sklad_rashodniki = new QTreeWidgetItem(treeItem_sotrydnika); |
+ itm_sklad_rashodniki->setText(2, tr("ÐÀÑÕÎÄÍÛÅ ÌÀÒÅÐÈÀËÛ")); |
+ } |
+ oboryd = oborydovanie(id_sotrydnika_otdela, treeItem_sotrydnika); |
+// treeItem_sotrydnika->setText(3, oboryd ); |
+ ++kolichestvo_sotrudnikov; |
+ } |
+ itemOtdela->setText(13, QVariant(kolichestvo_sotrudnikov).toString()); |
+} |
+ |
+QString MainWindowImpl::oborydovanie(QString id_sotrydnika, QTreeWidgetItem * itemSotrydnika){ |
+ QString result, prResult; |
+ QString sqlQueryText; |
+ QString serial_num, inventar_num, proizvoditel, model, system_block_id; |
+ QSqlQuery quer; |
+ QString MB_information, Memory_information, CPU_information, HDD_information, CD_DVD_information, Vidio_information; |
+ QString Sound_card_information, Lan_card_information; |
+ int field_serialNum, field_inventarNum, field_proizvoditel, field_model, field_system_block_id; |
+// QSqlQuery qns(tr("SET NAMES utf8"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QTreeWidgetItem *itemSysBlock; |
+// sqlQueryText.reserve(300); |
+ sqlQueryText = tr("select system_blocks.Ñåðèéíûé_íîìåð, system_blocks.Èíâåíòàðíûé_íîìåð, system_blocks.Èäåíòèôèêàòîð" |
+ " from system_blocks" |
+ " where system_blocks.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà ="); |
+ sqlQueryText.append(id_sotrydnika); |
+// sqlQueryText.append(tr(" AND Ìàòåðèíñêèå_ïëàòû.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð")); |
+ quer.prepare(sqlQueryText); |
+// quer.prepare(tr("select Ñèñòåìíûå_áëîêè.Ñåðèéíûé_íîìåð, Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð,Ìàòåðèíñêèå_ïëàòû.Ïðîèçâîäèòåëü, Ìàòåðèíñêèå_ïëàòû.Ìîäåëü from Ñèñòåìíûå_áëîêè,Ìàòåðèíñêèå_ïëàòû where Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà = 4 AND Ìàòåðèíñêèå_ïëàòû.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð;")); |
+ quer.exec(); |
+ field_serialNum = quer.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventarNum = quer.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_system_block_id = quer.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+// field_proizvoditel = quer.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+// field_model = quer.record().indexOf(tr("Ìîäåëü")); |
+ while(quer.next()){ |
+ system_block_id = quer.value(field_system_block_id).toString(); //èäåíòèôèêàòîð ñèñòåìíîãî áëîêà |
+ prResult = ""; |
+ serial_num = quer.value(field_serialNum).toString(); |
+ inventar_num = quer.value(field_inventarNum).toString(); |
+//// if (serial_num != "") {prResult.append(tr("s/n: ")); |
+//// prResult.append(serial_num);} |
+ if (inventar_num != "") { |
+//// prResult.append(tr(" èíâ.íîì: ")); |
+ prResult.append(inventar_num); |
+//// prResult.append(tr(" ")); |
+} |
+ |
+// result.append(q.value(field_proizvoditel).toString()); |
+// result.append(tr(" ")); |
+// result.append(q.value(field_model).toString()); |
+ |
+ |
+ |
+ |
+ |
+// if (id_sotrydnika == "1" & system_block_id == "1") itemSysBlock->setText(2, tr("Êîìïëåêòóþùèå"));// ýòî ñêëàä |
+ if (id_sotrydnika == "1" && system_block_id == "1") itemSysBlock = itm_sklad_komplectyushie;// ýòî ñêëàä |
+ else if (id_sotrydnika == "1" ){ |
+ itemSysBlock = new QTreeWidgetItem(itm_sklad_system_blocks); // íà ñêëàä ñèñòåìíèê |
+ itemSysBlock->setText(2, tr("Ñèñòåìíûé áëîê")); |
+ itemSysBlock->setIcon(3, comp_icon); |
+ if (system_block_id !="") itemSysBlock->setText(12, system_block_id); |
+ if (id_sotrydnika !="") itemSysBlock->setText(14, id_sotrydnika); |
+ } |
+ |
+ else { |
+ itemSysBlock = new QTreeWidgetItem(itemSotrydnika); |
+ itemSysBlock->setText(2, tr("Ñèñòåìíûé áëîê")); |
+ itemSysBlock->setIcon(3, comp_icon); |
+ if (system_block_id !="") itemSysBlock->setText(12, system_block_id); |
+ if (id_sotrydnika !="") itemSysBlock->setText(14, id_sotrydnika); |
+ |
+ } |
+ |
+ MB_information = addMatheBoardInformation (id_sotrydnika, system_block_id, itemSysBlock); //ïîëó÷àåì èíôîðìàöèþ î ìàòåðèíñêîé ïëàòå |
+//// prResult.append(MB_information); |
+ Memory_information = addMemoryInformation(id_sotrydnika, system_block_id, itemSysBlock); //ïîëó÷àåì èíôîðìàöèþ î ïàìÿòè |
+//// prResult.append(Memory_information); |
+ CPU_information = addCpuInformation(id_sotrydnika, system_block_id, itemSysBlock); |
+//// prResult.append(CPU_information); |
+ HDD_information = addHDDInformation(id_sotrydnika, system_block_id, itemSysBlock); |
+//// prResult.append(HDD_information); |
+ CD_DVD_information = add_CD_DVD_Information(id_sotrydnika, system_block_id, itemSysBlock); |
+//// prResult.append(CD_DVD_information); |
+ Vidio_information = add_Vidio_Information(id_sotrydnika, system_block_id, itemSysBlock); |
+ Sound_card_information = add_Sound_Card_Information(id_sotrydnika, system_block_id, itemSysBlock); |
+ Lan_card_information = add_Lan_Card_Information(id_sotrydnika, system_block_id, itemSysBlock); |
+ if (system_block_id != "1"){ |
+ |
+ itemSysBlock->setText(3, prResult); |
+ result.append(prResult); |
+} |
+ |
+ |
+ } |
+ return result; |
+} |
+ |
+QString MainWindowImpl::addMatheBoardInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString MB_proizvoditel, MB_model, MB_identifikator, MB_serial_num, MB_inventar_num; |
+ QString MatheBoardSqlQueryText; |
+ QSqlQuery MatheBoardQuery; |
+ int field_proizvoditel, field_model, field_identifikator, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *itemMB, *itmMB_block; |
+ MatheBoardSqlQueryText = tr("select * " |
+ " from matheboards where matheboards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ MatheBoardSqlQueryText.append(id_systemBlock); |
+ MatheBoardQuery.prepare(MatheBoardSqlQueryText); |
+ MatheBoardQuery.exec(); |
+ field_identifikator = MatheBoardQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = MatheBoardQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = MatheBoardQuery.record().indexOf(tr("Ìîäåëü")); |
+ field_serial_num = MatheBoardQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = MatheBoardQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itmMB_block = new QTreeWidgetItem(itm_sklad_komplectyushie); |
+ itmMB_block->setText(2, tr("ÌÀÒÅÐÈÍÑÊÈÅ ÏËÀÒÛ")); |
+// itmMB_block->setIcon(3, matheboard_icon); |
+ } |
+ |
+ while(MatheBoardQuery.next()){ |
+ tmp = ""; |
+ MB_identifikator = MatheBoardQuery.value(field_identifikator).toString(); |
+ MB_proizvoditel = MatheBoardQuery.value(field_proizvoditel).toString(); |
+ MB_model = MatheBoardQuery.value(field_model).toString(); |
+ MB_serial_num = MatheBoardQuery.value(field_serial_num).toString(); |
+ MB_inventar_num = MatheBoardQuery.value(field_inventar_num).toString(); |
+ |
+ if (MB_proizvoditel != "") { |
+// tmp.append(tr("MB: ")); |
+ tmp.append(MB_proizvoditel); |
+ } |
+ if (MB_model != "") {tmp.append(tr(" ")); |
+ tmp.append(MB_model); |
+ tmp.append(tr(" "));} |
+ result.append(tmp); |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1") {itemMB = new QTreeWidgetItem(itmMB_block); |
+ } |
+ else itemMB = new QTreeWidgetItem(itemSysBlock); |
+ itemMB->setIcon(4, matheboard_icon); |
+ itemMB->setText(4, tmp); |
+ itemMB->setText(12, MB_identifikator); |
+ itemMB->setText(13, id_systemBlock); |
+ itemMB->setText(14, id_otvetstvennogo_lica); |
+ itemMB->setText(2, tr("Ìàòåðèíñêàÿ ïëàòà")); |
+ itemMB->setText(3, MB_inventar_num); |
+ if (id_systemBlock !="1") itemSysBlock->setText(5, tmp); |
+ |
+ } |
+ return result; |
+} |
+ |
+ |
+QString MainWindowImpl::addMemoryInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString Memiry_id, Memory_proizvoditel, Memory_type, Memory_obem, Memory_inventar_num, Memory_serial_num; |
+ QString MemorySqlQueryText; |
+ QSqlQuery MemoryQuery; |
+ int field_proizvoditel, field_type, field_obem, field_id, field_inventar_num, field_sereal_num; |
+ QTreeWidgetItem *itemMemory, *itemMemory_block; |
+ MemorySqlQueryText = tr("select memory.* " |
+ " from memory where memory.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ MemorySqlQueryText.append(id_systemBlock); |
+ MemoryQuery.prepare(MemorySqlQueryText); |
+ MemoryQuery.exec(); |
+ field_id = MemoryQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = MemoryQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_type = MemoryQuery.record().indexOf(tr("Òèï")); |
+ field_obem = MemoryQuery.record().indexOf(tr("Îáúåì")); |
+ field_inventar_num = MemoryQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_sereal_num = MemoryQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemMemory_block = new QTreeWidgetItem(itm_sklad_komplectyushie); |
+ itemMemory_block->setText(2, tr("ÌÎÄÓËÈ ÏÀÌßÒÈ")); |
+ } |
+ while(MemoryQuery.next()){ |
+// tmp = tr("RAM: "); |
+ tmp = tr(""); |
+ Memiry_id = MemoryQuery.value(field_id).toString(); |
+ Memory_proizvoditel = MemoryQuery.value(field_proizvoditel).toString(); |
+ Memory_type = MemoryQuery.value(field_type).toString(); |
+ Memory_obem = MemoryQuery.value(field_obem).toString(); |
+ Memory_inventar_num = MemoryQuery.value(field_inventar_num).toString(); |
+ Memory_serial_num = MemoryQuery.value(field_sereal_num).toString(); |
+//// if (Memory_proizvoditel != "") { |
+//// tmp.append(Memory_proizvoditel);} |
+ if (Memory_type != "") {tmp.append(tr(" ")); |
+ tmp.append(Memory_type); |
+ tmp.append(tr(" "));} |
+ if (Memory_obem != "") {tmp.append(tr(" ")); |
+ tmp.append(Memory_obem); |
+ tmp.append(tr("MB; "));} |
+ result.append(tmp); |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemMemory = new QTreeWidgetItem(itemMemory_block); |
+ } |
+ else itemMemory = new QTreeWidgetItem(itemSysBlock); |
+ itemMemory->setIcon(4, memory_icon); |
+ itemMemory->setText(4, tmp); |
+ |
+ itemMemory->setText(2, tr("Ìîäóëü ïàìÿòè")); |
+ itemMemory->setText(12, Memiry_id); |
+ itemMemory->setText(13, id_systemBlock); |
+ itemMemory->setText(14, id_otvetstvennogo_lica); |
+ itemMemory->setText(3, Memory_inventar_num); |
+ |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(6, result); |
+ return result; |
+} |
+ |
+ |
+QString MainWindowImpl::addCpuInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString CPU_id, CPU_proizvoditel, CPU_slot, CPU_fqr, CPU_inventar_num, CPU_serial_num; |
+ QString CpuSqlQueryText; |
+ QSqlQuery CpuQuery; |
+ int field_id, field_proizvoditel, field_slot, field_fqr, field_inventar_num, field_serial_num; |
+ QTreeWidgetItem *itemCpu, *itemCpu_block; |
+ CpuSqlQueryText = tr("select processors.* " |
+ " from processors where processors.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ CpuSqlQueryText.append(id_systemBlock); |
+ CpuQuery.prepare(CpuSqlQueryText); |
+ CpuQuery.exec(); |
+ field_id = CpuQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = CpuQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_slot = CpuQuery.record().indexOf(tr("Ñëîò")); |
+ field_fqr = CpuQuery.record().indexOf(tr("×àñòîòà")); |
+ field_inventar_num = CpuQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = CpuQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemCpu_block = new QTreeWidgetItem(itemSysBlock); |
+ itemCpu_block->setText(2, tr("ÏÐÎÖÅÑÑÎÐÛ")); |
+ itemCpu_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ |
+ while(CpuQuery.next()){ |
+// tmp = tr("CPU: "); |
+ tmp = tr(""); |
+ CPU_id = CpuQuery.value(field_id).toString(); |
+ CPU_proizvoditel = CpuQuery.value(field_proizvoditel).toString(); |
+ CPU_slot = CpuQuery.value(field_slot).toString(); |
+ CPU_fqr = CpuQuery.value(field_fqr).toString(); |
+ CPU_inventar_num = CpuQuery.value(field_inventar_num).toString(); |
+ CPU_serial_num = CpuQuery.value(field_serial_num).toString(); |
+ |
+ if (CPU_proizvoditel != "") { |
+ tmp.append(CPU_proizvoditel);} |
+// if (CPU_slot != "") {tmp.append(tr(" ")); |
+// tmp.append(CPU_slot); |
+// tmp.append(tr(" "));} |
+ if (CPU_fqr != "") {tmp.append(tr(" ")); |
+ tmp.append(CPU_fqr); |
+ tmp.append(tr("MGz "));} |
+ result.append(tmp); |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemCpu = new QTreeWidgetItem(itemCpu_block); |
+ } |
+ else itemCpu = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// itemCpu = new QTreeWidgetItem(itemSysBlock); |
+ itemCpu->setText(2, tr("Ïðîöåññîð")); |
+ itemCpu->setText(12, CPU_id); |
+ itemCpu->setText(13, id_systemBlock); |
+ itemCpu->setText(14, id_otvetstvennogo_lica); |
+ |
+ itemCpu->setIcon(4, cpu_icon); |
+ itemCpu->setText(4, tmp); |
+ |
+ itemCpu->setText(3, CPU_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(4, tmp); |
+ return result; |
+} |
+ |
+QString MainWindowImpl::addHDDInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString HDD_id, HDD_proizvoditel, HDD_interfeis, HDD_obem, HDD_inventar_num, HDD_serial_num; |
+ QString HDDSqlQueryText; |
+ QSqlQuery HDDQuery; |
+ int field_id, field_proizvoditel, field_interfeis, field_obem, field_inventar_num, field_serial_num; |
+ QTreeWidgetItem *itemHDD; |
+ QTreeWidgetItem *itemHDD_block; |
+ HDDSqlQueryText = tr("select harddiscs.* " |
+ " from harddiscs where harddiscs.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ HDDSqlQueryText.append(id_systemBlock); |
+ HDDQuery.prepare(HDDSqlQueryText); |
+ HDDQuery.exec(); |
+ field_id = HDDQuery.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = HDDQuery.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_interfeis = HDDQuery.record().indexOf(tr("Èíòåðôåéñ")); |
+ field_obem = HDDQuery.record().indexOf(tr("Îáúåì")); |
+ field_inventar_num = HDDQuery.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = HDDQuery.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemHDD_block = new QTreeWidgetItem(itemSysBlock); |
+ itemHDD_block->setText(2, tr("ÂÈÍ×ÅÑÒÅÐÛ")); |
+ itemHDD_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ |
+ while(HDDQuery.next()){ |
+// tmp = tr("HDD: "); |
+ tmp = tr(""); |
+ HDD_id = HDDQuery.value(field_id).toString(); |
+ HDD_proizvoditel = HDDQuery.value(field_proizvoditel).toString(); |
+ HDD_interfeis = HDDQuery.value(field_interfeis).toString(); |
+ HDD_obem = HDDQuery.value(field_obem).toString(); |
+ HDD_inventar_num = HDDQuery.value(field_inventar_num).toString(); |
+ HDD_serial_num = HDDQuery.value(field_serial_num).toString(); |
+ if (HDD_proizvoditel != "") { |
+ tmp.append(HDD_proizvoditel);} |
+ if (HDD_interfeis != "") {tmp.append(tr(" ")); |
+ tmp.append(HDD_interfeis); |
+ tmp.append(tr(" "));} |
+ if (HDD_obem != "") {tmp.append(tr(" ")); |
+ tmp.append(HDD_obem); |
+ tmp.append(tr("GB; "));} |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ itemHDD = new QTreeWidgetItem(itemHDD_block); |
+ } |
+ else itemHDD = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// itemHDD = new QTreeWidgetItem(itemSysBlock); |
+ |
+ itemHDD->setText(2, tr("Æåñòêèé äèñê")); |
+ itemHDD->setText(12, HDD_id); |
+ itemHDD->setText(13, id_systemBlock); |
+ itemHDD->setText(14, id_otvetstvennogo_lica); |
+ |
+ itemHDD->setIcon(4, hdd_icon); |
+ itemHDD->setText(4, tmp); |
+ itemHDD->setText(3, HDD_inventar_num); |
+ } |
+// if (result!="") itemSysBlock->setIcon(7, hdd_icon); |
+ if (id_systemBlock !="1") itemSysBlock->setText(7, result); |
+ return result; |
+} |
+ |
+QString MainWindowImpl::add_CD_DVD_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock) |
+{ |
+ QString result, tmp; |
+ QString CD_DVD_id, CD_DVD_proizvoditel, CD_DVD_type, CD_DVD_speed, CD_DVD_serial_num, CD_DVD_inventar_num; |
+ QString CD_DVD_SqlQueryText; |
+ QSqlQuery CD_DVD_Query; |
+ int field_id, field_proizvoditel, field_type, field_speed, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *item_CD_DVD; |
+ QTreeWidgetItem *item_CD_DVD_block; |
+ CD_DVD_SqlQueryText = tr("select cd_dvd.* " |
+ " from cd_dvd where cd_dvd.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ CD_DVD_SqlQueryText.append(id_systemBlock); |
+ CD_DVD_Query.prepare(CD_DVD_SqlQueryText); |
+ CD_DVD_Query.exec(); |
+ field_id = CD_DVD_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = CD_DVD_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_type = CD_DVD_Query.record().indexOf(tr("Òèï")); |
+ field_speed = CD_DVD_Query.record().indexOf(tr("Ñêîðîñòü")); |
+ field_inventar_num = CD_DVD_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = CD_DVD_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_CD_DVD_block = new QTreeWidgetItem(itemSysBlock); |
+ item_CD_DVD_block->setText(2, tr("ÏÐÈÂÎÄÛ")); |
+ item_CD_DVD_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ |
+ while(CD_DVD_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ CD_DVD_id = CD_DVD_Query.value(field_id).toString(); |
+ CD_DVD_proizvoditel = CD_DVD_Query.value(field_proizvoditel).toString(); |
+ CD_DVD_type = CD_DVD_Query.value(field_type).toString(); |
+ CD_DVD_speed = CD_DVD_Query.value(field_speed).toString(); |
+ CD_DVD_serial_num = CD_DVD_Query.value(field_serial_num).toString(); |
+ CD_DVD_inventar_num = CD_DVD_Query.value(field_inventar_num).toString(); |
+ |
+ if (CD_DVD_type != "") { |
+ tmp.append(CD_DVD_type);} |
+ if (CD_DVD_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(CD_DVD_proizvoditel); |
+ tmp.append(tr(" "));} |
+ if (CD_DVD_speed != "") {tmp.append(tr(" ")); |
+ tmp.append(CD_DVD_speed); |
+ tmp.append(tr(" "));} |
+ result.append(tmp); |
+ |
+if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_CD_DVD = new QTreeWidgetItem(item_CD_DVD_block); |
+ } |
+ else item_CD_DVD = new QTreeWidgetItem(itemSysBlock); |
+ |
+ item_CD_DVD->setText(2, tr("Ïðèâîä")); |
+ item_CD_DVD->setText(12, CD_DVD_id); |
+ item_CD_DVD->setText(13, id_systemBlock); |
+ item_CD_DVD->setText(14, id_otvetstvennogo_lica); |
+ item_CD_DVD->setIcon(4, cd_dvd_icon); |
+ item_CD_DVD->setText(4, tmp); |
+ item_CD_DVD->setText(3, CD_DVD_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(8, result); |
+ return result; |
+} |
+ |
+QString MainWindowImpl::add_Vidio_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock){ |
+ |
+ QString result, tmp; |
+ QString Vidio_id, Vidio_proizvoditel, Vidio_model, Vidio_interfeis, Vidio_ram, Vidio_inventar_num, Vidio_sereal_num; |
+ QString Vidio_SqlQueryText; |
+ QSqlQuery Vidio_Query; |
+ int field_id, field_proizvoditel, field_model, field_interfeis, field_ram, field_inventar_num, field_sereal_num; |
+ QTreeWidgetItem *item_Vidio, *item_Vidio_block; |
+ Vidio_SqlQueryText = tr("select videocards.* " |
+ " from videocards where videocards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Vidio_SqlQueryText.append(id_systemBlock); |
+ Vidio_Query.prepare(Vidio_SqlQueryText); |
+ Vidio_Query.exec(); |
+ field_id = Vidio_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Vidio_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Vidio_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_interfeis = Vidio_Query.record().indexOf(tr("Èíòåðôåéñ")); |
+ field_ram = Vidio_Query.record().indexOf(tr("Ïàìÿòü")); |
+ field_inventar_num = Vidio_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_sereal_num = Vidio_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Vidio_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Vidio_block->setText(2, tr("ÂÈÄÅÎÊÀÐÒÛ")); |
+ item_Vidio_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ |
+ |
+ while(Vidio_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Vidio_id = Vidio_Query.value(field_id).toString(); |
+ Vidio_proizvoditel = Vidio_Query.value(field_proizvoditel).toString(); |
+ Vidio_model = Vidio_Query.value(field_model).toString(); |
+ Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+ Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ Vidio_inventar_num = Vidio_Query.value(field_inventar_num).toString(); |
+ Vidio_sereal_num = Vidio_Query.value(field_sereal_num).toString(); |
+ if (Vidio_interfeis != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_interfeis);} |
+ if (Vidio_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_proizvoditel);} |
+ if (Vidio_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Vidio_model);} |
+ |
+ if (Vidio_ram !=""){tmp.append(tr(" ")); |
+ tmp.append(Vidio_ram); |
+ tmp.append(tr(" Mb")); |
+ |
+ } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Vidio = new QTreeWidgetItem(item_Vidio_block); |
+ } |
+ else item_Vidio = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// item_Vidio = new QTreeWidgetItem(itemSysBlock); |
+ |
+ item_Vidio->setText(2, tr("Âèäåîêàðòà")); |
+ item_Vidio->setText(12, Vidio_id); |
+ item_Vidio->setText(13, id_systemBlock); |
+ item_Vidio->setText(14, id_otvetstvennogo_lica); |
+ item_Vidio->setIcon(4, vidio_card_icon); |
+ item_Vidio->setText(4, tmp); |
+ item_Vidio->setText(3, Vidio_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(9, result); |
+ return result; |
+} |
+ |
+ |
+QString MainWindowImpl::add_Sound_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock){ |
+ |
+ |
+ QString result, tmp; |
+ QString Sound_card_id, Sound_card_proizvoditel, Sound_card_model, Sound_card_inventar_num, Sound_card_serial_num; |
+ QString Sound_card_SqlQueryText; |
+ QSqlQuery Sound_card_Query; |
+ int field_id, field_proizvoditel, field_model, field_inventar_num, field_serial_num; |
+ QTreeWidgetItem *item_Sound_card, *item_Sound_card_block; |
+ Sound_card_SqlQueryText = tr("select soundcards.* " |
+ " from soundcards where soundcards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Sound_card_SqlQueryText.append(id_systemBlock); |
+ Sound_card_Query.prepare(Sound_card_SqlQueryText); |
+ Sound_card_Query.exec(); |
+ field_id = Sound_card_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Sound_card_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Sound_card_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_inventar_num = Sound_card_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_serial_num = Sound_card_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Sound_card_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Sound_card_block->setText(2, tr("ÇÂÓÊÎÂÛÅ ÊÀÐÒÛ")); |
+ item_Sound_card_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ while(Sound_card_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Sound_card_id = Sound_card_Query.value(field_id).toString(); |
+ Sound_card_proizvoditel = Sound_card_Query.value(field_proizvoditel).toString(); |
+ Sound_card_model = Sound_card_Query.value(field_model).toString(); |
+ Sound_card_inventar_num = Sound_card_Query.value(field_inventar_num).toString(); |
+ Sound_card_serial_num = Sound_card_Query.value(field_serial_num).toString(); |
+ |
+// Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+// Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ if (Sound_card_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Sound_card_proizvoditel);} |
+ |
+ if (Sound_card_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Sound_card_model);} |
+ |
+/// if (Vidio_ram !=""){tmp.append(tr(" ")); |
+/// tmp.append(Vidio_ram); |
+/// tmp.append(tr(" Mb")); |
+ |
+/// } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Sound_card = new QTreeWidgetItem(item_Sound_card_block); |
+ } |
+ else item_Sound_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+// item_Sound_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+ item_Sound_card->setText(2, tr("Çâóêîâàÿ êàðòà")); |
+ item_Sound_card->setText(12, Sound_card_id); |
+ item_Sound_card->setText(13, id_systemBlock); |
+ item_Sound_card->setText(14, id_otvetstvennogo_lica); |
+ item_Sound_card->setIcon(4, sound_card_icon); |
+ item_Sound_card->setText(4, tmp); |
+ item_Sound_card->setText(3, Sound_card_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(10, result); |
+ return result; |
+ |
+} |
+ |
+QString MainWindowImpl::add_Lan_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock){ |
+ |
+ |
+ QString result, tmp; |
+ QString Lan_card_id, Lan_card_proizvoditel, Lan_card_model, Lan_speed, Lan_inventar_num, Lan_serial_num; |
+ QString Lan_card_SqlQueryText; |
+ QSqlQuery Lan_card_Query; |
+ int field_id, field_proizvoditel, field_model, field_speed, field_serial_num, field_inventar_num; |
+ QTreeWidgetItem *item_Lan_card, *item_Lan_card_block; |
+ Lan_card_SqlQueryText = tr("select lancards.* " |
+ " from lancards where lancards.Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = " |
+ ); |
+ Lan_card_SqlQueryText.append(id_systemBlock); |
+ Lan_card_Query.prepare(Lan_card_SqlQueryText); |
+ Lan_card_Query.exec(); |
+ field_id = Lan_card_Query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_proizvoditel = Lan_card_Query.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ field_model = Lan_card_Query.record().indexOf(tr("Ìîäåëü")); |
+ field_speed = Lan_card_Query.record().indexOf(tr("Ñêîðîñòü_ïåðåäà÷è_äàííûõ")); |
+ field_serial_num = Lan_card_Query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = Lan_card_Query.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Lan_card_block = new QTreeWidgetItem(itemSysBlock); |
+ item_Lan_card_block->setText(2, tr("ÑÅÒÅÂÛÅ ÊÀÐÒÛ")); |
+ item_Lan_card_block->setText(14, id_otvetstvennogo_lica); |
+ } |
+ |
+ while(Lan_card_Query.next()){ |
+// tmp = tr("CD/DVD: "); |
+ tmp = tr(""); |
+ Lan_card_id = Lan_card_Query.value(field_id).toString(); |
+ Lan_card_proizvoditel = Lan_card_Query.value(field_proizvoditel).toString(); |
+ Lan_card_model = Lan_card_Query.value(field_model).toString(); |
+ Lan_speed = Lan_card_Query.value(field_speed).toString(); |
+ Lan_inventar_num = Lan_card_Query.value(field_inventar_num).toString(); |
+ Lan_serial_num = Lan_card_Query.value(field_serial_num).toString(); |
+ |
+ |
+// Vidio_interfeis = Vidio_Query.value(field_interfeis).toString(); |
+// Vidio_ram = Vidio_Query.value(field_ram).toString(); |
+ if (Lan_card_proizvoditel != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_card_proizvoditel);} |
+ |
+ if (Lan_card_model != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_card_model);} |
+ |
+ if (Lan_speed != "") {tmp.append(tr(" ")); |
+ tmp.append(Lan_speed); |
+ tmp.append(tr(" Mbit"));} |
+ |
+/// if (Vidio_ram !=""){tmp.append(tr(" ")); |
+/// tmp.append(Vidio_ram); |
+/// tmp.append(tr(" Mb")); |
+ |
+/// } |
+ result.append(tmp); |
+ |
+ if (id_otvetstvennogo_lica == "1" && id_systemBlock == "1"){ |
+ item_Lan_card = new QTreeWidgetItem(item_Lan_card_block); |
+ } |
+ else item_Lan_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+// item_Lan_card = new QTreeWidgetItem(itemSysBlock); |
+ |
+ |
+ item_Lan_card->setText(2, tr("Ñåòåâàÿ êàðòà")); |
+ item_Lan_card->setText(12, Lan_card_id); |
+ item_Lan_card->setText(13, id_systemBlock); |
+ item_Lan_card->setText(14, id_otvetstvennogo_lica); |
+ item_Lan_card->setIcon(4, lan_card_icon); |
+ item_Lan_card->setText(4, tmp); |
+ item_Lan_card->setText(3, Lan_inventar_num); |
+ } |
+ if (id_systemBlock !="1") itemSysBlock->setText(11, result); |
+ return result; |
+ |
+} |
+ |
+void MainWindowImpl::refreshTree(){ |
+ |
+ initTreeWidget(); |
+} |
+ |
+int MainWindowImpl::select_system_block(){ |
+ return 1; |
+} |
+ |
+ |
Index: trunk/source_code/src/actions.cpp |
=================================================================== |
--- trunk/source_code/src/actions.cpp (revision 0) |
+++ trunk/source_code/src/actions.cpp (revision 257) |
@@ -0,0 +1,110 @@ |
+#include "mainwindowimpl.h" |
+ |
+void MainWindowImpl::delete_all_actions(){ |
+ treeWidget->removeAction(addMemoryAction); |
+ treeWidget->removeAction(MB_na_skladAction); |
+ treeWidget->removeAction(new_sotrydnikAction); |
+ treeWidget->removeAction(novoe_oborydovanieAction); |
+ treeWidget->removeAction(SpliterAction); |
+ treeWidget->removeAction(metaDataAction); |
+ treeWidget->removeAction(pereimenovat_otdelAction); |
+ treeWidget->removeAction(yvolit_sotrydnikaAction); |
+ treeWidget->removeAction(perevesti_sotrydnika_v_drygo1_otdelAction); |
+ treeWidget->removeAction(naznachit_otvetstvennim_za_oborydovanieAction); |
+ treeWidget->removeAction(ystanovit_novie_complektyushieAction); |
+ treeWidget->removeAction(sozdat_otdelAction); |
+ treeWidget->removeAction(novaya_MB_na_skladAction); |
+ treeWidget->removeAction(insert_MB_to_system_blockAction); |
+ treeWidget->removeAction(novaya_RAM_na_skladAction); |
+ treeWidget->removeAction(novaya_CPU_na_skladAction); |
+ treeWidget->removeAction(novaya_HDD_na_skladAction); |
+ treeWidget->removeAction(novaya_CD_DVD_na_skladAction); |
+ treeWidget->removeAction(novaya_VIDEO_na_skladAction); |
+ treeWidget->removeAction(novaya_SoundCard_na_skladAction); |
+ treeWidget->removeAction(novaya_LAN_na_skladAction); |
+ treeWidget->removeAction(novaya_SYSTEM_BLOCK_na_skladAction); |
+ treeWidget->removeAction(peredat_sys_block_pod_otveystvennostAction); |
+ |
+} |
+ |
+void MainWindowImpl::add_actions_for_otdel(){ |
+ treeWidget->addAction(pereimenovat_otdelAction); |
+ treeWidget->addAction(new_sotrydnikAction); |
+ treeWidget->addAction(sozdat_otdelAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sotrydnik(){ |
+// SpliterAction->setText(tr("Cîòðóäíèê")); |
+// perevesti_sotrydnika_v_drygo1_otdelAction->setEnabled(false); |
+ treeWidget->addAction(perevesti_sotrydnika_v_drygo1_otdelAction); |
+ |
+// SpliterAction->setSeparator (true); |
+// treeWidget->addAction(SpliterAction); |
+ |
+ treeWidget->addAction(yvolit_sotrydnikaAction); |
+ treeWidget->addAction(naznachit_otvetstvennim_za_oborydovanieAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_system_block(){ |
+ treeWidget->addAction(MB_na_skladAction); |
+ treeWidget->addAction(ystanovit_novie_complektyushieAction); |
+ |
+} |
+ |
+void MainWindowImpl::add_actions_for_kompletyushie(){ |
+ treeWidget->addAction(MB_na_skladAction); |
+} |
+ |
+ |
+void MainWindowImpl::add_actions_for_sklad(){ |
+ treeWidget->addAction(sozdat_otdelAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_MB(){ |
+ treeWidget->addAction(novaya_MB_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_HDD(){ |
+ treeWidget->addAction(novaya_HDD_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_CD_DVD(){ |
+ treeWidget->addAction(novaya_CD_DVD_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_SoundCard(){ |
+ treeWidget->addAction(novaya_SoundCard_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_LAN(){ |
+ treeWidget->addAction(novaya_LAN_na_skladAction); |
+} |
+ |
+ |
+void MainWindowImpl::add_actions_for_sklad_VIDEO(){ |
+ treeWidget->addAction(novaya_VIDEO_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_RAM(){ |
+ treeWidget->addAction(novaya_RAM_na_skladAction); |
+} |
+ |
+void MainWindowImpl::add_actions_for_sklad_CPU(){ |
+ treeWidget->addAction(novaya_CPU_na_skladAction); |
+} |
+ |
+ |
+void MainWindowImpl::add_actions_for_insert_MB_to_system_block(){ |
+ treeWidget->addAction(insert_MB_to_system_blockAction); |
+ } |
+ |
+ |
+void MainWindowImpl::add_actions_for_sklad_SB(){ |
+ treeWidget->addAction(novaya_SYSTEM_BLOCK_na_skladAction); |
+} |
+ |
+ |
+void MainWindowImpl::add_actions_for_sklad_system_block(){ //Äëÿ ñèñòåìíèêîâ íà ñêëàäå äîáàâëÿåì àêöèþ "íàçíà÷èòü îòâåòñòâåííîãî çà ñèñòåìíûé áëîê" |
+ treeWidget->addAction(peredat_sys_block_pod_otveystvennostAction); |
+} |
+ |
\ No newline at end of file |
/trunk/source_code/src/actions.cpp |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/raportform.h |
=================================================================== |
--- trunk/source_code/src/raportform.h (revision 0) |
+++ trunk/source_code/src/raportform.h (revision 257) |
@@ -0,0 +1,197 @@ |
+#ifndef __RAPORTFORM_H__ |
+#define __RAPORTFORM_H__ |
+ |
+// place your code here |
+#include <QtGui> |
+#include <QMainWindow> |
+#include <QString> |
+#include <QtSql> |
+#include <QSqlTableModel> |
+#include <QTableView> |
+#include <QSqlDriverPlugin> |
+#include <QIcon> |
+#include <QVariant> |
+#include <QPrinter> |
+#include <QPrintDialog> |
+#include <QFileDialog> |
+#include <QDate> |
+#include "ui_raportform.h" |
+ |
+ |
+typedef struct soundcard { |
+ QString proizvoditel; |
+ QString ID; |
+ QString model; |
+ QString id_sys_block; |
+ QString inv_num; |
+ QString ser_num; |
+ |
+} TSoundcard; |
+ |
+typedef struct lancard { |
+ QString proizvoditel; |
+ QString ID; |
+ QString model; |
+ QString id_sys_block; |
+ QString inv_num; |
+ QString ser_num; |
+ QString speed; |
+ |
+} TLancard; |
+ |
+ |
+typedef struct memory { |
+ QString proizvoditel; |
+ QString tip; |
+ QString ID; |
+ QString obem; |
+ QString inv_num; |
+ QString ser_num; |
+ |
+} TMemory; |
+ |
+typedef struct privod { |
+ QString proizvoditel; |
+ QString tip; |
+ QString model; |
+ QString ID; |
+ QString speed; |
+ QString inv_num; |
+ QString ser_num; |
+ |
+} TPrivod; |
+ |
+typedef struct cpu { |
+ QString proizvoditel; |
+ QString model; |
+ QString ID; |
+ QString slot; |
+ QString inv_num; |
+ QString ser_num; |
+ QString fqr; |
+ |
+} TCpu; |
+ |
+typedef struct videocard { |
+ QString ID; |
+ QString proizvoditel; |
+ QString model; |
+ QString interfeis; |
+ QString memory_value; |
+ QString id_sys_block; |
+ QString ser_num; |
+ QString inv_num; |
+} TVideocard; |
+ |
+typedef struct matheboard { |
+ QString proizvoditel; |
+ QString model; |
+ QString ID; |
+ QString ser_num; |
+ QString inv_num; |
+ |
+ |
+} TMatheboard; |
+ |
+typedef struct harddisc { |
+ QString ID; |
+ QString proizvoditel; |
+ QString interfeis; |
+ QString obem; |
+ QString model; |
+ QString ser_num; |
+ QString inv_num; |
+ |
+ |
+} THarddisc; |
+ |
+ |
+typedef struct system_block { |
+ QString ID; |
+ QString inv_num; |
+ QString ser_num; |
+ QVariant date; |
+ QVariant garantiya; |
+ QString id_otv_lica; |
+ QList<TMatheboard> mb_list; |
+ QList<TMemory> memory_list; |
+ QList<TCpu> cpu_list; |
+ QList<THarddisc> harddisc_list; |
+ QList<TPrivod> privod_list; |
+ QList<TVideocard> videocard_list; |
+ QList<TSoundcard> soundcard_list; |
+ QList<TLancard> lancard_list; |
+ |
+} TSystemBlock; |
+ |
+ |
+typedef struct user { |
+ QString name; |
+ QString ID; |
+ QList <TSystemBlock> system_block_list; |
+} TUser; |
+ |
+typedef struct otdel { |
+ QString name; |
+ QString ID; |
+ QList <TUser> user_list; |
+} TOtdel; |
+ |
+typedef struct sibgipro |
+{ |
+ QList <TOtdel> otdel_list; |
+} TSibgipro; |
+ |
+class raportForm : public QMainWindow, public Ui::raportWindow |
+{ |
+ |
+ |
+ |
+ |
+ |
+Q_OBJECT |
+public: |
+ //raportForm( QWidget * parent = 0, Qt::WFlags f = 0 ); |
+ raportForm(); |
+ ~raportForm(); |
+private slots: |
+ |
+void create_raport(); |
+void on_pushButton_clicked(); |
+//QStringList get_otgel_list(); |
+void on_print_raport(); |
+void on_print_raport_to_pdf(); |
+ |
+private: |
+QTextDocument *document; |
+// = ui->textEdit->document(); |
+QTextCursor *cursor; |
+void print_raport(); |
+void print_raport_to_pdf(); |
+TSibgipro get_sibgipro(); // ïîëó÷àåì ïîëíóþ ñòðóêòóðó îðãàíèçàöèè |
+QList<TOtdel> get_otdel_list(); |
+QList<TUser> get_user_list(QString otdel_ID); |
+QList<TSystemBlock> get_sys_block_list(QString id_otv_lica); // ñïèñîê ñèñòåìíûõ áëîêîâ, çàêðåïëåííûõ çà ïîëüçîâàòåëåì |
+QList<TMatheboard> get_matheboard_list(QString id_system_block); // ñïèñîê ìàòåðèíñêèõ ïëàò, óñòàíîâëåííûõ â ñèñòåìíîì áëîêå |
+QList<TMemory> get_memory_list(QString id_system_block); |
+QList<THarddisc> get_harddisc_list(QString id_system_block); |
+QList<TCpu> get_cpu_list(QString id_system_block); |
+QList<TPrivod> get_privod_list(QString id_system_block); |
+QList<TVideocard> get_videocard_list(QString id_system_block); |
+QList<TSoundcard> get_soundcard_list(QString id_system_block); |
+QList<TLancard> get_lancard_list(QString id_system_block); |
+//QList<THarddisc> get_harddisc_list(QString id_system_block); |
+void bild_raport(); |
+ |
+ |
+QList<TOtdel> otdel_list; |
+ |
+ |
+ |
+public: |
+QSqlDatabase *pdb; |
+ |
+}; |
+ |
+ |
+#endif // __RAPORTFORM_H__ |
Index: trunk/source_code/src/settingform.cpp |
=================================================================== |
--- trunk/source_code/src/settingform.cpp (revision 0) |
+++ trunk/source_code/src/settingform.cpp (revision 257) |
@@ -0,0 +1,10 @@ |
+#include "settingform.h" |
+ |
+// place your code here |
+settingForm::settingForm( ) |
+ : QWidget() |
+{ |
+ setupUi(this); |
+ |
+ // TODO |
+} |
/trunk/source_code/src/settingform.cpp |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/form.cpp |
=================================================================== |
--- trunk/source_code/src/form.cpp (revision 0) |
+++ trunk/source_code/src/form.cpp (revision 257) |
@@ -0,0 +1,179 @@ |
+#include "form.h" |
+#include "ui_form.h" |
+ |
+Form::Form(QWidget *parent) : |
+ QWidget(parent), |
+ m_ui(new Ui::Form) |
+{ |
+ m_ui->setupUi(this); |
+ connect(&wmiProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput())); |
+} |
+ |
+Form::~Form() |
+{ |
+ delete m_ui; |
+} |
+ |
+void Form::changeEvent(QEvent *e) |
+{ |
+ QWidget::changeEvent(e); |
+ switch (e->type()) { |
+ case QEvent::LanguageChange: |
+ m_ui->retranslateUi(this); |
+ break; |
+ default: |
+ break; |
+ } |
+} |
+ |
+ |
+ |
+ |
+void Form::on_wmiButton_clicked(){ |
+ |
+// 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 //")); |
+ 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); |
+ |
+} |
+ |
+ |
+void Form::readStandartProcessOutput(){ |
+ QByteArray arr; |
+ QStringList result, list_tmp, list_tmp_value; |
+ QString str1, str2, str_tmp, str_buf; |
+ int i; |
+ arr = wmiProcess.readAllStandardOutput(); |
+ QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
+ QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
+ QTextCodec::setCodecForTr(codecUTF); |
+ str1 = QString(tr(arr)); |
+ result.clear(); |
+// result << QStringList(tr(arr)); |
+ QTextCodec::setCodecForTr(codec); |
+ |
+// str2 << arr; |
+ i = result.size(); |
+// str1 = result.at(0); |
+ i++; |
+ i = str1.indexOf("\r"); |
+ i = str1.indexOf("\n"); |
+ str_tmp = str1.left(i); |
+ m_ui->lineEdit->insert(str1); |
+ |
+ while (i != -1){ |
+ i = str1.indexOf("\n"); |
+ if (i != -1) { |
+ str_tmp = str1.left(i); |
+ result << str_tmp; |
+ str1.remove(0, i+1);} |
+ |
+ } |
+ document = m_ui->textEdit->document(); |
+ cursor = new QTextCursor(document); |
+ cursor->movePosition(QTextCursor::Start); |
+ QTextCharFormat format(cursor->charFormat()); |
+ //format.setFontFamily("Courier"); |
+ format.setFontFamily("Arial"); |
+ //format.setFontItalic(false); |
+ |
+ format.setFontWeight(QFont::Normal); |
+ QTextCharFormat boldFormat = format; |
+ boldFormat.setFontWeight(QFont::Bold); |
+ |
+ QTextCharFormat italicFormat = format; |
+ //format.setFontFamily("Courier"); |
+// format.setFontFamily("Arial"); |
+ italicFormat.setFontItalic(true); |
+ |
+for (int m = 0; m < result.size(); ++m){ |
+ cursor->insertText(result.at(m), format); |
+ cursor->insertBlock(); |
+ cursor->insertText(tr("--------------------------"), format); |
+ 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); |
+ cursor->insertBlock(); |
+ cursor->insertText(result.at(3), format); |
+ |
+*/ |
+ |
+} |
+ |
+void Form::readStandartProcessError(){ |
+ 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; |
+ |
+ |
+} |
Index: trunk/source_code/src/mainwindowimpl.h |
=================================================================== |
--- trunk/source_code/src/mainwindowimpl.h (revision 0) |
+++ trunk/source_code/src/mainwindowimpl.h (revision 257) |
@@ -0,0 +1,234 @@ |
+#ifndef MAINWINDOWIMPL_H |
+#define MAINWINDOWIMPL_H |
+// |
+#include <QtGui> |
+#include <QMainWindow> |
+#include <QString> |
+#include <QtSql> |
+#include <QSqlField> |
+#include <QSqlRecord> |
+#include <QSqlTableModel> |
+#include <QSqlQueryModel> |
+#include <QTableView> |
+#include <QSqlDriverPlugin> |
+#include <QIcon> |
+#include <QVariant> |
+#include <QProcess> |
+#include <QByteArray> |
+#include "ui_mainwindow.h" |
+#include "settingform.h" |
+#include "addmemoryform.h" |
+#include "addotdelform.h" |
+#include "addsotrydnikform.h" |
+#include "form.h" |
+//#include "addsósblockform.h" |
+#include "addsysblockform.h" |
+#include "raportform.h" |
+#include <QAbstractItemDelegate> |
+ |
+ |
+#include <string.h> |
+ |
+ |
+ |
+// |
+ |
+bool myfun(void); |
+/// /// bool send(void); |
+bool send(int); |
+bool connecttoregistry(void); |
+bool initcomponentcontext(void); |
+ |
+class MainWindowImpl : public QMainWindow, public Ui::MainWindow |
+{ |
+enum type_komplektyushie {MB, HDD, CD_DVD}; |
+typedef enum type_komplektyushie komplektyushie; |
+ |
+enum type_currient_task_for_dblclick {no_task, select_sys_block, select_sotrydnik_for_sys_block}; |
+typedef enum type_currient_task_for_dblclick currient_task_for_dblclick; |
+ |
+ |
+ |
+ |
+Q_OBJECT |
+public: |
+ MainWindowImpl( QWidget * parent = 0, Qt::WFlags f = 0 ); |
+ ~MainWindowImpl(); |
+ void initTreeWidget(); |
+ |
+ |
+private slots: |
+ void openBase(); |
+ void openMemoryTable(); |
+ void getSetting(); |
+ void applySetting(); |
+ void addString(); |
+ void delString(); |
+ void filter(); |
+ void hiddenRow(); |
+ void showRow(); |
+ void dbUpdate();//âíîñèì èçìåíåíèÿ â áàçó äàííûõ |
+ void dblClick(QTreeWidgetItem *item, int column); |
+ void on_treeWidget_itemActivated(QTreeWidgetItem *item, int column); |
+ void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column); |
+ void on_treeWidget_itemSelectionChanged (); |
+ void editTreeWidget(); |
+ void addNewOtdel();//ñîçäàåì íîâûé îòäåë |
+ void addNewMemory(); |
+ void addNewMemory(QString inventar_num); |
+ void refreshTree(); |
+ void move_to_sklad(); |
+ void new_sotrydnik(); |
+ void novoe_oborydovanie(); |
+ void ystanovit_novie_complektyushie(); |
+ void pereimenovft_otdel(); |
+ void yvolit_sotrydnika(); |
+ void perevesti_sotrydnika_v_drygo1_otdel(); |
+ void naznachit_otvetstvennim_za_oborydovanie(); |
+ void novaya_MB_na_sklad(); |
+ void novaya_RAM_na_sklad(); |
+ void novaya_CPU_na_sklad(); |
+ void novaya_HDD_na_sklad(); |
+ void novaya_CD_DVD_na_sklad(); |
+ void novaya_VIDEO_na_sklad(); |
+ void novaya_SoundCard_na_sklad(); |
+ void novaya_LAN_na_sklad(); |
+ void novaya_SYSTEM_BLOCK_na_sklad(); |
+ void on_addmemoryForm_formClose(); |
+ void insert_MB_to_system_block(); |
+ void on_createButton_clicked(); |
+ void on_exportButton_clicked(); |
+ void on_wmiButton_clicked(); |
+ void peredat_sys_block_pod_otveystvennost(); |
+ void readStandartProcessOutput(); |
+ void readStandartProcessError(); |
+ |
+private: |
+//ïåðåìåííûå |
+ QString baseName; |
+ QString hostName; |
+ QString userName; |
+ QString password; |
+ QString tableName; |
+ |
+ |
+ |
+ QString component_table; // òèï êîìïîíåíòà, óñòàíàâëèâàåìíîãî â ñèñòåìíûé áëîê |
+ QString component_id;// èäåíòèôèêàòîð êîìïîíåíòà, óñòàíàâëèâàåìîãî â ñèñòåìíûé áëîê |
+ QString curr_sys_block_id; |
+ bool fEnable_component_add; |
+ bool fEnable_naznachit_otvetstv; |
+ int id_sys_block_pod_otvetstv; |
+ currient_task_for_dblclick curr_task; |
+//óêàçàòåëè íà îáúåêòû |
+ settingForm *setFrm; |
+ addmemoryForm addmemFrm; |
+ addotdelForm addotdelFrm; |
+ addsotrydnikForm addsotrydnikFrm; |
+ raportForm raportFrm; |
+ Form wmiFrm; |
+ |
+ addsysblockForm addsysblockFrm; |
+ |
+ QSqlTableModel *model; |
+ QSqlTableModel *memory_model; |
+ QTableView view; |
+ QTableView memory_view;// return res; |
+ QList<QTreeWidgetItem *> items; |
+ QTreeWidgetItem *itm; |
+ QTreeWidgetItem *itm1; |
+ QTreeWidgetItem *itm_sklad_komplectyushie; |
+ QTreeWidgetItem *itm_sklad_system_blocks; |
+ QTreeWidgetItem *itm_sklad_orgtehnika; |
+ QTreeWidgetItem *itm_sklad_orgtehnika_printers; |
+ QTreeWidgetItem *itm_sklad_orgtehnika_mfy; |
+ QTreeWidgetItem *itm_sklad_orgtehnika_scaners; |
+ QTreeWidgetItem *itm_sklad_rashodniki; |
+ QAction *metaDataAction; |
+ QAction *addMemoryAction; |
+ QAction *MB_na_skladAction; // àêöèÿ "ïåðåìåñòèòü íà ñêëàä" |
+ QAction *new_sotrydnikAction; |
+ QAction *novoe_oborydovanieAction; |
+ QAction *SpliterAction; |
+ QAction *pereimenovat_otdelAction; |
+ QAction *perevesti_sotrydnika_v_drygo1_otdelAction; |
+ QAction *yvolit_sotrydnikaAction; |
+ QAction *naznachit_otvetstvennim_za_oborydovanieAction; |
+ QAction *peredat_sys_block_pod_otveystvennostAction; |
+ QAction *ystanovit_novie_complektyushieAction; |
+ QAction *sozdat_otdelAction; |
+ |
+ QAction *novaya_MB_na_skladAction; |
+ QAction *novaya_RAM_na_skladAction; |
+ QAction *novaya_CPU_na_skladAction; |
+ QAction *novaya_HDD_na_skladAction; |
+ QAction *novaya_CD_DVD_na_skladAction; |
+ QAction *novaya_VIDEO_na_skladAction; |
+ QAction *novaya_SoundCard_na_skladAction; |
+ QAction *novaya_LAN_na_skladAction; |
+ QAction *novaya_SYSTEM_BLOCK_na_skladAction; |
+ |
+ QAction *insert_MB_to_system_blockAction; //íîâûé ñèñòåìíèê íà ñêëàä |
+ |
+//ôóíêöèè |
+ void writeSettings(); |
+ void readSettings(); |
+ void SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela); // ôîðìèðóåì ñïèñîê ñîòðóäíèêîâ |
+ void addOtdels();//äîáàâëÿåì îòäåëû â treeView |
+ |
+ |
+ |
+ QString oborydovanie(QString id_sotrydnika, QTreeWidgetItem * itemSotrydnika); |
+ QString addMatheBoardInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString addMemoryInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString addCpuInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString addHDDInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString add_CD_DVD_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString add_Vidio_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString add_Sound_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString add_Lan_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
+ QString get_info_from_system_block(QString inventar_num); |
+ void delete_all_actions(); |
+ void add_actions_for_otdel(); |
+ void add_actions_for_sklad(); |
+ void add_actions_for_sotrydnik(); |
+ void add_actions_for_system_block(); |
+ void add_actions_for_kompletyushie(); |
+ void add_actions_for_sklad_MB(); |
+ void add_actions_for_sklad_RAM(); |
+ void add_actions_for_sklad_CPU(); |
+ void add_actions_for_sklad_HDD(); |
+ void add_actions_for_sklad_CD_DVD(); |
+ void add_actions_for_sklad_VIDEO(); |
+ void add_actions_for_sklad_SoundCard(); |
+ void add_actions_for_sklad_LAN(); |
+ void add_actions_for_sklad_SB(); |
+ void add_actions_for_insert_MB_to_system_block(); |
+ void add_actions_for_sklad_system_block(); |
+ |
+ |
+ int select_system_block(); // ôóíêöèÿ âåðí¸ò èäåíòèôèêàòîð âûáðàííîãî ñèñòåìíîãî áëîêà |
+ |
+ |
+ |
+public: |
+ QIcon comp_icon; |
+ QIcon printer_icon; |
+ QIcon hdd_icon; |
+ QIcon memory_icon; |
+ QIcon matheboard_icon; |
+ QIcon cpu_icon; |
+ QIcon cd_dvd_icon; |
+ QIcon vidio_card_icon; |
+ QIcon sound_card_icon; |
+ QIcon lan_card_icon; |
+ QSqlDatabase *pdb; |
+ QSqlDatabase db; |
+ QProcess process; |
+ |
+}; |
+#endif |
+ |
+ |
+ |
+ |
/trunk/source_code/src/mainwindowimpl.h |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/slots.cpp |
=================================================================== |
--- trunk/source_code/src/slots.cpp (revision 0) |
+++ trunk/source_code/src/slots.cpp (revision 257) |
@@ -0,0 +1,1009 @@ |
+#include "mainwindowimpl.h" |
+// place your code here |
+// ïðîâåðêà |
+ |
+void MainWindowImpl::addNewMemory(){ |
+QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+QStringList user_list; |
+// addmemFrm = new addmemoryForm; |
+// QString temp; |
+// int lsize; |
+ addmemFrm.treeWidget->clear(); |
+ addmemFrm.comboBox->clear(); |
+ addmemFrm.comboBox_4->clear(); |
+ proizv_list = addmemFrm.getManufacturiesList(); |
+ user_list = addmemFrm.getSystemBlockList(); |
+ |
+// lsize = proizv_list.size(); |
+//for (int i = 0; i < lsize; ++i){ |
+// temp = proizv_list.at(i); } |
+ addmemFrm.comboBox->addItems(proizv_list); |
+ addmemFrm.comboBox_4->addItems(user_list); |
+ addmemFrm.show(); |
+} |
+ |
+void MainWindowImpl::addNewMemory(QString inventar_num){ |
+QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+QStringList mb_proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ìàòåðèíñêèõ ïëàò |
+QStringList hdd_proizv_list; //ñïèñîê ïðîèçâîäèòåëåé âèí÷åñòåðîâ |
+QStringList cpu_proizv_list; //ñïèñîê ïðîèçâîäèòåëåé âèí÷åñòåðîâ |
+QStringList video_proizv_list; //ñïèñîê ïðîèçâîäèòåëåé âèäåîêàðò |
+QStringList mb_model_list;//ñïèñîê ìîäåëåé ìàòåðèíñêèõ ïëàò |
+QStringList user_list; |
+QString currProizvoditel; |
+// addmemFrm = new addmemoryForm; |
+// QString temp; |
+// int lsize; |
+ treeWidget->setEnabled(false); |
+ |
+ addmemFrm.label_7->setText(inventar_num); |
+ addmemFrm.treeWidget->clear(); |
+ addmemFrm.comboBox->clear(); |
+ addmemFrm.comboBox_4->clear(); |
+ addmemFrm.comboBox_5->clear(); |
+ addmemFrm.comboBox_6->clear(); |
+ addmemFrm.comboBox_13->clear();//ïðîèçâîäèòåëè HDD |
+ addmemFrm.comboBox_9->clear();//ïðîèçâîäèòåëè CPU |
+ addmemFrm.comboBox_19->clear();//ïðîèçâîäèòåëè VIDEO |
+ addmemFrm.comboBox_20->clear();//ìîäåëè âèäåîêàðò |
+ addmemFrm.lineEdit_2->clear(); |
+ addmemFrm.lineEdit->clear(); |
+ |
+ proizv_list = addmemFrm.getManufacturiesList(); |
+ mb_proizv_list = addmemFrm.getManufacturiesListMB(); |
+ hdd_proizv_list = addmemFrm.getManufacturiesListHDD(); |
+ cpu_proizv_list = addmemFrm.getManufacturiesListCPU(); |
+ video_proizv_list = addmemFrm.getManufacturiesListVIDEO(); |
+ |
+ user_list = addmemFrm.getSystemBlockList(); |
+ |
+ |
+// lsize = proizv_list.size(); |
+//for (int i = 0; i < lsize; ++i){ |
+// temp = proizv_list.at(i); } |
+ addmemFrm.comboBox->addItems(proizv_list); |
+ addmemFrm.comboBox_5->addItems(mb_proizv_list); |
+ addmemFrm.comboBox_13->addItems(hdd_proizv_list); |
+ addmemFrm.comboBox_9->addItems(cpu_proizv_list); |
+ addmemFrm.comboBox_19->addItems(video_proizv_list); |
+ currProizvoditel = addmemFrm.comboBox_5->currentText(); |
+// mb_model_list = addmemFrm.getModelListMB(currProizvoditel); |
+// addmemFrm.comboBox_6->addItems(mb_model_list); |
+ addmemFrm.comboBox_4->addItems(user_list); |
+ |
+ addmemFrm.show(); |
+} |
+ |
+ |
+QString MainWindowImpl::get_info_from_system_block(QString inventar_num){ |
+ |
+ QSqlQuery query; |
+ int field_id, field_serial_num, field_inventar_num, field_data_pokypki, field_srok_garantii, field_id_otv_lica; |
+ QString sql_query_text, tmp; |
+ QString identifikator, serial_num, data_pokypki, srok_garantii, id_otv_lica ; |
+ |
+ sql_query_text = tr("select Ñèñòåìíûå_áëîêè.* from Ñèñòåìíûå_áëîêè where Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð = "); |
+ sql_query_text.append(inventar_num); |
+ query.prepare(sql_query_text); |
+ query.exec(); |
+ |
+ field_id = query.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_serial_num = query.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_data_pokypki = query.record().indexOf(tr("Äàòà_ïîêóïêè")); |
+ field_srok_garantii = query.record().indexOf(tr("Ñðîê_ãàðàíòèè")); |
+ field_id_otv_lica = query.record().indexOf(tr("Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà")); |
+ |
+ identifikator = query.value(field_id).toString(); |
+ serial_num = query.value(field_serial_num).toString(); |
+ data_pokypki = query.value(field_data_pokypki).toString(); |
+ srok_garantii = query.value(field_srok_garantii).toString(); |
+ id_otv_lica = query.value(field_id_otv_lica).toString(); |
+ |
+ tmp = "Èíâ. íîì: "; |
+ tmp.append(inventar_num); |
+ |
+ |
+ return tmp; |
+} |
+ |
+void MainWindowImpl::on_treeWidget_itemSelectionChanged (){ |
+ if (fEnable_component_add || fEnable_naznachit_otvetstv) { |
+ delete_all_actions(); |
+ return; |
+ } |
+ QTreeWidgetItem *currItm; |
+ QString txt; |
+ QString id_otv_lica; |
+ int i; |
+ i++; |
+ currItm = treeWidget-> currentItem (); |
+ txt = currItm->text(2); |
+ id_otv_lica = currItm->text(14); |
+ if (txt==tr("Îòäåë")){ |
+ delete_all_actions(); |
+ add_actions_for_otdel(); |
+// treeWidget->removeAction(MB_na_skladAction); |
+// treeWidget->removeAction(addMemoryAction); |
+// treeWidget->removeAction(novoe_oborydovanieAction); |
+ } |
+ else if (txt==tr("Ñîòðóäíèê")) { |
+ delete_all_actions(); |
+ add_actions_for_sotrydnik(); |
+// treeWidget->removeAction(addMemoryAction); |
+// treeWidget->removeAction(MB_na_skladAction); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ else if (txt==tr("Ñêëàä")) { |
+ delete_all_actions(); |
+// treeWidget->removeAction(MB_na_skladAction); |
+// treeWidget->removeAction(addMemoryAction); |
+ add_actions_for_sklad(); |
+ } |
+ else if (txt==tr("Ñèñòåìíûé áëîê") && id_otv_lica != tr("1")){ |
+ delete_all_actions(); |
+ add_actions_for_system_block(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ else if (txt==tr("Ñèñòåìíûé áëîê") && id_otv_lica == tr("1")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_system_block(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ else if (txt==tr("ÌÀÒÅÐÈÍÑÊÈÅ ÏËÀÒÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_MB(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ else if (txt==tr("ÌÎÄÓËÈ ÏÀÌßÒÈ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_RAM(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÏÐÎÖÅÑÑÎÐÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_CPU(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÂÈÍ×ÅÑÒÅÐÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_HDD(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÏÐÈÂÎÄÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_CD_DVD(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÂÈÄÅÎÊÀÐÒÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_VIDEO(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÇÂÓÊÎÂÛÅ ÊÀÐÒÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_SoundCard(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ else if (txt==tr("ÑÅÒÅÂÛÅ ÊÀÐÒÛ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_LAN(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+else if (txt==tr("ÑÈÑÒÅÌÍÛÅ ÁËÎÊÈ")){ |
+ delete_all_actions(); |
+ add_actions_for_sklad_SB(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } |
+ |
+ |
+/* else if (txt==tr("Ìàòåðèíñêàÿ ïëàòà") && id_otv_lica == tr("1")){ |
+ delete_all_actions(); |
+ add_actions_for_insert_MB_to_system_block(); |
+// treeWidget->removeAction(new_sotrydnikAction); |
+ } */ |
+ |
+ |
+ else if (id_otv_lica != tr("1")){treeWidget->addAction(addMemoryAction); //íå ñêëàä |
+ delete_all_actions(); |
+ add_actions_for_kompletyushie(); |
+// treeWidget->addAction(SpliterAction); |
+ |
+// SpliterAction->setSeparator (true); |
+// treeWidget->addAction(MB_na_skladAction); |
+ } |
+ |
+ else {treeWidget->addAction(addMemoryAction); // ñêëàä |
+ delete_all_actions(); |
+ add_actions_for_insert_MB_to_system_block();//íàçâàíèå ôóíêöèè íàäî ïîìåíÿòü, ýòî êî âñåì êîìïëåêòóþùèì îòíîñèòñÿ |
+// treeWidget->addAction(SpliterAction); |
+ |
+// SpliterAction->setSeparator (true); |
+// treeWidget->addAction(MB_na_skladAction); |
+ } |
+ |
+// if (txt==tr("Ñèñòåìíûé áëîê")) {i++;} |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+void MainWindowImpl::novoe_oborydovanie(){ |
+ |
+} |
+ |
+ |
+void MainWindowImpl::pereimenovft_otdel(){ |
+ |
+} |
+ |
+void MainWindowImpl::yvolit_sotrydnika(){ |
+ |
+} |
+ |
+void MainWindowImpl::perevesti_sotrydnika_v_drygo1_otdel(){ |
+ int i; |
+ i++; |
+} |
+ |
+void MainWindowImpl::naznachit_otvetstvennim_za_oborydovanie(){ |
+ |
+} |
+ |
+void MainWindowImpl::ystanovit_novie_complektyushie(){ |
+ QString inventar_num; |
+ QTreeWidgetItem * currItem; |
+ int currColomn; |
+ int top_item_index; |
+ lineEdit->insert(tr("Ðåäàêòèðîâàòü")); |
+ currItem = treeWidget->currentItem (); |
+ top_item_index = treeWidget->indexOfTopLevelItem(currItem); |
+ currColomn = treeWidget->currentColumn(); |
+ MainWindowImpl::on_treeWidget_itemClicked(currItem, 3); //âûâîäèì íîìåð ñèñòåìíèêà íà ôîðìó |
+// inventar_num = tr("Èíâ.íîì: "); |
+ inventar_num.append(currItem ->text(3)); |
+ if (currColomn == 1){ |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addmemFrm.show(); |
+ }; |
+ if (inventar_num == "") return; |
+ lineEdit->insert(currItem ->text(currColomn)); |
+switch(currColomn) |
+ { |
+ case 1://Ñîòðóäíèêè |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(4); |
+ addNewMemory(inventar_num); |
+ |
+ } |
+ break; |
+ |
+ |
+ case 4: //Ïðîöåññîð |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(2); |
+ addNewMemory(inventar_num); |
+ } |
+ break; |
+ |
+ case 5: //Ìàòåðèíñêèå ïëàòû |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(3); |
+ addNewMemory(inventar_num); |
+ } |
+ break; |
+ |
+ case 6: //Ïàìÿòü |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(0); |
+ addNewMemory(inventar_num); |
+// addmemFrm.show(); |
+ } |
+ break; |
+ |
+ case 7: //Âèí÷åñòåð |
+ { |
+ addmemFrm.tabWidget->setCurrentIndex(1); |
+ addNewMemory(inventar_num); |
+ } |
+ break; |
+ |
+ |
+// case 2: break; |
+ default : { |
+ addmemFrm.tabWidget->setCurrentIndex(0); |
+ addNewMemory(inventar_num); |
+ } |
+ |
+ break; |
+ } |
+ addmemFrm.treeWidget->clear(); |
+ |
+ |
+ |
+ |
+ |
+ addmemFrm.treeWidget->clear(); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+void MainWindowImpl::on_addmemoryForm_formClose(){ |
+ treeWidget->setEnabled(true); |
+} |
+ |
+ |
+ |
+ |
+ |
+void MainWindowImpl::insert_MB_to_system_block(){ // óñòàíàâëèâàåì êîìïîíåíòû ñî ñêëàäà |
+ QTreeWidgetItem * currItem; |
+ QString tip_komplekt; |
+ QString identifikator_kimplekt; // èäåíòèôèêàòîð êîìïëåêòóþùåãî â òàáëèöå |
+ currItem = treeWidget->currentItem (); |
+ tip_komplekt = currItem->text(2); |
+ identifikator_kimplekt = currItem->text(12); |
+ if (tip_komplekt == tr("Ìàòåðèíñêàÿ ïëàòà")){ |
+ component_table = tr("matheboards"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé õîòèòå óñòàíîâèòü ìàòåðèíñêóþ ïëàòó.")); |
+ |
+ } |
+ else if (tip_komplekt == tr("Ìîäóëü ïàìÿòè")){ |
+ component_table = tr("memory"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü ìîäóëü ïàìÿòè.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Ïðîöåññîð")){ |
+ component_table = tr("processors"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü ïðîöåññîð.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Âèäåîêàðòà")){ |
+ component_table = tr("videocards"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü âèäåîêàðòó.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Ïðèâîä")){ |
+ component_table = tr("cd_dvd"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü ïðèâîä.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Çâóêîâàÿ êàðòà")){ |
+ component_table = tr("soundcards"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü çâóêîâóþ êàðòó.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Ñåòåâàÿ êàðòà")){ |
+ component_table = tr("lancards"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü ñåòåâóþ êàðòó.")); |
+ } |
+ |
+ else if (tip_komplekt == tr("Æåñòêèé äèñê")){ |
+ component_table = tr("harddiscs"); |
+ component_id = identifikator_kimplekt; |
+ fEnable_component_add = true; |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Óêàæèòå ñèñòåìíûé áëîê "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Òåïåðü âèáåðèòå ñèñòåìíûé áëîê (äâîéíûì êëèêîì ìûøêè), â êîòîðûé òðåáóåòñÿ óñòàíîâèòü æåñòêèé äèñê.")); |
+ } |
+ |
+ // select an_db.Îòäåëû.Íàçâàíèå, an_db.Ñîòðóäíèêè.ÔÈÎ, an_db.Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð from an_db.Îòäåëû , an_db.Ñîòðóäíèêè, an_db.Ñèñòåìíûå_áëîêè where an_db.Îòäåëû.Èäåíòèôèêàòîð = an_db.Ñîòðóäíèêè.Èäåíòèôèêàòîð_îòäåëà and an_db.Ñîòðóäíèêè.Èäåíòèôèêàòîð = an_db.Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà; |
+// select an_db.Îòäåëû.Íàçâàíèå, an_db.Ñîòðóäíèêè.ÔÈÎ, an_db.Ñèñòåìíûå_áëîêè.Èíâåíòàðíûé_íîìåð, an_db.Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð from an_db.Îòäåëû , an_db.Ñîòðóäíèêè, an_db.Ñèñòåìíûå_áëîêè where an_db.Îòäåëû.Èäåíòèôèêàòîð = an_db.Ñîòðóäíèêè.Èäåíòèôèêàòîð_îòäåëà and an_db.Ñîòðóäíèêè.Èäåíòèôèêàòîð = an_db.Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà and an_db.Ñèñòåìíûå_áëîêè.Èäåíòèôèêàòîð != 1 and an_db.Îòäåëû.Íàçâàíèå = "ÑÀÏÐ"; |
+ |
+ |
+ int i; |
+ i++; |
+ |
+ |
+} |
+ |
+void MainWindowImpl::dblClick(QTreeWidgetItem *item, int column) |
+{ |
+ lineEdit->insert(item->text(column)); |
+ |
+ |
+} |
+ |
+void MainWindowImpl::move_to_sklad(){ |
+ QString SqlText; |
+ QString currID; |
+ QString typeOdorydovaniya; |
+ QString tableName; |
+ QTreeWidgetItem * currItem; |
+ QString TipOborydovaniya; |
+ QSqlQuery UpdateSqlQuery; |
+ currItem = treeWidget->currentItem (); |
+ currID = currItem->text(12); |
+ typeOdorydovaniya = currItem->text(2); |
+ |
+// tableName = |
+ if (typeOdorydovaniya == tr("Ìîäóëü ïàìÿòè")){ |
+ tableName = tr("memory"); |
+ } |
+ else if (typeOdorydovaniya == tr("Ìàòåðèíñêàÿ ïëàòà")){ |
+ tableName = tr("matheboards"); |
+ } |
+ else if (typeOdorydovaniya == tr("Ïðîöåññîð")){ |
+ tableName = tr("processors"); |
+ } |
+ else if (typeOdorydovaniya == tr("Âèäåîêàðòà")){ |
+ tableName = tr("videocards"); |
+ } |
+ else if (typeOdorydovaniya == tr("Ïðèâîä")){ |
+ tableName = tr("cd_dvd"); |
+ } |
+ else if (typeOdorydovaniya == tr("Çâóêîâàÿ êàðòà")){ |
+ tableName = tr("soundcards"); |
+ } |
+ else if (typeOdorydovaniya == tr("Æåñòêèé äèñê")){ |
+ tableName = tr("harddiscs"); |
+ } |
+ else if (typeOdorydovaniya == tr("Ñåòåâàÿ êàðòà")){ |
+ tableName = tr("lancards"); |
+ } |
+ |
+ else return; |
+ SqlText = tr("update "); |
+ SqlText.append(tableName); |
+ SqlText.append(tr(" set Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = 1 where Èäåíòèôèêàòîð = ")); |
+ SqlText.append(currID); |
+ UpdateSqlQuery.prepare(SqlText); |
+ UpdateSqlQuery.exec(); |
+ initTreeWidget(); |
+} |
+ |
+ |
+ |
+void MainWindowImpl::on_treeWidget_itemActivated(QTreeWidgetItem *item, int column)// ñîáûòèå íàñòóïàåò ïðè äâîéíîì êëèêå ìûøêè |
+{ |
+ if (fEnable_naznachit_otvetstv) { |
+ QString SqlText; |
+ QSqlQuery UpdateSqlQuery; |
+ QString id_sotrydnika; |
+ if (item ->text(2) == tr("Ñîòðóäíèê")) { |
+ id_sotrydnika = item ->text(14); |
+ SqlText = tr("update system_blocks set Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà = "); |
+ SqlText.append(id_sotrydnika); |
+ SqlText.append(tr(" where system_blocks.Èäåíòèôèêàòîð = ")); |
+ SqlText.append(tr(curr_sys_block_id)); |
+ UpdateSqlQuery.prepare(SqlText); |
+ UpdateSqlQuery.exec(); |
+ initTreeWidget(); |
+ fEnable_naznachit_otvetstv = false; |
+ |
+ } |
+ } |
+ |
+ else if (!fEnable_component_add) lineEdit->insert(item->text(column)); |
+ else { |
+ QString SqlText; |
+ QSqlQuery UpdateSqlQuery; |
+ QString id_sys_block; |
+// QTreeWidgetItem * currItem; |
+// currItem = treeWidget->currentItem (); |
+ if (item ->text(2) == tr("Ñèñòåìíûé áëîê")) { |
+ id_sys_block = item ->text(12); |
+ SqlText = tr("update "); |
+ SqlText.append(component_table); |
+ SqlText.append(tr(" set Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = ")); |
+ SqlText.append(id_sys_block); |
+ SqlText.append(tr(" where Èäåíòèôèêàòîð = ")); |
+ SqlText.append(tr(component_id)); |
+ UpdateSqlQuery.prepare(SqlText); |
+ UpdateSqlQuery.exec(); |
+ initTreeWidget(); |
+ fEnable_component_add = false; |
+ } |
+ |
+ else return; |
+ |
+ |
+ } |
+ |
+} |
+ |
+void addmemoryForm::on_comboBox_5_currentIndexChanged (QString newText){ |
+ QStringList mb_model_list; |
+ comboBox_6->clear(); |
+ mb_model_list = getModelListMB(newText); |
+ comboBox_6->addItems(mb_model_list); |
+ |
+// int i; |
+// i++; |
+// i++; |
+} |
+ |
+void addmemoryForm::on_comboBox_19_currentIndexChanged (QString newText){ |
+ QStringList video_model_list; |
+ comboBox_20->clear(); |
+ video_model_list = getModelListVIDEO(newText); |
+ comboBox_20->addItems(video_model_list); |
+ |
+// int i; |
+// i++; |
+// i++; |
+} |
+ |
+ |
+void addmemoryForm::on_comboBox_9_currentIndexChanged (QString newText){ |
+ QStringList mb_model_list; |
+ comboBox_12->clear(); |
+ mb_model_list = getModelListCPU(newText); |
+ comboBox_12->addItems(mb_model_list); |
+ |
+// int i; |
+// i++; |
+// i++; |
+} |
+ |
+void MainWindowImpl::on_createButton_clicked(){ |
+// int i; |
+// i++; |
+// i++; |
+ bool ok; |
+QSqlQuery q; |
+//q.prepare(tr("set NAMES cp1251")); |
+//ok = q.exec(); |
+// q.clear(); |
+ |
+//Ñîçäàåì òàáëèöó îòäåëîâ |
+ |
+ |
+q.prepare(tr("CREATE TABLE otdeli ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Íàçâàíèå CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàíî\", " |
+ "Ñïðàâêà CHAR(255) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåò\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ ok = q.exec(); |
+ |
+ |
+//Ñîçäàåì òàáëèöó ñîòðóäíèêîâ |
+ |
+q.clear(); |
+ |
+q.prepare(tr("CREATE TABLE sotrydniki ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "ÔÈÎ CHAR(80) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàíî\", " |
+ "Èäåíòèôèêàòîð_îòäåëà INTEGER UNSIGNED, " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+//Ñîçäàåì òàáëèöó ñèñòåìíûõ áëîêîâ |
+ |
+q.prepare(tr("CREATE TABLE system_blocks ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Äàòà_ïîêóïêè DATE, " |
+ "Ñðîê_ãàðàíòèè INTEGER UNSIGNED NOT NULL DEFAULT 0, " |
+ "Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà INTEGER UNSIGNED DEFAULT 1, " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+//Ñîçäàåì òàáëèöó ìàòåðèíñêèõ ïëàò |
+ |
+q.prepare(tr("CREATE TABLE matheboards ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Ñëîò CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòíî\", " |
+ "×àñòîòà_øèíû INTEGER UNSIGNED DEFAULT 100, " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+//Ñîçäàåì òàáëèöó ìîäóëåé ïàìÿòè |
+ |
+ok = q.prepare(tr("CREATE TABLE memory ( Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Òèï ENUM(\"DIM\",\"DDR\",\"DDRII\",\"RIMM\",\"SIMM\") DEFAULT \"DDRII\", " |
+ "Îáúåì INTEGER UNSIGNED, " |
+ "×àñòîòà_øèíû INTEGER UNSIGNED, " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE proizvoditeli_pamyati (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE processors (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "×àñòîòà INTEGER UNSIGNED, " |
+ "Ñëîò CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòåí\", " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE processor_models (Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòåí\"" |
+ ") ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE harddiscs (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíòåðôåéñ CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Îáúåì INTEGER UNSIGNED, " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE proizvoditeli_hdd (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE proizvoditeli_mb (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE proizvoditeli_cpu (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE proizvoditeli_mb (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE proizvoditeli_video (Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci NOT NULL, " |
+ "PRIMARY KEY ( Ïðîèçâîäèòåëü )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE video_models (Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòíà\", " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå èçâåñòåí\"" |
+ ") ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE cd_dvd (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Òèï CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ñêîðîñòü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåíà\", " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ok = q.prepare(tr("CREATE TABLE videocards (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåíà\", " |
+ "Èíòåðôåéñ CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ïàìÿòü INTEGER UNSIGNED, " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE soundcards (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåíà\", " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("CREATE TABLE lancards (Èäåíòèôèêàòîð INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " |
+ "Ïðîèçâîäèòåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "Ìîäåëü CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåíà\", " |
+ "Ñêîðîñòü_ïåðåäà÷è_äàííûõ INTEGER UNSIGNED DEFAULT 100, " |
+ "Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà INTEGER UNSIGNED DEFAULT 1, " |
+ "Èíâåíòàðíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íå çàäàí\", " |
+ "Ñåðèéíûé_íîìåð CHAR(30) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT \"íåèçâåñòåí\", " |
+ "PRIMARY KEY ( Èäåíòèôèêàòîð )) ENGINE = MyISAM CHARACTER SET cp1251 COLLATE cp1251_general_ci")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ok = q.prepare(tr("INSERT INTO otdeli VALUES( default, \"Ñêëàä\", \"Ñêëàä\")")); |
+ |
+ok = q.exec(); |
+ |
+q.clear(); |
+ |
+ |
+ |
+//sotrydniki |
+ |
+q.prepare(tr("insert into sotrydniki (ÔÈÎ, Èäåíòèôèêàòîð_îòäåëà) " |
+ "values (:fio, :id_otd)")); |
+ q.bindValue(tr(":fio"), tr("Êëàäîâùèê")); |
+ q.bindValue(tr(":id_otd"), tr("1")); |
+ |
+ok = q.exec(); |
+ |
+ |
+} |
+ |
+ |
+ |
+void MainWindowImpl::on_exportButton_clicked(){ |
+ |
+raportFrm.show(); |
+/* |
+ |
+int ch; |
+QChar qch = 'Ï'; |
+ |
+char ch_arr[32]; |
+ch_arr[0] = char('À'); |
+ch_arr[1] = char('í'); |
+ch_arr[2] = char('ä'); |
+ch_arr[3] = char('ð'); |
+ch_arr[4] = char('å'); |
+ |
+ch = qch.unicode(); |
+ |
+// int y; |
+// y = 20 / 0; |
+ if (!(myfun())){ |
+ |
+ //connecttoregistry(); |
+ //initcomponentcontext(); |
+ //send(); |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ïîäêëþ÷åíèÿ "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Íå óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó OpenOffice.")); |
+ } |
+ |
+ |
+ |
+if (!(connecttoregistry())){ |
+ |
+ //connecttoregistry(); |
+ //initcomponentcontext(); |
+ //send(); |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ïîäêëþ÷åíèÿ "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Íå óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó OpenOffice.")); |
+ } |
+if (!(initcomponentcontext())){ |
+ |
+ //connecttoregistry(); |
+ //initcomponentcontext(); |
+ //send(); |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ïîäêëþ÷åíèÿ "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Íå óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó OpenOffice.")); |
+ } |
+ |
+ if (!(send(10))){ |
+ |
+ //connecttoregistry(); |
+ //initcomponentcontext(); |
+ //send(); |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ïîäêëþ÷åíèÿ "), // Çàãîëîâîê. |
+// db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ tr("Íå óäàëîñü ïîäêëþ÷èòüñÿ ê ñåðâåðó OpenOffice.")); |
+ } |
+ |
+ |
+ |
+ |
+ |
+*/ |
+ |
+}; |
+ |
+ |
+void MainWindowImpl::on_wmiButton_clicked(){ |
+ |
+// 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\"")); |
+ int i; |
+ i++; |
+ process.start(program); |
+ |
+} |
+ |
+ |
+void MainWindowImpl::addNewOtdel(){ |
+ int i=0; |
+ i++; |
+ addotdelFrm.lineEdit->clear(); |
+ addotdelFrm.lineEdit_2->clear(); |
+ treeWidget->setEnabled(false); |
+ addotdelFrm.show(); |
+ |
+} |
+ |
+void MainWindowImpl::new_sotrydnik(){ |
+ QTreeWidgetItem *currItm; |
+ currItm = treeWidget-> currentItem (); |
+ int i=0; |
+ i++; |
+ addsotrydnikFrm.lineEdit->clear(); |
+ addsotrydnikFrm.IdOtdela = currItm->text(12); |
+ treeWidget->setEnabled(false); |
+ addsotrydnikFrm.show(); |
+ |
+} |
+ |
+void MainWindowImpl::novaya_SYSTEM_BLOCK_na_sklad(){ |
+ int i=0; |
+ i++; |
+ treeWidget->setEnabled(false); |
+ addsysblockFrm.show(); |
+ |
+} |
+ |
+void MainWindowImpl::readStandartProcessOutput(){ |
+ QByteArray arr; |
+ QStringList result; |
+ QString str1, str2; |
+ int i; |
+ arr = process.readAllStandardOutput(); |
+ QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
+ QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
+ QTextCodec::setCodecForTr(codecUTF); |
+ str1 = QString(tr(arr)); |
+ QTextCodec::setCodecForTr(codec); |
+ result << QStringList(arr); |
+// str2 << arr; |
+ i = result.size(); |
+// str1 = result.at(0); |
+ i++; |
+ lineEdit->insert(str1); |
+ |
+} |
+ |
+void MainWindowImpl::readStandartProcessError(){ |
+ QByteArray arr; |
+ arr = process.readAllStandardError(); |
+ |
+} |
Index: trunk/source_code/src/addotdelform.cpp |
=================================================================== |
--- trunk/source_code/src/addotdelform.cpp (revision 0) |
+++ trunk/source_code/src/addotdelform.cpp (revision 257) |
@@ -0,0 +1,61 @@ |
+#include "addotdelform.h" |
+#include "mainwindowimpl.h" |
+// place your code here |
+ |
+addotdelForm::addotdelForm() |
+ : QDialog() |
+{ |
+// QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+ setupUi(this); |
+// proizv_list = getManufacturiesList(); |
+// comboBox->addItems(proizv_list); |
+ // TODO |
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(addNemOtdelSlot())); |
+ |
+} |
+ |
+ |
+ |
+void addotdelForm::closeEvent ( QCloseEvent * event ) { |
+ emit formClose(); |
+} |
+ |
+void addotdelForm::addNemOtdelSlot(){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_identifikator, field_nazvanie, field_spravka; |
+ QString identifikator, nazvanie, spravka; |
+ bool ok; |
+ if (lineEdit->text()==""){ |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ñîçäàíèÿ îòäåëà"), // Çàãîëîâîê. |
+ tr("Âû íå ââåëè íàçâàíèå îòäåëà!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ |
+ |
+ sqltext = tr("select * from otdeli where otdeli.Íàçâàíèå = \""); |
+ sqltext.append(lineEdit->text()); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ ok = q.exec(); |
+ field_nazvanie = q.record().indexOf(tr("Íàçâàíèå")); |
+ if (q.next()) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ñîçäàíèÿ îòäåëà"), // Çàãîëîâîê. |
+ tr("Îòäåë ñ òàêèì èìåíåì ñóùåñòâóåò!")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+ else { |
+ q.clear(); |
+ q.prepare(tr("insert into otdeli (Íàçâàíèå, Ñïðàâêà) " |
+ "values (:name, :comment)")); |
+ q.bindValue(tr(":name"), lineEdit->text()); |
+ q.bindValue(tr(":comment"), lineEdit_2->text()); |
+ ok = q.exec(); |
+ emit componentAdd(); |
+ close();} |
+ |
+} |
\ No newline at end of file |
/trunk/source_code/src/addotdelform.cpp |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/addmemoryform.cpp |
=================================================================== |
--- trunk/source_code/src/addmemoryform.cpp (revision 0) |
+++ trunk/source_code/src/addmemoryform.cpp (revision 257) |
@@ -0,0 +1,754 @@ |
+#include "addmemoryform.h" |
+#include "mainwindowimpl.h" |
+ |
+// place your code here |
+addmemoryForm::addmemoryForm( ) |
+ : QWidget() |
+{ |
+// QStringList proizv_list; //ñïèñîê ïðîèçâîäèòåëåé ïàìÿòè |
+ setupUi(this); |
+// proizv_list = getManufacturiesList(); |
+// comboBox->addItems(proizv_list); |
+ // TODO |
+} |
+ |
+QStringList addmemoryForm::getManufacturiesList(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from proizvoditeli_pamyati"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+ |
+QStringList addmemoryForm::getManufacturiesListVIDEO(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from proizvoditeli_video"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+ |
+ |
+ |
+QStringList addmemoryForm::getManufacturiesListMB(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from proizvoditeli_mb"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+ |
+QStringList addmemoryForm::getManufacturiesListHDD(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from proizvoditeli_hdd"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+QStringList addmemoryForm::getManufacturiesListCPU(){ |
+ QStringList mnfctrlist; |
+ QString mnfctSqlText, tmp; |
+ QSqlQuery qproiz; |
+ int field_proizvoditel; |
+ mnfctSqlText = tr("select * from proizvoditeli_cpu"); |
+// QSqlQuery qns(tr("SET NAMES utf8")); |
+ qproiz.prepare(mnfctSqlText); |
+ qproiz.exec(); |
+// QSqlQuery qproiz("SELECT * FROM Ïðîèçâîäèòåëè_ïàìÿòè"); |
+ field_proizvoditel = qproiz.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ mnfctrlist.clear(); |
+ while (qproiz.next()){ |
+ tmp = qproiz.value(field_proizvoditel).toString(); |
+// comboBox->addItem(tmp); |
+ mnfctrlist.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return mnfctrlist; |
+} |
+ |
+ |
+ |
+QStringList addmemoryForm::getModelListMB(QString proizvoditel){ |
+ QStringList modelList; |
+ QString SqlText, tmp; |
+ QSqlQuery qmodel; |
+ int field_model; |
+ SqlText = tr("select * from Ìîäåëè_ìàòåðèíñêèõ_ïëàò where Ìîäåëè_ìàòåðèíñêèõ_ïëàò.Ïðîèçâîäèòåëü = \""); |
+ SqlText.append(proizvoditel); |
+ SqlText.append(tr("\"")); |
+ qmodel.prepare(SqlText); |
+ qmodel.exec(); |
+ field_model = qmodel.record().indexOf(tr("Ìîäåëü")); |
+ modelList.clear(); |
+ while (qmodel.next()){ |
+ tmp = qmodel.value(field_model).toString(); |
+// comboBox->addItem(tmp); |
+ modelList.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return modelList; |
+} |
+ |
+ |
+ |
+QStringList addmemoryForm::getModelListVIDEO(QString proizvoditel){ |
+ QStringList modelList; |
+ QString SqlText, tmp; |
+ QSqlQuery qmodel; |
+ int field_model; |
+ SqlText = tr("select * from video_models where video_models.Ïðîèçâîäèòåëü = \""); |
+ SqlText.append(proizvoditel); |
+ SqlText.append(tr("\"")); |
+ qmodel.prepare(SqlText); |
+ qmodel.exec(); |
+ field_model = qmodel.record().indexOf(tr("Ìîäåëü")); |
+ modelList.clear(); |
+ while (qmodel.next()){ |
+ tmp = qmodel.value(field_model).toString(); |
+// comboBox->addItem(tmp); |
+ modelList.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return modelList; |
+} |
+ |
+ |
+ |
+QStringList addmemoryForm::getModelListCPU(QString proizvoditel){ |
+ QStringList modelList; |
+ QString SqlText, tmp; |
+ QSqlQuery qmodel; |
+ int field_model; |
+ SqlText = tr("select * from processor_models where processor_models.Ïðîèçâîäèòåëü = \""); |
+ SqlText.append(proizvoditel); |
+ SqlText.append(tr("\"")); |
+ qmodel.prepare(SqlText); |
+ qmodel.exec(); |
+ field_model = qmodel.record().indexOf(tr("Ìîäåëü")); |
+ modelList.clear(); |
+ while (qmodel.next()){ |
+ tmp = qmodel.value(field_model).toString(); |
+// comboBox->addItem(tmp); |
+ modelList.append (tmp); |
+ } |
+// comboBox->addItems(mnfctrlist); |
+ return modelList; |
+} |
+ |
+ |
+QStringList addmemoryForm::getSystemBlockList(){ |
+ QStringList sysBlockList; |
+ bool b1, b2; |
+ QString tmp, SerialNum, InventarNum, DataPokypki, SrokGarantii, UserId, Identifikator; |
+ int field_identifikator, field_serial_num, field_inventar_num, field_data_pokypki, field_srok_garantii, field_user_id; |
+ QSqlQuery qysBlockList(tr("select * from system_blocks")); |
+ field_serial_num = qysBlockList.record().indexOf(tr("Ñåðèéíûé_íîìåð")); |
+ field_inventar_num = qysBlockList.record().indexOf(tr("Èíâåíòàðíûé_íîìåð")); |
+ field_data_pokypki = qysBlockList.record().indexOf(tr("Äàòà_ïîêóïêè")); |
+ field_srok_garantii = qysBlockList.record().indexOf(tr("Ñðîê_ãàðàíòèè")); |
+ field_user_id = qysBlockList.record().indexOf(tr("Èäåíòèôèêàòîð_îòâåòñòâåííîãî_ëèöà")); |
+ field_identifikator = qysBlockList.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (qysBlockList.next()){ |
+ tmp = ""; |
+ SerialNum = qysBlockList.value(field_serial_num).toString(); |
+ InventarNum = qysBlockList.value(field_inventar_num).toString(); |
+ DataPokypki = qysBlockList.value(field_data_pokypki).toString(); |
+ SrokGarantii = qysBlockList.value(field_srok_garantii).toString(); |
+ UserId = qysBlockList.value(field_user_id).toString(); |
+ Identifikator = qysBlockList.value(field_identifikator).toString(); |
+ b1 = (SerialNum !=""); |
+ b2 = (SerialNum !=tr("Ñïèñàí")); |
+// if (SerialNum == tr("Ñïèñàí")){continue;} |
+// if (SerialNum == tr("Ñêëàä")){sysBlockList << tr("Íà ñêëàä"); continue;} |
+// if (SerialNum !="") {tmp.append(tr("S/N: ")); |
+// tmp.append(SerialNum); } |
+ if (InventarNum == tr("Ñïèñàí")){continue;} |
+ if (InventarNum == tr("Ñêëàä")){sysBlockList << tr("Íà ñêëàä"); continue;} |
+ if (InventarNum !="") {tmp.append(tr("Èíâ.íîì:")); |
+ tmp.append(InventarNum); } |
+ tmp.append(addmemoryForm::getUserInfo(UserId)); |
+// if (InventarNum !=""){tmp.append(tr(" Èíâ.íîì: ")); |
+// tmp.append(InventarNum);} |
+ if (tmp !="") sysBlockList << tmp; |
+ |
+ } |
+ return sysBlockList; |
+ |
+} |
+ |
+QString addmemoryForm::getUserInfo(QString userID){ |
+ QString rslt, tmp, sqlQueryText; |
+ QString identifikator_polzovatela, fio_polzovatela, identifikator_otdela; |
+ int field_identifikator, field_fio, field_id_otdela; |
+ QSqlQuery qSqlUserInfo; |
+ sqlQueryText = tr("select * from Ñîòðóäíèêè where Èäåíòèôèêàòîð = "); |
+ sqlQueryText.append(userID); |
+ qSqlUserInfo.prepare(sqlQueryText); |
+ qSqlUserInfo.exec(); |
+ field_identifikator = qSqlUserInfo.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ field_fio = qSqlUserInfo.record().indexOf(tr("ÔÈÎ")); |
+ field_id_otdela = qSqlUserInfo.record().indexOf(tr("Èäåíòèôèêàòîð_îòäåëà")); |
+ tmp=""; |
+ while(qSqlUserInfo.next()){ |
+ identifikator_polzovatela = qSqlUserInfo.value(field_identifikator).toString(); |
+ fio_polzovatela = qSqlUserInfo.value(field_fio).toString(); |
+ identifikator_otdela = qSqlUserInfo.value(field_id_otdela).toString(); |
+ if (fio_polzovatela !="") { |
+ tmp.append(tr(" ")); |
+ tmp.append(fio_polzovatela); |
+ tmp.append(addmemoryForm::getOtdelName(identifikator_otdela)); |
+ } |
+ |
+ } |
+ rslt.append(tmp); |
+ return rslt; |
+ |
+} |
+ |
+ |
+QString addmemoryForm::getOtdelName(QString otdelID){ |
+ QString otdel, sqlText, tmp; |
+ QSqlQuery query; |
+ int field_name; |
+ sqlText = (tr("select Îòäåëû.Íàçâàíèå from Îòäåëû where Èäåíòèôèêàòîð = ")); |
+ sqlText.append(otdelID); |
+ query.prepare(sqlText); |
+ query.exec(); |
+ field_name = query.record().indexOf(tr("Íàçâàíèå")); |
+ tmp=""; |
+ while(query.next()){ |
+ tmp.append(tr(" ")); |
+ tmp.append( query.value(field_name).toString()); |
+ } |
+ otdel = tmp; |
+ return otdel; |
+} |
+ |
+void addmemoryForm::initTreeWidgrt(){ |
+int fieldName, fieldID; |
+ QTreeWidgetItem *otdelItem; |
+ QSqlQuery q(tr("select * from Îòäåëû"));// ïîëó÷àåì ñïèñîê îòäåëîâ |
+ QString otdel, otdel_id; |
+ fieldName = q.record().indexOf(tr("Íàçâàíèå")); |
+ fieldID = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (q.next()){ |
+ otdel = q.value(fieldName).toString(); |
+ otdel_id = q.value(fieldID).toString(); |
+ otdelItem = new QTreeWidgetItem(addmemoryForm::treeWidget); |
+ otdelItem->setText(0, otdel); |
+ addmemoryForm::SotrydnikiOtdela(otdel_id, otdelItem); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela){ |
+ int field_fio_sotrydnika, field_id_sotrydnika; |
+ QString fio_sotrydnika_otdela, id_sotrydnika_otdela, oboryd; |
+ QSqlQuery qsotrydnikiOtdela; |
+ QString sqlQueryString; |
+ QTreeWidgetItem *treeItem_sotrydnika; |
+ sqlQueryString = tr("select Èäåíòèôèêàòîð, ÔÈÎ from Ñîòðóäíèêè where Èäåíòèôèêàòîð_îòäåëà="); |
+ sqlQueryString.append(id_otdela); |
+ qsotrydnikiOtdela.prepare(sqlQueryString); |
+ qsotrydnikiOtdela.exec(); |
+ field_fio_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("ÔÈÎ")); |
+ field_id_sotrydnika = qsotrydnikiOtdela.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ while (qsotrydnikiOtdela.next()) |
+ { |
+ fio_sotrydnika_otdela = qsotrydnikiOtdela.value(field_fio_sotrydnika).toString(); |
+ id_sotrydnika_otdela = qsotrydnikiOtdela.value(field_id_sotrydnika).toString(); |
+ treeItem_sotrydnika = new QTreeWidgetItem(itemOtdela); |
+ treeItem_sotrydnika->setText(1, fio_sotrydnika_otdela ); |
+// treeItem_sotrydnika->setText(2, id_sotrydnika_otdela ); |
+// oboryd = oborydovanie(id_sotrydnika_otdela, treeItem_sotrydnika); |
+// treeItem_sotrydnika->setText(3, oboryd ); |
+ } |
+} |
+ |
+void addmemoryForm::on_pushButton_clicked(){ |
+QSqlQuery q; |
+QString sqlText; |
+if (lineEdit->text() == "") |
+ { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ââîäà äàííûõ"), // Çàãîëîâîê. |
+ tr("Ââåäèòå èíâåíòàðíûé íîìåð")); // Òåêñò ñîîáùåíèÿ. |
+ return; |
+ } |
+switch (tabWidget->currentIndex()) |
+{ |
+ case 0: //Ìîäóëè ïàìÿòè |
+ { |
+ QString id; |
+ |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into memory (Ïðîèçâîäèòåëü, Òèï, Îáúåì, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :tip, :obem, :sys_id, :inv_num, :serial_num)")); |
+// q.bindValue(":ident", "default"); |
+ q.bindValue(tr(":proizvoditel"), comboBox->currentText()); |
+ q.bindValue(tr(":tip"), comboBox_3->currentText()); |
+ q.bindValue(tr(":obem"), comboBox_2->currentText()); |
+// q.bindValue(tr(":chastota"), "default"); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+// query.bindValue(":surname", "Simpson"); |
+// sqlText = tr("insert into Ïàìÿòü vflue()"); |
+ q.exec(); |
+ add_mem_proizvoditel(comboBox->currentText()); //äîáàâèì ïðîèçâîäèòåëÿ â ñïèñîê, åñëè åãî òàì íåò |
+ emit componentAdd(); |
+ close(); |
+// MainWindowImpl::initTreeWidget(); |
+ } |
+ break; |
+ |
+ case 1: //Âèí÷åñòåðû |
+ { |
+ QString id; |
+ |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into harddiscs (Ïðîèçâîäèòåëü, Èíòåðôåéñ, Îáúåì, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :interface, :obem, :sys_id, :inv_num, :serial_num)")); |
+// q.bindValue(":ident", "default"); |
+ q.bindValue(tr(":proizvoditel"), comboBox_13->currentText()); |
+ q.bindValue(tr(":interface"), comboBox_14->currentText()); |
+ q.bindValue(tr(":obem"), comboBox_15->currentText()); |
+// q.bindValue(tr(":chastota"), "default"); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+// query.bindValue(":surname", "Simpson"); |
+// sqlText = tr("insert into Ïàìÿòü vflue()"); |
+ q.exec(); |
+ add_hdd_proizvoditel(comboBox_13->currentText()); //äîáàâèì ïðîèçâîäèòåëÿ â ñïèñîê, åñëè åãî òàì íåò |
+ emit componentAdd(); |
+ close(); |
+// MainWindowImpl::initTreeWidget(); |
+ } |
+ break; |
+ |
+ |
+ case 2: //Ïðîöåññîðû |
+ { |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into processors (Ïðîèçâîäèòåëü, Ìîäåëü, ×àñòîòà , Ñëîò, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :fqr, :slot, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_9->currentText()); |
+ q.bindValue(tr(":model"), comboBox_12->currentText()); |
+ q.bindValue(tr(":slot"), comboBox_11->currentText()); |
+ q.bindValue(tr(":fqr"), comboBox_10->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_cpu_proizvoditel(comboBox_9->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ add_cpu_model(comboBox_9->currentText(), comboBox_12->currentText()); |
+ |
+ emit componentAdd(); |
+ close(); |
+ } |
+ break; |
+ |
+ case 3: //Ìàòåðèíñêèå ïëàòû |
+ { |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into matheboards (Ïðîèçâîäèòåëü, Ìîäåëü , Ñëîò, ×àñòîòà_øèíû, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :slot, :bus_fqr, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_5->currentText()); |
+ q.bindValue(tr(":model"), comboBox_6->currentText()); |
+ q.bindValue(tr(":slot"), comboBox_7->currentText()); |
+ q.bindValue(tr(":bus_fqr"), comboBox_8->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ } |
+ break; |
+ |
+ case 4: //CD/DVD ïðèâîäû |
+ { |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into cd_dvd (Òèï, Ïðîèçâîäèòåëü, Ñêîðîñòü, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:tip, :proizvoditel, :skorost, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":tip"), comboBox_16->currentText()); |
+ q.bindValue(tr(":proizvoditel"), comboBox_17->currentText()); |
+ q.bindValue(tr(":skorost"), comboBox_18->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ } |
+ |
+ |
+ break; |
+ |
+ case 5: //Âèäåîêàðòû |
+ { |
+ |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into videocards (Ïðîèçâîäèòåëü, Ìîäåëü , Èíòåðôåéñ, Ïàìÿòü, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :interface, :memory, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_19->currentText()); |
+ q.bindValue(tr(":model"), comboBox_20->currentText()); |
+ q.bindValue(tr(":interface"), comboBox_21->currentText()); |
+ q.bindValue(tr(":memory"), comboBox_22->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_video_proizvoditel(comboBox_19->currentText()); |
+ add_video_model(comboBox_19->currentText(), comboBox_20->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ } |
+ break; |
+ |
+ case 6: //Çâóêîâûå êàðòû |
+ { |
+ |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into soundcards (Ïðîèçâîäèòåëü, Ìîäåëü , Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_23->currentText()); |
+ q.bindValue(tr(":model"), comboBox_24->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ |
+ } |
+ break; |
+ case 7: //Ñåòåâûå êàðòû |
+ { |
+ |
+ QString id; |
+ id = getIdentifikator(label_7->text()); |
+ q.prepare(tr("insert into lancards (Ïðîèçâîäèòåëü, Ìîäåëü , Ñêîðîñòü_ïåðåäà÷è_äàííûõ, Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà, Èíâåíòàðíûé_íîìåð, Ñåðèéíûé_íîìåð) " |
+ "values (:proizvoditel, :model, :spd, :sys_id, :inv_num, :serial_num)")); |
+ q.bindValue(tr(":proizvoditel"), comboBox_25->currentText()); |
+ q.bindValue(tr(":model"), comboBox_26->currentText()); |
+ q.bindValue(tr(":spd"), comboBox_27->currentText()); |
+ q.bindValue(tr(":sys_id"), id); |
+ q.bindValue(tr(":inv_num"), lineEdit->text()); |
+ q.bindValue(tr(":serial_num"), lineEdit_2->text()); |
+ q.exec(); |
+ add_mb_proizvoditel(comboBox_5->currentText()); |
+ add_mb_model(comboBox_5->currentText(), comboBox_6->currentText()); |
+ emit componentAdd(); |
+ close(); |
+ |
+ } |
+ break; |
+ |
+ default: |
+ |
+ |
+ break; |
+} |
+ |
+void componentAdd(); |
+ |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+QString addmemoryForm::getIdentifikator(QString inventar_num){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_id; |
+ QString identifikator; |
+ if (inventar_num == tr("Íà ñêëàä")) return tr("1"); |
+ sqltext = tr("select * from system_blocks where system_blocks.Èíâåíòàðíûé_íîìåð = \""); |
+ sqltext.append(inventar_num); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_id = q.record().indexOf(tr("Èäåíòèôèêàòîð")); |
+ if (q.next()) {identifikator = q.value(field_id).toString();} |
+ else { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Îøèáêà ââîäà äàííûõ"), // Çàãîëîâîê. |
+ tr("Íåâîçìîæíî îïðåäåëèòü èäåíòèôèêàòîð ñèñòåìíîãî áëîêà")); // Òåêñò ñîîáùåíèÿ. |
+ return identifikator; |
+ |
+ |
+ }; |
+ return identifikator; |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+void addmemoryForm::add_video_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_video where proizvoditeli_video.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_video (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+ |
+void addmemoryForm::add_mem_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_pamyati where proizvoditeli_pamyati.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_pamyati (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+ |
+void addmemoryForm::add_mb_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_mb where proizvoditeli_mb.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_mb (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::add_hdd_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_hdd where proizvoditeli_hdd.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_hdd (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::add_cpu_proizvoditel(QString brend){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from proizvoditeli_cpu where proizvoditeli_hdd.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into proizvoditeli_cpu (Ïðîèçâîäèòåëü) " |
+ "values (:proizvoditel)")); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::add_mb_model(QString brend, QString model){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from Ìîäåëè_ìàòåðèíñêèõ_ïëàò where Ìîäåëè_ìàòåðèíñêèõ_ïëàò.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\" and Ìîäåëè_ìàòåðèíñêèõ_ïëàò.Ìîäåëü = \"")); |
+ sqltext.append(model); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into Ìîäåëè_ìàòåðèíñêèõ_ïëàò (Ìîäåëü, Ïðîèçâîäèòåëü) " |
+ "values (:model, :proizvoditel)")); |
+ q.bindValue(tr(":model"), model); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+ |
+ |
+void addmemoryForm::add_cpu_model(QString brend, QString model){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from processor_models where processor_models.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\" and processor_models.Ìîäåëü = \"")); |
+ sqltext.append(model); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into processor_models (Ìîäåëü, Ïðîèçâîäèòåëü) " |
+ "values (:model, :proizvoditel)")); |
+ q.bindValue(tr(":model"), model); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+void addmemoryForm::add_video_model(QString brend, QString model){ |
+ QSqlQuery q; |
+ QString sqltext; |
+ int field_proizvoditel; |
+ QString proizv; |
+ sqltext = tr("select * from video_models where video_models.Ïðîèçâîäèòåëü = \""); |
+ sqltext.append(brend); |
+ sqltext.append(tr("\" and video_models.Ìîäåëü = \"")); |
+ sqltext.append(model); |
+ sqltext.append(tr("\"")); |
+ q.prepare(sqltext); |
+ q.exec(); |
+ field_proizvoditel = q.record().indexOf(tr("Ïðîèçâîäèòåëü")); |
+ if (q.next()) {return;} |
+ else { |
+ q.prepare(tr("insert into video_models (Ìîäåëü, Ïðîèçâîäèòåëü) " |
+ "values (:model, :proizvoditel)")); |
+ q.bindValue(tr(":model"), model); |
+ q.bindValue(tr(":proizvoditel"), brend); |
+ q.exec(); |
+ } |
+ |
+} |
+ |
+ |
+//void addmemoryForm::hide (){ |
+// treeWidget->setEnabled(true); |
+//} |
+ |
+void addmemoryForm::closeEvent ( QCloseEvent * event ) { |
+ emit formClose(); |
+} |
+ |
+ |
Index: trunk/source_code/src/settingform.h |
=================================================================== |
--- trunk/source_code/src/settingform.h (revision 0) |
+++ trunk/source_code/src/settingform.h (revision 257) |
@@ -0,0 +1,15 @@ |
+#ifndef __SETTINGFORM_H__ |
+#define __SETTINGFORM_H__ |
+#include <QWidget> |
+#include "ui_settingform.h" |
+// place your code here |
+class settingForm : public QWidget, public Ui::settingForm |
+{ |
+Q_OBJECT |
+public: |
+ settingForm(); |
+ |
+ private slots: |
+// void on_pushButton_clicked(); |
+}; |
+#endif // __SETTINGFORM_H__ |
/trunk/source_code/src/settingform.h |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/form.h |
=================================================================== |
--- trunk/source_code/src/form.h (revision 0) |
+++ trunk/source_code/src/form.h (revision 257) |
@@ -0,0 +1,48 @@ |
+#ifndef FORM_H |
+#define FORM_H |
+ |
+#include <QtGui/QWidget> |
+#include <QtGui> |
+#include <QMainWindow> |
+#include <QString> |
+#include <QtSql> |
+#include <QSqlTableModel> |
+#include <QTableView> |
+#include <QSqlDriverPlugin> |
+#include <QIcon> |
+#include <QVariant> |
+#include <QProcess> |
+#include <QByteArray> |
+ |
+namespace Ui { |
+ class Form; |
+} |
+ |
+class Form : public QWidget { |
+ Q_OBJECT |
+public: |
+ Form(QWidget *parent = 0); |
+ ~Form(); |
+ |
+protected: |
+ void changeEvent(QEvent *e); |
+ |
+private: |
+ Ui::Form *m_ui; |
+ QTextDocument *document; |
+ QTextCursor *cursor; |
+ |
+ |
+public: |
+ QProcess wmiProcess; |
+ QStringList get_substr_arr(QString stroka, QString razdelitel); |
+ |
+private slots: |
+ |
+void on_wmiButton_clicked(); |
+void readStandartProcessOutput(); |
+void readStandartProcessError(); |
+ |
+}; |
+ |
+#endif // FORM_H |
Index: trunk/source_code/src/addotdelform.h |
=================================================================== |
--- trunk/source_code/src/addotdelform.h (revision 0) |
+++ trunk/source_code/src/addotdelform.h (revision 257) |
@@ -0,0 +1,33 @@ |
+#ifndef __ADDOTDELFORM_H__ |
+#define __ADDOTDELFORM_H__ |
+ |
+// place your code here |
+#include <QDialog> |
+#include <QtGui> |
+#include <QtSql> |
+#include "ui_addotdelform.h" |
+ |
+class addotdelForm : public QDialog, public Ui::addotdelform |
+{ |
+Q_OBJECT |
+ public: |
+ addotdelForm(); |
+ |
+ |
+signals: |
+ void formClose(); |
+ void componentAdd(); |
+ |
+private slots: |
+ void addNemOtdelSlot(); |
+ |
+private: |
+ |
+protected: |
+ void closeEvent( QCloseEvent * event ); |
+ |
+ |
+}; |
+ |
+ |
+#endif // __ADDOTDELFORM_H__ |
/trunk/source_code/src/addotdelform.h |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/src/addmemoryform.h |
=================================================================== |
--- trunk/source_code/src/addmemoryform.h (revision 0) |
+++ trunk/source_code/src/addmemoryform.h (revision 257) |
@@ -0,0 +1,56 @@ |
+#ifndef __ADDMEMORYFORM_H__ |
+#define __ADDMEMORYFORM_H__ |
+#include <QWidget> |
+#include <QtSql> |
+#include <QtGui> |
+#include "ui_addmemoryform.h" |
+// place your code here |
+class addmemoryForm : public QWidget, public Ui::addmemoryForm |
+{ |
+Q_OBJECT |
+ public: |
+ addmemoryForm(); |
+// addmemoryForm(QTreeWidgetItem * currItem); |
+ QStringList getManufacturiesList(); |
+ QStringList getManufacturiesListMB(); |
+ QStringList getManufacturiesListHDD(); |
+ QStringList getManufacturiesListCPU(); |
+ QStringList getManufacturiesListVIDEO(); |
+ QStringList getModelListMB(QString proizvoditel); |
+ QStringList getModelListCPU(QString proizvoditel); |
+ QStringList getModelListVIDEO(QString proizvoditel); |
+ QStringList getSystemBlockList(); |
+ QStringList getSystemBlockList(QString inventar_num); |
+ QString getUserInfo(QString userID); |
+ QString getOtdelName(QString otdelID); |
+ QString getIdentifikator(QString inventar_num); |
+ void initTreeWidgrt(); |
+ void SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela); // ôîðìèðóåì ñïèñîê ñîòðóäíèêîâ |
+ |
+//public slots: |
+// void hide(); |
+ |
+signals: |
+ void componentAdd(); |
+ void formClose(); |
+ |
+private slots: |
+ void on_pushButton_clicked(); |
+ void on_comboBox_5_currentIndexChanged (QString newText); |
+ void on_comboBox_9_currentIndexChanged (QString newText); |
+ void on_comboBox_19_currentIndexChanged (QString newText); |
+private: |
+ void add_video_proizvoditel(QString brend); |
+ void add_mem_proizvoditel(QString brend); |
+ void add_mb_proizvoditel(QString brend); |
+ void add_cpu_proizvoditel(QString brend); |
+ void add_hdd_proizvoditel(QString brend); |
+ void add_mb_model (QString brend, QString model); |
+ void add_cpu_model (QString brend, QString model); |
+ void add_video_model (QString brend, QString model); |
+protected: |
+ void closeEvent( QCloseEvent * event ); |
+ |
+ |
+}; |
+#endif // __ADDMEMORYFORM_H__ |
/trunk/source_code/src/addmemoryform.h |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/bin/soundcard1.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/soundcard1.png |
=================================================================== |
--- trunk/source_code/bin/soundcard1.png (revision 0) |
+++ trunk/source_code/bin/soundcard1.png (revision 257) |
/trunk/source_code/bin/soundcard1.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/source_code/bin/hdd5.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/hdd5.png |
=================================================================== |
--- trunk/source_code/bin/hdd5.png (revision 0) |
+++ trunk/source_code/bin/hdd5.png (revision 257) |
/trunk/source_code/bin/hdd5.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/source_code/bin/cd_dvd3.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/cd_dvd3.png |
=================================================================== |
--- trunk/source_code/bin/cd_dvd3.png (revision 0) |
+++ trunk/source_code/bin/cd_dvd3.png (revision 257) |
/trunk/source_code/bin/cd_dvd3.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/source_code/bin/vidiocard2.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/vidiocard2.png |
=================================================================== |
--- trunk/source_code/bin/vidiocard2.png (revision 0) |
+++ trunk/source_code/bin/vidiocard2.png (revision 257) |
/trunk/source_code/bin/vidiocard2.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/source_code/bin/memory1.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/memory1.png |
=================================================================== |
--- trunk/source_code/bin/memory1.png (revision 0) |
+++ trunk/source_code/bin/memory1.png (revision 257) |
/trunk/source_code/bin/memory1.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/source_code/bin/cpu3.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/cpu3.png |
=================================================================== |
--- trunk/source_code/bin/cpu3.png (revision 0) |
+++ trunk/source_code/bin/cpu3.png (revision 257) |
/trunk/source_code/bin/cpu3.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/source_code/bin/lan1.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/lan1.png |
=================================================================== |
--- trunk/source_code/bin/lan1.png (revision 0) |
+++ trunk/source_code/bin/lan1.png (revision 257) |
/trunk/source_code/bin/lan1.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/source_code/bin/icon_motherboard.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/icon_motherboard.png |
=================================================================== |
--- trunk/source_code/bin/icon_motherboard.png (revision 0) |
+++ trunk/source_code/bin/icon_motherboard.png (revision 257) |
/trunk/source_code/bin/icon_motherboard.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/source_code/bin/pc.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/source_code/bin/pc.png |
=================================================================== |
--- trunk/source_code/bin/pc.png (revision 0) |
+++ trunk/source_code/bin/pc.png (revision 257) |
/trunk/source_code/bin/pc.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/ClassEditor/settingsdialog.h |
=================================================================== |
--- trunk/ClassEditor/settingsdialog.h (revision 0) |
+++ trunk/ClassEditor/settingsdialog.h (revision 257) |
@@ -0,0 +1,23 @@ |
+#ifndef SETTINGSDIALOG_H |
+#define SETTINGSDIALOG_H |
+ |
+#include <QDialog> |
+ |
+namespace Ui { |
+ class SettingsDialog; |
+} |
+ |
+class SettingsDialog : public QDialog { |
+ Q_OBJECT |
+public: |
+ SettingsDialog(QWidget *parent = 0); |
+ ~SettingsDialog(); |
+ |
+protected: |
+ void changeEvent(QEvent *e); |
+ |
+private: |
+ Ui::SettingsDialog *ui; |
+}; |
+ |
+#endif // SETTINGSDIALOG_H |
Index: trunk/ClassEditor/modelforpointers.cpp |
=================================================================== |
--- trunk/ClassEditor/modelforpointers.cpp (revision 0) |
+++ trunk/ClassEditor/modelforpointers.cpp (revision 257) |
@@ -0,0 +1,173 @@ |
+#include "modelforpointers.h" |
+ |
+ModelForPointers::ModelForPointers(QObject *parent) : |
+ QSqlTableModel(parent) |
+{ |
+ setEditStrategy(QSqlTableModel::OnManualSubmit); |
+} |
+ |
+Qt::ItemFlags ModelForPointers::flags( |
+ const QModelIndex &index) const { |
+Qt::ItemFlags flags = QSqlTableModel::flags(index); |
+if ((index.column() != 3) && (index.column() != 0)) |
+ flags |= Qt::ItemIsEditable; |
+//if (index.column() == 4) |
+// flags |= Qt::ItemIsUserCheckable; |
+else |
+{ |
+ if ((index.column() == 3) || (index.column() == 0)) flags &= ~Qt::ItemIsEditable; // çàïðåùàåì ðåäàêòèðîâàíèå òðåòüåãî ñòîëáöà |
+} |
+ return flags; |
+} |
+ |
+ |
+bool ModelForPointers::setData(const QModelIndex &index, const QVariant &value, int role) { |
+ //// if (index.column()==3) return false; // â òðåòüåé êîëîíêå íå äàåì ïîìåíÿòü çíà÷åíèå |
+ bool lResult = false; |
+ QVariant old_value; // ñîõðàíèì ñòàðîå çíà÷åíèå |
+ old_value = data(index); |
+ |
+ if (index.column()==1){ // åñëè ïîìåíÿëîñü èìÿ ïîëÿ |
+ QSqlQuery qu; |
+ QString old_field_name; // ñòàðîå èìÿ ïîëÿ |
+ QString new_field_name; // íîâîå èìÿ ïîëÿ |
+ QString query_str; |
+ QString type_str; // òèï äàííûõ ïîëÿ |
+ old_field_name = old_value.toString(); // îïðåäåëèì òåêóùåå (êîòîðîå íóæíî ïîìåíÿòü) èìÿ ïîëÿ |
+ new_field_name = value.toString(); |
+ // type_str = data(ModelForPointers::index(index.row(), 3)).toString(); // òèï ïîëÿ õðàíèòüñÿ â 3 ñòîëáöå, ñ÷èòûâàåì åãî çíà÷åíèå |
+ type_str = tr("CHAR(10)"); |
+ |
+ query_str = tr("ALTER TABLE "); |
+ query_str.append(ModelForPointers::Inctance); |
+ query_str.append(tr(" CHANGE COLUMN `")); |
+ query_str.append(old_field_name); |
+ query_str.append(tr("` `")); |
+ query_str.append(new_field_name); |
+ query_str.append(tr("` ")); |
+ query_str.append(type_str); |
+ query_str.append(tr(" CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL")); |
+ qu.prepare(query_str); |
+ bool ok; |
+ ok = qu.exec(); |
+ if (!ok) return false; |
+ } |
+ |
+ |
+ |
+ lResult = QSqlTableModel::setData(index, value, role); |
+ if (lResult) { |
+ QModelIndex newindex; |
+ QSqlRecord rec = record(index.row()); |
+ |
+ rec.setValue(index.column(), value); |
+ rec.setGenerated(index.column(), true); |
+ |
+ |
+ lResult = updateRowInTable(index.row(), rec); |
+ emit field_changed(); |
+ /// QSqlTableModel::setData(newindex, QVariant(str_tmp), Qt::EditRole); |
+ |
+ |
+ } |
+ return lResult; |
+} |
+ |
+ |
+ |
+QVariant ModelForPointers::data(const QModelIndex &index, int role) const { |
+ |
+ QVariant value = QSqlTableModel::data(index, role); |
+ switch (role) { |
+ case Qt::DisplayRole: { |
+ if(index.column() == 4){ |
+ QSqlQuery q; |
+ QString sql_str; |
+ bool ok; |
+ sql_str = tr("select * from `ListOfClasses` where `ID` = "); |
+ sql_str.append(value.toString()); |
+ |
+ q.prepare(sql_str); |
+ |
+ ok = q.exec(); |
+ |
+ if (ok) { |
+ while(q.next()){ |
+ QString class_name = q.value(1).toString(); |
+ if (!class_name.isEmpty()) return class_name; |
+ |
+ } |
+ |
+ |
+ } |
+ |
+ } |
+ |
+ |
+ return value; |
+ } |
+ |
+ |
+ |
+ case Qt::EditRole: return value; |
+ case Qt::TextColorRole: |
+ if(index.column() == 1) |
+ return qVariantFromValue(QColor(Qt::blue)); |
+ else |
+ return value; |
+ case Qt::TextAlignmentRole: return value; |
+ case Qt::FontRole: |
+ if(index.column() == 1) { |
+ QFont font = QFont("Helvetica", 16, QFont::Bold); |
+ return qVariantFromValue(font); |
+ }else |
+ return value; |
+ |
+ case Qt::BackgroundColorRole: { |
+ int a = (index.row() % 2) ? 14 : 0; |
+ if(index.column() == 2) |
+ return qVariantFromValue(QColor(220,240-a,230-a)); |
+ else if(index.column() == 4) |
+ return qVariantFromValue(QColor(200,220-a,255-a)); |
+ else |
+ return value; |
+ } |
+ |
+ |
+ |
+ case Qt::CheckStateRole: return value; |
+ |
+ case Qt::SizeHintRole:return value; |
+ |
+ } |
+ return value; |
+} |
+ |
+void ModelForPointers::setInctance(QString currInctatce){ // ïåðåäàåì èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
+ ModelForPointers::Inctance = currInctatce; |
+} |
+ |
+ |
+bool ModelForPointers::onlySetData(const QModelIndex &index, const QVariant &value, int role){ |
+ bool lResult = false; |
+ |
+ QSqlRecord rec = record(index.row()); |
+ rec.setValue(index.column(), value); |
+ rec.setGenerated(index.column(), true); |
+ |
+ |
+ lResult = QSqlTableModel::setData(index, value, role); |
+ if (lResult) { |
+ lResult = updateRowInTable(index.row(), rec); |
+ // emit field_changed(); |
+/// QSqlTableModel::setData(newindex, QVariant(str_tmp), Qt::EditRole); |
+ } |
+ |
+ |
+ |
+ |
+ return lResult; |
+ |
+} |
+ |
+ |
Index: trunk/ClassEditor/tablefield.h |
=================================================================== |
--- trunk/ClassEditor/tablefield.h (revision 0) |
+++ trunk/ClassEditor/tablefield.h (revision 257) |
@@ -0,0 +1,63 @@ |
+#ifndef TABLEFIELD_H |
+#define TABLEFIELD_H |
+ |
+#include <QObject> |
+#include <QtGui> |
+#include <QMainWindow> |
+#include <QString> |
+#include <QtSql> |
+#include <QSqlTableModel> |
+#include <QTableView> |
+#include <QSqlDriverPlugin> |
+#include <QIcon> |
+#include <QVariant> |
+#include <QProcess> |
+#include <QByteArray> |
+ |
+class TableField : public QObject |
+{ |
+Q_OBJECT |
+public: |
+ |
+/*********************************************************************************************** |
+ ** Êîíñòðóêòîð êëàññà TableField èìååò îäèí îáÿçàòåëüíûé ïàðàìåòð - èìÿ ïîëÿ |
+ ** îñòàëüíûå ïàðàìåòðû èìåþò çíà÷åíèÿ ïî óìîë÷àíèþ: |
+ ** *parent = 0 (íåò "ðîäèòåëüñêîãî" îáúåêòà) |
+ ** ftype = CHAR(30) (òèï õðàíèìûõ â ïîëå äàííûõ - ñòðîêà èç 30 ñèìâîëîâ) |
+ ** fdefaultValue = NULL (äàííûå â ïîëå ìîãóò èìåòü "ïóñòîå" çíà÷åíèå) |
+ ***********************************************************************************************/ |
+ |
+ |
+ explicit TableField(QString fname = "ID", QObject *parent = 0, QString ftype = "CHAR(30)", QString fdefaultValue = "NULL"); |
+ |
+signals: |
+ |
+public slots: |
+ |
+private: |
+ QString fieldName; // ïåðåìåííàÿ ñîäåðæèò èìÿ ïîëÿ |
+ QString fieldType; // ïåðåìåííàÿ óêàçûâàåò íà òèï äàííûõ, õðàíèìûõ â ïîëå |
+ QString defaultValue; // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ QString characterSet; // ïåðåìåííàÿ ñîäåðæèò êîäèðîâêó, â êîòîðîé õðàíÿòüñÿ òåêñòîâûå äàííûå |
+ bool notNull; // ôëàã, óêàçûâàþùèé, ÷òî õðàíèìîå â ïîëå çíà÷åíèå íå ìîæåò áûòü ïóñòûì (NULL) |
+ bool autoIncrement; // ôëàã, óêàçûâàþùèé, ÷òî ïîëå ÿâëÿåòñÿ àâòîèíêåìåíòíûì |
+ QString SqlString; // ñêòîêà Sql-çàïðîñà äëÿ ñîçäàíèÿ ïîëÿ â áàçå äàííûõ |
+ void createSqlString(); // ôóíêöèÿ ãåíåðèðóåò ñòðîêó Sql-çàïðîñà, êîòîðàÿ ñîçäàåò â áàçå äàííûõ ñîîòâåòñòâóþùåå ïîëå |
+protected: |
+ |
+public: |
+ void setName(QString name); |
+ void setType(QString ftype); |
+ void setAutoIncrement(bool autoInc); // óñòàíàâëèâàåì ôëàã, óêàçûâàþùèé, ÷òî ïîëå ÿâëÿåòñÿ àâòîèíêåìåíòíûì |
+ bool isAutoIncrement(); // óñòàíàâëèâàåì ôëàã, óêàçûâàþùèé, ÿâëÿåòñÿ ëè ïîëå àâòîèíêåìåíòíûì |
+ |
+ QString name(); |
+ QString type(); |
+ bool isNotNull(); |
+ void setNotNull(bool fnotNull); |
+ void setDefaultValue(QString fdefaultValue); |
+ |
+ QString sqlString(); // ôóíêöèÿ âîçâðàùàåò ñòðîêó Sql-çàïðîñà, êîòîðàÿ ñîçäàåò â áàçå äàííûõ ñîîòâåòñòâóþùåå ïîëå |
+}; |
+ |
+#endif // TABLEFIELD_H |
Index: trunk/ClassEditor/settingform.cpp |
=================================================================== |
--- trunk/ClassEditor/settingform.cpp (revision 0) |
+++ trunk/ClassEditor/settingform.cpp (revision 257) |
@@ -0,0 +1,10 @@ |
+#include "settingform.h" |
+ |
+// place your code here |
+settingForm::settingForm( ) |
+ : QWidget() |
+{ |
+ setupUi(this); |
+ |
+ // TODO |
+} |
/trunk/ClassEditor/settingform.cpp |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/ClassEditor/mymodel.cpp |
=================================================================== |
--- trunk/ClassEditor/mymodel.cpp (revision 0) |
+++ trunk/ClassEditor/mymodel.cpp (revision 257) |
@@ -0,0 +1,181 @@ |
+#include "mymodel.h" |
+ |
+MyModel::MyModel(QObject *parent) : |
+ QSqlTableModel(parent) |
+{ |
+ setEditStrategy(QSqlTableModel::OnManualSubmit); |
+} |
+ |
+Qt::ItemFlags MyModel::flags( |
+ const QModelIndex &index) const { |
+Qt::ItemFlags flags = QSqlTableModel::flags(index); |
+if ((index.column() != 3) && (index.column() != 0) /* && (index.column() != 5)*/) |
+ flags |= Qt::ItemIsEditable; |
+//if (index.column() == 4) |
+// flags |= Qt::ItemIsUserCheckable; |
+else |
+{ |
+ if ((index.column() == 3) || (index.column() == 0) /* || (index.column() == 5)*/) flags &= ~Qt::ItemIsEditable; // çàïðåùàåì ðåäàêòèðîâàíèå 0, 3 è 5 ñòîëáöà |
+} |
+ return flags; |
+} |
+ |
+ |
+bool MyModel::setData(const QModelIndex &index, const QVariant &value, int role) { |
+ //// if (index.column()==3) return false; // â òðåòüåé êîëîíêå íå äàåì ïîìåíÿòü çíà÷åíèå |
+ bool lResult = false; |
+ |
+ /* |
+ QString str_tmp; |
+ if (index.column()==1) { // åñëè ìåíÿåì èìÿ êëàññà |
+ str_tmp = value.toString(); // òî ïîìåíÿåì è èìÿ òàáëèöû |
+ str_tmp.append(tr(" instance")); |
+ } |
+ */ |
+/* |
+ QString str_tmp; |
+ if (index.column()==0) { // åñëè ìåíÿåì èìÿ êëàññà |
+ str_tmp = value.toString(); // òî ïîìåíÿåì è èìÿ òàáëèöû |
+ str_tmp.append(tr("_instance")); |
+ } |
+*/ |
+ lResult = QSqlTableModel::setData(index, value, role); |
+ |
+ // if (index.column() == 5) return lResult; |
+ if (lResult) { |
+ QModelIndex newindex; |
+ QSqlRecord rec = record(index.row()); |
+ |
+ if (value.isNull()) { |
+ rec.setNull(index.column()); |
+ |
+ } |
+ else rec.setValue(index.column(), value); |
+ |
+ rec.setGenerated(index.column(), true); |
+ |
+ /* |
+ if (index.column()==1){ |
+ rec.setValue(index.column()+2, QVariant(str_tmp)); |
+ rec.setGenerated(index.column()+2, true); |
+ newindex = MyModel::index(index.row(), index.column()+2); |
+ QSqlTableModel::setData(newindex, QVariant(str_tmp), Qt::EditRole); |
+ } |
+ */ |
+/* |
+ |
+ if (index.column()==0){ |
+ rec.setValue(index.column()+3, QVariant(str_tmp)); |
+ rec.setGenerated(index.column()+3, true); |
+ newindex = MyModel::index(index.row(), index.column()+3); |
+ QSqlTableModel::setData(newindex, QVariant(str_tmp), Qt::EditRole); |
+ } |
+*/ |
+ |
+ lResult = updateRowInTable(index.row(), rec); |
+ /// QSqlTableModel::setData(newindex, QVariant(str_tmp), Qt::EditRole); |
+ // submitAll(); |
+ // this->select(); |
+ |
+ } |
+ if (value.isNull()) { |
+ select(); |
+ emit dataChanged(index, index); |
+ } |
+ return lResult; |
+} |
+ |
+ |
+ |
+QVariant MyModel::data(const QModelIndex &index, int role) const { |
+ |
+ QVariant value = QSqlTableModel::data(index, role); |
+ switch (role) { |
+ case Qt::DisplayRole: return value; |
+ case Qt::EditRole: return value; |
+ case Qt::TextColorRole: |
+ if(index.column() == 1) |
+ return qVariantFromValue(QColor(Qt::blue)); |
+ else |
+ return value; |
+ case Qt::TextAlignmentRole: return value; |
+ case Qt::FontRole: |
+ if(index.column() == 1) { |
+ QFont font = QFont("Helvetica", 16, QFont::Bold); |
+ return qVariantFromValue(font); |
+ }else |
+ return value; |
+ |
+ case Qt::BackgroundColorRole: { |
+ int a = (index.row() % 2) ? 14 : 0; |
+ if(index.column() == 2) |
+ return qVariantFromValue(QColor(220,240-a,230-a)); |
+ else if(index.column() == 4) |
+ return qVariantFromValue(QColor(200,220-a,255-a)); |
+ else |
+ return value; |
+ } |
+ |
+ |
+ |
+ case Qt::CheckStateRole: return value; |
+ |
+ case Qt::SizeHintRole: |
+ { |
+ |
+ int height = value.toSize().height(); |
+ int widht = value.toSize().width(); |
+ if(index.column() == 5) { |
+ QVariant currentImage = QSqlTableModel::data(index, 0); |
+ QByteArray bytes = currentImage.toByteArray(); |
+ QPixmap pxmp; |
+ |
+ |
+ if (currentImage.isValid()) { |
+ pxmp.loadFromData(bytes); |
+ if (height < pxmp.height()) height = pxmp.height() +10; |
+ if (widht < pxmp.width()) widht = pxmp.width() +10; |
+ return QVariant(QSize(widht, height)); |
+ |
+ } |
+ else return value; |
+ |
+ } |
+ |
+ |
+ // QSize size(200,100); |
+ |
+ return value; |
+ // return QVariant(size); |
+ } |
+ |
+ case Qt::DecorationRole: { |
+ if(index.column() == 1) return iconProvider.icon(QFileIconProvider::Folder); |
+ else return QVariant(); |
+ /*{ |
+ QVariant currentImage = QSqlTableModel::data(index, 0); |
+ QByteArray bytes = currentImage.toByteArray(); |
+ QPixmap pxmp; |
+ if (currentImage.isValid()) { |
+ pxmp.loadFromData(bytes); |
+ QIcon icon; |
+ icon.addPixmap(pxmp); |
+ return icon; |
+ |
+ } |
+ else { |
+ //QItemDelegate::paint(painter, option, index); |
+ return value; |
+ } |
+ |
+ } |
+ */ |
+ |
+ } |
+ |
+ |
+ |
+ } |
+ return value; |
+} |
+ |
Index: trunk/ClassEditor/classeditor.ui |
=================================================================== |
--- trunk/ClassEditor/classeditor.ui (revision 0) |
+++ trunk/ClassEditor/classeditor.ui (revision 257) |
@@ -0,0 +1,391 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>ClassEditor</class> |
+ <widget class="QMainWindow" name="ClassEditor"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>983</width> |
+ <height>757</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>ClassEditor</string> |
+ </property> |
+ <widget class="QWidget" name="centralWidget"> |
+ <widget class="QWidget" name="verticalLayoutWidget_5"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>19</x> |
+ <y>0</y> |
+ <width>951</width> |
+ <height>701</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout" name="verticalLayout_8"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_7"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_6"> |
+ <item> |
+ <layout class="QHBoxLayout" name="horizontalLayout"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_5"> |
+ <item> |
+ <widget class="QLabel" name="label"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Список зарегистрированных классов</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QTableView" name="tableView"> |
+ <property name="minimumSize"> |
+ <size> |
+ <width>0</width> |
+ <height>100</height> |
+ </size> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout"> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_4"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_2"> |
+ <property name="text"> |
+ <string>Удалить класс</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="text"> |
+ <string>Новый класс</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer_2"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_3"> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_3"> |
+ <property name="text"> |
+ <string>Новое поле</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_4"> |
+ <property name="text"> |
+ <string>Удалить выделенные поля</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_5"> |
+ <property name="text"> |
+ <string>Удалить все поля</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <spacer name="verticalSpacer"> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ <item> |
+ <layout class="QVBoxLayout" name="verticalLayout_2"> |
+ <property name="sizeConstraint"> |
+ <enum>QLayout::SetDefaultConstraint</enum> |
+ </property> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_6"> |
+ <property name="text"> |
+ <string>Новый указатель</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_7"> |
+ <property name="text"> |
+ <string>Удалить выделенные указатели</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton_8"> |
+ <property name="text"> |
+ <string>Удалить все указатели</string> |
+ </property> |
+ </widget> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_2"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Поля класса</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QTableView" name="tableView_2"/> |
+ </item> |
+ </layout> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_3"> |
+ <property name="font"> |
+ <font> |
+ <pointsize>11</pointsize> |
+ <weight>75</weight> |
+ <bold>true</bold> |
+ </font> |
+ </property> |
+ <property name="text"> |
+ <string>Поля для указателей на классы-контейнеры</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QTableView" name="tableView_3"/> |
+ </item> |
+ </layout> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <widget class="QMenuBar" name="menuBar"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>983</width> |
+ <height>24</height> |
+ </rect> |
+ </property> |
+ <widget class="QMenu" name="menu"> |
+ <property name="title"> |
+ <string>Класс</string> |
+ </property> |
+ <widget class="QMenu" name="menu_3"> |
+ <property name="title"> |
+ <string>Удалить классы</string> |
+ </property> |
+ <addaction name="action_removeAllClasses"/> |
+ <addaction name="separator"/> |
+ <addaction name="action_removeSelectedClasses"/> |
+ </widget> |
+ <addaction name="action_newClass"/> |
+ <addaction name="separator"/> |
+ <addaction name="menu_3"/> |
+ <addaction name="separator"/> |
+ <addaction name="action_ID"/> |
+ <addaction name="action_showAlias"/> |
+ <addaction name="action_showInstance"/> |
+ </widget> |
+ <widget class="QMenu" name="menu_2"> |
+ <property name="title"> |
+ <string>Поле</string> |
+ </property> |
+ <widget class="QMenu" name="menu_4"> |
+ <property name="title"> |
+ <string>Удалить поля</string> |
+ </property> |
+ <addaction name="action_removeAllFields"/> |
+ <addaction name="separator"/> |
+ <addaction name="action_removeSelectedFields"/> |
+ </widget> |
+ <addaction name="action_newField"/> |
+ <addaction name="separator"/> |
+ <addaction name="menu_4"/> |
+ </widget> |
+ <widget class="QMenu" name="menu_5"> |
+ <property name="title"> |
+ <string>Указатель</string> |
+ </property> |
+ <widget class="QMenu" name="menu_7"> |
+ <property name="title"> |
+ <string>Удалить указатели</string> |
+ </property> |
+ <addaction name="action_removeAllPointer"/> |
+ <addaction name="separator"/> |
+ <addaction name="action_removeSelectedPointers"/> |
+ </widget> |
+ <addaction name="action_newPointer"/> |
+ <addaction name="separator"/> |
+ <addaction name="menu_7"/> |
+ </widget> |
+ <widget class="QMenu" name="menu_6"> |
+ <property name="title"> |
+ <string>Инструменты</string> |
+ </property> |
+ <addaction name="action_2"/> |
+ </widget> |
+ <widget class="QMenu" name="menu_8"> |
+ <property name="title"> |
+ <string>База данных</string> |
+ </property> |
+ <addaction name="getsettingAct"/> |
+ </widget> |
+ <addaction name="menu"/> |
+ <addaction name="menu_2"/> |
+ <addaction name="menu_5"/> |
+ <addaction name="menu_6"/> |
+ <addaction name="menu_8"/> |
+ </widget> |
+ <widget class="QToolBar" name="mainToolBar"> |
+ <attribute name="toolBarArea"> |
+ <enum>TopToolBarArea</enum> |
+ </attribute> |
+ <attribute name="toolBarBreak"> |
+ <bool>false</bool> |
+ </attribute> |
+ </widget> |
+ <widget class="QStatusBar" name="statusBar"/> |
+ <action name="action_newClass"> |
+ <property name="text"> |
+ <string>Новый класс</string> |
+ </property> |
+ </action> |
+ <action name="action_removeAllClasses"> |
+ <property name="text"> |
+ <string>Удалить все классы</string> |
+ </property> |
+ </action> |
+ <action name="action_removeSelectedClasses"> |
+ <property name="text"> |
+ <string>Удалить выбранные классы</string> |
+ </property> |
+ </action> |
+ <action name="action_newField"> |
+ <property name="text"> |
+ <string>Новое поле</string> |
+ </property> |
+ </action> |
+ <action name="action_removeAllFields"> |
+ <property name="text"> |
+ <string>Удалить все поля</string> |
+ </property> |
+ </action> |
+ <action name="action_removeSelectedFields"> |
+ <property name="text"> |
+ <string>Удалить выделенные поля</string> |
+ </property> |
+ </action> |
+ <action name="action_ID"> |
+ <property name="checkable"> |
+ <bool>true</bool> |
+ </property> |
+ <property name="text"> |
+ <string>Показывать ID</string> |
+ </property> |
+ </action> |
+ <action name="action_showAlias"> |
+ <property name="checkable"> |
+ <bool>true</bool> |
+ </property> |
+ <property name="text"> |
+ <string>Показывать псевдоним</string> |
+ </property> |
+ </action> |
+ <action name="action_showInstance"> |
+ <property name="checkable"> |
+ <bool>true</bool> |
+ </property> |
+ <property name="text"> |
+ <string>Показывать хранилища объектов</string> |
+ </property> |
+ </action> |
+ <action name="action_newPointer"> |
+ <property name="text"> |
+ <string>Новый указатель</string> |
+ </property> |
+ </action> |
+ <action name="action_3"> |
+ <property name="text"> |
+ <string>Удалить все указатели</string> |
+ </property> |
+ </action> |
+ <action name="action_4"> |
+ <property name="text"> |
+ <string>Удалить выделенные указатели</string> |
+ </property> |
+ </action> |
+ <action name="action_removeAllPointer"> |
+ <property name="text"> |
+ <string>Удалить все указатели</string> |
+ </property> |
+ </action> |
+ <action name="action_7"> |
+ <property name="text"> |
+ <string>Удалить выделенные указатели</string> |
+ </property> |
+ </action> |
+ <action name="action_removeSelectedPointers"> |
+ <property name="text"> |
+ <string>Удалить выделенные указатели</string> |
+ </property> |
+ </action> |
+ <action name="action_2"> |
+ <property name="text"> |
+ <string>Проверить таблицу-контейнер </string> |
+ </property> |
+ </action> |
+ <action name="getsettingAct"> |
+ <property name="text"> |
+ <string>Параметры соединения</string> |
+ </property> |
+ </action> |
+ </widget> |
+ <layoutdefault spacing="6" margin="11"/> |
+ <resources/> |
+ <connections/> |
+</ui> |
Index: trunk/ClassEditor/mysql.h |
=================================================================== |
--- trunk/ClassEditor/mysql.h (revision 0) |
+++ trunk/ClassEditor/mysql.h (revision 257) |
@@ -0,0 +1,75 @@ |
+/************************************************************************************ |
+** Êëàññ MySQL ñîäåðæèò ìåòîäû äëÿ ðàáîòû ñ áàçàìè äàííûõ |
+** MySQL class contains methods for working with databases |
+** |
+** |
+*************************************************************************************/ |
+ |
+ |
+ |
+ |
+ |
+ |
+#ifndef MYSQL_H |
+#define MYSQL_H |
+ |
+#include "settingsdialog.h" |
+#include "tablefield.h" |
+#include "sqltable.h" |
+ |
+#include <QObject> |
+#include <QtGui> |
+#include <QMainWindow> |
+#include <QString> |
+#include <QtSql> |
+#include <QSqlTableModel> |
+#include <QTableView> |
+#include <QSqlDriverPlugin> |
+#include <QIcon> |
+#include <QVariant> |
+#include <QProcess> |
+#include <QByteArray> |
+#include <QSqlQuery> |
+ |
+ |
+class MySql : public QObject |
+{ |
+Q_OBJECT |
+public: |
+ explicit MySql(QObject *parent = 0); |
+ ~MySql(); |
+ bool connect(); // ñîåäèíåíèå ñ áàçîé äàííûõ |
+ bool createDataBase(); // ñîçäàåò íåîáõîäèìûå òàáëèöû â þàçå äàííûõ äëÿ õðàíåíèÿ íàçâàíèÿ è îïèñàíèÿ êëàññîâ (Òàáëèöà ListOfClasses è Òàáëèöà DescriptionOfClasses) |
+ bool createListOfClassesTable(); // ñîçäàåò íåîáõîäèìóþ òàáëèöó â áàçå äàííûõ äëÿ õðàíåíèÿ íàçâàíèÿ è êëàññîâ (Òàáëèöà ListOfClasses) |
+ bool createDescriptionOfClassesTable(); // ñîçäàåò íåîáõîäèìóþ òàáëèöó â áàçå äàííûõ äëÿ õðàíåíèÿ îïèñàíèÿ êëàññîâ (Òàáëèöà DescriptionOfClasses) |
+ bool createListModelsTable(); // ñîçäàåò íåîáõîäèìóþ òàáëèöó â áàçå äàííûõ äëÿ õðàíåíèÿ ìîäåëåé (Òàáëèöà ListOfModels) |
+ bool createFiltersTable(); // ñîçäàåò íåîáõîäèìóþ òàáëèöó â áàçå äàííûõ äëÿ õðàíåíèÿ ôèëüòðîâ (Òàáëèöà Filters) |
+signals: |
+ |
+public slots: |
+ |
+private: |
+ QString sqlDatabaseName; // ïåðåìåííàÿ ñîäåðæèò èìÿ áàçû äàííûõ, ñ êîòîðîé áóäåì óñòàíàâëèâàòü ñîåäèíåíèå |
+ QString sqlUserName; // ïåðåìåííàÿ ñîäåðæèò èìÿ ïîëüçîâàòåëÿ áàçû äàííûõ |
+ QString sqlPassword; // ïåðåìåííàÿ ñîäåðæèò ïàðîëü ê áàçå äàííûõ |
+ QString sqlHostName; // ïåðåìåííàÿ ñîäåðæèò èìÿ õîñòà, íà êîòîðîì íàõîäèòñÿ áàçà äàííûõ |
+ QSqlDatabase db; |
+ QString mysqlLastError; |
+ |
+protected: |
+ |
+public: |
+ void setDatabaseName(QString dbname); |
+ void setUserName(QString uname); |
+ void setPassword(QString passwrd); |
+ void setHostName(QString hname); |
+ bool createTable(SqlTable* table); // ñîçäàåò â áàçå äàííûõ òàáëèöó |
+ void close(); // çàêîûâàåì ñîåäèíåíèå ñ áàçîé |
+ |
+ QString lasError(); |
+ QSqlError dbLastError(); // ôóíêöèÿ ôîçâðàùàåò ïîñëåäíþþ îøèáêó áàçû äàííûõ |
+ |
+ |
+}; |
+ |
+#endif // MYSQL_H |
Index: trunk/ClassEditor/settingsdialog.ui |
=================================================================== |
--- trunk/ClassEditor/settingsdialog.ui (revision 0) |
+++ trunk/ClassEditor/settingsdialog.ui (revision 257) |
@@ -0,0 +1,71 @@ |
+<ui version="4.0"> |
+ <author/> |
+ <comment/> |
+ <exportmacro/> |
+ <class>SettingsDialog</class> |
+ <widget class="QDialog" name="SettingsDialog"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>400</width> |
+ <height>300</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Dialog</string> |
+ </property> |
+ <widget class="QDialogButtonBox" name="buttonBox"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>30</x> |
+ <y>240</y> |
+ <width>341</width> |
+ <height>32</height> |
+ </rect> |
+ </property> |
+ <property name="orientation"> |
+ <enum>Qt::Horizontal</enum> |
+ </property> |
+ <property name="standardButtons"> |
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
+ </property> |
+ </widget> |
+ </widget> |
+ <pixmapfunction/> |
+ <resources/> |
+ <connections> |
+ <connection> |
+ <sender>buttonBox</sender> |
+ <signal>accepted()</signal> |
+ <receiver>SettingsDialog</receiver> |
+ <slot>accept()</slot> |
+ <hints> |
+ <hint type="sourcelabel"> |
+ <x>248</x> |
+ <y>254</y> |
+ </hint> |
+ <hint type="destinationlabel"> |
+ <x>157</x> |
+ <y>274</y> |
+ </hint> |
+ </hints> |
+ </connection> |
+ <connection> |
+ <sender>buttonBox</sender> |
+ <signal>rejected()</signal> |
+ <receiver>SettingsDialog</receiver> |
+ <slot>reject()</slot> |
+ <hints> |
+ <hint type="sourcelabel"> |
+ <x>316</x> |
+ <y>260</y> |
+ </hint> |
+ <hint type="destinationlabel"> |
+ <x>286</x> |
+ <y>274</y> |
+ </hint> |
+ </hints> |
+ </connection> |
+ </connections> |
+</ui> |
Index: trunk/ClassEditor/delegateforclassestable.h |
=================================================================== |
--- trunk/ClassEditor/delegateforclassestable.h (revision 0) |
+++ trunk/ClassEditor/delegateforclassestable.h (revision 257) |
@@ -0,0 +1,42 @@ |
+#ifndef DELEGATEFORCLASSESTABLE_H |
+#define DELEGATEFORCLASSESTABLE_H |
+ |
+ |
+#include <QItemDelegate> |
+#include <QModelIndex> |
+#include <QObject> |
+#include <QSize> |
+#include <QSpinBox> |
+ |
+class DelegateForClassesTable : public QItemDelegate |
+{ |
+Q_OBJECT |
+public: |
+ explicit DelegateForClassesTable(QObject *parent = 0); |
+ |
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, const QModelIndex &index) const; |
+ void setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ void updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+ |
+ void setItems(QStringList new_items); // äîáàâëÿåì íîâûå ïóíêòû â äåëåãàò |
+ |
+private: |
+ QStringList items; |
+ |
+signals: |
+ |
+public slots: |
+ |
+}; |
+ |
+ |
+ |
+ |
+ |
+#endif // DELEGATEFORCLASSESTABLE_H |
Index: trunk/ClassEditor/classeditor.cpp |
=================================================================== |
--- trunk/ClassEditor/classeditor.cpp (revision 0) |
+++ trunk/ClassEditor/classeditor.cpp (revision 257) |
@@ -0,0 +1,1264 @@ |
+#include "classeditor.h" |
+#include "ui_classeditor.h" |
+ |
+ |
+ClassEditor::ClassEditor(QWidget *parent) : |
+ QMainWindow(parent), |
+ ui(new Ui::ClassEditor) |
+{ |
+ ui->setupUi(this); |
+ |
+ // iconFrm.show(); |
+ |
+ ui->centralWidget->setLayout(ui->verticalLayout_8); |
+ |
+ readSettings(); |
+ |
+ |
+ initDataBase(); // íàñòðàèâàåì è óñòàíàâëèâàåì ñîåäèíåíèå |
+ createMainTables(); // ñîçäàåì ñòðóêòóðó íàøåé áàçû - äâå ãëàâíûå òàáëèöû DescriptionOfClasses è ListOfClasses |
+ |
+ |
+ |
+/* |
+ field = new TableField(tr("Ñîòðóäíèêè"), this); |
+ field->setNotNull(true); |
+ field->setDefaultValue(tr("ñîòðóäíèê")); |
+ |
+ table = new SqlTable (tr("NewTable"), this); |
+ table->setName(tr("NewTable")); |
+ table->fields().at(0)->setNotNull(true); |
+ if (!(table->setPrimaryKey(tr("ID")))) { |
+ ui->label_3->setText(table->lastError()); |
+ } |
+ else ui->label_3->setText(table->primaryKey()); |
+ table->append(field); |
+ |
+ field = new TableField(tr("Êîìïüþòåðû"), this); |
+ field->setNotNull(true); |
+ field->setDefaultValue(tr("êîìïüþòåð")); |
+ table->append(field); |
+ |
+ field = new TableField(tr("Ìîíèòîðû"), this); |
+ field->setNotNull(true); |
+ field->setDefaultValue(tr("ìîíèòîð")); |
+ table->append(field); |
+ |
+ field = new TableField(tr("Êîëè÷åñòâî (øòóê)"), this); |
+ field->setNotNull(true); |
+ field->setType(tr("INTEGER")); |
+ field->setDefaultValue(tr("1")); |
+ table->append(field); |
+ |
+ field = new TableField(tr("Äåíü ðîæäåíèÿ"), this); |
+ field->setNotNull(false); |
+ field->setType(tr("DATE")); |
+ field->setDefaultValue(tr("NULL")); |
+ table->append(field); |
+ |
+ ui->label_2->setText(table->name()); |
+ ui->label->setText(table->fields().at(0)->sqlString()); |
+ ui->label_4->setText(table->sqlString()); |
+ ////// ui->lineEdit->insert(table->sqlString()); |
+ |
+*/ |
+ /********************************************** |
+ |
+ QTextDocument *document; |
+ // = ui->textEdit->document(); |
+ QTextCursor *cursor; |
+ |
+ document = ui->textEdit->document(); |
+ cursor = new QTextCursor(document); |
+ cursor->movePosition(QTextCursor::Start); |
+QTextCharFormat format(cursor->charFormat()); |
+//format.setFontFamily("Courier"); |
+format.setFontFamily("Arial"); |
+//format.setFontItalic(false); |
+ |
+format.setFontWeight(QFont::Normal); |
+QTextCharFormat boldFormat = format; |
+boldFormat.setFontWeight(QFont::Bold); |
+ |
+QTextCharFormat italicFormat = format; |
+//format.setFontFamily("Courier"); |
+// format.setFontFamily("Arial"); |
+italicFormat.setFontItalic(true); |
+ |
+cursor->insertText(table->sqlString(), format); |
+ |
+****************************************************/ |
+ |
+QString errorString; |
+ |
+ |
+ |
+ |
+/* |
+ok = sql.createTable(table); |
+if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+else { |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Connect"), // Çàãîëîâîê. |
+ QObject::tr("Òàáëèöà â áàçå äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ |
+ |
+ |
+*/ |
+ |
+ |
+ |
+ |
+model = new QSqlTableModel(); // õðàíèëèùå îáúåêòîâ êëàññà |
+tableForInstance = new QTableView(); |
+mymodel = new MyModel(this); |
+modelForPointers = new ModelForPointers(this); // // ìîäåëü äëÿ òàáëèöû ñ óêàçàòåëÿìè |
+ |
+//modelForDescription = new QSqlTableModel(this); |
+modelForDescription = new ModelForDescriptionTable(this); |
+ |
+ |
+ |
+initClassListTable(); |
+ |
+initFieldsTable(); |
+ |
+initPointersTable(); |
+ |
+/////////////////model->setTable(tr("ListOfClasses")); |
+ |
+ |
+ |
+/////model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ |
+// modelForPointers->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ |
+ |
+ |
+ |
+ |
+ |
+//mymodel->setEditStrategy(QSqlTableModel::OnFieldChange); |
+ |
+ |
+ |
+//////////////////model->setSort(0, Qt::AscendingOrder); |
+ |
+ |
+ |
+ |
+// model->setFilter(tr("Èäåíòèôèêàòîð_ñèñòåìíîãî_áëîêà = '7' and Èíâåíòàðíûé_íîìåð = 'i09090909'")); |
+////////////////////model->select(); |
+ |
+//tableForDescription = new QTableView(); |
+ |
+//tableForDescription->show(); |
+ |
+ |
+ |
+ |
+/* |
+ui->tableView_2->hideColumn(0); |
+ui->tableView_2->hideColumn(5); |
+ui->tableView_2->hideColumn(2); |
+*/ |
+ |
+ |
+ |
+ |
+ |
+ |
+//if (mymodel->rowCount() > 0) { |
+ |
+ |
+ |
+/* |
+ |
+currIndexOfClassesTable = mymodel->index(0, 1); |
+ |
+ |
+QModelIndex index_temp; |
+ |
+ |
+ |
+currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
+QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
+ |
+QModelIndex topLeft; |
+QModelIndex bottomRight; |
+ |
+ topLeft = mymodel->index(0, 0, QModelIndex()); |
+ bottomRight = mymodel->index(0, 1, QModelIndex()); |
+ |
+QItemSelection selection(topLeft, bottomRight); |
+selectionModel->select(selection, QItemSelectionModel::Select); |
+ |
+ |
+QString class_indx, class_instance; |
+QString str_fltr = tr("ClassIdentifer = "); |
+class_indx = mymodel->data(mymodel->index(0,0)).toString(); |
+class_instance = mymodel->data(mymodel->index(0,3)).toString(); |
+ |
+currInctanceTable = class_instance; // |
+ |
+ |
+ |
+modelForDescription->setInctance(class_instance); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
+//class_instance.append(tr("_inctance")); |
+str_fltr.append(class_indx); |
+str_fltr.append(tr(" AND FieldType <> \"pointer\"")); |
+ |
+model->setTable(class_instance); |
+//model->setTable(tr("memory")); |
+model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+model->select(); |
+tableForInstance->setModel(model); |
+tableForInstance->resizeColumnsToContents(); |
+tableForInstance->setWindowTitle(class_instance); |
+tableForInstance->show(); |
+ |
+modelForDescription->setFilter(str_fltr); |
+modelForDescription->select(); |
+ui->tableView_2->resizeColumnsToContents(); |
+ |
+ |
+ str_fltr = tr("ClassIdentifer = "); |
+ modelForPointers->setInctance(class_instance); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
+ str_fltr.append(class_indx); |
+ str_fltr.append(tr(" AND FieldType = \"pointer\"")); |
+// str_fltr.append( tr(" FieldType = pointer ")); |
+ |
+ |
+ |
+ modelForPointers->setFilter(str_fltr); |
+modelForPointers->select(); |
+ |
+ |
+*/ |
+ |
+//connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex))); |
+connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
+connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
+//connect(ui->newClassAction, SIGNAL(triggered(bool)), this, SLOT(on_pushButton_clicked(bool))); |
+connect(ui->action_ID, SIGNAL(triggered(bool)), this, SLOT(on_action_ID_triggered(bool))); |
+connect(ui->action_showAlias, SIGNAL(triggered(bool)), this, SLOT(on_action_showAlias_triggered(bool))); // ïîêàçûâàòü ïñåâäîíèìû |
+connect(ui->action_showInstance, SIGNAL(triggered(bool)), this, SLOT(on_action_showInstance_triggered(bool))); // ïîêàçûâàòü õðàíèëèùà îáúåêòîâ |
+connect(ui->action_removeSelectedFields, SIGNAL(triggered()), this, SLOT(on_pushButton_4_clicked())); // óäàëèòü âûäåëåííûå ïîëÿ |
+connect(ui->action_removeAllFields, SIGNAL(triggered()), this, SLOT(on_pushButton_5_clicked())); // óäàëèòü âñå ïîëÿ |
+connect(ui->action_removeSelectedClasses, SIGNAL(triggered()), this, SLOT(on_pushButton_2_clicked())); // óäàëèòü âûäåëåííûå êëàññû |
+connect(ui->action_removeAllClasses, SIGNAL(triggered()), this, SLOT(on_action_removeAllClasses())); // óäàëèòü âñå êëàññû |
+connect(ui->action_newClass, SIGNAL(triggered()), this, SLOT(on_pushButton_clicked())); // äîáàâèòü íîâûé êëàññ |
+connect(ui->action_newField, SIGNAL(triggered()), this, SLOT(on_pushButton_3_clicked())); // äîáàâèòü íîâîå ïîëå |
+connect(ui->action_newPointer, SIGNAL(triggered()), this, SLOT(on_action_newPointer())); // äîáàâèòü íîâîå ïîëå äëÿ óêàçàòåëåé íà êëàññû-êîíòåéíåðû |
+// connect(ui->action_newPointer, SIGNAL(triggered()), this, SLOT(on_pushButton_3_clicked())); // äîáàâèòü íîâîå ïîëå äëÿ óêàçàòåëåé íà êëàññû-êîíòåéíåðû |
+ |
+connect(ui->action_removeSelectedPointers, SIGNAL(triggered()), this, SLOT(on_action_removeSelectedPointers())); // óäàëèòü âûäåëåííûå êëàññû |
+connect(modelForDescription, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // â òàáëèöå ïîëåé ïðîèçîøëè èçìåíåíèÿ |
+connect(ClassEditor::modelForPointers, SIGNAL(field_changed()), this, SLOT(on_field_changed())); // â òàáëèöå óêàçàòåëåé ïðîèçîøëè èçìåíåíèÿ |
+ |
+ |
+connect(ui->getsettingAct, SIGNAL(triggered()), this, SLOT(getSetting())); // âûáîð â ãëàâíîé ôîðìå â ìåíþ "Áàçà äàííûõ" ïóíêòà "Ïàðàìåòðû ñîåäèíåíèÿ" |
+connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting())); |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ClassEditor::~ClassEditor() |
+{ |
+ // tableForInstance->close(); |
+ delete tableForInstance; |
+ delete model; |
+ |
+ delete ui; |
+ // delete field; |
+ // delete settdialog; |
+} |
+ |
+void ClassEditor::changeEvent(QEvent *e) |
+{ |
+ QMainWindow::changeEvent(e); |
+ switch (e->type()) { |
+ case QEvent::LanguageChange: |
+ ui->retranslateUi(this); |
+ break; |
+ default: |
+ break; |
+ } |
+} |
+ |
+ |
+/* |
+void ClassEditor::addNewClass(){ |
+ |
+ int row = model->rowCount(); |
+ |
+ model->insertRows(row, 1); |
+ model->setData(model->index(row, 1), tr("New class")); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
+ |
+ |
+ // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí")); |
+ // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1")); |
+ |
+ |
+ model->submitAll(); |
+ |
+ row = model->rowCount(); |
+ QString tmp_str; |
+ int i_tmp; |
+ i_tmp = model->data(model->index(row-1, 0)).toInt(); |
+ tmp_str = model->data(model->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà |
+ |
+ tmp_str.append(tr("_Inctance")); |
+ model->setData(model->index(row-1, 3), tmp_str ); // è çàíîñèì çíà÷åíèå â òàáëèöó |
+ |
+ model->submitAll(); |
+ mymodel->select(); |
+ |
+ |
+} |
+*/ |
+ |
+void ClassEditor::addNewClass_new(){ |
+ |
+ int row = mymodel->rowCount(); |
+ |
+ mymodel->insertRows(row, 1); |
+ mymodel->setData(mymodel->index(row, 1), QVariant(tr("New class")), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà" |
+ |
+ |
+ mymodel->submitAll(); |
+ row = mymodel->rowCount(); |
+ QString tmp_str1, sql_str; |
+ int i_tmp1; |
+ i_tmp1 = mymodel->data(mymodel->index(row-1, 0)).toInt(); |
+ tmp_str1 = mymodel->data(mymodel->index(row-1, 0)).toString(); // ãåíåðèì èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ êëàññà |
+ |
+ tmp_str1.append(tr("_Inctance")); |
+ SqlTable* tbl; |
+ tbl = new SqlTable(tmp_str1); // ñîçäàåì õðàíèëèùå îáúåêòîâ |
+ sql_str = tbl->sqlString(); |
+ bool ok; |
+ |
+ ok = sql.createTable(tbl); |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
+ delete tbl; |
+ mymodel->removeRow(row-1); |
+ mymodel->submitAll(); |
+ mymodel->select(); |
+ ui->tableView_2->resizeRowsToContents(); |
+ return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
+ |
+ } |
+ |
+ delete tbl; |
+ mymodel->setData(mymodel->index(row-1, 3), QVariant(tmp_str1), Qt::EditRole); // è çàíîñèì çíà÷åíèå â òàáëèöó |
+ |
+ |
+ |
+ // model->setData(model->index(row, 1), tr("Âàñÿ Ïóïê èí")); |
+ // model->setData(model->index(row, 2) , tr("Ìóõîñðà íñê, Çàæîïèíñêèå âûñåëêè ä 1")); |
+ |
+ |
+ //mymodel->submitAll(); |
+ |
+ //row = mymodel->rowCount(); |
+ |
+ |
+ //mymodel->select(); |
+ |
+ |
+} |
+ |
+ |
+void ClassEditor::addNewField(){ |
+ // QSqlRecord rec = mymodel->record(1); |
+ //bool ok; |
+ //ok = rec.isEmpty(); |
+ //QString currientClassID; |
+ //currientClassID = rec.value(1).toString(); |
+ QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
+ QString query_str = tr("ALTER TABLE "); |
+ QString db_error; |
+ QSqlQuery q; |
+ int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
+ Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
+ query_str.append( Inctance_str); |
+ query_str.append(tr(" ADD COLUMN `New field` CHAR(30)")); |
+ bool ok = q.prepare(query_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
+ |
+ } |
+ |
+ int row = modelForDescription->rowCount(); |
+ modelForDescription->insertRows(row, 1); |
+ modelForDescription->onlySetData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
+ modelForDescription->onlySetData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
+ |
+ modelForDescription->submitAll(); |
+ |
+ delete model; |
+ delete tableForInstance; |
+ model = new QSqlTableModel(); |
+ tableForInstance = new QTableView(); |
+ model->setTable(Inctance_str); |
+ model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ tableForInstance->setModel(model); |
+ tableForInstance->setWindowTitle(Inctance_str); |
+ tableForInstance->show(); |
+} |
+ |
+ |
+ |
+void ClassEditor::addNewPointer(){ //äîáîâëÿåì íîâîå ïîëå, ãäå áóäóò õðàíèòüñÿ óêàçàòåëè íà îáúåêòû êëàññà-êîíòåéíåðà |
+ QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
+ QString query_str = tr("ALTER TABLE "); |
+ QString db_error; |
+ QSqlQuery q; |
+ int currRow = ClassEditor::currIndexOfClassesTable.row(); // |
+ Inctance_str = mymodel->data(mymodel->index(currRow, 3)).toString(); |
+ query_str.append( Inctance_str); |
+ query_str.append(tr(" ADD COLUMN `Ñlass-container ID` CHAR(30)")); |
+ bool ok = q.prepare(query_str); |
+ |
+ ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
+ |
+ } |
+ |
+ |
+ int row = ClassEditor::modelForPointers->rowCount(); |
+ modelForPointers->insertRows(row, 1); |
+ |
+ modelForPointers->onlySetData(modelForPointers->index(row, 1), QVariant(tr("Ñlass-container ID")), Qt::EditRole); |
+ modelForPointers->onlySetData(modelForPointers->index(row, 3), QVariant(tr("pointer")), Qt::EditRole); |
+ modelForPointers->onlySetData(modelForPointers->index(row, 5), QVariant(currClassID), Qt::EditRole); |
+ modelForPointers->onlySetData(modelForPointers->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
+ |
+ |
+ modelForPointers->submitAll(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ /* |
+ |
+ str_fltr = tr("ClassIdentifer = "); |
+ modelForPointers->setInctance(Inctance_str); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
+ str_fltr.append(class_indx); |
+ str_fltr.append(tr(" AND FieldType = \"pointer\"")); |
+ // str_fltr.append( tr(" FieldType = pointer ")); |
+ |
+ |
+ |
+ modelForPointers->setFilter(str_fltr); |
+ modelForPointers->select(); |
+ ui->tableView_3->setModel(modelForPointers); |
+ ui->tableView_3->resizeColumnsToContents(); |
+*/ |
+ |
+ |
+ |
+ |
+ // modelForPointers->select(); |
+ |
+ |
+ |
+ |
+ |
+ ClassEditor::refreshInctance(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+// äîáàâëÿåì íîâûé êëàññ |
+void ClassEditor::on_pushButton_clicked(){ |
+//int i; |
+//i++; |
+/////ClassEditor::addNewClass(); |
+ClassEditor::addNewClass_new(); |
+ mymodel->select(); |
+ ui->tableView->resizeColumnsToContents(); |
+ ui->tableView->resizeRowsToContents(); |
+ |
+//ui->tableView->setModel(mymodel); |
+ |
+} |
+ |
+void ClassEditor::on_tableView_clicked(const QModelIndex & index ){ |
+ bool indexIsValid; |
+ int i, row, column; |
+ i++; |
+ indexIsValid = index.isValid(); |
+ row = index.row(); |
+ column = index.column(); |
+ currIndexOfClassesTable = index; |
+ QModelIndex index_tmp, index_instance; |
+ QString tmp_str, filter_str, instance_str; |
+ index_tmp = ui->tableView->model()->index(row, 0); |
+ index_instance = ui->tableView->model()->index(row, 3); |
+ tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
+ instance_str = ui->tableView->model()->data(index_instance).toString(); |
+ modelForDescription->setInctance(instance_str); // ïåðåäàåì â ìîäåëü ïîëåé èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
+ modelForPointers->setInctance(instance_str); |
+ |
+ delegateForDefaultValueColomn.getItems(); //ïðîñèì äåëåãàòà îáíîâèòü ñïèñîê êëàññîâ |
+ |
+ // instance_str.append(tr("_inctance")); |
+/* |
+ Inctance_model.clear(); |
+ Inctance_model.setTable(instance_str); |
+ Inctance_model.select(); |
+ tableForInstance_new.setModel(&Inctance_model); |
+ tableForInstance_new.show(); |
+*/ |
+ // model->clear(); |
+ tableForInstance->close(); |
+ delete model; |
+ delete tableForInstance; |
+ model = new QSqlTableModel(); |
+ tableForInstance = new QTableView(); |
+ model->setTable(instance_str); |
+ model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ tableForInstance->setModel(model); |
+ |
+ model->select(); |
+tableForInstance->setWindowTitle(instance_str); |
+// // // tableForInstance->show(); |
+ |
+ // tableForInstance.setModel(model); |
+ tableForInstance->resizeColumnsToContents(); |
+ |
+ currClassID = tmp_str; |
+ // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString()); |
+ filter_str = tr("ClassIdentifer = "); |
+ filter_str.append(tmp_str); |
+ filter_str.append(tr(" AND FieldType <> \"pointer\"")); |
+ modelForDescription->setFilter(filter_str); |
+ modelForDescription->select(); |
+ ui->tableView_2->resizeColumnsToContents(); |
+ |
+ filter_str = tr("ClassIdentifer = "); |
+ filter_str.append(tmp_str); |
+ filter_str.append(tr(" AND FieldType = \"pointer\"")); |
+ modelForPointers->setFilter(filter_str); |
+ modelForPointers->select(); |
+ ui->tableView_3->resizeColumnsToContents(); |
+ |
+ |
+ |
+ |
+ i++; |
+} |
+ |
+ |
+ |
+void ClassEditor::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïðêè "Óäàëèòü êëàññ" |
+ QModelIndex model_index; |
+ QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
+ QModelIndexList indexes = selectionModel->selectedIndexes(); |
+ QList<int> selectedRows; |
+ selectedRows.clear(); |
+ foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
+ if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
+ |
+ } |
+ qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
+ |
+ |
+ for (int m =0; m < selectedRows.size(); ++m){ |
+ |
+ ClassEditor::removeClass(selectedRows.at(m)); |
+ |
+ |
+ |
+ } |
+ mymodel->submitAll(); |
+ ClassEditor::modelForDescription->select(); |
+ ui->tableView->resizeColumnsToContents(); |
+ ui->tableView->resizeRowsToContents(); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
+ int i; |
+ i++; |
+ ClassEditor::addNewField(); |
+ ClassEditor::modelForDescription->select(); |
+ ui->tableView_2->resizeColumnsToContents(); |
+} |
+ |
+ |
+void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
+ // int i; |
+ QModelIndex model_index; |
+ QItemSelectionModel *selectionModel = ui->tableView_2->selectionModel(); |
+ QModelIndexList indexes = selectionModel->selectedIndexes(); |
+ //QModelIndexList indexes_fo_first_col; // èíäåêñû äëÿ ïåðâîãî ñòîëáöà (èìåíà êëàññîâ) |
+ //model_index = mymodel->selec; |
+ //modelList = ui->tableView->SelectItems; |
+ //i = indexes.size(); |
+ QList<int> selectedRows; |
+ //indexes_fo_first_col.clear(); |
+ /* |
+ foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
+ if (!indexes_fo_first_col.contains(model_index) && (model_index.column()==1)) indexes_fo_first_col.append(model_index); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
+ |
+ } |
+*/ |
+ selectedRows.clear(); |
+ foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
+ if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) { |
+ selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
+ } |
+ } |
+ |
+ qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
+ |
+ QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
+ Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
+ for (int m =0; m < selectedRows.size(); ++m){ |
+ |
+ |
+ QString query_str; |
+ QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ |
+ QSqlQuery q; |
+ |
+ query_str.clear(); |
+ |
+ |
+ field_name_str = modelForDescription->data(modelForDescription->index(selectedRows.at(m), 1)).toString(); |
+ |
+ query_str.append(tr("ALTER TABLE ")); |
+ query_str.append(Inctance_str); |
+ query_str.append(tr(" DROP COLUMN `")); |
+ query_str.append(field_name_str); |
+ query_str.append(tr("`")); |
+ q.prepare(query_str); |
+ bool ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
+ |
+ } |
+ |
+ |
+ |
+ modelForDescription->removeRow(selectedRows.at(m)); |
+ |
+ } |
+ delete model; |
+ delete tableForInstance; |
+ model = new QSqlTableModel(); |
+ tableForInstance = new QTableView(); |
+ model->setTable(Inctance_str); |
+ model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ tableForInstance->setModel(model); |
+ tableForInstance->setWindowTitle(Inctance_str); |
+ tableForInstance->show(); |
+ //i = selectedRows.size(); |
+ |
+ //if (i > 0) model_index = indexes.at(0); |
+} |
+ |
+ |
+void ClassEditor::on_action_removeSelectedPointers(){ // óäàëèòü âûäåëåííûå óêàçàòåëè |
+ QModelIndex model_index; |
+ QItemSelectionModel *selectionModel = ui->tableView_3->selectionModel(); |
+ QModelIndexList indexes = selectionModel->selectedIndexes(); |
+ QList<int> selectedRows; |
+ |
+ selectedRows.clear(); |
+ |
+ foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê |
+ if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) { |
+ selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå |
+ } |
+ } |
+ |
+ qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå |
+ |
+ QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
+ Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
+ for (int m =0; m < selectedRows.size(); ++m){ |
+ |
+ |
+ QString query_str; |
+ QString field_name_str; // èìÿ óäàëÿåìîãî ïîëÿ |
+ QSqlQuery q; |
+ |
+ query_str.clear(); |
+ |
+ |
+ field_name_str = modelForPointers->data(modelForPointers->index(selectedRows.at(m), 1)).toString(); |
+ |
+ query_str.append(tr("ALTER TABLE ")); |
+ query_str.append(Inctance_str); |
+ query_str.append(tr(" DROP COLUMN `")); |
+ query_str.append(field_name_str); |
+ query_str.append(tr("`")); |
+ q.prepare(query_str); |
+ bool ok = q.exec(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ return; // âûõîäèì íå ïðèìåíÿÿ èçìåíåíèé |
+ |
+ } |
+ |
+ |
+ |
+ modelForPointers->removeRow(selectedRows.at(m)); |
+ |
+ } |
+ |
+ |
+ refreshInctance(); |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+void ClassEditor::on_pushButton_5_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âñå ïîëÿ" |
+int row; |
+row = ClassEditor::modelForDescription->rowCount(); |
+ClassEditor::modelForDescription->removeRows(0, row); |
+ClassEditor::modelForDescription->submitAll(); |
+} |
+ |
+void ClassEditor::on_pushButton_6_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âñå ïîëÿ" |
+ |
+on_action_newPointer(); |
+ /********************************* |
+ |
+ |
+ QString fileName; |
+ QPixmap pixmap; |
+ fileName = QFileDialog::getOpenFileName(this, |
+ tr("Open Image"), "", tr("Image Files (*.png *.jpg *.bmp)")); |
+ pixmap.load(fileName); |
+ ui->label_4->setPixmap(pixmap); |
+ QImage currentImage = pixmap.toImage(); |
+ QByteArray bytes; |
+ QBuffer buffer(&bytes); |
+ buffer.open(QIODevice::WriteOnly); |
+ currentImage.save(&buffer, "PNG"); |
+ |
+ if (currIndexOfClassesTable.isValid()) { |
+ bool ok; |
+ |
+ ok = mymodel->setData(mymodel->index(currIndexOfClassesTable.row(), 5), QVariant (bytes), Qt::EditRole); |
+ mymodel->submitAll(); |
+ |
+ |
+ } |
+ |
+********************************************/ |
+} |
+ |
+ |
+ |
+ |
+void ClassEditor::on_pushButton_7_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âûäåëåííûå óêàçàòåëè" |
+ |
+ |
+ |
+} |
+ |
+ |
+void ClassEditor::on_pushButton_8_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âûäåëåííûå óêàçàòåëè" |
+ |
+ |
+ |
+} |
+ |
+ |
+void ClassEditor::on_myModel_dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
+ |
+int i; |
+i++; |
+ui->tableView->resizeColumnsToContents(); |
+ui->tableView->resizeRowsToContents(); |
+ |
+ |
+ |
+ |
+} |
+ |
+void ClassEditor::on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
+ ui->tableView_2->resizeColumnsToContents(); |
+ |
+ /* |
+ QString instance_str; |
+ instance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
+ tableForInstance->close(); |
+ delete model; |
+ delete tableForInstance; |
+ model = new QSqlTableModel(); |
+ tableForInstance = new QTableView(); |
+ model->setTable(instance_str); |
+ model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ tableForInstance->setModel(model); |
+ |
+ model->select(); |
+ tableForInstance->setWindowTitle(instance_str); |
+ tableForInstance->show(); |
+*/ |
+} |
+ |
+void ClassEditor::on_action_ID_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ID" |
+if (is_checked) ui->tableView->showColumn(0); |
+else ui->tableView->hideColumn(0); |
+ui->tableView->resizeColumnsToContents(); |
+} |
+ |
+void ClassEditor::on_action_showAlias_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ïñåâäîíèì" |
+ if (is_checked) ui->tableView->showColumn(2); |
+ else ui->tableView->hideColumn(2); |
+ ui->tableView->resizeColumnsToContents(); |
+} |
+ |
+void ClassEditor::on_action_showInstance_triggered(bool is_checked){ // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü õðàíèëèùà îáúåêòîâ" |
+ if (is_checked) ui->tableView->showColumn(3); |
+ else ui->tableView->hideColumn(3); |
+ ui->tableView->resizeColumnsToContents(); |
+} |
+ |
+ |
+ |
+void ClassEditor::on_action_removeAllClasses(){ // îáðàáàòûâàåì âûáîð â ìåíþ "Óäàëèòü âñå êëàññû" |
+ int row; |
+ row = ClassEditor::mymodel->rowCount(); |
+ for (int m=0; m < row; ++m){ |
+ ClassEditor::removeClass(0); |
+ //ClassEditor::mymodel->removeRows(0, row); |
+} |
+ ClassEditor::mymodel->submitAll(); |
+ ClassEditor::modelForDescription->select(); |
+} |
+ |
+void ClassEditor::removeClass(int class_row){ // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row |
+ QModelIndex index_tmp; |
+ QString tmp_str, filter_str; |
+ QString class_inctance; |
+ index_tmp = ui->tableView->model()->index(class_row, 0); |
+ tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
+ currClassID = tmp_str; |
+ index_tmp = ui->tableView->model()->index(class_row, 3); |
+ class_inctance = ui->tableView->model()->data(index_tmp).toString(); |
+ |
+ QSqlQuery q; |
+ QString sql_str; |
+ bool ok; |
+ sql_str = tr("drop table `"); |
+ sql_str.append(class_inctance); |
+ sql_str.append(tr("`")); |
+ ok = q.prepare(sql_str); |
+ |
+ |
+ |
+ |
+ |
+ // ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString()); |
+ filter_str = tr("ClassIdentifer = "); |
+ filter_str.append(tmp_str); |
+ modelForDescription->setFilter(filter_str); // îáíîâëÿåì òàáëèöó ïîëåé |
+ ClassEditor::on_pushButton_5_clicked(); // ñíà÷àëà óäàëèì âñå ïîëÿ êëàññà |
+ mymodel->removeRow(class_row); // òåïåðü óäàëÿåì ñàì êëàññ |
+ mymodel->submitAll(); // ôèêñèðóåì èçìåíåíèÿ |
+ |
+ ok = q.exec();// óäàëÿåì õðàíèëèùå îáúåêòîâ êëàññà |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ |
+ } |
+ |
+ ui->tableView->resizeColumnsToContents(); |
+ ui->tableView_2->resizeColumnsToContents(); |
+ |
+} |
+ |
+ |
+void ClassEditor::on_field_changed(){ // ïîìåíÿëîñü èìÿ ïîëÿ |
+ ClassEditor::refreshInctance(); |
+} |
+ |
+ |
+ |
+ |
+void ClassEditor::refreshInctance(){ // îáíîâèì ìîäåëü òàáëèöû-õðàíèëèùà |
+ |
+ QString Inctance_str; // èìÿ òàáëèöû-õðàíèëèùà |
+ Inctance_str = mymodel->data(mymodel->index(ClassEditor::currIndexOfClassesTable.row(), 3)).toString(); |
+ delete model; |
+ delete tableForInstance; |
+ model = new QSqlTableModel(); |
+ tableForInstance = new QTableView(); |
+ model->setTable(Inctance_str); |
+ model->setEditStrategy(QSqlTableModel::OnManualSubmit); |
+ model->select(); |
+ tableForInstance->setModel(model); |
+ tableForInstance->setWindowTitle(Inctance_str); |
+ tableForInstance->resizeRowsToContents(); |
+ tableForInstance->show(); |
+ |
+} |
+ |
+ |
+ |
+ |
+void ClassEditor::on_action_newPointer(){ // äîáàâëÿåì íîâîå ïîëå äëÿ óêàçàòåëåé íà îáúåêòû êëàññà-êîíòåéíåðà |
+ ClassEditor::addNewPointer(); |
+ ClassEditor::modelForPointers->select(); |
+ ui->tableView_3->resizeColumnsToContents(); |
+ |
+} |
+ |
+ |
+// Ñ÷èòûâàåì íàñòðîéêè |
+ |
+void ClassEditor::readSettings() |
+{ |
+ QSettings settings("Trolltech", "Application Example"); |
+ baseName = settings.value("baseName", "an_db").toString(); |
+ userName = settings.value("userName", "an").toString(); |
+ password = settings.value("password", "393939").toString(); |
+ tableName = settings.value("tableName", "inventar").toString(); |
+ hostName = settings.value("hostName", "server").toString(); |
+// resize(size); |
+// move(pos);tableName |
+} |
+ |
+ |
+void ClassEditor::writeSettings() |
+{ |
+ QSettings settings("Trolltech", "Application Example"); |
+ settings.setValue("baseName", baseName); |
+ settings.setValue("userName", userName); |
+ settings.setValue("password", password); |
+ settings.setValue("tableName", tableName); |
+ settings.setValue("hostName", hostName); |
+} |
+ |
+ |
+void ClassEditor::applySetting() |
+{ |
+ bool ok; |
+ baseName = setFrm.lineEdit->text(); |
+ userName = setFrm.lineEdit_2->text(); |
+ password = setFrm.lineEdit_3->text(); |
+ // tableName = setFrm->lineEdit_4->text(); |
+ hostName = setFrm.lineEdit_5->text(); |
+ writeSettings(); |
+ |
+ sql.close(); // ðàçðûâàåì ñîåäèíåíèå ñ áàçîé |
+ |
+ sql.setDatabaseName(baseName); |
+ // sql.setDatabaseName(tr("inventory")); |
+ |
+ // sql.setHostName(tr("localhost")); |
+ sql.setHostName(hostName); |
+ |
+ // sql.setUserName(tr("an")); |
+ |
+ sql.setUserName(userName); |
+ |
+ // sql.setPassword(tr("393939")); |
+ |
+ sql.setPassword(password); |
+ |
+ ok = sql.connect(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ } |
+ else { |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Connect"), // Çàãîëîâîê. |
+ QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ. |
+ |
+ |
+ |
+ |
+ |
+ } |
+ |
+ |
+ mymodel->select(); |
+ model->select(); |
+ modelForDescription->select(); |
+ |
+ //////////// ok=openDataBase(); |
+ //////////// if (!ok) return; |
+ // // // ui->treeWidget->clear(); // î÷èùàåì äåðåâî ñ ìîäåëüþ |
+ |
+ // // // buildPreviewModel(tr("Ìîÿ ìîäåëü"), tr("1")); |
+ //////////// class_list_map.clear(); // î÷èùàåì ñïèñîê êëàññîâ |
+ //////////// initComboBox(); |
+ // // // getDatabaseData(); |
+ // delete setFrm; |
+ setFrm.close(); |
+} |
+ |
+void ClassEditor::getSetting() |
+{ |
+ // setFrm = new settingForm; |
+ // // // connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting())); |
+ setFrm.lineEdit->setText(baseName); |
+ setFrm.lineEdit_2->setText(userName); |
+ setFrm.lineEdit_3->setText(password); |
+// setFrm->lineEdit_4->setText(tableName); |
+ setFrm.lineEdit_5->setText(hostName); |
+ setFrm.show(); |
+ |
+ |
+ |
+} |
+ |
+ |
+void ClassEditor::initDataBase(){ // íàñòðîéêà ïàðàìåòðîâ ñîåäèíåíèÿ è óñòàíîâêà ñîåäèíåíèÿ |
+ |
+ sql.setDatabaseName(baseName); |
+ sql.setHostName(hostName); |
+ sql.setUserName(userName); |
+ sql.setPassword(password); |
+ |
+ bool ok; |
+ ok = sql.connect(); |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ } |
+ else { |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Connect"), // Çàãîëîâîê. |
+ QObject::tr("Ñîåäèíåíèå ñ áàçîé äàííûõ óñïåøíî óñòàíîâëåíî.")); // Òåêñò ñîîáùåíèÿ. |
+ |
+ |
+ |
+ |
+ |
+ } |
+ |
+} |
+ |
+ |
+void ClassEditor::createMainTables(){// ñîçäàåì ñòðóêòóðó áàçû äàííûõ - òàáëèöû DescriptionOfClasses è ListOfClasses |
+ |
+ bool ok; |
+ ok = sql.createListOfClassesTable(); |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ } |
+ else { |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Create"), // Çàãîëîâîê. |
+ QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ |
+ |
+ |
+ |
+ ok = sql.createDescriptionOfClassesTable(); |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ } |
+ else { |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Create"), // Çàãîëîâîê. |
+ QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ |
+ |
+ok = sql.createListModelsTable(); |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ } |
+ else { |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Create"), // Çàãîëîâîê. |
+ QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ |
+ |
+ |
+ |
+ |
+ ok = sql.createFiltersTable(); |
+ |
+ if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ sql.lasError()); // Òåêñò ñîîáùåíèÿ. |
+ |
+ } |
+ else { |
+ |
+ QMessageBox::information( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Create"), // Çàãîëîâîê. |
+ QObject::tr("Áàçà äàííûõ óñïåøíî ñîçäàíà.")); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ |
+ |
+} |
+ |
+void ClassEditor::initClassListTable(){ // íàñòðàèâàåì òàáëèöó äëÿ îòîáðàæåíèÿ ñïèñêà ñóùåñòâóþùèõ êëàññîâ |
+ |
+ mymodel->setTable(tr("ListOfClasses")); |
+ mymodel->setSort(0, Qt::AscendingOrder); |
+ mymodel->select(); |
+ mymodel->setHeaderData(1, Qt::Horizontal, tr("Èìÿ êëàññà")); |
+ mymodel->setHeaderData(2, Qt::Horizontal, tr("Ïñåâäîíèì êëàññà")); |
+ mymodel->setHeaderData(4, Qt::Horizontal, tr("Êîìåíòàðèé")); |
+ mymodel->setHeaderData(5, Qt::Horizontal, tr("Èêîíêà")); |
+ ui->tableView->setModel(mymodel); |
+ ui->tableView->setAlternatingRowColors(true); |
+ ui->tableView->resizeColumnsToContents(); |
+ ui->tableView->resizeRowsToContents(); |
+ ui->tableView->hideColumn(0); |
+ ui->tableView->hideColumn(3); |
+ ui->tableView->hideColumn(2); |
+ CPictureDelegate *pictureDelegate; |
+ pictureDelegate = new CPictureDelegate(this); |
+ pictureDelegate->setTableView(ui->tableView); |
+ ui->tableView->setItemDelegateForColumn(5, pictureDelegate); |
+ ui->tableView->resizeColumnsToContents(); |
+ ui->tableView->resizeRowsToContents(); |
+ /* |
+ for (int i=0; i < mymodel->rowCount(); i++){ |
+ ui->tableView->setRowHeight(i, 100); |
+ } |
+*/ |
+ |
+} |
+ |
+ |
+void ClassEditor::initFieldsTable(){ // íàñòðàèâàåì òàáëèöó äëÿ îòîáðàæåíèÿ ñïèñêà ïîëåé ñóùåñòâóþùèõ êëàññîâ |
+ |
+ modelForDescription->setTable(tr("DescriptionOfClasses")); |
+ modelForDescription->setSort(0, Qt::AscendingOrder); |
+ modelForDescription->setEditStrategy(QSqlTableModel::OnFieldChange); |
+ ui->tableView_2->setModel(modelForDescription); |
+ ui->tableView_2->setAlternatingRowColors(true); |
+ ui->tableView_2->resizeColumnsToContents(); |
+ ui->tableView_2->setItemDelegateForColumn(3, &classTableDelegate); |
+} |
+ |
+void ClassEditor::initPointersTable(){ // íàñòðàèâàåì òàáëèöó äëÿ îòîáðàæåíèÿ ñïèñêà ïîëåé-óêàçàòåëåé êëàññà |
+ |
+ modelForPointers->setTable(tr("DescriptionOfClasses")); |
+ modelForPointers->setSort(0, Qt::AscendingOrder); |
+ modelForPointers->setEditStrategy(QSqlTableModel::OnFieldChange); |
+ ui->tableView_3->setModel(modelForPointers); |
+ delegateForDefaultValueColomn.getItems(); |
+ ui->tableView_3->setItemDelegateForColumn(4, &delegateForDefaultValueColomn); |
+ |
+ // ui->tableView_3->resizeColumnsToContents(); |
+ |
+} |
Index: trunk/ClassEditor/sqltable.h |
=================================================================== |
--- trunk/ClassEditor/sqltable.h (revision 0) |
+++ trunk/ClassEditor/sqltable.h (revision 257) |
@@ -0,0 +1,43 @@ |
+#ifndef SQLTABLE_H |
+#define SQLTABLE_H |
+ |
+#include <QObject> |
+#include <QList> |
+#include "tablefield.h" |
+ |
+ |
+class SqlTable : public QObject |
+{ |
+Q_OBJECT |
+public: |
+ explicit SqlTable(QString tname, QObject *parent = 0); |
+ |
+ |
+void setName(QString tname); // ôóíêöèÿ ïðèñâàèâàåò èìÿ òàáëèöå, èìå ïåðåäàåòñÿ â ïàðàìåòðå ôóíêöèè tname |
+QString name(); // ôóíêöèÿ áåç ïàðàìåòðîâ âîçâðàùàåò èìÿ òàáëèöû |
+QList<TableField*> fields(); // âîçâðàùàåò ñïèñîê óêàçàòåëåé íà ïîëÿ òàáëèöû |
+bool setPrimaryKey(QString fieldName); // ôóíêöèÿ óñòàíàâëèâàåò ïåðâè÷íûì êëþ÷îì ïîëå, èìåíÿ êîòîðîãî ñîâïàäàåò ñ ïåðåäàâàåìûì ïàðàìåòðîì fieldName |
+QString lastError(); // ôóíêöèÿ âîçâðàùàåèò ïîÿñíèòåëüíûé òåêñò ïîñëåäíåé îøèáêè, êîòîðàÿ âîçíèêëà ïðè âûçîâå ìåòîäîâ êëàññà |
+QString primaryKey(); // ôóíêöèÿ âîçâðàùàåò èìÿ ïîëÿ, êîòîðîå ÿâëÿåòñÿ ïåðâè÷íûì êëþ÷îì |
+QString sqlString(); // ôóíêöèÿ ãåíåðèðóåò ñòðîêó Sql-çàïðîñà, êîòîðàÿ ñîçäàåò â áàçå äàííûõ ñîîòâåòñòâóþùóþ òàáëèöó |
+void append(TableField* newfield); // äîáàâëÿåò â êîíåö ñïèñêà (óêàçàòåëåé) ïîëåé òàáëèöû íîàîå ïîëå, ïåðåäàâàåìîå ÷åðåç ïàðàìåòð newfield (óêàçàòåëü) |
+ |
+ |
+private: |
+QString tableName; // èìÿ òàáëèöû |
+QString SqlString; // ñòðîêà Sql-çàïðîñà äëÿ ñîçäàíèÿ òàáëèöû â áàçå äàííûõ |
+QString tableCharacterSet; // ïåðåìåííàÿ ñîäåðæèò êîäèðîâêó, â êîòîðîé õðàíÿòüñÿ òåêñòîâûå äàííûå |
+QString tablePrimaryKey; // èìÿ ïîëÿ, ÿâëÿþùåãîñÿ ïåðâè÷íûì êëþ÷îì òàáëèöû |
+QString tableEngine; // äâèæåê òàáëèöû |
+int tablePrimaryKeyIndex; // ïîðÿäêîâûé íîìåð ïîëÿ (â ñïèñêå ïîëåé fields), êîòîðîå ÿâëÿåòñÿ ïåðâè÷íûì êëþ÷îì òàáëèöû |
+QList<TableField*> tableFields; // â ýòîì ñïèñêå íàõîäòñÿ âñå ïîëÿ òàáëèöû |
+TableField *field_tmp; |
+QString tableLastError; // ñòðîêà ñîäåðæèò ïîÿñíèòåëüíûé òåêñò ïîñëåäíåé îøèáêè, êîòîðàÿ âîçíèêëà ïðè âûçîâå ìåòîäîâ êëàññà |
+ |
+bool createSqlString(); // ôóíêöèÿ ãåíåðèðóåò ñòðîêó Sql-çàïðîñà, êîòîðàÿ ñîçäàåò â áàçå äàííûõ ñîîòâåòñòâóþùe òàáëèöó |
+ |
+protected: |
+ |
+}; |
+ |
+#endif // SQLTABLE_H |
Index: trunk/ClassEditor/pic.qrc |
=================================================================== |
--- trunk/ClassEditor/pic.qrc (revision 0) |
+++ trunk/ClassEditor/pic.qrc (revision 257) |
@@ -0,0 +1,6 @@ |
+<RCC> |
+ <qresource prefix="/"> |
+ <file>Delete.png</file> |
+ <file>Open.png</file> |
+ </qresource> |
+</RCC> |
Index: trunk/ClassEditor/delegate.h |
=================================================================== |
--- trunk/ClassEditor/delegate.h (revision 0) |
+++ trunk/ClassEditor/delegate.h (revision 257) |
@@ -0,0 +1,103 @@ |
+#ifndef DELEGATE_H |
+#define DELEGATE_H |
+#include <QItemDelegate> |
+#include <QModelIndex> |
+#include <QSqlQuery> |
+#include <QObject> |
+#include <QSize> |
+#include <QSpinBox> |
+#include <QMap> |
+#include <QTableView> |
+ |
+#include "iconform.h" |
+ |
+//! [0] |
+class SpinBoxDelegate : public QItemDelegate |
+{ |
+ Q_OBJECT |
+ |
+public: |
+ SpinBoxDelegate(QObject *parent = 0); |
+ |
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, const QModelIndex &index) const; |
+ void setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ void updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+ |
+ void getItems(); // ïîëó÷àåì ñâÿçàííûé ñïèñîê |
+ |
+private: |
+ QMap <QString, QString> items; // çäåñü áóäåì õðàíèòü ñâÿçàííûé ñïèñîê èìåò îáúåêòîâ è èõ èäåíòèôèêàòîðîâ ID |
+ |
+ |
+}; |
+//! [0] |
+ |
+class MyDEDelegate : public QItemDelegate { |
+ Q_OBJECT |
+ public: |
+ MyDEDelegate(bool calpopup = true, |
+ QObject *parent = 0); |
+ QWidget *createEditor( |
+ QWidget *parent, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ void setEditorData(QWidget *editor, |
+ const QModelIndex &index) const; |
+ void setModelData(QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ void updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ private: |
+ bool m_calpopup; |
+ }; |
+ |
+ |
+class CPictureDelegate : public QItemDelegate |
+{ |
+ mutable QPixmap m_pxPicture; |
+private: |
+ QTableView *tblView; |
+ |
+public: |
+ CPictureDelegate( QObject *parent ); |
+ |
+ QWidget *createEditor( |
+ QWidget *parent, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setEditorData(QWidget *editor, |
+ const QModelIndex &index) const; |
+ |
+ void setModelData(QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex &index) const; |
+ |
+ |
+ void updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, |
+ const QModelIndex &index) const; |
+ |
+ void setTableView(QTableView* table); |
+ |
+ |
+ //QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; |
+}; |
+ |
+ |
+ |
+ |
+#endif // DELEGATE_H |
Index: trunk/ClassEditor/qrc_pic.cpp |
=================================================================== |
--- trunk/ClassEditor/qrc_pic.cpp (revision 0) |
+++ trunk/ClassEditor/qrc_pic.cpp (revision 257) |
@@ -0,0 +1,350 @@ |
+/**************************************************************************** |
+** Resource object code |
+** |
+** Created: Tue Dec 28 16:23:18 2010 |
+** by: The Resource Compiler for Qt version 4.6.2 |
+** |
+** WARNING! All changes made in this file will be lost! |
+*****************************************************************************/ |
+ |
+#include <QtCore/qglobal.h> |
+ |
+static const unsigned char qt_resource_data[] = { |
+ // /home/andrey/OpenInventory/OpenInventory/trunk/ClassEditor/Open.png |
+ 0x0,0x0,0x8,0x3a, |
+ 0x89, |
+ 0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0, |
+ 0x0,0x0,0x20,0x0,0x0,0x0,0x20,0x8,0x6,0x0,0x0,0x0,0x73,0x7a,0x7a,0xf4, |
+ 0x0,0x0,0x8,0x1,0x49,0x44,0x41,0x54,0x78,0xda,0xbd,0x97,0x6b,0x50,0x54,0xe7, |
+ 0x19,0xc7,0xff,0xef,0xee,0xd9,0xb,0xbb,0xb,0xeb,0xca,0x45,0xe4,0x22,0x15,0x6f, |
+ 0x6b,0x88,0x1a,0x2d,0xb1,0x42,0xa3,0x60,0x24,0x9,0x4d,0x34,0x35,0x66,0xa2,0x68, |
+ 0xd5,0x26,0x99,0xe4,0x43,0xdb,0x34,0x58,0xa5,0x9d,0xcc,0x64,0x3a,0xad,0x97,0x36, |
+ 0xd3,0x24,0xa6,0xe3,0x87,0xce,0x38,0x69,0xcc,0xa4,0x9d,0x66,0x26,0xd5,0xa4,0x9d, |
+ 0x74,0xda,0xc9,0xa4,0x6,0x84,0xc6,0x14,0x22,0x56,0xa3,0x8,0x2,0xba,0x80,0x80, |
+ 0x8,0x2c,0xbb,0xec,0xb2,0xbb,0xe7,0xb6,0x7b,0xf6,0xf4,0x39,0x67,0x17,0xa2,0x55, |
+ 0x2e,0x71,0x32,0xdd,0xe1,0x39,0x87,0x7d,0xcf,0x39,0xef,0xff,0xf7,0x3e,0xb7,0xf7, |
+ 0x2c,0xc3,0xff,0xe1,0x73,0xf6,0xa8,0x35,0x3d,0xc5,0xc2,0xfd,0x3d,0x1a,0x8b,0xb3, |
+ 0xfb,0x9e,0xe7,0xb7,0xd2,0xd0,0x8,0x19,0xaf,0x5d,0x63,0x5f,0x8b,0xc2,0xd3,0x70, |
+ 0x41,0x41,0x39,0x24,0x5c,0xc6,0x71,0x5c,0xa1,0x91,0x38,0x99,0x3a,0x2e,0x9e,0x5f, |
+ 0xf4,0xf0,0xc5,0xcc,0x25,0x8f,0xe7,0x9c,0xfb,0xf0,0x67,0x37,0x8a,0x9f,0xf7,0xef, |
+ 0xa5,0xe1,0xd3,0x64,0xfd,0x33,0x7,0xd8,0x8e,0x5c,0x12,0xc8,0x26,0x4b,0xa7,0x69, |
+ 0x8d,0x64,0x61,0x1a,0x1d,0xc6,0x18,0x4d,0x52,0x4b,0x2b,0xd9,0x89,0x55,0x46,0xb3, |
+ 0xf1,0x3d,0x35,0xac,0x1e,0x8b,0x1f,0x8f,0xbf,0x49,0xd7,0xc6,0xc8,0x62,0x9,0xf1, |
+ 0xca,0x8b,0x99,0xee,0x27,0x72,0x58,0x3c,0x8c,0xd3,0x27,0x5e,0xe,0xae,0x7d,0x21, |
+ 0xf0,0x1a,0x5d,0x7b,0x9f,0xac,0x63,0x7a,0x80,0x1d,0x98,0x47,0xc7,0x27,0x53,0x5d, |
+ 0xa9,0x9b,0xb2,0xd2,0xb3,0x96,0xa5,0xda,0x52,0x33,0x4c,0x9c,0x9,0xbc,0xcc,0x8b, |
+ 0x81,0xb1,0xc0,0x95,0xe0,0x68,0xb0,0x39,0x32,0x10,0x79,0xd7,0x30,0xcb,0xb0,0x22, |
+ 0xaf,0x28,0xef,0x8d,0xe0,0xf5,0xe0,0x67,0x81,0xf7,0x3,0x7b,0x70,0x3,0x97,0x49, |
+ 0xdc,0x9a,0x5f,0xf4,0xe8,0xc5,0xcc,0xa5,0x5b,0x72,0x10,0x27,0x6f,0x2b,0x63,0xf8, |
+ 0xf4,0xc4,0xc1,0x70,0xd9,0x8b,0xc1,0xc3,0x34,0xe7,0x7b,0x64,0xed,0x53,0x3,0x54, |
+ 0x61,0x2d,0x33,0xb3,0x97,0x57,0xaf,0x5c,0xfd,0x48,0xe9,0xb2,0x52,0xe4,0x66,0xe7, |
+ 0xc2,0x6e,0x73,0xc0,0x68,0x64,0xf0,0x9,0x7e,0xc,0x8c,0xe,0xa0,0x6f,0xb8,0xf, |
+ 0xed,0x97,0xda,0x86,0x47,0x43,0xc1,0xc8,0xd2,0xd2,0xa5,0xf3,0xaf,0x75,0x5c,0x93, |
+ 0xba,0x3f,0xec,0x3e,0x50,0x65,0x32,0xfe,0xe5,0x8d,0xfd,0x9b,0x6b,0xb3,0x8b,0x9e, |
+ 0x22,0x71,0x1,0x4c,0x9,0x42,0x8d,0x8d,0xe0,0x5f,0x1f,0x1c,0x9,0x97,0x57,0x87, |
+ 0x66,0x0,0xb0,0x3,0xab,0xd,0x66,0xc3,0xef,0xb6,0x3c,0xb4,0xa5,0xf8,0xb1,0x92, |
+ 0xc7,0x90,0x62,0x4e,0x81,0x14,0x95,0xd1,0xcf,0xf7,0xa3,0x37,0xd4,0x3,0xaf,0xe8, |
+ 0x45,0x28,0x16,0x6,0x1f,0xe3,0xe1,0x1b,0xf3,0x41,0x12,0x45,0x38,0x5c,0xa9,0x8, |
+ 0x79,0xc3,0x18,0xaa,0xeb,0x6b,0xfa,0xe0,0xc1,0xf2,0x5,0x65,0x95,0xcf,0x66,0xda, |
+ 0xcc,0xa,0x54,0x5a,0x39,0xa4,0x6e,0x30,0xa1,0xd,0xf5,0x1f,0xd5,0x87,0xd7,0xef, |
+ 0xe1,0x5f,0x27,0x85,0x3f,0x4f,0xe,0xb0,0x1b,0xe,0xa3,0xd1,0xf8,0xd6,0xc6,0xf5, |
+ 0x1b,0xb7,0xed,0x7a,0x70,0x97,0x7e,0x87,0x27,0xe8,0x41,0x5b,0xa0,0xd,0xad,0x81, |
+ 0x56,0xf8,0x25,0x1f,0x84,0x98,0x8,0x59,0x91,0xa1,0xc4,0x15,0x7d,0xa,0xce,0x60, |
+ 0x20,0x21,0xc0,0x60,0x30,0x42,0x6a,0x8d,0xa8,0x87,0x16,0x7e,0x8f,0x55,0x95,0x7c, |
+ 0x13,0xe9,0x4e,0xba,0x2a,0xb7,0x1,0x42,0x3b,0x58,0xcc,0x8b,0xfa,0x93,0x97,0x9, |
+ 0x40,0x98,0x16,0xa0,0xca,0xbd,0xc8,0xfd,0xce,0x9e,0xa7,0xf6,0x58,0x1c,0x29,0xe, |
+ 0x9c,0xf1,0x9e,0x41,0xa3,0xb7,0x49,0x5f,0xbd,0xa4,0x88,0x94,0xdb,0x94,0xdc,0xcc, |
+ 0x0,0x83,0x9e,0xe7,0x4c,0xff,0xaa,0x1d,0x92,0xc3,0x90,0x47,0x64,0x94,0xf8,0xb, |
+ 0xf1,0x9b,0x8a,0xcd,0x70,0x67,0xf9,0x61,0x51,0x3b,0x28,0x4,0x21,0xba,0xce,0xa3, |
+ 0xe1,0x64,0xe7,0xf4,0x0,0xe6,0xe7,0xcc,0x7f,0xd8,0xb1,0x69,0xc7,0xee,0xb2,0xfb, |
+ 0xca,0x50,0x3b,0x50,0x8b,0x26,0x5f,0x13,0x46,0xa5,0x51,0xba,0x91,0xc1,0x40,0x82, |
+ 0x5a,0x71,0xa9,0xc9,0x22,0x53,0x35,0xd5,0xb8,0xf6,0xaf,0x9a,0x84,0x60,0x3a,0x84, |
+ 0xd8,0x22,0xe0,0xc8,0x92,0x75,0xf8,0x6e,0x51,0xc,0x2e,0x47,0x14,0x6,0x50,0x1e, |
+ 0x50,0x22,0xd6,0x7f,0xe2,0x99,0x1e,0x20,0xed,0x87,0x69,0x6d,0x2f,0x7c,0xff,0x47, |
+ 0x4b,0xbb,0x84,0x6e,0x7c,0x7c,0xe1,0x63,0xf0,0xc3,0x11,0x35,0x1e,0x54,0x18,0x62, |
+ 0x2a,0xc,0x29,0x46,0x18,0x9d,0x26,0x70,0x2e,0xe,0xe6,0x4c,0xb3,0x7e,0xbf,0xe, |
+ 0x91,0xf8,0x23,0x11,0x3a,0x52,0x92,0x6a,0x5e,0x58,0xe7,0x75,0xe0,0x95,0x6f,0x17, |
+ 0x62,0x51,0xe,0x60,0xe1,0x8,0x40,0x15,0x28,0x4,0x3d,0xe1,0xf5,0x3f,0x99,0x6, |
+ 0x60,0xd6,0x8f,0x53,0xa3,0xe5,0x15,0x1b,0xb8,0x7f,0x9f,0x3e,0x89,0x25,0x41,0xe, |
+ 0x45,0xb3,0xe6,0x60,0x59,0xde,0xa,0x8a,0x67,0x16,0x7c,0x52,0x10,0x6d,0xfe,0x5e, |
+ 0x9c,0xf3,0x76,0xa2,0xd5,0x36,0x6,0xae,0xc0,0xa,0x66,0x67,0x9,0x2f,0x28,0x1a, |
+ 0x4c,0x9c,0x2a,0x2e,0xe,0x69,0x40,0x4,0x37,0xa4,0xe0,0x8f,0x25,0xf7,0xa0,0x7c, |
+ 0xa9,0x5,0x4e,0x87,0x4c,0x21,0x23,0x80,0xda,0x5e,0x2,0x10,0x27,0x7,0xb8,0xf0, |
+ 0x96,0x75,0xef,0xda,0xb3,0xb1,0xc3,0xf7,0xe4,0x2f,0x46,0xa5,0x6d,0xd,0xee,0xcf, |
+ 0x5b,0x80,0x74,0x97,0x15,0x69,0xe,0x23,0x55,0x82,0x2,0x3,0x93,0x10,0x8b,0x74, |
+ 0x60,0x74,0xb8,0x15,0x7b,0x1b,0xdb,0xf1,0x45,0xbe,0x1,0xe6,0xc,0x13,0x14,0x41, |
+ 0x41,0x2c,0xa8,0x20,0x3a,0x20,0xc3,0x16,0x4,0x16,0x58,0xed,0xa8,0xc8,0x74,0xa1, |
+ 0x72,0x41,0x2a,0xdc,0x5,0x6,0x64,0xa4,0xc9,0x24,0x24,0xa0,0xa1,0xf6,0xfa,0xe4, |
+ 0x0,0x9a,0xb8,0xd5,0x6a,0x3b,0xfc,0xaa,0x7f,0x15,0xca,0xe7,0x96,0x22,0xdf,0x3e, |
+ 0x1b,0x39,0x73,0x1c,0x4,0x60,0x46,0x8a,0x25,0xe,0x13,0x89,0xb3,0xa8,0x7,0xf1, |
+ 0xf0,0x5,0x84,0x2,0x5e,0xdc,0x7f,0xbc,0x5,0xde,0xf9,0x56,0xc4,0xc2,0xa,0xcc, |
+ 0x83,0xc,0x19,0x31,0x7,0x96,0x3b,0x9d,0xa8,0x9c,0xeb,0xc2,0x3c,0xa7,0x11,0x4e, |
+ 0x9b,0x82,0x2c,0x57,0x1c,0xd9,0xb3,0xa3,0x4,0x2f,0xe9,0x21,0x68,0xa8,0x1b,0xbc, |
+ 0x33,0xc0,0xb8,0xf8,0xfc,0x87,0x7e,0x8f,0xe,0x9f,0x4,0x5b,0x8c,0xc1,0xc4,0xc5, |
+ 0x91,0x3e,0xcb,0xc,0xab,0x49,0x1,0x63,0x94,0xfd,0x32,0xb5,0x6e,0xbe,0x85,0xea, |
+ 0x79,0x10,0x27,0x5a,0xba,0xb1,0xf5,0x9f,0xbd,0x28,0x48,0x9d,0x8d,0x79,0xa6,0xb9, |
+ 0x58,0x33,0xa7,0x10,0xf,0x64,0xa7,0x23,0xcd,0x32,0x4c,0x49,0xa7,0x92,0xc5,0xe0, |
+ 0xb0,0xcb,0x48,0xe1,0x44,0x58,0x8c,0x22,0x89,0x50,0x27,0x54,0x45,0x2,0xf0,0xde, |
+ 0xe,0x70,0xfe,0x4d,0x6b,0x9e,0xdd,0x91,0xd6,0xf7,0x8d,0xd,0x47,0x61,0xb2,0xe7, |
+ 0x21,0x2a,0xf3,0x90,0xa5,0x30,0x8c,0x86,0x18,0x25,0x4f,0x8c,0x1e,0xd4,0x32,0x38, |
+ 0xc,0x95,0xbf,0x0,0x26,0xf6,0x52,0x4d,0xfb,0xf1,0xdb,0x26,0xf,0xba,0x46,0xac, |
+ 0x28,0x5e,0xb0,0x15,0x39,0xe4,0xee,0x34,0x1b,0x65,0xbb,0x75,0x8,0x4e,0x7b,0x18, |
+ 0x76,0x8b,0xc,0x8b,0x49,0x82,0x91,0xca,0x8e,0xa9,0x9a,0x30,0x99,0xd6,0xd,0x9, |
+ 0xa0,0xbe,0xce,0x77,0x3b,0x40,0xdd,0x61,0x4b,0xe1,0x92,0x15,0xeb,0x3c,0x39,0x25, |
+ 0xaf,0xd0,0x8d,0x12,0x25,0x93,0x48,0x65,0x96,0x88,0x19,0xa3,0xef,0x1a,0x0,0xe4, |
+ 0x6b,0x34,0x4f,0x2b,0x35,0x95,0x0,0x75,0xb5,0x31,0xb4,0xb6,0x5d,0x81,0x7d,0x71, |
+ 0xd,0x64,0xe6,0x22,0xb1,0x18,0xad,0x7c,0x4,0x56,0x43,0x3f,0x2c,0x6,0x89,0x4a, |
+ 0x8e,0xa7,0xe7,0x35,0x51,0xcd,0x22,0x34,0x87,0x40,0xdf,0x85,0x84,0x7,0x4e,0x5, |
+ 0xee,0xc,0xb0,0x78,0xf9,0x3,0x9e,0xdc,0x92,0x43,0xf4,0x80,0x4c,0x37,0x4a,0x3a, |
+ 0x8,0xf4,0x87,0x84,0xc4,0x99,0xbf,0x48,0xc3,0x3,0x74,0xf6,0x53,0x47,0x8b,0xa0, |
+ 0xb5,0xa5,0x15,0x85,0xdf,0xf9,0x13,0xc1,0xf2,0x94,0x1b,0x3c,0x38,0xe5,0x2a,0x35, |
+ 0x1b,0xbf,0x2e,0xaa,0x89,0x33,0x1a,0x57,0xd5,0x8,0x6d,0x40,0xfc,0xc4,0x3c,0x42, |
+ 0x98,0xc7,0xc9,0xba,0xb0,0x7f,0xf3,0xcf,0xa5,0x23,0x49,0x80,0xc4,0x6e,0xf8,0xb7, |
+ 0x43,0x96,0xfc,0x85,0xf9,0x5c,0x4f,0x41,0xe9,0x2f,0xd,0xb6,0xac,0x95,0x5f,0x2, |
+ 0x10,0xb1,0x3e,0x21,0xb5,0x50,0xf0,0x97,0x48,0x98,0xc2,0x10,0x1e,0xa2,0x4d,0x56, |
+ 0x44,0xc7,0xe5,0x76,0xb8,0x1f,0x7f,0x37,0xb1,0xca,0xe8,0x75,0xf2,0x4a,0x4f,0x42, |
+ 0x48,0x7,0x88,0x24,0x57,0xcf,0x27,0x0,0x34,0xf1,0x50,0x18,0xcd,0xcd,0x41,0x61, |
+ 0xf7,0xaf,0xa5,0x93,0xbd,0xc3,0xea,0x47,0xa4,0xfb,0xf,0xb2,0xbe,0xf1,0x24,0xe4, |
+ 0x8e,0xfd,0xd4,0x5c,0xbd,0xa6,0x88,0x7b,0xad,0xa0,0xe4,0x25,0x66,0xcf,0x5a,0x91, |
+ 0x9c,0x4c,0x4c,0x78,0x40,0xa2,0xb8,0xcb,0x64,0xb1,0x10,0x10,0xf6,0x22,0x1e,0x8d, |
+ 0xa0,0xb3,0xbd,0x13,0xee,0x8d,0x6f,0xd3,0x75,0x12,0x13,0xbb,0xf4,0x9d,0x8e,0x8d, |
+ 0x8b,0x52,0xcc,0x55,0x25,0xe9,0x7e,0x7a,0x9e,0xf,0x8d,0xa1,0xf9,0x73,0x9f,0xb0, |
+ 0xeb,0x57,0xd2,0xa9,0x3e,0xaf,0xda,0x48,0x7a,0x9f,0x90,0xb5,0x90,0x45,0xc6,0x1, |
+ 0x34,0xcb,0x3c,0xf8,0x8c,0xa9,0x66,0x4b,0x99,0xa9,0xa6,0x60,0xf5,0x8b,0xcc,0x96, |
+ 0x75,0xaf,0xfe,0xb0,0xe,0x22,0x5d,0x85,0x1a,0xf5,0xe9,0x0,0x8c,0x3c,0xa0,0xca, |
+ 0x11,0x74,0x74,0x5c,0x25,0x80,0xa3,0x34,0x46,0x6e,0x97,0xba,0xf4,0x95,0xea,0xae, |
+ 0xd7,0x12,0x4e,0x89,0x4c,0xe4,0x80,0x18,0xe,0xe0,0x4c,0xd3,0xd0,0xb8,0x78,0x13, |
+ 0xe9,0xd4,0x91,0x5d,0x4a,0xbe,0xb0,0xa8,0x37,0xf7,0x1,0x8e,0x2c,0xfb,0xc0,0x33, |
+ 0xa6,0xea,0x27,0xcb,0x4c,0xfb,0xe6,0x15,0x3f,0xc7,0x1c,0x99,0xee,0x4,0x80,0xd8, |
+ 0x49,0x67,0x7a,0x1,0xa2,0xd,0x5,0x63,0xc3,0x54,0x5,0x63,0x68,0xf7,0x74,0xc1, |
+ 0xfd,0x28,0x85,0x32,0x3a,0x48,0x76,0x63,0xc2,0xfd,0x18,0x77,0x3f,0x1,0xf1,0x21, |
+ 0x3f,0x9a,0x9b,0xfa,0xa7,0x14,0xff,0xdf,0x4e,0x78,0xb,0x44,0xfe,0xca,0xed,0x2c, |
+ 0x35,0x73,0x11,0xa5,0x42,0xa7,0x5e,0x42,0xfa,0xe4,0x21,0x2f,0xd4,0x90,0xf,0x1d, |
+ 0xdd,0xd7,0xe0,0xae,0x7c,0x95,0xc4,0xfb,0xc9,0xdd,0xa3,0x7a,0xd2,0x25,0x20,0x22, |
+ 0x7a,0xe,0x88,0xf4,0x8e,0x70,0xa6,0xb1,0x87,0xc4,0xc5,0x29,0xc5,0xef,0xb4,0x17, |
+ 0xdc,0xa,0xb1,0x7c,0x33,0x73,0x50,0x33,0x62,0xaa,0x9c,0x48,0x28,0x7e,0x38,0x1, |
+ 0xe0,0x21,0x80,0x47,0xf6,0x93,0xfb,0xfb,0x13,0xa2,0x6a,0x42,0x5c,0x3,0xe1,0xc9, |
+ 0x4b,0x67,0x1b,0xaf,0x8,0x3b,0xf,0xe9,0xe2,0x9f,0xd3,0x7c,0xb5,0x93,0x89,0x4f, |
+ 0xf6,0x46,0x74,0x13,0x4,0xb7,0x2f,0x77,0xc9,0xb7,0x98,0x33,0x6b,0x6e,0x22,0xce, |
+ 0x94,0x84,0x88,0x24,0x1,0x2a,0x5e,0xd2,0x43,0xa0,0xea,0x8d,0x2a,0xe1,0x7a,0x3e, |
+ 0x38,0x84,0x73,0x8d,0x6d,0xc2,0x8e,0x83,0x62,0xfd,0x4d,0x2b,0x6f,0x99,0x4c,0x7c, |
+ 0x32,0x80,0xdb,0x20,0x72,0x16,0xaf,0x62,0xce,0x8c,0x4c,0x12,0xf7,0xea,0x61,0xe8, |
+ 0xe8,0xea,0x85,0x7b,0x43,0xb5,0x9e,0x84,0x5a,0x93,0xd1,0x2a,0x40,0x8,0xde,0x20, |
+ 0xf1,0xb,0xe2,0xf6,0x3,0xc2,0xcd,0x2b,0x9f,0x52,0x7c,0x2a,0x80,0xdb,0x21,0x16, |
+ 0xde,0xcb,0x9c,0xa9,0x29,0x60,0xa3,0x83,0x68,0xef,0x21,0x80,0xf5,0x3f,0xa0,0xf8, |
+ 0x7,0x93,0xe2,0x3,0x38,0xdf,0x78,0x56,0xda,0xb6,0x5f,0x38,0xd5,0x9f,0x58,0xf9, |
+ 0x8c,0xc4,0xa7,0x3,0xb8,0xd,0x62,0x6e,0x6e,0x21,0x73,0x59,0xe3,0x54,0x5,0xdd, |
+ 0x70,0x97,0x3f,0xab,0xc7,0x5d,0x8,0x5e,0xc7,0xf9,0xcf,0x1a,0xc5,0x6d,0xfb,0xf9, |
+ 0xfa,0xfe,0x2f,0xdd,0x7e,0x71,0x26,0xe2,0x33,0x1,0xb8,0x5,0xe2,0x89,0x52,0x6e, |
+ 0xdf,0x9c,0xac,0x39,0xcc,0x47,0x5e,0x70,0x97,0xed,0xa6,0x98,0xf7,0xe2,0x8b,0xd3, |
+ 0x9f,0xde,0xb5,0xf8,0x4c,0x1,0x26,0x20,0xf6,0x3f,0x6d,0xaa,0xde,0x54,0x6c,0xdc, |
+ 0x47,0xef,0xaa,0xac,0x60,0xe5,0xc3,0xf8,0x4f,0x43,0xad,0xb8,0xfd,0xe0,0xdd,0x8b, |
+ 0x7f,0x15,0x80,0x9,0x88,0x5f,0xec,0xe4,0xaa,0xab,0x2a,0xb8,0x1a,0x5f,0x88,0xe3, |
+ 0xb7,0x1f,0x88,0x34,0x24,0x13,0xee,0xae,0xc4,0xbf,0x2a,0xc0,0x4,0xc4,0x5f,0xf, |
+ 0x98,0x8f,0xd5,0x1c,0x8d,0x7a,0x3c,0x3,0x2a,0xed,0x44,0x68,0xc0,0xc,0x13,0xee, |
+ 0xeb,0x0,0x18,0x87,0xd0,0x7e,0x33,0x16,0x92,0xd1,0xb,0x82,0xfe,0x6b,0xf8,0xae, |
+ 0xc4,0xb5,0xcf,0x7f,0x1,0x76,0xbe,0xa0,0x5d,0x2d,0x84,0xfb,0x20,0x0,0x0,0x0, |
+ 0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82, |
+ // /home/andrey/OpenInventory/OpenInventory/trunk/ClassEditor/Delete.png |
+ 0x0,0x0,0x8,0xf4, |
+ 0x89, |
+ 0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0, |
+ 0x0,0x0,0x20,0x0,0x0,0x0,0x20,0x8,0x6,0x0,0x0,0x0,0x73,0x7a,0x7a,0xf4, |
+ 0x0,0x0,0x8,0xbb,0x49,0x44,0x41,0x54,0x78,0xda,0xb5,0x57,0x79,0x54,0x53,0x67, |
+ 0x16,0xbf,0xf,0x12,0x20,0x1,0xb2,0x0,0x1,0x63,0x8,0x61,0xa9,0xa0,0x16,0xec, |
+ 0x20,0xe2,0x2,0xa7,0xb8,0xb4,0x28,0xad,0xa8,0x14,0x51,0x50,0x4e,0x4b,0x9d,0x1e, |
+ 0x99,0x76,0x6a,0xd5,0x5a,0xa7,0xb6,0x3a,0xb6,0x73,0xa6,0xa7,0xd3,0x99,0xe3,0x1f, |
+ 0xad,0xc7,0x8e,0x55,0x1c,0x97,0xc1,0x51,0xac,0xa7,0x53,0xed,0xd0,0x4e,0xad,0xa, |
+ 0x82,0x2,0x2,0xb2,0x88,0x80,0x78,0x6a,0x5d,0x80,0x80,0x20,0x7b,0x16,0x48,0xf2, |
+ 0x5e,0xf2,0xe6,0x7e,0x2f,0x2f,0x31,0xd0,0xc0,0x4c,0xff,0x98,0x77,0xce,0xcd,0xf7, |
+ 0x96,0xef,0x7e,0xbf,0xdf,0x5d,0xbe,0x7b,0xbf,0x50,0xf0,0x7f,0xbc,0x72,0xd5,0x6a, |
+ 0xe9,0xa9,0xce,0x4e,0x1d,0xff,0xc8,0xba,0x9b,0x43,0x4d,0xa6,0xbc,0x49,0xa3,0x21, |
+ 0xa,0xa6,0xe3,0xed,0xed,0xb1,0x38,0xf6,0xa0,0x18,0x7f,0x9,0xf8,0xab,0x1a,0x4d, |
+ 0x8d,0x50,0x28,0x9c,0xff,0x9d,0x56,0x1b,0xdf,0x6d,0x32,0xdd,0xc7,0x57,0x7a,0x77, |
+ 0x24,0xdc,0x12,0x40,0xf0,0xa1,0x4f,0x3f,0xff,0x42,0xa6,0xeb,0xef,0x87,0xf7,0x3f, |
+ 0xd8,0xd3,0x8f,0x56,0xa4,0xe3,0xeb,0x66,0x94,0xd1,0xff,0x11,0xfc,0xdb,0x9c,0xcc, |
+ 0xac,0x95,0x29,0x2b,0xd3,0x61,0xdb,0xeb,0x9b,0xa1,0x58,0xab,0x5d,0xd3,0x63,0x32, |
+ 0x95,0xe3,0x27,0xdd,0x44,0x12,0xd4,0x4,0x60,0xf,0x1c,0xac,0x8,0xe,0x6c,0x7b, |
+ 0x7,0x78,0x48,0x24,0x30,0x42,0x5b,0x60,0xf7,0x1f,0xf6,0xea,0xff,0xd1,0xd9,0xf9, |
+ 0x3c,0x7e,0x6b,0xf9,0x6f,0x24,0x10,0xbc,0x24,0x3b,0x33,0x6b,0x59,0xf2,0xc2,0x24, |
+ 0x18,0xbd,0x5a,0x1,0x92,0x35,0xe9,0xb0,0x7d,0xcb,0x1b,0x50,0xd6,0xdd,0xfd,0xca, |
+ 0x8f,0x6,0xc3,0xb7,0x38,0x65,0xd8,0x95,0x4,0xe5,0x2,0x2e,0xa0,0x28,0x8a,0xfe, |
+ 0x6b,0xd1,0x97,0x30,0x56,0xdf,0x0,0xd6,0x41,0x9c,0xc7,0xb2,0x20,0xc,0x53,0x83, |
+ 0xd9,0xcb,0xb,0x76,0xed,0x7e,0x97,0x39,0xd1,0xde,0x9e,0xc2,0x7b,0xc2,0x30,0x9, |
+ 0x78,0x6b,0x5e,0xf6,0x86,0xd9,0x9,0x73,0x13,0x10,0xbc,0x12,0x58,0x9b,0xd,0x0, |
+ 0x45,0x92,0xb9,0x6,0x7e,0xf7,0xce,0x76,0xb8,0xd4,0xde,0xfe,0xea,0x5d,0x3b,0x89, |
+ 0x41,0x7,0x9,0x57,0x2,0xec,0xc1,0x33,0x67,0xc1,0x78,0xf9,0xa,0xe2,0xb2,0x9c, |
+ 0x22,0x21,0x40,0x44,0x10,0x12,0xc,0x82,0x88,0x70,0xd8,0xf2,0xfa,0x66,0xe6,0xef, |
+ 0x1d,0x1d,0x8b,0x71,0x7a,0xd3,0xc4,0x9c,0x40,0xf0,0x86,0xed,0xaf,0xe5,0xc7,0x47, |
+ 0x46,0x46,0x81,0xb1,0xf2,0xba,0x5d,0x9f,0x5f,0x83,0x10,0x91,0xae,0xcd,0x80,0x6d, |
+ 0xdb,0xb6,0xc0,0x37,0x9d,0x9d,0x6b,0xfb,0xcc,0xe6,0x2b,0xe,0x4f,0x50,0x8,0xec, |
+ 0x45,0x1e,0xe,0xfc,0xed,0xb8,0xc8,0x7c,0xf3,0x16,0xd8,0x46,0x47,0xc7,0x81,0xb3, |
+ 0xfc,0xbd,0x57,0xb8,0x6,0x86,0x18,0x6,0xf6,0x7c,0xf2,0xd1,0xc0,0xe9,0xce,0xce, |
+ 0x95,0xae,0x39,0x81,0xe0,0xc5,0xeb,0x56,0xbf,0x94,0xfe,0x6c,0x72,0x32,0x18,0xcb, |
+ 0xae,0x3d,0xd1,0xb7,0x5a,0x39,0x7d,0x16,0x47,0xf2,0x4e,0x96,0x9d,0x5,0x6f,0xbd, |
+ 0xbd,0x15,0x4a,0x7b,0x7a,0x36,0x3c,0x34,0x1a,0x2f,0xa0,0xea,0x8,0xf5,0xeb,0xc8, |
+ 0xc8,0x43,0xcb,0x96,0xaf,0xf8,0x4d,0xe6,0xba,0x6c,0x30,0x5e,0xab,0xb4,0x2b,0x12, |
+ 0x25,0x57,0x2f,0x38,0x48,0x44,0x45,0x42,0xbf,0x69,0xc,0xf6,0xee,0xfb,0x73,0x7f, |
+ 0x91,0x56,0xfb,0x2,0x2e,0x70,0x3b,0x4f,0xa3,0x39,0x9d,0xb9,0x72,0xf5,0x9a,0x65, |
+ 0x8b,0x97,0x80,0xa1,0xb4,0xcc,0x39,0xd7,0x46,0x40,0x79,0x61,0x79,0xf1,0x9d,0x9f, |
+ 0x8,0xb7,0x3a,0x1e,0xc0,0xfe,0xaf,0xce,0x76,0x9f,0x7b,0xf4,0x28,0x7,0xf5,0x1b, |
+ 0xa9,0xa4,0xc0,0xc0,0xa8,0x18,0xb9,0xbc,0x7c,0xe7,0x9b,0x5b,0x55,0xea,0x90,0x69, |
+ 0x60,0x6e,0xbb,0xe3,0xb4,0xda,0xe1,0xc6,0x27,0x64,0x0,0x44,0xf3,0xe6,0xc2,0xcd, |
+ 0xe6,0x26,0xd8,0x5f,0x78,0xe2,0x1e,0xc6,0xaf,0x75,0xd5,0xf3,0xcb,0x57,0xaf,0xcd, |
+ 0x78,0x9,0xf4,0xdf,0x5f,0xb4,0xcf,0x25,0xa0,0xc4,0x73,0x64,0x44,0x8f,0xd9,0xc8, |
+ 0x3b,0x9a,0xc1,0x30,0x2a,0x80,0x8e,0xd4,0xc0,0xde,0x23,0x87,0xad,0x17,0x3b,0x3a, |
+ 0x2e,0xe1,0xae,0x38,0x85,0x4,0x2e,0x92,0x1c,0x10,0x5,0x7b,0x7b,0x27,0x2e,0xf, |
+ 0xd,0x2d,0x7a,0xef,0xb7,0x6f,0x4d,0x57,0x87,0x84,0x80,0xb9,0xb5,0x6d,0x5c,0xfc, |
+ 0xc0,0x36,0x3e,0x1c,0xe2,0xc4,0x4,0x68,0x44,0x12,0xf,0x7a,0x7b,0x20,0x2b,0x23, |
+ 0x13,0xf4,0xff,0xfe,0xc1,0x9,0xce,0xcd,0xc1,0xd1,0x86,0xe0,0x2c,0x27,0x56,0x10, |
+ 0x28,0x2,0x11,0x3c,0x1c,0xde,0x3d,0x72,0x88,0xbe,0xac,0xd5,0x56,0xd,0xd2,0xf4, |
+ 0x75,0x2,0x8e,0x52,0x4f,0xf1,0x89,0xe8,0xa7,0x40,0x12,0x2f,0x84,0x86,0x9e,0xf9, |
+ 0xe0,0xed,0x9d,0xa,0x85,0xbf,0x4,0x4c,0x2d,0xad,0x4e,0xab,0xb9,0xc5,0x5d,0xbc, |
+ 0x42,0xee,0xc5,0xb,0x12,0xc1,0x53,0xe2,0xcf,0x81,0x3b,0xb2,0xdd,0xe1,0x6e,0xe, |
+ 0x9c,0x26,0xe0,0x34,0x78,0x6,0x5,0x81,0x47,0xec,0x2c,0xd8,0x7a,0xe0,0x33,0x6b, |
+ 0x49,0x57,0x57,0xc5,0x10,0x4d,0x57,0xe3,0x8a,0xa5,0xc4,0xfd,0x28,0x3,0x8e,0x5d, |
+ 0x40,0x46,0xdf,0x68,0x3f,0xbf,0xd4,0x64,0xa5,0xf2,0xd8,0x8e,0xd7,0xf2,0x65,0x61, |
+ 0xc1,0x21,0x60,0x6a,0x6e,0x7d,0xb2,0xf8,0x38,0x8f,0x8c,0x27,0xe3,0x70,0x39,0x67, |
+ 0x31,0x4d,0x73,0x62,0xb5,0xd0,0x20,0xc,0x56,0x80,0x29,0x5c,0xd,0xef,0x17,0x1e, |
+ 0x67,0xcb,0xbb,0xba,0x6a,0x1f,0x5b,0x2c,0x98,0xa1,0x70,0x19,0xa5,0xe,0x65,0x88, |
+ 0x98,0xe6,0x5a,0x88,0xc8,0xbd,0xbf,0xd2,0xc7,0x27,0x65,0xe9,0xb4,0x69,0x5,0xef, |
+ 0xe5,0xbf,0xa1,0xd4,0xa8,0xd5,0x30,0x56,0x53,0x37,0x1e,0x78,0x2,0x11,0xd6,0x6c, |
+ 0x1,0xeb,0xc0,0x0,0x58,0x87,0x86,0x81,0x19,0x19,0x1,0x46,0xaf,0x7,0x1a,0x77, |
+ 0x92,0x4f,0x4c,0x34,0x18,0xd4,0x4a,0xd8,0x55,0x5e,0x4a,0xd7,0xeb,0x74,0x35,0x83, |
+ 0x16,0x4b,0xd,0xae,0x8f,0x59,0xa,0xb5,0x28,0xfd,0x4,0xdc,0x5d,0x29,0x26,0xcf, |
+ 0x52,0xb9,0x97,0x57,0x42,0x9a,0x52,0x59,0xf8,0x66,0xee,0xcb,0xd3,0xe3,0xa2,0x67, |
+ 0xc2,0x68,0x75,0xed,0x38,0xab,0x99,0xc7,0x7d,0xc0,0xf4,0x3e,0x6,0x2b,0x8e,0xd6, |
+ 0x7e,0x4,0x37,0x18,0x70,0x35,0x16,0xac,0xa4,0x8c,0xe2,0x28,0x8e,0x7d,0x1a,0x1e, |
+ 0x4,0x48,0x60,0x5f,0x4b,0x13,0x5d,0xa7,0xd3,0x55,0xea,0x18,0x86,0x80,0x93,0x52, |
+ 0xdc,0xc0,0x83,0x5b,0xa7,0xea,0x5,0x5c,0x4e,0xf8,0xb,0x4,0xcf,0xac,0x8,0x9, |
+ 0x29,0xdc,0xf6,0x72,0x5e,0xc4,0x9c,0x19,0x31,0x60,0xc0,0x2,0x45,0x77,0x6a,0x81, |
+ 0x21,0xd2,0xfd,0x88,0x73,0xb3,0xe3,0xb2,0xf1,0xc0,0x18,0x7d,0x10,0xc5,0xc5,0xc2, |
+ 0x7d,0xa9,0x1f,0x7c,0xdc,0xd2,0x34,0xd6,0x64,0x30,0x54,0x19,0xec,0xe0,0xa4,0xf0, |
+ 0xdc,0xe4,0x2b,0xa0,0x6d,0xd2,0x5e,0x30,0xe1,0xbd,0x18,0x65,0x16,0x16,0xaa,0x1b, |
+ 0xfb,0x3f,0xfa,0x4,0x7a,0x76,0xec,0xe2,0xac,0x9d,0x78,0xb1,0xbc,0xe0,0x86,0x3, |
+ 0x8c,0x3e,0x84,0x6e,0xdd,0x2,0x1b,0x4f,0x1e,0x83,0x5a,0x9d,0xae,0xcc,0x60,0xb5, |
+ 0x56,0xf2,0x9,0xd7,0xe4,0x88,0xb9,0x3b,0xa0,0xc9,0x2e,0xea,0x95,0xb0,0xb0,0xaf, |
+ 0x12,0x43,0xc3,0x32,0x73,0x16,0x24,0x43,0xff,0xa7,0x7,0xdc,0x4e,0xb2,0x71,0xc2, |
+ 0x72,0x1e,0x20,0x4,0x7c,0x13,0xe6,0x42,0xf9,0xa8,0xe,0xa,0xb4,0x1d,0xc3,0x8d, |
+ 0x7a,0xfd,0x3b,0xfc,0x76,0xeb,0x82,0x5f,0x7a,0x1e,0xc0,0xf2,0xfa,0xaf,0x58,0xa9, |
+ 0x7c,0x55,0xde,0x73,0x2b,0x26,0x5,0x77,0x78,0x80,0x10,0xc0,0xfc,0x7,0xb,0xde, |
+ 0x99,0x71,0x94,0xc6,0xc6,0x42,0x89,0x79,0x14,0x4e,0xf6,0x74,0xf,0x34,0xe8,0xf5, |
+ 0x2f,0xc2,0x14,0x5d,0xd4,0x2d,0x1,0x2c,0xaf,0xc5,0xb,0x2,0x83,0xd3,0xd7,0xa5, |
+ 0x2c,0x85,0xc7,0x9f,0x7d,0xee,0x56,0xc1,0x31,0x5a,0x39,0x12,0x76,0xeb,0x69,0x24, |
+ 0x60,0xc1,0x67,0xb,0xde,0xcb,0x70,0x17,0xd4,0x7b,0x50,0x50,0xd0,0xd5,0x31,0x80, |
+ 0x89,0x98,0x86,0xaf,0x6f,0xbb,0x23,0xf1,0x33,0x2,0xe8,0xf6,0xfa,0xf9,0x1,0x8a, |
+ 0xb9,0xeb,0x16,0x24,0x41,0xdf,0xe1,0xa3,0xbc,0xdf,0x6c,0xdc,0x54,0xca,0x45,0xcd, |
+ 0x55,0xd1,0x91,0x80,0x24,0x2d,0xcd,0x38,0x9a,0x38,0x32,0x0,0x1,0x61,0x61,0xd0, |
+ 0xe8,0x2b,0x86,0x93,0x5d,0x1d,0x96,0x2a,0x9d,0x2e,0x85,0xf7,0x84,0x71,0x52,0x2, |
+ 0x78,0x86,0x6b,0xcd,0x8e,0x98,0x31,0x7b,0xde,0x53,0xd1,0xd0,0x77,0xec,0x84,0x33, |
+ 0xc1,0x58,0x97,0xc9,0x1e,0xfc,0x9d,0x2c,0xf5,0x39,0x2c,0x34,0xc1,0x30,0x70,0xaa, |
+ 0x88,0xf3,0x2,0xc3,0x93,0x20,0xe0,0x66,0x2e,0x1c,0xf6,0x6d,0x19,0xa4,0x52,0x81, |
+ 0x27,0x6e,0xe5,0x1d,0xd,0x35,0x4c,0xd5,0xc8,0x8,0x69,0xe5,0xb7,0xc0,0xe5,0x3c, |
+ 0xe1,0x24,0x90,0xa3,0x52,0x5d,0x59,0x16,0xac,0x5c,0x92,0x16,0xfe,0x14,0x3c,0x3e, |
+ 0x77,0x8e,0xb3,0xf9,0x9,0x1,0x16,0x28,0x27,0x1,0xa,0x2,0x17,0xa7,0xe0,0x2a, |
+ 0x56,0x78,0xa4,0xd3,0xc1,0xaa,0x98,0xd9,0xd0,0x87,0xe7,0x8,0xc6,0x19,0x6,0x3b, |
+ 0x1,0x13,0x97,0x17,0x76,0xef,0xc8,0xa5,0x72,0x30,0xcd,0x98,0x1,0x7f,0xfa,0xe9, |
+ 0x8e,0xb1,0x6a,0x78,0x38,0x95,0x27,0x61,0x74,0x12,0xc8,0x56,0xa9,0xbe,0x4f,0x94, |
+ 0x5,0xa6,0xad,0xc7,0xc5,0xba,0xbf,0xfe,0x9a,0x53,0x24,0x89,0x65,0xe3,0xc1,0x59, |
+ 0x1e,0x98,0x58,0x1f,0x32,0x2f,0x11,0x6e,0xa,0x28,0x38,0x7a,0xef,0x47,0x3,0xcd, |
+ 0xb2,0xe6,0xc,0x95,0x3a,0x30,0x33,0x22,0x1a,0xba,0xcf,0x9f,0xe7,0xc0,0x2c,0x3c, |
+ 0x1,0x33,0x17,0xe,0xfb,0xee,0x20,0x20,0xd3,0x42,0x94,0xd0,0x81,0x8d,0xee,0x88, |
+ 0xf6,0xe1,0xd0,0xd5,0xc1,0x41,0xd2,0xca,0xb9,0xf3,0x4,0x95,0x3d,0x7d,0xfa,0x3e, |
+ 0x99,0x50,0xb8,0xf3,0xc3,0xb4,0x55,0xf0,0xe0,0x70,0x1,0x67,0x1,0xc3,0xbb,0xcf, |
+ 0x1,0x4e,0xc4,0x13,0x97,0x91,0x93,0xfe,0x10,0xf7,0x34,0xfc,0xb1,0xa9,0xc1,0x52, |
+ 0x3d,0x3c,0x5c,0x8a,0x45,0xa6,0x2d,0x55,0xa1,0xc8,0x59,0x1f,0xaa,0x51,0x2e,0x95, |
+ 0x4,0x40,0x6f,0x79,0x19,0xa7,0x6f,0x71,0x86,0x1,0x38,0x63,0xc8,0xa,0x9e,0xf8, |
+ 0x3b,0xe3,0x99,0x4,0x28,0x36,0x8e,0x40,0xe9,0xd0,0xc0,0xc3,0xd2,0x81,0x81,0x2c, |
+ 0x92,0x98,0xd4,0x92,0xa0,0xa0,0x64,0x3f,0xf,0x8f,0x8a,0xfd,0x4b,0x96,0x43,0xcf, |
+ 0x77,0xc5,0x60,0x34,0x1a,0x5d,0x8,0xd8,0x95,0x49,0xca,0xc9,0x64,0x72,0xa0,0x63, |
+ 0x67,0xc3,0x87,0xad,0xcd,0x34,0x56,0xb8,0x4a,0x1d,0x4d,0x93,0xc6,0x52,0xe1,0xeb, |
+ 0xe9,0xc9,0x2e,0x92,0xcb,0x8f,0x6f,0xc,0xd5,0xa8,0x92,0x5,0x3e,0xd0,0x5b,0x57, |
+ 0x3b,0x8e,0x4,0xcd,0xaf,0x20,0xc4,0x31,0x3e,0x6b,0x3d,0x6c,0x2a,0xb9,0x0,0xf7, |
+ 0x4d,0xa6,0x8a,0xf6,0xb1,0xb1,0x43,0xf8,0xea,0x12,0x57,0xf1,0xc2,0xc4,0xe2,0xb5, |
+ 0x1a,0x6f,0xef,0xa3,0x5,0xb,0x9f,0x15,0x76,0x95,0x96,0xc0,0x98,0x79,0x8c,0x2f, |
+ 0x59,0xf6,0x6c,0x97,0x48,0x64,0x40,0xcf,0x8a,0x81,0x3d,0x6d,0x2d,0x74,0xdb,0xe8, |
+ 0x68,0xa5,0x9e,0x61,0x48,0x3f,0x2f,0x1,0x7b,0x6d,0xa7,0xa5,0x2,0xc1,0xdc,0x4, |
+ 0xa9,0xf4,0x74,0xae,0x4a,0xad,0x4a,0x22,0x24,0x1a,0xea,0x38,0xeb,0xad,0x7c,0x1e, |
+ 0x90,0xb5,0xe2,0xf0,0xdc,0x90,0x5b,0xfa,0x3,0xdc,0x33,0x99,0x1a,0xf9,0xae,0x48, |
+ 0xa,0x54,0x95,0x23,0xb1,0x3,0x94,0xde,0xde,0x1b,0xc3,0xbc,0xbd,0xf7,0x7f,0x89, |
+ 0xa1,0xf8,0xe9,0x9b,0xf3,0x60,0x36,0x9b,0x38,0xa,0x12,0xa9,0xc,0xbc,0x13,0xe6, |
+ 0x91,0x2c,0x66,0x5b,0x8c,0x98,0x43,0x34,0x5d,0xe1,0x2,0x3e,0xc4,0x3b,0xca,0x57, |
+ 0xe1,0xe5,0x95,0x14,0x2f,0x91,0x9c,0xc9,0x8f,0x88,0x92,0xc7,0xb2,0x9e,0xe8,0x89, |
+ 0x1b,0x9c,0x27,0x9,0x81,0x99,0xeb,0xb3,0x61,0xc3,0x85,0x62,0xb8,0x67,0x36,0x37, |
+ 0xf7,0x9a,0xcd,0x57,0xc1,0xde,0x15,0xc9,0xb9,0xa0,0xc7,0xb1,0xb,0x38,0x12,0x6a, |
+ 0x91,0x28,0x3f,0xd4,0xcb,0xeb,0xe3,0xc3,0xc9,0x29,0x30,0x7c,0xa5,0xc,0x84,0x22, |
+ 0x31,0xd0,0x73,0xe2,0x60,0x77,0x53,0xbd,0xf5,0x8e,0xd1,0x58,0xd7,0x6f,0xb1,0x90, |
+ 0xda,0x4e,0xfa,0xf9,0xd,0x18,0xdf,0x58,0xb8,0x6,0x86,0xfa,0xcb,0x67,0xf9,0xfa, |
+ 0x7e,0x91,0x1b,0x16,0xae,0x58,0x24,0x14,0x41,0x6f,0x4d,0x35,0x44,0x6c,0xda,0x4, |
+ 0xb9,0xe7,0xce,0xc2,0x5d,0x93,0xa9,0xd,0xff,0x21,0x95,0xf1,0xe0,0x55,0x60,0xff, |
+ 0xb7,0xc5,0xb8,0xd6,0x1,0x42,0x42,0x11,0xea,0xe3,0x93,0x1b,0x2d,0x16,0xff,0xe5, |
+ 0x60,0xea,0x8b,0x82,0x61,0x83,0x1e,0x7e,0x5f,0x5d,0x41,0xfa,0xf9,0x75,0x3c,0xc9, |
+ 0x90,0x3e,0x5e,0xce,0x83,0xf7,0xc1,0xcf,0x1b,0xb,0x17,0x2d,0x4c,0xe8,0x45,0x98, |
+ 0x13,0xc7,0x72,0xc3,0x23,0x95,0xa9,0xb,0x93,0x21,0xaf,0xa8,0x10,0x9a,0xf4,0xfa, |
+ 0xe6,0x47,0x18,0x77,0xfc,0x4e,0xac,0x27,0xe1,0xeb,0x72,0xe4,0xe7,0xc4,0x4a,0x48, |
+ 0x92,0x35,0x48,0x23,0x12,0x65,0xc6,0x4b,0xa5,0x7,0xc9,0xc7,0x6b,0x83,0x83,0xd7, |
+ 0xd0,0x72,0xc2,0x98,0xb4,0x54,0xee,0x18,0x5,0x2e,0xfd,0xdc,0xd,0x9,0x7f,0x24, |
+ 0x31,0x6f,0x71,0x60,0xe0,0x3f,0x71,0x31,0x59,0xed,0xc8,0x48,0xa3,0x76,0x6c,0xac, |
+ 0x8a,0x7,0x27,0xad,0xb9,0x9b,0xe4,0x8d,0xdb,0x4a,0xe8,0x1a,0x8e,0x5f,0x49,0xa5, |
+ 0x9b,0x8d,0xc,0x33,0xe7,0xae,0xd1,0x48,0xfe,0x58,0x56,0xb8,0x71,0x3b,0x4c,0x41, |
+ 0xc2,0x77,0xa6,0x9f,0xdf,0x2a,0xf,0x8a,0xca,0xb8,0xad,0xd7,0x13,0xfd,0x7a,0x47, |
+ 0xcc,0x9d,0x3b,0x73,0xa,0x2,0xe,0x12,0x41,0x28,0x51,0xfc,0x9c,0x7b,0x93,0xb8, |
+ 0x7d,0x2a,0x12,0x52,0x94,0x8,0xb0,0x9f,0x2b,0xda,0xdd,0x81,0x93,0xeb,0x3f,0x64, |
+ 0xb1,0xb8,0xc4,0x9a,0x6e,0x57,0x25,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae, |
+ 0x42,0x60,0x82, |
+ |
+}; |
+ |
+static const unsigned char qt_resource_name[] = { |
+ // Open.png |
+ 0x0,0x8, |
+ 0x6,0xc1,0x5d,0x87, |
+ 0x0,0x4f, |
+ 0x0,0x70,0x0,0x65,0x0,0x6e,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67, |
+ // Delete.png |
+ 0x0,0xa, |
+ 0xc,0xb1,0xf,0x7, |
+ 0x0,0x44, |
+ 0x0,0x65,0x0,0x6c,0x0,0x65,0x0,0x74,0x0,0x65,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67, |
+ |
+}; |
+ |
+static const unsigned char qt_resource_struct[] = { |
+ // : |
+ 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1, |
+ // :/Open.png |
+ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, |
+ // :/Delete.png |
+ 0x0,0x0,0x0,0x16,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x8,0x3e, |
+ |
+}; |
+ |
+QT_BEGIN_NAMESPACE |
+ |
+extern Q_CORE_EXPORT bool qRegisterResourceData |
+ (int, const unsigned char *, const unsigned char *, const unsigned char *); |
+ |
+extern Q_CORE_EXPORT bool qUnregisterResourceData |
+ (int, const unsigned char *, const unsigned char *, const unsigned char *); |
+ |
+QT_END_NAMESPACE |
+ |
+ |
+int QT_MANGLE_NAMESPACE(qInitResources_pic)() |
+{ |
+ QT_PREPEND_NAMESPACE(qRegisterResourceData) |
+ (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); |
+ return 1; |
+} |
+ |
+Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources_pic)) |
+ |
+int QT_MANGLE_NAMESPACE(qCleanupResources_pic)() |
+{ |
+ QT_PREPEND_NAMESPACE(qUnregisterResourceData) |
+ (0x01, qt_resource_struct, qt_resource_name, qt_resource_data); |
+ return 1; |
+} |
+ |
+Q_DESTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qCleanupResources_pic)) |
+ |
Index: trunk/ClassEditor/settingsdialog.cpp |
=================================================================== |
--- trunk/ClassEditor/settingsdialog.cpp (revision 0) |
+++ trunk/ClassEditor/settingsdialog.cpp (revision 257) |
@@ -0,0 +1,26 @@ |
+#include "settingsdialog.h" |
+#include "ui_settingsdialog.h" |
+ |
+SettingsDialog::SettingsDialog(QWidget *parent) : |
+ QDialog(parent), |
+ ui(new Ui::SettingsDialog) |
+{ |
+ ui->setupUi(this); |
+} |
+ |
+SettingsDialog::~SettingsDialog() |
+{ |
+ delete ui; |
+} |
+ |
+void SettingsDialog::changeEvent(QEvent *e) |
+{ |
+ QDialog::changeEvent(e); |
+ switch (e->type()) { |
+ case QEvent::LanguageChange: |
+ ui->retranslateUi(this); |
+ break; |
+ default: |
+ break; |
+ } |
+} |
Index: trunk/ClassEditor/iconform.h |
=================================================================== |
--- trunk/ClassEditor/iconform.h (revision 0) |
+++ trunk/ClassEditor/iconform.h (revision 257) |
@@ -0,0 +1,33 @@ |
+#ifndef ICONFORM_H |
+#define ICONFORM_H |
+ |
+#include <QWidget> |
+ |
+namespace Ui { |
+ class IconForm; |
+} |
+ |
+class IconForm : public QWidget { |
+ Q_OBJECT |
+public: |
+ IconForm(QWidget *parent = 0); |
+ ~IconForm(); |
+ void setPixmap (QPixmap newPixmap); |
+ // void clearPixmap(); |
+ QPixmap pixmap (); |
+ bool dataIsChanged(); |
+protected: |
+ void changeEvent(QEvent *e); |
+ |
+private: |
+ Ui::IconForm *ui; |
+ QPixmap Pixmap; |
+ bool fdataIsChanged; |
+private slots: |
+ |
+ void on_pushButton_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó" |
+ void on_pushButton_2_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó" |
+ |
+}; |
+ |
+#endif // ICONFORM_H |
Index: trunk/ClassEditor/modelfordescriptiontable.h |
=================================================================== |
--- trunk/ClassEditor/modelfordescriptiontable.h (revision 0) |
+++ trunk/ClassEditor/modelfordescriptiontable.h (revision 257) |
@@ -0,0 +1,33 @@ |
+#ifndef MODELFORDESCRIPTIONTABLE_H |
+#define MODELFORDESCRIPTIONTABLE_H |
+ |
+#include <QMainWindow> |
+#include <QObject> |
+#include <QtGui> |
+#include <QSqlQueryModel> |
+#include <QSqlTableModel> |
+#include <QSqlQuery> |
+ |
+class ModelForDescriptionTable : public QSqlTableModel |
+{ |
+Q_OBJECT |
+public: |
+ explicit ModelForDescriptionTable(QObject *parent = 0); |
+ Qt::ItemFlags flags(const QModelIndex &index) const; |
+ bool setData(const QModelIndex &, const QVariant &, int); |
+ bool onlySetData(const QModelIndex &, const QVariant &, int); |
+ |
+ |
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
+ void setInctance(QString currInctatce); // ïåðåäàåì èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
+signals: |
+ void field_changed(); |
+ |
+public slots: |
+ |
+private: |
+ QString Inctance; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ âûäåëåííîãî (â òàáëèöå êëàññîâ) êëàññà |
+ |
+}; |
+ |
+#endif // MODELFORDESCRIPTIONTABLE_H |
Index: trunk/ClassEditor/ClassEditor.pro |
=================================================================== |
--- trunk/ClassEditor/ClassEditor.pro (revision 0) |
+++ trunk/ClassEditor/ClassEditor.pro (revision 257) |
@@ -0,0 +1,46 @@ |
+# ------------------------------------------------- |
+# Project created by QtCreator 2010-08-14T20:52:47 |
+# ------------------------------------------------- |
+QT += network \ |
+ opengl \ |
+ sql \ |
+ script \ |
+ scripttools \ |
+ svg \ |
+ xml \ |
+ xmlpatterns \ |
+ # multimedia \ |
+ qt3support |
+TARGET = ClassEditor |
+TEMPLATE = app |
+SOURCES += main.cpp \ |
+ classeditor.cpp \ |
+ mysql.cpp \ |
+ settingsdialog.cpp \ |
+ tablefield.cpp \ |
+ sqltable.cpp \ |
+ mymodel.cpp \ |
+ delegate.cpp \ |
+ modelfordescriptiontable.cpp \ |
+ delegateforclassestable.cpp \ |
+ modelforpointers.cpp \ |
+ settingform.cpp \ |
+ iconform.cpp |
+HEADERS += classeditor.h \ |
+ mysql.h \ |
+ settingsdialog.h \ |
+ tablefield.h \ |
+ sqltable.h \ |
+ mymodel.h \ |
+ delegate.h \ |
+ modelfordescriptiontable.h \ |
+ delegateforclassestable.h \ |
+ modelforpointers.h \ |
+ settingform.h \ |
+ iconform.h |
+FORMS += classeditor.ui \ |
+ settingsdialog.ui \ |
+ settingform.ui \ |
+ iconform.ui |
+RESOURCES += pic.qrc \ |
+ pic.qrc |
Index: trunk/ClassEditor/tablefield.cpp |
=================================================================== |
--- trunk/ClassEditor/tablefield.cpp (revision 0) |
+++ trunk/ClassEditor/tablefield.cpp (revision 257) |
@@ -0,0 +1,131 @@ |
+#include "tablefield.h" |
+ |
+/*TableField::TableField() |
+{ |
+} |
+*/ |
+ |
+/*********************************************************************************************** |
+ ** Êîíñòðóêòîð êëàññà TableField èìååò îäèí îáÿçàòåëüíûé ïàðàìåòð - èìÿ ïîëÿ |
+ ** îñòàëüíûå ïàðàìåòðû èìåþò çíà÷åíèÿ ïî óìîë÷àíèþ: |
+ ** *parent = 0 (íåò "ðîäèòåëüñêîãî" îáúåêòà) |
+ ** ftype = CHAR(30) (òèï õðàíèìûõ â ïîëå äàííûõ - ñòðîêà èç 30 ñèìâîëîâ) |
+ ** fdefaultValue = NULL (äàííûå â ïîëå ìîãóò èìåòü "ïóñòîå" çíà÷åíèå) |
+ ***********************************************************************************************/ |
+ |
+TableField::TableField(QString fname, QObject *parent, QString ftype, QString fdefaultValue): |
+ QObject(parent) |
+{ |
+ fieldName = fname; |
+ fieldType = ftype; |
+ defaultValue = fdefaultValue; |
+ notNull = false; // ïî óìîë÷àíèþ äàííûå â ïîëå ìîãóò îòñóòñòâîâàòü (áûòü NULL) |
+ characterSet = ""; // êîäèðîâêà ïî óìîë÷àíèþ (íå óêàçûâàòü êîäèðîâêó) |
+ autoIncrement = false; // ñäåëàåì íàøå ïîëå àâòîèíêåìåíòíûì |
+ createSqlString(); // ñôîðìèðóåì ñòðîêó Sql-çàïðîñà, êîòîðàÿ ñîçäàåò â áàçå äàííûõ ñîîòâåòñòâóþùåå ïîëå |
+} |
+ |
+ |
+ |
+/******************************************************************* |
+** Ôóíêöèÿ óñòàíàâëèâàò ïåðåííóþ name (èìÿ ïîëÿ), |
+** |
+*******************************************************************/ |
+ |
+ |
+ |
+void TableField::setName(QString name){ |
+ TableField::fieldName = name; |
+ TableField::createSqlString(); |
+} |
+ |
+ |
+QString TableField::name(){ |
+ return TableField::fieldName; |
+} |
+ |
+QString TableField::type(){ |
+ return TableField::fieldType; |
+} |
+ |
+void TableField::setType(QString ftype){ |
+TableField::fieldType = ftype; |
+TableField::createSqlString(); |
+} |
+ |
+/************************************************************************* |
+** Ôóíêöèÿ isNotNull() âîçâðàùàåò true, åñëè ïîëå èìååò àòðèáóò "NOT NULL" |
+** Èíà÷å - âîçâðàùàåò false |
+*************************************************************************/ |
+ |
+bool TableField::isNotNull(){ |
+return TableField::notNull; |
+} |
+ |
+/******************************************************************* |
+** Ôóíêöèÿ óñòàíàâëèâàåò àòðèáóò ïîëÿ "NOT NULL" |
+** Çíà÷åíèå ïåðåäàåòñÿ ÷åðåç ïàðàìåòð ôóíêöèè |
+*******************************************************************/ |
+ |
+ |
+void TableField::setNotNull(bool fnotNull){ |
+ if ((fnotNull) && (defaultValue == "NULL")) defaultValue = ""; // ïîëå íå ìîæåò áûòü ïóñòûì, ïîýòîìó, åñëè çíà÷åíèå ïî óìîë÷àíèþ NULL, ïîìåíÿåì åãî íà ïóñòóþ ñòðîêó |
+ TableField::notNull = fnotNull; |
+ TableField::createSqlString(); // Ãåíåðèðóåò ñòðîêó Sql-çàïðîñà ñ íîâûìè ïàðàìåòðàìè |
+} |
+ |
+ |
+/******************************************************************************************** |
+** Ôóíêöèÿ ãåíåðèðóåò ñòðîêó Sql-çàïðîñà, êîòîðàÿ ñîçäàåò â áàçå äàííûõ ñîîòâåòñòâóþùåå ïîëå |
+** è ïðèñâàèâàåò ïîëó÷åííîå çíà÷åíèå ïåðåìåííîé SqlString |
+********************************************************************************************/ |
+ |
+void TableField::createSqlString(){ |
+QString str_tmp = ""; |
+str_tmp.append(tr("`")); |
+str_tmp.append(fieldName); |
+str_tmp.append(tr("` ")); |
+str_tmp.append(fieldType); |
+//str_tmp.append(tr(" ")); |
+if (characterSet !="") { |
+str_tmp.append(tr(" character set")); |
+str_tmp.append(characterSet); |
+} |
+if (notNull) { str_tmp.append(tr(" NOT NULL")); } |
+if ((defaultValue !="") && (defaultValue !="NULL")) { |
+ str_tmp.append(tr(" default '")); |
+ str_tmp.append(defaultValue); |
+ str_tmp.append(tr("'"));} |
+if ((defaultValue =="NULL")) { |
+ str_tmp.append(tr(" default ")); |
+ str_tmp.append(defaultValue);} |
+ |
+if (TableField::autoIncrement) { |
+ str_tmp.append(tr(" ")); |
+ str_tmp.append(tr("AUTO_INCREMENT")); |
+} |
+TableField::SqlString = str_tmp; |
+} |
+ |
+ |
+QString TableField::sqlString(){ |
+return TableField::SqlString; |
+} |
+ |
+ |
+void TableField::setDefaultValue(QString fdefaultValue){ |
+ TableField::defaultValue = fdefaultValue; |
+ TableField::createSqlString(); |
+} |
+ |
+ |
+ |
+void TableField::setAutoIncrement(bool autoInc){ |
+ TableField::autoIncrement = autoInc; |
+ TableField::createSqlString(); |
+} |
+ |
+ |
+bool TableField::isAutoIncrement(){ |
+ return TableField::autoIncrement; |
+} |
Index: trunk/ClassEditor/settingform.ui |
=================================================================== |
--- trunk/ClassEditor/settingform.ui (revision 0) |
+++ trunk/ClassEditor/settingform.ui (revision 257) |
@@ -0,0 +1,91 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>settingForm</class> |
+ <widget class="QWidget" name="settingForm"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>180</width> |
+ <height>306</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Параметры соединения</string> |
+ </property> |
+ <widget class="QWidget" name="verticalLayout"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>10</x> |
+ <y>10</y> |
+ <width>171</width> |
+ <height>336</height> |
+ </rect> |
+ </property> |
+ <layout class="QVBoxLayout"> |
+ <item> |
+ <widget class="QLabel" name="label"> |
+ <property name="text"> |
+ <string>Имя базы данных</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_2"> |
+ <property name="text"> |
+ <string>Имя пользователя</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_2"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_3"> |
+ <property name="text"> |
+ <string>Пароль</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_3"/> |
+ </item> |
+ <item> |
+ <widget class="QLabel" name="label_5"> |
+ <property name="text"> |
+ <string>Имя сервера</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <widget class="QLineEdit" name="lineEdit_5"/> |
+ </item> |
+ <item> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="text"> |
+ <string>Применить</string> |
+ </property> |
+ </widget> |
+ </item> |
+ <item> |
+ <spacer> |
+ <property name="orientation"> |
+ <enum>Qt::Vertical</enum> |
+ </property> |
+ <property name="sizeHint" stdset="0"> |
+ <size> |
+ <width>20</width> |
+ <height>40</height> |
+ </size> |
+ </property> |
+ </spacer> |
+ </item> |
+ </layout> |
+ </widget> |
+ </widget> |
+ <resources/> |
+ <connections/> |
+</ui> |
/trunk/ClassEditor/settingform.ui |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/ClassEditor/modelforpointers.h |
=================================================================== |
--- trunk/ClassEditor/modelforpointers.h (revision 0) |
+++ trunk/ClassEditor/modelforpointers.h (revision 257) |
@@ -0,0 +1,31 @@ |
+#ifndef MODELFORPOINTERS_H |
+#define MODELFORPOINTERS_H |
+ |
+#include <QSqlTableModel> |
+#include <QMainWindow> |
+#include <QObject> |
+#include <QtGui> |
+#include <QSqlQueryModel> |
+#include <QSqlTableModel> |
+#include <QSqlQuery> |
+ |
+class ModelForPointers : public QSqlTableModel |
+{ |
+Q_OBJECT |
+public: |
+ explicit ModelForPointers(QObject *parent = 0); |
+ Qt::ItemFlags flags(const QModelIndex &index) const; |
+ bool setData(const QModelIndex &, const QVariant &, int); |
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
+ bool onlySetData(const QModelIndex &, const QVariant &, int); |
+ void setInctance(QString currInctatce); // ïåðåäàåì èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
+signals: |
+ void field_changed(); |
+public slots: |
+ |
+private: |
+ QString Inctance; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ âûäåëåííîãî (â òàáëèöå êëàññîâ) êëàññà |
+ |
+}; |
+ |
+#endif // MODELFORPOINTERS_H |
Index: trunk/ClassEditor/Open.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/ClassEditor/Open.png |
=================================================================== |
--- trunk/ClassEditor/Open.png (revision 0) |
+++ trunk/ClassEditor/Open.png (revision 257) |
/trunk/ClassEditor/Open.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/ClassEditor/Delete.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: trunk/ClassEditor/Delete.png |
=================================================================== |
--- trunk/ClassEditor/Delete.png (revision 0) |
+++ trunk/ClassEditor/Delete.png (revision 257) |
/trunk/ClassEditor/Delete.png |
Изменения свойств: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: trunk/ClassEditor/mysql.cpp |
=================================================================== |
--- trunk/ClassEditor/mysql.cpp (revision 0) |
+++ trunk/ClassEditor/mysql.cpp (revision 257) |
@@ -0,0 +1,539 @@ |
+#include "mysql.h" |
+ |
+MySql::MySql(QObject *parent) : |
+ QObject(parent) |
+{ |
+} |
+ |
+MySql::~MySql(){ |
+db.close(); |
+} |
+ |
+/************************************************ |
+** Ôóíêöèÿ ïðèñâîåíèÿ çíà÷åíèÿ èìåíè áàçû äàííûõ |
+** |
+************************************************/ |
+ |
+ |
+ |
+void MySql::setDatabaseName(QString name){ |
+ MySql::sqlDatabaseName = name; |
+} |
+ |
+ |
+bool MySql::connect(){ |
+ db = QSqlDatabase::addDatabase("QMYSQL"); |
+ |
+ db.setHostName(MySql::sqlHostName); |
+ db.setDatabaseName(MySql::sqlDatabaseName); |
+ db.setUserName(MySql::sqlUserName); |
+ db.setPassword(MySql::sqlPassword); |
+ bool ok = db.open(); |
+ if (ok) return true; |
+ else { |
+ MySql::mysqlLastError = db.lastError().text(); |
+ return false; } |
+ |
+ /* |
+ pdb->setHostName(hostName); |
+ pdb->setDatabaseName(baseName); |
+ pdb->setUserName(userName); |
+ pdb->setPassword(password); |
+ bool ok = pdb->open(); |
+ |
+if (!ok) { |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ QWidget(this->parent()), // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ db.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ } |
+ */ |
+ |
+ return true; |
+} |
+ |
+ |
+void MySql::setUserName(QString uname){ |
+ MySql::sqlUserName = uname; |
+} |
+ |
+void MySql::setPassword(QString passwrd){ |
+ MySql::sqlPassword = passwrd; |
+} |
+ |
+ |
+void MySql::setHostName(QString hname){ |
+ MySql::sqlHostName = hname; |
+} |
+ |
+bool MySql::createTable(SqlTable* table){ // ñîçäàåò â áàçå äàííûõ òàáëèöó |
+QSqlQuery q; |
+bool ok; |
+ok = q.prepare(table->sqlString()); |
+if(!ok) { |
+ MySql::mysqlLastError = q.lastError().text(); |
+ return false;} |
+ok = q.exec(); |
+if(!ok) { |
+ MySql::mysqlLastError = q.lastError().text(); |
+ return false;} |
+else return true; |
+} |
+ |
+ |
+ |
+QString MySql::lasError(){ |
+ |
+ return MySql::mysqlLastError; |
+} |
+ |
+ |
+ |
+/************************************************ |
+** Ôóíêöèÿ ñîçäàåò íåîáõîäèìûå òàáëèöû â áàçå äàííûõ |
+** äëÿ õðàíåíèÿ íàçâàíèÿ è îïèñàíèÿ êëàññîâ |
+** (Òàáëèöà ListOfClasses è Òàáëèöà DescriptionOfClasses) |
+************************************************/ |
+ |
+ |
+bool MySql::createDataBase(){ |
+ SqlTable* tbl; |
+ TableField* fld; |
+ if (!db.isOpen()){ |
+ MySql::mysqlLastError = tr("Database is not open!"); |
+ return false; |
+ } |
+ |
+ tbl = new SqlTable(tr("ListOfModels")); // ñîçäàäèì òàáëèöó ñ èìåíåì ListOfModels äëÿ õðàíåíèÿ ñïèñêà ìîäåëåé ïðåäñòàâëåíèÿ |
+ fld = new TableField(tr("ModelName"), tbl); // ýòî âòîðîå ïîëå òàáëèöû áóäåò õðàíèòü èìåíà ìîäåëåé, ïåðâîå ïîëå ID óæå èìååòñÿ â íîâîé òàáëèöå (îíî ñîçäàåòñÿ ïî óìîë÷àíèþ) |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New model")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ fld = new TableField(tr("ModelString"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ìîäåëü â âèäå ñòðîêè |
+ fld->setType(tr("TEXT")); // òèï ïîëÿ - òåêñò |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); |
+ |
+ fld = new TableField(tr("Enable"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ìîäåëü â âèäå ñòðîêè |
+ fld->setType(tr("BOOL")); // òèï ïîëÿ - òåêñò |
+ fld->setDefaultValue(tr("1")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); |
+ |
+ |
+ if(!MySql::createTable(tbl)){ // åñëè íå óäàåòñÿ ñîçäàòü òàáëèöó |
+ |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return false; // âûâîäèì îøèáêó |
+ } |
+ |
+ |
+ else { // òàáëèöó óñïåøíî ñîçäàíà |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return true; // ñîîáùàåì îá óñïåõå |
+ |
+ } |
+ |
+ |
+ |
+ |
+ |
+ tbl = new SqlTable(tr("ListOfClasses")); // ñîçäàäèì òàáëèöó ñ èìåíåì ListOfClasses äëÿ õðàíåíèÿ ñïèñêà êëàññîâ |
+ fld = new TableField(tr("ClassName"), tbl); // ýòî âòîðîå ïîëå òàáëèöû áóäåò õðàíèòü èìåíà êëàññîâ, ïåðâîå ïîëå ID óæå èìååòñÿ â íîâîé òàáëèöå (îíî ñîçäàåòñÿ ïî óìîë÷àíèþ) |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New class")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("ClassAlias"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New class alias")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("TableWhithInstance"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New class instance")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("Comment"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("without comments")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ if(!MySql::createTable(tbl)){ // åñëè íå óäàåòñÿ ñîçäàòü òàáëèöó |
+ |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return false; // âûâîäèì îøèáêó |
+ } |
+ |
+ |
+ else { // òàáëèöó óñïåøíî ñîçäàíà |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return true; // ñîîáùàåì îá óñïåõå |
+ |
+ } |
+ |
+ tbl = new SqlTable(tr("DescriptionOfClasses")); // ñîçäàäèì òàáëèöó ñ èìåíåì DescriptionOfClassess äëÿ õðàíåíèÿ îïèñàíèÿ ïîëåé êëàññîâ |
+ fld = new TableField(tr("FieldName"), tbl); // ýòî âòîðîå ïîëå òàáëèöû áóäåò õðàíèòü èìåíà ïîëåé, ïåðâîå ïîëå ID óæå èìååòñÿ â íîâîé òàáëèöå (îíî ñîçäàåòñÿ ïî óìîë÷àíèþ) |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New field")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("FieldAlias"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû ïîëåé êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New class alias")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("FieldType"), tbl); // ýòî ÷åòâåðòîå ïîëå òàáëèöû áóäåò òèï ïîëÿ êëàññà |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("CHAR(30)")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("ClassIdentifer"), tbl); // ýòî ïÿòîå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(false); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("INT(10)")); // òèï ïîëÿ - öåëîå ÷èñëî |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ |
+ fld = new TableField(tr("Comment"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("without comments")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ if(!MySql::createTable(tbl)){ // åñëè íå óäàåòñÿ ñîçäàòü òàáëèöó |
+ |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return false; // âûâîäèì îøèáêó |
+ } |
+ |
+ |
+ else { // òàáëèöó óñïåøíî ñîçäàíà |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return true; // ñîîáùàåì îá óñïåõå |
+ |
+ } |
+ |
+tbl = new SqlTable(tr("Filters")); // ñîçäàäèì òàáëèöó ñ èìåíåì DescriptionOfClassess äëÿ õðàíåíèÿ îïèñàíèÿ ïîëåé êëàññîâ |
+fld = new TableField(tr("Model_ID"), tbl); // ýòî âòîðîå ïîëå òàáëèöû áóäåò õðàíèòü èìåíà ïîëåé, ïåðâîå ïîëå ID óæå èìååòñÿ â íîâîé òàáëèöå (îíî ñîçäàåòñÿ ïî óìîë÷àíèþ) |
+fld->setNotNull(false); // ïîëå ìîæåò áûòü ïóñòûì |
+fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+if(!MySql::createTable(tbl)){ // åñëè íå óäàåòñÿ ñîçäàòü òàáëèöó |
+ |
+// delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return false; // âûâîäèì îøèáêó |
+} |
+ |
+ |
+else { // òàáëèöó óñïåøíî ñîçäàíà |
+// delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return true; // ñîîáùàåì îá óñïåõå |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+bool MySql::createListOfClassesTable(){ |
+ |
+ SqlTable* tbl; |
+ TableField* fld; |
+ if (!db.isOpen()){ |
+ MySql::mysqlLastError = tr("Database is not open!"); |
+ return false; |
+ } |
+ tbl = new SqlTable(tr("ListOfClasses")); // ñîçäàäèì òàáëèöó ñ èìåíåì ListOfClasses äëÿ õðàíåíèÿ ñïèñêà êëàññîâ |
+ fld = new TableField(tr("ClassName"), tbl); // ýòî âòîðîå ïîëå òàáëèöû áóäåò õðàíèòü èìåíà êëàññîâ, ïåðâîå ïîëå ID óæå èìååòñÿ â íîâîé òàáëèöå (îíî ñîçäàåòñÿ ïî óìîë÷àíèþ) |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New class")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("ClassAlias"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New class alias")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("TableWhithInstance"), tbl); // ýòî ÷åòâåðòîå ïîëå òàáëèöû áóäåò õðàíèòü èìÿ òàáëèöû - õðàíèëèùà îáúåêòîâ êëàññà |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New class instance")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("Comment"), tbl); // ýòî ïÿòîå ïîëå òàáëèöû áóäåò õðàíèòü êîììåíòàðèé |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("without comments")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("Icon"), tbl); // ýòî ïÿòîå ïîëå òàáëèöû áóäåò õðàíèòü èêîíêó äëÿ êëàññà |
+// fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("BLOB")); // òèï ïîëÿ - "BLOB" |
+// fld->setDefaultValue(tr("without comments")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ |
+ |
+ if(!MySql::createTable(tbl)){ // åñëè íå óäàåòñÿ ñîçäàòü òàáëèöó |
+ |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return false; // âûâîäèì îøèáêó |
+ } |
+ |
+ |
+ else { // òàáëèöó óñïåøíî ñîçäàíà |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return true; // ñîîáùàåì îá óñïåõå |
+ |
+ } |
+ |
+ |
+ |
+} |
+ |
+ |
+ |
+ |
+bool MySql::createListModelsTable(){ // ñîçäàåò íåîáõîäèìóþ òàáëèöó â áàçå äàííûõ äëÿ õðàíåíèÿ ìîäåëåé (Òàáëèöà ListOfModels) |
+ |
+ SqlTable* tbl; |
+ TableField* fld; |
+ if (!db.isOpen()){ |
+ MySql::mysqlLastError = tr("Database is not open!"); |
+ return false; |
+ } |
+ tbl = new SqlTable(tr("ListOfModels")); // ñîçäàäèì òàáëèöó ñ èìåíåì ListOfModels äëÿ õðàíåíèÿ ñïèñêà ìîäåëåé |
+ fld = new TableField(tr("ModelName"), tbl); // ýòî âòîðîå ïîëå òàáëèöû áóäåò õðàíèòü èìåíà ìîäåëåé, ïåðâîå ïîëå ID óæå èìååòñÿ â íîâîé òàáëèöå (îíî ñîçäàåòñÿ ïî óìîë÷àíèþ) |
+ //fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New model")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("ModelString"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ìîäåëü êàê ñòðîêó |
+ //fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("TEXT")); // òèï ïîëÿ - òåêñò |
+ //fld->setDefaultValue(tr("New class alias")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("Enable"), tbl); // îòîáðàæàòü èëè íåò ìîäåëü |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("BOOL")); // òèï ïîëÿ - áóëåâîå |
+ fld->setDefaultValue(tr("1")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("Comment"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("without comments")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ if(!MySql::createTable(tbl)){ // åñëè íå óäàåòñÿ ñîçäàòü òàáëèöó |
+ |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return false; // âûâîäèì îøèáêó |
+ } |
+ |
+ |
+ else { // òàáëèöó óñïåøíî ñîçäàíà |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return true; // ñîîáùàåì îá óñïåõå |
+ |
+ } |
+ |
+ |
+} |
+ |
+bool MySql::createDescriptionOfClassesTable(){ // ñîçäàåò íåîáõîäèìóþ òàáëèöó â áàçå äàííûõ äëÿ õðàíåíèÿ îïèñàíèÿ êëàññîâ (Òàáëèöà DescriptionOfClasses) |
+ SqlTable* tbl; |
+ TableField* fld; |
+ if (!db.isOpen()){ |
+ MySql::mysqlLastError = tr("Database is not open!"); |
+ return false; |
+ } |
+ tbl = new SqlTable(tr("DescriptionOfClasses")); // ñîçäàäèì òàáëèöó ñ èìåíåì DescriptionOfClassess äëÿ õðàíåíèÿ îïèñàíèÿ ïîëåé êëàññîâ |
+ fld = new TableField(tr("FieldName"), tbl); // ýòî âòîðîå ïîëå òàáëèöû áóäåò õðàíèòü èìåíà ïîëåé, ïåðâîå ïîëå ID óæå èìååòñÿ â íîâîé òàáëèöå (îíî ñîçäàåòñÿ ïî óìîë÷àíèþ) |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New field")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("FieldAlias"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû ïîëåé êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("New field alias")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("FieldType"), tbl); // ýòî ÷åòâåðòîå ïîëå òàáëèöû áóäåò òèï ïîëÿ êëàññà |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("CHAR(30)")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("DefaultValue"), tbl); // ýòî ÷åòâåðòîå ïîëå òàáëèöû áóäåò òèï ïîëÿ êëàññà |
+ fld->setNotNull(false); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("ClassIdentifer"), tbl); // ýòî ïÿòîå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(false); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("INT(10)")); // òèï ïîëÿ - öåëîå ÷èñëî |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ |
+ fld = new TableField(tr("Comment"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ïñåâäîíèìû êëàññîâ |
+ fld->setNotNull(true); // ïîëå íå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("without comments")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ if(!MySql::createTable(tbl)){ // åñëè íå óäàåòñÿ ñîçäàòü òàáëèöó |
+ |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return false; // âûâîäèì îøèáêó |
+ } |
+ |
+ |
+ else { // òàáëèöó óñïåøíî ñîçäàíà |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return true; // ñîîáùàåì îá óñïåõå |
+ |
+ } |
+ |
+ |
+} |
+ |
+ |
+bool MySql::createFiltersTable(){ // ñîçäàåò íåîáõîäèìóþ òàáëèöó â áàçå äàííûõ äëÿ õðàíåíèÿ ôèëüòðîâ (Òàáëèöà Filters) |
+ |
+ SqlTable* tbl; |
+ TableField* fld; |
+ if (!db.isOpen()){ |
+ MySql::mysqlLastError = tr("Database is not open!"); |
+ return false; |
+ } |
+ tbl = new SqlTable(tr("Filters")); // ñîçäàäèì òàáëèöó ñ èìåíåì Filters äëÿ õðàíåíèÿ ôèëüòðîâ |
+ |
+ fld = new TableField(tr("Model_ID"), tbl); // ýòî âòîðîå ïîëå òàáëèöû áóäåò õðàíèòü ID ìîäåëè, ïåðâîå ïîëå ID óæå èìååòñÿ â íîâîé òàáëèöå (îíî ñîçäàåòñÿ ïî óìîë÷àíèþ) |
+ fld->setNotNull(false); // ïîëå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("Class_ID"), tbl); // ýòî òðåòüå ïîëå òàáëèöû áóäåò õðàíèòü ID êëàññà, ê êîòîðîìó áóäåò ïðèìåíÿòüñÿ ôèëüòð |
+ fld->setNotNull(false); // ïîëå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ fld = new TableField(tr("Ñondition"), tbl); // ýòî ÷åòâåðòîå ïîëå òàáëèöû áóäåò õðàíèòü ëîãè÷åñêèå óñëîâèå (AND, OR), c êîòîðûì âûðàæåíèå áóäåò äîáàâëÿòüñÿ â ôèëüòð |
+ fld->setNotNull(false); // ïîëå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ |
+ fld = new TableField(tr("FieldName"), tbl); // ýòî ïÿòîå ïîëå òàáëèöû áóäåò õðàíèòü èìÿ ïîëÿ, ïî êîòîðîìó áóäåò ïðèìåíÿòüñÿ ôèëüòð |
+ fld->setNotNull(false); // ïîëå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ fld = new TableField(tr("ÑonditionalSymbol"), tbl); // ýòî øåñòîå ïîëå òàáëèöû áóäåò õðàíèòü ñèìâîë óñëîâèÿ (>, =, <) |
+ fld->setNotNull(false); // ïîëå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ |
+ fld = new TableField(tr("ValueForComparison"), tbl); // ýòî ñåäüìîå ïîëå òàáëèöû áóäåò õðàíèòü çíà÷åíèå äëÿ ñðàâíåíèÿ |
+ fld->setNotNull(false); // ïîëå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("TEXT")); // òèï ïîëÿ - òåêñò |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ fld = new TableField(tr("PostÑondition"), tbl); // ýòî âîñüìîå ïîëå òàáëèöû áóäåò õðàíèòü ëîãè÷åñêèå óñëîâèå (AND, OR), c êîòîðûì âûðàæåíèå áóäåò äîáàâëÿòüñÿ â ôèëüòð |
+ fld->setNotNull(false); // ïîëå ìîæåò áûòü ïóñòûì |
+ fld->setType(tr("CHAR(30)")); // òèï ïîëÿ - ñòðîêà èç 30 ñèìâîëîâ |
+ fld->setDefaultValue(tr("NULL")); // çíà÷åíèå ïîëÿ ïî óìîë÷àíèþ |
+ tbl->append(fld); // äîáàâëÿåì ïîëå â òàáëèöó |
+ |
+ |
+ if(!MySql::createTable(tbl)){ // åñëè íå óäàåòñÿ ñîçäàòü òàáëèöó |
+ |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return false; // âûâîäèì îøèáêó |
+ } |
+ |
+ |
+ else { // òàáëèöó óñïåøíî ñîçäàíà |
+ // delete fld; |
+ delete tbl; // ÷èñòèì çà ñîáîé |
+ return true; // ñîîáùàåì îá óñïåõå |
+ |
+ } |
+ |
+ |
+} |
+ |
+ |
+ |
+QSqlError MySql::dbLastError(){ // ôóíêöèÿ ôîçâðàùàåò ïîñëåäíþþ îøèáêó áàçû äàííûõ |
+ QString error; |
+ error = db.lastError().text(); |
+ |
+ return db.lastError(); |
+} |
+ |
+ |
+void MySql::close(){ // çàêîûâàåì ñîåäèíåíèå ñ áàçîé |
+ db.close(); |
+ |
+} |
Index: trunk/ClassEditor/settingform.h |
=================================================================== |
--- trunk/ClassEditor/settingform.h (revision 0) |
+++ trunk/ClassEditor/settingform.h (revision 257) |
@@ -0,0 +1,15 @@ |
+#ifndef __SETTINGFORM_H__ |
+#define __SETTINGFORM_H__ |
+#include <QWidget> |
+#include "ui_settingform.h" |
+// place your code here |
+class settingForm : public QWidget, public Ui::settingForm |
+{ |
+Q_OBJECT |
+public: |
+ settingForm(); |
+ |
+ private slots: |
+// void on_pushButton_clicked(); |
+}; |
+#endif // __SETTINGFORM_H__ |
/trunk/ClassEditor/settingform.h |
Изменения свойств: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: trunk/ClassEditor/sqltable.cpp |
=================================================================== |
--- trunk/ClassEditor/sqltable.cpp (revision 0) |
+++ trunk/ClassEditor/sqltable.cpp (revision 257) |
@@ -0,0 +1,171 @@ |
+#include "sqltable.h" |
+ |
+SqlTable::SqlTable(QString tname, QObject *parent) : |
+ QObject(parent) |
+{ |
+ |
+ tableName = tname; |
+ field_tmp = new TableField("ID", this); // ïðè ñîçäàíèè òàáëèöû äîáàâèì ïîëå "ID" (ñ÷åò÷èê) |
+ field_tmp->setType(tr("INT(10)")); |
+ field_tmp->setAutoIncrement(true); |
+ tableFields.append(field_tmp); // äîáàâëÿåì íîâîå ïîëå (óêàçàòåëü) â ñïèñîê (óêàçàòåëåé) ïîëåé |
+ tablePrimaryKey = field_tmp->name(); // äåëàåì íàøå åäèíñòâåííîå ïîëå ïåðâè÷íûì êëþ÷îì |
+ tablePrimaryKeyIndex = 0; |
+ tableEngine = tr("MyISAM"); |
+ tableCharacterSet = tr("cp1251"); |
+ SqlTable::createSqlString(); |
+ //delete field_tmp; |
+} |
+ |
+/*************************************************************************************** |
+** ôóíêöèÿ ïðèñâàèâàåò èìÿ òàáëèöå, íîâîå èìÿ ïåðåäàåòñÿ â ïàðàìåòðå ôóíêöèè tname |
+** |
+** |
+***************************************************************************************/ |
+ |
+ |
+void SqlTable::setName(QString tname){ |
+ SqlTable::tableName = tname; |
+ SqlTable::createSqlString(); |
+} |
+ |
+/*************************************************************************************** |
+** ôóíêöèÿ âîçâðàùàåò èìÿ òàáëèöû |
+** |
+** |
+***************************************************************************************/ |
+ |
+ |
+QString SqlTable::name(){ |
+ |
+ return SqlTable::tableName; |
+} |
+ |
+ |
+/*************************************************************************************** |
+** ôóíêöèÿ âîçâðàùàåò ñïèñîê óêàçàòåëåé íà ïîëÿ òàáëèöû |
+** |
+** |
+***************************************************************************************/ |
+ |
+QList<TableField*> SqlTable::fields(){ |
+ |
+ return SqlTable::tableFields; |
+} |
+ |
+ |
+/*************************************************************************************** |
+** ôóíêöèÿ óñòàíàâëèâàåò ïåðâè÷íûì êëþ÷îì ïîëå, |
+** èìåíÿ êîòîðîãî ñîâïàäàåò ñ ïåðåäàâàåìûì ïàðàìåòðîì fieldName |
+** Âîçâðàùàåò true, åñëè îïðåðàöèÿ ïðîøëà óñïåøíî |
+** Èíà÷å - âîçâðàùàåò false è ïîìåùàåò ïîÿñíåíèå ê ñëó÷èâøåéñÿ îøèáêå â ïåðåìåííóþ lastError |
+** |
+** |
+***************************************************************************************/ |
+ |
+ |
+ |
+bool SqlTable::setPrimaryKey(QString fieldName){ |
+ |
+ if (tableFields.isEmpty()) { // åñëè ñïèñîê ïîëåé ïóñò |
+ SqlTable::tableLastError = tr("Table does not contain fields!"); // âûäàåì îøèáêó |
+ return false; |
+ } |
+ for (int i = 0; i < tableFields.size(); ++i){ |
+ if (tableFields.at(i)->name() == fieldName){ // íàøëè ïîëå ñ íóæíûì èìåíåì |
+ SqlTable::tablePrimaryKeyIndex = i; // ïðèñâàèâàåì èäåêñó êëþ÷åâîãî ïîëÿ íîâîå çíà÷åíèå |
+ SqlTable::tablePrimaryKey = tableFields.at(i)->name(); // òàêæå ïðèñâàèâàåì íîâîå çíà÷åíèå ïåðåìåííîé, ñîäåðæàùåé èìÿ êëþ÷åâîãî ïîëÿ |
+ SqlTable::createSqlString(); // îáíîâëÿåì sql-ñòðîêó çàïðîñà |
+ return true; |
+ } |
+ } |
+ SqlTable::tableLastError = tr("In the table there is no field with that name!"); // íå íàøëè ïîëÿ ñ òàêèì èìåíåì, |
+ return false; // âûäàåì îøèáêó |
+} |
+ |
+ |
+/*************************************************************************************** |
+** ôóíêöèÿ âîçâðàùàåèò ïîÿñíèòåëüíûé òåêñò ïîñëåäíåé îøèáêè, |
+** êîòîðàÿ âîçíèêëà ïðè âûçîâå ìåòîäîâ êëàññà |
+** |
+***************************************************************************************/ |
+ |
+QString SqlTable::lastError(){ |
+return SqlTable::tableLastError; |
+} |
+ |
+ |
+ |
+/*************************************************************************************** |
+** ôóíêöèÿ âîçâðàùàåò èìÿ ïîëÿ, |
+** êîòîðîå ÿâëÿåòñÿ ïåðâè÷íûì êëþ÷îì |
+** |
+***************************************************************************************/ |
+ |
+QString SqlTable::primaryKey(){ |
+ return SqlTable::tablePrimaryKey; |
+} |
+ |
+/*************************************************************************************** |
+** ôóíêöèÿ ãåíåðèðóåò ñòðîêó Sql-çàïðîñà, |
+** êîòîðàÿ ñîçäàåò â áàçå äàííûõ ñîîòâåòñòâóþùe òàáëèöó |
+** |
+***************************************************************************************/ |
+ |
+bool SqlTable::createSqlString(){ |
+ QString sql_str; |
+ int i = 0; |
+ if (tableFields.isEmpty()) { // åñëè ñïèñîê ïîëåé ïóñò |
+ SqlTable::tableLastError = tr("Table does not contain fields!"); // âûäàåì îøèáêó |
+ return false; |
+ } |
+ sql_str = tr("CREATE TABLE `"); |
+ sql_str.append( SqlTable::tableName); |
+ sql_str.append(tr("` ( ")); |
+ |
+ for (i; i < (tableFields.size()-1); ++i){ // îáðàáîòàåì âñå ïîëÿ, êðîìå ïîñëåäíåãî |
+ sql_str.append(tableFields.at(i)->sqlString()); |
+ sql_str.append(tr(", ")); |
+ } |
+ sql_str.append(tableFields.at(i)->sqlString()); // ïîñëåäíåå ïîëå |
+ sql_str.append(tr(" ")); // ïîñëå ïîñëåäíåãî ïîëÿ çàïÿòóþ ïîêà íå ñòàâèì |
+ |
+ if (SqlTable::tablePrimaryKey != tr("")) { // åñëè åñòü ïåðâè÷íûé êëþ÷, |
+ sql_str.append(tr(", ")); // òî ñòàâèì çàïÿòóþ |
+ sql_str.append(tr("PRIMARY KEY (`")); |
+ sql_str.append(SqlTable::tablePrimaryKey); |
+ sql_str.append(tr("`) ) ")); |
+ } |
+ else sql_str.append(tr(" ) ")); |
+ if (SqlTable::tableEngine != tr("")) { |
+ sql_str.append(tr("ENGINE=")); |
+ sql_str.append(SqlTable::tableEngine); |
+ sql_str.append(tr(" ")); |
+ } |
+ if (SqlTable::tableCharacterSet != tr("")){ |
+ sql_str.append(tr("DEFAULT CHARSET=")); |
+ sql_str.append(SqlTable::tableCharacterSet); |
+ |
+ } |
+ SqlTable::SqlString = sql_str; |
+ return true; |
+ |
+} |
+ |
+/*************************************************************************************** |
+** ôóíêöèÿ âîçâðàùàåò ñòðîêó Sql-çàïðîñà, êîòîðàÿ ñîçäàåò â áàçå äàííûõ ñîîòâåòñòâóþùóþ òàáëèöó |
+** |
+** |
+***************************************************************************************/ |
+ |
+ |
+QString SqlTable::sqlString(){ |
+ return SqlTable::SqlString; |
+ |
+} |
+ |
+ |
+void SqlTable::append(TableField* newfield){ // äîáàâëÿåò â êîíåö ñïèñêà (óêàçàòåëåé) ïîëåé òàáëèöû íîàîå ïîëå, ïåðåäàâàåìîå ÷åðåç ïàðàìåòð newfield (óêàçàòåëü) |
+ SqlTable::tableFields.append(newfield); |
+ SqlTable::createSqlString(); |
+} |
Index: trunk/ClassEditor/delegateforclassestable.cpp |
=================================================================== |
--- trunk/ClassEditor/delegateforclassestable.cpp (revision 0) |
+++ trunk/ClassEditor/delegateforclassestable.cpp (revision 257) |
@@ -0,0 +1,112 @@ |
+#include "delegateforclassestable.h" |
+#include <QtGui> |
+ |
+DelegateForClassesTable::DelegateForClassesTable(QObject *parent) : |
+ QItemDelegate(parent) |
+{ |
+ items.append(tr("CHAR(10)")); |
+ items.append(tr("CHAR(30)")); |
+ items.append(tr("TEXT")); |
+ items.append(tr("INT(10)")); |
+ items.append(tr("DATE")); |
+ items.append(tr("BLOB")); |
+ items.append(tr("MEDIUMBLOB")); |
+ items.append(tr("BOOL")); |
+ |
+ |
+} |
+QWidget *DelegateForClassesTable::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex &/* index */) const |
+{ |
+ //QSpinBox *editor = new QSpinBox(parent); |
+ //editor->setMinimum(0); |
+ //editor->setMaximum(100); |
+ QComboBox *editor = new QComboBox(parent); |
+ editor->addItems(items); |
+ |
+ /* |
+ editor->addItem("0"); |
+ editor->addItem("1"); |
+ editor->addItem("2"); |
+ editor->addItem("3"); |
+ editor->addItem("4"); |
+ editor->addItem("5"); |
+ editor->addItem("6"); |
+ editor->addItem("7"); |
+ editor->addItem("8"); |
+ editor->addItem("9"); |
+ // editor->addItem("0"); |
+ */ |
+ |
+ return editor; |
+} |
+//! [1] |
+ |
+//! [2] |
+void DelegateForClassesTable::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+{ |
+ // int value = index.model()->data(index, Qt::EditRole).toInt(); |
+ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->setValue(value); |
+QString value = index.model()->data(index, Qt::EditRole).toString(); |
+QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+int curr_index = items.indexOf(value); |
+if (curr_index!= -1) comboBox->setCurrentIndex(curr_index); |
+else { |
+ |
+} |
+/* |
+if (value == "0") comboBox->setCurrentIndex(0); |
+if (value == "1") comboBox->setCurrentIndex(1); |
+if (value == "2") comboBox->setCurrentIndex(2); |
+if (value == "3") comboBox->setCurrentIndex(3); |
+if (value == "4") comboBox->setCurrentIndex(4); |
+if (value == "5") comboBox->setCurrentIndex(5); |
+if (value == "6") comboBox->setCurrentIndex(6); |
+if (value == "7") comboBox->setCurrentIndex(7); |
+if (value == "8") comboBox->setCurrentIndex(8); |
+if (value == "9") comboBox->setCurrentIndex(9); |
+*/ |
+comboBox->setEditable(false); |
+ |
+ |
+//comboBox->setItemText(0, value); |
+ |
+} |
+//! [2] |
+ |
+//! [3] |
+void DelegateForClassesTable::setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const |
+{ |
+ // QSpinBox *spinBox = static_cast<QSpinBox*>(editor); |
+ // spinBox->interpretText(); |
+ // int value = spinBox->value(); |
+ |
+ // model->setData(index, value, Qt::EditRole); |
+ |
+ QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ int currIndex; |
+ currIndex = comboBox->currentIndex(); |
+ QString value = comboBox->itemText(currIndex); |
+ model->setData(index, value, Qt::EditRole); |
+} |
+//! [3] |
+ |
+//! [4] |
+void DelegateForClassesTable::updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &/* index */) const |
+{ |
+ editor->setGeometry(option.rect); |
+} |
+//! [4] |
+ |
+ |
+void DelegateForClassesTable::setItems(QStringList new_items){ |
+ |
+ DelegateForClassesTable::items = new_items; |
+ |
+} |
Index: trunk/ClassEditor/iconform.ui |
=================================================================== |
--- trunk/ClassEditor/iconform.ui (revision 0) |
+++ trunk/ClassEditor/iconform.ui (revision 257) |
@@ -0,0 +1,74 @@ |
+<?xml version="1.0" encoding="UTF-8"?> |
+<ui version="4.0"> |
+ <class>IconForm</class> |
+ <widget class="QWidget" name="IconForm"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>133</width> |
+ <height>69</height> |
+ </rect> |
+ </property> |
+ <property name="windowTitle"> |
+ <string>Form</string> |
+ </property> |
+ <property name="autoFillBackground"> |
+ <bool>true</bool> |
+ </property> |
+ <widget class="QPushButton" name="pushButton"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>0</x> |
+ <y>0</y> |
+ <width>31</width> |
+ <height>31</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="icon"> |
+ <iconset resource="pic.qrc"> |
+ <normaloff>:/Open.png</normaloff>:/Open.png</iconset> |
+ </property> |
+ </widget> |
+ <widget class="QPushButton" name="pushButton_2"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>30</x> |
+ <y>0</y> |
+ <width>31</width> |
+ <height>30</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="icon"> |
+ <iconset resource="pic.qrc"> |
+ <normaloff>:/Delete.png</normaloff>:/Delete.png</iconset> |
+ </property> |
+ </widget> |
+ <widget class="QLabel" name="label"> |
+ <property name="geometry"> |
+ <rect> |
+ <x>60</x> |
+ <y>0</y> |
+ <width>71</width> |
+ <height>71</height> |
+ </rect> |
+ </property> |
+ <property name="text"> |
+ <string/> |
+ </property> |
+ <property name="pixmap"> |
+ <pixmap>pc.png</pixmap> |
+ </property> |
+ </widget> |
+ </widget> |
+ <resources> |
+ <include location="pic.qrc"/> |
+ </resources> |
+ <connections/> |
+</ui> |
Index: trunk/ClassEditor/delegate.cpp |
=================================================================== |
--- trunk/ClassEditor/delegate.cpp (revision 0) |
+++ trunk/ClassEditor/delegate.cpp (revision 257) |
@@ -0,0 +1,442 @@ |
+ |
+/**************************************************************************** |
+** |
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
+** All rights reserved. |
+** Contact: Nokia Corporation (qt-info@nokia.com) |
+** |
+** This file is part of the examples of the Qt Toolkit. |
+** |
+** $QT_BEGIN_LICENSE:LGPL$ |
+** Commercial Usage |
+** Licensees holding valid Qt Commercial licenses may use this file in |
+** accordance with the Qt Commercial License Agreement provided with the |
+** Software or, alternatively, in accordance with the terms contained in |
+** a written agreement between you and Nokia. |
+** |
+** GNU Lesser General Public License Usage |
+** Alternatively, this file may be used under the terms of the GNU Lesser |
+** General Public License version 2.1 as published by the Free Software |
+** Foundation and appearing in the file LICENSE.LGPL included in the |
+** packaging of this file. Please review the following information to |
+** ensure the GNU Lesser General Public License version 2.1 requirements |
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
+** |
+** In addition, as a special exception, Nokia gives you certain additional |
+** rights. These rights are described in the Nokia Qt LGPL Exception |
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
+** |
+** GNU General Public License Usage |
+** Alternatively, this file may be used under the terms of the GNU |
+** General Public License version 3.0 as published by the Free Software |
+** Foundation and appearing in the file LICENSE.GPL included in the |
+** packaging of this file. Please review the following information to |
+** ensure the GNU General Public License version 3.0 requirements will be |
+** met: http://www.gnu.org/copyleft/gpl.html. |
+** |
+** If you have questions regarding the use of this file, please contact |
+** Nokia at qt-info@nokia.com. |
+** $QT_END_LICENSE$ |
+** |
+****************************************************************************/ |
+ |
+/* |
+ delegate.cpp |
+ |
+ A delegate that allows the user to change integer values from the model |
+ using a spin box widget. |
+*/ |
+ |
+#include <QtGui> |
+ |
+#include "delegate.h" |
+ |
+ |
+//! [0] |
+SpinBoxDelegate::SpinBoxDelegate(QObject *parent) |
+ : QItemDelegate(parent) |
+{ |
+ // SpinBoxDelegate::getItems(); |
+} |
+//! [0] |
+ |
+//! [1] |
+QWidget *SpinBoxDelegate::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex &/* index */) const |
+{ |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ |
+ // getItems(); |
+ |
+ |
+ |
+ |
+ |
+ ID_list = items.keys(); |
+ Name_list = items.values(); |
+ |
+ QComboBox *editor = new QComboBox(parent); |
+ |
+/* |
+ editor->addItem("0"); |
+ editor->addItem("1"); |
+ editor->addItem("2"); |
+ editor->addItem("3"); |
+ editor->addItem("4"); |
+ editor->addItem("5"); |
+ editor->addItem("6"); |
+ editor->addItem("7"); |
+ editor->addItem("8"); |
+ editor->addItem("9"); |
+*/ |
+ |
+// editor->addItem("0"); |
+ |
+ editor->addItems(Name_list); |
+ return editor; |
+} |
+//! [1] |
+ |
+//! [2] |
+void SpinBoxDelegate::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+{ |
+ QString value = index.model()->data(index, Qt::EditRole).toString(); |
+ QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ int curr_index; |
+ |
+ ID_list = items.keys(); |
+ Name_list = items.values(); |
+ |
+ curr_index = ID_list.indexOf(value); |
+ comboBox->setCurrentIndex(curr_index); |
+ /**************************************************** |
+ if (value == "0") comboBox->setCurrentIndex(0); |
+ if (value == "1") comboBox->setCurrentIndex(1); |
+ if (value == "2") comboBox->setCurrentIndex(2); |
+ if (value == "3") comboBox->setCurrentIndex(3); |
+ if (value == "4") comboBox->setCurrentIndex(4); |
+ if (value == "5") comboBox->setCurrentIndex(5); |
+ if (value == "6") comboBox->setCurrentIndex(6); |
+ if (value == "7") comboBox->setCurrentIndex(7); |
+ if (value == "8") comboBox->setCurrentIndex(8); |
+ if (value == "9") comboBox->setCurrentIndex(9); |
+ ******************************************************/ |
+ comboBox->setEditable(true); |
+ |
+ |
+//comboBox->setItemText(0, value); |
+ |
+} |
+//! [2] |
+ |
+//! [3] |
+void SpinBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, |
+ const QModelIndex &index) const |
+{ |
+ QStringList ID_list; |
+ QStringList Name_list; |
+ |
+ QComboBox *comboBox = static_cast<QComboBox*>(editor); |
+ int currIndex; |
+ currIndex = comboBox->currentIndex(); |
+ // QString value = comboBox->itemText(currIndex); |
+ |
+ ID_list = items.keys(); |
+ Name_list = items.values(); |
+ |
+ QString value = ID_list.at(currIndex); |
+ model->setData(index, value, Qt::EditRole); |
+ |
+ |
+} |
+//! [3] |
+ |
+//! [4] |
+void SpinBoxDelegate::updateEditorGeometry(QWidget *editor, |
+ const QStyleOptionViewItem &option, const QModelIndex &/* index */) const |
+{ |
+ editor->setGeometry(option.rect); |
+} |
+//! [4] |
+ |
+void SpinBoxDelegate::getItems(){ |
+ QMap <QString, QString> result_map; |
+ QSqlQuery q; |
+ QString query_str; |
+ bool ok; |
+ |
+ query_str = tr("select * from `ListOfClasses`"); |
+ q.prepare(query_str); |
+ |
+ |
+ ok = q.exec(); |
+ |
+ |
+ |
+ |
+ if (!ok) { |
+ /* |
+ QString error_str; |
+ error_str = tr("íå óäàëîñü ïîëó÷èòü ñïèñîê îáúåêòîâ èç òàáëèöû "); |
+ error_str.append(inctance); |
+ QMessageBox::critical( // Äèàëîã ñ ñîîáùåíèåì îá îøèáêå. |
+ this, // Ðîäèòåëüñêèé âèäæåò. |
+ QObject::tr("Database Error"), // Çàãîëîâîê. |
+ q.lastError().text()); // Òåêñò ñîîáùåíèÿ. |
+ // tr("íå óäàëîñü ïîëó÷èòü ñïèñîê îáúåêòîâ èç òàáëèöû ")); // Òåêñò ñîîáùåíèÿ. |
+ |
+ */ |
+ items.clear(); |
+ return; |
+ } |
+ |
+ |
+ // field_inctance = q.record().indexOf(tr("TableWhithInstance")); |
+ items.clear(); |
+ while(q.next()){ |
+ |
+ QString ID; |
+ QString ClassName; |
+ ID = q.value(0).toString(); // îïðåäåëÿåì ID |
+ ClassName = q.value(1).toString(); // îïðåäåëÿåì Name |
+ items.insert(ID, ClassName); |
+ } |
+ |
+ |
+ // return result_map; |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+MyDEDelegate::MyDEDelegate( |
+ bool calpopup, |
+ QObject *parent) |
+ : QItemDelegate(parent), |
+ m_calpopup(calpopup) { |
+ } |
+ |
+ QWidget *MyDEDelegate::createEditor( |
+ QWidget *parent, |
+ const QStyleOptionViewItem& /* option */, |
+ const QModelIndex& /* index */) const { |
+ QDateEdit *editor = new QDateEdit(parent); |
+ editor->setCalendarPopup(m_calpopup); |
+ editor->installEventFilter(const_cast<MyDEDelegate*>(this)); |
+ return editor; |
+ } |
+ |
+ void MyDEDelegate::setEditorData( |
+ QWidget *editor, |
+ const QModelIndex &index) const { |
+ QDate value = index.model()->data( |
+ index, Qt::EditRole).toDate(); |
+ QDateEdit *de = static_cast<QDateEdit*>(editor); |
+ de->setDate(value); |
+ } |
+ |
+ void MyDEDelegate::setModelData( |
+ QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex& index) const { |
+ QDateEdit *de = static_cast<QDateEdit*>(editor); |
+ de->interpretText(); |
+ QDate value = de->date(); |
+ model->setData(index, value); |
+ } |
+ |
+ void MyDEDelegate::updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex& /* index */) const { |
+ editor->setGeometry(option.rect); |
+ } |
+ |
+ |
+ |
+ CPictureDelegate::CPictureDelegate( QObject * parent ) : QItemDelegate(parent) |
+ { |
+ } |
+ |
+ |
+ |
+ |
+ |
+ QWidget *CPictureDelegate::createEditor(QWidget *parent, |
+ const QStyleOptionViewItem &/* option */, |
+ const QModelIndex &/* index */) const |
+ { |
+ |
+ IconForm *editor = new IconForm(parent); |
+ return editor; |
+ |
+ } |
+ |
+ |
+ |
+ |
+ void CPictureDelegate::setEditorData(QWidget *editor, |
+ const QModelIndex &index) const |
+ { |
+ |
+ |
+ const QAbstractItemModel * model = index.model(); |
+ IconForm *icnFrm = static_cast<IconForm*>(editor); |
+ QVariant currentImage = model->data(index,0); |
+ QByteArray bytes = currentImage.toByteArray(); |
+ if (currentImage.isValid()) { |
+ m_pxPicture.loadFromData(bytes); |
+ } |
+ else { |
+ //QItemDelegate::paint(painter, option, index); |
+ |
+ |
+ return; |
+ } |
+ icnFrm->setPixmap(m_pxPicture); |
+ } |
+ |
+ |
+ |
+ |
+ void CPictureDelegate::setModelData( |
+ QWidget *editor, |
+ QAbstractItemModel *model, |
+ const QModelIndex& index) const { |
+ IconForm *icnFrm = static_cast<IconForm*>(editor); |
+ if (!(icnFrm->dataIsChanged())) return; |
+ |
+ if (!(icnFrm->pixmap().isNull())){ // åñëè íå óäàëèëè èêîíêó |
+ m_pxPicture = icnFrm->pixmap(); |
+ QImage currentImage = m_pxPicture.toImage(); |
+ QByteArray bytes; |
+ QBuffer buffer(&bytes); |
+ buffer.open(QIODevice::WriteOnly); |
+ currentImage.save(&buffer, "PNG"); |
+ |
+ |
+ |
+ |
+ model->setData(index, QVariant (bytes), Qt::EditRole); |
+ |
+ // int widht = m_pxPicture.width(); |
+ // int heigh = m_pxPicture.height(); |
+ // tblView->setRowHeight(index.row(), heigh + 10); |
+ // model->submitAll(); |
+ } |
+ else { // èêîíêó óäàëèëè |
+ QVariant val_null; |
+ model->setData(index, val_null, Qt::EditRole); |
+ } |
+ |
+ |
+ // model->setData(index, value); |
+ } |
+ |
+ |
+ |
+ void CPictureDelegate::updateEditorGeometry( |
+ QWidget *editor, |
+ const QStyleOptionViewItem &option, |
+ const QModelIndex& /* index */) const { |
+ |
+ |
+ // QRect r(option.rect.x() + option.rect.width()/2 - 7, option.rect.y() + option.rect.height()/2 - 7, 150, 100); |
+ // editor->setGeometry(r); |
+ |
+ editor->setGeometry(option.rect); |
+ } |
+ |
+ |
+ |
+ |
+ void CPictureDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const |
+ { |
+ |
+ |
+ m_pxPicture.fill( QColor(Qt::white) ); |
+ |
+ const QAbstractItemModel * model = index.model(); |
+ QString sFileName = model->data( index, Qt::DisplayRole ).toString(); |
+ |
+ QVariant currentImage = model->data(index,0); |
+ |
+ QByteArray bytes = currentImage.toByteArray(); |
+ // QImage image; |
+ // image.loadFromData(bytes); |
+ |
+ |
+ if (currentImage.isValid()) { |
+ m_pxPicture.loadFromData(bytes); |
+ |
+ } |
+ else { |
+ int i; |
+ i++; |
+ //QItemDelegate::paint(painter, option, index); |
+ return; |
+ } |
+ |
+ |
+ |
+ |
+ |
+ /* |
+ |
+ if ( !sFileName.isEmpty() ) |
+ m_pxPicture.load( sFileName ); |
+ else { |
+ //QItemDelegate::paint(painter, option, index); |
+ return; |
+ } |
+*/ |
+ |
+ |
+ QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ? |
+ ((option.state & QStyle::State_Active) ? QPalette::Normal : QPalette::Inactive ) : |
+ QPalette::Disabled; |
+ |
+ if (option.state & QStyle::State_Selected) |
+ |
+ |
+ painter->fillRect(option.rect, option.palette.color(cg, QPalette::Highlight)); |
+ |
+ int nX = option.rect.x() + ( ( option.rect.width() - m_pxPicture.rect().width() ) / 2 ); |
+ int nY = option.rect.y() + ( ( option.rect.height() - m_pxPicture.rect().height() ) / 2 ); |
+ painter->drawPixmap( nX, nY, m_pxPicture ); |
+ |
+ |
+ // drawFocus(painter, option, option.rect.adjusted(0, 0, -1, -1)); // since we draw the grid ourselves |
+ |
+ /* |
+ QPen pen = painter->pen(); |
+ painter->setPen(option.palette.color(QPalette::Mid)); |
+ painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight()); |
+ painter->drawLine(option.rect.topRight(), option.rect.bottomRight()); |
+ painter->setPen(pen); |
+ */ |
+} |
+ |
+ |
+ void CPictureDelegate::setTableView(QTableView* table){ |
+ tblView = table; |
+ } |
Index: trunk/ClassEditor/mymodel.h |
=================================================================== |
--- trunk/ClassEditor/mymodel.h (revision 0) |
+++ trunk/ClassEditor/mymodel.h (revision 257) |
@@ -0,0 +1,27 @@ |
+#ifndef MYMODEL_H |
+#define MYMODEL_H |
+ |
+#include <QObject> |
+#include <QtGui> |
+#include <QSqlQueryModel> |
+#include <QSqlTableModel> |
+#include <QFileIconProvider> |
+class MyModel : public QSqlTableModel { |
+Q_OBJECT |
+public: |
+ explicit MyModel(QObject *parent = 0); |
+ Qt::ItemFlags flags(const QModelIndex &index) const; |
+ bool setData(const QModelIndex &, const QVariant &, int); |
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
+private: |
+ QFileIconProvider iconProvider; |
+ |
+signals: |
+ |
+ |
+public slots: |
+ |
+ |
+}; |
+ |
+#endif // MYMODEL_H |
Index: trunk/ClassEditor/iconform.cpp |
=================================================================== |
--- trunk/ClassEditor/iconform.cpp (revision 0) |
+++ trunk/ClassEditor/iconform.cpp (revision 257) |
@@ -0,0 +1,75 @@ |
+#include "iconform.h" |
+#include "ui_iconform.h" |
+#include "classeditor.h" |
+ |
+ |
+IconForm::IconForm(QWidget *parent) : |
+ QWidget(parent), |
+ ui(new Ui::IconForm) |
+{ |
+ ui->setupUi(this); |
+ IconForm::fdataIsChanged = false; |
+} |
+ |
+IconForm::~IconForm() |
+{ |
+ delete ui; |
+} |
+ |
+void IconForm::changeEvent(QEvent *e) |
+{ |
+ QWidget::changeEvent(e); |
+ switch (e->type()) { |
+ case QEvent::LanguageChange: |
+ ui->retranslateUi(this); |
+ break; |
+ default: |
+ break; |
+ } |
+} |
+ |
+ |
+void IconForm::on_pushButton_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ïîìåíÿòü èêîíêó" |
+ |
+ QString fileName; |
+ fileName = QFileDialog::getOpenFileName(this, |
+ tr("Open Image"), "", tr("Image Files (*.png *.jpg *.bmp)")); |
+ |
+ if (fileName.isEmpty()) return; |
+ Pixmap.load(fileName); |
+ |
+ ui->label->setPixmap(Pixmap); |
+ IconForm::fdataIsChanged = true; |
+// IconForm::close(); |
+} |
+ |
+void IconForm::on_pushButton_2_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü èêîíêó" |
+ |
+ QPixmap pix_tmp; |
+ Pixmap = pix_tmp; |
+ ui->label->setPixmap(Pixmap); |
+ IconForm::fdataIsChanged = true; |
+ |
+ } |
+ |
+ |
+ |
+ |
+void IconForm::setPixmap (QPixmap newPixmap){ |
+Pixmap = newPixmap; |
+ ui->label->setPixmap(Pixmap); |
+ |
+} |
+ |
+ |
+QPixmap IconForm::pixmap (){ |
+ return Pixmap; |
+} |
+ |
+ |
+bool IconForm::dataIsChanged(){ |
+ return IconForm::fdataIsChanged; |
+} |
+ |
+ |
+// void IconForm::clearPixmap(){} |
Index: trunk/ClassEditor/classeditor.h |
=================================================================== |
--- trunk/ClassEditor/classeditor.h (revision 0) |
+++ trunk/ClassEditor/classeditor.h (revision 257) |
@@ -0,0 +1,120 @@ |
+#ifndef CLASSEDITOR_H |
+#define CLASSEDITOR_H |
+ |
+#include <QMainWindow> |
+#include "mysql.h" |
+#include "mymodel.h" |
+#include "modelfordescriptiontable.h" |
+#include "delegateforclassestable.h" |
+#include "modelforpointers.h" |
+#include "delegate.h" |
+#include "settingform.h" |
+ |
+#include <QTreeView> |
+#include <QFileDialog> |
+ |
+ |
+namespace Ui { |
+ class ClassEditor; |
+} |
+ |
+class ClassEditor : public QMainWindow { |
+ Q_OBJECT |
+public: |
+ ClassEditor(QWidget *parent = 0); |
+ ~ClassEditor(); |
+ |
+protected: |
+ void changeEvent(QEvent *e); |
+ |
+private: |
+ Ui::ClassEditor *ui; |
+ |
+ settingForm setFrm; |
+ IconForm iconFrm; |
+ |
+ QString baseName; |
+ QString hostName; |
+ QString userName; |
+ QString password; |
+ QString tableName; |
+ |
+ void readSettings(); |
+ void writeSettings(); |
+ |
+ |
+ |
+ MySql sql; |
+ SettingsDialog settdialog; |
+ TableField *field; |
+ SqlTable *table; |
+ QModelIndex currIndexOfClassesTable; // ïåðåìåííàÿ õðàíèò òåêóùèé èíäåêñ òàáëèöû êëàññîâ |
+ QString currClassID; // òåêóùèé èäåíòèôèêàòîð êëàññà |
+ QString currInctanceTable; // èìÿ òàáëèöû-õðàíèëèùà îáúåêòîâ äëÿ âûáðàííîãî êëàññà |
+ |
+ QSqlTableModel* model; |
+ |
+ |
+ // QSqlTableModel* modelForPointers; // ìîäåëü äëÿ òàáëèöû ñ óêàçàòåëÿìè |
+ ModelForPointers* modelForPointers; // ìîäåëü äëÿ òàáëèöû ñ óêàçàòåëÿìè |
+ |
+ // QSqlTableModel* modelForDescription; |
+ ModelForDescriptionTable* modelForDescription; |
+ |
+ QSqlTableModel* Inctance_model; |
+ |
+ QTableView* tableForDescription; |
+ MyModel* mymodel; |
+ |
+ QTableView* tableForInstance; // çäåñü áóäåì îòîáðàæàòü òàáëèöó-õðàíèëèùå îáúåêòîà êëàññà |
+ QTableView tableForInstance_new; // çäåñü áóäåì îòîáðàæàòü òàáëèöó-õðàíèëèùå îáúåêòîà êëàññà |
+ |
+ DelegateForClassesTable classTableDelegate; |
+ SpinBoxDelegate delegateForDefaultValueColomn; |
+ |
+ |
+ // void addNewClass(); // äîáàâèì íîâûé êëàññ |
+ void addNewClass_new(); |
+ void addNewField(); // äîáàâëÿåì íîâîå ïîëå ê êëàññó |
+ void addNewPointer();//äîáîâëÿåì íîâîå ïîëå, ãäå áóäóò õðàíèòüñÿ óêàçàòåëè íà îáúåêòû êëàññà-êîíòåéíåðà |
+ void refreshInctance(); // îáíîâèì ìîäåëü òàáëèöû-õðàíèëèùà |
+ void initDataBase(); // íàñòðîéêà ïàðàìåòðîâ ñîåäèíåíèÿ è óñòàíîâêà ñîåäèíåíèÿ |
+ void createMainTables();// ñîçäàåì ñòðóêòóðó áàçû äàííûõ - òàáëèöû DescriptionOfClasses è ListOfClasses |
+ void initClassListTable(); // íàñòðàèâàåì òàáëèöó äëÿ îòîáðàæåíèÿ ñïèñêà ñóùåñòâóþùèõ êëàññîâ |
+ void initFieldsTable(); // íàñòðàèâàåì òàáëèöó äëÿ îòîáðàæåíèÿ ñïèñêà ïîëåé êëàññà |
+ void initPointersTable(); // íàñòðàèâàåì òàáëèöó äëÿ îòîáðàæåíèÿ ñïèñêà ïîëåé-óêàçàòåëåé êëàññà |
+ |
+private slots: |
+ |
+ void on_pushButton_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâûé êëàññ" |
+ void on_pushButton_2_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü êëàññ" |
+ void on_pushButton_3_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
+ void on_pushButton_4_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
+ void on_pushButton_5_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âñå ïîëÿ" |
+ void on_pushButton_6_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâûé óêàçàòåëü" |
+ void on_pushButton_7_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âûäåëåííûå óêàçàòåëè" |
+ void on_pushButton_8_clicked(); // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü âñå óêàçàòåëè" |
+ |
+ |
+ void on_action_ID_triggered(bool is_checked); // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ID" |
+ void on_action_showAlias_triggered(bool is_checked); // îáðàáàòûâàåì âûáîð â ìåíþ "Ïîêàçûâàòü ïñåâäîíèì" |
+ void on_action_showInstance_triggered(bool is_checked); // ... ïîêàçûâàòü õðàíèëèùà îáúåêòîâ |
+ |
+ void on_tableView_clicked(const QModelIndex & index ); |
+ void on_myModel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); |
+ void on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); |
+ void on_action_removeAllClasses(); // óäàëèòü âñå êëàññû |
+ void on_action_removeSelectedPointers(); // óäàëèòü âûäåëåííûå óêàçàòåëè |
+ |
+ void removeClass(int class_row); // ôóíêöèÿ óäàëÿåò êëàññ, íàõîäÿùèéñÿ â ñòðîêå ñ íîìåðîì class_row |
+ void on_field_changed(); // ïîìåíÿëîñü èìÿ ïîëÿ |
+ void on_action_newPointer(); // äîáàâèòü íîâûé óêàçàòåëü íà êëàññ-êîíòåéíåð |
+ |
+ void applySetting(); |
+ void getSetting(); // îòêðîåì îêíî íàñòðîåê |
+ |
+ |
+ |
+}; |
+ |
+#endif // CLASSEDITOR_H |
Index: trunk/ClassEditor/modelfordescriptiontable.cpp |
=================================================================== |
--- trunk/ClassEditor/modelfordescriptiontable.cpp (revision 0) |
+++ trunk/ClassEditor/modelfordescriptiontable.cpp (revision 257) |
@@ -0,0 +1,205 @@ |
+#include "modelfordescriptiontable.h" |
+ |
+ModelForDescriptionTable::ModelForDescriptionTable(QObject *parent) : |
+ QSqlTableModel(parent) |
+{ |
+ setEditStrategy(QSqlTableModel::OnManualSubmit); |
+} |
+ |
+Qt::ItemFlags ModelForDescriptionTable::flags( |
+ const QModelIndex &index) const { |
+Qt::ItemFlags flags = QSqlTableModel::flags(index); |
+if ((index.column() != 5) && (index.column() != 0)) |
+ flags |= Qt::ItemIsEditable; |
+//if (index.column() == 4) |
+// flags |= Qt::ItemIsUserCheckable; |
+else |
+{ |
+ if ((index.column() == 0) || (index.column() == 5)) flags &= ~Qt::ItemIsEditable; // çàïðåùàåì ðåäàêòèðîâàíèå òðåòüåãî ñòîëáöà |
+} |
+ return flags; |
+} |
+ |
+ |
+bool ModelForDescriptionTable::setData(const QModelIndex &index, const QVariant &value, int role) { |
+ //// if (index.column()==3) return false; // â òðåòüåé êîëîíêå íå äàåì ïîìåíÿòü çíà÷åíèå |
+ bool lResult = false; |
+ QVariant old_value; // ñîõðàíèì ñòàðîå çíà÷åíèå |
+ old_value = data(index); |
+ |
+ |
+ if (index.column()==1){ // åñëè ïîìåíÿëîñü èìÿ ïîëÿ |
+ QSqlQuery qu; |
+ QString old_field_name; // ñòàðîå èìÿ ïîëÿ |
+ QString new_field_name; // íîâîå èìÿ ïîëÿ |
+ QString query_str; |
+ QString type_str; // òèï äàííûõ ïîëÿ |
+ old_field_name = old_value.toString(); // îïðåäåëèì òåêóùåå (êîòîðîå íóæíî ïîìåíÿòü) èìÿ ïîëÿ |
+ new_field_name = value.toString(); |
+ type_str = data(ModelForDescriptionTable::index(index.row(), 3)).toString(); // òèï ïîëÿ õðàíèòüñÿ â 3 ñòîëáöå, ñ÷èòûâàåì åãî çíà÷åíèå |
+ query_str = tr("ALTER TABLE "); |
+ query_str.append(ModelForDescriptionTable::Inctance); |
+ query_str.append(tr(" CHANGE COLUMN `")); |
+ query_str.append(old_field_name); |
+ query_str.append(tr("` `")); |
+ query_str.append(new_field_name); |
+ query_str.append(tr("` ")); |
+ query_str.append(type_str); |
+ query_str.append(tr(" CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT NULL")); |
+ qu.prepare(query_str); |
+ bool ok; |
+ ok = qu.exec(); |
+ if (!ok) return false; |
+ } |
+ |
+ |
+ if (index.column()==3){ // åñëè ïîìåíÿëñÿ òèï äàííûõ |
+///ALTER TABLE `an_db`.`1_Inctance` MODIFY COLUMN `int` INTEGER; |
+ |
+ bool ok; |
+ ok = QSqlTableModel::setData(ModelForDescriptionTable::index(index.row(), 4), QVariant(tr("NULL")), Qt::EditRole); // ñáðîñèì çíà÷åíèå ïî óìîë÷àíèþ |
+ if (ok) { |
+ |
+ |
+ QSqlQuery qu; |
+ QString old_type, new_type, field_name, query_str; |
+ old_type = old_value.toString(); // îïðåäåëèì òåêóùèé (êîòîðîå íóæíî ïîìåíÿòü) òèï ïîëÿ |
+ new_type = value.toString(); // íîâûé òèï ïîëÿ |
+ field_name = data(ModelForDescriptionTable::index(index.row(), 1)).toString(); // èìÿ ïîëÿ õðàíèòüñÿ â 1 ñòîëáöå, ñ÷èòûâàåì åãî çíà÷åíèå |
+ query_str = tr("ALTER TABLE "); |
+ query_str.append(ModelForDescriptionTable::Inctance); |
+ query_str.append(tr(" MODIFY COLUMN `")); |
+ query_str.append(field_name); |
+ query_str.append(tr("` ")); |
+ query_str.append(new_type); |
+ qu.prepare(query_str); |
+ |
+ ok = qu.exec(); |
+ if (!ok) return false; |
+ } |
+ else return false; |
+ } |
+ |
+ if (index.column()==4){ // åñëè ïîìåíÿëîñü çíà÷åíèå ïî óìîë÷àíèþ |
+///ALTER TABLE `an_db`.`2_Inctance` MODIFY COLUMN `Îò÷åñòâî` CHAR(10) CHARACTER SET cp1251 COLLATE cp1251_general_ci DEFAULT 'Èâàíîâè÷'; |
+ QSqlQuery qu; |
+ QString field_type, new_default_value, field_name, query_str; |
+ |
+ field_type = data(ModelForDescriptionTable::index(index.row(), 3)).toString(); // òèï ïîëÿ õðàíèòüñÿ â 3 ñòîëáöå, ñ÷èòûâàåì åãî çíà÷åíèå |
+ field_name = data(ModelForDescriptionTable::index(index.row(), 1)).toString(); // èìÿ ïîëÿ õðàíèòüñÿ â 1 ñòîëáöå, ñ÷èòûâàåì åãî çíà÷åíèå |
+ new_default_value = value.toString(); |
+ query_str = tr("ALTER TABLE "); |
+ query_str.append(ModelForDescriptionTable::Inctance); |
+ query_str.append(tr(" MODIFY COLUMN `")); |
+ query_str.append(field_name); |
+ query_str.append(tr("` ")); |
+ query_str.append(field_type); |
+ |
+ if (new_default_value != tr("NULL")) { |
+ query_str.append(tr(" DEFAULT '")); |
+ |
+ |
+ query_str.append(new_default_value); |
+ query_str.append(tr("'")); } |
+ else { |
+ query_str.append(tr(" DEFAULT ")); // Åñëè íàäî çàäàòü çíà÷åíèå NULL òî àïîñòðîôû íå ñòàâèì |
+ query_str.append(new_default_value); |
+ } |
+ qu.prepare(query_str); |
+ bool ok; |
+ ok = qu.exec(); |
+ if (!ok) return false; |
+ |
+ } |
+ |
+ |
+ QSqlRecord rec = record(index.row()); |
+ rec.setValue(index.column(), value); |
+ rec.setGenerated(index.column(), true); |
+ |
+ |
+ lResult = QSqlTableModel::setData(index, value, role); |
+ if (lResult) { |
+ lResult = updateRowInTable(index.row(), rec); |
+ emit field_changed(); |
+ /// QSqlTableModel::setData(newindex, QVariant(str_tmp), Qt::EditRole); |
+ } |
+ |
+ |
+ |
+ |
+ return lResult; |
+} |
+ |
+ |
+ |
+ |
+bool ModelForDescriptionTable::onlySetData(const QModelIndex &index, const QVariant &value, int role){ |
+ bool lResult = false; |
+ |
+ QSqlRecord rec = record(index.row()); |
+ rec.setValue(index.column(), value); |
+ rec.setGenerated(index.column(), true); |
+ |
+ |
+ lResult = QSqlTableModel::setData(index, value, role); |
+ if (lResult) { |
+ lResult = updateRowInTable(index.row(), rec); |
+ // emit field_changed(); |
+/// QSqlTableModel::setData(newindex, QVariant(str_tmp), Qt::EditRole); |
+ } |
+ |
+ |
+ |
+ |
+ return lResult; |
+ |
+} |
+ |
+ |
+ |
+ |
+ |
+QVariant ModelForDescriptionTable::data(const QModelIndex &index, int role) const { |
+ |
+ QVariant value = QSqlTableModel::data(index, role); |
+ switch (role) { |
+ case Qt::DisplayRole: return value; |
+ case Qt::EditRole: return value; |
+ case Qt::TextColorRole: |
+ if(index.column() == 1) |
+ return qVariantFromValue(QColor(Qt::darkGreen)); |
+ else |
+ return value; |
+ case Qt::TextAlignmentRole: return value; |
+ case Qt::FontRole: |
+ if(index.column() == 1) { |
+ QFont font = QFont("Helvetica", 16, QFont::Bold); |
+ return qVariantFromValue(font); |
+ }else |
+ return value; |
+ |
+ case Qt::BackgroundColorRole: { |
+ int a = (index.row() % 2) ? 14 : 0; |
+ if(index.column() == 2) |
+ return qVariantFromValue(QColor(220,240-a,230-a)); |
+ else if(index.column() == 6) |
+ return qVariantFromValue(QColor(200,220-a,255-a)); |
+ else |
+ return value; |
+ } |
+ |
+ |
+ |
+ case Qt::CheckStateRole: return value; |
+ |
+ case Qt::SizeHintRole:return value; |
+ |
+ } |
+ return value; |
+} |
+ |
+ |
+void ModelForDescriptionTable::setInctance(QString currInctatce){ // ïåðåäàåì èìÿ òåêóùåé òàáëèöû-õðàíèëèùà |
+ ModelForDescriptionTable::Inctance = currInctatce; |
+} |
Index: trunk/ClassEditor/main.cpp |
=================================================================== |
--- trunk/ClassEditor/main.cpp (revision 0) |
+++ trunk/ClassEditor/main.cpp (revision 257) |
@@ -0,0 +1,14 @@ |
+#include <QtGui/QApplication> |
+#include "classeditor.h" |
+ |
+int main(int argc, char *argv[]) |
+{ |
+ QTextCodec *codec = QTextCodec::codecForName("cp1251"); |
+ QTextCodec *codecUTF = QTextCodec::codecForName("utf8"); |
+ QTextCodec::setCodecForTr(codec); |
+ QApplication a(argc, argv); |
+ ClassEditor w; |
+ w.show(); |
+ a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); |
+ return a.exec(); |
+} |