PRCYCoin  2.0.0.7rc1
P2P Digital Currency
networkstyle.cpp
Go to the documentation of this file.
1 // Copyright (c) 2014 The Bitcoin developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include "networkstyle.h"
6 
7 #include "guiconstants.h"
8 
9 #include <QApplication>
10 
11 static const struct {
12  const char* networkId;
13  const char* appName;
14  const char* appIcon;
15  const char* titleAddText;
16  const char* splashImage;
17 } network_styles[] = {
18  {"main", QAPP_APP_NAME_DEFAULT, ":/icons/bitcoin", "", ":/images/splash"},
19  {"test", QAPP_APP_NAME_TESTNET, ":/icons/bitcoin_testnet", QT_TRANSLATE_NOOP("SplashScreen", "[testnet]"), ":/images/splash_testnet"},
20  {"regtest", QAPP_APP_NAME_TESTNET, ":/icons/bitcoin_regtest", "[regtest]", ":/images/splash_regtest"}};
21 static const unsigned network_styles_count = sizeof(network_styles) / sizeof(*network_styles);
22 
23 // titleAddText needs to be const char* for tr()
24 NetworkStyle::NetworkStyle(const QString& appName, const QString& appIcon, const char* titleAddText, const QString& splashImage) : appName(appName),
26  titleAddText(qApp->translate("SplashScreen", titleAddText)),
28 {
29 }
30 
32 {
33  for (unsigned x = 0; x < network_styles_count; ++x) {
34  if (networkId == network_styles[x].networkId) {
35  return new NetworkStyle(
36  network_styles[x].appName,
37  network_styles[x].appIcon,
38  network_styles[x].titleAddText,
39  network_styles[x].splashImage);
40  }
41  }
42  return 0;
43 }
NetworkStyle::splashImage
QPixmap splashImage
Definition: networkstyle.h:30
NetworkStyle
Definition: networkstyle.h:13
NetworkStyle::titleAddText
QString titleAddText
Definition: networkstyle.h:29
splashImage
const char * splashImage
Definition: networkstyle.cpp:16
QAPP_APP_NAME_DEFAULT
#define QAPP_APP_NAME_DEFAULT
Definition: guiconstants.h:59
NetworkStyle::appIcon
QIcon appIcon
Definition: networkstyle.h:28
QAPP_APP_NAME_TESTNET
#define QAPP_APP_NAME_TESTNET
Definition: guiconstants.h:60
networkId
const char * networkId
Definition: networkstyle.cpp:12
titleAddText
const char * titleAddText
Definition: networkstyle.cpp:15
NetworkStyle::appName
QString appName
Definition: networkstyle.h:27
guiconstants.h
NetworkStyle::instantiate
static const NetworkStyle * instantiate(const QString &networkId)
Get style associated with provided network id, or 0 if not known.
Definition: networkstyle.cpp:31
networkstyle.h
NetworkStyle::NetworkStyle
NetworkStyle(const QString &appName, const QString &appIcon, const char *titleAddText, const QString &splashImage)
Definition: networkstyle.cpp:24
appName
const char * appName
Definition: networkstyle.cpp:13
appIcon
const char * appIcon
Definition: networkstyle.cpp:14