Хранилища Subversion OpenInventory

Редакция

Редакция 241 | Редакция 243 | К новейшей редакции | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
88 pingvin 1
#include "mainwindow.h"
2
#include "ui_mainwindow.h"
3
 
4
MainWindow::MainWindow(QWidget *parent) :
5
    QMainWindow(parent),
6
    ui(new Ui::MainWindow)
7
{
8
    ui->setupUi(this);
222 pingvin 9
/*
10
    QPalette p = this->palette();
11
    p.setBrush(this->backgroundRole(), QBrush(QColor(255,255,255,128)));
12
    this->setAutoFillBackground(true);
13
    this->setPalette(p);
14
*/
15
 
205 pingvin 16
    ui->centralWidget->setLayout(ui->verticalLayout);
17
    ui->tab->setLayout(ui->horizontalLayout);
18
    ui->tab_2->setLayout(ui->horizontalLayout_3);
233 pingvin 19
    ui->tab_3->setLayout(ui->horizontalLayout_7);
237 pingvin 20
    ui->tab_4->setLayout(ui->horizontalLayout_8);
106 pingvin 21
   // connect( ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_currentIndexChanged(int)));
118 pingvin 22
    model_is_build = false;
145 pingvin 23
   // MainWindow::readModel();
89 pingvin 24
 
91 pingvin 25
   //QString model_str;
140 pingvin 26
 
27
 
28
   /*
91 pingvin 29
   MainWindow::creatModelString();
30
   int i;
31
   i++;
93 pingvin 32
    QFile file_tmp("./temp.txt");
92 pingvin 33
    bool ok;
34
    ok = file_tmp.open(QIODevice::ReadWrite | QIODevice::Text);
35
    QTextStream out(&file_tmp);
36
    out << MainWindow::modelString;
37
    file_tmp.close();
140 pingvin 38
*/
174 pingvin 39
 
40
 
41
 
42
 
114 pingvin 43
    ui->treeWidget->setAlternatingRowColors(true);
44
    ui->treeWidget_2->setAlternatingRowColors(true);
132 pingvin 45
 
177 pingvin 46
    ui->treeWidget->setIconSize(QSize(30,30));
209 pingvin 47
    ui->treeWidget->setColumnWidth(0, 400);
193 pingvin 48
    ui->treeWidget_2->setIconSize(QSize(128,128));
132 pingvin 49
 
50
    MainWindow::readSettings();
51
 
93 pingvin 52
    MainWindow::openDataBase();
136 pingvin 53
 
174 pingvin 54
    classesIcons = MainWindow::getClassesIcons(); //    
55
 
104 pingvin 56
    MainWindow::initComboBox();
136 pingvin 57
 
145 pingvin 58
//    MainWindow::buildPreviewModel(tr(" "), tr("11"));
136 pingvin 59
 
142 pingvin 60
    MainWindow::initListModelsTablle();
140 pingvin 61
 
144 pingvin 62
    MainWindow::readModels();
63
 
145 pingvin 64
 //   MainWindow::creatModelString();
140 pingvin 65
    //int i;
66
    //i++;
145 pingvin 67
 
68
    /*
69
    QFile file_tmp("./modelstring.txt");
140 pingvin 70
     bool ok;
71
     file_tmp.remove();
72
     ok = file_tmp.open(QIODevice::ReadWrite | QIODevice::Text);
73
     QTextStream out(&file_tmp);
74
     out.setCodec("cp1251");
75
     out << MainWindow::modelString;
76
     file_tmp.close();
145 pingvin 77
    */
140 pingvin 78
 
79
 
151 pingvin 80
    ui->treeWidget_2->hideColumn(1);
81
    ui->treeWidget_2->hideColumn(2);
82
    ui->treeWidget_2->hideColumn(3);
83
    ui->treeWidget_2->hideColumn(4);
235 pingvin 84
    ui->treeWidget_2->hideColumn(5);
140 pingvin 85
 
151 pingvin 86
 
109 pingvin 87
    getDatabaseData();
127 pingvin 88
    //// sql_mogel = new QSqlTableModel();
89
    sql_mogel = new MyModel();
90
 
223 pingvin 91
    /// filter_model = new MyModel();
92
    filter_model = new QSqlTableModel();
227 pingvin 93
    filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
127 pingvin 94
 
118 pingvin 95
    model_is_build = true;
119 pingvin 96
    connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
146 pingvin 97
    connect(model_for_ListModelsTable, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_model_for_ListModelsTable_dataChanged(QModelIndex,QModelIndex)));
221 pingvin 98
    connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
238 pingvin 99
    connect(&wmiProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readStandartProcessOutput()));
241 pingvin 100
    connect(&wmiProcess, SIGNAL(readyReadStandardError()), this, SLOT(readStandartProcessError()));
146 pingvin 101
 
221 pingvin 102
 
119 pingvin 103
    ui->pushButton_3->setEnabled(false);
104
    ui->pushButton_4->setEnabled(false);
105
 
217 pingvin 106
 
107
    ui->pushButton_9->setEnabled(false);
108
    ui->pushButton_10->setEnabled(false);
109
    ui->pushButton_11->setEnabled(false);
110
    ui->pushButton_12->setEnabled(false);
111
 
132 pingvin 112
   // setFrm.show();
119 pingvin 113
 
212 pingvin 114
    // treeForm.show();
115
 
132 pingvin 116
    connect(ui->getsettingAct, SIGNAL(triggered()), this, SLOT(getSetting())); //       " "  " "
117
    connect(setFrm.pushButton, SIGNAL(clicked()), this, SLOT(applySetting()));
118
 
158 pingvin 119
 //   connect(ui->tableView_2,SIGNAL(activated(QModelIndex)),ui->tableView_2,SLOT(edit(QModelIndex)));
132 pingvin 120
 
158 pingvin 121
    picture_delegate = new CPictureDelegate(this);
189 pingvin 122
    iconDelegate = new IconDelegate(this);
201 pingvin 123
    fileDelegate = new FileDelegate(this);
158 pingvin 124
 
200 pingvin 125
 //   fileForm.show();
196 pingvin 126
 
233 pingvin 127
    doc = ui->textEdit->document();
128
    cursor = new QTextCursor(doc);
129
 //   buildReport(true);
228 pingvin 130
 
241 pingvin 131
    all_reading = false; //     
242 pingvin 132
// wmiThread = new WmiThread(this);
228 pingvin 133
 
88 pingvin 134
}
135
 
136
MainWindow::~MainWindow()
137
{
117 pingvin 138
    delete sql_mogel;
221 pingvin 139
    delete filter_model;
88 pingvin 140
    delete ui;
149 pingvin 141
    delete model_for_ListModelsTable;
88 pingvin 142
}
143
 
144
void MainWindow::changeEvent(QEvent *e)
145
{
146
    QMainWindow::changeEvent(e);
147
    switch (e->type()) {
148
    case QEvent::LanguageChange:
149
        ui->retranslateUi(this);
150
        break;
151
    default:
152
        break;
153
    }
154
}
89 pingvin 155
 
156
 
157
bool MainWindow::readModel(){
158
    bool result;
159
    QString model_str;
140 pingvin 160
    QFile file("modelstring.txt");
141 pingvin 161
  //  QFile file("model.txt");
91 pingvin 162
   rootItem1 = new  QTreeWidgetItem(ui->treeWidget);
89 pingvin 163
    rootItem1->setText(0, tr(" 1"));
164
   // rootItem2 = new  QTreeWidgetItem(rootItem1);
165
   // rootItem2->setText(0, tr(" 2"));
166
    rootItem1->setCheckState(0,Qt::Checked);
167
   // rootItem2->setCheckState(0,Qt::Checked);
168
 
169
 
170
 
171
    result = file.open(QIODevice::ReadOnly);
172
    if (result) {
90 pingvin 173
                     model_str = QString(tr(file.readAll()));
89 pingvin 174
                }
175
 
215 pingvin 176
    setupModelData(model_str.split(QString("\n")), rootItem1, -1, tr("1"));
89 pingvin 177
 
178
 
179
    return result;
180
 
181
}
182
 
183
 
