Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoingui.cpp
Show All 28 Lines | |||||
#endif // ENABLE_WALLET | #endif // ENABLE_WALLET | ||||
#ifdef Q_OS_MAC | #ifdef Q_OS_MAC | ||||
#include "macdockiconhandler.h" | #include "macdockiconhandler.h" | ||||
#endif | #endif | ||||
#include "chainparams.h" | #include "chainparams.h" | ||||
#include "init.h" | #include "init.h" | ||||
#include "interface/handler.h" | |||||
#include "interface/node.h" | |||||
#include "ui_interface.h" | #include "ui_interface.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include <iostream> | #include <iostream> | ||||
#include <QAction> | #include <QAction> | ||||
#include <QApplication> | #include <QApplication> | ||||
#include <QComboBox> | #include <QComboBox> | ||||
Show All 20 Lines | #if defined(Q_OS_MAC) | ||||
"macosx" | "macosx" | ||||
#elif defined(Q_OS_WIN) | #elif defined(Q_OS_WIN) | ||||
"windows" | "windows" | ||||
#else | #else | ||||
"other" | "other" | ||||
#endif | #endif | ||||
; | ; | ||||
BitcoinGUI::BitcoinGUI(const Config *configIn, | BitcoinGUI::BitcoinGUI(interface::Node &node, const Config *configIn, | ||||
const PlatformStyle *_platformStyle, | const PlatformStyle *_platformStyle, | ||||
const NetworkStyle *networkStyle, QWidget *parent) | const NetworkStyle *networkStyle, QWidget *parent) | ||||
: QMainWindow(parent), enableWallet(false), platformStyle(_platformStyle), | : QMainWindow(parent), enableWallet(false), m_node(node), | ||||
config(configIn) { | platformStyle(_platformStyle), config(configIn) { | ||||
QSettings settings; | QSettings settings; | ||||
if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { | if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { | ||||
// Restore failed (perhaps missing setting), center the window | // Restore failed (perhaps missing setting), center the window | ||||
move(QApplication::desktop()->availableGeometry().center() - | move(QApplication::desktop()->availableGeometry().center() - | ||||
frameGeometry().center()); | frameGeometry().center()); | ||||
} | } | ||||
QString windowTitle = tr(PACKAGE_NAME) + " - "; | QString windowTitle = tr(PACKAGE_NAME) + " - "; | ||||
▲ Show 20 Lines • Show All 1,093 Lines • ▼ Show 20 Lines | void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden) { | ||||
} | } | ||||
} | } | ||||
void BitcoinGUI::toggleHidden() { | void BitcoinGUI::toggleHidden() { | ||||
showNormalIfMinimized(true); | showNormalIfMinimized(true); | ||||
} | } | ||||
void BitcoinGUI::detectShutdown() { | void BitcoinGUI::detectShutdown() { | ||||
if (ShutdownRequested()) { | if (m_node.shutdownRequested()) { | ||||
if (rpcConsole) { | if (rpcConsole) { | ||||
rpcConsole->hide(); | rpcConsole->hide(); | ||||
} | } | ||||
qApp->quit(); | qApp->quit(); | ||||
} | } | ||||
} | } | ||||
void BitcoinGUI::showProgress(const QString &title, int nProgress) { | void BitcoinGUI::showProgress(const QString &title, int nProgress) { | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | QMetaObject::invokeMethod(gui, "message", | ||||
Q_ARG(QString, QString::fromStdString(caption)), | Q_ARG(QString, QString::fromStdString(caption)), | ||||
Q_ARG(QString, QString::fromStdString(message)), | Q_ARG(QString, QString::fromStdString(message)), | ||||
Q_ARG(unsigned int, style), Q_ARG(bool *, &ret)); | Q_ARG(unsigned int, style), Q_ARG(bool *, &ret)); | ||||
return ret; | return ret; | ||||
} | } | ||||
void BitcoinGUI::subscribeToCoreSignals() { | void BitcoinGUI::subscribeToCoreSignals() { | ||||
// Connect signals to client | // Connect signals to client | ||||
uiInterface.ThreadSafeMessageBox.connect( | m_handler_message_box = m_node.handleMessageBox( | ||||
boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); | boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); | ||||
uiInterface.ThreadSafeQuestion.connect( | m_handler_question = m_node.handleQuestion( | ||||
boost::bind(ThreadSafeMessageBox, this, _1, _3, _4)); | boost::bind(ThreadSafeMessageBox, this, _1, _3, _4)); | ||||
} | } | ||||
void BitcoinGUI::unsubscribeFromCoreSignals() { | void BitcoinGUI::unsubscribeFromCoreSignals() { | ||||
// Disconnect signals from client | // Disconnect signals from client | ||||
uiInterface.ThreadSafeMessageBox.disconnect( | m_handler_message_box->disconnect(); | ||||
boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); | m_handler_question->disconnect(); | ||||
uiInterface.ThreadSafeQuestion.disconnect( | |||||
boost::bind(ThreadSafeMessageBox, this, _1, _3, _4)); | |||||
} | } | ||||
void BitcoinGUI::toggleNetworkActive() { | void BitcoinGUI::toggleNetworkActive() { | ||||
if (clientModel) { | if (clientModel) { | ||||
clientModel->setNetworkActive(!clientModel->getNetworkActive()); | clientModel->setNetworkActive(!clientModel->getNetworkActive()); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |