@@ -20,6 +20,7 @@ QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits()
2020 unitlist.append (BTC);
2121 unitlist.append (mBTC );
2222 unitlist.append (uBTC);
23+ unitlist.append (SAT);
2324 return unitlist;
2425}
2526
@@ -30,6 +31,7 @@ bool BitcoinUnits::valid(int unit)
3031 case BTC:
3132 case mBTC :
3233 case uBTC:
34+ case SAT:
3335 return true ;
3436 default :
3537 return false ;
@@ -43,6 +45,7 @@ QString BitcoinUnits::longName(int unit)
4345 case BTC: return QString (" BTC" );
4446 case mBTC : return QString (" mBTC" );
4547 case uBTC: return QString::fromUtf8 (" µBTC (bits)" );
48+ case SAT: return QString (" Satoshi (sat)" );
4649 default : return QString (" ???" );
4750 }
4851}
@@ -52,7 +55,8 @@ QString BitcoinUnits::shortName(int unit)
5255 switch (unit)
5356 {
5457 case uBTC: return QString::fromUtf8 (" bits" );
55- default : return longName (unit);
58+ case SAT: return QString (" sat" );
59+ default : return longName (unit);
5660 }
5761}
5862
@@ -63,6 +67,7 @@ QString BitcoinUnits::description(int unit)
6367 case BTC: return QString (" Bitcoins" );
6468 case mBTC : return QString (" Milli-Bitcoins (1 / 1" THIN_SP_UTF8 " 000)" );
6569 case uBTC: return QString (" Micro-Bitcoins (bits) (1 / 1" THIN_SP_UTF8 " 000" THIN_SP_UTF8 " 000)" );
70+ case SAT: return QString (" Satoshi (sat) (1 / 100" THIN_SP_UTF8 " 000" THIN_SP_UTF8 " 000)" );
6671 default : return QString (" ???" );
6772 }
6873}
@@ -71,10 +76,11 @@ qint64 BitcoinUnits::factor(int unit)
7176{
7277 switch (unit)
7378 {
74- case BTC: return 100000000 ;
79+ case BTC: return 100000000 ;
7580 case mBTC : return 100000 ;
7681 case uBTC: return 100 ;
77- default : return 100000000 ;
82+ case SAT: return 1 ;
83+ default : return 100000000 ;
7884 }
7985}
8086
@@ -85,6 +91,7 @@ int BitcoinUnits::decimals(int unit)
8591 case BTC: return 8 ;
8692 case mBTC : return 5 ;
8793 case uBTC: return 2 ;
94+ case SAT: return 0 ;
8895 default : return 0 ;
8996 }
9097}
0 commit comments