Subversion Repositories OpenInventory

Rev

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