Skip to content

Commit ddddce0

Browse files
author
MarcoFalke
committed
util: Replace boost::signals2 with std::function
1 parent ddc3ec9 commit ddddce0

14 files changed

+44
-36
lines changed

src/bench/bench_bitcoin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include <memory>
1515

16+
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
17+
1618
static const int64_t DEFAULT_BENCH_EVALUATIONS = 5;
1719
static const char* DEFAULT_BENCH_FILTER = ".*";
1820
static const char* DEFAULT_BENCH_SCALING = "1.0";

src/bitcoin-cli.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include <univalue.h>
2626

27+
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
28+
2729
static const char DEFAULT_RPCCONNECT[] = "127.0.0.1";
2830
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
2931
static const bool DEFAULT_NAMED=false;

src/bitcoin-tx.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ static bool fCreateBlank;
3131
static std::map<std::string,UniValue> registers;
3232
static const int CONTINUE_EXECUTION=-1;
3333

34+
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
35+
3436
static void SetupBitcoinTxArgs()
3537
{
3638
gArgs.AddArg("-?", "This help message", false, OptionsCategory::OPTIONS);

src/bitcoind.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#include <stdio.h>
2525

26+
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
27+
2628
/* Introduction text for doxygen: */
2729

2830
/*! \mainpage Developer documentation

src/noui.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <stdint.h>
1313
#include <string>
1414

15+
#include <boost/signals2/connection.hpp>
16+
1517
static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
1618
{
1719
bool fSecure = style & CClientUIInterface::SECURE;

src/qt/bitcoin.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,10 @@ static void InitMessage(const std::string &message)
7676
LogPrintf("init message: %s\n", message);
7777
}
7878

79-
/*
80-
Translate string to current locale using Qt.
81-
*/
82-
static std::string Translate(const char* psz)
83-
{
79+
/** Translate string to current locale using Qt. */
80+
const std::function<std::string(const char*)> G_TRANSLATION_FUN = [](const char* psz) {
8481
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
85-
}
82+
};
8683

8784
static QString GetLangTerritory()
8885
{
@@ -619,7 +616,6 @@ int main(int argc, char *argv[])
619616
// Now that QSettings are accessible, initialize translations
620617
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
621618
initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
622-
translationInterface.Translate.connect(Translate);
623619

624620
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
625621
// but before showing splash screen.

src/qt/bitcoingui.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
#include <QUrlQuery>
5858
#include <QVBoxLayout>
5959

60+
#include <boost/bind.hpp>
61+
6062
const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
6163
#if defined(Q_OS_MAC)
6264
"macosx"

src/qt/splashscreen.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include <interfaces/handler.h>
1515
#include <interfaces/node.h>
1616
#include <interfaces/wallet.h>
17-
#include <util.h>
1817
#include <ui_interface.h>
18+
#include <util.h>
1919
#include <version.h>
2020

2121
#include <QApplication>
@@ -24,6 +24,8 @@
2424
#include <QPainter>
2525
#include <QRadialGradient>
2626

27+
#include <boost/bind.hpp>
28+
2729
SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle) :
2830
QWidget(0, f), curAlignment(0), m_node(node)
2931
{

src/qt/transactiontablemodel.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@
1616
#include <core_io.h>
1717
#include <interfaces/handler.h>
1818
#include <interfaces/node.h>
19-
#include <validation.h>
2019
#include <sync.h>
2120
#include <uint256.h>
2221
#include <util.h>
22+
#include <validation.h>
2323

2424
#include <QColor>
2525
#include <QDateTime>
2626
#include <QDebug>
2727
#include <QIcon>
2828
#include <QList>
2929

30+
#include <boost/bind.hpp>
31+
3032
// Amount column is right-aligned it contains numbers
3133
static int column_alignments[] = {
3234
Qt::AlignLeft|Qt::AlignVCenter, /* status */

src/test/test_bitcoin.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@
88
#include <consensus/consensus.h>
99
#include <consensus/validation.h>
1010
#include <crypto/sha256.h>
11-
#include <validation.h>
1211
#include <miner.h>
1312
#include <net_processing.h>
1413
#include <pow.h>
15-
#include <ui_interface.h>
16-
#include <streams.h>
17-
#include <rpc/server.h>
1814
#include <rpc/register.h>
15+
#include <rpc/server.h>
1916
#include <script/sigcache.h>
17+
#include <streams.h>
18+
#include <ui_interface.h>
19+
#include <validation.h>
20+
21+
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
2022

2123
void CConnmanTest::AddNode(CNode& node)
2224
{

0 commit comments

Comments
 (0)