Skip to content

Commit c47f01b

Browse files
committed
Showing Local Addresses in Node Window
This change adds one line to the Node Window (debugwindow.ui) under the Network section and shows the LocalAddresses there. fixes #564
1 parent 68b1425 commit c47f01b

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed

src/qt/forms/debugwindow.ui

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,29 @@
249249
</widget>
250250
</item>
251251
<item row="9" column="0">
252+
<widget class="QLabel" name="label_14">
253+
<property name="text">
254+
<string>Local Address</string>
255+
</property>
256+
</widget>
257+
</item>
258+
<item row="9" column="1" colspan="2">
259+
<widget class="QLabel" name="localAddresses">
260+
<property name="cursor">
261+
<cursorShape>IBeamCursor</cursorShape>
262+
</property>
263+
<property name="text">
264+
<string notr="true">N/A</string>
265+
</property>
266+
<property name="textFormat">
267+
<enum>Qt::PlainText</enum>
268+
</property>
269+
<property name="textInteractionFlags">
270+
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
271+
</property>
272+
</widget>
273+
</item>
274+
<item row="10" column="0">
252275
<widget class="QLabel" name="label_10">
253276
<property name="font">
254277
<font>
@@ -261,14 +284,14 @@
261284
</property>
262285
</widget>
263286
</item>
264-
<item row="10" column="0">
287+
<item row="11" column="0">
265288
<widget class="QLabel" name="label_3">
266289
<property name="text">
267290
<string>Current block height</string>
268291
</property>
269292
</widget>
270293
</item>
271-
<item row="10" column="1" colspan="2">
294+
<item row="11" column="1" colspan="2">
272295
<widget class="QLabel" name="numberOfBlocks">
273296
<property name="cursor">
274297
<cursorShape>IBeamCursor</cursorShape>
@@ -284,14 +307,14 @@
284307
</property>
285308
</widget>
286309
</item>
287-
<item row="11" column="0">
310+
<item row="12" column="0">
288311
<widget class="QLabel" name="labelLastBlockTime">
289312
<property name="text">
290313
<string>Last block time</string>
291314
</property>
292315
</widget>
293316
</item>
294-
<item row="11" column="1" colspan="2">
317+
<item row="12" column="1" colspan="2">
295318
<widget class="QLabel" name="lastBlockTime">
296319
<property name="cursor">
297320
<cursorShape>IBeamCursor</cursorShape>
@@ -307,7 +330,7 @@
307330
</property>
308331
</widget>
309332
</item>
310-
<item row="12" column="0">
333+
<item row="13" column="0">
311334
<widget class="QLabel" name="labelMempoolTitle">
312335
<property name="font">
313336
<font>
@@ -320,14 +343,14 @@
320343
</property>
321344
</widget>
322345
</item>
323-
<item row="13" column="0">
346+
<item row="14" column="0">
324347
<widget class="QLabel" name="labelNumberOfTransactions">
325348
<property name="text">
326349
<string>Current number of transactions</string>
327350
</property>
328351
</widget>
329352
</item>
330-
<item row="13" column="1">
353+
<item row="14" column="1">
331354
<widget class="QLabel" name="mempoolNumberTxs">
332355
<property name="cursor">
333356
<cursorShape>IBeamCursor</cursorShape>
@@ -343,14 +366,14 @@
343366
</property>
344367
</widget>
345368
</item>
346-
<item row="14" column="0">
369+
<item row="15" column="0">
347370
<widget class="QLabel" name="labelMemoryUsage">
348371
<property name="text">
349372
<string>Memory usage</string>
350373
</property>
351374
</widget>
352375
</item>
353-
<item row="14" column="1">
376+
<item row="15" column="1">
354377
<widget class="QLabel" name="mempoolSize">
355378
<property name="cursor">
356379
<cursorShape>IBeamCursor</cursorShape>
@@ -366,7 +389,7 @@
366389
</property>
367390
</widget>
368391
</item>
369-
<item row="12" column="2" rowspan="3">
392+
<item row="13" column="2" rowspan="3">
370393
<layout class="QVBoxLayout" name="verticalLayoutDebugButton">
371394
<property name="spacing">
372395
<number>3</number>
@@ -406,7 +429,7 @@
406429
</item>
407430
</layout>
408431
</item>
409-
<item row="15" column="0">
432+
<item row="16" column="0">
410433
<spacer name="verticalSpacer">
411434
<property name="orientation">
412435
<enum>Qt::Vertical</enum>

src/qt/rpcconsole.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,17 @@ void RPCConsole::updateNetworkState()
958958
}
959959

960960
ui->numberOfConnections->setText(connections);
961+
962+
QString local_addresses;
963+
LOCK(g_maplocalhost_mutex);
964+
for (auto it = mapLocalHost.begin(); it != mapLocalHost.end();) {
965+
local_addresses += QString::fromStdString(it->first.ToString()) + ":" + QString::number(it->second.nPort);
966+
if (++it != mapLocalHost.end()) local_addresses += ", ";
967+
}
968+
//: Signals to the user that they do not have any local addresses.
969+
if (local_addresses.isEmpty()) local_addresses = tr("None");
970+
971+
ui->localAddresses->setText(local_addresses);
961972
}
962973

963974
void RPCConsole::setNumConnections(int count)

0 commit comments

Comments
 (0)