Commit Graph

12 Commits (6d5dd75e4a20f75c0a6c568a88fbec04f4a49121)

Author SHA1 Message Date
Matt Gajownik f77ab0e199 UI: Fix rendering of spaces & tabs in Log Viewer
For some reason, the combination of QPlainTextEdit and a HTML block
seems to treat spaces as HTML shoult (only display one, no tabs, etc)
rather than how QTextEdit + HTML does, which is strange. As we don't
need HTML for existing log lines, insert them as plaintext, but for
new entries wrap non-error non-warning messages in a <font> tag and
format that with white-space: pre
2022-02-27 18:56:19 +11:00
Matt Gajownik 0e57a7beef UI: Fix performance issues with the Log Viewer
This commit includes two big changes, alongside other smaller tweaks.

1) Update the internal QTextDocument of the text component directly
2) Use QPlainTextEdit, which supports HTML & is designed for long text
3) Use QString's arg function for formatting strings

Fix 1 significantly improves realtime performance when adding lines
individually, to the point that the UI no longer freezes if the viewer
is open and the log is being spammed. It also improves initial launch
speed when there's a large amount of text already in the file.
Reference: https://stackoverflow.com/a/54501760/2763321

Fix 2 completely eliminates delay when opening the viewer, regardless
of how many lines are already in the log file. For a standard log
after OBS launch, this cuts opening time from about 2 seconds to half a
second. For anything longer than 1,000 lines, the UI no longer freezes,
and the viewer (& its contents) open within half a second.
Reference: https://stackoverflow.com/a/17466240/2763321
2022-02-26 15:03:35 -08:00
Clayton Groeneveld a5bb527ce5 UI: Delete log viewer when closing it
When the user would open the log viewer and close it, it would
just hide, instead of deleting it.
2021-05-09 20:35:28 -05:00
Ryan Foster e81f8e3857 UI: Don't use QTextStream::setCodec in Qt6
In Qt6, QTextStream::setCodec has been replaced by
QTextStream::setEncoding. However, all text is assumed to be UTF-8, so
we don't need to specify UTF-8 in Qt6.

https://doc.qt.io/qt-5/qtextstream.html#setCodec-1
https://doc.qt.io/qt-6/qtextstream.html#setEncoding
2021-03-09 09:16:19 -05:00
Kurt Kartaltepe 513bcb8e35 UI: Cleanup Qt for Qt6
This changes cleans up some deprecated functions that were removed in
Qt6. Some are placed behind version ifdefs and others are replaced for
their non-deprecated Qt5 version.
2021-03-08 21:41:13 -08:00
Matt Gajownik fff7d5b8d4 UI: Always parse log contents for Log Viewer as UTF-8 2020-09-27 02:28:05 -07:00
jp9000 c0f19b95d5 UI: Do not always have log viewer loaded
This object should not always be created on startup. Instead, only load
it specifically when the user wants to load it.

This fixes a freeze some users were experiencing due to the text widget.
Unfortunately, it is not yet known how that freeze occurred with the log
viewer, so for the time being do not load the log viewer object unless
explicitly created.
2020-09-15 20:29:40 -07:00
Matt Gajownik a4e1049e67 UI: Add maximize and minimize support to Log Viewer 2020-08-25 14:30:21 +10:00
Jim b31f04c92a
Merge pull request #3284 from WizardCM/open-log-button
UI: Provide Open button in the Log Viewer
2020-08-20 11:25:28 -07:00
Matt Gajownik 92b1980c0a UI: Render tabs and spaces in Log Viewer 2020-08-20 09:39:05 +10:00
Matt Gajownik 3e5de93cf3 UI: Provide Open button in the Log Viewer 2020-08-15 15:20:38 +10:00
Clayton Groeneveld 040e445617 UI: Add log viewer window 2020-07-31 19:57:12 -07:00