Skip to content

Commit 326b5bb

Browse files
committed
Merge pull request #3437
2ea980a qt: Treat regtest as testnet (Wladimir J. van der Laan)
2 parents cc661b4 + 2ea980a commit 326b5bb

File tree

7 files changed

+32
-23
lines changed

7 files changed

+32
-23
lines changed

src/qt/bitcoin.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,10 @@ int main(int argc, char *argv[])
198198

199199
// Application identification (must be set before OptionsModel is initialized,
200200
// as it is used to locate QSettings)
201+
bool isaTestNet = TestNet() || RegTest();
201202
QApplication::setOrganizationName("Bitcoin");
202203
QApplication::setOrganizationDomain("bitcoin.org");
203-
if (TestNet()) // Separate UI settings for testnet
204+
if (isaTestNet) // Separate UI settings for testnets
204205
QApplication::setApplicationName("Bitcoin-Qt-testnet");
205206
else
206207
QApplication::setApplicationName("Bitcoin-Qt");
@@ -231,7 +232,7 @@ int main(int argc, char *argv[])
231232
PaymentServer* paymentServer = new PaymentServer(&app);
232233

233234
// User language is set up: pick a data directory
234-
Intro::pickDataDirectory(TestNet());
235+
Intro::pickDataDirectory(isaTestNet);
235236

236237
// Install global event filter that makes sure that long tooltips can be word-wrapped
237238
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
@@ -259,7 +260,7 @@ int main(int argc, char *argv[])
259260
return 1;
260261
}
261262

262-
SplashScreen splash(QPixmap(), 0);
263+
SplashScreen splash(QPixmap(), 0, isaTestNet);
263264
if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false))
264265
{
265266
splash.show();
@@ -281,7 +282,7 @@ int main(int argc, char *argv[])
281282

282283
boost::thread_group threadGroup;
283284

284-
BitcoinGUI window(TestNet(), 0);
285+
BitcoinGUI window(isaTestNet, 0);
285286
guiref = &window;
286287

287288
QTimer* pollShutdownTimer = new QTimer(guiref);

src/qt/clientmodel.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,12 @@ void ClientModel::updateAlert(const QString &hash, int status)
123123
emit alertsChanged(getStatusBarWarnings());
124124
}
125125

126-
bool ClientModel::isTestNet() const
126+
QString ClientModel::getNetworkName() const
127127
{
128-
return TestNet();
128+
QString netname(QString::fromStdString(Params().DataDir()));
129+
if(netname.isEmpty())
130+
netname = "main";
131+
return netname;
129132
}
130133

131134
bool ClientModel::inInitialBlockDownload() const

src/qt/clientmodel.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class ClientModel : public QObject
4646
double getVerificationProgress() const;
4747
QDateTime getLastBlockDate() const;
4848

49-
//! Return true if client connected to testnet
50-
bool isTestNet() const;
49+
//! Return network (main, testnet3, regtest)
50+
QString getNetworkName() const;
5151
//! Return true if core is doing initial block download
5252
bool inInitialBlockDownload() const;
5353
//! Return true if core is importing blocks

src/qt/forms/rpcconsole.ui

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@
172172
</widget>
173173
</item>
174174
<item row="7" column="0">
175-
<widget class="QLabel" name="label_7">
175+
<widget class="QLabel" name="label_8">
176176
<property name="text">
177-
<string>Number of connections</string>
177+
<string>Name</string>
178178
</property>
179179
</widget>
180180
</item>
181181
<item row="7" column="1">
182-
<widget class="QLabel" name="numberOfConnections">
182+
<widget class="QLabel" name="networkName">
183183
<property name="cursor">
184184
<cursorShape>IBeamCursor</cursorShape>
185185
</property>
@@ -195,19 +195,25 @@
195195
</widget>
196196
</item>
197197
<item row="8" column="0">
198-
<widget class="QLabel" name="label_8">
198+
<widget class="QLabel" name="label_7">
199199
<property name="text">
200-
<string>On testnet</string>
200+
<string>Number of connections</string>
201201
</property>
202202
</widget>
203203
</item>
204204
<item row="8" column="1">
205-
<widget class="QCheckBox" name="isTestNet">
206-
<property name="enabled">
207-
<bool>false</bool>
205+
<widget class="QLabel" name="numberOfConnections">
206+
<property name="cursor">
207+
<cursorShape>IBeamCursor</cursorShape>
208208
</property>
209209
<property name="text">
210-
<string/>
210+
<string>N/A</string>
211+
</property>
212+
<property name="textFormat">
213+
<enum>Qt::PlainText</enum>
214+
</property>
215+
<property name="textInteractionFlags">
216+
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
211217
</property>
212218
</widget>
213219
</item>

src/qt/rpcconsole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void RPCConsole::setClientModel(ClientModel *model)
284284
ui->buildDate->setText(model->formatBuildDate());
285285
ui->startupTime->setText(model->formatClientStartupTime());
286286

287-
ui->isTestNet->setChecked(model->isTestNet());
287+
ui->networkName->setText(model->getNetworkName());
288288
}
289289
}
290290

src/qt/splashscreen.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44

55
#include "splashscreen.h"
66

7-
#include "chainparams.h"
87
#include "clientversion.h"
98
#include "util.h"
109

1110
#include <QApplication>
1211
#include <QPainter>
1312

14-
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
13+
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet) :
1514
QSplashScreen(pixmap, f)
1615
{
1716
// set reference point, paddings
@@ -32,7 +31,7 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
3231

3332
// load the bitmap for writing some text over it
3433
QPixmap newPixmap;
35-
if(TestNet()) {
34+
if(isTestNet) {
3635
newPixmap = QPixmap(":/images/splash_testnet");
3736
}
3837
else {
@@ -72,7 +71,7 @@ SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
7271
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);
7372

7473
// draw testnet string if testnet is on
75-
if(TestNet()) {
74+
if(isTestNet) {
7675
QFont boldFont = QFont(font, 10*fontFactor);
7776
boldFont.setWeight(QFont::Bold);
7877
pixPaint.setFont(boldFont);

src/qt/splashscreen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SplashScreen : public QSplashScreen
1414
Q_OBJECT
1515

1616
public:
17-
explicit SplashScreen(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags f = 0);
17+
explicit SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f, bool isTestNet);
1818
};
1919

2020
#endif // SPLASHSCREEN_H

0 commit comments

Comments
 (0)