Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ QT_MOC_CPP = \
qt/moc_coincontroldialog.cpp \
qt/moc_coincontroltreewidget.cpp \
qt/moc_csvmodelwriter.cpp \
qt/moc_dash.cpp \
qt/moc_editaddressdialog.cpp \
qt/moc_guiutil.cpp \
qt/moc_intro.cpp \
Expand Down Expand Up @@ -99,6 +100,7 @@ QT_MOC_CPP = \
qt/moc_transactiontablemodel.cpp \
qt/moc_transactionview.cpp \
qt/moc_utilitydialog.cpp \
qt/moc_walletcontroller.cpp \
qt/moc_walletframe.cpp \
qt/moc_walletmodel.cpp \
qt/moc_walletview.cpp
Expand All @@ -109,7 +111,6 @@ BITCOIN_MM = \
qt/macos_appnap.mm

QT_MOC = \
qt/dash.moc \
qt/bitcoinamountfield.moc \
qt/callback.moc \
qt/intro.moc \
Expand Down Expand Up @@ -146,6 +147,7 @@ BITCOIN_QT_H = \
qt/coincontroldialog.h \
qt/coincontroltreewidget.h \
qt/csvmodelwriter.h \
qt/dash.h \
qt/editaddressdialog.h \
qt/guiconstants.h \
qt/guiutil.h \
Expand Down Expand Up @@ -184,6 +186,7 @@ BITCOIN_QT_H = \
qt/transactiontablemodel.h \
qt/transactionview.h \
qt/utilitydialog.h \
qt/walletcontroller.h \
qt/walletframe.h \
qt/walletmodel.h \
qt/walletmodeltransaction.h \
Expand Down Expand Up @@ -225,6 +228,7 @@ RES_ICONS = \
BITCOIN_QT_BASE_CPP = \
qt/appearancewidget.cpp \
qt/bantablemodel.cpp \
qt/dash.cpp \
qt/bitcoinaddressvalidator.cpp \
qt/bitcoinamountfield.cpp \
qt/bitcoingui.cpp \
Expand Down Expand Up @@ -273,6 +277,7 @@ BITCOIN_QT_WALLET_CPP = \
qt/transactionrecord.cpp \
qt/transactiontablemodel.cpp \
qt/transactionview.cpp \
qt/walletcontroller.cpp \
qt/walletframe.cpp \
qt/walletmodel.cpp \
qt/walletmodeltransaction.cpp \
Expand Down Expand Up @@ -382,6 +387,9 @@ qt_libdashqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS)

qt_libdashqt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \
$(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(PROTOBUF_PROTO) $(RES_ICONS) $(RES_IMAGES) $(RES_CSS) $(RES_FONTS) $(RES_MOVIES)
if TARGET_DARWIN
qt_libdashqt_a_SOURCES += $(BITCOIN_MM)
endif

nodist_qt_libdashqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(PROTOBUF_CC) \
$(PROTOBUF_H) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP)
Expand All @@ -404,10 +412,7 @@ qt_dash_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES)
$(QT_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
qt_dash_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)

qt_dash_qt_SOURCES = qt/dash.cpp
if TARGET_DARWIN
qt_dash_qt_SOURCES += $(BITCOIN_MM)
endif
qt_dash_qt_SOURCES = qt/main.cpp
if TARGET_WINDOWS
qt_dash_qt_SOURCES += $(BITCOIN_RC)
endif
Expand Down
3 changes: 3 additions & 0 deletions src/Makefile.qttest.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ bin_PROGRAMS += qt/test/test_dash-qt
TESTS += qt/test/test_dash-qt

TEST_QT_MOC_CPP = \
qt/test/moc_apptests.cpp \
qt/test/moc_compattests.cpp \
qt/test/moc_rpcnestedtests.cpp \
qt/test/moc_trafficgraphdatatests.cpp \
Expand All @@ -24,6 +25,7 @@ endif # ENABLE_WALLET

TEST_QT_H = \
qt/test/addressbooktests.h \
qt/test/apptests.h \
qt/test/compattests.h \
qt/test/rpcnestedtests.h \
qt/test/uritests.h \
Expand All @@ -42,6 +44,7 @@ qt_test_test_dash_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_
$(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS)

qt_test_test_dash_qt_SOURCES = \
qt/test/apptests.cpp \
qt/test/compattests.cpp \
qt/test/rpcnestedtests.cpp \
qt/test/test_main.cpp \
Expand Down
39 changes: 33 additions & 6 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <qt/utilitydialog.h>

#ifdef ENABLE_WALLET
#include <qt/walletcontroller.h>
#include <qt/walletframe.h>
#include <qt/walletmodel.h>
#include <qt/walletview.h>
Expand Down Expand Up @@ -106,6 +107,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle,
* the central widget is the rpc console.
*/
setCentralWidget(rpcConsole);
Q_EMIT consoleShown(rpcConsole);
}

