mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
refactor: Make RPCExecutor*
a member of the RPCConsole
class
This commit is contained in:
parent
61457c179a
commit
fdf7285950
2 changed files with 8 additions and 6 deletions
|
@ -1091,11 +1091,11 @@ void RPCConsole::browseHistory(int offset)
|
||||||
|
|
||||||
void RPCConsole::startExecutor()
|
void RPCConsole::startExecutor()
|
||||||
{
|
{
|
||||||
RPCExecutor *executor = new RPCExecutor(m_node);
|
m_executor = new RPCExecutor(m_node);
|
||||||
executor->moveToThread(&thread);
|
m_executor->moveToThread(&thread);
|
||||||
|
|
||||||
// Replies from executor object must go to this object
|
// Replies from executor object must go to this object
|
||||||
connect(executor, &RPCExecutor::reply, this, [this](int category, const QString& command) {
|
connect(m_executor, &RPCExecutor::reply, this, [this](int category, const QString& command) {
|
||||||
// Remove "Executing…" message.
|
// Remove "Executing…" message.
|
||||||
ui->messagesWidget->undo();
|
ui->messagesWidget->undo();
|
||||||
message(category, command);
|
message(category, command);
|
||||||
|
@ -1104,15 +1104,15 @@ void RPCConsole::startExecutor()
|
||||||
});
|
});
|
||||||
|
|
||||||
// Requests from this object must go to executor
|
// Requests from this object must go to executor
|
||||||
connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request);
|
connect(this, &RPCConsole::cmdRequest, m_executor, &RPCExecutor::request);
|
||||||
|
|
||||||
// Make sure executor object is deleted in its own thread
|
// Make sure executor object is deleted in its own thread
|
||||||
connect(&thread, &QThread::finished, executor, &RPCExecutor::deleteLater);
|
connect(&thread, &QThread::finished, m_executor, &RPCExecutor::deleteLater);
|
||||||
|
|
||||||
// Default implementation of QThread::run() simply spins up an event loop in the thread,
|
// Default implementation of QThread::run() simply spins up an event loop in the thread,
|
||||||
// which is what we want.
|
// which is what we want.
|
||||||
thread.start();
|
thread.start();
|
||||||
QTimer::singleShot(0, executor, []() {
|
QTimer::singleShot(0, m_executor, []() {
|
||||||
util::ThreadRename("qt-rpcconsole");
|
util::ThreadRename("qt-rpcconsole");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
class ClientModel;
|
class ClientModel;
|
||||||
class PlatformStyle;
|
class PlatformStyle;
|
||||||
|
class RPCExecutor;
|
||||||
class RPCTimerInterface;
|
class RPCTimerInterface;
|
||||||
class WalletModel;
|
class WalletModel;
|
||||||
|
|
||||||
|
@ -173,6 +174,7 @@ private:
|
||||||
int consoleFontSize = 0;
|
int consoleFontSize = 0;
|
||||||
QCompleter *autoCompleter = nullptr;
|
QCompleter *autoCompleter = nullptr;
|
||||||
QThread thread;
|
QThread thread;
|
||||||
|
RPCExecutor* m_executor{nullptr};
|
||||||
WalletModel* m_last_wallet_model{nullptr};
|
WalletModel* m_last_wallet_model{nullptr};
|
||||||
bool m_is_executing{false};
|
bool m_is_executing{false};
|
||||||
QByteArray m_peer_widget_header_state;
|
QByteArray m_peer_widget_header_state;
|
||||||
|
|
Loading…
Reference in a new issue