Subversion Repositories Scribus

Rev

Rev 23567 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13761 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
7
 
8
#ifndef PREFS_KEYBOARDSHORTCUTS_H
9
#define PREFS_KEYBOARDSHORTCUTS_H
10
 
14610 cbradney 11
#include <QMap>
12
#include <QPair>
13
#include <QString>
14
#include <QStringList>
15
#include <QKeyEvent>
16
#include <QEvent>
17
 
13761 cbradney 18
#include "ui_prefs_keyboardshortcutsbase.h"
14610 cbradney 19
#include "prefs_pane.h"
13761 cbradney 20
#include "scribusapi.h"
14610 cbradney 21
#include "scribusstructs.h"
13761 cbradney 22
 
14610 cbradney 23
 
24
class SCRIBUS_API Prefs_KeyboardShortcuts : public Prefs_Pane, Ui::Prefs_KeyboardShortcuts
13761 cbradney 25
{
26
        Q_OBJECT
27
 
28
        public:
22510 craig 29
                Prefs_KeyboardShortcuts(QWidget* parent, ScribusDoc* doc=nullptr);
13761 cbradney 30
                ~Prefs_KeyboardShortcuts();
14610 cbradney 31
 
23156 jghali 32
                void restoreDefaults(struct ApplicationPrefs *prefsData) override;
33
                void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const override;
34
 
23567 craig 35
                bool event( QEvent* ev ) override;
36
                void keyPressEvent(QKeyEvent *k) override;
37
                void keyReleaseEvent(QKeyEvent *k) override;
17864 jghali 38
 
22601 craig 39
                static QString getKeyText(const QKeySequence& KeyC);
40
                static QString getTrKeyText(const QKeySequence& KeyC);
14610 cbradney 41
 
42
        public slots:
43
                void languageChange();
44
 
45
protected:
46
        QMap<QString,Keys> keyMap;
47
        QMap<QString,Keys>::Iterator currentKeyMapRow;
48
        QMap<QString, QString> keySetList;
49
        QMap<QTreeWidgetItem*, QString> lviToActionMap;
50
        QList<QTreeWidgetItem*> lviToMenuMap;
51
        QVector< QPair<QString, QStringList> >* defMenus;
52
        QVector< QPair<QString, QStringList> >* defNonMenuActions;
24749 jghali 53
        QTreeWidgetItem * selectedLVI { nullptr };
54
        int keyCode { 0 };
14610 cbradney 55
 
56
        void insertActions();
22601 craig 57
        void importKeySet(const QString&);
58
        bool exportKeySet(const QString&);
14610 cbradney 59
        QStringList scanForSets();
17663 craig 60
        bool checkKey(int code);
61
        QString getAction(int code);
14610 cbradney 62
 
63
protected slots:
64
        void setKeyText();
65
        void dispKey(QTreeWidgetItem* current, QTreeWidgetItem* previous=0);
66
        void setNoKey();
67
        void loadKeySetFile();
68
        void importKeySetFile();
69
        void exportKeySetFile();
70
        void resetKeySet();
71
        void clearSearchString();
72
        void applySearch( const QString & newss );
13761 cbradney 73
};
74
 
75
#endif // PREFS_KEYBOARDSHORTCUTS_H