Subversion Repositories OpenInventory

Rev

Rev 241 | Rev 243 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
88 pingvin 1
#ifndef MAINWINDOW_H
2
#define MAINWINDOW_H
3
 
93 pingvin 4
 
5
//#include "mysql.h"
109 pingvin 6
 
127 pingvin 7
#include "mymodel.h"
132 pingvin 8
#include "settingform.h"
124 pingvin 9
#include "delegate.h"
200 pingvin 10
// #include "fileform.h"
209 pingvin 11
#include "treedelegateform.h"
241 pingvin 12
#include "wmithread.h"
124 pingvin 13
 
88 pingvin 14
#include <QMainWindow>
15
#include <QStandardItemModel>
16
#include <QStandardItem>
17
#include <QTreeWidgetItem>
18
#include <QTextCodec>
89 pingvin 19
#include <QSqlDatabase>
88 pingvin 20
 
89 pingvin 21
#include <QtGui>
93 pingvin 22
#include <QString>
23
#include <QtSql>
113 pingvin 24
#include <QFont>
114 pingvin 25
#include <QColor>
130 pingvin 26
#include <QItemDelegate>
147 pingvin 27
#include <QList>
222 pingvin 28
#include <QPalette>
89 pingvin 29
 
93 pingvin 30
 
222 pingvin 31
 
93 pingvin 32
/*
33
#include <QSqlField>
34
#include <QSqlRecord>
35
#include <QSqlTableModel>
36
#include <QSqlQueryModel>
37
#include <QTableView>
38
#include <QSqlDriverPlugin>
39
#include <QIcon>
40
#include <QVariant>
41
#include <QProcess>
42
#include <QByteArray>
43
*/
44
 
99 pingvin 45
typedef struct Class {
46
        QString name;
47
        QString ID;
93 pingvin 48
 
99 pingvin 49
} TClass;
93 pingvin 50
 
51
 
52
 
241 pingvin 53
typedef struct wmiVideoCard {
54
    QString name; //  
55
    QString manufacturer; // 
56
    QString model;
93 pingvin 57
 
241 pingvin 58
} TWmiVideoCard;
59
 
60
 
61
 
62
 
63
 
64
 
88 pingvin 65
namespace Ui {
66
    class MainWindow;
67
}
68
 
69
class MainWindow : public QMainWindow {
70
    Q_OBJECT
71
public:
72
    MainWindow(QWidget *parent = 0);
73
    ~MainWindow();
74
 
75
protected:
76
    void changeEvent(QEvent *e);
77
 
78
private:
79
    Ui::MainWindow *ui;
200 pingvin 80
    //FileForm fileForm;
241 pingvin 81
 
82
volatile bool all_reading;
83
 
209 pingvin 84
    TreeDelegateForm treeForm;
88 pingvin 85
 
132 pingvin 86
        settingForm setFrm;
87
//    
88
        QString baseName;
89
        QString hostName;
90
        QString userName;
91
        QString password;
92
        QString tableName;
93
 
94
        void readSettings();
95
        void writeSettings();
96
 
97
 
237 pingvin 98
    QProcess wmiProcess;
106 pingvin 99
    QList<QTreeWidgetItem *> root_items_list;
88 pingvin 100
    QStandardItemModel *model;
101
    QStandardItem *item;
102
    QTreeWidgetItem *rootItem1, *rootItem2;
89 pingvin 103
    void openBase();
104
    bool readModel();
215 pingvin 105
    void setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row, QString model_id); // row -     ,   
146 pingvin 106
    QString creatModelString(QTreeWidgetItem* model);
91 pingvin 107
    QString modelString; // ,   
108
    void addChildsString(QTreeWidgetItem *parentItem, int level);
93 pingvin 109
 
110
    QSqlDatabase sql;
118 pingvin 111
    bool model_is_build; //  ,    (true)    (false)
93 pingvin 112
 
113
    bool openDataBase();
97 pingvin 114
    bool buildPreviewModel(QString modelName, QString rootClassID);
107 pingvin 115
 
147 pingvin 116
    bool rebuildPreviewModel(QTreeWidgetItem* root_item, QString rootClassID, int row);
107 pingvin 117
 
95 pingvin 118
    QString ClassName(QString class_id); //     ID
147 pingvin 119
    void addChildsItems(QTreeWidgetItem *perent_class_item, int row); //          ,      
99 pingvin 120
    QStringList classChields(QString class_id);
102 pingvin 121
    QMap <QString, QString> getClassList(); //   
125 pingvin 122
    QMap <QString, QString> getFieldsList(QString class_id); //    
104 pingvin 123
    void initComboBox();
124
    QList<QTreeWidgetItem *> rootItems; //     ()
241 pingvin 125
    TWmiVideoCard getWmiVideoGard(QString host, QString user_name, QString password);
127 pingvin 126
 
241 pingvin 127
 
128
 
129
 
130
 
242 pingvin 131
    WmiThread wmiThread;
127 pingvin 132
    /////// QSqlTableModel * sql_mogel;
133
 
134
    MyModel  * sql_mogel;
223 pingvin 135
 ////   MyModel * filter_model;
219 pingvin 136
 
221 pingvin 137
    QSqlTableModel * filter_model;
219 pingvin 138
 
142 pingvin 139
    QSqlTableModel * model_for_ListModelsTable;
127 pingvin 140
 
142 pingvin 141
    void initListModelsTablle();
144 pingvin 142
    void readModels(); //          
142 pingvin 143
 
118 pingvin 144
    int pointer_index; // -   
145
    QString parentObject_id;
109 pingvin 146
 
115 pingvin 147
 
106 pingvin 148
    QMap <QString, QString> class_list_map;
147 pingvin 149
    QMap <int, QTreeWidgetItem*> models_items; //   ( )       
