Skip to content

Commit fa8dd78

Browse files
author
MarcoFalke
committed
[qt] Remove Priority from coincontrol dialog
1 parent 6e6ab2c commit fa8dd78

File tree

6 files changed

+27
-181
lines changed

6 files changed

+27
-181
lines changed

src/qt/coincontroldialog.cpp

Lines changed: 11 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
7676
QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this);
7777
QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this);
7878
QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this);
79-
QAction *clipboardPriorityAction = new QAction(tr("Copy priority"), this);
8079
QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this);
8180
QAction *clipboardChangeAction = new QAction(tr("Copy change"), this);
8281

@@ -85,7 +84,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
8584
connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee()));
8685
connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee()));
8786
connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes()));
88-
connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(clipboardPriority()));
8987
connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput()));
9088
connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange()));
9189

@@ -94,7 +92,6 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
9492
ui->labelCoinControlFee->addAction(clipboardFeeAction);
9593
ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction);
9694
ui->labelCoinControlBytes->addAction(clipboardBytesAction);
97-
ui->labelCoinControlPriority->addAction(clipboardPriorityAction);
9895
ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction);
9996
ui->labelCoinControlChange->addAction(clipboardChangeAction);
10097

@@ -124,16 +121,14 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget
124121
ui->treeWidget->headerItem()->setText(COLUMN_CHECKBOX, QString());
125122

126123
ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 84);
127-
ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 100);
128-
ui->treeWidget->setColumnWidth(COLUMN_LABEL, 170);
129-
ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 290);
130-
ui->treeWidget->setColumnWidth(COLUMN_DATE, 110);
131-
ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 100);
132-
ui->treeWidget->setColumnWidth(COLUMN_PRIORITY, 100);
124+
ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 110);
125+
ui->treeWidget->setColumnWidth(COLUMN_LABEL, 190);
126+
ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 320);
127+
ui->treeWidget->setColumnWidth(COLUMN_DATE, 130);
128+
ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 110);
133129
ui->treeWidget->setColumnHidden(COLUMN_TXHASH, true); // store transaction hash in this column, but don't show it
134130
ui->treeWidget->setColumnHidden(COLUMN_VOUT_INDEX, true); // store vout index in this column, but don't show it
135131
ui->treeWidget->setColumnHidden(COLUMN_AMOUNT_INT64, true); // store amount int64 in this column, but don't show it
136-
ui->treeWidget->setColumnHidden(COLUMN_PRIORITY_INT64, true); // store priority int64 in this column, but don't show it
137132
ui->treeWidget->setColumnHidden(COLUMN_DATE_INT64, true); // store date int64 in this column, but don't show it
138133

139134
// default view is sorted by amount desc
@@ -325,12 +320,6 @@ void CoinControlDialog::clipboardBytes()
325320
GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace(ASYMP_UTF8, ""));
326321
}
327322

328-
// copy label "Priority" to clipboard
329-
void CoinControlDialog::clipboardPriority()
330-
{
331-
GUIUtil::setClipboard(ui->labelCoinControlPriority->text());
332-
}
333-
334323
// copy label "Dust" to clipboard
335324
void CoinControlDialog::clipboardLowOutput()
336325
{
@@ -419,25 +408,6 @@ void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
419408
#endif
420409
}
421410

422-
// return human readable label for priority number
423-
QString CoinControlDialog::getPriorityLabel(double dPriority, double mempoolEstimatePriority)
424-
{
425-
double dPriorityMedium = mempoolEstimatePriority;
426-
427-
if (dPriorityMedium <= 0)
428-
dPriorityMedium = AllowFreeThreshold(); // not enough data, back to hard-coded
429-
430-
if (dPriority / 1000000 > dPriorityMedium) return tr("highest");
431-
else if (dPriority / 100000 > dPriorityMedium) return tr("higher");
432-
else if (dPriority / 10000 > dPriorityMedium) return tr("high");
433-
else if (dPriority / 1000 > dPriorityMedium) return tr("medium-high");
434-
else if (dPriority > dPriorityMedium) return tr("medium");
435-
else if (dPriority * 10 > dPriorityMedium) return tr("low-medium");
436-
else if (dPriority * 100 > dPriorityMedium) return tr("low");
437-
else if (dPriority * 1000 > dPriorityMedium) return tr("lower");
438-
else return tr("lowest");
439-
}
440-
441411
// shows count of locked unspent outputs
442412
void CoinControlDialog::updateLabelLocked()
443413
{
@@ -473,7 +443,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
473443
}
474444
}
475445

476-
QString sPriorityLabel = tr("none");
477446
CAmount nAmount = 0;
478447
CAmount nPayFee = 0;
479448
CAmount nAfterFee = 0;
@@ -551,11 +520,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
551520
nBytes += nQuantity; // account for the witness byte that holds the number of stack items for each input.
552521
}
553522

554-
// Priority
555-
double mempoolEstimatePriority = mempool.estimateSmartPriority(nTxConfirmTarget);
556-
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)
557-
sPriorityLabel = CoinControlDialog::getPriorityLabel(dPriority, mempoolEstimatePriority);
558-
559523
// 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
560524
if (CoinControlDialog::fSubtractFeeFromAmount)
561525
if (nAmount - nPayAmount == 0)
@@ -568,6 +532,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
568532

569533

570534
// Allow free? (require at least hard-coded threshold and default to that if no estimate)
535+
double mempoolEstimatePriority = mempool.estimateSmartPriority(nTxConfirmTarget);
536+
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)
571537
double dPriorityNeeded = std::max(mempoolEstimatePriority, AllowFreeThreshold());
572538
fAllowFree = (dPriority >= dPriorityNeeded);
573539

@@ -617,7 +583,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
617583
QLabel *l3 = dialog->findChild<QLabel *>("labelCoinControlFee");
618584
QLabel *l4 = dialog->findChild<QLabel *>("labelCoinControlAfterFee");
619585
QLabel *l5 = dialog->findChild<QLabel *>("labelCoinControlBytes");
620-
QLabel *l6 = dialog->findChild<QLabel *>("labelCoinControlPriority");
621586
QLabel *l7 = dialog->findChild<QLabel *>("labelCoinControlLowOutput");
622587
QLabel *l8 = dialog->findChild<QLabel *>("labelCoinControlChange");
623588

@@ -633,7 +598,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
633598
l3->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee
634599
l4->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee
635600
l5->setText(((nBytes > 0) ? ASYMP_UTF8 : "") + QString::number(nBytes)); // Bytes
636-
l6->setText(sPriorityLabel); // Priority
637601
l7->setText(fDust ? tr("yes") : tr("no")); // Dust
638602
l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
639603
if (nPayFee > 0 && (coinControl->nMinimumTotalFee < nPayFee))
@@ -644,21 +608,11 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
644608
l8->setText(ASYMP_UTF8 + l8->text());
645609
}
646610

647-
// turn labels "red"
648-
l5->setStyleSheet((nBytes >= MAX_FREE_TRANSACTION_CREATE_SIZE) ? "color:red;" : "");// Bytes >= 1000
649-
l6->setStyleSheet((dPriority > 0 && !fAllowFree) ? "color:red;" : ""); // Priority < "medium"
650-
l7->setStyleSheet((fDust) ? "color:red;" : ""); // Dust = "yes"
611+
// turn label red when dust
612+
l7->setStyleSheet((fDust) ? "color:red;" : "");
651613

652614
// tool tips
653-
QString toolTip1 = tr("This label turns red if the transaction size is greater than 1000 bytes.") + "<br /><br />";
654-
toolTip1 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, CWallet::GetRequiredFee(1000))) + "<br /><br />";
655-
toolTip1 += tr("Can vary +/- 1 byte per input.");
656-
657-
QString toolTip2 = tr("Transactions with higher priority are more likely to get included into a block.") + "<br /><br />";
658-
toolTip2 += tr("This label turns red if the priority is smaller than \"medium\".") + "<br /><br />";
659-
toolTip2 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatHtmlWithUnit(nDisplayUnit, CWallet::GetRequiredFee(1000)));
660-
661-
QString toolTip3 = tr("This label turns red if any recipient receives an amount smaller than the current dust threshold.");
615+
QString toolTipDust = tr("This label turns red if any recipient receives an amount smaller than the current dust threshold.");
662616

663617
// how many satoshis the estimated fee can vary per byte we guess wrong
664618
double dFeeVary;
@@ -671,14 +625,11 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
671625

672626
l3->setToolTip(toolTip4);
673627
l4->setToolTip(toolTip4);
674-
l5->setToolTip(toolTip1);
675-
l6->setToolTip(toolTip2);
676-
l7->setToolTip(toolTip3);
628+
l7->setToolTip(toolTipDust);
677629
l8->setToolTip(toolTip4);
678630
dialog->findChild<QLabel *>("labelCoinControlFeeText") ->setToolTip(l3->toolTip());
679631
dialog->findChild<QLabel *>("labelCoinControlAfterFeeText") ->setToolTip(l4->toolTip());
680632
dialog->findChild<QLabel *>("labelCoinControlBytesText") ->setToolTip(l5->toolTip());
681-
dialog->findChild<QLabel *>("labelCoinControlPriorityText") ->setToolTip(l6->toolTip());
682633
dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setToolTip(l7->toolTip());
683634
dialog->findChild<QLabel *>("labelCoinControlChangeText") ->setToolTip(l8->toolTip());
684635

@@ -702,7 +653,6 @@ void CoinControlDialog::updateView()
702653
QFlags<Qt::ItemFlag> flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;
703654

704655
int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
705-
double mempoolEstimatePriority = mempool.estimateSmartPriority(nTxConfirmTarget);
706656

707657
std::map<QString, std::vector<COutput> > mapCoins;
708658
model->listCoins(mapCoins);
@@ -731,11 +681,8 @@ void CoinControlDialog::updateView()
731681
}
732682

733683
CAmount nSum = 0;
734-
double dPrioritySum = 0;
735684
int nChildren = 0;
736-
int nInputSum = 0;
737685
BOOST_FOREACH(const COutput& out, coins.second) {
738-
int nInputSize = 0;
739686
nSum += out.tx->vout[out.i].nValue;
740687
nChildren++;
741688

@@ -755,11 +702,6 @@ void CoinControlDialog::updateView()
755702
// if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs
756703
if (!treeMode || (!(sAddress == sWalletAddress)))
757704
itemOutput->setText(COLUMN_ADDRESS, sAddress);
758-
759-
CPubKey pubkey;
760-
CKeyID *keyid = boost::get<CKeyID>(&outputAddress);
761-
if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed())
762-
nInputSize = 29; // 29 = 180 - 151 (public key is 180 bytes, priority free area is 151 bytes)
763705
}
764706

765707
// label
@@ -788,13 +730,6 @@ void CoinControlDialog::updateView()
788730
// confirmations
789731
itemOutput->setText(COLUMN_CONFIRMATIONS, strPad(QString::number(out.nDepth), 8, " "));
790732

791-
// priority
792-
double dPriority = ((double)out.tx->vout[out.i].nValue / (nInputSize + 78)) * (out.nDepth+1); // 78 = 2 * 34 + 10
793-
itemOutput->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPriority, mempoolEstimatePriority));
794-
itemOutput->setText(COLUMN_PRIORITY_INT64, strPad(QString::number((int64_t)dPriority), 20, " "));
795-
dPrioritySum += (double)out.tx->vout[out.i].nValue * (out.nDepth+1);
796-
nInputSum += nInputSize;
797-
798733
// transaction hash
799734
uint256 txhash = out.tx->GetHash();
800735
itemOutput->setText(COLUMN_TXHASH, QString::fromStdString(txhash.GetHex()));
@@ -819,12 +754,9 @@ void CoinControlDialog::updateView()
819754
// amount
820755
if (treeMode)
821756
{
822-
dPrioritySum = dPrioritySum / (nInputSum + 78);
823757
itemWalletAddress->setText(COLUMN_CHECKBOX, "(" + QString::number(nChildren) + ")");
824758
itemWalletAddress->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, nSum));
825759
itemWalletAddress->setText(COLUMN_AMOUNT_INT64, strPad(QString::number(nSum), 15, " "));
826-
itemWalletAddress->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPrioritySum, mempoolEstimatePriority));
827-
itemWalletAddress->setText(COLUMN_PRIORITY_INT64, strPad(QString::number((int64_t)dPrioritySum), 20, " "));
828760
}
829761
}
830762

src/qt/coincontroldialog.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class CoinControlDialog : public QDialog
4040

4141
// static because also called from sendcoinsdialog
4242
static void updateLabels(WalletModel*, QDialog*);
43-
static QString getPriorityLabel(double dPriority, double mempoolEstimatePriority);
4443

4544
static QList<CAmount> payAmounts;
4645
static CCoinControl *coinControl;
@@ -72,11 +71,9 @@ class CoinControlDialog : public QDialog
7271
COLUMN_ADDRESS,
7372
COLUMN_DATE,
7473
COLUMN_CONFIRMATIONS,
75-
COLUMN_PRIORITY,
7674
COLUMN_TXHASH,
7775
COLUMN_VOUT_INDEX,
7876
COLUMN_AMOUNT_INT64,
79-
COLUMN_PRIORITY_INT64,
8077
COLUMN_DATE_INT64
8178
};
8279