// Accept D&D of URIs
Expand Down Expand Up @@ -407,6 +409,7 @@ void BitcoinGUI::createActions()
// initially disable the debug window menu items
openInfoAction->setEnabled(false);
openRPCConsoleAction->setEnabled(false);
openRPCConsoleAction->setObjectName("openRPCConsoleAction");
openGraphAction->setEnabled(false);
openPeersAction->setEnabled(false);
openRepairAction->setEnabled(false);
Expand Down Expand Up @@ -783,17 +786,32 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
}

#ifdef ENABLE_WALLET
void BitcoinGUI::setWalletController(WalletController* wallet_controller)
{
assert(!m_wallet_controller);
assert(wallet_controller);

m_wallet_controller = wallet_controller;

connect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet);
connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet);

for (WalletModel* wallet_model : m_wallet_controller->getWallets()) {
addWallet(wallet_model);
}
}

void BitcoinGUI::addWallet(WalletModel* walletModel)
{
if (!walletFrame) return;
const QString display_name = walletModel->getDisplayName();
setWalletActionsEnabled(true);
rpcConsole->addWallet(walletModel);
walletFrame->addWallet(walletModel);
m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel));
if (m_wallet_selector->count() == 2) {
m_wallet_selector_action->setVisible(true);
}
rpcConsole->addWallet(walletModel);
walletFrame->addWallet(walletModel);
}

void BitcoinGUI::removeWallet(WalletModel* walletModel)
Expand All @@ -815,13 +833,19 @@ void BitcoinGUI::setCurrentWallet(WalletModel* wallet_model)
{
if (!walletFrame) return;
walletFrame->setCurrentWallet(wallet_model);
for (int index = 0; index < m_wallet_selector->count(); ++index) {
if (m_wallet_selector->itemData(index).value<WalletModel*>() == wallet_model) {
m_wallet_selector->setCurrentIndex(index);
break;
}
}
updateWindowTitle();
}

void BitcoinGUI::setCurrentWalletBySelectorIndex(int index)
{
WalletModel* wallet_model = m_wallet_selector->itemData(index).value<WalletModel*>();
setCurrentWallet(wallet_model);
if (wallet_model) setCurrentWallet(wallet_model);
}

void BitcoinGUI::removeAllWallets()
Expand Down Expand Up @@ -869,9 +893,11 @@ void BitcoinGUI::createTrayIcon()
{
assert(QSystemTrayIcon::isSystemTrayAvailable());

trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this);
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + m_network_style->getTitleAddText();
trayIcon->setToolTip(toolTip);
if (QSystemTrayIcon::isSystemTrayAvailable()) {
trayIcon = new QSystemTrayIcon(m_network_style->getTrayAndWindowIcon(), this);
QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + m_network_style->getTitleAddText();
trayIcon->setToolTip(toolTip);
}
}

void BitcoinGUI::createIconMenu(QMenu *pmenu)
Expand Down Expand Up @@ -951,6 +977,7 @@ void BitcoinGUI::aboutClicked()
void BitcoinGUI::showDebugWindow()
{
GUIUtil::bringToFront(rpcConsole);
Q_EMIT consoleShown(rpcConsole);
}

void BitcoinGUI::showInfo()
Expand Down
7 changes: 7 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class OptionsModel;
class RPCConsole;
class SendCoinsRecipient;
class UnitDisplayStatusBarControl;
class WalletController;
class WalletFrame;
class WalletModel;
class HelpMessageDialog;
Expand Down Expand Up @@ -74,6 +75,9 @@ class BitcoinGUI : public QMainWindow
The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
*/
void setClientModel(ClientModel *clientModel);
#ifdef ENABLE_WALLET
void setWalletController(WalletController* wallet_controller);
#endif

#ifdef ENABLE_WALLET
/** Set the wallet model.
Expand Down Expand Up @@ -101,6 +105,7 @@ class BitcoinGUI : public QMainWindow

private:
interfaces::Node& m_node;
WalletController* m_wallet_controller{nullptr};
std::unique_ptr<interfaces::Handler> m_handler_message_box;
std::unique_ptr<interfaces::Handler> m_handler_question;
ClientModel* clientModel = nullptr;
Expand Down Expand Up @@ -228,6 +233,8 @@ class BitcoinGUI : public QMainWindow
Q_SIGNALS:
/** Signal raised when a URI was entered or dragged to the GUI */
void receivedURI(const QString &uri);
/** Signal raised when RPC console shown */
void consoleShown(RPCConsole* console);
/** Restart handling */
void requestedRestart(QStringList args);

Expand Down
Loading