109 pingvin 150
    void getDatabaseData();
151
    void buildTree(QTreeWidgetItem * model_item);
152
    QString getClassInctance(QString class_id); //    -   
110 pingvin 153
    void showClassObjects(QTreeWidgetItem * parent_item, QTreeWidgetItem * model_item); //   
154
    void showObjectChildrens(QString object_ID, QTreeWidgetItem * object_item, QTreeWidgetItem * model_item); //   
112 pingvin 155
    void showObjects(QTreeWidgetItem * parent_object_item, QTreeWidgetItem * model_item, QString filtr);// //   
156
    QString getPointerFieldName(QString parent_class_id, QString chield_class_id); //   ,        
93 pingvin 157
 
128 pingvin 158
    QMap <QString, QString> getPointersList(QString class_id); //    -,      -
159
                                                                //      -   
147 pingvin 160
 
161
 
174 pingvin 162
    QMap <QString, QPixmap> getClassesIcons(); //     
163
                                                //     ID ,     -  
164
 
195 pingvin 165
 
166
    QMap <QString, QPixmap> getObjectsIcon(QString inctance); //     
167
    //     ID ,     -  
168
 
169
 
158 pingvin 170
    QStringList getDataFieldList(QString class_id); //     c  ""
147 pingvin 171
 
158 pingvin 172
 
173
 
174
    QStringList getBoolFieldList(QString class_id); //     c  "bool"
175
 
176
 
200 pingvin 177
    QStringList getFileFieldList(QString class_id); //    ,    "
188 pingvin 178
 
200 pingvin 179
 
222 pingvin 180
    QString getFiltrString(QString model_id, QString class_id); //  -     
200 pingvin 181
 
222 pingvin 182
 
230 pingvin 183
    QList<TField> getFieldList(QString class_id);//    
184
 
185
 
188 pingvin 186
    int getIconFieldIndex(QString inctance); //     
187
 
228 pingvin 188
 
189
    void buildReport(bool advanced); //      OpenOffice,  advanced     
190
    // QTreeWidgetItem * model_item
191
 
192
    void getReport(QTreeWidgetItem * model_item, bool advanced); //       advanced     
193
 
194
    void printChild(QTreeWidgetItem * model_item, QString filtr, bool advanced, int pos);//    
195
 
229 pingvin 196
    void newPage(int page_number);//    
197
    void newPage();//    
228 pingvin 198
 
126 pingvin 199
    SpinBoxDelegate spinDelegate;
130 pingvin 200
    QItemDelegate standart_delegate;
138 pingvin 201
    CPictureDelegate * picture_delegate;
189 pingvin 202
    IconDelegate * iconDelegate;
224 pingvin 203
    FileDelegate * fileDelegate; //     ,     
219 pingvin 204
    FilterSpinBoxDelegate filterSpinDelegate;
205
    FilterConditionDelegate filterConditionDelegate, filterConditionDelegate_1, filterConditionDelegate_2;
224 pingvin 206
    FilterValueDelegate filterValueDelegate; //     ,      
207
 
152 pingvin 208
    bool comboBox_slot_enable; //   ,   item_index  ,   
159 pingvin 209
    QList <int> boolFieldsIndexes_global; //      "BOOL"
115 pingvin 210
 
174 pingvin 211
    QMap <QString, QPixmap> classesIcons;
132 pingvin 212
 
233 pingvin 213
    QTextDocument * doc;
228 pingvin 214
    QTextCursor * cursor;
132 pingvin 215
 
216
 
217
 
106 pingvin 218
private slots:
219
    void on_comboBox_currentIndexChanged( int index );
220
    void on_treeWidget_itemChanged ( QTreeWidgetItem * item, int column );
221
    void on_treeWidget_itemClicked ( QTreeWidgetItem * item, int column );
115 pingvin 222
    void on_treeWidget_2_itemClicked ( QTreeWidgetItem * item, int column );
119 pingvin 223
    void on_pushButton_clicked(); //   " "
224
    void on_pushButton_2_clicked();//   "  "
225
    void on_pushButton_3_clicked();//   ""
226
    void on_pushButton_4_clicked();//   " "
144 pingvin 227
    void on_pushButton_5_clicked();//   "  "
228
    void on_pushButton_6_clicked();//   "  "
146 pingvin 229
    void on_pushButton_7_clicked();//   "" (  )
230
    void on_pushButton_8_clicked();//   "" (  )
217 pingvin 231
    void on_pushButton_9_clicked();//   " " (  )
232
    void on_pushButton_10_clicked();//   " " (  )
233
    void on_pushButton_11_clicked();//   "" (  )
234
    void on_pushButton_12_clicked();//   " " (  )
233 pingvin 235
    void on_pushButton_13_clicked();//   "  " (  )
236
    void on_pushButton_14_clicked();//   "  " (  )
237
    void on_pushButton_15_clicked();//   "" (  )
238
    void on_pushButton_16_clicked();//   "  PDF" (  )
239
    void on_pushButton_17_clicked();//   "  OpenOffice" (  )
238 pingvin 240
    void on_pushButton_18_clicked();//   "  OpenOffice" (  )
217 pingvin 241
 
238 pingvin 242
 
119 pingvin 243
    void on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); //       
146 pingvin 244
    void on_model_for_ListModelsTable_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); //       
221 pingvin 245
    void on_filter_model_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); //       
132 pingvin 246
    void applySetting();
247
    void getSetting(); //   
238 pingvin 248
    void readStandartProcessOutput();
249
    void readStandartProcessError();
250
 
251
 
252
 
253
 
88 pingvin 254
};
255
 
105 pingvin 256
 
257
 
258
 
88 pingvin 259
#endif // MAINWINDOW_H