]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiApplication.h
* GuiApplication.C (GuiApplication): make sure that the Qtranslator
[lyx.git] / src / frontends / qt4 / GuiApplication.h
1 /**
2  * \file qt4/GuiApplication.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author unknown
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef QT4_APPLICATION_H
14 #define QT4_APPLICATION_H
15
16 #include "ColorCache.h"
17 #include "GuiFontLoader.h"
18 #include "GuiClipboard.h"
19 #include "GuiImplementation.h"
20 #include "GuiSelection.h"
21
22 #include "frontends/Application.h"
23
24 #include <QApplication>
25 #include <QTranslator>
26
27 namespace lyx {
28
29 class BufferView;
30 class socket_callback;
31
32 namespace frontend {
33
34 class GuiWorkArea;
35
36 /// The Qt main application class
37 /**
38 There should be only one instance of this class. No Qt object
39 initialisation should be done before the instanciation of this class.
40
41 \todo The work areas handling could be moved to a base virtual class
42 comon to all frontends.
43 */
44 class GuiApplication : public QApplication, public Application
45 {
46         Q_OBJECT
47
48 public:
49         GuiApplication(int & argc, char ** argv);
50         ///
51         virtual ~GuiApplication();
52
53         /// Method inherited from \c Application class
54         //@{
55         virtual Clipboard& clipboard();
56         virtual Selection& selection();
57         virtual FontLoader & fontLoader() { return font_loader_; }
58         virtual int const exec();
59         virtual Gui & gui() { return gui_; }
60         virtual void exit(int status);
61         virtual bool event(QEvent * e);
62         void syncEvents();
63         virtual std::string const romanFontName();
64         virtual std::string const sansFontName();
65         virtual std::string const typewriterFontName();
66         virtual bool getRgbColor(LColor_color col, lyx::RGBColor & rgbcol);
67         virtual std::string const hexName(LColor_color col);
68         virtual void updateColor(LColor_color col);
69         virtual void registerSocketCallback(
70                 int fd, boost::function<void()> func);
71         void unregisterSocketCallback(int fd);
72         //@}
73
74         ///
75         ColorCache & colorCache() { return color_cache_; }
76         ///
77         ///
78         GuiFontLoader & guiFontLoader() { return font_loader_; }
79
80 private Q_SLOTS:
81         ///
82         void execBatchCommands();
83
84 private:
85         ///
86         GuiImplementation gui_;
87         ///
88         GuiClipboard clipboard_;
89         ///
90         GuiSelection selection_;
91         ///
92         GuiFontLoader font_loader_;
93         ///
94         ColorCache color_cache_;
95         ///
96         QTranslator qt_trans_;
97         ///
98         std::map<int, boost::shared_ptr<socket_callback> > socket_callbacks_;
99
100 #ifdef Q_WS_X11
101 public:
102         bool x11EventFilter (XEvent * ev);
103 #endif
104
105 }; // GuiApplication
106
107 extern GuiApplication * guiApp;
108
109 } // namespace frontend
110
111 } // namespace lyx
112
113
114 #endif // QT4_APPLICATION_H