@ -36,24 +36,33 @@ bool BitcoinUnits::valid(int unit)
}
}
}
}
QString BitcoinUnits : : name ( int unit )
QString BitcoinUnits : : lo ngN ame( int unit )
{
{
switch ( unit )
switch ( unit )
{
{
case BTC : return QString ( " BTC " ) ;
case BTC : return QString ( " BTC " ) ;
case mBTC : return QString ( " mBTC " ) ;
case mBTC : return QString ( " mBTC " ) ;
case uBTC : return QString : : fromUtf8 ( " μBTC " ) ;
case uBTC : return QString : : fromUtf8 ( " µBTC (bits) " ) ;
default : return QString ( " ??? " ) ;
default : return QString ( " ??? " ) ;
}
}
}
}
QString BitcoinUnits : : shortName ( int unit )
{
switch ( unit )
{
case uBTC : return QString : : fromUtf8 ( " bits " ) ;
default : return longName ( unit ) ;
}
}
QString BitcoinUnits : : description ( int unit )
QString BitcoinUnits : : description ( int unit )
{
{
switch ( unit )
switch ( unit )
{
{
case BTC : return QString ( " Bitcoins " ) ;
case BTC : return QString ( " Bitcoins " ) ;
case mBTC : return QString ( " Milli-Bitcoins (1 / 1 " THIN_SP_UTF8 " 000) " ) ;
case mBTC : return QString ( " Milli-Bitcoins (1 / 1 " THIN_SP_UTF8 " 000) " ) ;
case uBTC : return QString ( " Micro-Bitcoins (1 / 1 " THIN_SP_UTF8 " 000 " THIN_SP_UTF8 " 000) " ) ;
case uBTC : return QString ( " Micro-Bitcoins (bits) ( 1 / 1 " THIN_SP_UTF8 " 000 " THIN_SP_UTF8 " 000) " ) ;
default : return QString ( " ??? " ) ;
default : return QString ( " ??? " ) ;
}
}
}
}
@ -121,7 +130,7 @@ QString BitcoinUnits::format(int unit, const CAmount& nIn, bool fPlus, Separator
QString BitcoinUnits : : formatWithUnit ( int unit , const CAmount & amount , bool plussign , SeparatorStyle separators )
QString BitcoinUnits : : formatWithUnit ( int unit , const CAmount & amount , bool plussign , SeparatorStyle separators )
{
{
return format ( unit , amount , plussign , separators ) + QString ( " " ) + n ame( unit ) ;
return format ( unit , amount , plussign , separators ) + QString ( " " ) + shortN ame( unit ) ;
}
}
QString BitcoinUnits : : formatHtmlWithUnit ( int unit , const CAmount & amount , bool plussign , SeparatorStyle separators )
QString BitcoinUnits : : formatHtmlWithUnit ( int unit , const CAmount & amount , bool plussign , SeparatorStyle separators )
@ -176,7 +185,7 @@ QString BitcoinUnits::getAmountColumnTitle(int unit)
QString amountTitle = QObject : : tr ( " Amount " ) ;
QString amountTitle = QObject : : tr ( " Amount " ) ;
if ( BitcoinUnits : : valid ( unit ) )
if ( BitcoinUnits : : valid ( unit ) )
{
{
amountTitle + = " ( " + BitcoinUnits : : n ame( unit ) + " ) " ;
amountTitle + = " ( " + BitcoinUnits : : shortN ame( unit ) + " ) " ;
}
}
return amountTitle ;
return amountTitle ;
}
}
@ -197,7 +206,7 @@ QVariant BitcoinUnits::data(const QModelIndex &index, int role) const
{
{
case Qt : : EditRole :
case Qt : : EditRole :
case Qt : : DisplayRole :
case Qt : : DisplayRole :
return QVariant ( name ( unit ) ) ;
return QVariant ( lo ngN ame( unit ) ) ;
case Qt : : ToolTipRole :
case Qt : : ToolTipRole :
return QVariant ( description ( unit ) ) ;
return QVariant ( description ( unit ) ) ;
case UnitRole :
case UnitRole :