1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef GLOBALACTIONS_H |
5 | #define GLOBALACTIONS_H |
6 | |
7 | #include <QtCore/QList> |
8 | #include <QtCore/QObject> |
9 | #include <QtGui/qtguiglobal.h> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QAction; |
14 | class QMenu; |
15 | |
16 | class GlobalActions : public QObject |
17 | { |
18 | Q_OBJECT |
19 | Q_DISABLE_COPY(GlobalActions) |
20 | public: |
21 | static GlobalActions *instance(QObject *parent = nullptr); |
22 | |
23 | QList<QAction *> actionList() const { return m_actionList; } |
24 | QAction *backAction() const { return m_backAction; } |
25 | QAction *nextAction() const { return m_nextAction; } |
26 | QAction *homeAction() const { return m_homeAction; } |
27 | QAction *zoomInAction() const { return m_zoomInAction; } |
28 | QAction *zoomOutAction() const { return m_zoomOutAction; } |
29 | #if QT_CONFIG(clipboard) |
30 | QAction *copyAction() const { return m_copyAction; } |
31 | #endif |
32 | QAction *printAction() const { return m_printAction; } |
33 | QAction *findAction() const { return m_findAction; } |
34 | |
35 | public slots: |
36 | #if QT_CONFIG(clipboard) |
37 | void setCopyAvailable(bool available); |
38 | #endif |
39 | void updateActions(); |
40 | |
41 | #if defined(BROWSER_QTWEBKIT) |
42 | private slots: |
43 | void slotAboutToShowBackMenu(); |
44 | void slotAboutToShowNextMenu(); |
45 | void slotOpenActionUrl(QAction *action); |
46 | #endif // BROWSER_QTWEBKIT |
47 | |
48 | private: |
49 | void setupNavigationMenus(QAction *back, QAction *next, QWidget *parent); |
50 | |
51 | private: |
52 | GlobalActions(QObject *parent); |
53 | |
54 | static GlobalActions *m_instance; |
55 | |
56 | QAction *m_backAction; |
57 | QAction *m_nextAction; |
58 | QAction *m_homeAction; |
59 | QAction *m_zoomInAction; |
60 | QAction *m_zoomOutAction; |
61 | #if QT_CONFIG(clipboard) |
62 | QAction *m_copyAction; |
63 | #endif |
64 | QAction *m_printAction; |
65 | QAction *m_findAction; |
66 | |
67 | QList<QAction *> m_actionList; |
68 | |
69 | QMenu *m_backMenu; |
70 | QMenu *m_nextMenu; |
71 | }; |
72 | |
73 | QT_END_NAMESPACE |
74 | |
75 | #endif // GLOBALACTIONS_H |
76 |