Merge pull request #3437

2ea980a qt: Treat regtest as testnet (Wladimir J. van der Laan)
This commit is contained in:
Wladimir J. van der Laan 2013-12-20 11:20:01 +01:00
commit 326b5bb9d0
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
7 changed files with 32 additions and 23 deletions

View File

@ -198,9 +198,10 @@ int main(int argc, char *argv[])
// Application identification (must be set before OptionsModel is initialized, // Application identification (must be set before OptionsModel is initialized,
// as it is used to locate QSettings) // as it is used to locate QSettings)
bool isaTestNet = TestNet() || RegTest();
QApplication::setOrganizationName("Bitcoin"); QApplication::setOrganizationName("Bitcoin");
QApplication::setOrganizationDomain("bitcoin.org"); QApplication::setOrganizationDomain("bitcoin.org");
if (TestNet()) // Separate UI settings for testnet if (isaTestNet) // Separate UI settings for testnets
QApplication::setApplicationName("Bitcoin-Qt-testnet"); QApplication::setApplicationName("Bitcoin-Qt-testnet");
else else
QApplication::setApplicationName("Bitcoin-Qt"); QApplication::setApplicationName("Bitcoin-Qt");
@ -231,7 +232,7 @@ int main(int argc, char *argv[])
PaymentServer* paymentServer = new PaymentServer(&app); PaymentServer* paymentServer = new PaymentServer(&app);
// User language is set up: pick a data directory // User language is set up: pick a data directory
Intro::pickDataDirectory(TestNet()); Intro::pickDataDirectory(isaTestNet);
// Install global event filter that makes sure that long tooltips can be word-wrapped // Install global event filter that makes sure that long tooltips can be word-wrapped
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app)); app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
@ -259,7 +260,7 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
SplashScreen splash(QPixmap(), 0); SplashScreen splash(QPixmap(), 0, isaTestNet);
if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false)) if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false))
{ {
splash.show(); splash.show();
@ -281,7 +282,7 @@ int main(int argc, char *argv[])
boost::thread_group threadGroup; boost::thread_group threadGroup;
BitcoinGUI window(TestNet(), 0); BitcoinGUI window(isaTestNet, 0);
guiref = &window; guiref = &window;
QTimer* pollShutdownTimer = new QTimer(guiref); QTimer* pollShutdownTimer = new QTimer(guiref);

View File

@ -123,9 +123,12 @@ void ClientModel::updateAlert(const QString &hash, int status)
emit alertsChanged(getStatusBarWarnings()); emit alertsChanged(getStatusBarWarnings());
} }
bool ClientModel::isTestNet() const QString ClientModel::getNetworkName() const
{ {
return TestNet(); QString netname(QString::fromStdString(Params().DataDir()));
if(netname.isEmpty())
netname = "main";
return netname;
} }
bool ClientModel::inInitialBlockDownload() const bool ClientModel::inInitialBlockDownload() const

View File

@ -46,8 +46,8 @@ public:
double getVerificationProgress() const; double getVerificationProgress() const;
QDateTime getLastBlockDate() const; QDateTime getLastBlockDate() const;
//! Return true if client connected to testnet //! Return network (main, testnet3, regtest)
bool isTestNet() const; QString getNetworkName() const;
//! Return true if core is doing initial block download //! Return true if core is doing initial block download
bool inInitialBlockDownload() const; bool inInitialBlockDownload() const;
//! Return true if core is importing blocks //! Return true if core is importing blocks

View File

@ -172,14 +172,14 @@
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Number of connections</string> <string>Name</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="7" column="1">
<widget class="QLabel" name="numberOfConnections"> <widget class="QLabel" name="networkName">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -195,19 +195,25 @@
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>On testnet</string> <string>Number of connections</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="8" column="1">
<widget class="QCheckBox" name="isTestNet"> <widget class="QLabel" name="numberOfConnections">
<property name="enabled"> <property name="cursor">
<bool>false</bool> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -284,7 +284,7 @@ void RPCConsole::setClientModel(ClientModel *model)
ui->buildDate->setText(model->formatBuildDate()); ui->buildDate->setText(model->formatBuildDate());
ui->startupTime->setText(model->formatClientStartupTime()); ui->startupTime->setText(model->formatClientStartupTime());
ui->isTestNet->setChecked(model->isTestNet()); ui->networkName->setText(model->getNetworkName());
} }
} }

View File

@ -4,14 +4,13 @@
#include "splashscreen.h" #include "splashscreen.h"
#include "chainparams.h"
#include "clientversion.h" #include "clientversion.h"
#include "util.h" #include "util.h"
#include <QApplication> #include <QApplication>
#include <QPainter> #include <QPainter>
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) : SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet) :
QSplashScreen(pixmap, f) QSplashScreen(pixmap, f)
{ {
// set reference point, paddings // set reference point, paddings
@ -32,7 +31,7 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
// load the bitmap for writing some text over it // load the bitmap for writing some text over it
QPixmap newPixmap; QPixmap newPixmap;
if(TestNet()) { if(isTestNet) {
newPixmap = QPixmap(":/images/splash_testnet"); newPixmap = QPixmap(":/images/splash_testnet");
} }
else { else {
@ -72,7 +71,7 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText); pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);
// draw testnet string if testnet is on // draw testnet string if testnet is on
if(TestNet()) { if(isTestNet) {
QFont boldFont = QFont(font, 10*fontFactor); QFont boldFont = QFont(font, 10*fontFactor);
boldFont.setWeight(QFont::Bold); boldFont.setWeight(QFont::Bold);
pixPaint.setFont(boldFont); pixPaint.setFont(boldFont);

View File

@ -14,7 +14,7 @@ class SplashScreen : public QSplashScreen
Q_OBJECT Q_OBJECT
public: public:
explicit SplashScreen(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = 0); explicit SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet);
}; };
#endif // SPLASHSCREEN_H #endif // SPLASHSCREEN_H