diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9fe09d4..d0ee83b 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1986,10 +1986,7 @@ void MainWindow::setupMiningTab() { } } -void MainWindow::setupDebugLogTab() { - ui->debugLog->setReadOnly(true); - ui->debugLog->setPlainText("Some debug stuff"); - +QString MainWindow::readDebugLines() { #ifdef Q_OS_LINUX QFile file(QDir::homePath() + "/.hush/HUSH3/debug.log"); #elif defined(Q_OS_DARWIN) @@ -2004,7 +2001,7 @@ void MainWindow::setupDebugLogTab() { DEBUG(": Found debug.log at " << file); } else { DEBUG("No debug.log found!"); - return; + return ""; } if(file.open(QIODevice::ReadOnly)) @@ -2023,9 +2020,23 @@ void MainWindow::setupDebugLogTab() { } file.seek(file.pos()+2); QString debugText = file.readAll(); - ui->debugLog->setPlainText( debugText ); + DEBUG("got " << debugText.size() << " bytes of debugText"); + file.close(); + return debugText; } + return ""; +} + +void MainWindow::setupDebugLogTab() { + ui->debugLog->setReadOnly(true); + ui->debugLog->setPlainText("Loading debug log..."); + + QObject::connect(ui->refreshDebugButton, &QPushButton::clicked, [=] () { + DEBUG("refresh debug log clicked"); + ui->debugLog->setPlainText( readDebugLines() ); + }); + ui->debugLog->setPlainText( readDebugLines() ); } void MainWindow::setupPeersTab() { diff --git a/src/mainwindow.h b/src/mainwindow.h index e5c9024..1f0ea51 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -85,6 +85,7 @@ private: void closeEvent(QCloseEvent* event); + QString readDebugLines(); void setupSendTab(); void setupPeersTab(); void setupTransactionsTab(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 69e5c82..bdbbfdf 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1137,7 +1137,34 @@ - + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + Click to see the latest debug log data + + + + Refresh + + + +