Skip to content

Commit 8a10000

Browse files
committed
Merge pull request #6022
b74dcb3 Separate CTranslationInterface from CClientUIInterface (Jorge Timón)
2 parents f026ab6 + b74dcb3 commit 8a10000

File tree

11 files changed

+24
-23
lines changed

11 files changed

+24
-23
lines changed

src/bitcoin-cli.cpp

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

1313
#include <boost/filesystem/operations.hpp>
1414

15-
#define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to translate non-UI */
16-
1715
using namespace std;
1816
using namespace json_spirit;
1917

src/bitcoin-tx.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "primitives/transaction.h"
1212
#include "script/script.h"
1313
#include "script/sign.h"
14-
#include "ui_interface.h" // for _(...)
1514
#include "univalue/univalue.h"
1615
#include "util.h"
1716
#include "utilmoneystr.h"
@@ -26,7 +25,6 @@ using namespace std;
2625

2726
static bool fCreateBlank;
2827
static map<string,UniValue> registers;
29-
CClientUIInterface uiInterface;
3028

3129
static bool AppInitRawTx(int argc, char* argv[])
3230
{

src/bitcoind.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "init.h"
99
#include "main.h"
1010
#include "noui.h"
11-
#include "ui_interface.h"
1211
#include "util.h"
1312

1413
#include <boost/algorithm/string/predicate.hpp>

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ enum BindFlags {
6868
};
6969

7070
static const char* FEE_ESTIMATES_FILENAME="fee_estimates.dat";
71-
CClientUIInterface uiInterface;
71+
CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
7272

7373
//////////////////////////////////////////////////////////////////////////////
7474
//

src/qt/bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ int main(int argc, char *argv[])
532532
// Now that QSettings are accessible, initialize translations
533533
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
534534
initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
535-
uiInterface.Translate.connect(Translate);
535+
translationInterface.Translate.connect(Translate);
536536

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

src/qt/transactiondesc.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "main.h"
1515
#include "script/script.h"
1616
#include "timedata.h"
17-
#include "ui_interface.h"
1817
#include "util.h"
1918
#include "wallet/db.h"
2019
#include "wallet/wallet.h"

src/rpcclient.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include "rpcprotocol.h"
99
#include "util.h"
10-
#include "ui_interface.h"
1110

1211
#include <set>
1312
#include <stdint.h>

src/test/test_bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <boost/test/unit_test.hpp>
2121
#include <boost/thread.hpp>
2222

23-
CClientUIInterface uiInterface;
23+
CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
2424
CWallet* pwalletMain;
2525

2626
extern bool fPrintToConsole;

src/ui_interface.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ class CClientUIInterface
7878
/** Progress message during initialization. */
7979
boost::signals2::signal<void (const std::string &message)> InitMessage;
8080

81-
/** Translate a message to the native language of the user. */
82-
boost::signals2::signal<std::string (const char* psz)> Translate;
83-
8481
/** Number of network connections changed. */
8582
boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged;
8683

@@ -102,14 +99,4 @@ class CClientUIInterface
10299

103100
extern CClientUIInterface uiInterface;
104101

105-
/**
106-
* Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
107-
* If no translation slot is registered, nothing is returned, and simply return the input.
108-
*/
109-
inline std::string _(const char* psz)
110-
{
111-
boost::optional<std::string> rv = uiInterface.Translate(psz);
112-
return rv ? (*rv) : psz;
113-
}
114-
115102
#endif // BITCOIN_UI_INTERFACE_H

src/util.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ string strMiscWarning;
109109
bool fLogTimestamps = false;
110110
bool fLogIPs = false;
111111
volatile bool fReopenDebugLog = false;
112+
CTranslationInterface translationInterface;
112113

113114
/** Init OpenSSL library multithreading support */
114115
static CCriticalSection** ppmutexOpenSSL;

0 commit comments

Comments
 (0)