clide/qml/main.qml
2025-03-29 10:26:39 -04:00

157 lines
5.3 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import "Menu"
ApplicationWindow {
id: appWindow
height: 800
title: "CLIDE"
visible: true
width: 1200
menuBar: ClideMenuBar {
}
Rectangle {
anchors.fill: parent
color: "#1e1f22"
}
MessageDialog {
id: errorDialog
title: qsTr("Error")
}
RowLayout {
anchors.fill: parent
spacing: 0
SplitView {
Layout.fillHeight: true
Layout.fillWidth: true
// Customized handle to drag between the Navigation and the Editor.
handle: Rectangle {
border.color: SplitHandle.hovered ? "#303234" : "#3c3f41"
color: SplitHandle.pressed ? "#4b4f51" : "#3c3f41"
implicitWidth: 8
opacity: SplitHandle.hovered || navigationView.width < 15 ? 1.0 : 0.0
Behavior on opacity {
OpacityAnimator {
duration: 1400
}
}
}
Rectangle {
id: navigationView
SplitView.fillHeight: true
SplitView.preferredWidth: 250
color: "#303234"
StackLayout {
anchors.fill: parent
// Shows the help text.
TextArea {
readOnly: true
placeholderText: qsTr("File system view placeholder")
placeholderTextColor: "white"
wrapMode: TextArea.Wrap
}
// TODO: Shows the files on the file system.
// ClideProjectView {
// id: fileSystemView
// color: Colors.surface1
// onFileClicked: path => root.currentFilePath = path
// }
}
}
SplitView {
Layout.fillHeight: true
Layout.fillWidth: true
orientation: Qt.Vertical
// Customized handle to drag between the Navigation and the Editor.
handle: Rectangle {
border.color: SplitHandle.hovered ? "#2b2b2b" : "#3c3f41"
color: SplitHandle.pressed ? "#4b4f51" : "#3c3f41"
implicitHeight: 8
opacity: SplitHandle.hovered || navigationView.width < 15 ? 1.0 : 0.0
Behavior on opacity {
OpacityAnimator {
duration: 1400
}
}
}
TextArea {
id: areaText
color: "#ccced3"
focus: true
persistentSelection: true
selectByMouse: true
// selectedTextColor: control.palette.highlightedText
// selectionColor: control.palette.highlight
textFormat: Qt.AutoText
wrapMode: TextArea.Wrap
background: Rectangle {
color: "#2b2b2b"
implicitHeight: 650
}
onLinkActivated: function (link) {
Qt.openUrlExternally(link);
}
// TODO: Handle saving
// Component.onCompleted: {
// if (Qt.application.arguments.length === 2)
// textDocument.source = "file:" + Qt.application.arguments[1]
// else
// textDocument.source = "qrc:/texteditor.html"
// }
// textDocument.onStatusChanged: {
// // a message lookup table using computed properties:
// // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer
// const statusMessages = {
// [ TextDocument.ReadError ]: qsTr("Failed to load “%1”"),
// [ TextDocument.WriteError ]: qsTr("Failed to save “%1”"),
// [ TextDocument.NonLocalFileError ]: qsTr("Not a local file: “%1”"),
// }
// const err = statusMessages[textDocument.status]
// if (err) {
// errorDialog.text = err.arg(textDocument.source)
// errorDialog.open()
// }
// }
}
TextArea {
id: areaConsole
placeholderText: qsTr("Placeholder for bash terminal.")
placeholderTextColor: "white"
height: 100
readOnly: true
wrapMode: TextArea.Wrap
background: Rectangle {
color: "#2b2b2b"
implicitHeight: 100
// border.color: control.enabled ? "#21be2b" : "transparent"
}
}
}
}
}
}