1 | /* |
2 | * Copyright (C) 2008-2009 Petri Damstén <damu@iki.fi> |
3 | * Copyright (C) 2008 Kristof Bal <kristof.bal@gmail.com> |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU Library General Public License as |
7 | * published by the Free Software Foundation; either version 2, or |
8 | * (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details |
14 | * |
15 | * You should have received a copy of the GNU Library General Public |
16 | * License along with this program; if not, write to the |
17 | * Free Software Foundation, Inc., |
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #include "mass.h" |
22 | #include "converter.h" |
23 | #include <klocale.h> |
24 | |
25 | using namespace KUnitConversion; |
26 | |
27 | Mass::Mass() : UnitCategory(MassCategory) |
28 | { |
29 | setName(i18n("Mass" )); |
30 | setSymbolStringFormat(ki18nc("%1 value, %2 unit symbol (mass)" , "%1 %2" )); |
31 | |
32 | U(Yottagram, 1e+24, |
33 | i18nc("mass unit symbol" , "Yg" ), |
34 | i18nc("unit description in lists" , "yottagrams" ), |
35 | i18nc("unit synonyms for matching user input" , "yottagram;yottagrams;Yg" ), |
36 | ki18nc("amount in units (real)" , "%1 yottagrams" ), |
37 | ki18ncp("amount in units (integer)" , "%1 yottagram" , "%1 yottagrams" ) |
38 | ); |
39 | U(Zettagram, 1e+21, |
40 | i18nc("mass unit symbol" , "Zg" ), |
41 | i18nc("unit description in lists" , "zettagrams" ), |
42 | i18nc("unit synonyms for matching user input" , "zettagram;zettagrams;Zg" ), |
43 | ki18nc("amount in units (real)" , "%1 zettagrams" ), |
44 | ki18ncp("amount in units (integer)" , "%1 zettagram" , "%1 zettagrams" ) |
45 | ); |
46 | U(Exagram, 1e+18, |
47 | i18nc("mass unit symbol" , "Eg" ), |
48 | i18nc("unit description in lists" , "exagrams" ), |
49 | i18nc("unit synonyms for matching user input" , "exagram;exagrams;Eg" ), |
50 | ki18nc("amount in units (real)" , "%1 exagrams" ), |
51 | ki18ncp("amount in units (integer)" , "%1 exagram" , "%1 exagrams" ) |
52 | ); |
53 | U(Petagram, 1e+15, |
54 | i18nc("mass unit symbol" , "Pg" ), |
55 | i18nc("unit description in lists" , "petagrams" ), |
56 | i18nc("unit synonyms for matching user input" , "petagram;petagrams;Pg" ), |
57 | ki18nc("amount in units (real)" , "%1 petagrams" ), |
58 | ki18ncp("amount in units (integer)" , "%1 petagram" , "%1 petagrams" ) |
59 | ); |
60 | U(Teragram, 1e+12, |
61 | i18nc("mass unit symbol" , "Tg" ), |
62 | i18nc("unit description in lists" , "teragrams" ), |
63 | i18nc("unit synonyms for matching user input" , "teragram;teragrams;Tg" ), |
64 | ki18nc("amount in units (real)" , "%1 teragrams" ), |
65 | ki18ncp("amount in units (integer)" , "%1 teragram" , "%1 teragrams" ) |
66 | ); |
67 | U(Gigagram, 1e+09, |
68 | i18nc("mass unit symbol" , "Gg" ), |
69 | i18nc("unit description in lists" , "gigagrams" ), |
70 | i18nc("unit synonyms for matching user input" , "gigagram;gigagrams;Gg" ), |
71 | ki18nc("amount in units (real)" , "%1 gigagrams" ), |
72 | ki18ncp("amount in units (integer)" , "%1 gigagram" , "%1 gigagrams" ) |
73 | ); |
74 | U(Megagram, 1e+06, |
75 | i18nc("mass unit symbol" , "Mg" ), |
76 | i18nc("unit description in lists" , "megagrams" ), |
77 | i18nc("unit synonyms for matching user input" , "megagram;megagrams;Mg" ), |
78 | ki18nc("amount in units (real)" , "%1 megagrams" ), |
79 | ki18ncp("amount in units (integer)" , "%1 megagram" , "%1 megagrams" ) |
80 | ); |
81 | setDefaultUnit(UP(Kilogram, 1000, |
82 | i18nc("mass unit symbol" , "kg" ), |
83 | i18nc("unit description in lists" , "kilograms" ), |
84 | i18nc("unit synonyms for matching user input" , "kilogram;kilograms;kg" ), |
85 | ki18nc("amount in units (real)" , "%1 kilograms" ), |
86 | ki18ncp("amount in units (integer)" , "%1 kilogram" , "%1 kilograms" ) |
87 | )); |
88 | U(Hectogram, 100, |
89 | i18nc("mass unit symbol" , "hg" ), |
90 | i18nc("unit description in lists" , "hectograms" ), |
91 | i18nc("unit synonyms for matching user input" , "hectogram;hectograms;hg" ), |
92 | ki18nc("amount in units (real)" , "%1 hectograms" ), |
93 | ki18ncp("amount in units (integer)" , "%1 hectogram" , "%1 hectograms" ) |
94 | ); |
95 | U(Decagram, 10, |
96 | i18nc("mass unit symbol" , "dag" ), |
97 | i18nc("unit description in lists" , "decagrams" ), |
98 | i18nc("unit synonyms for matching user input" , "decagram;decagrams;dag" ), |
99 | ki18nc("amount in units (real)" , "%1 decagrams" ), |
100 | ki18ncp("amount in units (integer)" , "%1 decagram" , "%1 decagrams" ) |
101 | ); |
102 | U(Gram, 1, |
103 | i18nc("mass unit symbol" , "g" ), |
104 | i18nc("unit description in lists" , "grams" ), |
105 | i18nc("unit synonyms for matching user input" , "gram;grams;g" ), |
106 | ki18nc("amount in units (real)" , "%1 grams" ), |
107 | ki18ncp("amount in units (integer)" , "%1 gram" , "%1 grams" ) |
108 | ); |
109 | U(Decigram, 0.1, |
110 | i18nc("mass unit symbol" , "dg" ), |
111 | i18nc("unit description in lists" , "decigrams" ), |
112 | i18nc("unit synonyms for matching user input" , "decigram;decigrams;dg" ), |
113 | ki18nc("amount in units (real)" , "%1 decigrams" ), |
114 | ki18ncp("amount in units (integer)" , "%1 decigram" , "%1 decigrams" ) |
115 | ); |
116 | U(Centigram, 0.01, |
117 | i18nc("mass unit symbol" , "cg" ), |
118 | i18nc("unit description in lists" , "centigrams" ), |
119 | i18nc("unit synonyms for matching user input" , "centigram;centigrams;cg" ), |
120 | ki18nc("amount in units (real)" , "%1 centigrams" ), |
121 | ki18ncp("amount in units (integer)" , "%1 centigram" , "%1 centigrams" ) |
122 | ); |
123 | U(Milligram, 0.001, |
124 | i18nc("mass unit symbol" , "mg" ), |
125 | i18nc("unit description in lists" , "milligrams" ), |
126 | i18nc("unit synonyms for matching user input" , "milligram;milligrams;mg" ), |
127 | ki18nc("amount in units (real)" , "%1 milligrams" ), |
128 | ki18ncp("amount in units (integer)" , "%1 milligram" , "%1 milligrams" ) |
129 | ); |
130 | U(Microgram, 1e-06, |
131 | i18nc("mass unit symbol" , "µg" ), |
132 | i18nc("unit description in lists" , "micrograms" ), |
133 | i18nc("unit synonyms for matching user input" , "microgram;micrograms;µg;ug" ), |
134 | ki18nc("amount in units (real)" , "%1 micrograms" ), |
135 | ki18ncp("amount in units (integer)" , "%1 microgram" , "%1 micrograms" ) |
136 | ); |
137 | U(Nanogram, 1e-09, |
138 | i18nc("mass unit symbol" , "ng" ), |
139 | i18nc("unit description in lists" , "nanograms" ), |
140 | i18nc("unit synonyms for matching user input" , "nanogram;nanograms;ng" ), |
141 | ki18nc("amount in units (real)" , "%1 nanograms" ), |
142 | ki18ncp("amount in units (integer)" , "%1 nanogram" , "%1 nanograms" ) |
143 | ); |
144 | U(Picogram, 1e-12, |
145 | i18nc("mass unit symbol" , "pg" ), |
146 | i18nc("unit description in lists" , "picograms" ), |
147 | i18nc("unit synonyms for matching user input" , "picogram;picograms;pg" ), |
148 | ki18nc("amount in units (real)" , "%1 picograms" ), |
149 | ki18ncp("amount in units (integer)" , "%1 picogram" , "%1 picograms" ) |
150 | ); |
151 | U(Femtogram, 1e-15, |
152 | i18nc("mass unit symbol" , "fg" ), |
153 | i18nc("unit description in lists" , "femtograms" ), |
154 | i18nc("unit synonyms for matching user input" , "femtogram;femtograms;fg" ), |
155 | ki18nc("amount in units (real)" , "%1 femtograms" ), |
156 | ki18ncp("amount in units (integer)" , "%1 femtogram" , "%1 femtograms" ) |
157 | ); |
158 | U(Attogram, 1e-18, |
159 | i18nc("mass unit symbol" , "ag" ), |
160 | i18nc("unit description in lists" , "attograms" ), |
161 | i18nc("unit synonyms for matching user input" , "attogram;attograms;ag" ), |
162 | ki18nc("amount in units (real)" , "%1 attograms" ), |
163 | ki18ncp("amount in units (integer)" , "%1 attogram" , "%1 attograms" ) |
164 | ); |
165 | U(Zeptogram, 1e-21, |
166 | i18nc("mass unit symbol" , "zg" ), |
167 | i18nc("unit description in lists" , "zeptograms" ), |
168 | i18nc("unit synonyms for matching user input" , "zeptogram;zeptograms;zg" ), |
169 | ki18nc("amount in units (real)" , "%1 zeptograms" ), |
170 | ki18ncp("amount in units (integer)" , "%1 zeptogram" , "%1 zeptograms" ) |
171 | ); |
172 | U(Yoctogram, 1e-24, |
173 | i18nc("mass unit symbol" , "yg" ), |
174 | i18nc("unit description in lists" , "yoctograms" ), |
175 | i18nc("unit synonyms for matching user input" , "yoctogram;yoctograms;yg" ), |
176 | ki18nc("amount in units (real)" , "%1 yoctograms" ), |
177 | ki18ncp("amount in units (integer)" , "%1 yoctogram" , "%1 yoctograms" ) |
178 | ); |
179 | U(Ton, 1e+06, |
180 | i18nc("mass unit symbol" , "t" ), |
181 | i18nc("unit description in lists" , "tons" ), |
182 | i18nc("unit synonyms for matching user input" , "ton;tons;t;tonne" ), |
183 | ki18nc("amount in units (real)" , "%1 tons" ), |
184 | ki18ncp("amount in units (integer)" , "%1 ton" , "%1 tons" ) |
185 | ); |
186 | //I guess it's useful... |
187 | U(Carat, 0.2, |
188 | i18nc("mass unit symbol" , "CD" ), |
189 | i18nc("unit description in lists" , "carats" ), |
190 | i18nc("unit synonyms for matching user input" , "carat;carats;CD" ), |
191 | ki18nc("amount in units (real)" , "%1 carats" ), |
192 | ki18ncp("amount in units (integer)" , "%1 carat" , "%1 carats" ) |
193 | ); |
194 | //http://en.wikipedia.org/wiki/Pound_(mass)#International_pound |
195 | U(Pound, 453.592, |
196 | i18nc("mass unit symbol" , "lb" ), |
197 | i18nc("unit description in lists" , "pounds" ), |
198 | i18nc("unit synonyms for matching user input" , "pound;pounds;lb" ), |
199 | ki18nc("amount in units (real)" , "%1 pounds" ), |
200 | ki18ncp("amount in units (integer)" , "%1 pound" , "%1 pounds" ) |
201 | ); |
202 | //International avoirdupois ounce |
203 | U(Ounce, 28.3495, |
204 | i18nc("mass unit symbol" , "oz" ), |
205 | i18nc("unit description in lists" , "ounces" ), |
206 | i18nc("unit synonyms for matching user input" , "ounce;ounces;oz" ), |
207 | ki18nc("amount in units (real)" , "%1 ounces" ), |
208 | ki18ncp("amount in units (integer)" , "%1 ounce" , "%1 ounces" ) |
209 | ); |
210 | U(TroyOunce, 31.1035, |
211 | i18nc("mass unit symbol" , "t oz" ), |
212 | i18nc("unit description in lists" , "troy ounces" ), |
213 | i18nc("unit synonyms for matching user input" , "troy ounce;troy ounces;t oz" ), |
214 | ki18nc("amount in units (real)" , "%1 troy ounces" ), |
215 | ki18ncp("amount in units (integer)" , "%1 troy ounce" , "%1 troy ounces" ) |
216 | ); |
217 | U(MassNewton, 101.937, |
218 | i18nc("mass unit symbol" , "N" ), |
219 | i18nc("unit description in lists" , "newtons" ), |
220 | i18nc("unit synonyms for matching user input" , "newton;newtons;N" ), |
221 | ki18nc("amount in units (real)" , "%1 newtons" ), |
222 | ki18ncp("amount in units (integer)" , "%1 newton" , "%1 newtons" ) |
223 | ); |
224 | //used a lot in industry (aircraft engines for example) |
225 | U(Kilonewton, 101937, |
226 | i18nc("mass unit symbol" , "kN" ), |
227 | i18nc("unit description in lists" , "kilonewton" ), |
228 | i18nc("unit synonyms for matching user input" , "kilonewton;kilonewton;kN" ), |
229 | ki18nc("amount in units (real)" , "%1 kilonewton" ), |
230 | ki18ncp("amount in units (integer)" , "%1 kilonewton" , "%1 kilonewton" ) |
231 | ); |
232 | |
233 | setMostCommonUnits(QList<int>() << |
234 | Kilogram << Gram << Microgram << Ton << Pound << Ounce); |
235 | } |
236 | |