Changeset View
Changeset View
Standalone View
Standalone View
containmentactions/switchwindow/switch.h
| 1 | /* | 1 | /* | ||
|---|---|---|---|---|---|
| 2 | * Copyright 2009 by Chani Armitage <chani@kde.org> | 2 | * Copyright 2009 by Chani Armitage <chani@kde.org> | ||
| 3 | * Copyright 2018 by Eike Hein <hein@kde.org> | ||||
| 3 | * | 4 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU Library General Public License as | 6 | * it under the terms of the GNU Library General Public License as | ||
| 6 | * published by the Free Software Foundation; either version 2, or | 7 | * published by the Free Software Foundation; either version 2, or | ||
| 7 | * (at your option) any later version. | 8 | * (at your option) any later version. | ||
| 8 | * | 9 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details | 13 | * GNU General Public License for more details | ||
| 13 | * | 14 | * | ||
| 14 | * You should have received a copy of the GNU Library General Public | 15 | * You should have received a copy of the GNU Library General Public | ||
| 15 | * License along with this program; if not, write to the | 16 | * License along with this program; if not, write to the | ||
| 16 | * Free Software Foundation, Inc., | 17 | * Free Software Foundation, Inc., | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 18 | */ | 19 | */ | ||
| 19 | 20 | | |||
| 20 | #ifndef SWITCHWINDOW_HEADER | 21 | #ifndef SWITCHWINDOW_HEADER | ||
| 21 | #define SWITCHWINDOW_HEADER | 22 | #define SWITCHWINDOW_HEADER | ||
| 22 | 23 | | |||
| 23 | #include "ui_config.h" | 24 | #include "ui_config.h" | ||
| 24 | #include <plasma/containmentactions.h> | 25 | #include <plasma/containmentactions.h> | ||
| 25 | 26 | | |||
| 26 | // libtaskmanager | | |||
| 27 | #include <activityinfo.h> | | |||
| 28 | #include <tasksmodel.h> | | |||
| 29 | | ||||
| 30 | class QAction; | 27 | class QAction; | ||
| 31 | class QTimer; | | |||
| 32 | 28 | | |||
| 33 | namespace LegacyTaskManager | 29 | namespace TaskManager { | ||
| 34 | { | 30 | class ActivityInfo; | ||
| 35 | class Task; | 31 | class TasksModel; | ||
| 36 | } // namespace LegacyTaskManager | 32 | class VirtualDesktopInfo; | ||
| 33 | } | ||||
| 37 | 34 | | |||
| 38 | class SwitchWindow : public Plasma::ContainmentActions | 35 | class SwitchWindow : public Plasma::ContainmentActions | ||
| 39 | { | 36 | { | ||
| 40 | Q_OBJECT | 37 | Q_OBJECT | ||
| 41 | public: | 38 | public: | ||
| 42 | SwitchWindow(QObject* parent, const QVariantList& args); | 39 | SwitchWindow(QObject *parent, const QVariantList &args); | ||
| 43 | ~SwitchWindow() override; | 40 | ~SwitchWindow() override; | ||
| 44 | 41 | | |||
| 45 | void restore(const KConfigGroup &config) override; | 42 | void restore(const KConfigGroup &config) override; | ||
| 46 | QWidget* createConfigurationInterface(QWidget* parent) override; | 43 | QWidget* createConfigurationInterface(QWidget *parent) override; | ||
| 47 | void configurationAccepted() override; | 44 | void configurationAccepted() override; | ||
| 48 | void save(KConfigGroup &config) override; | 45 | void save(KConfigGroup &config) override; | ||
| 49 | 46 | | |||
| 50 | void performNextAction() override; | 47 | void performNextAction() override; | ||
| 51 | void performPreviousAction() override; | 48 | void performPreviousAction() override; | ||
| 52 | void doSwitch(bool up); | 49 | void doSwitch(bool up); | ||
| 53 | QList<QAction*> contextualActions() override; | 50 | QList<QAction *> contextualActions() override; | ||
| 54 | 51 | | |||
| 55 | private: | 52 | private: | ||
| 56 | void makeMenu(); | 53 | void makeMenu(); | ||
| 57 | 54 | | |||
| 58 | private Q_SLOTS: | 55 | private Q_SLOTS: | ||
| 59 | void clearWindowsOrder(); | | |||
| 60 | void switchTo(QAction *action); | 56 | void switchTo(QAction *action); | ||
| 61 | 57 | | |||
| 62 | private: | 58 | private: | ||
| 63 | enum MenuMode { | 59 | enum MenuMode { | ||
| 64 | AllFlat = 0, | 60 | AllFlat = 0, | ||
| 65 | DesktopSubmenus, | 61 | DesktopSubmenus, | ||
| 66 | CurrentDesktop | 62 | CurrentDesktop | ||
| 67 | }; | 63 | }; | ||
| 68 | 64 | | |||
| 69 | QList <QAction *> m_actions; | 65 | QList<QAction *> m_actions; | ||
| 70 | TaskManager::ActivityInfo *m_activityInfo; | | |||
| 71 | TaskManager::TasksModel *m_tasksModel; | | |||
| 72 | Ui::Config m_ui; | 66 | Ui::Config m_ui; | ||
| 73 | MenuMode m_mode; | 67 | MenuMode m_mode; | ||
| 74 | QTimer *m_clearOrderTimer; | 68 | | ||
| 75 | QList<WId> m_windowsOrder; | 69 | TaskManager::VirtualDesktopInfo* m_virtualDesktopInfo; | ||
| 70 | | ||||
| 71 | static TaskManager::ActivityInfo *s_activityInfo; | ||||
| 72 | static TaskManager::TasksModel *s_tasksModel; | ||||
| 73 | static int s_instanceCount; | ||||
| 76 | }; | 74 | }; | ||
| 77 | 75 | | |||
| 78 | #endif | 76 | #endif | ||