Compare commits

...

2 Commits

Author SHA1 Message Date
Lakshay Kansal
cbdcde8b75
scrollbar fixed for main chat and chat drawer (#1301) 2023-07-31 12:18:38 -04:00
Lakshay Kansal
3d2db76070
fixed issue of text color changing for code blocks in light mode (#1299) 2023-07-31 12:18:19 -04:00
3 changed files with 73 additions and 4 deletions

View File

@ -675,7 +675,7 @@ Window {
anchors.top: parent.top
anchors.bottom: !currentChat.isServer ? textInputView.top : parent.bottom
anchors.bottomMargin: !currentChat.isServer ? 30 : 0
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
Rectangle {
anchors.fill: parent
@ -729,6 +729,7 @@ Window {
visible: ModelList.installedModels.count !== 0
anchors.fill: parent
model: chatModel
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AlwaysOn }
Accessible.role: Accessible.List
Accessible.name: qsTr("List of prompt/response pairs")

View File

@ -63,15 +63,15 @@ Drawer {
anchors.top: newChat.bottom
anchors.bottom: checkForUpdatesButton.top
anchors.bottomMargin: 10
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
clip: true
ListView {
id: conversationList
anchors.fill: parent
anchors.rightMargin: 10
model: ChatListModel
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AlwaysOn }
delegate: Rectangle {
id: chatRectangle
@ -287,4 +287,4 @@ Drawer {
}
}
}
}
}

View File

@ -23,6 +23,8 @@ enum Language {
Php
};
static QColor defaultColor = "#d1d5db"; // white
static QColor keywordColor = "#2e95d3"; // blue
static QColor functionColor = "#f22c3d"; // red
static QColor functionCallColor = "#e9950c"; // orange
@ -91,6 +93,12 @@ static QVector<HighlightingRule> pythonHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat functionCallFormat;
functionCallFormat.setForeground(functionCallColor);
rule.pattern = QRegularExpression("\\b(\\w+)\\s*(?=\\()");
@ -151,6 +159,12 @@ static QVector<HighlightingRule> csharpHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
// Function call highlighting
QTextCharFormat functionCallFormat;
functionCallFormat.setForeground(functionCallColor);
@ -219,6 +233,12 @@ static QVector<HighlightingRule> cppHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat functionCallFormat;
functionCallFormat.setForeground(functionCallColor);
rule.pattern = QRegularExpression("\\b(\\w+)\\s*(?=\\()");
@ -297,6 +317,12 @@ static QVector<HighlightingRule> typescriptHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat functionCallFormat;
functionCallFormat.setForeground(functionCallColor);
rule.pattern = QRegularExpression("\\b(\\w+)\\s*(?=\\()");
@ -381,6 +407,12 @@ static QVector<HighlightingRule> javaHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat functionCallFormat;
functionCallFormat.setForeground(functionCallColor);
rule.pattern = QRegularExpression("\\b(\\w+)\\s*(?=\\()");
@ -450,6 +482,12 @@ static QVector<HighlightingRule> goHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat functionCallFormat;
functionCallFormat.setForeground(functionCallColor);
rule.pattern = QRegularExpression("\\b(\\w+)\\s*(?=\\()");
@ -515,6 +553,12 @@ static QVector<HighlightingRule> bashHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat commandFormat;
commandFormat.setForeground(commandColor);
QStringList commandPatterns = {
@ -582,6 +626,12 @@ static QVector<HighlightingRule> latexHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat commandFormat;
commandFormat.setForeground(commandColor); // commandColor needs to be set to your liking
rule.pattern = QRegularExpression("\\\\[A-Za-z]+"); // Pattern for LaTeX commands
@ -604,6 +654,12 @@ static QVector<HighlightingRule> htmlHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat attributeNameFormat;
attributeNameFormat.setForeground(attributeNameColor);
rule.pattern = QRegularExpression("\\b(\\w+)\\s*=");
@ -644,6 +700,12 @@ static QVector<HighlightingRule> phpHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
QTextCharFormat functionCallFormat;
functionCallFormat.setForeground(functionCallColor);
rule.pattern = QRegularExpression("\\b(\\w+)\\s*(?=\\()");
@ -711,6 +773,12 @@ static QVector<HighlightingRule> jsonHighlightingRules()
HighlightingRule rule;
QTextCharFormat defaultFormat;
defaultFormat.setForeground(defaultColor);
rule.pattern = QRegularExpression(".*");
rule.format = defaultFormat;
highlightingRules.append(rule);
// Key string rule
QTextCharFormat keyFormat;
keyFormat.setForeground(keyColor); // Assuming keyColor is defined