File indexing completed on 2024-04-28 04:21:22

0001 // SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
0002 // SPDX-FileCopyrightText: 2021-2022 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
0003 //
0004 // SPDX-License-Identifier: GPL-2.0-or-later
0005 
0006 #ifndef KEYBOARDEVENTHANDLER_H
0007 #define KEYBOARDEVENTHANDLER_H
0008 
0009 #include "ThumbnailComponent.h"
0010 #include "enums.h"
0011 
0012 #include <QObject>
0013 
0014 class QKeyEvent;
0015 class ThumbnailFactory;
0016 
0017 namespace ThumbnailView
0018 {
0019 /**
0020  * @brief The KeyboardEventHandler class handles keyboard input for the thumbnail widget.
0021  *
0022  * Specifically, the following keyboard interactions are handled:
0023  *  - Setting and unsetting tokens on images (a-z)
0024  *  - Setting the rating for images (1-5)
0025  *  - Stopping video thumbnail cycling when Control is pressed
0026  *  - Showing the Viewer when Enter is pressed.
0027  *  - Applying filters for tokens and ratings.
0028  *  - Clearing the current filter
0029  */
0030 class KeyboardEventHandler : public QObject, public ThumbnailComponent
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     explicit KeyboardEventHandler(ThumbnailFactory *factory);
0036     bool keyPressEvent(QKeyEvent *event);
0037     bool keyReleaseEvent(QKeyEvent *);
0038 
0039 Q_SIGNALS:
0040     void showSelection();
0041     void showSearch();
0042 
0043 private:
0044 };
0045 }
0046 
0047 #endif /* KEYBOARDEVENTHANDLER_H */
0048 
0049 // vi:expandtab:tabstop=4 shiftwidth=4: