]> git.sesse.net Git - kdenlive/blobdiff - src/unicodedialog.cpp
const'ify when necessary
[kdenlive] / src / unicodedialog.cpp
index 243bd1144ab86db8107543243ce9c7c52e66c087..7576c3b2c9d7258c0c05722c79984f8c7096764b 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "unicodedialog.h"
 
+#include <QWheelEvent>
+
 /// CONSTANTS
 
 const int MAX_LENGTH_HEX = 4;
@@ -40,7 +42,7 @@ UnicodeDialog::UnicodeDialog(InputMethod inputMeth) :
 
     arrowUp->setShortcut(Qt::Key_Up);
     arrowDown->setShortcut(Qt::Key_Down);
-
+    unicode_link->setText(i18n("Information about unicode characters: <a href=\"http://decodeunicode.org\">http://decodeunicode.org</a>"));
     arrowUp->setToolTip(i18n("Previous Unicode character (Arrow Up)"));
     arrowDown->setToolTip(i18n("Next Unicode character (Arrow Down)"));
     unicodeNumber->setToolTip(i18n("Enter your Unicode number here. Allowed characters: [0-9] and [a-f]."));
@@ -78,7 +80,7 @@ bool UnicodeDialog::controlCharacter(QString text)
 
     switch (inputMethod) {
     case InputHex:
-        if (t == ""
+        if (t.isEmpty()
                 || (t.length() == 1 && !(t == "9" || t == "a" || t == "d"))
                 || (t.length() == 2 && t.at(0) == QChar('1'))) {
             isControlCharacter = true;
@@ -129,7 +131,7 @@ QString UnicodeDialog::unicodeInfo(QString unicode)
     } else if (u == "a0") {
         infoText = i18n("No-break space. &amp;nbsp; in HTML. See U+2009 and U+0020.");
     } else if (u == "ab" || u == "bb" || u == "2039" || u == "203a") {
-        infoText = i18n("<p><strong>«</strong> (u+00ab, <code>&amp;lfquo;</code> in HTML) and <strong>»</strong> (u+00bb, <code>&amp;rfquo;</code> in HTML) are called Guillemets or angle quotes. Usage in different countries: «&nbsp;France&nbsp;» (with non-breaking Space 0x00a0), «Switzerland», »Germany«, »Finland and Sweden».</p><p><strong>&lsaquo;</strong> and <strong>&rsaquo;</strong> (U+2039/203a, <code>&amp;lsaquo;/&amp;rsaquo;</code>) are their single quote equivalents.</p><p>See <a href=\"http://en.wikipedia.org/wiki/Guillemets\">Wikipedia:Guillemets</a></p>");
+        infoText = i18n("<p><strong>&laquo;</strong> (u+00ab, <code>&amp;lfquo;</code> in HTML) and <strong>&raquo;</strong> (u+00bb, <code>&amp;rfquo;</code> in HTML) are called Guillemets or angle quotes. Usage in different countries: France (with non-breaking Space 0x00a0), Switzerland, Germany, Finland and Sweden.</p><p><strong>&lsaquo;</strong> and <strong>&rsaquo;</strong> (U+2039/203a, <code>&amp;lsaquo;/&amp;rsaquo;</code>) are their single quote equivalents.</p><p>See <a href=\"http://en.wikipedia.org/wiki/Guillemets\">Wikipedia:Guillemets</a></p>");
     } else if (u == "2002") {
         infoText = i18n("En Space (width of an n)");
     } else if (u == "2003") {
@@ -153,9 +155,9 @@ QString UnicodeDialog::unicodeInfo(QString unicode)
     } else if (u == "2013") {
         infoText = i18n("<p>An en Dash (dash of the width of an n).</p><p>Usage examples: In English language for value ranges (1878&#x2013;1903), for relationships/connections (Zurich&#x2013;Dublin). In the German language it is also used (with spaces!) for showing thoughts: &ldquo;Es war &#x2013; wie immer in den Ferien &#x2013; ein regnerischer Tag.</p> <p>See <a href=\"http://en.wikipedia.org/wiki/Dash\">Wikipedia:Dash</a></p>");
     } else if (u == "2014") {
-        infoText = i18n("<p>An em Dash (dash of the widht of an m).</p><p>Usage examples: In English language to mark&#x2014;like here&#x2014;thoughts. Traditionally without spaces. </p><p>See <a href=\"http://en.wikipedia.org/wiki/Dash\">Wikipedia:Dash</a></p>");
+        infoText = i18n("<p>An em Dash (dash of the width of an m).</p><p>Usage examples: In English language to mark&#x2014;like here&#x2014;thoughts. Traditionally without spaces. </p><p>See <a href=\"http://en.wikipedia.org/wiki/Dash\">Wikipedia:Dash</a></p>");
     } else if (u == "202f") {
-        infoText = i18n("<p>Narrow no-break space. Has the same width as U+2009.</p><p>Usage: For units (spaces are marked with U+2423, &#x2423;): 230&#x2423;V, &#x2212;21&#x2423;°C, 50&#x2423;lb, <em>but</em> 90° (no space). In German for abbreviations (like: i.&#x202f;d.&#x202f;R. instead of i.&#xa0;d.&#xa0;R. with U+00a0).</p><p>See <a href=\"http://de.wikipedia.org/wiki/Schmales_Leerzeichen\">Wikipedia:de:Schmales_Leerzeichen</a></p>");
+        infoText = i18n("<p>Narrow no-break space. Has the same width as U+2009.</p><p>Usage: For units (spaces are marked with U+2423, &#x2423;): 230&#x2423;V, &#x2212;21&#x2423;&deg;C, 50&#x2423;lb, <em>but</em> 90&deg; (no space). In German for abbreviations (like: i.&#x202f;d.&#x202f;R. instead of i.&#xa0;d.&#xa0;R. with U+00a0).</p><p>See <a href=\"http://de.wikipedia.org/wiki/Schmales_Leerzeichen\">Wikipedia:de:Schmales_Leerzeichen</a></p>");
     } else if (u == "2026") {
         infoText = i18n("Ellipsis: If text has been left o&#x2026; See <a href=\"http://en.wikipedia.org/wiki/Ellipsis\">Wikipedia:Ellipsis</a>");
     } else if (u == "2212") {
@@ -164,12 +166,12 @@ QString UnicodeDialog::unicodeInfo(QString unicode)
         infoText = i18n("Open box; stands for a space.");
     } else if (u == "2669") {
         infoText = i18n("Quarter note (Am.) or crochet (Brit.). See <a href=\"http://en.wikipedia.org/wiki/Quarter_note\">Wikipedia:Quarter_note</a>");
-    } else if (u == "266a") {
+    } else if (u == "266a" || u == "266b") {
         infoText = i18n("Eighth note (Am.) or quaver (Brit.). Half as long as a quarter note (U+2669). See <a href=\"http://en.wikipedia.org/wiki/Eighth_note\">Wikipedia:Eighth_note</a>");
-    } else if (u == "266b") {
-        infoText = i18n("Sixteenth note (Am.) or semiquaver (Brit.). Half as long as an eighth note (U+266a). See <a href=\"http://en.wikipedia.org/wiki/Sixteenth_note\">Wikipedia:Sixteenth_note</a>");
     } else if (u == "266c") {
-        infoText = i18n("Thirty-second note (Am.) or demisemiquaver (Brit.). Half as long as a sixteenth note (U+266b). See <a href=\"http://en.wikipedia.org/wiki/Quarter_note\">Wikipedia:Thirty-second_note</a>");
+        infoText = i18n("Sixteenth note (Am.) or semiquaver (Brit.). Half as long as an eighth note (U+266a). See <a href=\"http://en.wikipedia.org/wiki/Sixteenth_note\">Wikipedia:Sixteenth_note</a>");
+    } else if (u == "1D162") {
+        infoText = i18n("Thirty-second note (Am.) or demisemiquaver (Brit.). Half as long as a sixteenth note (U+266b). See <a href=\"http://en.wikipedia.org/wiki/Thirty-second_note\">Wikipedia:Thirty-second_note</a>");
     } else {
         infoText = i18n("<small>No additional information available for this character.</small>");
     }
@@ -208,7 +210,7 @@ void UnicodeDialog::updateOverviewChars(uint unicode)
 
     for (i = 1; i <= 4; i++) {
         if (unicode > i && !controlCharacter(unicode - i)) {
-            left = " " + left;
+            left = ' ' + left;
             left = QChar(unicode - i) + left;
         }
     }
@@ -216,7 +218,7 @@ void UnicodeDialog::updateOverviewChars(uint unicode)
     for (i = 1; i <= 8; i++) {
         if (unicode + i <= MAX_UNICODE_V1 && !controlCharacter(unicode + i)) {
             right += QChar(unicode + i);
-            right += " ";
+            right += ' ';
         }
     }
 
@@ -366,4 +368,12 @@ void UnicodeDialog::slotPrevUnicode()
     unicodeNumber->setText(nextUnicode(text, Backward));
 }
 
+void UnicodeDialog::wheelEvent(QWheelEvent * event)
+{
+    if (frame->underMouse()) {
+        if (event->delta() > 0) slotNextUnicode();
+        else slotPrevUnicode();
+    }
+}
+
 #include "unicodedialog.moc"