source: terepaima/terepaima-0.4.16/sources/shortcuthandler.h

desarrollostretch
Last change on this file was 1f4adec, checked in by aosorio <aosorio@…>, 8 years ago

Agregado proyecto base, esto luego del dh_make -f

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2
3Copyright 2013 Adam Reichold
4
5This file is part of qpdfview.
6
7qpdfview is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 2 of the License, or
10(at your option) any later version.
11
12qpdfview is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
19
20*/
21
22#ifndef SHORTCUTHANDLER_H
23#define SHORTCUTHANDLER_H
24
25#include <QAbstractTableModel>
26#include <QAction>
27#include <QKeySequence>
28
29class QSettings;
30
31namespace qpdfview
32{
33
34class ShortcutHandler : public QAbstractTableModel
35{
36    Q_OBJECT
37
38public:
39    static ShortcutHandler* instance();
40    ~ShortcutHandler();
41
42    void registerAction(QAction* action);
43
44    int columnCount(const QModelIndex& parent) const;
45    int rowCount(const QModelIndex& parent) const;
46
47    Qt::ItemFlags flags(const QModelIndex& index) const;
48
49    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
50
51    QVariant data(const QModelIndex& index, int role) const;
52    bool setData(const QModelIndex& index, const QVariant& value, int role);
53
54    bool matchesSkipBackward(const QKeySequence& keySequence) const;
55    bool matchesSkipForward(const QKeySequence& keySequence) const;
56
57    bool matchesMoveUp(const QKeySequence& keySequence) const;
58    bool matchesMoveDown(const QKeySequence& keySequence) const;
59    bool matchesMoveLeft(const QKeySequence& keySequence) const;
60    bool matchesMoveRight(const QKeySequence& keySequence) const;
61
62public slots:
63    bool submit();
64    void revert();
65
66    void reset();
67
68private:
69    Q_DISABLE_COPY(ShortcutHandler)
70
71    static ShortcutHandler* s_instance;
72    ShortcutHandler(QObject* parent = 0);
73
74    QSettings* m_settings;
75
76    QList< QAction* > m_actions;
77
78    QHash< QAction*, QList< QKeySequence > > m_shortcuts;
79    QHash< QAction*, QList< QKeySequence > > m_defaultShortcuts;
80
81    QAction* m_skipBackwardAction;
82    QAction* m_skipForwardAction;
83
84    QAction* m_moveUpAction;
85    QAction* m_moveDownAction;
86    QAction* m_moveLeftAction;
87    QAction* m_moveRightAction;
88
89};
90
91} // qpdfview
92
93#endif // SHORTCUTHANDLER_H
Note: See TracBrowser for help on using the repository browser.