Latest v3.0.0 rc4 fixes (#2490)

* Use the same font size for code blocks as we do for the rest of the chat text.

* Add a conversation tray after discussion with Vincent and Andriy and gathering
of feedback from some other users. This adds the reset context back as a
recycle button and copy chat features back to the app for v3.0.0.

Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
AT
2024-06-30 15:10:19 -04:00
committed by GitHub
parent 1bc16a2a4f
commit 4a1a3c48e8
20 changed files with 235 additions and 123 deletions

View File

@@ -888,6 +888,7 @@ ChatViewTextProcessor::ChatViewTextProcessor(QObject *parent)
, m_syntaxHighlighter(new SyntaxHighlighter(this))
, m_isProcessingText(false)
, m_shouldProcessText(true)
, m_fontPixelSize(QGuiApplication::font().pointSizeF())
{
}
@@ -933,6 +934,20 @@ void ChatViewTextProcessor::setShouldProcessText(bool b)
handleTextChanged();
}
qreal ChatViewTextProcessor::fontPixelSize() const
{
return m_fontPixelSize;
}
void ChatViewTextProcessor::setFontPixelSize(qreal sz)
{
if (m_fontPixelSize == sz)
return;
m_fontPixelSize = sz;
emit fontPixelSizeChanged();
handleTextChanged();
}
void traverseDocument(QTextDocument *doc, QTextFrame *frame)
{
QTextFrame *rootFrame = frame ? frame : doc->rootFrame();
@@ -1126,7 +1141,7 @@ void ChatViewTextProcessor::handleCodeBlocks()
codeBlockCharFormat.setForeground(defaultColor);
QFont monospaceFont("Courier");
monospaceFont.setPointSize(QGuiApplication::font().pointSize() + 2);
monospaceFont.setPointSize(m_fontPixelSize);
if (monospaceFont.family() != "Courier") {
monospaceFont.setFamily("Monospace"); // Fallback if Courier isn't available
}