mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge pull request #589 from crowning-/v0.12.1.x
UI: button to toggle lock-state for all inputs in coin-control dialog
This commit is contained in:
commit
39c2e40b64
@ -121,6 +121,9 @@ CoinControlDialog::CoinControlDialog(QWidget *parent) :
|
||||
// (un)select all
|
||||
connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked()));
|
||||
|
||||
// Toggle lock state
|
||||
connect(ui->pushButtonToggleLock, SIGNAL(clicked()), this, SLOT(buttonToggleLockClicked()));
|
||||
|
||||
// change coin control first column label due Qt4 bug.
|
||||
// see https://github.com/bitcoin/bitcoin/issues/5716
|
||||
ui->treeWidget->headerItem()->setText(COLUMN_CHECKBOX, QString());
|
||||
@ -210,6 +213,40 @@ void CoinControlDialog::buttonSelectAllClicked()
|
||||
CoinControlDialog::updateLabels(model, this);
|
||||
}
|
||||
|
||||
// Toggle lock state
|
||||
void CoinControlDialog::buttonToggleLockClicked()
|
||||
{
|
||||
QTreeWidgetItem *item;
|
||||
// Works in list-mode only
|
||||
if(ui->radioListMode->isChecked()){
|
||||
ui->treeWidget->setEnabled(false);
|
||||
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++){
|
||||
item = ui->treeWidget->topLevelItem(i);
|
||||
COutPoint outpt(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt());
|
||||
if (model->isLockedCoin(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt())){
|
||||
model->unlockCoin(outpt);
|
||||
item->setDisabled(false);
|
||||
item->setIcon(COLUMN_CHECKBOX, QIcon());
|
||||
}
|
||||
else{
|
||||
model->lockCoin(outpt);
|
||||
item->setDisabled(true);
|
||||
item->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
|
||||
}
|
||||
updateLabelLocked();
|
||||
}
|
||||
ui->treeWidget->setEnabled(true);
|
||||
CoinControlDialog::updateLabels(model, this);
|
||||
}
|
||||
else{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setObjectName("lockMessageBox");
|
||||
msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
|
||||
msgBox.setText(tr("Please switch to \"List mode\" to use this function."));
|
||||
msgBox.exec();
|
||||
}
|
||||
}
|
||||
|
||||
// context menu
|
||||
void CoinControlDialog::showMenu(const QPoint &point)
|
||||
{
|
||||
|
@ -122,6 +122,7 @@ private slots:
|
||||
void headerSectionClicked(int);
|
||||
void buttonBoxClicked(QAbstractButton*);
|
||||
void buttonSelectAllClicked();
|
||||
void buttonToggleLockClicked();
|
||||
void updateLabelLocked();
|
||||
};
|
||||
|
||||
|
@ -348,7 +348,7 @@
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutPanel" stretch="0,0,0,0,0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutPanel" stretch="0,0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>14</number>
|
||||
</property>
|
||||
@ -368,6 +368,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonToggleLock">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>toggle lock state</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioTreeMode">
|
||||
<property name="sizePolicy">
|
||||
|
@ -1328,6 +1328,12 @@ padding-right:10px;
|
||||
min-height:25px;
|
||||
}
|
||||
|
||||
QDialog#CoinControlDialog .QFrame#frame .QPushButton#pushButtonToggleLock { /* Toggle lock state button */
|
||||
padding-left:10px;
|
||||
padding-right:10px;
|
||||
min-height:25px;
|
||||
}
|
||||
|
||||
QDialog#CoinControlDialog .QDialogButtonBox#buttonBox QPushButton { /* Coin Control 'OK' button */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user