2017-12-02 11:46:54 +01:00
|
|
|
/* BEGIN_COMMON_COPYRIGHT_HEADER
|
|
|
|
* (c)LGPL2+
|
|
|
|
*
|
|
|
|
* LXDE-Qt - a lightweight, Qt based, desktop toolset
|
|
|
|
* https://lxqt.org/
|
|
|
|
*
|
|
|
|
* Copyright: 2015 LXQt team
|
|
|
|
* Authors:
|
|
|
|
* zjesclean@gmail.com
|
|
|
|
*
|
|
|
|
* This program or library is free software; you can redistribute it
|
|
|
|
* and/or modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU Lesser General
|
|
|
|
* Public License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
* END_COMMON_COPYRIGHT_HEADER */
|
|
|
|
|
2015-09-25 10:36:20 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QListWidget>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
2020-10-13 18:46:23 +02:00
|
|
|
namespace GlobalKeyShortcut {
|
|
|
|
class Action;
|
|
|
|
}
|
2015-09-25 10:36:20 +02:00
|
|
|
|
2020-10-13 18:46:23 +02:00
|
|
|
class AppSwitcher : public QListView
|
2015-09-25 10:36:20 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-10-13 18:46:23 +02:00
|
|
|
AppSwitcher(QWidget* parent);
|
|
|
|
|
2015-09-25 10:36:20 +02:00
|
|
|
protected:
|
2020-10-13 18:46:23 +02:00
|
|
|
void keyReleaseEvent(QKeyEvent* event) override;
|
|
|
|
void closeEvent(QCloseEvent*) override;
|
|
|
|
|
2015-09-25 10:36:20 +02:00
|
|
|
private:
|
2015-12-01 18:24:18 +01:00
|
|
|
void showSwitcher(bool forward = true);
|
|
|
|
void selectItem(bool forward = true);
|
2015-09-25 16:52:34 +02:00
|
|
|
void timer();
|
2016-02-22 13:48:24 +01:00
|
|
|
void activateWindow(WId id);
|
2020-10-13 18:46:23 +02:00
|
|
|
|
2015-09-25 10:36:20 +02:00
|
|
|
private:
|
2020-10-13 18:46:23 +02:00
|
|
|
GlobalKeyShortcut::Action* m_globalShortcut;
|
|
|
|
GlobalKeyShortcut::Action* m_globalRShortcut;
|
|
|
|
QTimer* m_timer;
|
|
|
|
int m_current = 0;
|
2015-09-25 10:36:20 +02:00
|
|
|
};
|