1 | /* |
2 | * Copyright (C) 2010 Petri Damstén <damu@iki.fi> |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU Library General Public License as |
6 | * published by the Free Software Foundation; either version 2, or |
7 | * (at your option) any later version. |
8 | * |
9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details |
13 | * |
14 | * You should have received a copy of the GNU Library General Public |
15 | * License along with this program; if not, write to the |
16 | * Free Software Foundation, Inc., |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #include "force.h" |
21 | #include "converter.h" |
22 | #include <klocale.h> |
23 | |
24 | using namespace KUnitConversion; |
25 | |
26 | Force::Force() : UnitCategory(ForceCategory) |
27 | { |
28 | setName(i18n("Force" )); |
29 | setSymbolStringFormat(ki18nc("%1 value, %2 unit symbol (force" , "%1 %2" )); |
30 | |
31 | U(Yottanewton, 1e+24, |
32 | i18nc("force unit symbol" , "YN" ), |
33 | i18nc("unit description in lists" , "yottanewtons" ), |
34 | i18nc("unit synonyms for matching user input" , "yottanewton;yottanewtons;YN" ), |
35 | ki18nc("amount in units (real)" , "%1 yottanewtons" ), |
36 | ki18ncp("amount in units (integer)" , "%1 yottanewton" , "%1 yottanewtons" ) |
37 | ); |
38 | U(Zettanewton, 1e+21, |
39 | i18nc("force unit symbol" , "ZN" ), |
40 | i18nc("unit description in lists" , "zettanewtons" ), |
41 | i18nc("unit synonyms for matching user input" , "zettanewton;zettanewtons;ZN" ), |
42 | ki18nc("amount in units (real)" , "%1 zettanewtons" ), |
43 | ki18ncp("amount in units (integer)" , "%1 zettanewton" , "%1 zettanewtons" ) |
44 | ); |
45 | U(Exanewton, 1e+18, |
46 | i18nc("force unit symbol" , "EN" ), |
47 | i18nc("unit description in lists" , "exanewtons" ), |
48 | i18nc("unit synonyms for matching user input" , "exanewton;exanewtons;EN" ), |
49 | ki18nc("amount in units (real)" , "%1 exanewtons" ), |
50 | ki18ncp("amount in units (integer)" , "%1 exanewton" , "%1 exanewtons" ) |
51 | ); |
52 | U(Petanewton, 1e+15, |
53 | i18nc("force unit symbol" , "PN" ), |
54 | i18nc("unit description in lists" , "petanewtons" ), |
55 | i18nc("unit synonyms for matching user input" , "petanewton;petanewtons;PN" ), |
56 | ki18nc("amount in units (real)" , "%1 petanewtons" ), |
57 | ki18ncp("amount in units (integer)" , "%1 petanewton" , "%1 petanewtons" ) |
58 | ); |
59 | U(Teranewton, 1e+12, |
60 | i18nc("force unit symbol" , "TN" ), |
61 | i18nc("unit description in lists" , "teranewtons" ), |
62 | i18nc("unit synonyms for matching user input" , "teranewton;teranewtons;TN" ), |
63 | ki18nc("amount in units (real)" , "%1 teranewtons" ), |
64 | ki18ncp("amount in units (integer)" , "%1 teranewton" , "%1 teranewtons" ) |
65 | ); |
66 | U(Giganewton, 1e+09, |
67 | i18nc("force unit symbol" , "GN" ), |
68 | i18nc("unit description in lists" , "giganewtons" ), |
69 | i18nc("unit synonyms for matching user input" , "giganewton;giganewtons;GN" ), |
70 | ki18nc("amount in units (real)" , "%1 giganewtons" ), |
71 | ki18ncp("amount in units (integer)" , "%1 giganewton" , "%1 giganewtons" ) |
72 | ); |
73 | U(Meganewton, 1e+06, |
74 | i18nc("force unit symbol" , "MN" ), |
75 | i18nc("unit description in lists" , "meganewtons" ), |
76 | i18nc("unit synonyms for matching user input" , "meganewton;meganewtons;MN" ), |
77 | ki18nc("amount in units (real)" , "%1 meganewtons" ), |
78 | ki18ncp("amount in units (integer)" , "%1 meganewton" , "%1 meganewtons" ) |
79 | ); |
80 | U(KilonewtonForce, 1000, |
81 | i18nc("force unit symbol" , "kN" ), |
82 | i18nc("unit description in lists" , "kilonewtons" ), |
83 | i18nc("unit synonyms for matching user input" , "kilonewton;kilonewtons;kN" ), |
84 | ki18nc("amount in units (real)" , "%1 kilonewtons" ), |
85 | ki18ncp("amount in units (integer)" , "%1 kilonewton" , "%1 kilonewtons" ) |
86 | ); |
87 | U(Hectonewton, 100, |
88 | i18nc("force unit symbol" , "hN" ), |
89 | i18nc("unit description in lists" , "hectonewtons" ), |
90 | i18nc("unit synonyms for matching user input" , "hectonewton;hectonewtons;hN" ), |
91 | ki18nc("amount in units (real)" , "%1 hectonewtons" ), |
92 | ki18ncp("amount in units (integer)" , "%1 hectonewton" , "%1 hectonewtons" ) |
93 | ); |
94 | U(Decanewton, 10, |
95 | i18nc("force unit symbol" , "daN" ), |
96 | i18nc("unit description in lists" , "decanewtons" ), |
97 | i18nc("unit synonyms for matching user input" , "decanewton;decanewtons;daN" ), |
98 | ki18nc("amount in units (real)" , "%1 decanewtons" ), |
99 | ki18ncp("amount in units (integer)" , "%1 decanewton" , "%1 decanewtons" ) |
100 | ); |
101 | setDefaultUnit(UP(Newton, 1, |
102 | i18nc("force unit symbol" , "N" ), |
103 | i18nc("unit description in lists" , "newtons" ), |
104 | i18nc("unit synonyms for matching user input" , "newton;newtons;N" ), |
105 | ki18nc("amount in units (real)" , "%1 newtons" ), |
106 | ki18ncp("amount in units (integer)" , "%1 newton" , "%1 newtons" ) |
107 | )); |
108 | U(Decinewton, 0.1, |
109 | i18nc("force unit symbol" , "dN" ), |
110 | i18nc("unit description in lists" , "decinewtons" ), |
111 | i18nc("unit synonyms for matching user input" , "decinewton;decinewtons;dN" ), |
112 | ki18nc("amount in units (real)" , "%1 decinewtons" ), |
113 | ki18ncp("amount in units (integer)" , "%1 decinewton" , "%1 decinewtons" ) |
114 | ); |
115 | U(Centinewton, 0.01, |
116 | i18nc("force unit symbol" , "cN" ), |
117 | i18nc("unit description in lists" , "centinewtons" ), |
118 | i18nc("unit synonyms for matching user input" , "centinewton;centinewtons;cN" ), |
119 | ki18nc("amount in units (real)" , "%1 centinewtons" ), |
120 | ki18ncp("amount in units (integer)" , "%1 centinewton" , "%1 centinewtons" ) |
121 | ); |
122 | U(Millinewton, 0.001, |
123 | i18nc("force unit symbol" , "mN" ), |
124 | i18nc("unit description in lists" , "millinewtons" ), |
125 | i18nc("unit synonyms for matching user input" , "millinewton;millinewtons;mN" ), |
126 | ki18nc("amount in units (real)" , "%1 millinewtons" ), |
127 | ki18ncp("amount in units (integer)" , "%1 millinewton" , "%1 millinewtons" ) |
128 | ); |
129 | U(Micronewton, 1e-06, |
130 | i18nc("force unit symbol" , "µN" ), |
131 | i18nc("unit description in lists" , "micronewtons" ), |
132 | i18nc("unit synonyms for matching user input" , "micronewton;micronewtons;µm;uN" ), |
133 | ki18nc("amount in units (real)" , "%1 micronewtons" ), |
134 | ki18ncp("amount in units (integer)" , "%1 micronewton" , "%1 micronewtons" ) |
135 | ); |
136 | U(Nanonewton, 1e-09, |
137 | i18nc("force unit symbol" , "nN" ), |
138 | i18nc("unit description in lists" , "nanonewtons" ), |
139 | i18nc("unit synonyms for matching user input" , "nanonewton;nanonewtons;nN" ), |
140 | ki18nc("amount in units (real)" , "%1 nanonewtons" ), |
141 | ki18ncp("amount in units (integer)" , "%1 nanonewton" , "%1 nanonewtons" ) |
142 | ); |
143 | U(Piconewton, 1e-12, |
144 | i18nc("force unit symbol" , "pN" ), |
145 | i18nc("unit description in lists" , "piconewtons" ), |
146 | i18nc("unit synonyms for matching user input" , "piconewton;piconewtons;pN" ), |
147 | ki18nc("amount in units (real)" , "%1 piconewtons" ), |
148 | ki18ncp("amount in units (integer)" , "%1 piconewton" , "%1 piconewtons" ) |
149 | ); |
150 | U(Femtonewton, 1e-15, |
151 | i18nc("force unit symbol" , "fN" ), |
152 | i18nc("unit description in lists" , "femtonewtons" ), |
153 | i18nc("unit synonyms for matching user input" , "femtonewton;femtonewtons;fN" ), |
154 | ki18nc("amount in units (real)" , "%1 femtonewtons" ), |
155 | ki18ncp("amount in units (integer)" , "%1 femtonewton" , "%1 femtonewtons" ) |
156 | ); |
157 | U(Attonewton, 1e-18, |
158 | i18nc("force unit symbol" , "aN" ), |
159 | i18nc("unit description in lists" , "attonewtons" ), |
160 | i18nc("unit synonyms for matching user input" , "attonewton;attonewtons;aN" ), |
161 | ki18nc("amount in units (real)" , "%1 attonewtons" ), |
162 | ki18ncp("amount in units (integer)" , "%1 attonewton" , "%1 attonewtons" ) |
163 | ); |
164 | U(Zeptonewton, 1e-21, |
165 | i18nc("force unit symbol" , "zN" ), |
166 | i18nc("unit description in lists" , "zeptonewtons" ), |
167 | i18nc("unit synonyms for matching user input" , "zeptonewton;zeptonewtons;zN" ), |
168 | ki18nc("amount in units (real)" , "%1 zeptonewtons" ), |
169 | ki18ncp("amount in units (integer)" , "%1 zeptonewton" , "%1 zeptonewtons" ) |
170 | ); |
171 | U(Yoctonewton, 1e-24, |
172 | i18nc("force unit symbol" , "yN" ), |
173 | i18nc("unit description in lists" , "yoctonewtons" ), |
174 | i18nc("unit synonyms for matching user input" , "yoctonewton;yoctonewtons;yN" ), |
175 | ki18nc("amount in units (real)" , "%1 yoctonewtons" ), |
176 | ki18ncp("amount in units (integer)" , "%1 yoctonewton" , "%1 yoctonewtons" ) |
177 | ); |
178 | |
179 | // http://en.wikipedia.org/wiki/Force#Units_of_measurement |
180 | U(Dyne, 0.0001, |
181 | i18nc("force unit symbol" , "dyn" ), |
182 | i18nc("unit description in lists" , "dynes" ), |
183 | i18nc("unit synonyms for matching user input" , "dyne;dynes;dyn" ), |
184 | ki18nc("amount in units (real)" , "%1 dynes" ), |
185 | ki18ncp("amount in units (integer)" , "%1 dyne" , "%1 dynes" ) |
186 | ); |
187 | U(Kilopond, 9.80665, |
188 | i18nc("force unit symbol" , "kp" ), |
189 | i18nc("unit description in lists" , "kiloponds" ), |
190 | i18nc("unit synonyms for matching user input" , "kilogram-force;kilopond;kiloponds;kp" ), |
191 | ki18nc("amount in units (real)" , "%1 kiloponds" ), |
192 | ki18ncp("amount in units (integer)" , "%1 kilopond" , "%1 kiloponds" ) |
193 | ); |
194 | U(PoundForce, 4.448222, |
195 | i18nc("force unit symbol" , "lbf" ), |
196 | i18nc("unit description in lists" , "pound-force" ), |
197 | i18nc("unit synonyms for matching user input" , "pound-force;lbf" ), |
198 | ki18nc("amount in units (real)" , "%1 pound-force" ), |
199 | ki18ncp("amount in units (integer)" , "%1 pound-force" , "%1 pound-force" ) |
200 | ); |
201 | U(Poundal, 0.138255, |
202 | i18nc("force unit symbol" , "pdl" ), |
203 | i18nc("unit description in lists" , "poundals" ), |
204 | i18nc("unit synonyms for matching user input" , "poundal;poundals;pdl" ), |
205 | ki18nc("amount in units (real)" , "%1 poundals" ), |
206 | ki18ncp("amount in units (integer)" , "%1 poundal" , "%1 poundals" ) |
207 | ); |
208 | |
209 | setMostCommonUnits(QList<int>() << KilonewtonForce << Newton); |
210 | } |
211 | |
212 | |