Changed font for better compatibility. Added some controls for scrolling

behavior.
knobtest
Elliott Liggett 2022-09-15 11:52:08 -07:00
rodzic c5f626065a
commit 4e3af7cccd
4 zmienionych plików z 57 dodań i 12 usunięć

Wyświetl plik

@ -13,6 +13,11 @@ loggingWindow::loggingWindow(QWidget *parent) :
ui->logTextDisplay->setFocusPolicy(Qt::NoFocus);
ui->annotateBtn->setFocusPolicy(Qt::NoFocus);
QFont font("Monospace");
font.setStyleHint(QFont::TypeWriter);
ui->logTextDisplay->setFont(font);
ui->userAnnotationText->setFont(font);
#ifdef Q_OS_MAC
logFilename = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0] + "/wfview.log";
logDirectory = QStandardPaths::standardLocations(QStandardPaths::DownloadLocation)[0];
@ -27,6 +32,12 @@ loggingWindow::loggingWindow(QWidget *parent) :
connect(socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromHost()));
connect(socket, SIGNAL(readyRead()), this, SLOT(handleDataFromLoggingHost()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(handleLoggingHostError(QAbstractSocket::SocketError)));
vertLogScroll = ui->logTextDisplay->verticalScrollBar();
horizLogScroll = ui->logTextDisplay->horizontalScrollBar();
vertLogScroll->setValue(vertLogScroll->maximum());
horizLogScroll->setValue(horizLogScroll->minimum());
}
loggingWindow::~loggingWindow()
@ -35,10 +46,18 @@ loggingWindow::~loggingWindow()
delete ui;
}
void loggingWindow::setInitialDebugState(bool debugModeEnabled)
{
ui->debugBtn->blockSignals(true);
ui->debugBtn->setChecked(debugModeEnabled);
ui->debugBtn->blockSignals(false);
}
void loggingWindow::acceptLogText(QString text)
{
QMutexLocker lock(&textMutex);
ui->logTextDisplay->appendPlainText(text);
horizLogScroll->setValue(horizLogScroll->minimum());
}
void loggingWindow::sendToTermbin()
@ -174,3 +193,9 @@ void loggingWindow::on_debugBtn_clicked(bool checked)
{
emit setDebugMode(checked);
}
void loggingWindow::on_toBottomBtn_clicked()
{
vertLogScroll->setValue(vertLogScroll->maximum());
horizLogScroll->setValue(horizLogScroll->minimum());
}

Wyświetl plik

@ -9,6 +9,7 @@
#include <QTcpSocket>
#include <QTextStream>
#include <QMessageBox>
#include <QScrollBar>
#include "logcategories.h"
@ -25,6 +26,9 @@ public:
~loggingWindow();
void acceptLogText(QString text);
public slots:
void setInitialDebugState(bool debugModeEnabled);
private slots:
void connectedToHost();
void disconnectedFromHost();
@ -47,6 +51,8 @@ private slots:
void on_debugBtn_clicked(bool checked);
void on_toBottomBtn_clicked();
signals:
void setDebugMode(bool debugOn);
@ -54,6 +60,8 @@ private:
Ui::loggingWindow *ui;
QClipboard *clipboard;
QMessageBox msgBox;
QScrollBar *vertLogScroll;
QScrollBar *horizLogScroll;
QMutex textMutex;
QString logFilename;
QString logDirectory;

Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>554</width>
<width>625</width>
<height>300</height>
</rect>
</property>
@ -16,11 +16,6 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPlainTextEdit" name="logTextDisplay">
<property name="font">
<font>
<family>Ubuntu Mono</family>
</font>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
@ -67,10 +62,8 @@
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>Ubuntu Mono</family>
</font>
<property name="toolTip">
<string>You may enter your own log notes here.</string>
</property>
</widget>
</item>
@ -109,20 +102,30 @@
<item>
<widget class="QCheckBox" name="debugBtn">
<property name="toolTip">
<string>Enable or disable debug logging</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enable or disable debug logging. Use the &amp;quot;-d&amp;quot; or &amp;quot;--debug&amp;quot; flag to open wfview with debug logging enabled on startup. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Debug</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toBottomBtn">
<property name="toolTip">
<string>Scroll to bottom</string>
</property>
<property name="text">
<string>To Bottom</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearDisplayBtn">
<property name="toolTip">
<string>Clears the display. Does not clear the log file.</string>
</property>
<property name="text">
<string>Clear Display</string>
<string>Clear</string>
</property>
</widget>
</item>

Wyświetl plik

@ -41,6 +41,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s
logWindow = new loggingWindow();
initLogging();
logWindow->setInitialDebugState(debugMode);
qInfo(logSystem()) << version;
this->serialPortCL = serialPortCL;
@ -6958,7 +6959,15 @@ void wfmain::on_colorSavePresetBtn_clicked()
void wfmain::on_showLogBtn_clicked()
{
if(logWindow->isMinimized())
{
logWindow->raise();
logWindow->activateWindow();
return;
}
logWindow->show();
logWindow->raise();
logWindow->activateWindow();
}
void wfmain::initLogging()