215 pingvin 184
void MainWindow::setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row, QString model_id)
89 pingvin 185
{
186
    QList<QTreeWidgetItem*> parents;
187
    QList<int> indentations;
188
    parents << parent;
189
    indentations << 0;
190
 
191
    int number = 0;
192
 
193
    while (number < lines.count()) {
194
        int position = 0;
195
        while (position < lines[number].length()) {
196
            if (lines[number].mid(position, 1) != " ")
197
                break;
198
            position++;
199
        }
200
 
201
        QString lineData = lines[number].mid(position).trimmed();
202
 
203
        if (!lineData.isEmpty()) {
204
            // Read the column data from the rest of the line.
205
            QStringList columnStrings = lineData.split("\t", QString::SkipEmptyParts);
206
            QList<QVariant> columnData;
207
            for (int column = 0; column < columnStrings.count(); ++column)
208
                columnData << columnStrings[column];
209
 
210
            if (position > indentations.last()) {
211
                // The last child of the current parent is now the new parent
212
                // unless the current parent has no children.
213
 
214
                if (parents.last()->childCount() > 0) {
215
                    parents << parents.last()->child(parents.last()->childCount()-1);
216
                    indentations << position;
217
                }
218
            } else {
219
                while (position < indentations.last() && parents.count() > 0) {
220
                    parents.pop_back();
221
                    indentations.pop_back();
222
                }
223
            }
224
 
225
            // Append a new item to the current parent's list of children.
226
          // // //  parents.last()->appendChild(new QTreeWidgetItem(columnData, parents.last()));
227
            QTreeWidgetItem* itm_tmp;
228
            itm_tmp = new QTreeWidgetItem( parents.last());
215 pingvin 229
        //    itm_tmp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
89 pingvin 230
 
209 pingvin 231
/*
232
            QLineEdit * edit_line;
233
            edit_line = new QLineEdit(this);
234
            ui->treeWidget->setItemWidget(itm_tmp, 5, edit_line);
235
*/
236
//static QStandartDelegate delegate;
237
            ui->treeWidget->setItemDelegateForColumn(5, &standart_delegate);
238
 
239
 
89 pingvin 240
            itm_tmp->setText(0, QString(columnData.at(0).toString()));
241
            if (columnData.at(1).toString() == "true") {
242
                                                            itm_tmp->setCheckState(0,Qt::Checked);
243
                                                        }
244
            else itm_tmp->setCheckState(0,Qt::Unchecked);
141 pingvin 245
            if (columnData.count()>2)
246
            {
173 pingvin 247
            QString class_id;
222 pingvin 248
            QString filtr_str;
174 pingvin 249
            QPixmap pxmp;
250
            QIcon icon;
173 pingvin 251
            class_id = QString(columnData.at(2).toString());
174 pingvin 252
            pxmp = MainWindow::classesIcons.value(class_id);
253
 
173 pingvin 254
           // itm_tmp->setText(1, QString(columnData.at(2).toString())); // id 
255
            itm_tmp->setText(1, class_id); // id 
215 pingvin 256
            itm_tmp->setText(6, model_id); // id 
90 pingvin 257
            itm_tmp->setText(2, QVariant(number).toString()); //    - 
173 pingvin 258
            itm_tmp->setText(3, QVariant(indentations.size()).toString()); //  
259
            itm_tmp->setText(4, QVariant(row).toString()); //    
222 pingvin 260
            filtr_str = getFiltrString(model_id,class_id);
261
            itm_tmp->setText(5,filtr_str);
174 pingvin 262
 
263
            if (!pxmp.isNull())
264
                {
265
                    icon.addPixmap(pxmp);
175 pingvin 266
                    itm_tmp->setIcon(0, icon);                  
174 pingvin 267
                }
141 pingvin 268
            }
89 pingvin 269
        }
270
 
271
        number++;
272
    }
273
}
274
 
275
 
276
/*
277
void MainWindow::openBase()
278
{
279
 
280
        db = QSqlDatabase::addDatabase("QMYSQL");
281
        pdb = &db;
282
        raportFrm.pdb = &db;
283
 
284
        pdb->setHostName(hostName);
285
        pdb->setDatabaseName(baseName);
286
        pdb->setUserName(userName);
287
        pdb->setPassword(password);
288
        bool ok = pdb->open();
289
        if (!ok) {
290
                                QMessageBox::critical( //     .
291
                                                                                this,                      //  .
292
                                                                                QObject::tr("Database Error"),   // .
293
                                                                                pdb->lastError().text());          //  .
294
                         }
295
        if (ok)
296
        {lineEdit-> insert(tr("  "));
297
        }
298
        else {lineEdit-> insert(tr(" .  : "));
299
                  lineEdit-> insert(pdb->lastError().text());
300
                 }
301
 
302
 
303
 
304
        model = new QSqlTableModel(this);
305
        model->setTable(tableName);
306
 
307
        model->setEditStrategy(QSqlTableModel::OnManualSubmit);
308
        model->setSort(0, Qt::AscendingOrder);
309
 
310
        model->select();
311
 
312
 
313
        QSqlField field(tr("age"), QVariant::Int);
314
        field.setValue(QString(tr("123")));
315
 
316
        bool okey;
317
        int index;
318
        QSqlRecord record;
319
 
320
 
321
        tableView->setModel(model);
322
        view.setModel(model);
323
 
324
 
325
        tableView->setAlternatingRowColors(true);
326
        view.setAlternatingRowColors(true);
327
 
328
        tableView->resizeColumnsToContents();
329
 
330
 
331
        view.resizeColumnsToContents();
332
 
333
        tableView->show();
334
 
335
 
336
 
337
        initTreeWidget();
338
}
339
*/
91 pingvin 340
 
341
 
146 pingvin 342
QString MainWindow::creatModelString(QTreeWidgetItem* model){
91 pingvin 343
 
344
    MainWindow::modelString.clear(); //   
345
 //   for (int i =0; i < rootItem1->childCount(); ++i )
346
 
146 pingvin 347
    {MainWindow::addChildsString(model, 0);}
348
 
349
    return MainWindow::modelString;
145 pingvin 350
// {MainWindow::addChildsString(ui->treeWidget, 0);}
351
 /*
91 pingvin 352
    int root_item_child_count;
353
    int i;
354
    root_item_child_count = rootItem1->childCount();
355
    i++;
145 pingvin 356
*/
91 pingvin 357
}
358
 
359
 
360
void MainWindow::addChildsString(QTreeWidgetItem *parentItem, int level){
361
    int child_count;
362
    child_count = parentItem->childCount();
363
    for (int i=0; i < child_count; ++i){
364
        for (int m=0; m < level; ++m){
365
        modelString.append(tr("    ")); //   -  ,     
366
    }
367
        modelString.append(parentItem->child(i)->text(0)); //    -  
368
        modelString.append(tr("\t\t\t\t")); //   -   
369
        if (parentItem->child(i)->checkState(0) ==  Qt::Checked) {modelString.append(tr("true"));} //   ,  "true",      
370
            else {modelString.append(tr("false"));} //     -  "false",       
371
        modelString.append(tr("\t\t\t\t")); //   -   
372
        modelString.append(parentItem->child(i)->text(1)); //    - ID 
373
         modelString.append(tr("\n")); //  
374
        if (parentItem->child(i)->childCount() > 0) { MainWindow::addChildsString(parentItem->child(i), level+1);}
375
 
376
    }
377
int i;
378
i++;
379
}
93 pingvin 380
 
381
 
382
bool MainWindow::openDataBase(){
383
    QString errorString;
384
    sql = QSqlDatabase::addDatabase("QMYSQL");
131 pingvin 385
//    sql.setDatabaseName(tr("an_db"));
386
 
132 pingvin 387
    // // // sql.setDatabaseName(tr("inventory"));
131 pingvin 388
 
132 pingvin 389
    sql.setDatabaseName(baseName);
131 pingvin 390
 
391
 
392
 
132 pingvin 393
    // // // sql.setHostName(tr("localhost"));
93 pingvin 394
 
132 pingvin 395
    sql.setHostName(hostName);
396
 
397
 
398
    // // // sql.setUserName(tr("an"));
399
 
400
    sql.setUserName(userName);
401
 
402
 
403
 
404
   // // //  sql.setPassword(tr("393939"));
405
 
406
 
407
    sql.setPassword(password);
408
 
409
 
410
 
93 pingvin 411
    bool ok;
412
    ok = sql.open();
413
 
414
    /*
415
    if (!ok) {
416
                                QMessageBox::critical( //     .
417
                                                                                this,                      //  .
418
                                                                                QObject::tr("Database Error"),   // .
419
                                                                                sql.lastError().text() );         //  .
420
 
421
 
422
                            }
423
 
424
*/
425
    if (!ok) {
426
                            QMessageBox::critical( //     .
427
                                                                            this,                      //  .
428
                                                                            QObject::tr("Database Error"),   // .
429
                                                                            sql.lastError().text());          //  .
430
                     }
431
else {
432
 
433
        QMessageBox::information( //     .
434
                                                        this,                      //  .
435
                                                        QObject::tr("Database Connect"),   // .
436
                                                        QObject::tr("     ."));         //  .
437
 
438
 
439
 
440
 
441
 
442
    }
443
 
444
     return ok;
445
}
94 pingvin 446
 
447
 
