BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // 00005 00006 #ifndef BALL_VIEW_DIALOGS_EDITSINGLESHORTCUT_H 00007 #define BALL_VIEW_DIALOGS_EDITSINGLESHORTCUT_H 00008 00009 #ifndef BALL_VIEW_KERNEL_PREFERENCESENTRY 00010 # include <BALL/VIEW/KERNEL/preferencesEntry.h> 00011 #endif 00012 00013 #ifndef BALL_VIEW_KERNEL_SHORTCUTREGISTRY_H 00014 # include <BALL/VIEW/KERNEL/shortcutRegistry.h> 00015 #endif 00016 00017 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H 00018 # include <BALL/VIEW/KERNEL/modularWidget.h> 00019 #endif 00020 00021 #include <BALL/VIEW/UIC/ui_editSingleShortcut.h> 00022 00023 #include <QtGui/QDialog> 00024 00025 class QModelIndex; 00026 00027 namespace BALL 00028 { 00029 namespace VIEW 00030 { 00031 00035 class BALL_VIEW_EXPORT EditSingleShortcut 00036 : public QDialog, 00037 public Ui_EditSingleShortcutData 00038 { 00039 // macro needed for Qt's slot mechanism: 00040 Q_OBJECT 00041 00042 public: 00043 00045 EditSingleShortcut(QWidget* parent = NULL, const char* name = "EditSingleShortcut", Qt::WFlags fl = 0 ); 00046 00047 QKeySequence const& getKeySequence() const { return new_sequence_; } 00048 00049 void setIndex(const QModelIndex& index); 00050 void reset(); 00051 void setup(const QString& shortcut); 00052 00053 public slots: 00054 virtual void accept(); 00055 virtual void reject(); 00056 00057 protected slots: 00058 void modeChanged_(bool toggled); 00059 00060 protected: 00061 bool is_recording_; 00062 00063 unsigned int modifiers_; 00064 int key_; 00065 QKeySequence new_sequence_; 00066 00068 void setErrorText(QString error); 00069 00071 void setShortcutText(QString new_keysequence); 00072 00073 void updateText_(); 00074 void changeMode_(bool mode); 00075 00076 void keyPressEvent(QKeyEvent* evt); 00077 void keyReleaseEvent(QKeyEvent* evt); 00078 00079 void startRecording_(); 00080 void stopRecording_(); 00081 }; 00082 00083 } 00084 } 00085 00086 #endif 00087