Skip to content

Commit

Permalink
[GUI] Add checkable btn in the contextual menu, for sffa with multirows
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed May 17, 2021
1 parent 9d5c1c9 commit cf2311e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/qt/pivx/send.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,11 +863,16 @@ void SendWidget::onMenuClicked(SendMultiRow* entry)
this->menu = new TooltipMenu(window, this);
this->menu->setCopyBtnText(tr("Add Memo"));
this->menu->setEditBtnText(tr("Save contact"));
this->menu->setMinimumSize(this->menu->width() + 30,this->menu->height());
this->menu->setLastBtnVisible(true);
this->menu->setLastBtnText(tr("Subtract fee"));
this->menu->setMinimumHeight(157);
this->menu->setLastBtnCheckable(true, entry->getSubtractFeeFromAmount());
this->menu->setMinimumSize(this->menu->width() + 30, this->menu->height());
connect(this->menu, &TooltipMenu::message, this, &AddressesWidget::message);
connect(this->menu, &TooltipMenu::onEditClicked, this, &SendWidget::onContactMultiClicked);
connect(this->menu, &TooltipMenu::onDeleteClicked, this, &SendWidget::onDeleteClicked);
connect(this->menu, &TooltipMenu::onCopyClicked, this, &SendWidget::onEntryMemoClicked);
connect(this->menu, &TooltipMenu::onLastClicked, this, &SendWidget::onSubtractFeeFromAmountChecked);
} else {
this->menu->hide();
}
Expand Down Expand Up @@ -932,6 +937,13 @@ void SendWidget::onEntryMemoClicked()
}
}

void SendWidget::onSubtractFeeFromAmountChecked()
{
if (focusedEntry) {
focusedEntry->toggleSubtractFeeFromAmount();
}
}

void SendWidget::onDeleteClicked()
{
if (focusedEntry) {
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/send.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private Q_SLOTS:
void onContactMultiClicked();
void onDeleteClicked();
void onEntryMemoClicked();
void onSubtractFeeFromAmountChecked();
void onResetCustomOptions(bool fRefreshAmounts);
void onResetSettings();

Expand Down
6 changes: 6 additions & 0 deletions src/qt/pivx/tooltipmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ void TooltipMenu::setLastBtnText(QString btnText, int minHeight){
ui->btnLast->setMinimumHeight(minHeight);
}

void TooltipMenu::setLastBtnCheckable(bool checkable, bool isChecked)
{
ui->btnLast->setCheckable(checkable);
ui->btnLast->setChecked(isChecked);
}

void TooltipMenu::setCopyBtnVisible(bool visible){
ui->btnCopy->setVisible(visible);
}
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/tooltipmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TooltipMenu : public PWidget
void setDeleteBtnVisible(bool visible);
void setEditBtnVisible(bool visible);
void setLastBtnVisible(bool visible);
void setLastBtnCheckable(bool checkable, bool isChecked);

Q_SIGNALS:
void onDeleteClicked();
Expand Down

0 comments on commit cf2311e

Please sign in to comment.