97 pingvin 448
bool MainWindow::buildPreviewModel(QString modelName, QString rootClassID){
94 pingvin 449
QSqlQuery q;
450
QString sql_str;
95 pingvin 451
QString field_name_str;
452
QString root_class_name;
192 pingvin 453
//bool ok;
454
//int field_name;
95 pingvin 455
 
456
//ui->treeWidget->clear();
457
 
458
root_class_name = MainWindow::ClassName(rootClassID); //   
459
 
145 pingvin 460
 
95 pingvin 461
rootItem1 = new  QTreeWidgetItem(ui->treeWidget);
145 pingvin 462
 root_items_list << rootItem1;
97 pingvin 463
 rootItem1->setText(0, modelName);
464
 
95 pingvin 465
 rootItem1->setCheckState(0,Qt::Checked);
104 pingvin 466
 rootItems.append(rootItem1);
95 pingvin 467
 
468
 
104 pingvin 469
 
145 pingvin 470
 rootItem2 = new  QTreeWidgetItem(rootItem1);
471
 rootItem2->setText(0, root_class_name);
472
 rootItem2->setText(1, rootClassID);
473
 rootItem2->setCheckState(0,Qt::Checked);
95 pingvin 474
 
147 pingvin 475
 addChildsItems(rootItem2, -1);
95 pingvin 476
 
145 pingvin 477
 
478
/*
479
 
94 pingvin 480
sql_str = tr("select * "
95 pingvin 481
             " from DescriptionOfClasses where  DescriptionOfClasses.DefaultValue = '"       // ,     
94 pingvin 482
             );
483
sql_str.append(rootClassID);
484
 
95 pingvin 485
sql_str.append(tr("' and DescriptionOfClasses.FieldType = 'pointer' "));
94 pingvin 486
 
95 pingvin 487
q.prepare(sql_str);
488
 
489
ok = q.exec();
490
if (!ok) {
491
                        QMessageBox::critical( //     .
492
                                                                        this,                      //  .
493
                                                                        QObject::tr("Database Error"),   // .
494
                                                                        q.lastError().text());          //  .
495
                 }
496
field_name = q.record().indexOf(tr("FieldName"));
497
while(q.next()){
498
 
499
                field_name_str = q.value(field_name).toString();
500
 
501
                }
502
 
100 pingvin 503
 
504
 
505
 
145 pingvin 506
*/
507
 
508
 
94 pingvin 509
}
95 pingvin 510
 
511
 
147 pingvin 512
bool MainWindow::rebuildPreviewModel(QTreeWidgetItem* root_item, QString rootClassID, int row){
107 pingvin 513
QSqlQuery q;
514
QString sql_str;
515
QString field_name_str;
516
QString root_class_name;
192 pingvin 517
//bool ok;
518
//int field_name;
95 pingvin 519
 
107 pingvin 520
//ui->treeWidget->clear();
521
 
522
root_class_name = MainWindow::ClassName(rootClassID); //   
523
 
524
 
525
// rootItem1 = new  QTreeWidgetItem(ui->treeWidget);
526
// root_items_list << rootItem1;
527
// rootItem1->setText(0, modelName);
528
 
529
// rootItem1->setCheckState(0,Qt::Checked);
530
// rootItems.append(rootItem1);
531
 
532
// root_item->removeChild(root_item->child(0)); //    
145 pingvin 533
if (root_item->childCount()==0){ //   ,  
534
    QTreeWidgetItem* item_tmp;
535
    item_tmp = new QTreeWidgetItem (root_item);
147 pingvin 536
    item_tmp->setText(4, QVariant(row).toString());
145 pingvin 537
 
538
}
539
 
540
if (root_item->childCount()==1){ //      ,    
107 pingvin 541
root_item->child(0)->setText(0, root_class_name);
542
root_item->child(0)->setText(1, rootClassID);
147 pingvin 543
root_item->child(0)->setCheckState(0,Qt::Checked);
544
root_item->setText(4, QVariant(row).toString());
107 pingvin 545
 
147 pingvin 546
}
145 pingvin 547
 
548
 
147 pingvin 549
 
107 pingvin 550
//delete rootItem2;
551
 
552
 
553
// rootItem2 = new  QTreeWidgetItem(rootItem1);
554
 
555
 
556
 
557
// rootItem2->setText(0, root_class_name);
558
// rootItem2->setText(1, rootClassID);
559
// rootItem2->setCheckState(0,Qt::Checked);
560
 
561
int child_count = root_item->child(0)->childCount();
562
 
563
 
145 pingvin 564
for (int i=0; i < child_count; i++){ //       ,  
107 pingvin 565
    root_item->child(0)->removeChild(root_item->child(0)->child(0));
566
}
567
 
568
child_count = root_item->child(0)->childCount();
147 pingvin 569
addChildsItems(root_item->child(0), row);
107 pingvin 570
/*
571
sql_str = tr("select * "
572
             " from DescriptionOfClasses where  DescriptionOfClasses.DefaultValue = '"       // ,     
573
             );
574
sql_str.append(rootClassID);
575
 
576
sql_str.append(tr("' and DescriptionOfClasses.FieldType = 'pointer' "));
577
 
578
q.prepare(sql_str);
579
 
580
ok = q.exec();
581
if (!ok) {
582
                        QMessageBox::critical( //     .
583
                                                                        this,                      //  .
584
                                                                        QObject::tr("Database Error"),   // .
585
                                                                        q.lastError().text());          //  .
586
                 }
587
field_name = q.record().indexOf(tr("FieldName"));
588
while(q.next()){
589
 
590
                field_name_str = q.value(field_name).toString();
591
 
592
                }
593
 
594
*/
595
 
596
 
597
}
598
 
599
 
600
 
601
 
95 pingvin 602
QString MainWindow::ClassName(QString class_id){ //     ID
603
    QSqlQuery q;
604
    QString sql_str;
605
    QString class_name_str;
606
    bool ok;
607
    int field_class_name;
608
 
609
    sql_str = tr("select * "
610
                 " from ListOfClasses where ListOfClasses.ID = '"       // ,     
611
                 );
612
 
613
    sql_str.append(class_id);
614
    sql_str.append(tr("' "));
615
 
616
    q.prepare(sql_str);
617
 
618
    ok = q.exec();
619
 
620
 
621
    if (!ok) {
622
                            QMessageBox::critical( //     .
623
                                                                            this,                      //  .
624
                                                                            QObject::tr("Database Error"),   // .
625
                                                                            q.lastError().text());          //  .
626
                     }
627
 
628
    field_class_name = q.record().indexOf(tr("ClassName"));
629
    while(q.next()){
630
 
631
                    class_name_str = q.value(field_class_name).toString();
632
 
633
                    }
634
 
635
    return class_name_str;
636
 
637
}
98 pingvin 638
 
147 pingvin 639
void MainWindow::addChildsItems(QTreeWidgetItem *perent_class_item, int row){ //          ,      
100 pingvin 640
QStringList chields_list;
641
QString parent_ID;
642
QTreeWidgetItem *Item_tmp;
643
parent_ID = perent_class_item->text(1);
644
int chields_count, i;
98 pingvin 645
 
100 pingvin 646
chields_list = MainWindow::classChields(parent_ID);
647
if(chields_list.isEmpty()) return;
648
chields_count = chields_list.size();
649
for (int l = 0; l < chields_count; ++l){
650
    QString chield_class_name, chield_id;
651
    chield_id = chields_list.at(l);
652
    chield_class_name = MainWindow::ClassName(chield_id);
653
    Item_tmp = new QTreeWidgetItem(perent_class_item);
654
    Item_tmp->setText(0, chield_class_name);
655
    Item_tmp->setText(1, chield_id);
656
    Item_tmp->setCheckState(0, Qt::Checked);
147 pingvin 657
    Item_tmp->setText(4, QVariant(row).toString());
658
    MainWindow::addChildsItems(Item_tmp, row);
98 pingvin 659
}
660
 
100 pingvin 661
i++;
99 pingvin 662
 
100 pingvin 663
}
664
 
665
 
99 pingvin 666
/********************************************************
667
*    "" 
668
*
669
*
670
*
671
********************************************************/
672
 
673
QStringList MainWindow::classChields(QString class_id){
674
   // QMap<QString, QString> map;
675
   // TClass class_tmp;
676
   // QList <TClass> chields_class_list; //   
677
    QStringList result;
678
    QSqlQuery q;
679
    QString sql_str;
680
    QString classIdentifer_str; //      -
681
    QString field_id_str;
682
    bool ok;
683
    int field_classIdentifer;
684
    sql_str = tr("select * "
685
                 " from DescriptionOfClasses where  DescriptionOfClasses.DefaultValue = '"       // ,     
686
                 );
687
    sql_str.append(class_id);
688
 
689
    sql_str.append(tr("' and DescriptionOfClasses.FieldType = 'pointer' "));
690
 
691
    q.prepare(sql_str);
692
 
693
    ok = q.exec();
694
    if (!ok) {
695
                            QMessageBox::critical( //     .
696
                                                                            this,                      //  .
697
                                                                            QObject::tr("Database Error"),   // .
698
                                                                            q.lastError().text());          //  .
699
                     }
700
    field_classIdentifer = q.record().indexOf(tr("ClassIdentifer"));
701
      while(q.next()){
702
 
703
                    classIdentifer_str = q.value(field_classIdentifer).toString();
704
                    result.append(classIdentifer_str);
705
                    }
706
 
707
    return result;
708
 
709
  }
102 pingvin 710
 
711
 
712
QMap <QString, QString> MainWindow::getClassList(){ //   
713
QMap <QString, QString> result_map;
714
QSqlQuery q;
715
QString sql_str;
103 pingvin 716
QString class_name_str, class_id_str;
717
 
102 pingvin 718
int field_class_id, field_class_name;
719
bool ok;
720
sql_str = tr("select * "
721
             " from ListOfClasses "       // ,     
722
             );
723
 q.prepare(sql_str);
724
 ok = q.exec();
725
 if (!ok) {
726
                         QMessageBox::critical( //     .
727
                                                                         this,                      //  .
728
                                                                         QObject::tr("Database Error"),   // .
729
                                                                         q.lastError().text());          //  .
730
                         return result_map; //   -   
731
                  }
732
field_class_id = q.record().indexOf(tr("ID"));
733
field_class_name = q.record().indexOf(tr("ClassName"));
734
 
103 pingvin 735
while(q.next()){
102 pingvin 736
 
103 pingvin 737
                class_name_str = q.value(field_class_name).toString();
738
                class_id_str = q.value(field_class_id).toString();
739
                result_map[class_id_str] = class_name_str;
740
                }
102 pingvin 741
 return result_map;
742
}
104 pingvin 743
 
