File indexing completed on 2022-09-27 12:30:59

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Sebastian Gottfried <sebastian.gottfried@posteo.de>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KTOUCHCONTEXT_H
0008 #define KTOUCHCONTEXT_H
0009 
0010 #include <QObject>
0011 
0012 class QMenu;
0013 class QQuickView;
0014 
0015 class KActionCollection;
0016 class KMainWindow;
0017 
0018 class DataIndex;
0019 class KeyboardLayout;
0020 class KeyboardLayoutMenu;
0021 class Lesson;
0022 class XEventNotifier;
0023 
0024 class KTouchContext : public QObject
0025 {
0026     Q_OBJECT
0027     Q_PROPERTY(QString keyboardLayoutName READ keyboardLayoutName NOTIFY keyboardLayoutNameChanged)
0028     Q_PROPERTY(DataIndex* globalDataIndex READ dataIndex CONSTANT)
0029     Q_PROPERTY(bool keyboardKCMAvailable READ keyboardKCMAvailable CONSTANT)
0030 public:
0031     explicit KTouchContext(KMainWindow* mainWindow, QQuickView* view, QObject* parent = 0);
0032     ~KTouchContext() override;
0033     QString keyboardLayoutName() const;
0034     DataIndex* dataIndex();
0035     bool keyboardKCMAvailable();
0036     Q_INVOKABLE void showMenu(int xPos, int yPos);
0037     Q_INVOKABLE Lesson* createLesson();
0038 public slots:
0039     void showResourceEditor();
0040     void showKeyboardKCM();
0041     bool showCustomLessonDialog(Lesson* lesson, KeyboardLayout* keyboardLayout);
0042 private slots:
0043     void showConfigDialog();
0044     void configureShortcuts();
0045     void setFullscreen(bool fullscreen);
0046 signals:
0047     void keyboardLayoutNameChanged();
0048 private:
0049     void init();
0050     bool testKCMAvailibility(const QString& name);
0051     KActionCollection* m_actionCollection;
0052     QMenu* m_menu;
0053     KMainWindow* m_mainWindow;
0054     QQuickView* m_view;
0055 #ifdef KTOUCH_BUILD_WITH_X11
0056     XEventNotifier* m_XEventNotifier;
0057 #endif
0058 };
0059 
0060 #endif // KTOUCHCONTEXT_H