@ -76,7 +76,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
@@ -76,7 +76,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
QAction * clipboardFeeAction = new QAction ( tr ( " Copy fee " ) , this ) ;
QAction * clipboardAfterFeeAction = new QAction ( tr ( " Copy after fee " ) , this ) ;
QAction * clipboardBytesAction = new QAction ( tr ( " Copy bytes " ) , this ) ;
QAction * clipboardPriorityAction = new QAction ( tr ( " Copy priority " ) , this ) ;
QAction * clipboardLowOutputAction = new QAction ( tr ( " Copy dust " ) , this ) ;
QAction * clipboardChangeAction = new QAction ( tr ( " Copy change " ) , this ) ;
@ -85,7 +84,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
@@ -85,7 +84,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
connect ( clipboardFeeAction , SIGNAL ( triggered ( ) ) , this , SLOT ( clipboardFee ( ) ) ) ;
connect ( clipboardAfterFeeAction , SIGNAL ( triggered ( ) ) , this , SLOT ( clipboardAfterFee ( ) ) ) ;
connect ( clipboardBytesAction , SIGNAL ( triggered ( ) ) , this , SLOT ( clipboardBytes ( ) ) ) ;
connect ( clipboardPriorityAction , SIGNAL ( triggered ( ) ) , this , SLOT ( clipboardPriority ( ) ) ) ;
connect ( clipboardLowOutputAction , SIGNAL ( triggered ( ) ) , this , SLOT ( clipboardLowOutput ( ) ) ) ;
connect ( clipboardChangeAction , SIGNAL ( triggered ( ) ) , this , SLOT ( clipboardChange ( ) ) ) ;
@ -94,7 +92,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
@@ -94,7 +92,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
ui - > labelCoinControlFee - > addAction ( clipboardFeeAction ) ;
ui - > labelCoinControlAfterFee - > addAction ( clipboardAfterFeeAction ) ;
ui - > labelCoinControlBytes - > addAction ( clipboardBytesAction ) ;
ui - > labelCoinControlPriority - > addAction ( clipboardPriorityAction ) ;
ui - > labelCoinControlLowOutput - > addAction ( clipboardLowOutputAction ) ;
ui - > labelCoinControlChange - > addAction ( clipboardChangeAction ) ;
@ -124,16 +121,14 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
@@ -124,16 +121,14 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
ui - > treeWidget - > headerItem ( ) - > setText ( COLUMN_CHECKBOX , QString ( ) ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_CHECKBOX , 84 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_AMOUNT , 100 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_LABEL , 170 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_ADDRESS , 290 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_DATE , 110 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_CONFIRMATIONS , 100 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_PRIORITY , 100 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_AMOUNT , 110 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_LABEL , 190 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_ADDRESS , 320 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_DATE , 130 ) ;
ui - > treeWidget - > setColumnWidth ( COLUMN_CONFIRMATIONS , 110 ) ;
ui - > treeWidget - > setColumnHidden ( COLUMN_TXHASH , true ) ; // store transaction hash in this column, but don't show it
ui - > treeWidget - > setColumnHidden ( COLUMN_VOUT_INDEX , true ) ; // store vout index in this column, but don't show it
ui - > treeWidget - > setColumnHidden ( COLUMN_AMOUNT_INT64 , true ) ; // store amount int64 in this column, but don't show it
ui - > treeWidget - > setColumnHidden ( COLUMN_PRIORITY_INT64 , true ) ; // store priority int64 in this column, but don't show it
ui - > treeWidget - > setColumnHidden ( COLUMN_DATE_INT64 , true ) ; // store date int64 in this column, but don't show it
// default view is sorted by amount desc
@ -325,12 +320,6 @@ void CoinControlDialog::clipboardBytes()
@@ -325,12 +320,6 @@ void CoinControlDialog::clipboardBytes()
GUIUtil : : setClipboard ( ui - > labelCoinControlBytes - > text ( ) . replace ( ASYMP_UTF8 , " " ) ) ;
}
// copy label "Priority" to clipboard
void CoinControlDialog : : clipboardPriority ( )
{
GUIUtil : : setClipboard ( ui - > labelCoinControlPriority - > text ( ) ) ;
}
// copy label "Dust" to clipboard
void CoinControlDialog : : clipboardLowOutput ( )
{
@ -419,25 +408,6 @@ void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
@@ -419,25 +408,6 @@ void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
# endif
}
// return human readable label for priority number
QString CoinControlDialog : : getPriorityLabel ( double dPriority , double mempoolEstimatePriority )
{
double dPriorityMedium = mempoolEstimatePriority ;
if ( dPriorityMedium < = 0 )
dPriorityMedium = AllowFreeThreshold ( ) ; // not enough data, back to hard-coded
if ( dPriority / 1000000 > dPriorityMedium ) return tr ( " highest " ) ;
else if ( dPriority / 100000 > dPriorityMedium ) return tr ( " higher " ) ;
else if ( dPriority / 10000 > dPriorityMedium ) return tr ( " high " ) ;
else if ( dPriority / 1000 > dPriorityMedium ) return tr ( " medium-high " ) ;
else if ( dPriority > dPriorityMedium ) return tr ( " medium " ) ;
else if ( dPriority * 10 > dPriorityMedium ) return tr ( " low-medium " ) ;
else if ( dPriority * 100 > dPriorityMedium ) return tr ( " low " ) ;
else if ( dPriority * 1000 > dPriorityMedium ) return tr ( " lower " ) ;
else return tr ( " lowest " ) ;
}
// shows count of locked unspent outputs
void CoinControlDialog : : updateLabelLocked ( )
{
@ -473,7 +443,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
@@ -473,7 +443,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
}
}
QString sPriorityLabel = tr ( " none " ) ;
CAmount nAmount = 0 ;
CAmount nPayFee = 0 ;
CAmount nAfterFee = 0 ;
@ -551,11 +520,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
@@ -551,11 +520,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
nBytes + = nQuantity ; // account for the witness byte that holds the number of stack items for each input.
}
// Priority
double mempoolEstimatePriority = mempool . estimateSmartPriority ( nTxConfirmTarget ) ;
dPriority = dPriorityInputs / ( nBytes - nBytesInputs + ( nQuantityUncompressed * 29 ) ) ; // 29 = 180 - 151 (uncompressed public keys are over the limit. max 151 bytes of the input are ignored for priority)
sPriorityLabel = CoinControlDialog : : getPriorityLabel ( dPriority , mempoolEstimatePriority ) ;
// in the subtract fee from amount case, we can tell if zero change already and subtract the bytes, so that fee calculation afterwards is accurate
if ( CoinControlDialog : : fSubtractFeeFromAmount )
if ( nAmount - nPayAmount = = 0 )
@ -568,6 +532,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
@@ -568,6 +532,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
// Allow free? (require at least hard-coded threshold and default to that if no estimate)
double mempoolEstimatePriority = mempool . estimateSmartPriority ( nTxConfirmTarget ) ;
dPriority = dPriorityInputs / ( nBytes - nBytesInputs + ( nQuantityUncompressed * 29 ) ) ; // 29 = 180 - 151 (uncompressed public keys are over the limit. max 151 bytes of the input are ignored for priority)
double dPriorityNeeded = std : : max ( mempoolEstimatePriority , AllowFreeThreshold ( ) ) ;
fAllowFree = ( dPriority > = dPriorityNeeded ) ;
@ -617,7 +583,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
@@ -617,7 +583,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
QLabel * l3 = dialog - > findChild < QLabel * > ( " labelCoinControlFee " ) ;
QLabel * l4 = dialog - > findChild < QLabel * > ( " labelCoinControlAfterFee " ) ;
QLabel * l5 = dialog - > findChild < QLabel * > ( " labelCoinControlBytes " ) ;
QLabel * l6 = dialog - > findChild < QLabel * > ( " labelCoinControlPriority " ) ;
QLabel * l7 = dialog - > findChild < QLabel * > ( " labelCoinControlLowOutput " ) ;
QLabel * l8 = dialog - > findChild < QLabel * > ( " labelCoinControlChange " ) ;
@ -633,7 +598,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
@@ -633,7 +598,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
l3 - > setText ( BitcoinUnits : : formatWithUnit ( nDisplayUnit , nPayFee ) ) ; // Fee
l4 - > setText ( BitcoinUnits : : formatWithUnit ( nDisplayUnit , nAfterFee ) ) ; // After Fee
l5 - > setText ( ( ( nBytes > 0 ) ? ASYMP_UTF8 : " " ) + QString : : number ( nBytes ) ) ; // Bytes
l6 - > setText ( sPriorityLabel ) ; // Priority
l7 - > setText ( fDust ? tr ( " yes " ) : tr ( " no " ) ) ; // Dust
l8 - > setText ( BitcoinUnits : : formatWithUnit ( nDisplayUnit , nChange ) ) ; // Change
if ( nPayFee > 0 & & ( coinControl - > nMinimumTotalFee < nPayFee ) )
@ -644,21 +608,11 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
@@ -644,21 +608,11 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
l8 - > setText ( ASYMP_UTF8 + l8 - > text ( ) ) ;
}
// turn labels "red"
l5 - > setStyleSheet ( ( nBytes > = MAX_FREE_TRANSACTION_CREATE_SIZE ) ? " color:red; " : " " ) ; // Bytes >= 1000
l6 - > setStyleSheet ( ( dPriority > 0 & & ! fAllowFree ) ? " color:red; " : " " ) ; // Priority < "medium"
l7 - > setStyleSheet ( ( fDust ) ? " color:red; " : " " ) ; // Dust = "yes"
// turn label red when dust
l7 - > setStyleSheet ( ( fDust ) ? " color:red; " : " " ) ;
// tool tips
QString toolTip1 = tr ( " This label turns red if the transaction size is greater than 1000 bytes. " ) + " <br /><br /> " ;
toolTip1 + = tr ( " This means a fee of at least %1 per kB is required. " ) . arg ( BitcoinUnits : : formatHtmlWithUnit ( nDisplayUnit , CWallet : : GetRequiredFee ( 1000 ) ) ) + " <br /><br /> " ;
toolTip1 + = tr ( " Can vary +/- 1 byte per input. " ) ;
QString toolTip2 = tr ( " Transactions with higher priority are more likely to get included into a block. " ) + " <br /><br /> " ;
toolTip2 + = tr ( " This label turns red if the priority is smaller than \" medium \" . " ) + " <br /><br /> " ;
toolTip2 + = tr ( " This means a fee of at least %1 per kB is required. " ) . arg ( BitcoinUnits : : formatHtmlWithUnit ( nDisplayUnit , CWallet : : GetRequiredFee ( 1000 ) ) ) ;
QString toolTip3 = tr ( " This label turns red if any recipient receives an amount smaller than the current dust threshold. " ) ;
QString toolTipDust = tr ( " This label turns red if any recipient receives an amount smaller than the current dust threshold. " ) ;
// how many satoshis the estimated fee can vary per byte we guess wrong
double dFeeVary ;
@ -671,14 +625,11 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
@@ -671,14 +625,11 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
l3 - > setToolTip ( toolTip4 ) ;
l4 - > setToolTip ( toolTip4 ) ;
l5 - > setToolTip ( toolTip1 ) ;
l6 - > setToolTip ( toolTip2 ) ;
l7 - > setToolTip ( toolTip3 ) ;
l7 - > setToolTip ( toolTipDust ) ;
l8 - > setToolTip ( toolTip4 ) ;
dialog - > findChild < QLabel * > ( " labelCoinControlFeeText " ) - > setToolTip ( l3 - > toolTip ( ) ) ;
dialog - > findChild < QLabel * > ( " labelCoinControlAfterFeeText " ) - > setToolTip ( l4 - > toolTip ( ) ) ;
dialog - > findChild < QLabel * > ( " labelCoinControlBytesText " ) - > setToolTip ( l5 - > toolTip ( ) ) ;
dialog - > findChild < QLabel * > ( " labelCoinControlPriorityText " ) - > setToolTip ( l6 - > toolTip ( ) ) ;
dialog - > findChild < QLabel * > ( " labelCoinControlLowOutputText " ) - > setToolTip ( l7 - > toolTip ( ) ) ;
dialog - > findChild < QLabel * > ( " labelCoinControlChangeText " ) - > setToolTip ( l8 - > toolTip ( ) ) ;
@ -702,7 +653,6 @@ void CoinControlDialog::updateView()
@@ -702,7 +653,6 @@ void CoinControlDialog::updateView()
QFlags < Qt : : ItemFlag > flgTristate = Qt : : ItemIsSelectable | Qt : : ItemIsEnabled | Qt : : ItemIsUserCheckable | Qt : : ItemIsTristate ;
int nDisplayUnit = model - > getOptionsModel ( ) - > getDisplayUnit ( ) ;
double mempoolEstimatePriority = mempool . estimateSmartPriority ( nTxConfirmTarget ) ;
std : : map < QString , std : : vector < COutput > > mapCoins ;
model - > listCoins ( mapCoins ) ;
@ -731,11 +681,8 @@ void CoinControlDialog::updateView()
@@ -731,11 +681,8 @@ void CoinControlDialog::updateView()
}
CAmount nSum = 0 ;
double dPrioritySum = 0 ;
int nChildren = 0 ;
int nInputSum = 0 ;
BOOST_FOREACH ( const COutput & out , coins . second ) {
int nInputSize = 0 ;
nSum + = out . tx - > vout [ out . i ] . nValue ;
nChildren + + ;
@ -755,11 +702,6 @@ void CoinControlDialog::updateView()
@@ -755,11 +702,6 @@ void CoinControlDialog::updateView()
// if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs
if ( ! treeMode | | ( ! ( sAddress = = sWalletAddress ) ) )
itemOutput - > setText ( COLUMN_ADDRESS , sAddress ) ;
CPubKey pubkey ;
CKeyID * keyid = boost : : get < CKeyID > ( & outputAddress ) ;
if ( keyid & & model - > getPubKey ( * keyid , pubkey ) & & ! pubkey . IsCompressed ( ) )
nInputSize = 29 ; // 29 = 180 - 151 (public key is 180 bytes, priority free area is 151 bytes)
}
// label
@ -788,13 +730,6 @@ void CoinControlDialog::updateView()
@@ -788,13 +730,6 @@ void CoinControlDialog::updateView()
// confirmations
itemOutput - > setText ( COLUMN_CONFIRMATIONS , strPad ( QString : : number ( out . nDepth ) , 8 , " " ) ) ;
// priority
double dPriority = ( ( double ) out . tx - > vout [ out . i ] . nValue / ( nInputSize + 78 ) ) * ( out . nDepth + 1 ) ; // 78 = 2 * 34 + 10
itemOutput - > setText ( COLUMN_PRIORITY , CoinControlDialog : : getPriorityLabel ( dPriority , mempoolEstimatePriority ) ) ;
itemOutput - > setText ( COLUMN_PRIORITY_INT64 , strPad ( QString : : number ( ( int64_t ) dPriority ) , 20 , " " ) ) ;
dPrioritySum + = ( double ) out . tx - > vout [ out . i ] . nValue * ( out . nDepth + 1 ) ;
nInputSum + = nInputSize ;
// transaction hash
uint256 txhash = out . tx - > GetHash ( ) ;
itemOutput - > setText ( COLUMN_TXHASH , QString : : fromStdString ( txhash . GetHex ( ) ) ) ;
@ -819,12 +754,9 @@ void CoinControlDialog::updateView()
@@ -819,12 +754,9 @@ void CoinControlDialog::updateView()
// amount
if ( treeMode )
{
dPrioritySum = dPrioritySum / ( nInputSum + 78 ) ;
itemWalletAddress - > setText ( COLUMN_CHECKBOX , " ( " + QString : : number ( nChildren ) + " ) " ) ;
itemWalletAddress - > setText ( COLUMN_AMOUNT , BitcoinUnits : : format ( nDisplayUnit , nSum ) ) ;
itemWalletAddress - > setText ( COLUMN_AMOUNT_INT64 , strPad ( QString : : number ( nSum ) , 15 , " " ) ) ;
itemWalletAddress - > setText ( COLUMN_PRIORITY , CoinControlDialog : : getPriorityLabel ( dPrioritySum , mempoolEstimatePriority ) ) ;
itemWalletAddress - > setText ( COLUMN_PRIORITY_INT64 , strPad ( QString : : number ( ( int64_t ) dPrioritySum ) , 20 , " " ) ) ;
}
}