Skip to content

Commit

Permalink
xpc introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
backpacker69 committed Jan 30, 2019
1 parent 5ece0c7 commit 53f70f5
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 17 deletions.
66 changes: 50 additions & 16 deletions src/qt/bitcoinunits.cpp
Expand Up @@ -14,6 +14,9 @@ QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits()
unitlist.append(BTC);
unitlist.append(mBTC);
unitlist.append(uBTC);
unitlist.append(PPC);
unitlist.append(mPPC);
unitlist.append(uPPC);
return unitlist;
}

Expand All @@ -22,8 +25,11 @@ bool BitcoinUnits::valid(int unit)
switch(unit)
{
case BTC:
case PPC:
case mBTC:
case mPPC:
case uBTC:
case uPPC:
return true;
default:
return false;
Expand All @@ -34,9 +40,12 @@ QString BitcoinUnits::name(int unit)
{
switch(unit)
{
case BTC: return QString("PPC");
case mBTC: return QString("mPPC");
case uBTC: return QString::fromUtf8("μPPC");
case BTC: return QString("XPC");
case PPC: return QString("PPC");
case mBTC: return QString("mXPC");
case mPPC: return QString("mPPC");
case uBTC: return QString::fromUtf8("μXPC");
case uPPC: return QString::fromUtf8("μPPC");
default: return QString("???");
}
}
Expand All @@ -45,9 +54,15 @@ QString BitcoinUnits::description(int unit)
{
switch(unit)
{
case BTC: return QString("Peercoins");
case mBTC: return QString("Milli-Peercoins (1 / 1,000)");
case uBTC: return QString("Micro-Peercoins (1 / 1,000,000)");
case BTC:
case PPC:
return QString("Peercoins");
case mBTC:
case mPPC:
return QString("Milli-Peercoins (1 / 1,000)");
case uBTC:
case uPPC:
return QString("Micro-Peercoins (1 / 1,000,000)");
default: return QString("???");
}
}
Expand All @@ -56,20 +71,33 @@ qint64 BitcoinUnits::factor(int unit)
{
switch(unit)
{
case BTC: return 1000000;
case mBTC: return 1000;
case uBTC: return 1;
default: return 1000000;
case BTC:
case PPC:
return 1000000;
case mBTC:
case mPPC:
return 1000;
case uBTC:
case uPPC:
return 1;
default:
return 1000000;
}
}

int BitcoinUnits::amountDigits(int unit)
{
switch(unit)
{
case BTC: return 10; // 21,000,000 (# digits, without commas)
case mBTC: return 13; // 21,000,000,000
case uBTC: return 16; // 21,000,000,000,000
case BTC:
case PPC:
return 10; // 21,000,000 (# digits, without commas)
case mBTC:
case mPPC:
return 13; // 21,000,000,000
case uBTC:
case uPPC:
return 16; // 21,000,000,000,000
default: return 0;
}
}
Expand All @@ -78,9 +106,15 @@ int BitcoinUnits::decimals(int unit)
{
switch(unit)
{
case BTC: return 6;
case mBTC: return 3;
case uBTC: return 0;
case BTC:
case PPC:
return 6;
case mBTC:
case mPPC:
return 3;
case uBTC:
case uPPC:
return 0;
default: return 0;
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/qt/bitcoinunits.h
Expand Up @@ -21,7 +21,10 @@ class BitcoinUnits: public QAbstractListModel
{
BTC,
mBTC,
uBTC
uBTC,
PPC,
mPPC,
uPPC
};

//! @name Static API
Expand Down

0 comments on commit 53f70f5

Please sign in to comment.