Compare commits

...

9 Commits
master ... duke

  1. 17
      src/connection.cpp
  2. 23
      src/mainwindow.cpp
  3. 15
      src/mainwindow.ui

17
src/connection.cpp

@ -378,11 +378,24 @@ bool ConnectionLoader::startEmbeddedHushd() {
// Static because it needs to survive even after this method returns.
static QString processStdErrOutput;
// Try to get only the error message
auto friendlyError = processStdErrOutput.split("Error: ");
if (ehushd != nullptr) {
if (ehushd->state() == QProcess::NotRunning) {
if (!processStdErrOutput.isEmpty()) {
QMessageBox::critical(main, QObject::tr("hushd error"), "hushd said: " + processStdErrOutput,
QMessageBox::Ok);
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(friendlyError.last());
msgBox.setDetailedText(processStdErrOutput);
//Add styles and width hack
msgBox.setStyleSheet("background-color:rgb(48, 51, 53);color:rgb(255, 255, 255)");
QSpacerItem* horizontalSpacer = new QSpacerItem(512, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout* layout = (QGridLayout*)msgBox.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
msgBox.exec();
}
return false;
} else {

23
src/mainwindow.cpp

@ -2044,6 +2044,29 @@ void MainWindow::setupDebugLogTab() {
});
ui->debugLog->setPlainText( readDebugLines() );
QObject::connect(ui->debugAuto, &QCheckBox::stateChanged, [=](auto checked) {
if(checked) {
QTimer* debugTimer = new QTimer();
DEBUG("debugAuto checkbox checked");
// Set up timer
QObject::connect(debugTimer, &QTimer::timeout, [=]() {
uint32_t debugLines = ui->debugLines->text().trimmed().toInt();
if (debugLines == 0) { debugLines = 50; }
ui->debugLog->setPlainText( readDebugLines(debugLines) );
DEBUG("Refreshed debug data with debugLines=" << debugLines);
});
//TODO: allow customizing refresh speed
uint32_t debugRefreshSpeed = 30*1000;
debugTimer->start(debugRefreshSpeed);
DEBUG("started debug refresh at speed=" << debugRefreshSpeed); //Settings::debugRefreshSpeed;
} else {
DEBUG("debugAuto checkbox unchecked");
//TODO: store debugTimer in class so we can access it here and stop it
// debugTimer->stop();
}
});
}
void MainWindow::setupPeersTab() {

15
src/mainwindow.ui

@ -1181,6 +1181,21 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="debugAuto">
<property name="text">
<string>Auto refresh</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QPlainTextEdit" name="debugLog">
<property name="plainText">

Loading…
Cancel
Save