]> git.sesse.net Git - kdenlive/blob - src/unicodedialog.h
clean up reindentation
[kdenlive] / src / unicodedialog.h
1 /***************************************************************************
2  *   Copyright (C) 2008 by Simon Andreas Eugster (simon.eu@gmail.com)      *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  ***************************************************************************/
9
10 #ifndef UNICODEDIALOG_H
11 #define UNICODEDIALOG_H
12
13 #include "ui_unicodedialog_ui.h"
14
15 class UnicodeDialog : public QDialog, public Ui::UnicodeDialog_UI
16 {
17     Q_OBJECT
18
19 public:
20     /** \brief The input method for the dialog. Atm only InputHex supported. */
21     enum InputMethod { InputHex, InputDec };
22
23     UnicodeDialog(InputMethod inputMeth);
24     ~UnicodeDialog();
25
26     /** \brief Returns infos about a unicode number. Extendable/improvable ;) */
27     QString unicodeInfo(QString unicode_number);
28
29     void showLastUnicode();
30
31 private:
32     Ui::UnicodeDialog_UI m_view;
33
34     enum Direction { Forward, Backward };
35
36     /** Selected input method */
37     InputMethod inputMethod;
38
39     /** \brief Validates text and removes all invalid characters (non-hex e.g.) */
40     QString validateText(QString text);
41     /** \brief Removes all leading zeros */
42     QString trimmedUnicodeNumber(QString text);
43     /** \brief Checks whether the given string is a control character */
44     bool controlCharacter(QString text);
45     /** \brief Checks whether the given uint is a control character */
46     bool controlCharacter(uint value);
47
48     /** \brief Returns the next available unicode. */
49     QString nextUnicode(QString text, Direction direction);
50
51     /** \brief Paints previous and next characters around current char */
52     void updateOverviewChars(uint unicode);
53     void clearOverviewChars();
54
55     int lastCursorPos;
56     QString lastUnicodeNumber;
57
58 signals:
59     /** \brief Contains the selected unicode character; emitted when Enter is pressed. */
60     void charSelected(const QString&);
61
62 private slots:
63     void slotTextChanged(QString text);
64     void slotReturnPressed();
65     void slotNextUnicode();
66     void slotPrevUnicode();
67
68 };
69
70 #endif