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 "density.h" |
21 | #include "converter.h" |
22 | #include <klocale.h> |
23 | |
24 | using namespace KUnitConversion; |
25 | |
26 | Density::Density() : UnitCategory(DensityCategory) |
27 | { |
28 | setName(i18n("Density" )); |
29 | setSymbolStringFormat(ki18nc("%1 value, %2 unit symbol (density)" , "%1 %2" )); |
30 | |
31 | setDefaultUnit(UP(KilogramsPerCubicMeter, 1, |
32 | i18nc("density unit symbol" , "kg/m³" ), |
33 | i18nc("unit description in lists" , "kilograms per cubic meter" ), |
34 | i18nc("unit synonyms for matching user input" , |
35 | "kilogram per cubic meter;kilograms per cubic meter;kg/m³" ), |
36 | ki18nc("amount in units (real)" , "%1 kilograms per cubic meter" ), |
37 | ki18ncp("amount in units (integer)" , |
38 | "%1 kilogram per cubic meter" , "%1 kilograms per cubic meter" ) |
39 | )); |
40 | |
41 | // source Google calculator |
42 | U(KilogramPerLiter, 1000, |
43 | i18nc("density unit symbol" , "kg/l" ), |
44 | i18nc("unit description in lists" , "kilograms per liter" ), |
45 | i18nc("unit synonyms for matching user input" , |
46 | "kilogram per liter;kilograms per liter;kg/l" ), |
47 | ki18nc("amount in units (real)" , "%1 kilograms per liter" ), |
48 | ki18ncp("amount in units (integer)" , "%1 kilogram per liter" , "%1 kilograms per liter" ) |
49 | ); |
50 | U(GramPerLiter, 1, |
51 | i18nc("density unit symbol" , "g/l" ), |
52 | i18nc("unit description in lists" , "grams per liter" ), |
53 | i18nc("unit synonyms for matching user input" , "gram per liter;grams per liter;g/l" ), |
54 | ki18nc("amount in units (real)" , "%1 grams per liter" ), |
55 | ki18ncp("amount in units (integer)" , "%1 gram per liter" , "%1 grams per liter" ) |
56 | ); |
57 | U(GramPerMilliliter, 1000, |
58 | i18nc("density unit symbol" , "g/ml" ), |
59 | i18nc("unit description in lists" , "grams per milliliter" ), |
60 | i18nc("unit synonyms for matching user input" , |
61 | "gram per milliliter;grams per milliliter;g/ml" ), |
62 | ki18nc("amount in units (real)" , "%1 grams per milliliter" ), |
63 | ki18ncp("amount in units (integer)" , "%1 gram per milliliter" , "%1 grams per milliliter" ) |
64 | ); |
65 | |
66 | // source : Google calculator |
67 | U(OuncePerCubicInch, 1729.99404, |
68 | i18nc("density unit symbol" , "oz/in³" ), |
69 | i18nc("unit description in lists" , "ounces per cubic inch" ), |
70 | i18nc("unit synonyms for matching user input" , |
71 | "ounce per cubic inch;ounces per cubic inch;oz/in³" ), |
72 | ki18nc("amount in units (real)" , "%1 ounces per cubic inch" ), |
73 | ki18ncp("amount in units (integer)" , "%1 ounce per cubic inch" , "%1 ounces per cubic inch" ) |
74 | ); |
75 | U(OuncePerCubicFoot, 1.00115396, |
76 | i18nc("density unit symbol" , "oz/ft³" ), |
77 | i18nc("unit description in lists" , "ounces per cubic foot" ), |
78 | i18nc("unit synonyms for matching user input" , |
79 | "ounce per cubic foot;ounces per cubic foot;oz/ft³" ), |
80 | ki18nc("amount in units (real)" , "%1 ounces per cubic foot" ), |
81 | ki18ncp("amount in units (integer)" , "%1 ounce per cubic foot" , "%1 ounces per cubic foot" ) |
82 | ); |
83 | U(PoundPerCubicInch, 27679.9047, |
84 | i18nc("density unit symbol" , "lb/in³" ), |
85 | i18nc("unit description in lists" , "pounds per cubic inch" ), |
86 | i18nc("unit synonyms for matching user input" , |
87 | "pound per cubic inch;pounds per cubic inch;lb/in³" ), |
88 | ki18nc("amount in units (real)" , "%1 pounds per cubic inch" ), |
89 | ki18ncp("amount in units (integer)" , "%1 pound per cubic inch" , "%1 pounds per cubic inch" ) |
90 | ); |
91 | U(PoundPerCubicFoot, 16.0184634, |
92 | i18nc("density unit symbol" , "lb/ft³" ), |
93 | i18nc("unit description in lists" , "pounds per cubic foot" ), |
94 | i18nc("unit synonyms for matching user input" , |
95 | "pound per cubic foot;pounds per cubic foot;lb/ft³" ), |
96 | ki18nc("amount in units (real)" , "%1 pounds per cubic foot" ), |
97 | ki18ncp("amount in units (integer)" , "%1 pound per cubic foot" , "%1 pounds per cubic foot" ) |
98 | ); |
99 | U(PoundPerCubicYard, 0.593276421, |
100 | i18nc("density unit symbol" , "lb/yd³" ), |
101 | i18nc("unit description in lists" , "pounds per cubic yard" ), |
102 | i18nc("unit synonyms for matching user input" , |
103 | "pound per cubic yard;pounds per cubic yard;lb/yd³" ), |
104 | ki18nc("amount in units (real)" , "%1 pounds per cubic yard" ), |
105 | ki18ncp("amount in units (integer)" , "%1 pound per cubic yard" , "%1 pounds per cubic yard" ) |
106 | ); |
107 | |
108 | setMostCommonUnits(QList<int>() << |
109 | KilogramsPerCubicMeter << KilogramPerLiter << OuncePerCubicInch); |
110 | } |
111 | |