Compare commits
1 Commits
693ffbcc00
...
e5b91eaed8
| Author | SHA1 | Date | |
|---|---|---|---|
| e5b91eaed8 |
2
build.rs
2
build.rs
@ -8,6 +8,8 @@ fn main() {
|
||||
"qml/ClideProjectView.qml",
|
||||
"qml/ClideEditor.qml",
|
||||
"qml/ClideMenuBar.qml",
|
||||
"qml/ClideLogger.qml",
|
||||
"qml/Logger/Logger.qml",
|
||||
]))
|
||||
// Link Qt's Network library
|
||||
// - Qt Core is always linked
|
||||
|
||||
@ -7,6 +7,7 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import clide.module 1.0
|
||||
import Logger 1.0
|
||||
|
||||
SplitView {
|
||||
id: root
|
||||
@ -78,6 +79,9 @@ SplitView {
|
||||
text: parent.index + 1
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width - indicator.width
|
||||
background: Rectangle {
|
||||
color: RustColors.terminal_background
|
||||
}
|
||||
}
|
||||
// Draw edge along the right side of the line number.
|
||||
Rectangle {
|
||||
@ -149,20 +153,8 @@ SplitView {
|
||||
}
|
||||
}
|
||||
}
|
||||
TextArea {
|
||||
ClideLogger {
|
||||
id: areaConsole
|
||||
|
||||
height: 100
|
||||
width: parent.width
|
||||
placeholderText: qsTr("shaun@pc:~/Code/clide$ ")
|
||||
placeholderTextColor: "white"
|
||||
readOnly: true
|
||||
wrapMode: TextArea.Wrap
|
||||
background: Rectangle {
|
||||
color: RustColors.terminal_background
|
||||
implicitHeight: 100
|
||||
// border.color: control.enabled ? RustColors.active : RustColors.inactive
|
||||
}
|
||||
}
|
||||
|
||||
// We use an inline component to customize the horizontal and vertical
|
||||
@ -208,4 +200,11 @@ SplitView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
// Show logging is working.
|
||||
Logger.debug("Debug console ready")
|
||||
Logger.warn("Warnings show up too")
|
||||
}
|
||||
}
|
||||
|
||||
58
qml/ClideLogger.qml
Normal file
58
qml/ClideLogger.qml
Normal file
@ -0,0 +1,58 @@
|
||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
||||
//
|
||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import clide.module 1.0
|
||||
import Logger 1.0
|
||||
|
||||
Item {
|
||||
ListModel { id: model }
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "#111"
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
model: model
|
||||
clip: true
|
||||
|
||||
function getLogColor(level) {
|
||||
switch (level) {
|
||||
case "INFO":
|
||||
return RustColors.info_log
|
||||
break;
|
||||
case "DEBUG":
|
||||
return RustColors.debug_log
|
||||
break;
|
||||
case "WARN":
|
||||
return RustColors.warn_log
|
||||
break;
|
||||
case "ERROR":
|
||||
return RustColors.error_log
|
||||
break;
|
||||
default:
|
||||
return RustColors.info_log
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Text {
|
||||
text: `[${level}] ${message}`
|
||||
font.family: "monospace"
|
||||
color: listView.getLogColor(level)
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Logger
|
||||
function onLogged(level, message) {
|
||||
model.append({ level, message })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import clide.module 1.0
|
||||
import Logger 1.0
|
||||
|
||||
SplitView {
|
||||
id: root
|
||||
@ -62,9 +63,7 @@ SplitView {
|
||||
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onSingleTapped: (eventPoint, button) => {
|
||||
contextMenu.popup()
|
||||
}
|
||||
onSingleTapped: (eventPoint, button) => contextMenu.popup()
|
||||
}
|
||||
|
||||
Menu {
|
||||
@ -72,7 +71,7 @@ SplitView {
|
||||
Action {
|
||||
text: qsTr("Reset root index")
|
||||
onTriggered: {
|
||||
console.log("Resetting root directory: " + clideTreeView.originalRootDirectory)
|
||||
Logger.log("Resetting root directory: " + clideTreeView.originalRootDirectory)
|
||||
clideTreeView.rootDirectory = clideTreeView.originalRootDirectory
|
||||
}
|
||||
}
|
||||
@ -89,7 +88,7 @@ SplitView {
|
||||
originalRootDirectory: root.projectDir
|
||||
rootDirectory: root.projectDir
|
||||
onRootDirectoryChanged: {
|
||||
console.log(clideTreeView.rootDirectory)
|
||||
Logger.log(clideTreeView.rootDirectory)
|
||||
breadCrumb.text = clideTreeView.rootDirectory
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import QtQuick.Effects
|
||||
import QtQuick.Controls
|
||||
|
||||
import clide.module 1.0
|
||||
import Logger 1.0
|
||||
|
||||
TreeView {
|
||||
id: fileSystemTreeView
|
||||
@ -133,14 +134,14 @@ TreeView {
|
||||
text: qsTr("Set as root index")
|
||||
enabled: treeDelegate.hasChildren
|
||||
onTriggered: {
|
||||
console.log("Setting new root directory: " + treeDelegate.filePath)
|
||||
Logger.debug("Setting new root directory: " + treeDelegate.filePath)
|
||||
fileSystemTreeView.rootDirectory = treeDelegate.filePath
|
||||
}
|
||||
}
|
||||
Action {
|
||||
text: qsTr("Reset root index")
|
||||
onTriggered: {
|
||||
console.log("Resetting root directory: " + fileSystemTreeView.originalRootDirectory)
|
||||
Logger.log("Resetting root directory: " + fileSystemTreeView.originalRootDirectory)
|
||||
fileSystemTreeView.rootDirectory = fileSystemTreeView.originalRootDirectory
|
||||
}
|
||||
}
|
||||
|
||||
30
qml/Logger/Logger.qml
Normal file
30
qml/Logger/Logger.qml
Normal file
@ -0,0 +1,30 @@
|
||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
||||
//
|
||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
||||
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
signal logged(string level, string message)
|
||||
|
||||
function log(msg) {
|
||||
console.log(msg)
|
||||
logged("INFO", msg)
|
||||
}
|
||||
|
||||
function debug(msg) {
|
||||
console.log(msg)
|
||||
logged("DEBUG", msg)
|
||||
}
|
||||
|
||||
function warn(msg) {
|
||||
console.warn(msg)
|
||||
logged("WARN", msg)
|
||||
}
|
||||
|
||||
function error(msg) {
|
||||
console.error(msg)
|
||||
logged("ERROR", msg)
|
||||
}
|
||||
}
|
||||
1
qml/Logger/qmldir
Normal file
1
qml/Logger/qmldir
Normal file
@ -0,0 +1 @@
|
||||
singleton Logger 1.0 Logger.qml
|
||||
@ -27,6 +27,7 @@ ApplicationWindow {
|
||||
title: qsTr("Error")
|
||||
}
|
||||
ClideProjectView {
|
||||
id: clideProjectView
|
||||
projectDir: appWindow.appContextPath
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,10 @@ pub mod qobject {
|
||||
#[qproperty(QColor, explorer_folder)]
|
||||
#[qproperty(QColor, explorer_folder_open)]
|
||||
#[qproperty(QColor, terminal_background)]
|
||||
#[qproperty(QColor, info_log)]
|
||||
#[qproperty(QColor, debug_log)]
|
||||
#[qproperty(QColor, warn_log)]
|
||||
#[qproperty(QColor, error_log)]
|
||||
type RustColors = super::RustColorsImpl;
|
||||
}
|
||||
}
|
||||
@ -67,6 +71,10 @@ pub struct RustColorsImpl {
|
||||
explorer_folder: QColor,
|
||||
explorer_folder_open: QColor,
|
||||
terminal_background: QColor,
|
||||
info_log: QColor,
|
||||
debug_log: QColor,
|
||||
warn_log: QColor,
|
||||
error_log: QColor,
|
||||
}
|
||||
|
||||
impl Default for RustColorsImpl {
|
||||
@ -83,7 +91,7 @@ impl Default for RustColorsImpl {
|
||||
linenumber: QColor::try_from("#94989b").unwrap(),
|
||||
active: QColor::try_from("#a9acb0").unwrap(),
|
||||
inactive: QColor::try_from("#FFF").unwrap(),
|
||||
editor_background: QColor::try_from("#2b2b2b").unwrap(),
|
||||
editor_background: QColor::try_from("#111111").unwrap(),
|
||||
editor_text: QColor::try_from("#acaea3").unwrap(),
|
||||
editor_highlighted_text: QColor::try_from("#ccced3").unwrap(),
|
||||
editor_highlight: QColor::try_from("#ccced3").unwrap(),
|
||||
@ -94,7 +102,11 @@ impl Default for RustColorsImpl {
|
||||
explorer_background: QColor::try_from("#1E1F22").unwrap(),
|
||||
explorer_folder: QColor::try_from("#54585b").unwrap(),
|
||||
explorer_folder_open: QColor::try_from("#2b2b2b").unwrap(),
|
||||
terminal_background: QColor::try_from("#2C2E32").unwrap(),
|
||||
terminal_background: QColor::try_from("#111111").unwrap(),
|
||||
info_log: QColor::try_from("#C4FFFF").unwrap(),
|
||||
debug_log: QColor::try_from("#55ff99").unwrap(),
|
||||
warn_log: QColor::try_from("#ffaa00").unwrap(),
|
||||
error_log: QColor::try_from("#ff5555").unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user