gwenhywfar
4.6.0beta
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
gui
qt4
qt4dialogbox.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
begin : Tue Feb 16 2010
3
copyright : (C) 2010 by Martin Preuss
4
email : martin@libchipcard.de
5
6
***************************************************************************
7
* Please see toplevel file COPYING for license details *
8
***************************************************************************/
9
10
#ifdef HAVE_CONFIG_H
11
# include <config.h>
12
#endif
13
14
15
16
#include "
qt4dialogbox.hpp
"
17
#include "
qt4_gui_dialog.hpp
"
18
19
#include <QCloseEvent>
20
21
#include <gwenhywfar/debug.h>
22
23
24
25
26
QT4_DialogBox::QT4_DialogBox
(
QT4_GuiDialog
*dialog,
27
QWidget *parent,
28
bool
modal,
29
Qt::WindowFlags f)
30
:QDialog(parent, f)
31
,_dialog(dialog)
32
{
33
setModal(modal);
34
}
35
36
37
38
QT4_DialogBox::~QT4_DialogBox
() {
39
}
40
41
42
43
void
QT4_DialogBox::accept
() {
44
QDialog::accept();
45
}
46
47
48
49
void
QT4_DialogBox::reject
() {
50
QDialog::reject();
51
}
52
53
54
55
int
QT4_DialogBox::cont
() {
56
return
exec();
57
}
58
59
60
61
void
QT4_DialogBox::closeEvent
(QCloseEvent *e){
62
if
(
_dialog
) {
63
int
rv;
64
65
rv=
GWEN_Dialog_EmitSignal
(
_dialog
->
getCInterface
(),
GWEN_DialogEvent_TypeClose
,
""
);
66
if
(rv!=
GWEN_DialogEvent_ResultReject
) {
67
e->accept();
68
}
69
}
70
else
{
71
e->accept();
72
}
73
}
74
75
76
77
void
QT4_DialogBox::unlinkFromDialog
() {
78
_dialog
=
NULL
;
79
}
80
81
82
83
void
QT4_DialogBox::slotActivated
() {
84
const
QObject *snd;
85
86
snd=sender();
87
if
(snd) {
88
GWEN_WIDGET
*w;
89
const
char
*wname;
90
int
rv=
GWEN_DialogEvent_ResultNotHandled
;
91
92
w=
GWEN_Dialog_FindWidgetByImplData
(
_dialog
->
getCInterface
(),
QT4_DIALOG_WIDGET_REAL
, snd);
93
if
(w==
NULL
) {
94
DBG_INFO
(0,
"Widget not found"
);
95
return
;
96
}
97
wname=
GWEN_Widget_GetName
(w);
98
99
DBG_INFO
(
GWEN_LOGDOMAIN
,
"Command for [%s] (type: %s)"
,
100
wname?wname:
"(unnamed)"
,
101
GWEN_Widget_Type_toString
(
GWEN_Widget_GetType
(w)));
102
103
switch
(
GWEN_Widget_GetType
(w)) {
104
case
GWEN_Widget_TypeUnknown
:
105
case
GWEN_Widget_TypeNone
:
106
break
;
107
108
case
GWEN_Widget_TypePushButton
:
109
case
GWEN_Widget_TypeLineEdit
:
110
case
GWEN_Widget_TypeComboBox
:
111
case
GWEN_Widget_TypeListBox
:
112
case
GWEN_Widget_TypeCheckBox
:
113
case
GWEN_Widget_TypeLabel
:
114
case
GWEN_Widget_TypeTextEdit
:
115
case
GWEN_Widget_TypeSpinBox
:
116
rv=
GWEN_Dialog_EmitSignal
(
GWEN_Widget_GetDialog
(w),
117
GWEN_DialogEvent_TypeActivated
,
118
GWEN_Widget_GetName
(w));
119
break
;
120
case
GWEN_Widget_TypeRadioButton
:
121
case
GWEN_Widget_TypeProgressBar
:
122
case
GWEN_Widget_TypeGroupBox
:
123
case
GWEN_Widget_TypeHSpacer
:
124
case
GWEN_Widget_TypeVSpacer
:
125
case
GWEN_Widget_TypeHLayout
:
126
case
GWEN_Widget_TypeVLayout
:
127
case
GWEN_Widget_TypeGridLayout
:
128
case
GWEN_Widget_TypeDialog
:
129
case
GWEN_Widget_TypeTabBook
:
130
case
GWEN_Widget_TypeTabPage
:
131
case
GWEN_Widget_TypeScrollArea
:
132
case
GWEN_Widget_TypeWidgetStack
:
133
case
GWEN_Widget_TypeHLine
:
134
case
GWEN_Widget_TypeVLine
:
135
case
GWEN_Widget_TypeTextBrowser
:
136
/* nothing to do for these types */
137
;
138
}
139
140
if
(rv==
GWEN_DialogEvent_ResultAccept
) {
141
accept
();
142
}
143
else
if
(rv==
GWEN_DialogEvent_ResultReject
) {
144
reject
();
145
}
146
}
147
}
148
149
150
151
void
QT4_DialogBox::slotValueChanged
() {
152
const
QObject *snd;
153
154
snd=sender();
155
if
(snd) {
156
GWEN_WIDGET
*w;
157
const
char
*wname;
158
int
rv=
GWEN_DialogEvent_ResultNotHandled
;
159
160
w=
GWEN_Dialog_FindWidgetByImplData
(
_dialog
->
getCInterface
(),
QT4_DIALOG_WIDGET_REAL
, snd);
161
if
(w==
NULL
) {
162
DBG_INFO
(0,
"Widget not found"
);
163
return
;
164
}
165
wname=
GWEN_Widget_GetName
(w);
166
167
DBG_INFO
(
GWEN_LOGDOMAIN
,
"ValueChanged for [%s] (type: %s)"
,
168
wname?wname:
"(unnamed)"
,
169
GWEN_Widget_Type_toString
(
GWEN_Widget_GetType
(w)));
170
171
switch
(
GWEN_Widget_GetType
(w)) {
172
case
GWEN_Widget_TypeUnknown
:
173
case
GWEN_Widget_TypeNone
:
174
break
;
175
176
case
GWEN_Widget_TypePushButton
:
177
case
GWEN_Widget_TypeLineEdit
:
178
case
GWEN_Widget_TypeComboBox
:
179
case
GWEN_Widget_TypeListBox
:
180
case
GWEN_Widget_TypeCheckBox
:
181
case
GWEN_Widget_TypeLabel
:
182
case
GWEN_Widget_TypeTextEdit
:
183
case
GWEN_Widget_TypeSpinBox
:
184
rv=
GWEN_Dialog_EmitSignal
(
GWEN_Widget_GetDialog
(w),
185
GWEN_DialogEvent_TypeValueChanged
,
186
GWEN_Widget_GetName
(w));
187
break
;
188
189
case
GWEN_Widget_TypeRadioButton
:
190
case
GWEN_Widget_TypeProgressBar
:
191
case
GWEN_Widget_TypeGroupBox
:
192
case
GWEN_Widget_TypeHSpacer
:
193
case
GWEN_Widget_TypeVSpacer
:
194
case
GWEN_Widget_TypeHLayout
:
195
case
GWEN_Widget_TypeVLayout
:
196
case
GWEN_Widget_TypeGridLayout
:
197
case
GWEN_Widget_TypeDialog
:
198
case
GWEN_Widget_TypeTabBook
:
199
case
GWEN_Widget_TypeTabPage
:
200
case
GWEN_Widget_TypeScrollArea
:
201
case
GWEN_Widget_TypeWidgetStack
:
202
case
GWEN_Widget_TypeHLine
:
203
case
GWEN_Widget_TypeVLine
:
204
case
GWEN_Widget_TypeTextBrowser
:
205
/* nothing to do for these types */
206
;
207
}
208
209
if
(rv==
GWEN_DialogEvent_ResultAccept
) {
210
accept
();
211
}
212
else
if
(rv==
GWEN_DialogEvent_ResultReject
) {
213
reject
();
214
}
215
}
216
}
217
218
219
220
#include "qt4dialogbox.moc"
221
222
223
Generated on Wed May 29 2013 05:31:48 for gwenhywfar by
1.8.3.1