Изменение базового класса окна About
authorfsb4000 <fsb4000@yandex.ru>
Fri, 23 Jan 2015 04:11:38 +0000 (10:11 +0600)
committerfsb4000 <fsb4000@yandex.ru>
Fri, 23 Jan 2015 04:11:38 +0000 (10:11 +0600)
src/qt/aboutdialog.cpp
src/qt/aboutdialog.h
src/qt/bitcoingui.cpp
src/qt/bitcoingui.h
src/qt/forms/aboutdialog.ui

index 7c6a42e..a66287d 100644 (file)
@@ -7,8 +7,10 @@
 
 #include "version.h"
 
+#include <QKeyEvent>
+
 AboutDialog::AboutDialog(QWidget *parent) :
-    QDialog(parent, DIALOGWINDOWHINTS),
+    QWidget(parent, DIALOGWINDOWHINTS),
     ui(new Ui::AboutDialog)
 {
     ui->setupUi(this);
@@ -31,3 +33,18 @@ void AboutDialog::on_buttonBox_accepted()
 {
     close();
 }
+
+void AboutDialog::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 2ed9e9e..714970f 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef ABOUTDIALOG_H
 #define ABOUTDIALOG_H
 
-#include <QDialog>
+#include <QWidget>
 
 namespace Ui {
     class AboutDialog;
@@ -9,7 +9,7 @@ namespace Ui {
 class ClientModel;
 
 /** "About" dialog box */
-class AboutDialog : public QDialog
+class AboutDialog : public QWidget
 {
     Q_OBJECT
 
@@ -21,6 +21,8 @@ public:
 private:
     Ui::AboutDialog *ui;
 
+    void keyPressEvent(QKeyEvent *);
+
 private slots:
     void on_buttonBox_accepted();
 };
index 6b6b9e7..f9b6da6 100644 (file)
@@ -83,7 +83,8 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
     aboutQtAction(0),
     trayIcon(0),
     notificator(0),
-    rpcConsole(0)
+    rpcConsole(0),
+    aboutDialog(0)
 {
     resize(850, 550);
     setWindowTitle(tr("NovaCoin") + " - " + tr("Wallet"));
@@ -200,6 +201,8 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
     rpcConsole = new RPCConsole(0);
     connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
 
+    aboutDialog = new AboutDialog(0);
+
     // Clicking on "Verify Message" in the address book sends you to the verify message tab
     connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
     // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
@@ -217,6 +220,7 @@ BitcoinGUI::~BitcoinGUI()
 #endif
 
     delete rpcConsole;
+    delete aboutDialog;
 }
 
 void BitcoinGUI::createActions()
@@ -538,9 +542,9 @@ void BitcoinGUI::optionsClicked()
 
 void BitcoinGUI::aboutClicked()
 {
-    AboutDialog dlg;
-    dlg.setModel(clientModel);
-    dlg.exec();
+    aboutDialog->setModel(clientModel);
+    aboutDialog->setWindowModality(Qt::ApplicationModal);
+    aboutDialog->show();
 }
 
 void BitcoinGUI::setNumConnections(int count)
index 58cf842..8b8daf9 100644 (file)
@@ -16,6 +16,7 @@ class SignVerifyMessageDialog;
 class MultisigDialog;
 class Notificator;
 class RPCConsole;
+class AboutDialog;
 
 QT_BEGIN_NAMESPACE
 class QLabel;
@@ -108,6 +109,7 @@ private:
     TransactionView *transactionView;
     MintingView *mintingView;
     RPCConsole *rpcConsole;
+    AboutDialog *aboutDialog;
 
     QMovie *syncIconMovie;
 
index 13b0acf..d34e5e6 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
  <class>AboutDialog</class>
- <widget class="QDialog" name="AboutDialog">
+ <widget class="QWidget" name="AboutDialog">
   <property name="geometry">
    <rect>
     <x>0</x>