Quark  0.1
DialogClosure.h++
Go to the documentation of this file.
1 // -*- mode: c++; -*-
2 // Copyright 2011 Google Inc. All Rights Reserved.
3 // Author: mlindner@google.com (Mark Lindner)
4 
5 #ifndef __libquark_gui_DialogClosure_hxx
6 #define __libquark_gui_DialogClosure_hxx
7 
8 #include <quark/Quark.h++>
9 
10 #include <QDialog>
11 #include <QScopedPointer>
12 #include <QVariantList>
13 #include <QWidget>
14 
15 namespace quark {
16 namespace gui {
17 
20 class LIBQUARK_API DialogClosure : public QObject
21 {
22  Q_OBJECT;
23 
24  public:
25 
26  DialogClosure(QWidget *parent, QDialog *dialog);
27  ~DialogClosure();
28 
29  void setFeature(const QString &feature);
30  void setSlot(QObject *target, const char *slot,
31  const char *cancelSlot = NULL);
32  bool addSlotArg(const QVariant &arg);
33 
34  void showDialog();
35 
36  public slots:
37 
38  void handleResult(int result);
39  void handleResult(const QString &result);
40  bool invokeCancelSlot();
41 
42  private:
43 
44  bool invokeSlot(const QVariant &result);
45  QString makeTitle();
46 
47  QWidget *_parent;
48  QScopedPointer<QDialog> _dialog;
49  QString _feature;
50  QObject *_slotTarget;
51  const char *_slot;
52  const char *_cancelSlot;
53  QVariantList _slotArgs;
54 
55  Q_DISABLE_COPY(DialogClosure);
56 };
57 
60 } // namespace gui
61 } // namespace quark
62 
63 #endif // __libquark_gui_DialogClosure_hxx
Definition: BarChartView.h++:6
#define LIBQUARK_API
Definition: Quark.h++:18