Subversion Repositories OpenInventory

Rev

Rev 112 | Rev 114 | 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
 
88 pingvin 7
#include <QMainWindow>
8
#include <QStandardItemModel>
9
#include <QStandardItem>
10
#include <QTreeWidgetItem>
11
#include <QTextCodec>
89 pingvin 12
#include <QSqlDatabase>
88 pingvin 13
 
89 pingvin 14
#include <QtGui>
93 pingvin 15
#include <QString>
16
#include <QtSql>
113 pingvin 17
#include <QFont>
89 pingvin 18
 
93 pingvin 19
 
20
/*
21
#include <QSqlField>
22
#include <QSqlRecord>
23
#include <QSqlTableModel>
24
#include <QSqlQueryModel>
25
#include <QTableView>
26
#include <QSqlDriverPlugin>
27
#include <QIcon>
28
#include <QVariant>
29
#include <QProcess>
30
#include <QByteArray>
31
*/
32
 
99 pingvin 33
typedef struct Class {
34
        QString name;
35
        QString ID;
93 pingvin 36
 
99 pingvin 37
} TClass;
93 pingvin 38
 
39
 
40
 
41
 
88 pingvin 42
namespace Ui {
43
    class MainWindow;
44
}
45
 
46
class MainWindow : public QMainWindow {
47
    Q_OBJECT
48
public:
49
    MainWindow(QWidget *parent = 0);
50
    ~MainWindow();
51
 
52
protected:
53
    void changeEvent(QEvent *e);
54
 
55
private:
56
    Ui::MainWindow *ui;
57
 
106 pingvin 58
    QList<QTreeWidgetItem *> root_items_list;
88 pingvin 59
    QStandardItemModel *model;
60
    QStandardItem *item;
61
    QTreeWidgetItem *rootItem1, *rootItem2;
89 pingvin 62
    void openBase();
63
    bool readModel();
64
    void setupModelData(const QStringList &lines, QTreeWidgetItem *parent);
91 pingvin 65
    void creatModelString();
66
    QString modelString; // ,   
67
    void addChildsString(QTreeWidgetItem *parentItem, int level);
93 pingvin 68
 
69
    QSqlDatabase sql;
70
 
71
    bool openDataBase();
97 pingvin 72
    bool buildPreviewModel(QString modelName, QString rootClassID);
107 pingvin 73
 
74
    bool rebuildPreviewModel(QTreeWidgetItem* root_item, QString rootClassID);
75
 
95 pingvin 76
    QString ClassName(QString class_id); //     ID
98 pingvin 77
    void addChildsItems(QTreeWidgetItem *perent_class_item); //          ,      
99 pingvin 78
    QStringList classChields(QString class_id);
102 pingvin 79
    QMap <QString, QString> getClassList(); //   
104 pingvin 80
    void initComboBox();
81
    QList<QTreeWidgetItem *> rootItems; //     ()
109 pingvin 82
 
106 pingvin 83
    QMap <QString, QString> class_list_map;
109 pingvin 84
    void getDatabaseData();
85
    void buildTree(QTreeWidgetItem * model_item);
86
    QString getClassInctance(QString class_id); //    -   
110 pingvin 87
    void showClassObjects(QTreeWidgetItem * parent_item, QTreeWidgetItem * model_item); //   
88
    void showObjectChildrens(QString object_ID, QTreeWidgetItem * object_item, QTreeWidgetItem * model_item); //   
112 pingvin 89
    void showObjects(QTreeWidgetItem * parent_object_item, QTreeWidgetItem * model_item, QString filtr);// //   
90
    QString getPointerFieldName(QString parent_class_id, QString chield_class_id); //   ,        
93 pingvin 91
 
106 pingvin 92
private slots:
93
    void on_comboBox_currentIndexChanged( int index );
94
    void on_treeWidget_itemChanged ( QTreeWidgetItem * item, int column );
95
    void on_treeWidget_itemClicked ( QTreeWidgetItem * item, int column );
88 pingvin 96
};
97
 
105 pingvin 98
 
99
 
100
 
88 pingvin 101
#endif // MAINWINDOW_H