Compare commits
2 Commits
048d40eb83
...
0fac2b71ab
| Author | SHA1 | Date | |
|---|---|---|---|
| 0fac2b71ab | |||
| db2f878018 |
@ -19,8 +19,6 @@ And of course, [Rust](https://www.rust-lang.org/tools/install).
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
This project requires at least Qt 6.7. To check your Qt version
|
||||
|
||||
```bash
|
||||
@ -144,6 +142,7 @@ Some helpful links for reading up on QML if you're just getting started.
|
||||
* [All QML Controls Types](https://doc.qt.io/qt-6/qtquick-controls-qmlmodule.html)
|
||||
* [KDAB CXX-Qt Book](https://kdab.github.io/cxx-qt/book/)
|
||||
* [github.com/KDAB/cxx-qt](https://github.com/KDAB/cxx-qt)
|
||||
* [QML and C++ Intergration](https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html)
|
||||
|
||||
|
||||
### Plugins
|
||||
|
||||
1
build.rs
1
build.rs
@ -18,6 +18,7 @@ fn main() {
|
||||
.qt_module("Gui")
|
||||
.qt_module("Svg")
|
||||
.qt_module("Xml")
|
||||
.qrc("./resources.qrc")
|
||||
.files(["src/gui/colors.rs", "src/gui/filesystem.rs"])
|
||||
.build();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@ -31,7 +31,7 @@ ApplicationWindow {
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 20
|
||||
|
||||
source: "../icons/kilroy-256.png"
|
||||
source: "qrc:/images/kilroy.png"
|
||||
sourceSize.width: 80
|
||||
sourceSize.height: 80
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
@ -43,11 +43,26 @@ SplitView {
|
||||
SplitView.preferredWidth: 200
|
||||
SplitView.maximumWidth: 250
|
||||
|
||||
StackLayout {
|
||||
anchors.fill: parent
|
||||
ColumnLayout {
|
||||
spacing: 2
|
||||
Rectangle {
|
||||
width: navigationView.width
|
||||
height: breadCrumb.height + 5
|
||||
|
||||
color: RustColors.explorer_text
|
||||
Text {
|
||||
id: breadCrumb
|
||||
text: clideTreeView.rootDirectory
|
||||
elide: Text.ElideLeft
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
|
||||
ClideTreeView {
|
||||
id: clideTreeView
|
||||
onFileClicked: path => root.projectDir = path
|
||||
width: navigationView.width
|
||||
height: navigationView.height
|
||||
|
||||
// Path to the directory opened in the file explorer.
|
||||
rootDirectory: root.projectDir
|
||||
|
||||
@ -3,41 +3,36 @@
|
||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import clide.module 1.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: RustColors.explorer_background
|
||||
TreeView {
|
||||
id: fileSystemTreeView
|
||||
model: FileSystem
|
||||
|
||||
property int lastIndex: -1
|
||||
|
||||
required property string rootDirectory
|
||||
|
||||
signal fileClicked(string filePath)
|
||||
|
||||
TreeView {
|
||||
id: fileSystemTreeView
|
||||
anchors.margins: 15
|
||||
|
||||
property int lastIndex: -1
|
||||
|
||||
model: FileSystem
|
||||
anchors.fill: parent
|
||||
rootIndex: FileSystem.rootIndex
|
||||
leftMargin: 5
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
boundsMovement: Flickable.StopAtBounds
|
||||
clip: true
|
||||
rootIndex: FileSystem.rootIndex
|
||||
|
||||
Component.onCompleted: {
|
||||
FileSystem.setDirectory(root.rootDirectory)
|
||||
fileSystemTreeView.expandRecursively(0, -1)
|
||||
FileSystem.rootIndex = FileSystem.setDirectory(fileSystemTreeView.rootDirectory)
|
||||
}
|
||||
|
||||
// The delegate represents a single entry in the filesystem.
|
||||
delegate: TreeViewDelegate {
|
||||
id: treeDelegate
|
||||
indentation: 8
|
||||
indentation: 6
|
||||
implicitWidth: fileSystemTreeView.width > 0 ? fileSystemTreeView.width : 250
|
||||
implicitHeight: 25
|
||||
|
||||
@ -93,8 +88,29 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
id: iconOverlay
|
||||
|
||||
anchors.fill: directoryIcon
|
||||
source: directoryIcon
|
||||
colorization: 1.0
|
||||
brightness: 1.0
|
||||
colorizationColor: {
|
||||
const isFile = !treeDelegate.hasChildren;
|
||||
if (isFile)
|
||||
return Qt.lighter(RustColors.explorer_folder, 2)
|
||||
|
||||
const isExpandedFolder = treeDelegate.expanded && treeDelegate.hasChildren;
|
||||
if (isExpandedFolder)
|
||||
return Qt.darker(RustColors.explorer_folder, 2)
|
||||
else
|
||||
return RustColors.explorer_folder
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hoverHandler
|
||||
acceptedDevices: PointerDevice.Mouse
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
@ -129,7 +145,8 @@ Rectangle {
|
||||
Action {
|
||||
text: qsTr("Reset root index")
|
||||
onTriggered: {
|
||||
FileSystem.rootIndex = FileSystem.setDirectory(root.rootDirectory)
|
||||
console.log("Reset root index")
|
||||
FileSystem.rootIndex = FileSystem.setDirectory(fileSystemTreeView.rootDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,5 +171,4 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
5
resources.qrc
Normal file
5
resources.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file alias="kilroy.png">images/kilroy-256.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@ -88,10 +88,10 @@ impl Default for RustColorsImpl {
|
||||
gutter: QColor::try_from("#1e1f22").unwrap(),
|
||||
explorer_hovered: QColor::try_from("#4c5053").unwrap(),
|
||||
explorer_text: QColor::try_from("#3b3b3b").unwrap(),
|
||||
explorer_text_selected: QColor::try_from("#8b8b8b").unwrap(),
|
||||
explorer_background: QColor::try_from("#676c70").unwrap(),
|
||||
explorer_text_selected: QColor::try_from("#262626").unwrap(),
|
||||
explorer_background: QColor::try_from("#1E1F22").unwrap(),
|
||||
explorer_folder: QColor::try_from("#54585b").unwrap(),
|
||||
explorer_folder_open: QColor::try_from("#FFF").unwrap(),
|
||||
explorer_folder_open: QColor::try_from("#2b2b2b").unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user