File indexing completed on 2024-05-12 17:07:40
0001 /* 0002 SPDX-FileCopyrightText: 2020 Carson Black <uhhadd@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include <QList> 0008 #include <QMap> 0009 #include <QString> 0010 0011 // Curating key data 0012 // ================= 0013 // 0014 // There are two main goals with key data here: 0015 // - to allow users to input letters related to but not in their keyboard language (e.g. Persian glyphs on top of the Arabic set) 0016 // - to allow users to input useful symbols, such as proper arithmetic symbols and various dashes 0017 // 0018 // The former generally is used for letters, while the latter is generally used for punctuation and numbers 0019 // 0020 // Latin Letters: 0021 // 0022 // Generally, these are going to be diacritics (a + ` = à) or diagraphs (a + e = æ). 0023 // Letters should be roughly ordered first by amount of speakers of languages that use them, 0024 // and then by commonality in languages as a secondary factor. For example, the character å is 0025 // found mostly in northern Germanic languages, which don't have nearly as many speakers as 0026 // romance languages such as Spanish, which has á. For this reason, á should be ordered before å. 0027 // Rinse and repeat this process until all the variants you want to offer are well placed. 0028 // 0029 // Cyrilic Letters: 0030 // 0031 // The same principles as Latin letters apply here. For example, the character ҝ (Ka with a vertical stroke; Azerbaijani) 0032 // is found in a much less common language than қ (Ka with a descender; many languages found in former Soviet Union territories) 0033 // so it should be placed after қ in the list of options for к (Ka; lot of languages) 0034 // 0035 // Arabic characters: 0036 // 0037 // Same deal as Latin and Cyrilic, except now it's going to render poorly in your text editors. 0038 // Most of these characters only have one alternate form, mostly to add some extra diacritics 0039 // in order to use a less common form or a form not found in Arabic, e.g. Persian پ from Arabic ب. 0040 // Alef is a special case here, as it has a lot of "variants" in common use. For example, there's the 0041 // alef with a hamza sitting on it (ا + ʾ = أ) or a hamza sitting below it (إ). These can be inputted 0042 // as diagraphs on keyboards, but can also be represented as a held-key variant of alef for input purposes. 0043 // 0044 // Hebrew characters: 0045 // 0046 // The characters here are the iffiest of the selection, since most don't add anything new to input, just a 0047 // "convenience" way for inputting characters with a ׳ added, when you can already type it without extra modifiers. 0048 // However, we're still having them there since they're a logical "variant" of the characters they're for. 0049 // 0050 // On the other hand, the ײַ ײ ױ װ work as held keys to offer a meaningful alternative to other methods of inputting 0051 // them, since these typically require the usage of AltGr to input on most Hebrew keyboards. 0052 // 0053 // Numbers: 0054 // 0055 // These are mostly exponents and fractions. Their ordering should be self explanatory. 0056 // 0057 // Symbols: 0058 // 0059 // These are mostly things that look like the key being held, with the exception 0060 // of ^ being used for directional arrows. 0061 // 0062 0063 namespace KeyData 0064 { 0065 const QMap<QString, QList<QString>> KeyMappings = { 0066 // 0067 // Latin 0068 // 0069 {"a", {"à", "á", "â", "ä", "æ", "ã", "å", "ā"}}, 0070 {"c", {"ç", "ć", "č"}}, 0071 {"d", {"ð"}}, 0072 {"e", {"è", "é", "ê", "ë", "ē", "ė", "ę", "ə"}}, 0073 {"g", {"ğ"}}, 0074 {"i", {"î", "ï", "í", "ī", "į", "ì", "ı"}}, 0075 {"l", {"ł"}}, 0076 {"n", {"ñ", "ń"}}, 0077 {"o", {"ô", "ö", "ò", "ó", "œ", "ø", "ō", "õ"}}, 0078 {"s", {"ß", "ś", "š", "ş"}}, 0079 {"u", {"û", "ü", "ù", "ú", "ū"}}, 0080 {"x", {"×"}}, 0081 {"y", {"ÿ", "ұ", "ү", "ӯ", "ў"}}, 0082 {"z", {"ž", "ź", "ż"}}, 0083 // 0084 // Cyrilic 0085 // 0086 {"г", {"ғ"}}, 0087 {"е", {"ё"}}, // this in fact NOT the same E as before 0088 {"и", {"ӣ", "і"}}, // і is not i 0089 {"й", {"ј"}}, // ј is not j 0090 {"к", 0091 { 0092 "қ", 0093 "ҝ", 0094 }}, 0095 {"н", {"ң", "һ"}}, // һ is not h 0096 {"о", {"ә", "ө"}}, 0097 {"ч", {"ҷ", "ҹ"}}, 0098 {"ь", {"ъ"}}, 0099 // 0100 // Arabic 0101 // 0102 // This renders weirdly in text editors, but is valid code. 0103 {"ا", {"أ", "إ", "آ", "ء"}}, 0104 {"ب", {"پ"}}, 0105 {"ج", {"چ"}}, 0106 {"ز", {"ژ"}}, 0107 {"ف", {"ڤ"}}, 0108 {"ك", {"گ"}}, 0109 {"ل", {"لا"}}, 0110 {"ه", {"ه"}}, 0111 {"و", {"ؤ"}}, 0112 // 0113 // Hebrew 0114 // 0115 // Likewise, this will render oddly, but is still valid code. 0116 {"ג", {"ג׳"}}, 0117 {"ז", {"ז׳"}}, 0118 {"ח", {"ח׳"}}, 0119 {"צ׳", {"צ׳"}}, 0120 {"ת", {"ת׳"}}, 0121 {"י", {"ײַ"}}, 0122 {"י", {"ײ"}}, 0123 {"ח", {"ױ"}}, 0124 {"ו", {"װ"}}, 0125 // 0126 // Numbers 0127 // 0128 {"0", {"∅", "ⁿ", "⁰"}}, 0129 {"1", {"¹", "½", "⅓", "¼", "⅕", "⅙", "⅐", "⅛", "⅑", "⅒"}}, 0130 {"2", {"²", "⅖", "⅔"}}, 0131 {"3", {"³", "⅗", "¾", "⅜"}}, 0132 {"4", {"⁴", "⅘", "⁵", "⅝", "⅚"}}, 0133 {"5", {"⁵", "⅝", "⅚"}}, 0134 {"6", {"⁶"}}, 0135 {"7", {"⁷", "⅞"}}, 0136 {"8", {"⁸"}}, 0137 {"9", {"⁹"}}, 0138 // 0139 // Punctuation 0140 // 0141 {R"(-)", {"—", "–", "·"}}, 0142 {R"(?)", {"¿", "‽"}}, 0143 {R"(')", {"‘", "’", "‚", "‹", "›"}}, 0144 {R"(!)", {"¡"}}, 0145 {R"(")", {"“", "”", "„", "«", "»"}}, 0146 {R"(/)", {"÷"}}, 0147 {R"(#)", {"№"}}, 0148 {R"(%)", {"‰", "℅"}}, 0149 {R"(^)", {"↑", "←", "→", "↓"}}, 0150 {R"(+)", {"±"}}, 0151 {R"(<)", {"«", "≤", "‹", "⟨"}}, 0152 {R"(=)", {"∞", "≠", "≈"}}, 0153 {R"(>)", {"⟩", "»", "≥", "›"}}, 0154 // 0155 // Currency 0156 // 0157 {"$", {"¢", "€", "£", "¥", "₹", "₽", "₺", "₩", "₱", "₿"}}, 0158 }; 0159 0160 }