Subversion Repositories OpenInventory

Rev

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