85 qApp->applicationDirPath() + "/" UNIXNAME ".ini", |
85 qApp->applicationDirPath() + "/" UNIXNAME ".ini", |
86 QSettings::IniFormat |
86 QSettings::IniFormat |
87 }; |
87 }; |
88 return settings; |
88 return settings; |
89 } |
89 } |
|
90 |
|
91 QString largeNumberRep(int number) |
|
92 { |
|
93 if (number < 0) |
|
94 { |
|
95 return "-" + largeNumberRep(-number); |
|
96 } |
|
97 else |
|
98 { |
|
99 QString rep; |
|
100 |
|
101 while (number >= 1000) |
|
102 { |
|
103 rep = " " + QString::number(number % 1000); |
|
104 number /= 1000; |
|
105 } |
|
106 |
|
107 return QString::number(number) + rep; |
|
108 } |
|
109 } |
|
110 |
|
111 static const QString superscripts = "⁰¹²³⁴⁵⁶⁷⁸⁹"; |
|
112 static const QString subscripts = "₀₁₂₃₄₅₆₇₈₉"; |
|
113 |
|
114 static QString customNumberRep(int number, const QString& script, const QString& minus) |
|
115 { |
|
116 if (number < 0) |
|
117 { |
|
118 return minus + customNumberRep(-number, script, minus); |
|
119 } |
|
120 else |
|
121 { |
|
122 QString rep = ""; |
|
123 for (QChar character : QString::number(number)) |
|
124 { |
|
125 if (character >= '0' and character <= '9') |
|
126 rep += script[character.unicode() - '0']; |
|
127 else |
|
128 rep += character; |
|
129 } |
|
130 return rep; |
|
131 } |
|
132 } |
|
133 |
|
134 QString superscript(int number) |
|
135 { |
|
136 return customNumberRep(number, superscripts, "⁻"); |
|
137 } |
|
138 |
|
139 QString subscript(int number) |
|
140 { |
|
141 return customNumberRep(number, subscripts, "₋"); |
|
142 } |
|
143 |
|
144 QString fractionRep(int numerator, int denominator) |
|
145 { |
|
146 return superscript(numerator) + "⁄" + subscript(denominator); |
|
147 } |