Subversion Repositories OpenInventory

Rev

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