mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-17 20:41:33 -07:00
* [Cleanup] Unused #includes Took 44 minutes * [Cleanup] More unused #includes Took 55 minutes * [Cleanup] Include QSet Took 4 minutes * [Cleanup] Include QDebug in deck_list.cpp Took 3 minutes * [Cleanup] Include protocol stuff in servatrice_database_interface.h Took 3 minutes * [Cleanup] Include QDialogButtonBox Took 8 minutes * [Cleanup] Include QUrl Took 8 minutes * [Cleanup] Include QTextOption in header. Took 3 minutes * [Cleanup] Include QMap in user_list_manager.h Took 8 minutes * [Cleanup] Adjust qjson Took 8 minutes * [Cleanup] include button box. Took 3 minutes * [Cleanup] Redo fwd declarations. * [Cleanup] Redo last removed fwd declarations. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
/**
|
|
* @file sequence_edit.h
|
|
* @ingroup UI
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef SEQUENCEEDIT_H
|
|
#define SEQUENCEEDIT_H
|
|
|
|
#include <QEvent>
|
|
#include <QLineEdit>
|
|
#include <QPushButton>
|
|
#include <QWidget>
|
|
|
|
class SequenceEdit : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit SequenceEdit(const QString &_shortcutName, QWidget *parent = nullptr);
|
|
QString getSequence();
|
|
void setShortcutName(const QString &_shortcutName);
|
|
void refreshShortcut();
|
|
void clear();
|
|
void retranslateUi();
|
|
|
|
private slots:
|
|
void removeLastShortcut();
|
|
void restoreDefault();
|
|
|
|
protected:
|
|
bool eventFilter(QObject *, QEvent *event) override;
|
|
|
|
private:
|
|
QString shortcutName;
|
|
QLineEdit *lineEdit;
|
|
QPushButton *clearButton;
|
|
QPushButton *defaultButton;
|
|
int keys = 0;
|
|
int currentKey = 0;
|
|
bool valid = false;
|
|
|
|
void processKey(QKeyEvent *e);
|
|
int translateModifiers(Qt::KeyboardModifiers state, const QString &text);
|
|
bool validateShortcut(const QKeySequence &sequence);
|
|
void finishShortcut();
|
|
void updateSettings();
|
|
};
|
|
|
|
#endif // SEQUENCEEDIT_H
|