aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-04-30 16:34:45 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-04-30 16:37:18 +0200
commit8a10000222cb49eb253b41802ecf312adaf79439 (patch)
treed3f87f54b5e8e138e65e6fcb945dd1c8ef28e469 /src
parentf026ab606d7bc317a725888296921df961d26208 (diff)
parentb74dcb3b4aa29958d22135f2d6c015578069e83c (diff)
Merge pull request #6022
b74dcb3 Separate CTranslationInterface from CClientUIInterface (Jorge Timón)
Diffstat (limited to 'src')
-rw-r--r--src/bitcoin-cli.cpp2
-rw-r--r--src/bitcoin-tx.cpp2
-rw-r--r--src/bitcoind.cpp1
-rw-r--r--src/init.cpp2
-rw-r--r--src/qt/bitcoin.cpp2
-rw-r--r--src/qt/transactiondesc.cpp1
-rw-r--r--src/rpcclient.cpp1
-rw-r--r--src/test/test_bitcoin.cpp2
-rw-r--r--src/ui_interface.h13
-rw-r--r--src/util.cpp1
-rw-r--r--src/util.h20
11 files changed, 24 insertions, 23 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 2fa8de6fd8..1269d7a119 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -12,8 +12,6 @@
#include <boost/filesystem/operations.hpp>
-#define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to translate non-UI */
-
using namespace std;
using namespace json_spirit;
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index f1c1c0ff8b..d024b48020 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -11,7 +11,6 @@
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
-#include "ui_interface.h" // for _(...)
#include "univalue/univalue.h"
#include "util.h"
#include "utilmoneystr.h"
@@ -26,7 +25,6 @@ using namespace std;
static bool fCreateBlank;
static map<string,UniValue> registers;
-CClientUIInterface uiInterface;
static bool AppInitRawTx(int argc, char* argv[])
{
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index 2172f4a21b..eeca8655c9 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -8,7 +8,6 @@
#include "init.h"
#include "main.h"
#include "noui.h"
-#include "ui_interface.h"
#include "util.h"
#include <boost/algorithm/string/predicate.hpp>
diff --git a/src/init.cpp b/src/init.cpp
index b648a237bf..5272541722 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -68,7 +68,7 @@ enum BindFlags {
};
static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
-CClientUIInterface uiInterface;
+CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
//////////////////////////////////////////////////////////////////////////////
//
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 069601ab67..018169cfdc 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -532,7 +532,7 @@ int main(int argc, char *argv[])
// Now that QSettings are accessible, initialize translations
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
- uiInterface.Translate.connect(Translate);
+ translationInterface.Translate.connect(Translate);
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
// but before showing splash screen.
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index 7214249435..4fffd03adf 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -14,7 +14,6 @@
#include "main.h"
#include "script/script.h"
#include "timedata.h"
-#include "ui_interface.h"
#include "util.h"
#include "wallet/db.h"
#include "wallet/wallet.h"
diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp
index ad676f9edc..4b576b3707 100644
--- a/src/rpcclient.cpp
+++ b/src/rpcclient.cpp
@@ -7,7 +7,6 @@
#include "rpcprotocol.h"
#include "util.h"
-#include "ui_interface.h"
#include <set>
#include <stdint.h>
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp
index a2cb78c989..4057eccbed 100644
--- a/src/test/test_bitcoin.cpp
+++ b/src/test/test_bitcoin.cpp
@@ -20,7 +20,7 @@
#include <boost/test/unit_test.hpp>
#include <boost/thread.hpp>
-CClientUIInterface uiInterface;
+CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
CWallet* pwalletMain;
extern bool fPrintToConsole;
diff --git a/src/ui_interface.h b/src/ui_interface.h
index 3f11a1ddab..32a92a4b81 100644
--- a/src/ui_interface.h
+++ b/src/ui_interface.h
@@ -78,9 +78,6 @@ public:
/** Progress message during initialization. */
boost::signals2::signal<void (const std::string &message)> InitMessage;
- /** Translate a message to the native language of the user. */
- boost::signals2::signal<std::string (const char* psz)> Translate;
-
/** Number of network connections changed. */
boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged;
@@ -102,14 +99,4 @@ public:
extern CClientUIInterface uiInterface;
-/**
- * Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
- * If no translation slot is registered, nothing is returned, and simply return the input.
- */
-inline std::string _(const char* psz)
-{
- boost::optional<std::string> rv = uiInterface.Translate(psz);
- return rv ? (*rv) : psz;
-}
-
#endif // BITCOIN_UI_INTERFACE_H
diff --git a/src/util.cpp b/src/util.cpp
index dfba506f24..c9e8242d47 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -109,6 +109,7 @@ string strMiscWarning;
bool fLogTimestamps = false;
bool fLogIPs = false;
volatile bool fReopenDebugLog = false;
+CTranslationInterface translationInterface;
/** Init OpenSSL library multithreading support */
static CCriticalSection** ppmutexOpenSSL;
diff --git a/src/util.h b/src/util.h
index 9b5a4153dd..483d9d7858 100644
--- a/src/util.h
+++ b/src/util.h
@@ -25,8 +25,17 @@
#include <vector>
#include <boost/filesystem/path.hpp>
+#include <boost/signals2/signal.hpp>
#include <boost/thread/exceptions.hpp>
+/** Signals for translation. */
+class CTranslationInterface
+{
+public:
+ /** Translate a message to the native language of the user. */
+ boost::signals2::signal<std::string (const char* psz)> Translate;
+};
+
extern std::map<std::string, std::string> mapArgs;
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
extern bool fDebug;
@@ -37,6 +46,17 @@ extern std::string strMiscWarning;
extern bool fLogTimestamps;
extern bool fLogIPs;
extern volatile bool fReopenDebugLog;
+extern CTranslationInterface translationInterface;
+
+/**
+ * Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
+ * If no translation slot is registered, nothing is returned, and simply return the input.
+ */
+inline std::string _(const char* psz)
+{
+ boost::optional<std::string> rv = translationInterface.Translate(psz);
+ return rv ? (*rv) : psz;
+}
void SetupEnvironment();