744
 
745
 
746
 
747
 
748
void MainWindow::initComboBox(){
749
 
106 pingvin 750
 
104 pingvin 751
    QStringList classesNameList;
752
    QStringList classesID_list;
753
    QStringList tmp_stringList;
754
 
755
 
756
 
757
    QString tmp_str;
758
 
759
    class_list_map = MainWindow::getClassList();
760
    classesID_list = class_list_map.keys();
761
    classesNameList = class_list_map.values();
762
    QMapIterator<QString, QString> interator(class_list_map);
763
//    ui->comboBox->addItems(classesID_list);
764
  //  ui->comboBox->addItems(classesNameList);
233 pingvin 765
 
104 pingvin 766
    while (interator.hasNext()) {
767
         interator.next();
768
         tmp_str =  interator.value();
769
         tmp_str.append(tr(" \t(ID="));
770
         tmp_str.append(interator.key());
771
         tmp_str.append(tr(")"));
772
         tmp_stringList << tmp_str;
773
 
774
     }
233 pingvin 775
    tmp_stringList << tr(" ");
132 pingvin 776
//    int count = ui->comboBox->count();
777
 
778
    ui->comboBox->clear();
104 pingvin 779
    ui->comboBox->addItems(tmp_stringList);
780
 
781
 
782
}
105 pingvin 783
 
784
 
106 pingvin 785
void MainWindow::on_comboBox_currentIndexChanged( int index ){
786
QStringList classesNameList;
787
QStringList classesID_list;
788
QString ID_str;
236 pingvin 789
if (index == -1) return;//       " "
790
if (ui->comboBox->itemText(index) == tr(" ")) return;
152 pingvin 791
if (!comboBox_slot_enable) return; //   ,     , 
147 pingvin 792
int row;
132 pingvin 793
 
106 pingvin 794
classesID_list = class_list_map.keys();
795
classesNameList = class_list_map.values();
796
ID_str =  classesID_list[index];
797
ui->label->setText(ID_str);
145 pingvin 798
if (root_items_list.indexOf(ui->treeWidget->currentItem()) != -1)
799
{
147 pingvin 800
    row = QVariant(ui->treeWidget->currentItem()->text(4)).toInt();
145 pingvin 801
    model_is_build = false; //     on_treeWidget_itemChanged
147 pingvin 802
    rebuildPreviewModel(ui->treeWidget->currentItem(), ID_str, row);
145 pingvin 803
    model_is_build = true; //   
147 pingvin 804
    QString mdl_str = MainWindow::creatModelString(ui->treeWidget->currentItem()); //
805
    model_for_ListModelsTable->setData(model_for_ListModelsTable->index(row, 2), QVariant(mdl_str));
145 pingvin 806
}
807
    getDatabaseData();
107 pingvin 808
 
809
 
105 pingvin 810
}
811
 
106 pingvin 812
void MainWindow::on_treeWidget_itemChanged ( QTreeWidgetItem * item, int column ){
813
    int i;
814
    i++;
147 pingvin 815
    QTreeWidgetItem * item_tmp;
816
    QString mdl_str;
817
    QString row; //     ,   
148 pingvin 818
    QList <QTreeWidgetItem *> mdl_itm_list;
147 pingvin 819
    QList <int> rows_list;
106 pingvin 820
 
147 pingvin 821
 
822
    if ((column) == 0 && (model_is_build)) {
823
    // if (!model_is_build) return; //    
148 pingvin 824
 
825
    mdl_itm_list = models_items.values();
147 pingvin 826
    rows_list =  models_items.keys();
148 pingvin 827
    row= item->text(4);
147 pingvin 828
 
148 pingvin 829
 
830
    if ( mdl_itm_list.indexOf(item) != -1){ //    ( )
831
        if (item->checkState(0)) model_for_ListModelsTable->setData(model_for_ListModelsTable->index(QVariant(row).toInt(), 3), QVariant(1));
832
        else model_for_ListModelsTable->setData(model_for_ListModelsTable->index(QVariant(row).toInt(), 3), QVariant(0));
833
        }
834
 
835
 
836
 
837
 
147 pingvin 838
    if (!row.isEmpty()){
839
 
840
 
841
        int row_int;
842
    row_int = QVariant(row).toInt();
843
     if (rows_list.indexOf(row_int) != -1)
844
        {
845
            item_tmp = models_items[row_int];
846
            mdl_str = MainWindow::creatModelString(item_tmp);
847
            model_for_ListModelsTable->setData(model_for_ListModelsTable->index(row_int, 2), QVariant(mdl_str));
848
        }
849
 
850
 
851
    }
852
 
853
 
854
}
855
 
856
/*
857
    QTreeWidgetItem * item_tmp;
858
    item_tmp = item;
859
    while (item_tmp ){
860
        item_tmp = item_tmp->parent();
861
    }
862
  */
118 pingvin 863
    if ((column) == 0 && (model_is_build)) getDatabaseData();
864
 
147 pingvin 865
 
106 pingvin 866
}
867
 
868
 
869
void MainWindow::on_treeWidget_itemClicked ( QTreeWidgetItem * item, int column ){
870
    int i;
871
    i++;
214 pingvin 872
    if (root_items_list.indexOf(item) != -1) { //      
108 pingvin 873
        QStringList classesNameList;
874
        QStringList classesID_list;
106 pingvin 875
 
217 pingvin 876
        ui->pushButton_9->setEnabled(false);
877
        ui->pushButton_10->setEnabled(false);
878
        ui->pushButton_11->setEnabled(false);
879
        ui->pushButton_12->setEnabled(false);
880
     //   ui->tableView->reset();
881
     //   MainWindow::filtr_model->clear();
221 pingvin 882
          disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
883
        delete filter_model;
223 pingvin 884
 
885
        filter_model = new QSqlTableModel();
886
       /// filter_model = new MyModel();
227 pingvin 887
    filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
223 pingvin 888
 
889
        connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
108 pingvin 890
        int index;
891
        classesID_list = class_list_map.keys();
892
        classesNameList = class_list_map.values();
145 pingvin 893
        if (item->childCount()>0) index = classesID_list.indexOf(item->child(0)->text(1)); //    ,   
894
        else { //  
233 pingvin 895
        index = classesID_list.count();
896
        comboBox_slot_enable = false; //   comboBox    
897
        ui->comboBox->setCurrentIndex(index);
145 pingvin 898
        ui->comboBox->setEnabled(true);
206 pingvin 899
        comboBox_slot_enable = true;
145 pingvin 900
        return;
901
 
902
        }
152 pingvin 903
        comboBox_slot_enable = false; //   comboBox    
132 pingvin 904
        if (index != -1) ui->comboBox->setCurrentIndex(index);
152 pingvin 905
        comboBox_slot_enable = true;
108 pingvin 906
        ui->comboBox->setEnabled(true);
907
 
908
 
909
    }
106 pingvin 910
  //  if ((rootItem1) == (item) ) ui->comboBox->setEnabled(true);
214 pingvin 911
else //     
912
    {
215 pingvin 913
        QString class_id;
914
        QString model_id;
915
        QString filtr_str;
221 pingvin 916
        QString inctance;
219 pingvin 917
        QStringList conditionList;
215 pingvin 918
        class_id = item->text(1);
919
        model_id = item->text(6);
221 pingvin 920
        inctance = MainWindow::getClassInctance(class_id);
921
 
217 pingvin 922
        filtr_str = tr("`Model_ID` = ");
215 pingvin 923
        filtr_str.append(model_id);
217 pingvin 924
        filtr_str.append(tr(" AND `Class_ID` = "));
215 pingvin 925
        filtr_str.append(class_id);
217 pingvin 926
       // filtr_str.append(tr("`"));
215 pingvin 927
 
221 pingvin 928
        disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
929
        delete filter_model;
223 pingvin 930
  ///      filter_model = new MyModel();
215 pingvin 931
 
221 pingvin 932
        filter_model = new QSqlTableModel();
227 pingvin 933
       filter_model->setEditStrategy(QSqlTableModel::OnManualSubmit);
934
 
221 pingvin 935
        connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
936
        filter_model->setTable(tr("Filters"));
937
        filter_model->setFilter(filtr_str);
226 pingvin 938
 
939
 
940
 
221 pingvin 941
        filter_model->select();
226 pingvin 942
 
943
        filter_model->sort(0,Qt::AscendingOrder);
944
 
221 pingvin 945
        ui->tableView_3->setModel(filter_model);
215 pingvin 946
 
219 pingvin 947
 
948
        ui->tableView_3->hideColumn(0);
949
        ui->tableView_3->hideColumn(1);
950
        ui->tableView_3->hideColumn(2);
951
 
952
 
953
        filterSpinDelegate.setClassID(class_id);
954
        filterSpinDelegate.getItems();
955
        ui->tableView_3->setItemDelegateForColumn(4, &filterSpinDelegate);
956
 
224 pingvin 957
       // ui->tableView_3->setItemDelegate();
219 pingvin 958
        conditionList <<"" << "and" << "or" << "(" << "and (" << "or (";
959
        filterConditionDelegate.setItems(conditionList);
960
        ui->tableView_3->setItemDelegateForColumn(3, &filterConditionDelegate);
961
 
962
        conditionList.clear();
227 pingvin 963
        conditionList <<"" << "=" << "<" << ">" << "IS NULL" << "IS NOT NULL";
219 pingvin 964
        filterConditionDelegate_1.setItems(conditionList);
965
        ui->tableView_3->setItemDelegateForColumn(5, &filterConditionDelegate_1);
966
 
967
 
227 pingvin 968
 
969
 
228 pingvin 970
        conditionList.clear();
971
        conditionList <<"" << ")";
972
        filterConditionDelegate_2.setItems(conditionList);
973
        ui->tableView_3->setItemDelegateForColumn(7, &filterConditionDelegate_2);
227 pingvin 974
 
224 pingvin 975
        ui->tableView_3->setItemDelegateForColumn(6, &filterValueDelegate);
219 pingvin 976
 
224 pingvin 977
 
978
 
979
 
217 pingvin 980
        ui->pushButton_9->setEnabled(true);
981
        ui->pushButton_10->setEnabled(true);
982
 
215 pingvin 983
        ui->comboBox->setEnabled(false);
984
 
985
 
214 pingvin 986
    }
106 pingvin 987
}
110 pingvin 988
 
