1/*
2 * Copyright (C) 2009 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 "power.h"
21#include "converter.h"
22#include <klocale.h>
23
24using namespace KUnitConversion;
25
26Power::Power() : UnitCategory(PowerCategory)
27{
28 setName(i18n("Power"));
29 setSymbolStringFormat(ki18nc("%1 value, %2 unit symbol (power)", "%1 %2"));
30
31 U(Yottawatt, 1e+24,
32 i18nc("power unit symbol", "YW"),
33 i18nc("unit description in lists", "yottawatts"),
34 i18nc("unit synonyms for matching user input", "yottawatt;yottawatts;YW"),
35 ki18nc("amount in units (real)", "%1 yottawatts"),
36 ki18ncp("amount in units (integer)", "%1 yottawatt", "%1 yottawatts")
37 );
38 U(Zettawatt, 1e+21,
39 i18nc("power unit symbol", "ZW"),
40 i18nc("unit description in lists", "zettawatts"),
41 i18nc("unit synonyms for matching user input", "zettawatt;zettawatts;ZW"),
42 ki18nc("amount in units (real)", "%1 zettawatts"),
43 ki18ncp("amount in units (integer)", "%1 zettawatt", "%1 zettawatts")
44 );
45 U(Exawatt, 1e+18,
46 i18nc("power unit symbol", "EW"),
47 i18nc("unit description in lists", "exawatts"),
48 i18nc("unit synonyms for matching user input", "exawatt;exawatts;EW"),
49 ki18nc("amount in units (real)", "%1 exawatts"),
50 ki18ncp("amount in units (integer)", "%1 exawatt", "%1 exawatts")
51 );
52 U(Petawatt, 1e+15,
53 i18nc("power unit symbol", "PW"),
54 i18nc("unit description in lists", "petawatts"),
55 i18nc("unit synonyms for matching user input", "petawatt;petawatts;PW"),
56 ki18nc("amount in units (real)", "%1 petawatts"),
57 ki18ncp("amount in units (integer)", "%1 petawatt", "%1 petawatts")
58 );
59 U(Terawatt, 1e+12,
60 i18nc("power unit symbol", "TW"),
61 i18nc("unit description in lists", "terawatts"),
62 i18nc("unit synonyms for matching user input", "terawatt;terawatts;TW"),
63 ki18nc("amount in units (real)", "%1 terawatts"),
64 ki18ncp("amount in units (integer)", "%1 terawatt", "%1 terawatts")
65 );
66 U(Gigawatt, 1e+09,
67 i18nc("power unit symbol", "GW"),
68 i18nc("unit description in lists", "gigawatts"),
69 i18nc("unit synonyms for matching user input", "gigawatt;gigawatts;GW"),
70 ki18nc("amount in units (real)", "%1 gigawatts"),
71 ki18ncp("amount in units (integer)", "%1 gigawatt", "%1 gigawatts")
72 );
73 U(Megawatt, 1e+06,
74 i18nc("power unit symbol", "MW"),
75 i18nc("unit description in lists", "megawatts"),
76 i18nc("unit synonyms for matching user input", "megawatt;megawatts;MW"),
77 ki18nc("amount in units (real)", "%1 megawatts"),
78 ki18ncp("amount in units (integer)", "%1 megawatt", "%1 megawatts")
79 );
80 U(Kilowatt, 1000,
81 i18nc("power unit symbol", "kW"),
82 i18nc("unit description in lists", "kilowatts"),
83 i18nc("unit synonyms for matching user input", "kilowatt;kilowatts;kW"),
84 ki18nc("amount in units (real)", "%1 kilowatts"),
85 ki18ncp("amount in units (integer)", "%1 kilowatt", "%1 kilowatts")
86 );
87 U(Hectowatt, 100,
88 i18nc("power unit symbol", "hW"),
89 i18nc("unit description in lists", "hectowatts"),
90 i18nc("unit synonyms for matching user input", "hectowatt;hectowatts;hW"),
91 ki18nc("amount in units (real)", "%1 hectowatts"),
92 ki18ncp("amount in units (integer)", "%1 hectowatt", "%1 hectowatts")
93 );
94 U(Decawatt, 10,
95 i18nc("power unit symbol", "daW"),
96 i18nc("unit description in lists", "decawatts"),
97 i18nc("unit synonyms for matching user input", "decawatt;decawatts;daW"),
98 ki18nc("amount in units (real)", "%1 decawatts"),
99 ki18ncp("amount in units (integer)", "%1 decawatt", "%1 decawatts")
100 );
101 setDefaultUnit(UP(Watt, 1,
102 i18nc("power unit symbol", "W"),
103 i18nc("unit description in lists", "watts"),
104 i18nc("unit synonyms for matching user input", "watt;watts;W"),
105 ki18nc("amount in units (real)", "%1 watts"),
106 ki18ncp("amount in units (integer)", "%1 watt", "%1 watts")
107 ));
108 U(Deciwatt, 0.1,
109 i18nc("power unit symbol", "dW"),
110 i18nc("unit description in lists", "deciwatts"),
111 i18nc("unit synonyms for matching user input", "deciwatt;deciwatts;dW"),
112 ki18nc("amount in units (real)", "%1 deciwatts"),
113 ki18ncp("amount in units (integer)", "%1 deciwatt", "%1 deciwatts")
114 );
115 U(Centiwatt, 0.01,
116 i18nc("power unit symbol", "cW"),
117 i18nc("unit description in lists", "centiwatts"),
118 i18nc("unit synonyms for matching user input", "centiwatt;centiwatts;cW"),
119 ki18nc("amount in units (real)", "%1 centiwatts"),
120 ki18ncp("amount in units (integer)", "%1 centiwatt", "%1 centiwatts")
121 );
122 U(Milliwatt, 0.001,
123 i18nc("power unit symbol", "mW"),
124 i18nc("unit description in lists", "milliwatts"),
125 i18nc("unit synonyms for matching user input", "milliwatt;milliwatts;mW"),
126 ki18nc("amount in units (real)", "%1 milliwatts"),
127 ki18ncp("amount in units (integer)", "%1 milliwatt", "%1 milliwatts")
128 );
129 U(Microwatt, 1e-06,
130 i18nc("power unit symbol", "µW"),
131 i18nc("unit description in lists", "microwatts"),
132 i18nc("unit synonyms for matching user input", "microwatt;microwatts;µW;uW"),
133 ki18nc("amount in units (real)", "%1 microwatts"),
134 ki18ncp("amount in units (integer)", "%1 microwatt", "%1 microwatts")
135 );
136 U(Nanowatt, 1e-09,
137 i18nc("power unit symbol", "nW"),
138 i18nc("unit description in lists", "nanowatts"),
139 i18nc("unit synonyms for matching user input", "nanowatt;nanowatts;nW"),
140 ki18nc("amount in units (real)", "%1 nanowatts"),
141 ki18ncp("amount in units (integer)", "%1 nanowatt", "%1 nanowatts")
142 );
143 U(Picowatt, 1e-12,
144 i18nc("power unit symbol", "pW"),
145 i18nc("unit description in lists", "picowatts"),
146 i18nc("unit synonyms for matching user input", "picowatt;picowatts;pW"),
147 ki18nc("amount in units (real)", "%1 picowatts"),
148 ki18ncp("amount in units (integer)", "%1 picowatt", "%1 picowatts")
149 );
150 U(Femtowatt, 1e-15,
151 i18nc("power unit symbol", "fW"),
152 i18nc("unit description in lists", "femtowatts"),
153 i18nc("unit synonyms for matching user input", "femtowatt;femtowatts;fW"),
154 ki18nc("amount in units (real)", "%1 femtowatts"),
155 ki18ncp("amount in units (integer)", "%1 femtowatt", "%1 femtowatts")
156 );
157 U(Attowatt, 1e-18,
158 i18nc("power unit symbol", "aW"),
159 i18nc("unit description in lists", "attowatts"),
160 i18nc("unit synonyms for matching user input", "attowatt;attowatts;aW"),
161 ki18nc("amount in units (real)", "%1 attowatts"),
162 ki18ncp("amount in units (integer)", "%1 attowatt", "%1 attowatts")
163 );
164 U(Zeptowatt, 1e-21,
165 i18nc("power unit symbol", "zW"),
166 i18nc("unit description in lists", "zeptowatts"),
167 i18nc("unit synonyms for matching user input", "zeptowatt;zeptowatts;zW"),
168 ki18nc("amount in units (real)", "%1 zeptowatts"),
169 ki18ncp("amount in units (integer)", "%1 zeptowatt", "%1 zeptowatts")
170 );
171 U(Yoctowatt, 1e-24,
172 i18nc("power unit symbol", "yW"),
173 i18nc("unit description in lists", "yoctowatts"),
174 i18nc("unit synonyms for matching user input", "yoctowatt;yoctowatts;yW"),
175 ki18nc("amount in units (real)", "%1 yoctowatts"),
176 ki18ncp("amount in units (integer)", "%1 yoctowatt", "%1 yoctowatts")
177 );
178 U(Horsepower, 735.499,
179 i18nc("power unit symbol", "hp"),
180 i18nc("unit description in lists", "horsepowers"),
181 i18nc("unit synonyms for matching user input", "horsepower;horsepowers;hp"),
182 ki18nc("amount in units (real)", "%1 horsepowers"),
183 ki18ncp("amount in units (integer)", "%1 horsepower", "%1 horsepowers")
184 );
185
186 setMostCommonUnits(QList<int>() << Kilowatt << Watt << Horsepower);
187}
188