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]{
ui->lineEdit_spendTxID->clear(); switch (ui->tabWidget->currentIndex()) {
ui->lineEdit_spendMessage->clear(); case 0:
ui->input_SpendProof->clear(); ui->lineEdit_spendTxID->clear();
}); ui->lineEdit_spendMessage->clear();
connect(ui->btn_outClear, &QPushButton::clicked, [this](){ ui->input_SpendProof->clear();
ui->lineEdit_outTxID->clear(); break;
ui->lineEdit_outAddress->clear(); case 1:
ui->lineEdit_outMessage->clear(); ui->lineEdit_outTxID->clear();
ui->input_OutProof->clear(); ui->lineEdit_outAddress->clear();
}); ui->lineEdit_outMessage->clear();
connect(ui->btn_inClear, &QPushButton::clicked, [this](){ ui->input_OutProof->clear();
ui->lineEdit_inTxID->clear(); break;
ui->lineEdit_inAddress->clear(); case 2:
ui->lineEdit_inMessage->clear(); ui->lineEdit_inTxID->clear();
ui->input_InProof->clear(); ui->lineEdit_inAddress->clear();
ui->lineEdit_inMessage->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,41 +269,44 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer_3">
<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_inClear">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_verifyInProof">
<property name="text">
<string>Verify</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
</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_clear">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_verify">
<property name="text">
<string>Verify</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>