Subversion Repositories OpenInventory

Rev

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