QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RSingleApplication.h
Go to the documentation of this file.
1 #ifndef RSINGLEAPPLICATION_H
2 #define RSINGLEAPPLICATION_H
3 
4 #include <QApplication>
5 #include <QMetaType>
6 #include <QMutex>
7 
8 class RLocalPeer;
9 
10 class RSingleApplication : public QApplication {
11  Q_OBJECT
12 
13 public:
14  RSingleApplication(int& argc, char **argv, bool GUIenabled = true);
15  RSingleApplication(const QString& id, int& argc, char **argv, bool GUIenabled = true);
16  RSingleApplication(int& argc, char **argv, Type type);
17 #if defined(Q_WS_X11)
18  RSingleApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
19  RSingleApplication(Display *dpy, int& argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
20  RSingleApplication(Display* dpy, const QString& appId, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
21 #endif
22 
24 
25  bool isRunning();
26  QString id() const;
27 
28  void setActivationWindow(QWidget* aw, bool activateOnMessage = true);
29  QWidget* activationWindow() const;
30 
31  bool blockEvents();
32  void unblockEvents();
33  //bool notify(QObject* receiver, QEvent* e);
34 
35 public slots:
36  bool sendMessage(const QString& message, int timeout = 5000);
37  void activateWindow();
38 
39 #ifdef RTRIAL
40  //void showInitTrialDialog();
41  void setTrialPeriodOver();
42  void showExitTrialDialog();
43 #endif
44 
45 signals:
46  void messageReceived(const QString& message);
47  void fileOpenRequestReceived(const QString& fileName);
48 
49 protected:
50  virtual bool event(QEvent* e);
51 
52 private:
53  void sysInit(const QString& appId = QString());
55  QWidget* actWin;
56  QMutex mutexEvents;
59 };
60 
62 
63 #endif