kopia lustrzana https://gitlab.com/eliggett/wfview
Add colour to logging!
rodzic
c3975ef492
commit
6e8eb23dea
|
@ -58,10 +58,21 @@ void loggingWindow::setInitialDebugState(bool debugModeEnabled)
|
|||
ui->debugBtn->blockSignals(false);
|
||||
}
|
||||
|
||||
void loggingWindow::acceptLogText(QString text)
|
||||
void loggingWindow::acceptLogText(QPair<QtMsgType,QString> text)
|
||||
{
|
||||
QMutexLocker lock(&textMutex);
|
||||
ui->logTextDisplay->appendPlainText(text);
|
||||
QString colour = "white";
|
||||
if (text.first == QtDebugMsg)
|
||||
{
|
||||
colour = "grey";
|
||||
} else if (text.first == QtWarningMsg)
|
||||
{
|
||||
colour = "yellow";
|
||||
} else if (text.first == QtCriticalMsg || text.first == QtFatalMsg)
|
||||
{
|
||||
colour = "red";
|
||||
}
|
||||
ui->logTextDisplay->appendHtml(QString("<p><span style='color:%0'>%1</span></p>").arg(colour).arg(text.second));
|
||||
if(vertLogScroll->value() == vertLogScroll->maximum())
|
||||
{
|
||||
horizLogScroll->setValue(horizLogScroll->minimum());
|
||||
|
|
|
@ -27,7 +27,7 @@ class loggingWindow : public QWidget
|
|||
public:
|
||||
explicit loggingWindow(QString logFilename, QWidget *parent = 0);
|
||||
~loggingWindow();
|
||||
void acceptLogText(QString text);
|
||||
void acceptLogText(QPair<QtMsgType,QString> text);
|
||||
|
||||
public slots:
|
||||
void setInitialDebugState(bool debugModeEnabled);
|
||||
|
|
|
@ -803,7 +803,7 @@ void rigCommander::parseCommand()
|
|||
}
|
||||
|
||||
case funcVFOBandMS:
|
||||
value.setValue(payloadIn[0]);
|
||||
value.setValue(static_cast<bool>(payloadIn[0]));
|
||||
break;
|
||||
case funcSatelliteMemory:
|
||||
memParser=rigCaps.satParser;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
QScopedPointer<QFile> m_logFile;
|
||||
QMutex logMutex;
|
||||
QMutex logTextMutex;
|
||||
QVector<QString> logStringBuffer;
|
||||
QVector<QPair<QtMsgType,QString>> logStringBuffer;
|
||||
#ifdef QT_DEBUG
|
||||
bool debugModeLogging = true;
|
||||
#else
|
||||
|
@ -5116,10 +5116,10 @@ void wfmain::logCheck()
|
|||
}
|
||||
}
|
||||
|
||||
void wfmain::handleLogText(QString text)
|
||||
void wfmain::handleLogText(QPair<QtMsgType,QString> logMessage)
|
||||
{
|
||||
// This function is just a pass-through
|
||||
logWindow->acceptLogText(text);
|
||||
logWindow->acceptLogText(logMessage);
|
||||
}
|
||||
|
||||
void wfmain::setDebugLogging(bool debugModeOn)
|
||||
|
@ -5177,7 +5177,7 @@ void wfmain::messageHandler(QtMsgType type, const QMessageLogContext& context, c
|
|||
text.append(": ");
|
||||
text.append(msg);
|
||||
logTextMutex.lock();
|
||||
logStringBuffer.push_front(text);
|
||||
logStringBuffer.push_front(QPair<QtMsgType,QString>(type,text));
|
||||
logTextMutex.unlock();
|
||||
|
||||
}
|
||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -95,7 +95,7 @@ public:
|
|||
explicit wfmain(const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0);
|
||||
~wfmain();
|
||||
static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);
|
||||
void handleLogText(QString text);
|
||||
void handleLogText(QPair<QtMsgType,QString> logMessage);
|
||||
|
||||
#ifdef USB_HOTPLUG
|
||||
#if defined(Q_OS_WIN)
|
||||
|
|
Ładowanie…
Reference in New Issue