@@ -87,17 +84,13 @@ class CoinControlDialog : public QDialog
8784
{
8885
if (column == COLUMN_AMOUNT_INT64)
8986
return COLUMN_AMOUNT;
90-
else if (column == COLUMN_PRIORITY_INT64)
91-
return COLUMN_PRIORITY;
9287
else if (column == COLUMN_DATE_INT64)
9388
return COLUMN_DATE;
9489
}
9590
else
9691
{
9792
if (column == COLUMN_AMOUNT)
9893
return COLUMN_AMOUNT_INT64;
99-
else if (column == COLUMN_PRIORITY)
100-
return COLUMN_PRIORITY_INT64;
10194
else if (column == COLUMN_DATE)
10295
return COLUMN_DATE_INT64;
10396
}
@@ -118,7 +111,6 @@ private Q_SLOTS:
118111
void clipboardFee();
119112
void clipboardAfterFee();
120113
void clipboardBytes();
121-
void clipboardPriority();
122114
void clipboardLowOutput();
123115
void clipboardChange();
124116
void radioTreeMode(bool);

src/qt/forms/coincontroldialog.ui

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -140,28 +140,34 @@
140140
</widget>
141141
</item>
142142
<item row="1" column="0">
143-
<widget class="QLabel" name="labelCoinControlPriorityText">
143+
<widget class="QLabel" name="labelCoinControlLowOutputText">
144+
<property name="enabled">
145+
<bool>false</bool>
146+
</property>
144147
<property name="font">
145148
<font>
146149
<weight>75</weight>
147150
<bold>true</bold>
148151
</font>
149152
</property>
150153
<property name="text">
151-
<string>Priority:</string>
154+
<string>Dust:</string>
152155
</property>
153156
</widget>
154157
</item>
155158
<item row="1" column="1">
156-
<widget class="QLabel" name="labelCoinControlPriority">
159+
<widget class="QLabel" name="labelCoinControlLowOutput">
160+
<property name="enabled">
161+
<bool>false</bool>
162+
</property>
157163
<property name="cursor">
158164
<cursorShape>IBeamCursor</cursorShape>
159165
</property>
160166
<property name="contextMenuPolicy">
161167
<enum>Qt::ActionsContextMenu</enum>
162168
</property>
163169
<property name="text">
164-
<string notr="true">medium</string>
170+
<string notr="true">no</string>
165171
</property>
166172
<property name="textInteractionFlags">
167173
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
@@ -213,41 +219,6 @@
213219
</property>
214220
</widget>
215221
</item>
216-
<item row="1" column="0">
217-
<widget class="QLabel" name="labelCoinControlLowOutputText">
218-
<property name="enabled">
219-
<bool>false</bool>
220-
</property>
221-
<property name="font">
222-
<font>
223-
<weight>75</weight>
224-
<bold>true</bold>
225-
</font>
226-
</property>
227-
<property name="text">
228-
<string>Dust:</string>
229-
</property>
230-
</widget>
231-
</item>
232-
<item row="1" column="1">
233-
<widget class="QLabel" name="labelCoinControlLowOutput">
234-
<property name="enabled">
235-
<bool>false</bool>
236-
</property>
237-
<property name="cursor">
238-
<cursorShape>IBeamCursor</cursorShape>
239-
</property>
240-
<property name="contextMenuPolicy">
241-
<enum>Qt::ActionsContextMenu</enum>
242-
</property>
243-
<property name="text">
244-
<string notr="true">no</string>
245-
</property>
246-
<property name="textInteractionFlags">
247-
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
248-
</property>
249-
</widget>
250-
</item>
251222
</layout>
252223
</item>
253224
<item>
@@ -431,7 +402,7 @@
431402
<bool>false</bool>
432403
</property>
433404
<property name="columnCount">
434-
<number>12</number>
405+
<number>10</number>
435406
</property>
436407
<attribute name="headerShowSortIndicator" stdset="0">
437408
<bool>true</bool>
@@ -472,16 +443,6 @@
472443
<string>Confirmed</string>
473444
</property>
474445
</column>
475-
<column>
476-
<property name="text">
477-
<string>Priority</string>
478-
</property>
479-
</column>
480-
<column>
481-
<property name="text">
482-
<string/>
483-
</property>
484-
</column>
485446
<column>
486447
<property name="text">
487448
<string/>

0 commit comments

Comments
 (0)