Subversion Repositories OpenInventory

Rev

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