Compare commits
No commits in common. "75889f202309179c6892af5d78844e99d5ae7da9" and "2340fd7652765d5844ee5bba1cb3e86e1cf6b708" have entirely different histories.
75889f2023
...
2340fd7652
@ -1,6 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
// TODO: Header
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls.Basic
|
import QtQuick.Controls.Basic
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
@ -16,14 +12,13 @@ Rectangle {
|
|||||||
|
|
||||||
signal fileClicked(string filePath)
|
signal fileClicked(string filePath)
|
||||||
|
|
||||||
// https://doc.qt.io/qt-6/qml-qtquick-treeview.html
|
|
||||||
TreeView {
|
TreeView {
|
||||||
id: fileSystemTreeView
|
id: fileSystemTreeView
|
||||||
anchors.margins: 15
|
anchors.margins: 15
|
||||||
|
|
||||||
property int lastIndex: -1
|
property int lastIndex: -1
|
||||||
|
|
||||||
model: FileSystemSortProxyModel
|
model: FileSystem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
boundsMovement: Flickable.StopAtBounds
|
boundsMovement: Flickable.StopAtBounds
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use crate::AppContext;
|
use crate::AppContext;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use cxx_qt_lib::{QMapPair, QMapPair_QString_QVariant, QString, QVariant};
|
use cxx_qt_lib::{QMapPair, QMapPair_QString_QVariant, QString, QVariant};
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
#[cxx_qt::bridge]
|
#[cxx_qt::bridge]
|
||||||
|
|
||||||
pub mod qobject {
|
pub mod qobject {
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!("cxx-qt-lib/qcolor.h");
|
include!("cxx-qt-lib/qcolor.h");
|
||||||
|
|||||||
@ -1,47 +1,17 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
use crate::gui::filesystem::qobject::{QAbstractItemModel};
|
|
||||||
use cxx_qt_lib::{QModelIndex, QString};
|
|
||||||
use dirs;
|
|
||||||
use log::warn;
|
|
||||||
use std::io::BufRead;
|
|
||||||
use std::{fs};
|
|
||||||
use syntect::easy::HighlightFile;
|
|
||||||
use syntect::highlighting::ThemeSet;
|
|
||||||
use syntect::html::{
|
|
||||||
IncludeBackground, append_highlighted_html_for_styled_line, start_highlighted_html_snippet,
|
|
||||||
};
|
|
||||||
use syntect::parsing::SyntaxSet;
|
|
||||||
|
|
||||||
#[cxx_qt::bridge]
|
#[cxx_qt::bridge]
|
||||||
pub mod qobject {
|
pub mod qobject {
|
||||||
// Import Qt Types from C++
|
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
|
// Import Qt Types from C++
|
||||||
include!("cxx-qt-lib/qstring.h");
|
include!("cxx-qt-lib/qstring.h");
|
||||||
type QString = cxx_qt_lib::QString;
|
type QString = cxx_qt_lib::QString;
|
||||||
|
|
||||||
include!("cxx-qt-lib/qmodelindex.h");
|
include!("cxx-qt-lib/qmodelindex.h");
|
||||||
type QModelIndex = cxx_qt_lib::QModelIndex;
|
type QModelIndex = cxx_qt_lib::QModelIndex;
|
||||||
|
|
||||||
include!(<QtGui/QFileSystemModel>);
|
include!(<QtGui/QFileSystemModel>);
|
||||||
type QFileSystemModel;
|
type QFileSystemModel;
|
||||||
|
|
||||||
include!(<QSortFilterProxyModel>);
|
|
||||||
type QSortFilterProxyModel;
|
|
||||||
|
|
||||||
include!(<QAbstractItemModel>);
|
|
||||||
type QAbstractItemModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export QML classes from Rust
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[qobject]
|
// Export QML Types from Rust
|
||||||
#[qml_element]
|
|
||||||
#[base = QSortFilterProxyModel]
|
|
||||||
#[qproperty(*mut FileSystem, inner)]
|
|
||||||
type FileSystemSortProxyModel = super::FileSystemSortProxyModelImpl;
|
|
||||||
|
|
||||||
#[qobject]
|
#[qobject]
|
||||||
#[base = QFileSystemModel]
|
#[base = QFileSystemModel]
|
||||||
#[qml_element]
|
#[qml_element]
|
||||||
@ -49,40 +19,6 @@ pub mod qobject {
|
|||||||
#[qproperty(QString, file_path, cxx_name = "filePath")]
|
#[qproperty(QString, file_path, cxx_name = "filePath")]
|
||||||
#[qproperty(QModelIndex, root_index, cxx_name = "rootIndex")]
|
#[qproperty(QModelIndex, root_index, cxx_name = "rootIndex")]
|
||||||
type FileSystem = super::FileSystemImpl;
|
type FileSystem = super::FileSystemImpl;
|
||||||
}
|
|
||||||
|
|
||||||
// Export QSortFilterProxyModel functions from Rust
|
|
||||||
// https://doc.qt.io/qt-6/qsortfilterproxymodel.html
|
|
||||||
unsafe extern "RustQt" {
|
|
||||||
#[inherit]
|
|
||||||
#[cxx_name = "setSourceModel"]
|
|
||||||
unsafe fn set_source_model(
|
|
||||||
self: Pin<&mut FileSystemSortProxyModel>,
|
|
||||||
source: *mut QAbstractItemModel,
|
|
||||||
);
|
|
||||||
|
|
||||||
#[cxx_override]
|
|
||||||
#[cxx_name = "filterAcceptsRow"]
|
|
||||||
const fn filter_accepts_row(
|
|
||||||
self: &FileSystemSortProxyModel,
|
|
||||||
source_row: i32,
|
|
||||||
source_parent: &QModelIndex,
|
|
||||||
) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom initialization logic.
|
|
||||||
impl cxx_qt::Initialize for FileSystemSortProxyModel {}
|
|
||||||
|
|
||||||
// Export QFileSystemModel functions from Rust
|
|
||||||
// https://doc.qt.io/qt-6/qfilesystemmodel.html
|
|
||||||
unsafe extern "RustQt" {
|
|
||||||
#[inherit]
|
|
||||||
fn index(
|
|
||||||
self: Pin<&mut FileSystem>,
|
|
||||||
row: i32,
|
|
||||||
col: i32,
|
|
||||||
parent: &QModelIndex,
|
|
||||||
) -> QModelIndex;
|
|
||||||
|
|
||||||
#[inherit]
|
#[inherit]
|
||||||
#[cxx_name = "setRootPath"]
|
#[cxx_name = "setRootPath"]
|
||||||
@ -103,35 +39,17 @@ pub mod qobject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct FileSystemSortProxyModelImpl {
|
use cxx_qt_lib::{QModelIndex, QString};
|
||||||
inner: *mut qobject::FileSystem,
|
use dirs;
|
||||||
}
|
use log::warn;
|
||||||
|
use std::fs;
|
||||||
impl Default for FileSystemSortProxyModelImpl {
|
use std::io::BufRead;
|
||||||
fn default() -> Self {
|
use syntect::easy::HighlightFile;
|
||||||
let model = Self {
|
use syntect::highlighting::ThemeSet;
|
||||||
inner: std::ptr::null_mut(),
|
use syntect::html::{
|
||||||
};
|
IncludeBackground, append_highlighted_html_for_styled_line, start_highlighted_html_snippet,
|
||||||
model
|
};
|
||||||
}
|
use syntect::parsing::SyntaxSet;
|
||||||
}
|
|
||||||
|
|
||||||
impl qobject::FileSystemSortProxyModel {
|
|
||||||
pub const fn filter_accepts_row(&self, _source_row: i32, _source_parent: &QModelIndex) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl cxx_qt::Initialize for qobject::FileSystemSortProxyModel {
|
|
||||||
fn initialize(self: core::pin::Pin<&mut Self>) {
|
|
||||||
let mut fs = FileSystemImpl::default();
|
|
||||||
unsafe {
|
|
||||||
let model: *mut FileSystemImpl = std::ptr::from_mut(&mut fs);
|
|
||||||
let m: *mut QAbstractItemModel = model as *mut QAbstractItemModel;
|
|
||||||
self.set_source_model(m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Impleent a provider for QFileSystemModel::setIconProvider for icons.
|
// TODO: Impleent a provider for QFileSystemModel::setIconProvider for icons.
|
||||||
pub struct FileSystemImpl {
|
pub struct FileSystemImpl {
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use anyhow::{Context, Result, anyhow};
|
use anyhow::{Context, Result, anyhow};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use log::{info, trace};
|
use log::{info, trace};
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
mod about;
|
mod about;
|
||||||
mod app;
|
mod app;
|
||||||
mod component;
|
mod component;
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use ratatui::buffer::Buffer;
|
use ratatui::buffer::Buffer;
|
||||||
use ratatui::layout::{Constraint, Direction, Layout, Rect};
|
use ratatui::layout::{Constraint, Direction, Layout, Rect};
|
||||||
use ratatui::text::{Line, Span};
|
use ratatui::text::{Line, Span};
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use crate::tui::about::About;
|
use crate::tui::about::About;
|
||||||
use crate::tui::app::AppComponent::{AppEditor, AppExplorer, AppLogger};
|
use crate::tui::app::AppComponent::{AppEditor, AppExplorer, AppLogger};
|
||||||
use crate::tui::component::{Action, Component, Focus, FocusState, Visibility, VisibleState};
|
use crate::tui::component::{Action, Component, Focus, FocusState, Visibility, VisibleState};
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
#![allow(dead_code, unused_variables)]
|
#![allow(dead_code, unused_variables)]
|
||||||
|
|
||||||
use crate::tui::component::Focus::Inactive;
|
use crate::tui::component::Focus::Inactive;
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
|
use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
|
||||||
use anyhow::{Context, Result, bail};
|
use anyhow::{Context, Result, bail};
|
||||||
use edtui::{
|
use edtui::{
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use crate::tui::component::{Action, Component, Focus, FocusState};
|
use crate::tui::component::{Action, Component, Focus, FocusState};
|
||||||
use crate::tui::editor::Editor;
|
use crate::tui::editor::Editor;
|
||||||
use anyhow::{Context, Result, anyhow};
|
use anyhow::{Context, Result, anyhow};
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
|
use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
|
||||||
use anyhow::{Context, Result, bail};
|
use anyhow::{Context, Result, bail};
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
|
use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
|
||||||
use log::{LevelFilter, trace};
|
use log::{LevelFilter, trace};
|
||||||
use ratatui::buffer::Buffer;
|
use ratatui::buffer::Buffer;
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GNU General Public License v3.0 or later
|
|
||||||
|
|
||||||
use crate::tui::component::{Action, Component, ComponentState, FocusState};
|
use crate::tui::component::{Action, Component, ComponentState, FocusState};
|
||||||
use crate::tui::menu_bar::MenuBarItemOption::{
|
use crate::tui::menu_bar::MenuBarItemOption::{
|
||||||
About, CloseTab, Exit, Reload, Save, ShowHideExplorer, ShowHideLogger,
|
About, CloseTab, Exit, Reload, Save, ShowHideExplorer, ShowHideLogger,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user