[Qt] the RPC Console should be a QWidget to make window more independent
- fix issue #5254
This commit is contained in:
parent
5406f61373
commit
4a8fc152a9
4 changed files with 17 additions and 11 deletions
|
@ -128,7 +128,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
|
||||||
setUnifiedTitleAndToolBarOnMac(true);
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rpcConsole = new RPCConsole(enableWallet ? this : 0);
|
rpcConsole = new RPCConsole(0);
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
if(enableWallet)
|
if(enableWallet)
|
||||||
{
|
{
|
||||||
|
@ -234,6 +234,8 @@ BitcoinGUI::~BitcoinGUI()
|
||||||
delete appMenuBar;
|
delete appMenuBar;
|
||||||
MacDockIconHandler::instance()->setMainWindow(NULL);
|
MacDockIconHandler::instance()->setMainWindow(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
delete rpcConsole;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
|
void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
|
||||||
|
@ -831,6 +833,9 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
|
||||||
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
|
if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
|
||||||
!clientModel->getOptionsModel()->getMinimizeOnClose())
|
!clientModel->getOptionsModel()->getMinimizeOnClose())
|
||||||
{
|
{
|
||||||
|
// close rpcConsole in case it was open to make some space for the shutdown window
|
||||||
|
rpcConsole->close();
|
||||||
|
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>RPCConsole</class>
|
<class>RPCConsole</class>
|
||||||
<widget class="QDialog" name="RPCConsole">
|
<widget class="QWidget" name="RPCConsole">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
|
|
@ -200,7 +200,7 @@ void RPCExecutor::request(const QString &command)
|
||||||
}
|
}
|
||||||
|
|
||||||
RPCConsole::RPCConsole(QWidget *parent) :
|
RPCConsole::RPCConsole(QWidget *parent) :
|
||||||
QDialog(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::RPCConsole),
|
ui(new Ui::RPCConsole),
|
||||||
clientModel(0),
|
clientModel(0),
|
||||||
historyPtr(0),
|
historyPtr(0),
|
||||||
|
@ -278,7 +278,7 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QDialog::eventFilter(obj, event);
|
return QWidget::eventFilter(obj, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPCConsole::setClientModel(ClientModel *model)
|
void RPCConsole::setClientModel(ClientModel *model)
|
||||||
|
@ -366,11 +366,12 @@ void RPCConsole::clear()
|
||||||
tr("Type <b>help</b> for an overview of available commands.")), true);
|
tr("Type <b>help</b> for an overview of available commands.")), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPCConsole::reject()
|
void RPCConsole::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
// Ignore escape keypress if this is not a seperate window
|
if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape)
|
||||||
if(windowType() != Qt::Widget)
|
{
|
||||||
QDialog::reject();
|
close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPCConsole::message(int category, const QString &message, bool html)
|
void RPCConsole::message(int category, const QString &message, bool html)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QWidget>
|
||||||
|
|
||||||
class ClientModel;
|
class ClientModel;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class QItemSelection;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
/** Local Bitcoin RPC console. */
|
/** Local Bitcoin RPC console. */
|
||||||
class RPCConsole: public QDialog
|
class RPCConsole: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventFilter(QObject* obj, QEvent *event);
|
virtual bool eventFilter(QObject* obj, QEvent *event);
|
||||||
|
void keyPressEvent(QKeyEvent *);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_lineEdit_returnPressed();
|
void on_lineEdit_returnPressed();
|
||||||
|
@ -59,7 +60,6 @@ private slots:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
void reject();
|
|
||||||
void message(int category, const QString &message, bool html = false);
|
void message(int category, const QString &message, bool html = false);
|
||||||
/** Set number of connections shown in the UI */
|
/** Set number of connections shown in the UI */
|
||||||
void setNumConnections(int count);
|
void setNumConnections(int count);
|
||||||
|
|
Loading…
Reference in a new issue