Add about dialog.

pull/520/head
Adam Treat 1 year ago
parent 659442394f
commit 06bb6960d4

@ -80,6 +80,7 @@ qt_add_qml_module(chat
qml/SettingsDialog.qml
qml/StartupDialog.qml
qml/PopupDialog.qml
qml/AboutDialog.qml
qml/Theme.qml
RESOURCES
icons/send_message.svg

@ -22,13 +22,15 @@ void ChatListModel::saveChats() const
QFileInfo settingsInfo(settings.fileName());
QString settingsPath = settingsInfo.absolutePath();
for (Chat *chat : m_chats) {
QFile file(settingsPath + "/gpt4all-" + chat->id() + ".chat");
QString fileName = "gpt4all-" + chat->id() + ".chat";
QFile file(settingsPath + "/" + fileName);
bool success = file.open(QIODevice::WriteOnly);
if (!success) {
qWarning() << "ERROR: Couldn't save chat to file:" << file.fileName();
continue;
}
QDataStream out(&file);
qDebug() << "serializing chat" << fileName;
if (!chat->serialize(out)) {
qWarning() << "ERROR: Couldn't serialize chat to file:" << file.fileName();
file.remove();
@ -63,6 +65,7 @@ void ChatListModel::restoreChats()
connect(chat, &Chat::nameChanged, this, &ChatListModel::nameChanged);
m_chats.append(chat);
}
qDebug() << "deserializing chat" << f;
file.close();
}
std::sort(m_chats.begin(), m_chats.end(), [](const Chat* a, const Chat* b) {

@ -87,6 +87,11 @@ Window {
anchors.centerIn: parent
}
AboutDialog {
id: aboutDialog
anchors.centerIn: parent
}
Item {
Accessible.role: Accessible.Window
Accessible.name: title
@ -533,6 +538,9 @@ Window {
onDownloadClicked: {
downloadNewModels.open()
}
onAboutClicked: {
aboutDialog.open()
}
}
Rectangle {

@ -0,0 +1,113 @@
import QtCore
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts
import download
import network
import llm
Dialog {
id: abpoutDialog
anchors.centerIn: parent
modal: false
opacity: 0.9
padding: 20
width: 1024
height: column.height + 40
Theme {
id: theme
}
Column {
id: column
spacing: 20
Item {
width: childrenRect.width
height: childrenRect.height
Image {
id: img
anchors.top: parent.top
anchors.left: parent.left
width: 60
height: 60
source: "qrc:/gpt4all/icons/logo.svg"
}
Text {
anchors.left: img.right
anchors.leftMargin: 30
anchors.verticalCenter: img.verticalCenter
text: qsTr("About GPT4All")
color: theme.textColor
}
}
ScrollView {
clip: true
height: 200
width: 1024 - 40
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
TextArea {
id: welcome
wrapMode: Text.Wrap
width: 1024 - 40
padding: 20
textFormat: TextEdit.MarkdownText
text: qsTr("### Release notes\n")
+ Download.releaseInfo.notes
+ qsTr("### Contributors\n")
+ Download.releaseInfo.contributors
color: theme.textColor
focus: false
readOnly: true
Accessible.role: Accessible.Paragraph
Accessible.name: qsTr("Release notes")
Accessible.description: qsTr("Release notes for this version")
background: Rectangle {
color: theme.backgroundLight
radius: 10
}
}
}
Label {
id: discordLink
width: parent.width
textFormat: Text.RichText
wrapMode: Text.WordWrap
text: qsTr("Check out our discord channel <a href=\"https://discord.gg/4M2QFmTt2k\">https://discord.gg/4M2QFmTt2k</a>")
onLinkActivated: { Qt.openUrlExternally("https://discord.gg/4M2QFmTt2k") }
color: theme.textColor
linkColor: theme.linkColor
Accessible.role: Accessible.Link
Accessible.name: qsTr("Discord link")
}
Label {
id: nomicProps
width: parent.width
textFormat: Text.RichText
wrapMode: Text.WordWrap
text: qsTr("Thank you to <a href=\"https://home.nomic.ai\">Nomic AI</a> and the community for contributing so much great data, code, ideas, and energy to the growing open source AI ecosystem!")
onLinkActivated: { Qt.openUrlExternally("https://home.nomic.ai") }
color: theme.textColor
linkColor: theme.linkColor
Accessible.role: Accessible.Paragraph
Accessible.name: qsTr("Thank you blurb")
Accessible.description: qsTr("Contains embedded link to https://home.nomic.ai")
}
}
background: Rectangle {
anchors.fill: parent
color: theme.backgroundDarkest
border.width: 1
border.color: theme.dialogBorder
radius: 10
}
}

@ -17,6 +17,7 @@ Drawer {
}
signal downloadClicked
signal aboutClicked
background: Rectangle {
height: parent.height
@ -259,41 +260,6 @@ Drawer {
}
}
/*Label {
id: discordLink
textFormat: Text.RichText
anchors.left: parent.left
anchors.right: parent.right
anchors.top: conversationList.bottom
anchors.topMargin: 20
wrapMode: Text.WordWrap
text: qsTr("Check out our discord channel <a href=\"https://discord.gg/4M2QFmTt2k\">https://discord.gg/4M2QFmTt2k</a>")
onLinkActivated: { Qt.openUrlExternally("https://discord.gg/4M2QFmTt2k") }
color: theme.textColor
linkColor: theme.linkColor
Accessible.role: Accessible.Link
Accessible.name: qsTr("Discord link")
}
Label {
id: nomicProps
textFormat: Text.RichText
anchors.left: parent.left
anchors.right: parent.right
anchors.top: discordLink.bottom
anchors.topMargin: 20
wrapMode: Text.WordWrap
text: qsTr("Thanks to <a href=\"https://home.nomic.ai\">Nomic AI</a> and the community for contributing so much great data and energy!")
onLinkActivated: { Qt.openUrlExternally("https://home.nomic.ai") }
color: theme.textColor
linkColor: theme.linkColor
Accessible.role: Accessible.Paragraph
Accessible.name: qsTr("Thank you blurb")
Accessible.description: qsTr("Contains embedded link to https://home.nomic.ai")
}*/
Button {
id: checkForUpdatesButton
anchors.left: parent.left
@ -329,7 +295,8 @@ Drawer {
id: downloadButton
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottom: aboutButton.top
anchors.bottomMargin: 10
padding: 15
contentItem: Text {
text: qsTr("Download new models...")
@ -353,5 +320,34 @@ Drawer {
downloadClicked()
}
}
Button {
id: aboutButton
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
padding: 15
contentItem: Text {
text: qsTr("About")
horizontalAlignment: Text.AlignHCenter
color: theme.textColor
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Use this to launch a dialog to show the about page")
}
background: Rectangle {
opacity: .5
border.color: theme.backgroundLightest
border.width: 1
radius: 10
color: theme.backgroundLight
}
onClicked: {
aboutClicked()
}
}
}
}
Loading…
Cancel
Save