VerifyProofDialog: minor fixes

- Fix layout issue on macOS
- Simplify button logic
- Set verify button to default
This commit is contained in:
tobtoht 2020-11-24 20:26:57 +01:00
parent 03f484c2ae
commit e2eb32ce78
3 changed files with 87 additions and 129 deletions

View file

@ -16,26 +16,28 @@ VerifyProofDialog::VerifyProofDialog(Wallet *wallet, QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->btn_verifySpendProof, &QPushButton::clicked, this, &VerifyProofDialog::checkSpendProof); connect(ui->btn_verify, &QPushButton::clicked, this, &VerifyProofDialog::checkProof);
connect(ui->btn_verifyOutProof, &QPushButton::clicked, this, &VerifyProofDialog::checkOutProof);
connect(ui->btn_verifyInProof, &QPushButton::clicked, this, &VerifyProofDialog::checkInProof);
connect(ui->btn_spendClear, &QPushButton::clicked, [this](){ connect(ui->btn_clear, &QPushButton::clicked, [this]{
switch (ui->tabWidget->currentIndex()) {
case 0:
ui->lineEdit_spendTxID->clear(); ui->lineEdit_spendTxID->clear();
ui->lineEdit_spendMessage->clear(); ui->lineEdit_spendMessage->clear();
ui->input_SpendProof->clear(); ui->input_SpendProof->clear();
}); break;
connect(ui->btn_outClear, &QPushButton::clicked, [this](){ case 1:
ui->lineEdit_outTxID->clear(); ui->lineEdit_outTxID->clear();
ui->lineEdit_outAddress->clear(); ui->lineEdit_outAddress->clear();
ui->lineEdit_outMessage->clear(); ui->lineEdit_outMessage->clear();
ui->input_OutProof->clear(); ui->input_OutProof->clear();
}); break;
connect(ui->btn_inClear, &QPushButton::clicked, [this](){ case 2:
ui->lineEdit_inTxID->clear(); ui->lineEdit_inTxID->clear();
ui->lineEdit_inAddress->clear(); ui->lineEdit_inAddress->clear();
ui->lineEdit_inMessage->clear(); ui->lineEdit_inMessage->clear();
ui->input_InProof->clear(); ui->input_InProof->clear();
break;
}
}); });
} }
@ -44,6 +46,20 @@ VerifyProofDialog::~VerifyProofDialog()
delete ui; delete ui;
} }
void VerifyProofDialog::checkProof() {
switch (ui->tabWidget->currentIndex()) {
case 0:
this->checkSpendProof();
break;
case 1:
this->checkOutProof();
break;
case 2:
this->checkInProof();
break;
}
}
void VerifyProofDialog::checkSpendProof() { void VerifyProofDialog::checkSpendProof() {
auto r = m_wallet->checkSpendProof(ui->lineEdit_spendTxID->text(), ui->lineEdit_spendMessage->text(), ui->input_SpendProof->toPlainText()); auto r = m_wallet->checkSpendProof(ui->lineEdit_spendTxID->text(), ui->lineEdit_spendMessage->text(), ui->input_SpendProof->toPlainText());

View file

@ -20,12 +20,13 @@ public:
~VerifyProofDialog() override; ~VerifyProofDialog() override;
private slots: private slots:
void checkSpendProof(); void checkProof();
void checkOutProof();
void checkInProof();
private: private:
void checkTxProof(const QString &txId, const QString &address, const QString &message, const QString &signature); void checkTxProof(const QString &txId, const QString &address, const QString &message, const QString &signature);
void checkSpendProof();
void checkOutProof();
void checkInProof();
Ui::VerifyProofDialog *ui; Ui::VerifyProofDialog *ui;
Wallet *m_wallet; Wallet *m_wallet;

View file

@ -39,17 +39,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QFormLayout" name="formLayout"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Transaction ID:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_spendTxID"/>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
@ -57,10 +47,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="0" column="1">
<widget class="QLabel" name="label_5"> <widget class="QLineEdit" name="lineEdit_spendTxID"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>SpendProof:</string> <string>Transaction ID:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -71,6 +64,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>SpendProof:</string>
</property>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QPlainTextEdit" name="input_SpendProof"> <widget class="QPlainTextEdit" name="input_SpendProof">
<property name="overwriteMode"> <property name="overwriteMode">
@ -96,37 +96,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_spendClear">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_verifySpendProof">
<property name="text">
<string>Verify</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="OutProof"> <widget class="QWidget" name="OutProof">
@ -213,37 +182,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_outClear">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_verifyOutProof">
<property name="text">
<string>Verify</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="InProof"> <widget class="QWidget" name="InProof">
@ -331,10 +269,14 @@
</property> </property>
</spacer> </spacer>
</item> </item>
</layout>
</widget>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -347,27 +289,26 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btn_inClear"> <widget class="QPushButton" name="btn_clear">
<property name="text"> <property name="text">
<string>Clear</string> <string>Clear</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btn_verifyInProof"> <widget class="QPushButton" name="btn_verify">
<property name="text"> <property name="text">
<string>Verify</string> <string>Verify</string>
</property> </property>
<property name="default">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</item>
</layout>
</widget>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>