125 pingvin 989
QMap <QString, QString> MainWindow::getFieldsList(QString class_id){ //    
110 pingvin 990
 
125 pingvin 991
}
142 pingvin 992
 
993
 
994
void MainWindow::initListModelsTablle(){
149 pingvin 995
    model_for_ListModelsTable = new QSqlTableModel();
142 pingvin 996
 
997
    model_for_ListModelsTable->setTable(tr("ListOfModels"));
146 pingvin 998
 //   model_for_ListModelsTable->setEditStrategy(QSqlTableModel::OnFieldChange);
999
    model_for_ListModelsTable->setEditStrategy(QSqlTableModel::OnManualSubmit);
142 pingvin 1000
    ui->tableView_2->setModel(model_for_ListModelsTable);
151 pingvin 1001
 
142 pingvin 1002
    model_for_ListModelsTable->select();
151 pingvin 1003
 
223 pingvin 1004
 
151 pingvin 1005
    ui->treeWidget->hideColumn(1);
1006
    ui->treeWidget->hideColumn(2);
1007
    ui->treeWidget->hideColumn(3);
1008
    ui->treeWidget->hideColumn(4);
221 pingvin 1009
//    ui->treeWidget->hideColumn(5);
215 pingvin 1010
    ui->treeWidget->hideColumn(6);
223 pingvin 1011
 
151 pingvin 1012
    ui->tableView_2->hideColumn(0);
1013
    ui->tableView_2->hideColumn(2);
1014
    ui->tableView_2->hideColumn(3);
1015
    ui->tableView_2->hideColumn(4);
1016
 
1017
    ui->tableView_2->resizeColumnsToContents();
1018
    ui->tableView_2->setAlternatingRowColors(true);
1019
 
146 pingvin 1020
    ui->pushButton_7->setEnabled(false);
1021
    ui->pushButton_8->setEnabled(false);
151 pingvin 1022
 
1023
 
142 pingvin 1024
}
228 pingvin 1025
 
1026
void MainWindow::buildReport(bool advanced){
1027
 
1028
  //  QTreeWidgetItem * hitm;
1029
 
1030
  //   hitm = ui->treeWidget_2->headerItem();
1031
 
1032
  //   int count = root_items_list.count();
1033
 
1034
    //int count = ui->treeWidget_2->rootIndex();
1035
 
229 pingvin 1036
 
233 pingvin 1037
    doc->clear();// 
228 pingvin 1038
 
1039
    int list_count;
1040
    if (rootItems.isEmpty()) return;
1041
 
1042
 
1043
 
1044
    list_count = rootItems.count();
1045
 
1046
    for (int i=0; i < list_count; i++){
1047
 
1048
       getReport(rootItems.at(i), advanced);
1049
 
229 pingvin 1050
 
1051
 
228 pingvin 1052
    }
233 pingvin 1053
 // (bool)QTextDocumentWriter("raport.odt").write(doc);
228 pingvin 1054
}
1055
 
1056
 
1057
void MainWindow::getReport(QTreeWidgetItem * model_item, bool advanced){ //     
1058
 
1059
 
1060
 //   QTextDocument doc;
1061
 //   QTextCursor cursor(&doc);
1062
    QTextCharFormat char_fmt;
1063
    bool ok;
1064
 
1065
    /**************
1066
 
1067
    //  char_fmt.setBackground(Qt::red);
1068
    cursor.insertText(tr("1\n"),char_fmt);
1069
    QImage img;
1070
    ok = img.load("./hdd5.png");
1071
     doc.addResource(QTextDocument::ImageResource, QUrl("myimage"), img);
1072
     cursor.insertImage("myimage");
1073
    cursor.insertText(tr(" \n"),char_fmt);
1074
 
1075
    (bool)QTextDocumentWriter("test.odt").write(&doc);
1076
    ***************/
1077
 
1078
    QString model_name;
1079
    QString rootClassID;
1080
    QString rootClassInctance;
1081
    QFont font;
233 pingvin 1082
    QBrush brush;
228 pingvin 1083
 
233 pingvin 1084
    brush.setColor(Qt::darkRed);
1085
    char_fmt.setForeground(brush);
1086
    font.setBold(true);
1087
    char_fmt.setFont(font);
1088
 
228 pingvin 1089
    model_name = model_item->text(0);
1090
    if (model_item->checkState(0) == false) return; //     
1091
 
1092
 
229 pingvin 1093
    newPage();
1094
/*******************
1095
    QTextBlockFormat textFormat;
1096
           textFormat.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore);
1097
                        cursor->setBlockFormat(textFormat);
1098
 
1099
                        cursor->insertText(tr(" "));
1100
                        cursor->insertBlock();
1101
 
1102
                        textFormat.setPageBreakPolicy(QTextFormat::PageBreak_Auto);
1103
                        cursor->setBlockFormat(textFormat);
1104
********************/
1105
 
1106
 
1107
 
228 pingvin 1108
    if (!(model_item->childCount() > 0)) return; //   (  )
1109
 
1110
    rootClassID = model_item->child(0)->text(1);
1111
    rootClassInctance = getClassInctance(rootClassID);
1112
 
233 pingvin 1113
    cursor->insertText(model_name, char_fmt);
228 pingvin 1114
    cursor->insertText(tr("\n"));
1115
 
1116
    if (model_item->child(0)->checkState(0)) //         ( ), 
1117
        {
1118
         /////   QTreeWidgetItem * item_tmp;
1119
       /////     item_tmp = new QTreeWidgetItem(item);                  //  ,   ,   
1120
       /////     item_tmp->setText(0, model_item->child(0)->text(0));    //   
1121
 
1122
            //showClassObjects(item_tmp, model_item->child(0));  //      
1123
 
1124
            ///// showObjects(item_tmp, model_item->child(0), tr(""));
1125
        printChild(model_item->child(0), tr(""), advanced, 1);
230 pingvin 1126
 
228 pingvin 1127
        }
1128
 
1129
 
1130
 
1131
 
1132
}
1133
 
