2023-04-27 20:27:53 +00:00
|
|
|
import QtCore
|
2023-04-20 10:48:00 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
2023-04-24 03:56:33 +00:00
|
|
|
import QtQuick.Controls.Basic
|
2023-04-27 20:27:53 +00:00
|
|
|
import QtQuick.Dialogs
|
2023-04-20 10:48:00 +00:00
|
|
|
import QtQuick.Layouts
|
2023-06-22 19:44:49 +00:00
|
|
|
import chatlistmodel
|
2023-04-19 01:10:06 +00:00
|
|
|
import download
|
|
|
|
import llm
|
2023-06-22 19:44:49 +00:00
|
|
|
import modellist
|
2023-05-03 00:31:17 +00:00
|
|
|
import network
|
2023-06-28 20:05:35 +00:00
|
|
|
import mysettings
|
2023-04-19 01:10:06 +00:00
|
|
|
|
2023-07-06 14:53:43 +00:00
|
|
|
MyDialog {
|
2023-04-19 01:10:06 +00:00
|
|
|
id: modelDownloaderDialog
|
|
|
|
modal: true
|
2023-07-09 18:58:55 +00:00
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
2023-07-06 14:53:43 +00:00
|
|
|
padding: 10
|
2023-10-24 16:13:32 +00:00
|
|
|
property bool showEmbeddingModels: false
|
2023-04-19 01:10:06 +00:00
|
|
|
|
2023-05-03 00:31:17 +00:00
|
|
|
onOpened: {
|
|
|
|
Network.sendModelDownloaderDialog();
|
2023-10-24 16:13:32 +00:00
|
|
|
|
|
|
|
if (showEmbeddingModels) {
|
|
|
|
ModelList.downloadableModels.expanded = true
|
|
|
|
var targetModelIndex = ModelList.defaultEmbeddingModelIndex
|
2023-11-14 16:53:02 +00:00
|
|
|
modelListView.positionViewAtIndex(targetModelIndex, ListView.Contain)
|
2023-10-24 16:13:32 +00:00
|
|
|
}
|
2023-05-03 00:31:17 +00:00
|
|
|
}
|
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
PopupDialog {
|
|
|
|
id: downloadingErrorPopup
|
|
|
|
anchors.centerIn: parent
|
|
|
|
shouldTimeOut: false
|
|
|
|
}
|
|
|
|
|
2023-04-19 01:10:06 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
2023-07-06 14:53:43 +00:00
|
|
|
anchors.margins: 10
|
2023-04-23 15:28:17 +00:00
|
|
|
spacing: 30
|
2023-04-19 01:10:06 +00:00
|
|
|
|
|
|
|
Label {
|
|
|
|
id: listLabel
|
2023-06-20 21:40:02 +00:00
|
|
|
text: qsTr("Available Models:")
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-04-19 01:10:06 +00:00
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
Layout.fillWidth: true
|
2023-04-23 13:42:35 +00:00
|
|
|
color: theme.textColor
|
2023-04-19 01:10:06 +00:00
|
|
|
}
|
|
|
|
|
2023-06-20 21:31:36 +00:00
|
|
|
Label {
|
2023-07-12 15:46:40 +00:00
|
|
|
visible: !ModelList.downloadableModels.count && !ModelList.asyncModelRequestOngoing
|
2023-06-20 21:40:02 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
verticalAlignment: Qt.AlignVCenter
|
2023-10-05 13:56:40 +00:00
|
|
|
text: qsTr("Network error: could not retrieve http://gpt4all.io/models/models2.json")
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-20 21:31:36 +00:00
|
|
|
color: theme.mutedTextColor
|
|
|
|
}
|
|
|
|
|
2023-07-12 15:46:40 +00:00
|
|
|
MyBusyIndicator {
|
|
|
|
visible: !ModelList.downloadableModels.count && ModelList.asyncModelRequestOngoing
|
|
|
|
running: ModelList.asyncModelRequestOngoing
|
|
|
|
Accessible.role: Accessible.Animation
|
2023-07-12 15:51:07 +00:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
2023-07-12 15:46:40 +00:00
|
|
|
Accessible.name: qsTr("Busy indicator")
|
|
|
|
Accessible.description: qsTr("Displayed when the models request is ongoing")
|
|
|
|
}
|
|
|
|
|
2023-04-23 15:28:17 +00:00
|
|
|
ScrollView {
|
|
|
|
id: scrollView
|
|
|
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
2023-04-19 01:10:06 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
clip: true
|
|
|
|
|
2023-04-23 15:28:17 +00:00
|
|
|
ListView {
|
2023-06-22 19:44:49 +00:00
|
|
|
id: modelListView
|
|
|
|
model: ModelList.downloadableModels
|
2023-04-23 15:28:17 +00:00
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
delegate: Rectangle {
|
2023-04-23 15:28:17 +00:00
|
|
|
id: delegateItem
|
2023-06-22 19:44:49 +00:00
|
|
|
width: modelListView.width
|
|
|
|
height: childrenRect.height
|
|
|
|
color: index % 2 === 0 ? theme.backgroundLight : theme.backgroundLighter
|
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
columns: 2
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
Text {
|
|
|
|
textFormat: Text.StyledText
|
2023-07-01 15:34:21 +00:00
|
|
|
text: "<h2>" + name + "</h2>"
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarger
|
2023-06-22 19:44:49 +00:00
|
|
|
Layout.row: 0
|
|
|
|
Layout.column: 0
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.columnSpan: 2
|
|
|
|
color: theme.assistantColor
|
|
|
|
Accessible.role: Accessible.Paragraph
|
|
|
|
Accessible.name: qsTr("Model file")
|
|
|
|
Accessible.description: qsTr("Model file to be downloaded")
|
|
|
|
}
|
2023-04-19 01:10:06 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
Rectangle {
|
|
|
|
id: actionBox
|
|
|
|
width: childrenRect.width + 20
|
|
|
|
color: theme.backgroundDark
|
|
|
|
border.width: 1
|
|
|
|
radius: 10
|
|
|
|
Layout.row: 1
|
|
|
|
Layout.column: 1
|
|
|
|
Layout.rightMargin: 20
|
|
|
|
Layout.bottomMargin: 20
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.minimumHeight: childrenRect.height + 20
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.rowSpan: 2
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
MyButton {
|
|
|
|
id: downloadButton
|
|
|
|
text: isDownloading ? qsTr("Cancel") : isIncomplete ? qsTr("Resume") : qsTr("Download")
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.minimumWidth: openaiKey.width
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
|
|
|
visible: !isChatGPT && !installed && !calcHash && downloadError === ""
|
2023-10-21 14:38:46 +00:00
|
|
|
Accessible.description: qsTr("Stop/restart/start the download")
|
2023-06-22 19:44:49 +00:00
|
|
|
background: Rectangle {
|
|
|
|
border.color: downloadButton.down ? theme.backgroundLightest : theme.buttonBorder
|
|
|
|
border.width: 2
|
|
|
|
radius: 10
|
|
|
|
color: downloadButton.hovered ? theme.backgroundDark : theme.backgroundDarkest
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
if (!isDownloading) {
|
|
|
|
Download.downloadModel(filename);
|
|
|
|
} else {
|
|
|
|
Download.cancelDownload(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-19 01:10:06 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
MyButton {
|
|
|
|
id: removeButton
|
|
|
|
text: qsTr("Remove")
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.minimumWidth: openaiKey.width
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
|
|
|
visible: installed || downloadError !== ""
|
2023-10-21 14:38:46 +00:00
|
|
|
Accessible.description: qsTr("Remove model from filesystem")
|
2023-06-22 19:44:49 +00:00
|
|
|
background: Rectangle {
|
|
|
|
border.color: removeButton.down ? theme.backgroundLightest : theme.buttonBorder
|
|
|
|
border.width: 2
|
|
|
|
radius: 10
|
|
|
|
color: removeButton.hovered ? theme.backgroundDark : theme.backgroundDarkest
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
Download.removeModel(filename);
|
|
|
|
}
|
|
|
|
}
|
2023-04-27 18:52:40 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
MyButton {
|
|
|
|
id: installButton
|
|
|
|
visible: !installed && isChatGPT
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.minimumWidth: openaiKey.width
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
|
|
|
text: qsTr("Install")
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
background: Rectangle {
|
|
|
|
border.color: installButton.down ? theme.backgroundLightest : theme.buttonBorder
|
|
|
|
border.width: 2
|
|
|
|
radius: 10
|
|
|
|
color: installButton.hovered ? theme.backgroundDark : theme.backgroundDarkest
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
if (openaiKey.text === "")
|
|
|
|
openaiKey.showError();
|
|
|
|
else
|
|
|
|
Download.installModel(filename, openaiKey.text);
|
|
|
|
}
|
|
|
|
Accessible.role: Accessible.Button
|
2023-10-21 14:38:46 +00:00
|
|
|
Accessible.name: qsTr("Install")
|
|
|
|
Accessible.description: qsTr("Install chatGPT model")
|
2023-06-22 19:44:49 +00:00
|
|
|
}
|
2023-04-23 15:28:17 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 0
|
|
|
|
Label {
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
text: "<strong><font size=\"1\">"
|
|
|
|
+ (qsTr("Status: ")
|
|
|
|
+ (installed ? qsTr("Installed")
|
|
|
|
: (downloadError !== "" ? qsTr("<a href=\"#error\">Error</a>")
|
|
|
|
: (isDownloading ? qsTr("Downloading") : qsTr("Available")))))
|
|
|
|
+ "</strong></font>"
|
|
|
|
color: theme.textColor
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-07-06 00:12:37 +00:00
|
|
|
linkColor: theme.textErrorColor
|
2023-06-22 19:44:49 +00:00
|
|
|
Accessible.role: Accessible.Paragraph
|
|
|
|
Accessible.name: text
|
|
|
|
Accessible.description: qsTr("Whether the file is already installed on your system")
|
|
|
|
onLinkActivated: {
|
|
|
|
downloadingErrorPopup.text = downloadError;
|
|
|
|
downloadingErrorPopup.open();
|
|
|
|
}
|
|
|
|
}
|
2023-04-19 01:10:06 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
Label {
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
text: "<strong><font size=\"1\">"
|
|
|
|
+ (qsTr("Download size: ") + filesize)
|
|
|
|
+ "<br>"
|
|
|
|
+ (qsTr("RAM required: ") + (ramrequired > 0 ? ramrequired + " GB" : qsTr("minimal")))
|
|
|
|
+ "<br>"
|
|
|
|
+ (qsTr("Parameters: ") + parameters)
|
|
|
|
+ "<br>"
|
|
|
|
+ (qsTr("Quantization: ") + quant)
|
|
|
|
+ "<br>"
|
|
|
|
+ (qsTr("Type: ") + type)
|
|
|
|
+ "</strong></font>"
|
|
|
|
color: theme.textColor
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
Accessible.role: Accessible.Paragraph
|
|
|
|
Accessible.name: text
|
|
|
|
Accessible.description: qsTr("Metadata about the model")
|
|
|
|
onLinkActivated: {
|
|
|
|
downloadingErrorPopup.text = downloadError;
|
|
|
|
downloadingErrorPopup.open();
|
|
|
|
}
|
|
|
|
}
|
2023-04-19 01:10:06 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
Label {
|
|
|
|
visible: LLM.systemTotalRAMInGB() < ramrequired
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.maximumWidth: openaiKey.width
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
text: qsTr("<strong><font size=\"2\">WARNING: Not recommended for your hardware.")
|
|
|
|
+ qsTr(" Model requires more memory (") + ramrequired
|
|
|
|
+ qsTr(" GB) than your system has available (")
|
|
|
|
+ LLM.systemTotalRAMInGBString() + ").</strong></font>"
|
|
|
|
color: theme.textErrorColor
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
Accessible.role: Accessible.Paragraph
|
|
|
|
Accessible.name: text
|
|
|
|
Accessible.description: qsTr("Error for incompatible hardware")
|
|
|
|
onLinkActivated: {
|
|
|
|
downloadingErrorPopup.text = downloadError;
|
|
|
|
downloadingErrorPopup.open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-24 04:14:52 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
ColumnLayout {
|
|
|
|
visible: isDownloading && !calcHash
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.minimumWidth: openaiKey.width
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
|
|
|
spacing: 20
|
|
|
|
|
|
|
|
ProgressBar {
|
|
|
|
id: itemProgressBar
|
|
|
|
Layout.fillWidth: true
|
|
|
|
width: openaiKey.width
|
|
|
|
value: bytesReceived / bytesTotal
|
|
|
|
background: Rectangle {
|
|
|
|
implicitHeight: 45
|
|
|
|
color: theme.backgroundDarkest
|
|
|
|
radius: 3
|
|
|
|
}
|
|
|
|
contentItem: Item {
|
|
|
|
implicitHeight: 40
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
width: itemProgressBar.visualPosition * parent.width
|
|
|
|
height: parent.height
|
|
|
|
radius: 2
|
|
|
|
color: theme.assistantColor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Accessible.role: Accessible.ProgressBar
|
|
|
|
Accessible.name: qsTr("Download progressBar")
|
|
|
|
Accessible.description: qsTr("Shows the progress made in the download")
|
|
|
|
}
|
2023-04-24 04:14:52 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
Label {
|
|
|
|
id: speedLabel
|
|
|
|
color: theme.textColor
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
text: speed
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
Accessible.role: Accessible.Paragraph
|
|
|
|
Accessible.name: qsTr("Download speed")
|
|
|
|
Accessible.description: qsTr("Download speed in bytes/kilobytes/megabytes per second")
|
|
|
|
}
|
|
|
|
}
|
2023-04-19 01:10:06 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
RowLayout {
|
|
|
|
visible: calcHash
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.minimumWidth: openaiKey.width
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: calcHashLabel
|
|
|
|
color: theme.textColor
|
|
|
|
text: qsTr("Calculating MD5...")
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
Accessible.role: Accessible.Paragraph
|
|
|
|
Accessible.name: text
|
|
|
|
Accessible.description: qsTr("Whether the file hash is being calculated")
|
|
|
|
}
|
2023-04-23 23:43:20 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
MyBusyIndicator {
|
|
|
|
id: busyCalcHash
|
|
|
|
running: calcHash
|
|
|
|
Accessible.role: Accessible.Animation
|
|
|
|
Accessible.name: qsTr("Busy indicator")
|
|
|
|
Accessible.description: qsTr("Displayed when the file hash is being calculated")
|
|
|
|
}
|
|
|
|
}
|
2023-04-23 23:43:20 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
MyTextField {
|
|
|
|
id: openaiKey
|
|
|
|
visible: !installed && isChatGPT
|
|
|
|
Layout.topMargin: 20
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.minimumWidth: 150
|
2023-07-01 15:34:21 +00:00
|
|
|
Layout.maximumWidth: textMetrics.width + 25
|
2023-06-22 19:44:49 +00:00
|
|
|
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
|
|
|
|
color: theme.textColor
|
|
|
|
background: Rectangle {
|
|
|
|
color: theme.backgroundLighter
|
|
|
|
radius: 10
|
|
|
|
}
|
2023-07-01 15:34:21 +00:00
|
|
|
wrapMode: Text.WrapAnywhere
|
2023-06-22 19:44:49 +00:00
|
|
|
function showError() {
|
|
|
|
openaiKey.placeholderTextColor = theme.textErrorColor
|
|
|
|
}
|
|
|
|
onTextChanged: {
|
|
|
|
openaiKey.placeholderTextColor = theme.backgroundLightest
|
|
|
|
}
|
|
|
|
placeholderText: qsTr("enter $OPENAI_API_KEY")
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
placeholderTextColor: theme.backgroundLightest
|
|
|
|
Accessible.role: Accessible.EditableText
|
|
|
|
Accessible.name: placeholderText
|
|
|
|
Accessible.description: qsTr("Whether the file hash is being calculated")
|
2023-07-01 15:34:21 +00:00
|
|
|
TextMetrics {
|
|
|
|
id: textMetrics
|
|
|
|
font: openaiKey.font
|
|
|
|
text: openaiKey.placeholderText
|
|
|
|
}
|
2023-06-22 19:44:49 +00:00
|
|
|
}
|
|
|
|
}
|
2023-04-23 23:43:20 +00:00
|
|
|
}
|
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
Text {
|
|
|
|
id: descriptionText
|
|
|
|
text: description
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-06-22 19:44:49 +00:00
|
|
|
Layout.row: 1
|
|
|
|
Layout.column: 0
|
|
|
|
Layout.leftMargin: 20
|
|
|
|
Layout.bottomMargin: 20
|
|
|
|
Layout.maximumWidth: modelListView.width - actionBox.width - 60
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
textFormat: Text.StyledText
|
2023-05-16 13:32:01 +00:00
|
|
|
color: theme.textColor
|
2023-06-22 19:44:49 +00:00
|
|
|
linkColor: theme.textColor
|
2023-05-16 13:32:01 +00:00
|
|
|
Accessible.role: Accessible.Paragraph
|
2023-06-22 19:44:49 +00:00
|
|
|
Accessible.name: qsTr("Description")
|
2023-10-21 14:38:46 +00:00
|
|
|
Accessible.description: qsTr("File description")
|
2023-06-22 19:44:49 +00:00
|
|
|
onLinkActivated: Qt.openUrlExternally(link)
|
2023-05-16 13:32:01 +00:00
|
|
|
}
|
2023-04-23 15:28:17 +00:00
|
|
|
}
|
2023-06-22 19:44:49 +00:00
|
|
|
}
|
2023-04-19 01:10:06 +00:00
|
|
|
|
2023-06-22 19:44:49 +00:00
|
|
|
footer: Component {
|
|
|
|
Rectangle {
|
|
|
|
width: modelListView.width
|
|
|
|
height: expandButton.height + 80
|
|
|
|
color: ModelList.downloadableModels.count % 2 === 0 ? theme.backgroundLight : theme.backgroundLighter
|
|
|
|
MyButton {
|
|
|
|
id: expandButton
|
|
|
|
anchors.centerIn: parent
|
|
|
|
padding: 40
|
|
|
|
text: ModelList.downloadableModels.expanded ? qsTr("Show fewer models") : qsTr("Show more models")
|
2023-05-15 00:12:15 +00:00
|
|
|
background: Rectangle {
|
2023-06-22 19:44:49 +00:00
|
|
|
border.color: expandButton.down ? theme.backgroundLightest : theme.buttonBorder
|
|
|
|
border.width: 2
|
2023-05-15 00:12:15 +00:00
|
|
|
radius: 10
|
2023-06-22 19:44:49 +00:00
|
|
|
color: expandButton.hovered ? theme.backgroundDark : theme.backgroundDarkest
|
2023-05-15 00:12:15 +00:00
|
|
|
}
|
|
|
|
onClicked: {
|
2023-06-22 19:44:49 +00:00
|
|
|
ModelList.downloadableModels.expanded = !ModelList.downloadableModels.expanded;
|
2023-04-23 15:28:17 +00:00
|
|
|
}
|
2023-04-19 01:10:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-27 20:27:53 +00:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
2023-04-23 15:28:17 +00:00
|
|
|
Layout.fillWidth: true
|
2023-04-27 20:27:53 +00:00
|
|
|
spacing: 20
|
|
|
|
FolderDialog {
|
|
|
|
id: modelPathDialog
|
|
|
|
title: "Please choose a directory"
|
2023-07-09 15:31:01 +00:00
|
|
|
currentFolder: "file://" + MySettings.modelPath
|
2023-04-27 20:27:53 +00:00
|
|
|
onAccepted: {
|
2023-07-09 15:31:01 +00:00
|
|
|
MySettings.modelPath = selectedFolder
|
2023-04-27 20:27:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: modelPathLabel
|
|
|
|
text: qsTr("Download path:")
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-04-27 20:27:53 +00:00
|
|
|
color: theme.textColor
|
|
|
|
Layout.row: 1
|
|
|
|
Layout.column: 0
|
|
|
|
}
|
2023-06-03 02:52:55 +00:00
|
|
|
MyDirectoryField {
|
|
|
|
id: modelPathDisplayField
|
2023-06-28 20:05:35 +00:00
|
|
|
text: MySettings.modelPath
|
2023-08-07 17:54:13 +00:00
|
|
|
font.pixelSize: theme.fontSizeLarge
|
2023-04-27 20:27:53 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
ToolTip.text: qsTr("Path where model files will be downloaded to")
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
Accessible.role: Accessible.ToolTip
|
2023-06-03 02:52:55 +00:00
|
|
|
Accessible.name: modelPathDisplayField.text
|
2023-04-27 20:27:53 +00:00
|
|
|
Accessible.description: ToolTip.text
|
2023-06-03 02:52:55 +00:00
|
|
|
onEditingFinished: {
|
|
|
|
if (isValid) {
|
2023-07-09 15:31:01 +00:00
|
|
|
MySettings.modelPath = modelPathDisplayField.text
|
2023-06-03 02:52:55 +00:00
|
|
|
} else {
|
2023-06-28 20:05:35 +00:00
|
|
|
text = MySettings.modelPath
|
2023-06-03 02:52:55 +00:00
|
|
|
}
|
2023-04-29 02:07:37 +00:00
|
|
|
}
|
2023-04-27 20:27:53 +00:00
|
|
|
}
|
2023-05-23 13:53:32 +00:00
|
|
|
MyButton {
|
2023-04-27 20:27:53 +00:00
|
|
|
text: qsTr("Browse")
|
2023-10-21 14:38:46 +00:00
|
|
|
Accessible.description: qsTr("Choose where to save model files")
|
2023-04-27 20:27:53 +00:00
|
|
|
onClicked: modelPathDialog.open()
|
|
|
|
}
|
2023-04-23 15:28:17 +00:00
|
|
|
}
|
2023-04-19 01:10:06 +00:00
|
|
|
}
|
|
|
|
}
|