@@ -28,20 +28,6 @@ QList<BitcoinUnit> BitcoinUnits::availableUnits()
28
28
return unitlist;
29
29
}
30
30
31
- bool BitcoinUnits::valid (Unit unit)
32
- {
33
- switch (unit)
34
- {
35
- case Unit::BTC:
36
- case Unit::mBTC :
37
- case Unit::uBTC:
38
- case Unit::SAT:
39
- return true ;
40
- default :
41
- return false ;
42
- }
43
- }
44
-
45
31
QString BitcoinUnits::longName (Unit unit)
46
32
{
47
33
switch (unit)
@@ -104,8 +90,6 @@ QString BitcoinUnits::format(Unit unit, const CAmount& nIn, bool fPlus, Separato
104
90
{
105
91
// Note: not using straight sprintf here because we do NOT want
106
92
// localized number formatting.
107
- if (!valid (unit))
108
- return QString (); // Refuse to format invalid unit
109
93
qint64 n = (qint64)nIn;
110
94
qint64 coin = factor (unit);
111
95
int num_decimals = decimals (unit);
@@ -173,8 +157,9 @@ QString BitcoinUnits::formatWithPrivacy(Unit unit, const CAmount& amount, Separa
173
157
174
158
bool BitcoinUnits::parse (Unit unit, const QString& value, CAmount* val_out)
175
159
{
176
- if (! valid (unit) || value.isEmpty ())
160
+ if ( value.isEmpty ()) {
177
161
return false ; // Refuse to parse invalid unit or empty string
162
+ }
178
163
int num_decimals = decimals (unit);
179
164
180
165
// Ignore spaces and thin spaces when parsing
@@ -212,12 +197,7 @@ bool BitcoinUnits::parse(Unit unit, const QString& value, CAmount* val_out)
212
197
213
198
QString BitcoinUnits::getAmountColumnTitle (Unit unit)
214
199
{
215
- QString amountTitle = QObject::tr (" Amount" );
216
- if (BitcoinUnits::valid (unit))
217
- {
218
- amountTitle += " (" +BitcoinUnits::shortName (unit) + " )" ;
219
- }
220
- return amountTitle;
200
+ return QObject::tr (" Amount" ) + " (" + shortName (unit) + " )" ;
221
201
}
222
202
223
203
int BitcoinUnits::rowCount (const QModelIndex &parent) const
0 commit comments