1134
void MainWindow::printChild(QTreeWidgetItem * model_item, QString filtr, bool advanced, int pos){//    
1135
    QString classID; //  
1136
    QString parentClassID; //   
1137
    QString pointerField; //  -   
1138
    QString inctance; //  , 
1139
    QString className; //  
1140
    QString modelID; //  
1141
    QString add_filtr; //  
1142
    int field_ID;
1143
    int icon_field_index;
1144
    bool filtr_empty;
1145
    bool ok;
1146
    QSqlQuery q;
1147
    QString sql_str;
1148
    QString str_tmp;
1149
    QTreeWidgetItem * title_item;
233 pingvin 1150
 
228 pingvin 1151
    QIcon icon;
230 pingvin 1152
    QMap<QString, QString> fieldsTypesList;//       ,    
1153
    //QList<TField> FieldsList; //  
228 pingvin 1154
 
229 pingvin 1155
 
1156
 
1157
 
233 pingvin 1158
// // //     font.setBold(true);
228 pingvin 1159
    filtr_empty = filtr.isEmpty();
1160
 
1161
    classID = model_item->text(1);
1162
    modelID = model_item->text(6);
1163
    add_filtr = MainWindow::getFiltrString(modelID, classID);
1164
 
1165
 
1166
    icon = model_item->icon(0);
1167
 
1168
    parentClassID = model_item->parent()->text(1);
1169
 
1170
    pointerField = getPointerFieldName(parentClassID, classID);
1171
 
1172
    className = model_item->text(0);
1173
    inctance = getClassInctance(classID);
1174
 
1175
    if  (!model_item->checkState(0)) return;
1176
 
1177
 
229 pingvin 1178
 
1179
 
233 pingvin 1180
    QTextCharFormat charFormatItalic, charFormatBase, charFormatItalicBold, charFormatItalicOnly;
1181
    QTextTableFormat tableFormat;
1182
 
1183
 
1184
//    QPen pen;
1185
    QBrush brush;
1186
    QFont font;
1187
    // pen.setColor(Qt::red);
1188
    // charFormatItalic.setTextOutline(pen);
1189
 
229 pingvin 1190
    //QFont font;
233 pingvin 1191
 
1192
    brush.setColor(Qt::blue);
1193
 
229 pingvin 1194
    font.setItalic(true);
233 pingvin 1195
 
1196
 charFormatItalicOnly.setFont(font);
229 pingvin 1197
    //charFormatItalic.setFontItalic(true);
233 pingvin 1198
 
1199
    font.setBold(true);/////////////////
229 pingvin 1200
    charFormatItalic.setFont(font);
233 pingvin 1201
 
1202
 
1203
    charFormatItalic.setForeground(brush);
1204
 
1205
 
1206
 
1207
    charFormatItalicBold.setFont(font);
1208
    charFormatItalicBold.setForeground(brush);
1209
 
1210
 
1211
 
229 pingvin 1212
    //charFormatItalic.setFontWeight(16);
1213
    pos++;
1214
    for(int i=0; i<pos; i++){ cursor->insertText( tr(" "));}//  
1215
    cursor->insertText(className, charFormatItalic);
1216
    cursor->setCharFormat(charFormatBase);
228 pingvin 1217
    cursor->insertText(tr("\n"));
1218
 
229 pingvin 1219
 
1220
 
228 pingvin 1221
    sql_str = tr("select * "
1222
                 " from "       //      -   
1223
                 );
1224
    sql_str.append(inctance);
1225
 
1226
 
1227
    if (filtr.isEmpty() && (!add_filtr.isEmpty())) //  ,    
1228
                            {
1229
                                filtr.append(tr ("where "));
1230
                                filtr.append(add_filtr);
1231
                             }
1232
 
1233
 
1234
    if (!filtr.isEmpty())   { //    
1235
                                 sql_str.append(tr(" "));
1236
                                 sql_str.append(filtr); //    
1237
                            }
1238
 
1239
    q.prepare(sql_str);
1240
 
1241
    ok = q.exec();
1242
 
1243
    if (!ok) {
1244
                            QString debug_str;
1245
                            debug_str.append(tr(" showObjects(): Database Error "));
1246
                            debug_str.append(tr(" : "));
1247
                            debug_str.append(inctance);
1248
                            debug_str.append(tr(" : "));
1249
                            debug_str.append(filtr);
1250
                            debug_str.append(q.lastError().text());
1251
                            QMessageBox::critical( //     .
1252
                                                                            this,                      //  .
1253
                                                                            QObject::tr(" showObjects(): Database Error"),   // .
1254
                                                                            debug_str
1255
                                                                           // q.lastError().text()
1256
                                                                             );          //  .
1257
                                                                            return;
1258
                     }
1259
 
1260
    field_ID = q.record().indexOf(tr("ID"));
1261
 
1262
    icon_field_index = q.record().indexOf(tr("Icon"));
1263
 
229 pingvin 1264
    int k=0;
1265
    QStringList fieldsNamesList;//    
230 pingvin 1266
    QList<TField> FieldsList; //  
231 pingvin 1267
    QMap<QString, TField> fieldsMap;//        ,     -   
1268
    QMap <QString, QString> fieldsValues;//     ,     
230 pingvin 1269
     FieldsList = getFieldList(classID); //   
228 pingvin 1270
 
1271
 
231 pingvin 1272
 
1273
 
1274
 
230 pingvin 1275
     if(FieldsList.count()>0){
1276
                                for(int i=0; i < FieldsList.count(); i++){ //  ( - )
1277
                                                                            fieldsTypesList.insert(FieldsList.at(i).FieldName, FieldsList.at(i).FieldType);
231 pingvin 1278
                                                                            fieldsMap.insert(FieldsList.at(i).FieldName, FieldsList.at(i));
230 pingvin 1279
                                                                         }
229 pingvin 1280
 
230 pingvin 1281
                              // fieldsNamesList = fieldsTypesList.keys(); //    
1282
                              }
1283
 
1284
// icon_field_index = fieldsNamesList.indexOf(tr("Icon"));//    
1285
 
1286
 
1287
 
229 pingvin 1288
    while(!q.record().fieldName(k).isEmpty()){//     
1289
        fieldsNamesList.append(q.record().fieldName(k++));
1290
    }
1291
 
1292
 
230 pingvin 1293
//icon_field_index = fieldsNamesList.indexOf(tr("Icon"));//    
1294
 
1295
 
228 pingvin 1296
    while(q.next()){
1297
                  if (q.record().count() > 1)
1298
                  {
1299
                    QString value_tmp;
1300
                    QString ID_tmp;
1301
                    QString space;
1302
 
1303
                    // // // //                QTreeWidgetItem * itm;
1304
                    ID_tmp = q.value(field_ID).toString(); //   
1305
                    value_tmp = q.value(1).toString(); //    (    )
1306
               //     itm = new QTreeWidgetItem(parent_object_item); //    ,  
1307
 
1308
 
1309
 
1310
 
1311
                    /***************************
1312
                    itm = new QTreeWidgetItem(title_item); //    ,  
1313
                    itm->setText(0, value_tmp);
1314
                    itm->setText(1, tr("object"));
1315
                    itm->setText(2, ID_tmp);
1316
                    ******************************/
1317
 
1318
                    if  (icon_field_index != -1){ //     
1319
 
1320
                        QVariant data;
1321
                        QByteArray bytes;
1322
                        QPixmap pix;
1323
                        QIcon icn;
1324
                        QMap <QString, QPixmap> pixmap_map;
1325
                        QList <QString> id_list;
1326
                        QList <QPixmap> pixmap_list;
1327
                        pixmap_map = MainWindow::getObjectsIcon(inctance);
1328
                        if (!pixmap_map.isEmpty()) {
1329
                            id_list = pixmap_map.keys();
1330
                            pixmap_list =  pixmap_map.values();
1331
                        }
1332
                        if (id_list.indexOf(ID_tmp) != -1) {
1333
                            pix = pixmap_list.at(id_list.indexOf(ID_tmp));
1334
                        }
1335
                      // data = q.record().value(icon_field_index);
1336
                      //  bytes = q.record().value(icon_field_index).toByteArray();
1337
                        // if (data.isValid() && (!data.isNull())) {
1338
                     //   if (!bytes.isEmpty()){
1339
                        // pix.loadFromData(data.toByteArray());
1340
                        // pix.loadFromData(bytes);
1341
 
1342
 
1343
                    if(!pix.isNull())    {
1344
                            if (pix.height() > 128) pix = pix.scaledToHeight(128);
1345
                            QString fname = value_tmp;
1346
                            fname.append(tr(".png"));
1347
 
1348
 
1349
                            pix.toImage().save(fname);
233 pingvin 1350
                            doc->addResource(QTextDocument::ImageResource, QUrl(fname), pix.toImage());
228 pingvin 1351
 
1352
                        // for(int i=0; i<pos; i++){ cursor->insertText( tr(" "));}//  
1353
 
1354
 
229 pingvin 1355
                            for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}//  
228 pingvin 1356
                            cursor->insertImage(fname);
1357
                          //  cursor->insertText(tr("\n"));
1358
 
1359
                        }
229 pingvin 1360
                            else for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}//  
228 pingvin 1361
 
1362
 
1363
 
1364
 
1365
                        // // // icn.addPixmap(pix);
1366
                        // // // itm->setIcon(0, icn);
1367
                     //  }
1368
 
1369
 
1370
                    }
1371
 
229 pingvin 1372
                    else for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}//  
228 pingvin 1373
                    cursor->insertText( value_tmp);
1374
                    cursor->insertText( tr("\n"));
1375
 
229 pingvin 1376
 
1377
 
230 pingvin 1378
                   // q.first();
229 pingvin 1379
 
1380
 
