File indexing completed on 2024-04-28 15:39:47

0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
0002 
0003    SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #ifndef SHORTCUTMANAGER_H
0006 #define SHORTCUTMANAGER_H
0007 
0008 #include <QList>
0009 #include <QPair>
0010 #include <QSet>
0011 
0012 class QDockWidget;
0013 class QLabel;
0014 class QWidget;
0015 
0016 namespace AnnotationDialog
0017 {
0018 
0019 typedef QPair<QDockWidget *, QWidget *> DockPair;
0020 
0021 /**
0022  * This class is to help set up the right shortcuts for the annotation dialog.
0023  * The are two problems with KDE's default shortcuts:
0024  * (1) There is a bug in Qt, so that shortcuts are actually not set up for
0025  * QDockWidgets. (This might be fixed when you read this, of course)
0026  * (2) KDE's shortcut handling does of course not know anything about the
0027  * annotation dialog, and may therefore not set up an optiomal set of
0028  * shortcuts.
0029  * This class ensures that each of the list selects (which are what the
0030  * user will use the most) will get shortcuts assigned first, and then the
0031  * other widgets will.
0032  */
0033 class ShortCutManager
0034 {
0035 public:
0036     void addDock(QDockWidget *dock, QWidget *buddy);
0037     void addLabel(QLabel *label);
0038     void setupShortCuts();
0039     void addTaken(const QString &);
0040 
0041 private:
0042     QList<DockPair> m_docks;
0043     QList<QLabel *> m_labelWidgets;
0044     QSet<QChar> m_taken;
0045 };
0046 
0047 }
0048 
0049 #endif /* SHORTCUTMANAGER_H */
0050 
0051 // vi:expandtab:tabstop=4 shiftwidth=4: