Emit error signal when login fails
[situare] / src / application.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5       Henri Lampela - henri.lampela@ixonos.com
6
7    Situare is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    version 2 as published by the Free Software Foundation.
10
11    Situare is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Situare; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19    USA.
20 */
21
22 #ifndef APPLICATION_H
23 #define APPLICATION_H
24
25 #include <QApplication>
26
27 /**
28 * @brief Application class is a subclass of QApplication
29 *
30 * This class handles X11 events
31 */
32 class Application : public QApplication
33 {
34     Q_OBJECT
35
36 public:
37     /**
38     * @brief Constructor
39     *
40     * @param argc number of arguments
41     * @param argv arguments
42     */
43     Application(int &argc, char **argv);
44
45 /*******************************************************************************
46  * MEMBER FUNCTIONS AND SLOTS
47  ******************************************************************************/
48 public:
49     /**
50     * @brief Registers window
51     *
52     * @param wId window id
53     */
54     void registerWindow(WId wId);
55
56     /**
57     * @brief Unregisters window
58     *
59     * @param wId window id
60     */
61     void unregisterWindow(WId wId);
62
63 private:
64 #ifdef Q_WS_X11
65     /**
66     * @brief Return active window
67     *
68     * @param display display
69     * @param rootWindow rootwindow
70     * @return WId window id
71     */
72     WId activeDesktopWindow(Display *display, WId rootWindow);
73
74
75     /**
76     * @brief Event filter for window
77     *
78     * @param event window event
79     * @return bool Return true if you want to stop the event from being processed.
80     *         Return false for normal event dispatching
81     */
82     bool x11EventFilter(XEvent *event);
83 #endif
84
85 /*******************************************************************************
86  * SIGNALS
87  ******************************************************************************/
88 signals:
89     /**
90     * @brief Signal is emitted when full screen button must be invoked and it's hiding timer
91              cleared.
92     *
93     * Signal is emitted when user interacts with keyboard or with mouse/finger, or when the
94     * main window is exposed.
95     */
96     void showFullScreenButton();
97
98     /**
99     * @brief Emitted when topmost window is changed
100     *
101     * @param mainWindowIsTopmost True if MainWindow is the topmost window
102     */
103     void topmostWindowChanged(bool mainWindowIsTopmost);
104
105 /*******************************************************************************
106  * DATA MEMBERS
107  ******************************************************************************/
108 private:
109     bool m_topmost;             ///< Flag for topmost
110
111     QList<WId> m_windows;       ///< List of window ids
112 };
113
114 #endif // APPLICATION_H