230 pingvin 1381
                    if(advanced && (fieldsNamesList.count()>0)){ //   
1382
 
1383
                        QString tmp_string;
229 pingvin 1384
                        sql_str.clear();
1385
 
231 pingvin 1386
                    // // //    QTextTable *table = cursor->insertTable(fieldsNamesList.count()-2, 2);//     ,    (ID   )
229 pingvin 1387
 
1388
 
230 pingvin 1389
 
231 pingvin 1390
                        /************************
1391
                        QTextTable *table = cursor->insertTable(fieldsNamesList.count(), 2);//     ,    (ID   )
1392
 
1393
                        ************************/
1394
 
1395
 
1396
 
1397
 
1398
 
1399
 
1400
 
1401
 
1402
 
1403
 
1404
                        //                   cursor->insertText(tr(" "));
1405
 
1406
 
230 pingvin 1407
                      //  *cursor = table->cellAt(0,1).firstCursorPosition();
1408
                      //  cursor->insertText(tr("  2"));
1409
                      //  *cursor = table->cellAt(1,1).lastCursorPosition();
1410
                      //  cursor->insertText(tr("  4"));
1411
 
1412
 
1413
                      //  cursor->movePosition(QTextCursor::End);
1414
 
1415
 
1416
 
1417
                        //table->cellAt(1,1).firstCursorPosition().insertText(tr("1"));
1418
                        //table->cellAt(1,2).firstCursorPosition().insertText(tr("2"));
1419
                        //table->cellAt(2,1).firstCursorPosition().insertText(tr("3"));
1420
 
1421
                        //table->cellAt(2,2).firstCursorPosition().insertText(tr("4"));
1422
                   //     cursor->insertText(tr("1 \t 2"));
1423
                   //      cursor->insertText(tr("3 \t 4"));
1424
 
231 pingvin 1425
                        for(int i=0; i < fieldsNamesList.count(); i++)
1426
                                {
230 pingvin 1427
 
231 pingvin 1428
 
1429
                            if (fieldsNamesList.at(i)== tr("Icon") || fieldsNamesList.at(i)== tr("ID")) {   tmp_string = tr("  ");
1430
                                                                        continue;
1431
                                                                    }
1432
 
1433
                                        QString fieldType;
1434
                                        fieldType = fieldsTypesList.value(fieldsNamesList.at(i)); //  
1435
                                        if(fieldType == tr("pointer")) //    - 
1436
                                                     {
1437
                                                        QSqlQuery q_tmp;
1438
                                                        QString sql_str;
1439
                                                 //       QString val_str;
1440
                                                         QString parent_class_id;//  ,     
1441
                                                         QString parent_class_inctance; //    
1442
                                                         bool ok;
1443
                                                         TField field_tmp;
1444
                                                         field_tmp = fieldsMap.value(fieldsNamesList.at(i));
1445
                                                         parent_class_id = field_tmp.DefaultValue;
1446
                                                         if  (parent_class_id.isEmpty()) continue; //    id  
1447
                                                         else parent_class_inctance = getClassInctance(parent_class_id);
1448
                                                         if  (parent_class_inctance.isEmpty()) continue; //    id  
1449
                                                         sql_str = tr("select * from `");
1450
                                                         sql_str.append(parent_class_inctance);
1451
                                                         sql_str.append(tr("` where `ID` = '"));
1452
                                                         sql_str.append(q.record().value(i).asString());
1453
                                                         sql_str.append(tr("'"));
1454
                                                         ok = q_tmp.prepare(sql_str);
1455
                                                         ok = q_tmp.exec();
1456
 
1457
                                                         if (!ok) {
1458
                                                                                 QString debug_str;
1459
                                                                                 debug_str.append(tr(" showObjects(): Database Error "));
1460
                                                                                 debug_str.append(tr(" : "));
1461
                                                                                 debug_str.append(inctance);
1462
                                                                                 debug_str.append(tr(" : "));
1463
                                                                                 debug_str.append(filtr);
1464
                                                                                 debug_str.append(q.lastError().text());
1465
                                                                                 QMessageBox::critical( //     .
1466
                                                                                                                                 this,                      //  .
1467
                                                                                                                                 QObject::tr(" showObjects(): Database Error"),   // .
1468
                                                                                                                                 debug_str
1469
                                                                                                                                // q.lastError().text()
1470
                                                                                                                                  );          //  .
1471
                                                                                                                                 return;
1472
                                                                          }
1473
 
1474
                                                         tmp_string.clear();
1475
                                                         while (q_tmp.next()){
1476
                                                                            tmp_string = q_tmp.record().value(1).asString();
1477
 
1478
                                                                        }
1479
 
1480
                                                         fieldsValues.insert(fieldsNamesList.at(i), tmp_string);//     
1481
 
1482
                                                         continue;//     
1483
 
1484
                                                     } //      pointer
1485
 
1486
                                        if(fieldType == tr("file")){ //    - ,   
1487
 
1488
                                                                            tmp_string = tr("  ");
1489
                                                                            continue;
1490
 
1491
                                                                    }
1492
 
1493
                                        tmp_string = q.record().value(i).asString(); //   ,     -,   
1494
                                        fieldsValues.insert(fieldsNamesList.at(i), tmp_string);//     
1495
 
1496
 
1497
                                    }
1498
 
1499
 
1500
 
1501
 
1502
 
233 pingvin 1503
                      //  for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}//  
1504
                        tableFormat.setAlignment(Qt::AlignLeft);
1505
                            tableFormat.setBackground(QColor("#e0e0e0"));
1506
                      //      tableFormat.setCellPadding(2);
1507
                      //      tableFormat.setCellSpacing(4);
1508
                        tableFormat.setLeftMargin(pos*7);
1509
                        tableFormat.setBorder(1);
1510
                        tableFormat.setBorderStyle( QTextFrameFormat::BorderStyle_Solid);
231 pingvin 1511
 
233 pingvin 1512
                        QTextTable *table = cursor->insertTable(fieldsValues.count(), 2, tableFormat);//     ,    (ID   )
1513
                //        table->setFormat(tableFormat);
1514
 
1515
 
1516
                        for(int i=0; i < fieldsValues.count(); i++){ //  : ID  ,    (    )
231 pingvin 1517
                                                                         QStringList keys_list = fieldsValues.keys();
1518
                                                                         QStringList values_list = fieldsValues.values();
1519
                                                                        *cursor = table->cellAt(i,0).firstCursorPosition();//  i-,  
233 pingvin 1520
                                                                        cursor->insertText(keys_list.at(i), charFormatItalicOnly);//   
231 pingvin 1521
                                                                        *cursor = table->cellAt(i,1).firstCursorPosition();//  i-,  
1522
                                                                        cursor->insertText(values_list.at(i));//   
1523
                                                                    }
1524
 
233 pingvin 1525
              //          table->setFormat(tableFormat);
1526
                        cursor->movePosition(QTextCursor::End);//  
231 pingvin 1527
                         cursor->insertText( tr("\n"));
1528
 
1529
 
1530
 
1531
/******************************
1532
 
1533
                        table = cursor->insertTable(fieldsNamesList.count(), 2);//     ,    (ID   )
1534
 
230 pingvin 1535
                        for(int i=2; i < fieldsNamesList.count(); i++){ //  : ID  ,    (    )
1536
                    //    if (i !=icon_field_index) tmp_string = q.record().value(i).asString(); //    ,     
1537
                        if (i !=icon_field_index) tmp_string = q.record().value(i).asString(); //    ,     
1538
 
1539
 
1540
                        else  tmp_string = tr(" ");
1541
                     ////   if (i !=icon_field_index) {
1542
                                                        for(int i=0; i<pos+2; i++){ cursor->insertText( tr(" "));}//  
1543
                                                         *cursor = table->cellAt(i-2,0).firstCursorPosition();//  i-,  
1544
                                                        cursor->insertText( fieldsNamesList.at(i));//   
1545
                                                         *cursor = table->cellAt(i-2,1).firstCursorPosition();//  i-,  
1546
                                                        //cursor->insertText( tr(":\t"));
1547
 
1548
                                                        cursor->insertText(tmp_string);//  
1549
                                                      //  cursor->insertText( tr("\n"));
1550
                                                    }
1551
 
1552
                       ////     }
231 pingvin 1553
 
1554
 
1555
 
1556
 
1557
 
1558
 
1559
 
1560
 
1561
 
1562
 
230 pingvin 1563
                        cursor->movePosition(QTextCursor::End);//  
1564
                        cursor->insertText( tr("\n"));
231 pingvin 1565
 
1566
                        *********************************/
1567
 
229 pingvin 1568
                    }
1569
 
1570
 
1571
 
1572
                    /********************************************************
1573
                    textFormat.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore);
1574
                                 cursor->setBlockFormat(textFormat);
1575
 
1576
                                 cursor->insertText(tr("  "));
1577
                                 cursor->insertBlock();
1578
 
1579
                                 textFormat.setPageBreakPolicy(QTextFormat::PageBreak_Auto);
1580
                                 cursor->setBlockFormat(textFormat);
1581
                    **********************************************************/
1582
 
1583
 
228 pingvin 1584
//                    itm->setIcon(0, icon);
1585
 
1586
 
1587
                    for (int i=0; i < model_item->childCount(); i++) // ,      
1588
                    {
1589
                        QTreeWidgetItem * model_item_tmp;           //  
1590
                        QString pointer_name;
1591
                        QString filtr_tmp;
1592
                        bool pointer_isEmpty;
1593
                        model_item_tmp = model_item->child(i);      //    
1594
                        pointer_name = getPointerFieldName(classID, model_item->child(i)->text(1));
1595
                        // // // // itm->setText(4, pointer_name);
1596
 
1597
                      //  title_item->setText(4, pointer_name);
1598
 
1599
 
1600
                        pointer_isEmpty = pointer_name.isEmpty();
1601
                        filtr_tmp = tr("where ");
1602
                        filtr_tmp.append(tr("`"));
1603
                        filtr_tmp.append(pointer_name);
1604
                        filtr_tmp.append(tr("` = '"));
1605
                        filtr_tmp.append(ID_tmp);
1606
                         filtr_tmp.append(tr("'"));
229 pingvin 1607
 
1608
                         printChild(model_item_tmp, filtr_tmp, advanced,  pos+1);
1609
 
228 pingvin 1610
                        // // // // showObjects(itm,  model_item_tmp, filtr_tmp);
1611
                        //MainWindow::showObjectChildrens(ID_tmp, itm, model_item_tmp);
1612
 
1613
                    }
