gwenhywfar  5.10.1
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 
27  QWidget *parent,
28  bool modal,
29  Qt::WindowFlags f)
30  :QDialog(parent, f)
31  ,_dialog(dialog) {
32  setModal(modal);
33 }
34 
35 
36 
38 }
39 
40 
41 
43  QDialog::accept();
44 }
45 
46 
47 
49  QDialog::reject();
50 }
51 
52 
53 
55  return exec();
56 }
57 
58 
59 
60 void QT4_DialogBox::closeEvent(QCloseEvent *e) {
61  if (_dialog) {
62  int rv;
63 
66  e->accept();
67  }
68  }
69  else {
70  e->accept();
71  }
72 }
73 
74 
75 
77  _dialog=NULL;
78 }
79 
80 
81 
83  const QObject *snd;
84 
85  snd=sender();
86  if (snd) {
87  GWEN_WIDGET *w;
88  const char *wname;
90 
92  if (w==NULL) {
93  DBG_INFO(0, "Widget not found");
94  return;
95  }
96  wname=GWEN_Widget_GetName(w);
97 
98  DBG_INFO(GWEN_LOGDOMAIN, "Command for [%s] (type: %s)",
99  wname?wname:"(unnamed)",
101 
102  switch(GWEN_Widget_GetType(w)) {
105  break;
106 
118  break;
135  /* nothing to do for these types */
136  ;
137  }
138 
140  accept();
141  }
142  else if (rv==GWEN_DialogEvent_ResultReject) {
143  reject();
144  }
145  }
146 }
147 
148 
149 
151  const QObject *snd;
152 
153  snd=sender();
154  if (snd) {
155  GWEN_WIDGET *w;
156  const char *wname;
158 
160  if (w==NULL) {
161  DBG_INFO(0, "Widget not found");
162  return;
163  }
164  wname=GWEN_Widget_GetName(w);
165 
166  DBG_INFO(GWEN_LOGDOMAIN, "ValueChanged for [%s] (type: %s)",
167  wname?wname:"(unnamed)",
169 
170  switch(GWEN_Widget_GetType(w)) {
173  break;
174 
186  break;
187 
204  /* nothing to do for these types */
205  ;
206  }
207 
209  accept();
210  }
211  else if (rv==GWEN_DialogEvent_ResultReject) {
212  reject();
213  }
214  }
215 }
216 
217 
218 
219 #include "qt4dialogbox.moc"
220 
221 
222 
virtual ~QT4_DialogBox()
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition: widget.c:185
void slotValueChanged()
const char * GWEN_Widget_GetName(const GWEN_WIDGET *w)
Definition: widget.c:320
void unlinkFromDialog()
#define NULL
Definition: binreloc.c:300
#define GWEN_LOGDOMAIN
Definition: logger.h:35
void slotActivated()
QT4_GuiDialog * _dialog
GWEN_DIALOG * getCInterface()
Definition: cppdialog.cpp:162
GWEN_WIDGET * GWEN_Dialog_FindWidgetByImplData(const GWEN_DIALOG *dlg, int index, const void *ptr)
Definition: dialog.c:605
GWEN_DIALOG * GWEN_Widget_GetDialog(const GWEN_WIDGET *w)
Definition: widget.c:92
void closeEvent(QCloseEvent *e)
struct GWEN_WIDGET GWEN_WIDGET
Definition: widget_be.h:34
int GWEN_Dialog_EmitSignal(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
Definition: dialog.c:321
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:181
#define QT4_DIALOG_WIDGET_REAL
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition: widget.c:452
QT4_DialogBox(QT4_GuiDialog *dialog, QWidget *parent=0, bool modal=FALSE, Qt::WindowFlags f=0)