Subversion Repositories OpenInventory

Rev

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