Browse Source

adapt user-experience from messagepage / move placeholderTexts from XML to source to avoid a problem with Qt < 4.7 / add eventFilter for address field to select text when clicking in / add Clear All button / rework strings

0.8
Philip Kaufmann 13 years ago
parent
commit
34aa3112c8
  1. 84
      src/qt/forms/verifymessagedialog.ui
  2. 35
      src/qt/verifymessagedialog.cpp
  3. 19
      src/qt/verifymessagedialog.h

84
src/qt/forms/verifymessagedialog.ui

@ -17,7 +17,7 @@
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Enter the message and signature below (be careful to correctly copy newlines, spaces, tabs, and other invisible characters), and press apply to obtain the bitcoin address used to sign the message.</string> <string>Enter the message and signature below (be careful to correctly copy newlines, spaces, tabs and other invisible characters) to obtain the Bitcoin address used to sign the message.</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -35,9 +35,6 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="placeholderText">
<string>Signature</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -48,9 +45,6 @@
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="placeholderText">
<string>Address</string>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -62,6 +56,20 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="verifyMessage">
<property name="toolTip">
<string>Verify a message and obtain the Bitcoin address used to sign the message</string>
</property>
<property name="text">
<string>&amp;Verify Message</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/transaction_0</normaloff>:/icons/transaction_0</iconset>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="copyToClipboard"> <widget class="QPushButton" name="copyToClipboard">
<property name="enabled"> <property name="enabled">
@ -79,6 +87,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="toolTip">
<string>Reset all verify message fields</string>
</property>
<property name="text">
<string>Clear &amp;All</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -92,19 +114,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Close</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -112,38 +121,5 @@
<resources> <resources>
<include location="../bitcoin.qrc"/> <include location="../bitcoin.qrc"/>
</resources> </resources>
<connections> <connections/>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>VerifyMessageDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>VerifyMessageDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>

35
src/qt/verifymessagedialog.cpp

@ -22,7 +22,16 @@ VerifyMessageDialog::VerifyMessageDialog(AddressTableModel *addressModel, QWidge
{ {
ui->setupUi(this); ui->setupUi(this);
#if (QT_VERSION >= 0x040700)
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
ui->lnSig->setPlaceholderText(tr("Enter Bitcoin signature"));
ui->lnAddress->setPlaceholderText(tr("Click \"Apply\" to obtain address"));
#endif
GUIUtil::setupAddressWidget(ui->lnAddress, this); GUIUtil::setupAddressWidget(ui->lnAddress, this);
ui->lnAddress->installEventFilter(this);
ui->edMessage->setFocus();
} }
VerifyMessageDialog::~VerifyMessageDialog() VerifyMessageDialog::~VerifyMessageDialog()
@ -63,13 +72,33 @@ bool VerifyMessageDialog::checkAddress()
return true; return true;
} }
void VerifyMessageDialog::on_buttonBox_clicked(QAbstractButton *button) void VerifyMessageDialog::on_verifyMessage_clicked()
{ {
if(ui->buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole) checkAddress();
checkAddress();
} }
void VerifyMessageDialog::on_copyToClipboard_clicked() void VerifyMessageDialog::on_copyToClipboard_clicked()
{ {
QApplication::clipboard()->setText(ui->lnAddress->text()); QApplication::clipboard()->setText(ui->lnAddress->text());
} }
void VerifyMessageDialog::on_clearButton_clicked()
{
ui->edMessage->clear();
ui->lnSig->clear();
ui->lnAddress->clear();
ui->lblStatus->clear();
ui->edMessage->setFocus();
}
bool VerifyMessageDialog::eventFilter(QObject *object, QEvent *event)
{
if(object == ui->lnAddress && (event->type() == QEvent::MouseButtonPress ||
event->type() == QEvent::FocusIn))
{
ui->lnAddress->selectAll();
return true;
}
return QDialog::eventFilter(object, event);
}

19
src/qt/verifymessagedialog.h

@ -3,16 +3,14 @@
#include <QDialog> #include <QDialog>
namespace Ui {
class VerifyMessageDialog;
}
class AddressTableModel; class AddressTableModel;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractButton;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Ui {
class VerifyMessageDialog;
}
class VerifyMessageDialog : public QDialog class VerifyMessageDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -21,16 +19,19 @@ public:
explicit VerifyMessageDialog(AddressTableModel *addressModel, QWidget *parent = 0); explicit VerifyMessageDialog(AddressTableModel *addressModel, QWidget *parent = 0);
~VerifyMessageDialog(); ~VerifyMessageDialog();
private slots: protected:
void on_buttonBox_clicked(QAbstractButton *button); bool eventFilter(QObject *object, QEvent *event);
void on_copyToClipboard_clicked();
private: private:
bool checkAddress(); bool checkAddress();
Ui::VerifyMessageDialog *ui; Ui::VerifyMessageDialog *ui;
AddressTableModel *model; AddressTableModel *model;
private slots:
void on_verifyMessage_clicked();
void on_copyToClipboard_clicked();
void on_clearButton_clicked();
}; };
#endif // VERIFYMESSAGEDIALOG_H #endif // VERIFYMESSAGEDIALOG_H

Loading…
Cancel
Save