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.
8+ const char *appIcon;
9+ const char *titleAddText;
10+ const char *splashImage;
11+} network_styles[] = {
12+ {"main", QAPP_APP_NAME_DEFAULT, ":/icons/bitcoin", "", ":/images/splash"},
13+ {"test", QAPP_APP_NAME_TESTNET, ":/icons/bitcoin_testnet", "[testnet]", ":/images/splash_testnet"},
0@@ -0,0 +1,31 @@
1+#ifndef H_NETWORKSTYLE
73@@ -78,23 +74,20 @@ SplashScreen::SplashScreen(Qt::WindowFlags f, bool isTestNet) :
74 pixPaint.setFont(QFont(font, 10*fontFactor));
75 pixPaint.drawText(pixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);
76
77- // draw testnet string if testnet is on
78- if(isTestNet) {
79+ // draw title add string if special network
26+ const QIcon &getAppIcon() const { return appIcon; }
27+ const QString &getTitleAddText() const { return titleAddText; }
28+ const QPixmap &getSplashImage() const { return splashImage; }
29+};
30+
31+#endif
// H_NETWORKSTYLE
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.
634@@ -636,6 +635,8 @@ int main(int argc, char *argv[])
635 PrintExceptionContinue(NULL, "Runaway exception");
636 app.handleRunawayException(QString::fromStdString(strMiscWarning));
637 }
638+ delete networkStyle;
delete self
.
It doesn’t really matter, it was just a suggestion for readability.
Out of curiosity though, why not just create a normal scoped object in main and pass around a pointer to it? I suspect I’m missing something obvious.
Здравствуйте друзья!Я не разбираюсь в этом.С уважением Махмет!
2014-10-09 23:07 GMT+04:00 Cory Fields notifications@github.com:
In src/qt/bitcoin.cpp:
@@ -636,6 +635,8 @@ int main(int argc, char *argv[]) PrintExceptionContinue(NULL, “Runaway exception”); app.handleRunawayException(QString::fromStdString(strMiscWarning)); }
- delete networkStyle;
It doesn’t really matter, it was just a suggestion for readability.
Out of curiosity though, why not just create a normal scoped object in main and pass around a pointer to it? I suspect I’m missing something obvious.
— Reply to this email directly or view it on GitHub https://github.com/bitcoin/bitcoin/pull/5066/files#r18666838.
@makhmet Graag alleen Engels hier. @theuni Well - I initially started from the approach that there was a Style class per network, but that didn’t turn out to be needed. The current interface (with a constructor-independent instantiate) leaves some freedom to return to that later if it becomes necessary (ie, if you’d want to paint the background in a network-specific way and offer a method for that). Also the function can return 0 if the network is unknown, unlike a constructor which would have to mess around with exceptions.
Good idea about the RAII though. I’ll change the networkStyle in main to a boost::scoped_ptr QScopedPointer.