aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoin.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-10-09 11:04:49 +0200
committerjtimon <jtimon@blockstream.io>2014-10-10 11:00:59 +0200
commit6de50c3c9a89e72f3152a1df7775572d5c8ad0e7 (patch)
treecf708c7b5b7800b295aeb5bcdb3d742f79b6a31b /src/qt/bitcoin.cpp
parentdec58922d07241f0b502c96f8e5131abccbd5dc1 (diff)
downloadbitcoin-6de50c3c9a89e72f3152a1df7775572d5c8ad0e7.tar.xz
qt: add network-specific style object
Mainly cleanups: Gets rid of isTestNet everywhere, by keeping track of network-specific theming in a central place. Also makes GUI no longer dependent on the network ID enumeration, which alleviates concerns about #4802.
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r--src/qt/bitcoin.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 5e2fdc6c30..9872ebc1f6 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -12,6 +12,7 @@
#include "guiconstants.h"
#include "guiutil.h"
#include "intro.h"
+#include "networkstyle.h"
#include "optionsmodel.h"
#include "splashscreen.h"
#include "utilitydialog.h"
@@ -190,9 +191,9 @@ public:
/// Create options model
void createOptionsModel();
/// Create main window
- void createWindow(bool isaTestNet);
+ void createWindow(const NetworkStyle *networkStyle);
/// Create splash screen
- void createSplashScreen(bool isaTestNet);
+ void createSplashScreen(const NetworkStyle *networkStyle);
/// Request core initialization
void requestInitialize();
@@ -331,18 +332,18 @@ void BitcoinApplication::createOptionsModel()
optionsModel = new OptionsModel();
}
-void BitcoinApplication::createWindow(bool isaTestNet)
+void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
{
- window = new BitcoinGUI(isaTestNet, 0);
+ window = new BitcoinGUI(networkStyle, 0);
pollShutdownTimer = new QTimer(window);
connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
pollShutdownTimer->start(200);
}
-void BitcoinApplication::createSplashScreen(bool isaTestNet)
+void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
{
- SplashScreen *splash = new SplashScreen(0, isaTestNet);
+ SplashScreen *splash = new SplashScreen(0, networkStyle);
// We don't hold a direct pointer to the splash screen after creation, so use
// Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually.
splash->setAttribute(Qt::WA_DeleteOnClose);
@@ -572,12 +573,10 @@ int main(int argc, char *argv[])
if (!PaymentServer::ipcParseCommandLine(argc, argv))
exit(0);
#endif
- bool isaTestNet = Params().NetworkID() != CBaseChainParams::MAIN;
+ QScopedPointer<const NetworkStyle> networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString())));
+ assert(!networkStyle.isNull());
// Allow for separate UI settings for testnets
- if (isaTestNet)
- QApplication::setApplicationName(QAPP_APP_NAME_TESTNET);
- else
- QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT);
+ QApplication::setApplicationName(networkStyle->getAppName());
// Re-initialize translations after changing application name (language in network-specific settings can be different)
initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
@@ -617,11 +616,11 @@ int main(int argc, char *argv[])
uiInterface.InitMessage.connect(InitMessage);
if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false))
- app.createSplashScreen(isaTestNet);
+ app.createSplashScreen(networkStyle.data());
try
{
- app.createWindow(isaTestNet);
+ app.createWindow(networkStyle.data());
app.requestInitialize();
#if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("Bitcoin Core didn't yet exit safely..."), (HWND)app.getMainWinId());