Редакция 159 | Редакция 188 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 159 | Редакция 174 | ||
---|---|---|---|
1 | 1 | #ifndef MAINWINDOW_H
|
|
2 | 2 | #define MAINWINDOW_H
|
|
3 | 3 | ||
4 | 4 | ||
5 | 5 | //#include "mysql.h"
|
|
6 | 6 | ||
7 | 7 | #include "mymodel.h"
|
|
8 | 8 | #include "settingform.h"
|
|
9 | 9 | #include "delegate.h"
|
|
10 | 10 | ||
11 | 11 | #include <QMainWindow>
|
|
12 | 12 | #include <QStandardItemModel>
|
|
13 | 13 | #include <QStandardItem>
|
|
14 | 14 | #include <QTreeWidgetItem>
|
|
15 | 15 | #include <QTextCodec>
|
|
16 | 16 | #include <QSqlDatabase>
|
|
17 | 17 | ||
18 | 18 | #include <QtGui>
|
|
19 | 19 | #include <QString>
|
|
20 | 20 | #include <QtSql>
|
|
21 | 21 | #include <QFont>
|
|
22 | 22 | #include <QColor>
|
|
23 | 23 | #include <QItemDelegate>
|
|
24 | 24 | #include <QList>
|
|
25 | 25 | ||
26 | 26 | ||
27 | 27 | /*
|
|
28 | 28 | #include <QSqlField>
|
|
29 | 29 | #include <QSqlRecord>
|
|
30 | 30 | #include <QSqlTableModel>
|
|
31 | 31 | #include <QSqlQueryModel>
|
|
32 | 32 | #include <QTableView>
|
|
33 | 33 | #include <QSqlDriverPlugin>
|
|
34 | 34 | #include <QIcon>
|
|
35 | 35 | #include <QVariant>
|
|
36 | 36 | #include <QProcess>
|
|
37 | 37 | #include <QByteArray>
|
|
38 | 38 | */
|
|
39 | 39 | ||
40 | 40 | typedef struct Class { |
|
41 | 41 | QString name;
|
|
42 | 42 | QString ID;
|
|
43 | 43 | ||
44 | 44 | } TClass; |
|
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | 49 | namespace Ui { |
|
50 | 50 | class MainWindow; |
|
51 | 51 | }
|
|
52 | 52 | ||
53 | 53 | class MainWindow : public QMainWindow { |
|
54 | 54 | Q_OBJECT |
|
55 | 55 | public: |
|
56 | 56 | MainWindow(QWidget *parent = 0); |
|
57 | 57 | ~MainWindow(); |
|
58 | 58 | ||
59 | 59 | protected: |
|
60 | 60 | void changeEvent(QEvent *e); |
|
61 | 61 | ||
62 | 62 | private: |
|
63 | 63 | Ui::MainWindow *ui; |
|
64 | 64 | ||
65 | 65 | settingForm setFrm;
|
|
66 | 66 | //ïåðåìåííûå äëÿ ñîåäèíåíèÿ ñ áàçîé
|
|
67 | 67 | QString baseName;
|
|
68 | 68 | QString hostName;
|
|
69 | 69 | QString userName;
|
|
70 | 70 | QString password;
|
|
71 | 71 | QString tableName;
|
|
72 | 72 | ||
73 | 73 | void readSettings(); |
|
74 | 74 | void writeSettings(); |
|
75 | 75 | ||
76 | 76 | ||
77 | 77 | ||
78 | 78 | QList<QTreeWidgetItem *> root_items_list; |
|
79 | 79 | QStandardItemModel *model; |
|
80 | 80 | QStandardItem *item; |
|
81 | 81 | QTreeWidgetItem *rootItem1, *rootItem2; |
|
82 | 82 | void openBase(); |
|
83 | 83 | bool readModel(); |
|
84 | 84 | void setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row); // row - íîìåð ñòðîêè â òàáëèöå ìîäåëåé, ñîîòâåòñòâóþùèé äàííîé ìîäåëè |
|
85 | 85 | QString creatModelString(QTreeWidgetItem* model); |
|
86 | 86 | QString modelString; // ñòðîêà, îïèñûâàþùàÿ ìîäåëü ïðåäñòàâëåíèÿ |
|
87 | 87 | void addChildsString(QTreeWidgetItem *parentItem, int level); |
|
88 | 88 | ||
89 | 89 | QSqlDatabase sql;
|
|
90 | 90 | bool model_is_build; // ôëàã ãîâîðèò, ïîñòðîåíà ëè ìîäêëü (true) èëè íåò (false) |
|
91 | 91 | ||
92 | 92 | bool openDataBase(); |
|
93 | 93 | bool buildPreviewModel(QString modelName, QString rootClassID); |
|
94 | 94 | ||
95 | 95 | bool rebuildPreviewModel(QTreeWidgetItem* |
|
96 | 96 | ||
97 | 97 | ||
98 | 98 | ||
99 | 99 | ||
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | 105 | ||
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | ||
115 | 115 | ||
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | 119 | ||
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | 125 | ||
126 | 126 | ||
127 | 127 | ||
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
- | 131 | ||
- | 132 | ||
- | 133 | ||
131 | 134 | ||
132 | 135 | ||
133 | 136 | ||
134 | 137 | ||
135 | 138 | ||
136 | 139 | ||
137 | 140 | ||
138 | 141 | ||
139 | 142 | ||
140 | 143 | ||
141 | 144 | ||
142 | 145 | ||
143 | 146 | ||
144 | - | ||
- | 147 | ||
145 | 148 |