X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Funicodedialog.h;h=4a8579a2048955461a1f4ded227e8690b3ab093f;hb=b01ec0dcade4544f2ced655c373619c96ab163ec;hp=697cee96656d62ca2493a294d3ae529c49744774;hpb=c08d0c1b8e25e14fe7be93c3e18ec53de9f56ba4;p=kdenlive diff --git a/src/unicodedialog.h b/src/unicodedialog.h index 697cee96..4a8579a2 100644 --- a/src/unicodedialog.h +++ b/src/unicodedialog.h @@ -14,55 +14,68 @@ class UnicodeDialog : public QDialog, public Ui::UnicodeDialog_UI { - Q_OBJECT - + Q_OBJECT + public: - /** \brief The input method for the dialog. Atm only InputHex supported. */ - enum InputMethod { InputHex, InputDec }; - - UnicodeDialog(InputMethod inputMeth); - ~UnicodeDialog(); - - /** \brief Returns infos about a unicode number. Extendable/improvable ;) */ - QString unicodeInfo(QString unicode_number); - - void showLastUnicode(); + /** \brief The input method for the dialog. Atm only InputHex supported. */ + enum InputMethod { InputHex, InputDec }; + + UnicodeDialog(InputMethod inputMeth); + ~UnicodeDialog(); + + /** \brief Returns infos about a unicode number. Extendable/improvable ;) */ + QString unicodeInfo(QString unicode); + + void showLastUnicode(); + +protected: + virtual void wheelEvent(QWheelEvent * event); + +public slots: + /** \brief Override QDialog::exec() to assure the focus being on the unicode input field */ + int exec(); private: - Ui::UnicodeDialog_UI m_view; - - enum Direction { Forward, Backward }; - - /** Selected input method */ - InputMethod inputMethod; - - /** \brief Validates text and removes all invalid characters (non-hex e.g.) */ - QString validateText(QString text); - /** \brief Removes all leading zeros */ - QString trimmedUnicodeNumber(QString text); - /** \brief Checks whether the given string is a control character */ - bool controlCharacter(QString text); - /** \brief Checks whether the given uint is a control character */ - bool controlCharacter(uint value); - - /** \brief Returns the next available unicode. */ - QString nextUnicode(QString text, Direction direction); - - /** \brief Paints previous and next characters around current char */ - void updateOverviewChars(uint unicode); - - int lastCursorPos; - QString lastUnicodeNumber; + Ui::UnicodeDialog_UI m_view; + + enum Direction { Forward, Backward }; + + /** Selected input method */ + InputMethod inputMethod; + + /** \brief Validates text and removes all invalid characters (non-hex e.g.) */ + QString validateText(QString text); + /** \brief Removes all leading zeros */ + QString trimmedUnicodeNumber(QString text); + /** \brief Checks whether the given string is a control character */ + bool controlCharacter(QString text); + /** \brief Checks whether the given uint is a control character */ + bool controlCharacter(uint value); + + /** \brief Returns the next available unicode. */ + QString nextUnicode(QString text, Direction direction); + + /** \brief Paints previous and next characters around current char */ + void updateOverviewChars(uint unicode); + void clearOverviewChars(); + + int m_lastCursorPos; + QString m_lastUnicodeNumber; + + /** \brief Reads the last used unicode number from the config file. */ + void readChoices(); + /** \brief Writes the last used unicode number into the config file. */ + void writeChoices(); signals: - /** \brief Contains the selected unicode character; emitted when Enter is pressed. */ - void charSelected(const QString&); + /** \brief Contains the selected unicode character; emitted when Enter is pressed. */ + void charSelected(const QString&); private slots: - void slotTextChanged(QString text); - void slotReturnPressed(); - void slotNextUnicode(); - void slotPrevUnicode(); + void slotTextChanged(QString text); + void slotReturnPressed(); + void slotNextUnicode(); + void slotPrevUnicode(); };