233 pingvin 1614
// if(pos==2) newPage(); //    ,   
228 pingvin 1615
 
1616
                }
1617
 
1618
              }
1619
 
1620
 
1621
 
1622
 
1623
 
1624
 
1625
 
1626
 
1627
 
1628
 
1629
}
1630
 
1631
 
229 pingvin 1632
void  MainWindow::newPage(int page_number){ //    
1633
 
1634
    QTextBlockFormat textFormat;
1635
           textFormat.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore);
1636
                        cursor->setBlockFormat(textFormat);
1637
 
1638
                        cursor->insertText(tr("  %1").arg(page_number));
1639
                        cursor->insertBlock();
1640
 
1641
                        textFormat.setPageBreakPolicy(QTextFormat::PageBreak_Auto);
1642
                        cursor->setBlockFormat(textFormat);
1643
 
1644
 
1645
}
1646
void  MainWindow::newPage(){ //    
1647
 
1648
    QTextBlockFormat textFormat;
1649
           textFormat.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore);
1650
                        cursor->setBlockFormat(textFormat);
1651
 
1652
                        //cursor->insertText(tr("  %1").arg(page_number));
1653
                        cursor->insertBlock();
1654
 
1655
                        textFormat.setPageBreakPolicy(QTextFormat::PageBreak_Auto);
1656
                        cursor->setBlockFormat(textFormat);
1657
 
1658
 
1659
}
230 pingvin 1660
 
1661
QList<TField> MainWindow::getFieldList(QString class_id){//    
1662
 
1663
    QSqlQuery q;
1664
    QString sql_str;
1665
    QList<TField> result_list;
1666
 
1667
    int field_id, field_name, field_alias, field_type, field_default_value, field_classIdentifer, field_comment;
1668
 
1669
    bool ok;
1670
    sql_str = tr("select * "
1671
                 " from `DescriptionOfClasses` where  `DescriptionOfClasses`.`ClassIdentifer` = "       //      -   
1672
                 );
1673
 
1674
    sql_str.append(tr("'"));
1675
    sql_str.append(class_id);
1676
    sql_str.append(tr("' "));
1677
    ok = q.prepare(sql_str);
1678
 
1679
    ok = q.exec();
1680
    if (!ok) {
1681
                            QMessageBox::critical( //     .
1682
                                                                            this,                      //  .
1683
                                                                            QObject::tr("Database Error"),   // .
1684
                                                                            q.lastError().text());          //  .
1685
                                                                            return result_list;
1686
                     }
1687
 
1688
 
1689
    field_id =  q.record().indexOf(tr("ID"));
1690
    field_name =  q.record().indexOf(tr("FieldName"));
1691
    field_alias =  q.record().indexOf(tr("FieldAlias"));
1692
    field_type =  q.record().indexOf(tr("FieldType"));
1693
    field_default_value = q.record().indexOf(tr("DefaultValue"));
1694
    field_classIdentifer = q.record().indexOf(tr("ClassIdentifer"));
1695
    field_comment = q.record().indexOf(tr("Comment"));
1696
 
1697
    while(q.next()){
1698
 
1699
            TField field_tmp;
1700
            field_tmp.ID = q.value(field_id).toString();
1701
            field_tmp.FieldName = q.value(field_name).toString();
1702
            field_tmp.FieldAlias = q.value(field_alias).toString();
1703
            field_tmp.FieldType = q.value(field_type).toString();
1704
            field_tmp.DefaultValue = q.value(field_default_value).toString();
1705
            field_tmp.ClassIdentifer = q.value(field_classIdentifer).toString();
1706
            field_tmp.Comment = q.value(field_comment).toString();
1707
            result_list << field_tmp;
1708
 
1709
 
1710
 
1711
 
1712
         //    parentClassID = q.value(field_default_value).toString();
1713
         //    parentClassInctance =  getClassInctance(parentClassID);
1714
         //    result_map.insert(pointerFieldName, parentClassInctance);
1715
 
1716
 
1717
 
1718
        }
1719
 
1720
return result_list;
1721
 
1722
}
238 pingvin 1723
 
1724
 
1725
 
1726
void MainWindow::readStandartProcessOutput(){
1727
 
1728
    QTextDocument * wmiDoc = ui->textEdit_2->document();
1729
    QTextCursor * wmiCursor;
1730
    wmiCursor = new QTextCursor(wmiDoc);
1731
 
1732
    QByteArray arr;
1733
        QStringList result, fields, values;
1734
        QString str1, str2;
1735
        int i;
1736
        arr = wmiProcess.readAllStandardOutput();
1737
        QTextCodec *codecUTF = QTextCodec::codecForName("utf8");
1738
        QTextCodec *codec = QTextCodec::codecForName("cp1251");
1739
        QTextCodec::setCodecForTr(codecUTF);
1740
        str1 = QString(tr(arr));
1741
         result = str1.split("\n", QString::SkipEmptyParts);
1742
    if (result.count()>2){
1743
 
1744
 
1745
 
1746
 
1747
        QString tmp_str;
1748
        QTextTable * wmi_table;
1749
        int fields_count, row_count;
1750
            tmp_str = result.at(1);
1751
            fields = tmp_str.split("|");
1752
            fields_count =  fields.count();
1753
            row_count = result.count()-1; //   ( )   
1754
            wmi_table = wmiCursor->insertTable(row_count, fields_count);
1755
            for(int n = 0; n < fields.count(); n++) { //  "" 
1756
                *wmiCursor = wmi_table->cellAt(0, n).firstCursorPosition();
1757
                wmiCursor->insertText(fields.at(n));
1758
            }
1759
         //   tmp_str = result.at(2);
1760
         //   values = tmp_str.split("|");
1761
 
1762
 
1763
            for (int m=2; m< result.count(); m++){
1764
 
1765
                tmp_str = result.at(m);
1766
                values = tmp_str.split("|");
1767
 
1768
                for(int n = 0; n < values.count(); n++){
1769
                    *wmiCursor = wmi_table->cellAt(m-1, n).firstCursorPosition();
1770
 
1771
                   // wmiCursor->insertText(fields.at(n));
1772
                   // wmiCursor->insertText(tr(": "));
1773
                    wmiCursor->insertText(values.at(n));
1774
                   // wmiCursor->insertText(tr("\n"));
1775
 
1776
                }
1777
 
1778
 
1779
 
1780
            }
1781
 
1782
 
1783
 
1784
        }
1785
        QTextCodec::setCodecForTr(codec);
1786
 
1787
 
1788
 
1789
 
1790
 
1791
 
1792
 
1793
 
1794
 
1795
//        result = QStringList(arr);
1796
//      str2 << arr;
1797
        //i = result.size();
1798
//      str1 = result.at(0);
1799
        i++;
1800
        //lineEdit->insert(str1);
241 pingvin 1801
        all_reading = true;
238 pingvin 1802
 
1803
}
1804
 
1805
void MainWindow::readStandartProcessError(){
241 pingvin 1806
    QTextDocument * wmiDoc = ui->textEdit_2->document();
1807
    QTextCursor * wmiCursor;
1808
    wmiCursor = new QTextCursor(wmiDoc);
1809
    QString str;
1810
 
1811
    QByteArray arr;
238 pingvin 1812
        arr = wmiProcess.readAllStandardError();
241 pingvin 1813
    str = QString(tr(arr));
1814
     wmiCursor->insertText(str);
1815
     wmiCursor->insertText(tr("\n"));
238 pingvin 1816
 
1817
}
241 pingvin 1818
 
1819
 
1820
 
1821
TWmiVideoCard MainWindow::getWmiVideoGard(QString host, QString user_name, QString password){
1822
    TWmiVideoCard result;
1823
    bool ok;
242 pingvin 1824
    wmiThread.moveToThread(&wmiThread);
1825
    wmiThread.setHost(host); //  
1826
    wmiThread.setUser(user_name);//  
1827
    wmiThread.setPassword( password);
1828
    wmiThread.setWmiString(tr("select * from Win32_ComputerSystem"));
1829
    wmiThread.start(QThread::NormalPriority);
1830
    //for (;;) {if (wmiThread.isStopped()) break;}
1831
    int t;
1832
    t++;
1833
 
1834
 
1835
    ok = wmiThread.wait(10000);
241 pingvin 1836
    if (ok){
1837
        int m;
1838
        m++;
1839
    }
1840
    else {
242 pingvin 1841
        wmiThread.stop();
1842
        ok = wmiThread.wait(10000);
241 pingvin 1843
        int k;
1844
        k++;
1845
    }
1846
 
1847
    /*
1848
 
1849
    QString program = tr("wmic");
1850
    QStringList arguments;
1851
 
1852
//      arguments << tr(" -U %Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\"");
1853
 //   program.append(tr(" -U %Patr10t //192.168.0.135 \"select * from Win32_ComputerSystem\""));
1854
    program.append(tr(" -U admin --password=samba //192.168.0.101 \"select * from "));    //Win32_Product\""));
1855
    program.append(ui->comboBox_2->currentText());
1856
    program.append(tr("\""));
1857
    all_reading = false;
1858
    int i;
1859
    i++;
1860
    wmiProcess.start(program);
1861
 
1862
 
1863
 
1864
    while (!all_reading){}; //,     
1865
 
1866
*/
1867
    return result;
1868
 
1869
 }