Subversion Repositories OpenInventory

Rev

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