diff options
author | Vlad Pyatnichenko <partizanu3@gmail.com> | 2016-03-04 20:15:13 +0200 |
---|---|---|
committer | Vlad Pyatnichenko <partizanu3@gmail.com> | 2016-03-05 01:05:45 +0200 |
commit | 35ee984d7239244a757f77e8621d4983d08fbc6c (patch) | |
tree | e894bc3fc80fcfa538d8b586e6b9d584e47aa0a7 /singleapplication.h | |
parent | Docs now imply Linux as well (diff) | |
download | singleapplication-35ee984d7239244a757f77e8621d4983d08fbc6c.tar.xz |
Adaptation to Qt's pimpl idiom design. Improved inheritance safety.
Details:
* Improved unsafe C-style macros inheritance approach to the project-wide
DEFINES: it is unspecified in
which order source files are being preprocessed ones, so in
singleapplication.cpp the class might be inherent of default-specified
base, while in main.cpp this can be a user-provided QAPPLICATION_CLASS
definition.
* Replace Qt's pseudo-keywords to more library-independent counterparts
('emit -> Q_EMIT', etc)
* Indentation fixes (80 character column-width)
* Rearragned #include statements: from most platform-independen to more
app-specific.
* Fixed some grammar typos.
* README.md updated respectively.
Diffstat (limited to 'singleapplication.h')
-rw-r--r-- | singleapplication.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/singleapplication.h b/singleapplication.h index 1fe5c12..dc6beb3 100644 --- a/singleapplication.h +++ b/singleapplication.h @@ -1,14 +1,8 @@ #ifndef SINGLE_APPLICATION_H #define SINGLE_APPLICATION_H +#include <QtCore/QtGlobal> -// Change this to inherit from QGuiApplication or QCoreApplication -#ifndef QAPPLICATION_CLASS - #define QAPPLICATION_CLASS QCoreApplication -#endif - -#define QUOTE(C) #C -#define INCLUDE_FILE(C) QUOTE(C) -#include INCLUDE_FILE(QAPPLICATION_CLASS) +#include QT_STRINGIFY(QAPPLICATION_CLASS) class SingleApplicationPrivate; @@ -18,19 +12,25 @@ class SingleApplicationPrivate; */ class SingleApplication : public QAPPLICATION_CLASS { - Q_OBJECT + Q_OBJECT + Q_DECLARE_PRIVATE(SingleApplication) + + typedef QAPPLICATION_CLASS app_t; + public: - explicit SingleApplication(int&, char *[]); - ~SingleApplication(); + explicit SingleApplication(int&, char *[]); + ~SingleApplication(); -signals: - void showUp(); +Q_SIGNALS: + void showUp(); -private slots: - void slotConnectionEstablished(); +private Q_SLOTS: + void slotConnectionEstablished(); private: - SingleApplicationPrivate *d_ptr; + SingleApplicationPrivate *d_ptr; + + }; #endif // SINGLE_APPLICATION_H |