Редакция 14 | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 14 | Редакция 125 | ||
---|---|---|---|
1 | #ifndef MAINWINDOWIMPL_H
|
1 | #ifndef MAINWINDOWIMPL_H
|
2 | #define MAINWINDOWIMPL_H
|
2 | #define MAINWINDOWIMPL_H
|
3 | //
|
3 | //
|
4 | #include <QtGui>
|
4 | #include <QtGui>
|
5 | #include <QMainWindow>
|
5 | #include <QMainWindow>
|
6 | #include <QString>
|
6 | #include <QString>
|
7 | #include <QtSql>
|
7 | #include <QtSql>
|
- | 8 | #include <QSqlField>
|
|
- | 9 | #include <QSqlRecord>
|
|
8 | #include <QSqlTableModel>
|
10 | #include <QSqlTableModel>
|
- | 11 | #include <QSqlQueryModel>
|
|
9 | #include <QTableView>
|
12 | #include <QTableView>
|
10 | #include <QSqlDriverPlugin>
|
13 | #include <QSqlDriverPlugin>
|
11 | #include <QIcon>
|
14 | #include <QIcon>
|
12 | #include <QVariant>
|
15 | #include <QVariant>
|
13 | #include <QProcess>
|
16 | #include <QProcess>
|
14 | #include <QByteArray>
|
17 | #include <QByteArray>
|
15 | #include "ui_mainwindow.h"
|
18 | #include "ui_mainwindow.h"
|
16 | #include "settingform.h"
|
19 | #include "settingform.h"
|
17 | #include "addmemoryform.h"
|
20 | #include "addmemoryform.h"
|
18 | #include "addotdelform.h"
|
21 | #include "addotdelform.h"
|
19 | #include "addsotrydnikform.h"
|
22 | #include "addsotrydnikform.h"
|
20 | #include "form.h"
|
23 | #include "form.h"
|
21 | //#include "addsósblockform.h"
|
24 | //#include "addsósblockform.h"
|
22 | #include "addsysblockform.h"
|
25 | #include "addsysblockform.h"
|
23 | #include "raportform.h"
|
26 | #include "raportform.h"
|
24 | - | ||
- | 27 | #include <QAbstractItemDelegate>
|
|
25 | 28 | ||
26 | 29 | ||
27 | #include <string.h>
|
30 | #include <string.h>
|
28 | 31 | ||
29 | 32 | ||
30 | 33 | ||
31 | //
|
34 | //
|
32 | 35 | ||
33 | bool myfun(void); |
36 | bool myfun(void); |
34 | /// /// bool send(void);
|
37 | /// /// bool send(void);
|
35 | bool send(int); |
38 | bool send(int); |
36 | bool connecttoregistry(void); |
39 | bool connecttoregistry(void); |
37 | bool initcomponentcontext(void); |
40 | bool initcomponentcontext(void); |
38 | 41 | ||
39 | class MainWindowImpl : public QMainWindow, public Ui::MainWindow |
42 | class MainWindowImpl : public QMainWindow, public Ui::MainWindow |
40 | {
|
43 | {
|
41 | enum type_komplektyushie {MB, HDD, CD_DVD}; |
44 | enum type_komplektyushie {MB, HDD, CD_DVD}; |
42 | typedef enum type_komplektyushie komplektyushie; |
45 | typedef enum type_komplektyushie komplektyushie; |
43 | 46 | ||
44 | enum type_currient_task_for_dblclick {no_task, select_sys_block, select_sotrydnik_for_sys_block}; |
47 | enum type_currient_task_for_dblclick {no_task, select_sys_block, select_sotrydnik_for_sys_block}; |
45 | typedef enum type_currient_task_for_dblclick currient_task_for_dblclick; |
48 | typedef enum type_currient_task_for_dblclick currient_task_for_dblclick; |
46 | 49 | ||
47 | 50 | ||
48 | 51 | ||
49 | 52 | ||
50 | Q_OBJECT |
53 | Q_OBJECT |
51 | public: |
54 | public: |
52 | MainWindowImpl( QWidget * parent = 0, Qt::WFlags f = 0 ); |
55 | MainWindowImpl( QWidget * parent = 0, Qt::WFlags f = 0 ); |
53 | ~MainWindowImpl(); |
56 | ~MainWindowImpl(); |
54 | void initTreeWidget(); |
57 | void initTreeWidget(); |
55 | 58 | ||
56 | 59 | ||
57 | private slots: |
60 | private slots: |
58 | void openBase(); |
61 | void openBase(); |
59 | void openMemoryTable(); |
62 | void openMemoryTable(); |
60 | void getSetting(); |
63 | void getSetting(); |
61 | void applySetting(); |
64 | void applySetting(); |
62 | void addString(); |
65 | void addString(); |
63 | void delString(); |
66 | void delString(); |
64 | void filter(); |
67 | void filter(); |
65 | void hiddenRow(); |
68 | void hiddenRow(); |
66 | void showRow(); |
69 | void showRow(); |
67 | void dbUpdate();//âíîñèì èçìåíåíèÿ â áàçó äàííûõ |
70 | void dbUpdate();//âíîñèì èçìåíåíèÿ â áàçó äàííûõ |
68 | void dblClick(QTreeWidgetItem *item, int column); |
71 | void dblClick(QTreeWidgetItem *item, int column); |
69 | void on_treeWidget_itemActivated(QTreeWidgetItem *item, int column); |
72 | void on_treeWidget_itemActivated(QTreeWidgetItem *item, int column); |
70 | void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column); |
73 | void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column); |
71 | void on_treeWidget_itemSelectionChanged (); |
74 | void on_treeWidget_itemSelectionChanged (); |
72 | void editTreeWidget(); |
75 | void editTreeWidget(); |
73 | void addNewOtdel();//ñîçäàåì íîâûé îòäåë |
76 | void addNewOtdel();//ñîçäàåì íîâûé îòäåë |
74 | void addNewMemory(); |
77 | void addNewMemory(); |
75 | void addNewMemory(QString inventar_num); |
78 | void addNewMemory(QString inventar_num); |
76 | void refreshTree(); |
79 | void refreshTree(); |
77 | void move_to_sklad(); |
80 | void move_to_sklad(); |
78 | void new_sotrydnik(); |
81 | void new_sotrydnik(); |
79 | void novoe_oborydovanie(); |
82 | void novoe_oborydovanie(); |
80 | void ystanovit_novie_complektyushie(); |
83 | void ystanovit_novie_complektyushie(); |
81 | void pereimenovft_otdel(); |
84 | void pereimenovft_otdel(); |
82 | void yvolit_sotrydnika(); |
85 | void yvolit_sotrydnika(); |
83 | void perevesti_sotrydnika_v_drygo1_otdel(); |
86 | void perevesti_sotrydnika_v_drygo1_otdel(); |
84 | void naznachit_otvetstvennim_za_oborydovanie(); |
87 | void naznachit_otvetstvennim_za_oborydovanie(); |
85 | void novaya_MB_na_sklad(); |
88 | void novaya_MB_na_sklad(); |
86 | void novaya_RAM_na_sklad(); |
89 | void novaya_RAM_na_sklad(); |
87 | void novaya_CPU_na_sklad(); |
90 | void novaya_CPU_na_sklad(); |
88 | void novaya_HDD_na_sklad(); |
91 | void novaya_HDD_na_sklad(); |
89 | void novaya_CD_DVD_na_sklad(); |
92 | void novaya_CD_DVD_na_sklad(); |
90 | void novaya_VIDEO_na_sklad(); |
93 | void novaya_VIDEO_na_sklad(); |
91 | void novaya_SoundCard_na_sklad(); |
94 | void novaya_SoundCard_na_sklad(); |
92 | void novaya_LAN_na_sklad(); |
95 | void novaya_LAN_na_sklad(); |
93 | void novaya_SYSTEM_BLOCK_na_sklad(); |
96 | void novaya_SYSTEM_BLOCK_na_sklad(); |
94 | void on_addmemoryForm_formClose(); |
97 | void on_addmemoryForm_formClose(); |
95 | void insert_MB_to_system_block(); |
98 | void insert_MB_to_system_block(); |
96 | void on_createButton_clicked(); |
99 | void on_createButton_clicked(); |
97 | void on_exportButton_clicked(); |
100 | void on_exportButton_clicked(); |
98 | void on_wmiButton_clicked(); |
101 | void on_wmiButton_clicked(); |
99 | void peredat_sys_block_pod_otveystvennost(); |
102 | void peredat_sys_block_pod_otveystvennost(); |
100 | void readStandartProcessOutput(); |
103 | void readStandartProcessOutput(); |
101 | void readStandartProcessError(); |
104 | void readStandartProcessError(); |
102 | 105 | ||
103 | private: |
106 | private: |
104 | //ïåðåìåííûå
|
107 | //ïåðåìåííûå
|
105 | QString baseName;
|
108 | QString baseName;
|
106 | QString hostName;
|
109 | QString hostName;
|
107 | QString userName;
|
110 | QString userName;
|
108 | QString password;
|
111 | QString password;
|
109 | QString tableName;
|
112 | QString tableName;
|
110 | 113 | ||
111 | 114 | ||
112 | 115 | ||
113 | QString component_table; // òèï êîìïîíåíòà, óñòàíàâëèâàåìíîãî â ñèñòåìíûé áëîê |
116 | QString component_table; // òèï êîìïîíåíòà, óñòàíàâëèâàåìíîãî â ñèñòåìíûé áëîê |
114 | QString component_id;// èäåíòèôèêàòîð êîìïîíåíòà, óñòàíàâëèâàåìîãî â ñèñòåìíûé áëîê |
117 | QString component_id;// èäåíòèôèêàòîð êîìïîíåíòà, óñòàíàâëèâàåìîãî â ñèñòåìíûé áëîê |
115 | QString curr_sys_block_id;
|
118 | QString curr_sys_block_id;
|
116 | bool fEnable_component_add; |
119 | bool fEnable_component_add; |
117 | bool fEnable_naznachit_otvetstv; |
120 | bool fEnable_naznachit_otvetstv; |
118 | int id_sys_block_pod_otvetstv; |
121 | int id_sys_block_pod_otvetstv; |
119 | currient_task_for_dblclick curr_task;
|
122 | currient_task_for_dblclick curr_task;
|
120 | //óêàçàòåëè íà îáúåêòû
|
123 | //óêàçàòåëè íà îáúåêòû
|
121 | settingForm *setFrm; |
124 | settingForm *setFrm; |
122 | addmemoryForm addmemFrm;
|
125 | addmemoryForm addmemFrm;
|
123 | addotdelForm addotdelFrm;
|
126 | addotdelForm addotdelFrm;
|
124 | addsotrydnikForm addsotrydnikFrm;
|
127 | addsotrydnikForm addsotrydnikFrm;
|
125 | raportForm raportFrm;
|
128 | raportForm raportFrm;
|
126 | Form wmiFrm;
|
129 | Form wmiFrm;
|
127 | 130 | ||
128 | addsysblockForm addsysblockFrm;
|
131 | addsysblockForm addsysblockFrm;
|
- | 132 | ||
129 | QSqlTableModel *model; |
133 | QSqlTableModel *model; |
130 | QSqlTableModel *memory_model; |
134 | QSqlTableModel *memory_model; |
131 | QTableView view;
|
135 | QTableView view;
|
132 | QTableView memory_view;// return res; |
136 | QTableView memory_view;// return res; |
133 | QList<QTreeWidgetItem *> items; |
137 | QList<QTreeWidgetItem *> items; |
134 | QTreeWidgetItem *itm; |
138 | QTreeWidgetItem *itm; |
135 | QTreeWidgetItem *itm1; |
139 | QTreeWidgetItem *itm1; |
136 | QTreeWidgetItem *itm_sklad_komplectyushie; |
140 | QTreeWidgetItem *itm_sklad_komplectyushie; |
137 | QTreeWidgetItem *itm_sklad_system_blocks; |
141 | QTreeWidgetItem *itm_sklad_system_blocks; |
138 | QTreeWidgetItem *itm_sklad_orgtehnika; |
142 | QTreeWidgetItem *itm_sklad_orgtehnika; |
139 | QTreeWidgetItem *itm_sklad_orgtehnika_printers; |
143 | QTreeWidgetItem *itm_sklad_orgtehnika_printers; |
140 | QTreeWidgetItem *itm_sklad_orgtehnika_mfy; |
144 | QTreeWidgetItem *itm_sklad_orgtehnika_mfy; |
141 | QTreeWidgetItem *itm_sklad_orgtehnika_scaners; |
145 | QTreeWidgetItem *itm_sklad_orgtehnika_scaners; |
142 | QTreeWidgetItem *itm_sklad_rashodniki; |
146 | QTreeWidgetItem *itm_sklad_rashodniki; |
143 | QAction *metaDataAction; |
147 | QAction *metaDataAction; |
144 | QAction *addMemoryAction; |
148 | QAction *addMemoryAction; |
145 | QAction *MB_na_skladAction; // àêöèÿ "ïåðåìåñòèòü íà ñêëàä" |
149 | QAction *MB_na_skladAction; // àêöèÿ "ïåðåìåñòèòü íà ñêëàä" |
146 | QAction *new_sotrydnikAction; |
150 | QAction *new_sotrydnikAction; |
147 | QAction *novoe_oborydovanieAction; |
151 | QAction *novoe_oborydovanieAction; |
148 | QAction *SpliterAction; |
152 | QAction *SpliterAction; |
149 | QAction *pereimenovat_otdelAction; |
153 | QAction *pereimenovat_otdelAction; |
150 | QAction *perevesti_sotrydnika_v_drygo1_otdelAction; |
154 | QAction *perevesti_sotrydnika_v_drygo1_otdelAction; |
151 | QAction *yvolit_sotrydnikaAction; |
155 | QAction *yvolit_sotrydnikaAction; |
152 | QAction *naznachit_otvetstvennim_za_oborydovanieAction; |
156 | QAction *naznachit_otvetstvennim_za_oborydovanieAction; |
153 | QAction *peredat_sys_block_pod_otveystvennostAction; |
157 | QAction *peredat_sys_block_pod_otveystvennostAction; |
154 | QAction *ystanovit_novie_complektyushieAction; |
158 | QAction *ystanovit_novie_complektyushieAction; |
155 | QAction *sozdat_otdelAction; |
159 | QAction *sozdat_otdelAction; |
156 | 160 | ||
157 | QAction *novaya_MB_na_skladAction; |
161 | QAction *novaya_MB_na_skladAction; |
158 | QAction *novaya_RAM_na_skladAction; |
162 | QAction *novaya_RAM_na_skladAction; |
159 | QAction *novaya_CPU_na_skladAction; |
163 | QAction *novaya_CPU_na_skladAction; |
160 | QAction *novaya_HDD_na_skladAction; |
164 | QAction *novaya_HDD_na_skladAction; |
161 | QAction *novaya_CD_DVD_na_skladAction; |
165 | QAction *novaya_CD_DVD_na_skladAction; |
162 | QAction *novaya_VIDEO_na_skladAction; |
166 | QAction *novaya_VIDEO_na_skladAction; |
163 | QAction *novaya_SoundCard_na_skladAction; |
167 | QAction *novaya_SoundCard_na_skladAction; |
164 | QAction *novaya_LAN_na_skladAction; |
168 | QAction *novaya_LAN_na_skladAction; |
165 | QAction *novaya_SYSTEM_BLOCK_na_skladAction; |
169 | QAction *novaya_SYSTEM_BLOCK_na_skladAction; |
166 | 170 | ||
167 | QAction *insert_MB_to_system_blockAction; //íîâûé ñèñòåìíèê íà ñêëàä |
171 | QAction *insert_MB_to_system_blockAction; //íîâûé ñèñòåìíèê íà ñêëàä |
168 | 172 | ||
169 | //ôóíêöèè
|
173 | //ôóíêöèè
|
170 | void writeSettings(); |
174 | void writeSettings(); |
171 | void readSettings(); |
175 | void readSettings(); |
172 | void SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela); // ôîðìèðóåì ñïèñîê ñîòðóäíèêîâ |
176 | void SotrydnikiOtdela(QString id_otdela, QTreeWidgetItem * itemOtdela); // ôîðìèðóåì ñïèñîê ñîòðóäíèêîâ |
173 | void addOtdels();//äîáàâëÿåì îòäåëû â treeView |
177 | void addOtdels();//äîáàâëÿåì îòäåëû â treeView |
174 | 178 | ||
175 | 179 | ||
176 | 180 | ||
177 | QString oborydovanie(QString id_sotrydnika, QTreeWidgetItem * itemSotrydnika); |
181 | QString oborydovanie(QString id_sotrydnika, QTreeWidgetItem * itemSotrydnika); |
178 | QString addMatheBoardInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
182 | QString addMatheBoardInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
179 | QString addMemoryInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
183 | QString addMemoryInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
180 | QString addCpuInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
184 | QString addCpuInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
181 | QString addHDDInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
185 | QString addHDDInformation(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
182 | QString add_CD_DVD_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
186 | QString add_CD_DVD_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
183 | QString add_Vidio_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
187 | QString add_Vidio_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
184 | QString add_Sound_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
188 | QString add_Sound_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
185 | QString add_Lan_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
189 | QString add_Lan_Card_Information(QString id_otvetstvennogo_lica, QString id_systemBlock, QTreeWidgetItem * itemSysBlock); |
186 | QString get_info_from_system_block(QString inventar_num); |
190 | QString get_info_from_system_block(QString inventar_num); |
187 | void delete_all_actions(); |
191 | void delete_all_actions(); |
188 | void add_actions_for_otdel(); |
192 | void add_actions_for_otdel(); |
189 | void add_actions_for_sklad(); |
193 | void add_actions_for_sklad(); |
190 | void add_actions_for_sotrydnik(); |
194 | void add_actions_for_sotrydnik(); |
191 | void add_actions_for_system_block(); |
195 | void add_actions_for_system_block(); |
192 | void add_actions_for_kompletyushie(); |
196 | void add_actions_for_kompletyushie(); |
193 | void add_actions_for_sklad_MB(); |
197 | void add_actions_for_sklad_MB(); |
194 | void add_actions_for_sklad_RAM(); |
198 | void add_actions_for_sklad_RAM(); |
195 | void add_actions_for_sklad_CPU(); |
199 | void add_actions_for_sklad_CPU(); |
196 | void add_actions_for_sklad_HDD(); |
200 | void add_actions_for_sklad_HDD(); |
197 | void add_actions_for_sklad_CD_DVD(); |
201 | void add_actions_for_sklad_CD_DVD(); |
198 | void add_actions_for_sklad_VIDEO(); |
202 | void add_actions_for_sklad_VIDEO(); |
199 | void add_actions_for_sklad_SoundCard(); |
203 | void add_actions_for_sklad_SoundCard(); |
200 | void add_actions_for_sklad_LAN(); |
204 | void add_actions_for_sklad_LAN(); |
201 | void add_actions_for_sklad_SB(); |
205 | void add_actions_for_sklad_SB(); |
202 | void add_actions_for_insert_MB_to_system_block(); |
206 | void add_actions_for_insert_MB_to_system_block(); |
203 | void add_actions_for_sklad_system_block(); |
207 | void add_actions_for_sklad_system_block(); |
204 | 208 | ||
205 | 209 | ||
206 | int select_system_block(); // ôóíêöèÿ âåðí¸ò èäåíòèôèêàòîð âûáðàííîãî ñèñòåìíîãî áëîêà |
210 | int select_system_block(); // ôóíêöèÿ âåðí¸ò èäåíòèôèêàòîð âûáðàííîãî ñèñòåìíîãî áëîêà |
207 | 211 | ||
208 | 212 | ||
209 | 213 | ||
210 | public: |
214 | public: |
211 | QIcon comp_icon;
|
215 | QIcon comp_icon;
|
212 | QIcon printer_icon;
|
216 | QIcon printer_icon;
|
213 | QIcon hdd_icon;
|
217 | QIcon hdd_icon;
|
214 | QIcon memory_icon;
|
218 | QIcon memory_icon;
|
215 | QIcon matheboard_icon;
|
219 | QIcon matheboard_icon;
|
216 | QIcon cpu_icon;
|
220 | QIcon cpu_icon;
|
217 | QIcon cd_dvd_icon;
|
221 | QIcon cd_dvd_icon;
|
218 | QIcon vidio_card_icon;
|
222 | QIcon vidio_card_icon;
|
219 | QIcon sound_card_icon;
|
223 | QIcon sound_card_icon;
|
220 | QIcon lan_card_icon;
|
224 | QIcon lan_card_icon;
|
221 | QSqlDatabase *pdb; |
225 | QSqlDatabase *pdb; |
222 | QSqlDatabase db;
|
226 | QSqlDatabase db;
|
223 | QProcess process;
|
227 | QProcess process;
|
224 | 228 | ||
225 | }; |
229 | }; |
226 | #endif
|
230 | #endif
|
227 | 231 | ||
228 | 232 | ||
229 | 233 | ||
230 | 234 | ||
231 | 235 |