Merge pull request #153 from fsb4000/QR_CODE
authorCryptoManiac <CryptoManiac@users.noreply.github.com>
Tue, 10 Feb 2015 18:24:48 +0000 (21:24 +0300)
committerCryptoManiac <CryptoManiac@users.noreply.github.com>
Tue, 10 Feb 2015 18:24:48 +0000 (21:24 +0300)
Поддержка QR кодов при самостоятельной сборке Linux клиента

src/qt/bitcoingui.cpp
src/qt/forms/signverifymessagedialog.ui
src/qt/sendcoinsentry.cpp
src/qt/signverifymessagedialog.cpp
src/qt/signverifymessagedialog.h
src/qt/transactiondescdialog.cpp
src/qt/transactiondescdialog.h
src/qt/transactionview.cpp

index a275cc8..03a91db 100644 (file)
@@ -86,7 +86,8 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
     rpcConsole(0),
     aboutDialog(0),
     optionsDialog(0),
-    multisigPage(0)
+    multisigPage(0),
+    signVerifyMessageDialog(0)
 {
     resize(850, 550);
     setWindowTitle(tr("NovaCoin") + " - " + tr("Wallet"));
@@ -133,7 +134,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
 
     sendCoinsPage = new SendCoinsDialog(this);
 
-    signVerifyMessageDialog = new SignVerifyMessageDialog(this);
+    signVerifyMessageDialog = new SignVerifyMessageDialog(0);
 
     multisigPage = new MultisigDialog(0);
 
@@ -226,6 +227,7 @@ BitcoinGUI::~BitcoinGUI()
     delete aboutDialog;
     delete optionsDialog;
     delete multisigPage;
+    delete signVerifyMessageDialog;
 }
 
 void BitcoinGUI::createActions()
index 7808547..19ce198 100644 (file)
@@ -1,7 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>SignVerifyMessageDialog</class>
- <widget class="QDialog" name="SignVerifyMessageDialog">
+ <widget class="QWidget" name="SignVerifyMessageDialog">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
   <property name="geometry">
    <rect>
     <x>0</x>
@@ -13,9 +16,6 @@
   <property name="windowTitle">
    <string>Signatures - Sign / Verify a Message</string>
   </property>
-  <property name="modal">
-   <bool>true</bool>
-  </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
     <widget class="QTabWidget" name="tabWidget">
index 0b5db26..7e960be 100644 (file)
@@ -59,10 +59,8 @@ void SendCoinsEntry::on_payTo_textChanged(const QString &address)
 {
     if(!model)
         return;
-    // Fill in label from address book, if address has an associated label
-    QString associatedLabel = model->getAddressTableModel()->labelForAddress(address);
-    if(!associatedLabel.isEmpty())
-        ui->addAsLabel->setText(associatedLabel);
+    // Fill in label from address book
+    ui->addAsLabel->setText(model->getAddressTableModel()->labelForAddress(address));
 }
 
 void SendCoinsEntry::setModel(WalletModel *model)
index 6bb5842..187fe13 100644 (file)
 #include <vector>
 
 #include <QClipboard>
+#include <QKeyEvent>
 
 SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
-    QDialog(parent, DIALOGWINDOWHINTS),
+    QWidget(parent, DIALOGWINDOWHINTS),
     ui(new Ui::SignVerifyMessageDialog),
     model(0)
 {
@@ -271,5 +272,20 @@ bool SignVerifyMessageDialog::eventFilter(QObject *object, QEvent *event)
             ui->statusLabel_VM->clear();
         }
     }
-    return QDialog::eventFilter(object, event);
+    return QWidget::eventFilter(object, event);
 }
+
+void SignVerifyMessageDialog::keyPressEvent(QKeyEvent *event)
+{
+#ifdef ANDROID
+    if(event->key() == Qt::Key_Back)
+    {
+        close();
+    }
+#else
+    if(event->key() == Qt::Key_Escape)
+    {
+        close();
+    }
+#endif
+}
\ No newline at end of file
index 5569c8b..e177d00 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef SIGNVERIFYMESSAGEDIALOG_H
 #define SIGNVERIFYMESSAGEDIALOG_H
 
-#include <QDialog>
+#include <QWidget>
 
 namespace Ui {
     class SignVerifyMessageDialog;
@@ -11,7 +11,7 @@ class WalletModel;
 QT_BEGIN_NAMESPACE
 QT_END_NAMESPACE
 
-class SignVerifyMessageDialog : public QDialog
+class SignVerifyMessageDialog : public QWidget
 {
     Q_OBJECT
 
@@ -28,6 +28,7 @@ public:
 
 protected:
     bool eventFilter(QObject *object, QEvent *event);
+    void keyPressEvent(QKeyEvent *);
 
 private:
     Ui::SignVerifyMessageDialog *ui;
index c79792d..4c62e4b 100644 (file)
@@ -34,4 +34,10 @@ void TransactionDescDialog::keyPressEvent(QKeyEvent *event)
         close();
     }
 #endif
-}
\ No newline at end of file
+}
+
+void TransactionDescDialog::closeEvent(QCloseEvent *e)
+{
+    emit(stopExec());
+    QWidget::closeEvent(e);
+}
index 4d74821..3f39e41 100644 (file)
@@ -16,6 +16,7 @@ class TransactionDescDialog : public QWidget
     Q_OBJECT
 protected:
     void keyPressEvent(QKeyEvent *);
+    void closeEvent(QCloseEvent *e);
 
 public:
     explicit TransactionDescDialog(const QModelIndex &idx, QWidget *parent = 0);
@@ -23,6 +24,9 @@ public:
 
 private:
     Ui::TransactionDescDialog *ui;
+
+signals:
+    void stopExec();
 };
 
 #endif // TRANSACTIONDESCDIALOG_H
index 45abb74..321d587 100644 (file)
@@ -421,7 +421,7 @@ void TransactionView::showDetails()
 
         // This loop will wait for the window is closed
         QEventLoop loop;
-        connect(&dlg, SIGNAL(close()), &loop, SLOT(quit()));
+        connect(&dlg, SIGNAL(stopExec()), &loop, SLOT(quit()));
         loop.exec();
     }
 }