From c99154e029b07dc0b51483d1e76e096818a72dfc Mon Sep 17 00:00:00 2001 From: Philippe Date: Thu, 19 Nov 2026 14:02:32 +0100 Subject: [PATCH 1/4] Flatpak in the release; .orp and .oiv open with a double-click (#132) The Release workflow packs the Linux build as a Flatpak bundle (io.github.Two_Play.OpenRAGE, runtime org.freedesktop.Platform 26.08) without compiling again. A MIME definition for .orp and .oiv and the desktop entry's MimeType let file managers open them with OpenRAGE, which shows the install dialog. Co-authored-by: Claude Opus 5.5 --- .github/workflows/release.yml | 37 ++++++++++-- README.md | 2 +- crates/openrage-gui/src/main.rs | 6 +- packaging/flatpak/build.sh | 58 +++++++++++++++++++ .../io.github.Two_Play.OpenRAGE.metainfo.xml | 42 ++++++++++++++ packaging/openrage-mime.xml | 15 +++++ packaging/openrage.desktop | 1 + site/content/getting-started.md | 9 +++ 8 files changed, 163 insertions(+), 7 deletions(-) create mode 100755 packaging/flatpak/build.sh create mode 100644 packaging/flatpak/io.github.Two_Play.OpenRAGE.metainfo.xml create mode 100644 packaging/openrage-mime.xml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b07e67f..722a990 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Release -# Pushing a tag such as v0.2.0 builds OpenRAGE for Linux (.tar.gz and -# AppImage) and Windows (.zip) and publishes a GitHub release with them and +# Pushing a tag such as v0.2.0 builds OpenRAGE for Linux (.tar.gz, AppImage +# and Flatpak) and Windows (.zip) and publishes a GitHub release with them and # their SHA-256 checksums. # "Run workflow" (manual) builds the same archives without publishing, to # try a release first. Tests are not repeated here: CI runs them on every @@ -77,7 +77,7 @@ jobs: 7z a -tzip "out/$dir.zip" "$dir" > /dev/null else cp target/release/openrage target/release/openrage-gui "$dir/" - cp packaging/openrage.desktop packaging/openrage.png "$dir/" + cp packaging/openrage.desktop packaging/openrage.png packaging/openrage-mime.xml "$dir/" tar czf "out/$dir.tar.gz" "$dir" fi - name: AppImage @@ -114,8 +114,37 @@ jobs: path: out/* if-no-files-found: error - publish: + # The Flatpak, from the Linux archive built above (nothing is compiled again). + flatpak: needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions/download-artifact@v4 + with: + name: linux-x86_64 + path: linux + - name: Install Flatpak and the runtime + run: | + sudo apt-get update + sudo apt-get install -y flatpak + flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + flatpak install --user -y --noninteractive flathub org.freedesktop.Platform//26.08 + - name: Build the Flatpak + run: | + ref="${GITHUB_REF_NAME//\//-}" + version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2) + mkdir -p unpacked out + tar xzf "linux/openrage-${ref}-linux-x86_64.tar.gz" -C unpacked + packaging/flatpak/build.sh "unpacked/openrage-${ref}-linux-x86_64" "$version" "out/openrage-${ref}-x86_64.flatpak" + - uses: actions/upload-artifact@v4 + with: + name: flatpak + path: out/*.flatpak + if-no-files-found: error + + publish: + needs: [build, flatpak] if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index f37c045..1e550ee 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ More screenshots and all features: **[two-play.github.io/openrage](https://two-p ## Installation -Download the [latest release](https://github.com/Two-Play/openrage/releases/latest) for Linux (AppImage or `.tar.gz`) or Windows (`.zip`) and start `openrage-gui`. On first start it finds your game and sets up the keys. Step by step: **[Getting started](https://two-play.github.io/openrage/getting-started/)**. +Download the [latest release](https://github.com/Two-Play/openrage/releases/latest) for Linux (AppImage, Flatpak or `.tar.gz`) or Windows (`.zip`) and start `openrage-gui`. On first start it finds your game and sets up the keys. Step by step: **[Getting started](https://two-play.github.io/openrage/getting-started/)**. To build from source (Rust, pinned in `rust-toolchain.toml`; on Linux also the fontconfig, xkbcommon, Wayland and ALSA development packages): diff --git a/crates/openrage-gui/src/main.rs b/crates/openrage-gui/src/main.rs index 14f1b29..bd282ad 100644 --- a/crates/openrage-gui/src/main.rs +++ b/crates/openrage-gui/src/main.rs @@ -147,8 +147,10 @@ fn main() -> anyhow::Result<()> { let ui = AppWindow::new()?; // Wayland shows a window's icon only through its app id and the desktop // entry of the same name (`openrage.desktop`, icon `openrage`); X11 uses - // it as WM_CLASS. Must be set before the first window is shown. - if let Err(e) = slint::set_xdg_app_id("openrage") { + // it as WM_CLASS. Must be set before the first window is shown. In the + // Flatpak the desktop entry is named after the Flatpak's id. + let app_id = std::env::var("FLATPAK_ID").unwrap_or_else(|_| "openrage".to_owned()); + if let Err(e) = slint::set_xdg_app_id(&app_id) { eprintln!("app id: {e}"); } let cfg = Config::load(); diff --git a/packaging/flatpak/build.sh b/packaging/flatpak/build.sh new file mode 100755 index 0000000..c6c6a1c --- /dev/null +++ b/packaging/flatpak/build.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Builds the OpenRAGE Flatpak bundle from already built programs, without +# compiling anything again: +# +# packaging/flatpak/build.sh +# +# holds `openrage`, `openrage-gui` and `plugins/` (the unpacked Linux +# release archive). Needs `flatpak` and the runtime org.freedesktop.Platform +# of $RUNTIME_VERSION (e.g. `flatpak install --user flathub +# org.freedesktop.Platform//26.08`). +# +# Install the result with `flatpak install --user openrage-….flatpak`; the +# command line runs as `flatpak run --command=openrage io.github.Two_Play.OpenRAGE`. +set -eu +src=$1 version=$2 out=$3 +ID=io.github.Two_Play.OpenRAGE +RUNTIME_VERSION=${RUNTIME_VERSION:-26.08} +here=$(cd "$(dirname "$0")" && pwd) +packaging=$(dirname "$here") +root=$(dirname "$packaging") +work=$(mktemp -d) +trap 'rm -rf "$work"' EXIT +build=$work/build repo=$work/repo + +# Nothing is compiled, so the runtime also serves as the SDK. +flatpak build-init "$build" "$ID" org.freedesktop.Platform org.freedesktop.Platform "$RUNTIME_VERSION" +files=$build/files +install -Dm755 "$src/openrage" "$files/bin/openrage" +install -Dm755 "$src/openrage-gui" "$files/bin/openrage-gui" +# The example plugins next to the programs, where OpenRAGE looks for them. +cp -r "$src/plugins" "$files/bin/plugins" +sed -e "s/^Icon=.*/Icon=$ID/" -e "s/^StartupWMClass=.*/StartupWMClass=$ID/" \ + "$packaging/openrage.desktop" > "$work/$ID.desktop" +install -Dm644 "$work/$ID.desktop" "$files/share/applications/$ID.desktop" +install -Dm644 "$packaging/openrage.png" "$files/share/icons/hicolor/256x256/apps/$ID.png" +install -Dm644 "$packaging/openrage-mime.xml" "$files/share/mime/packages/$ID.xml" +sed -e "s/{VERSION}/$version/" -e "s/{DATE}/$(date -u +%F)/" \ + "$here/$ID.metainfo.xml" > "$work/$ID.metainfo.xml" +install -Dm644 "$work/$ID.metainfo.xml" "$files/share/metainfo/$ID.metainfo.xml" +for f in README.md LICENSE NOTICE.md THIRD_PARTY_LICENSES.md; do + install -Dm644 "$root/$f" "$files/share/doc/openrage/$f" +done +install -Dm644 "$root/crates/rage-tfit2/LICENSE" "$files/share/doc/openrage/LICENSE-AGPL-3.0" + +# Games live anywhere (Steam libraries on other drives, Flatpak Steam, +# Heroic, Lutris), mods go next to them and the Proton fix edits the game's +# prefix: OpenRAGE needs the whole file system, like OpenIV on Windows. +flatpak build-finish "$build" \ + --command=openrage-gui \ + --share=ipc \ + --socket=wayland \ + --socket=fallback-x11 \ + --socket=pulseaudio \ + --device=dri \ + --filesystem=host +flatpak build-export "$repo" "$build" stable +flatpak build-bundle "$repo" "$out" "$ID" stable \ + --runtime-repo=https://dl.flathub.org/repo/flathub.flatpakrepo diff --git a/packaging/flatpak/io.github.Two_Play.OpenRAGE.metainfo.xml b/packaging/flatpak/io.github.Two_Play.OpenRAGE.metainfo.xml new file mode 100644 index 0000000..4228ac3 --- /dev/null +++ b/packaging/flatpak/io.github.Two_Play.OpenRAGE.metainfo.xml @@ -0,0 +1,42 @@ + + + io.github.Two_Play.OpenRAGE + OpenRAGE + Explore and mod GTA V, GTA IV and Red Dead Redemption 2 + CC0-1.0 + GPL-3.0-only AND AGPL-3.0-only + + Two-Play + + +

+ OpenRAGE is an open-source successor to OpenIV. It browses and searches every archive of the game, previews + textures, models, sounds and animations, reads metadata as XML, edits game text and installs .oiv packages, + compatible with OpenIV's mods folder and with undo. +

+

+ OpenRAGE contains no game files and no encryption keys: keys are taken from your own copy of the game. + It is not affiliated with or endorsed by Rockstar Games or Take-Two Interactive. +

+
+ io.github.Two_Play.OpenRAGE.desktop + https://two-play.github.io/openrage/ + https://github.com/Two-Play/openrage/issues + https://github.com/Two-Play/openrage + + + https://raw.githubusercontent.com/Two-Play/openrage/main/docs/images/overview-dark.png + The explorer with a 3D preview of a car + + + + + openrage + openrage-gui + application/x-openrage-plugin + application/x-openiv-package + + + + +
diff --git a/packaging/openrage-mime.xml b/packaging/openrage-mime.xml new file mode 100644 index 0000000..045e8bb --- /dev/null +++ b/packaging/openrage-mime.xml @@ -0,0 +1,15 @@ + + + + + OpenRAGE plugin + + + + + OpenIV package + + + + diff --git a/packaging/openrage.desktop b/packaging/openrage.desktop index 7fc5ec0..d69855a 100644 --- a/packaging/openrage.desktop +++ b/packaging/openrage.desktop @@ -8,4 +8,5 @@ Icon=openrage Terminal=false Categories=Development; Keywords=GTA;RDR2;OpenIV;mod;rpf; +MimeType=application/x-openrage-plugin;application/x-openiv-package; StartupWMClass=openrage diff --git a/site/content/getting-started.md b/site/content/getting-started.md index 5240d16..dc7d76d 100644 --- a/site/content/getting-started.md +++ b/site/content/getting-started.md @@ -23,6 +23,15 @@ Ready-made builds for **Linux** (x86-64, glibc 2.35 or newer) and **Windows** (x Unpack the archive and start the GUI, or `openrage` for the command line. The archive also holds `openrage.desktop` and `openrage.png` for a menu entry. Newer releases also come as an **AppImage**: make it executable and start it. +From 0.5 there is also a **Flatpak** (`openrage-*-x86_64.flatpak`). It installs a menu entry, and OpenRAGE plugins +(`.orp`) and OpenIV packages (`.oiv`) then open in OpenRAGE with a double-click. It keeps its settings apart from the +other downloads, in `~/.var/app/io.github.Two_Play.OpenRAGE`. The command line runs with +`flatpak run --command=openrage io.github.Two_Play.OpenRAGE`. + +``` +flatpak install --user openrage-*-x86_64.flatpak +``` + ``` tar -xzf openrage-*-linux-x86_64.tar.gz cd openrage-*-linux-x86_64 From 5b40608967b3e41f42d8ff6f92320241d761e7d9 Mon Sep 17 00:00:00 2001 From: Philippe Date: Thu, 19 Nov 2026 14:02:36 +0100 Subject: [PATCH 2/4] Empty archives say so instead of an I/O error (#133) RDR2 ships common.rpf as a 0-byte placeholder (its data is in common_0.rpf); opening it failed with "failed to fill whole buffer". Co-authored-by: Claude Opus 5.5 --- crates/rage-rpf/src/error.rs | 2 ++ crates/rage-rpf/src/rpf7.rs | 4 ++++ crates/rage-rpf/tests/synthetic.rs | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/crates/rage-rpf/src/error.rs b/crates/rage-rpf/src/error.rs index 3c7acf9..7c94b4e 100644 --- a/crates/rage-rpf/src/error.rs +++ b/crates/rage-rpf/src/error.rs @@ -5,6 +5,8 @@ use std::path::PathBuf; pub enum RpfError { #[error("I/O error: {0}")] Io(#[from] std::io::Error), + #[error("{0}: empty file ({1} bytes), not an archive")] + Empty(String, u64), #[error("{0}: not an RPF7 archive (magic {1:#010x})")] BadMagic(String, u32), #[error("{0}: archive is encrypted but no keys are loaded (run `openrage keys` first)")] diff --git a/crates/rage-rpf/src/rpf7.rs b/crates/rage-rpf/src/rpf7.rs index a5f9697..4dc93e5 100644 --- a/crates/rage-rpf/src/rpf7.rs +++ b/crates/rage-rpf/src/rpf7.rs @@ -166,6 +166,10 @@ impl Rpf7 { ) -> Result { let corrupt = |reason: &str| RpfError::CorruptToc { archive: display_path.clone(), reason: reason.into() }; + // Some games ship empty placeholders (RDR2's `common.rpf` is 0 bytes). + if size < 16 { + return Err(RpfError::Empty(display_path, size)); + } let mut header = [0u8; 16]; read_exact_at(&file, &mut header, base)?; let magic = u32_le(&header, 0); diff --git a/crates/rage-rpf/tests/synthetic.rs b/crates/rage-rpf/tests/synthetic.rs index d37b436..aa3e64f 100644 --- a/crates/rage-rpf/tests/synthetic.rs +++ b/crates/rage-rpf/tests/synthetic.rs @@ -176,6 +176,18 @@ fn rejects_corrupt_tables() { assert!(matches!(Rpf7::open(&path, None), Err(RpfError::BadMagic(..)))); } +#[test] +fn empty_archives_say_so() { + // RDR2 ships `common.rpf` as an empty placeholder. + let dir = std::env::temp_dir().join(format!("rage-rpf-empty-{}", std::process::id())); + std::fs::create_dir_all(&dir).unwrap(); + std::fs::write(dir.join("common.rpf"), b"").unwrap(); + let err = vfs::resolve(&dir, "common.rpf", None).err().expect("an error"); + assert!(matches!(err, RpfError::Empty(_, 0)), "{err:?}"); + assert!(err.to_string().contains("empty file (0 bytes)"), "{err}"); + std::fs::remove_dir_all(&dir).unwrap(); +} + #[test] fn entry_kinds_are_detected() { let path = write_temp("kinds", &sample_archive()); From 7e2d123f9d69d93471845615c092ffd62ae0e8b8 Mon Sep 17 00:00:00 2001 From: Philippe Date: Thu, 19 Nov 2026 14:03:01 +0100 Subject: [PATCH 3/4] Icon views, text size, folded search and filter, settings in tabs (#134) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Icon views, text size, folded search and filter, settings in tabs - The file list shows files as a list, as icons or as large icons (buttons above the list, View menu, Ctrl+1/2/3, saved as file_view); arrow keys move through the grid. - View → Text size scales text, list rows and icons in every window (saved as text_size). - Search and filter fold into buttons until used (Ctrl+F, Ctrl+Shift+F), Esc folds them again. - Settings are split into Appearance, Game, Behaviour and Plugins tabs; Tools → Plugins… opens the last one. The Install button of plugins sits at the top of the list. - The .orp install dialog was lost in #123 (only its buttons were left, at the bottom of Settings): restored. Co-Authored-By: Claude Opus 5.5 * Icon view: names take at most two lines, size right below Long names wrapped into more lines pushed the size into the next tile. Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- crates/openrage-app/src/config.rs | 12 + crates/openrage-gui/src/accent.rs | 16 +- crates/openrage-gui/src/callbacks.rs | 35 + crates/openrage-gui/src/debug.rs | 10 +- crates/openrage-gui/src/main.rs | 2 + crates/openrage-gui/ui/app.slint | 896 ++++++++++++------ crates/openrage-gui/ui/icons/filter.svg | 1 + .../openrage-gui/ui/icons/menu/view-grid.svg | 1 + .../openrage-gui/ui/icons/menu/view-large.svg | 1 + .../openrage-gui/ui/icons/menu/view-list.svg | 1 + crates/openrage-gui/ui/icons/view-grid.svg | 1 + crates/openrage-gui/ui/icons/view-large.svg | 1 + crates/openrage-gui/ui/icons/view-list.svg | 1 + crates/openrage-gui/ui/theme.slint | 17 +- site/content/guide.md | 24 +- 15 files changed, 719 insertions(+), 300 deletions(-) create mode 100644 crates/openrage-gui/ui/icons/filter.svg create mode 100644 crates/openrage-gui/ui/icons/menu/view-grid.svg create mode 100644 crates/openrage-gui/ui/icons/menu/view-large.svg create mode 100644 crates/openrage-gui/ui/icons/menu/view-list.svg create mode 100644 crates/openrage-gui/ui/icons/view-grid.svg create mode 100644 crates/openrage-gui/ui/icons/view-large.svg create mode 100644 crates/openrage-gui/ui/icons/view-list.svg diff --git a/crates/openrage-app/src/config.rs b/crates/openrage-app/src/config.rs index b03e423..1bc7f26 100644 --- a/crates/openrage-app/src/config.rs +++ b/crates/openrage-app/src/config.rs @@ -22,6 +22,10 @@ pub struct Config { pub accent: Option, /// Show the change history in its own window (default) instead of the file list. pub history_window: Option, + /// GUI text size in percent (100 = normal). + pub text_size: Option, + /// GUI file list view: `list`, `icons` or `large-icons`. + pub file_view: Option, /// Enabled plugins with the permissions the user granted them: /// `(id, "perm+perm")` (see `crate::plugins`). pub plugins: Vec<(String, String)>, @@ -60,6 +64,8 @@ impl Config { "theme" => cfg.theme = Some(v.to_owned()), "accent" => cfg.accent = Some(v.to_owned()), "history_window" => cfg.history_window = Some(v == "true"), + "text_size" => cfg.text_size = v.parse().ok(), + "file_view" => cfg.file_view = Some(v.to_owned()), "write_in_game" => cfg.write_in_game.push(PathBuf::from(v)), "asi_hint_off" => cfg.asi_hint_off.push(PathBuf::from(v)), "plugin" => { @@ -102,6 +108,12 @@ impl Config { if let Some(h) = self.history_window { text.push_str(&format!("history_window={h}\n")); } + if let Some(t) = self.text_size { + text.push_str(&format!("text_size={t}\n")); + } + if let Some(v) = &self.file_view { + text.push_str(&format!("file_view={v}\n")); + } for g in &self.write_in_game { text.push_str(&format!("write_in_game={}\n", g.display())); } diff --git a/crates/openrage-gui/src/accent.rs b/crates/openrage-gui/src/accent.rs index 603ed7e..1f985b0 100644 --- a/crates/openrage-gui/src/accent.rs +++ b/crates/openrage-gui/src/accent.rs @@ -1,6 +1,7 @@ //! The accent color (View → Accent color): the widget style's, OpenRAGE //! orange (the logo's) or one of the user's choice. Every window gets it when //! it opens and when it changes; it is saved in the settings as `accent`. +//! The text size (View → Text size) travels the same way. use std::cell::Cell; @@ -10,9 +11,21 @@ use crate::Theme; thread_local! { static CURRENT: Cell<(i32, Color)> = const { Cell::new((0, Color::from_rgb_u8(0xc2, 0x41, 0x0c))) }; + /// The text size (View → Text size), 1.0 = normal; saved as `text_size`. + static TEXT_SCALE: Cell = const { Cell::new(1.0) }; } -/// Applies the current accent to a window. +/// Sets the text size (applying it is up to the caller, like the accent). +pub fn set_text_scale(scale: f32) { + TEXT_SCALE.with(|c| c.set(scale.clamp(0.75, 1.6))); +} + +/// The text size setting in percent. +pub fn text_size_setting() -> u32 { + (TEXT_SCALE.with(Cell::get) * 100.0).round() as u32 +} + +/// Applies the current accent and text size to a window. pub fn apply(win: &T) where T: ComponentHandle, @@ -22,6 +35,7 @@ where let theme = win.global::(); theme.set_accent_custom(color); theme.set_accent_mode(mode); + theme.set_text_scale(TEXT_SCALE.with(Cell::get)); } /// Sets the current accent (applying it is up to the caller). diff --git a/crates/openrage-gui/src/callbacks.rs b/crates/openrage-gui/src/callbacks.rs index aabde58..681a7db 100644 --- a/crates/openrage-gui/src/callbacks.rs +++ b/crates/openrage-gui/src/callbacks.rs @@ -472,6 +472,24 @@ fn wire_settings(ui: &AppWindow) { xmlview::set_accent(); history::set_accent(); }); + let w = ui.as_weak(); + ui.on_text_scale_chosen(move |scale| { + accent::set_text_scale(scale); + with_app(|a| a.cfg.text_size = Some(accent::text_size_setting())); + if let Some(ui) = w.upgrade() { + save_settings(&ui); + accent::apply(&ui); + } + viewer::set_accent(); + editor::set_accent(); + xmlview::set_accent(); + history::set_accent(); + }); + let w = ui.as_weak(); + ui.on_view_mode_changed(move |mode| { + with_app(|a| a.cfg.file_view = Some(view_name(mode).to_owned())); + with_ui(&w, save_settings); + }); ui.on_color_hex(accent::hex_string); ui.on_parse_hex(|s| accent::parse_hex(&s).unwrap_or(slint::Color::from_argb_u8(0, 0, 0, 0))); let w = ui.as_weak(); @@ -679,6 +697,23 @@ pub(crate) fn theme_name(mode: i32) -> &'static str { } } +/// The file list view of the setting `file_view`: 0 list, 1 icons, 2 large icons. +pub(crate) fn view_mode(name: Option<&str>) -> i32 { + match name { + Some("icons") => 1, + Some("large-icons") => 2, + _ => 0, + } +} + +fn view_name(mode: i32) -> &'static str { + match mode { + 1 => "icons", + 2 => "large-icons", + _ => "list", + } +} + pub(crate) fn theme_mode(name: Option<&str>) -> i32 { match name { Some("light") => 1, diff --git a/crates/openrage-gui/src/debug.rs b/crates/openrage-gui/src/debug.rs index f6c9d26..3e1e47d 100644 --- a/crates/openrage-gui/src/debug.rs +++ b/crates/openrage-gui/src/debug.rs @@ -32,9 +32,15 @@ pub(crate) fn debug_snapshot(ui: &AppWindow) { if std::env::var("OPENRAGE_CONFIRM_PLUGIN").is_ok() && ui.get_plugin_pkg_visible() { ui.invoke_plugin_pkg_confirm(); } + // `OPENRAGE_FIELD=search|filter`: unfold that field. + match std::env::var("OPENRAGE_FIELD").as_deref() { + Ok("search") => ui.invoke_open_search(), + Ok("filter") => ui.invoke_open_filter(), + _ => {} + } if let Ok(page) = std::env::var("OPENRAGE_SETTINGS") { - ui.set_settings_scroll_end(page == "plugins"); - ui.invoke_open_settings(); + let tab = ["appearance", "game", "behaviour", "plugins"].iter().position(|t| *t == page).unwrap_or(0); + ui.invoke_open_settings_at(tab as i32); } // `OPENRAGE_ABOUT=` opens the About dialog on that tab (0–2). if let Ok(tab) = std::env::var("OPENRAGE_ABOUT") { diff --git a/crates/openrage-gui/src/main.rs b/crates/openrage-gui/src/main.rs index bd282ad..ea78a64 100644 --- a/crates/openrage-gui/src/main.rs +++ b/crates/openrage-gui/src/main.rs @@ -214,7 +214,9 @@ fn main() -> anyhow::Result<()> { ui.set_theme_mode(with_app(|a| theme_mode(a.cfg.theme.as_deref()))); let (mode, color) = with_app(|a| accent::from_setting(a.cfg.accent.as_deref())); accent::set(mode, color); + accent::set_text_scale(with_app(|a| a.cfg.text_size.unwrap_or(100)) as f32 / 100.0); accent::apply(&ui); + ui.set_view_mode(with_app(|a| view_mode(a.cfg.file_view.as_deref()))); ui.set_history_in_window(with_app(|a| a.cfg.history_window.unwrap_or(true))); let languages: Vec = std::iter::once("All languages".into()).chain(LANGUAGES.iter().map(|l| capitalize(l).into())).collect(); diff --git a/crates/openrage-gui/ui/app.slint b/crates/openrage-gui/ui/app.slint index 42e7c04..17b060d 100644 --- a/crates/openrage-gui/ui/app.slint +++ b/crates/openrage-gui/ui/app.slint @@ -375,11 +375,15 @@ component FileItem inherits Rectangle { in property texture-mode; in property history-mode; in property can-edit; + // Icon view: the size of the icon (0: a row of the list). + in property tile-icon: 0px; callback select(); callback open(); callback action(string); height: Theme.row-height; opacity: item.dim ? 0.55 : 1.0; + border-radius: root.tile-icon > 0px ? Theme.radius : 0px; + clip: root.tile-icon > 0px; property fg: selected && focused ? Theme.selection-text : Theme.text; background: selected ? (focused ? Theme.selection : Theme.accent-subtle) : area.has-hover ? Theme.hover : odd ? Theme.stripe : transparent; accessible-role: list-item; @@ -396,7 +400,48 @@ component FileItem inherits Rectangle { width: 3px; background: Theme.mark-color(item.mark); } - HorizontalLayout { + if root.tile-icon > 0px: VerticalLayout { + padding: Theme.space-xs; + spacing: Theme.space-xs; + alignment: start; + HorizontalLayout { + alignment: center; + FormatIcon { + width: root.tile-icon; + height: root.tile-icon; + name: item.icon; + tint: selected && focused ? Theme.selection-text : item.tint; + container: item.can-open && item.icon != "folder" && item.icon != "archive"; + Tooltip { + text: @markdown("\{item.name + " · " + item.kind}"); + } + } + } + // At most two lines, so long names never push the size into the next tile. + Rectangle { + height: min(name.preferred-height, Theme.font-body * 2.8); + clip: true; + name := Text { + y: 0; + width: 100%; + text: item.name; + horizontal-alignment: center; + vertical-alignment: top; + wrap: char-wrap; + overflow: elide; + color: root.fg; + } + } + Text { + height: Theme.font-small * 1.5; + text: item.size != "" ? item.size : item.kind; + horizontal-alignment: center; + font-size: Theme.font-small; + overflow: elide; + color: selected && focused ? Theme.selection-text : Theme.text-muted; + } + } + if root.tile-icon == 0px: HorizontalLayout { padding-left: Theme.space-s; padding-right: Theme.space-s; spacing: Theme.space-s; @@ -1157,7 +1202,25 @@ export component AppWindow inherits Window { callback asi-hint-fix(); callback asi-hint-dismiss(); in property plugin-folder; - in property settings-scroll-end; + // Settings tab: 0 appearance, 1 game, 2 behaviour, 3 plugins. + in-out property settings-tab; + // File list view (View menu, saved as `file_view`): 0 list, 1 icons, 2 large icons. + in-out property view-mode; + callback view-mode-changed(int); + // Text size (View → Text size, saved as `text_size`). + callback text-scale-chosen(float); + // Search and filter fields, folded into a button until used. + in-out property search-open; + in-out property search-text; + property search-focus-tick; + in-out property filter-open; + property filter-focus-tick; + // Icon view: tile and icon size, and how many tiles fit in a line. + property tile-icon: round((root.view-mode == 2 ? 72px : 40px) * Theme.text-scale / 1px) * 1px; + property tile-width: round((root.view-mode == 2 ? 136px : 100px) * Theme.text-scale / 1px) * 1px; + property tile-height: root.tile-icon + Theme.font-body * 2.8 + Theme.font-small * 1.5 + 6 * Theme.space-xs; + property per-line: root.view-mode == 0 ? 1 : max(1, floor((list-box.width - 16px) / root.tile-width)); + property line-height: root.view-mode == 0 ? Theme.row-height : root.tile-height; callback plugin-toggled(string, bool); callback open-plugin-folder(); callback reload-plugins(); @@ -1224,6 +1287,11 @@ export component AppWindow inherits Window { root.settings-visible = true; } + public function open-settings-at(tab: int) { + root.settings-tab = tab; + root.open-settings(); + } + function set-theme(mode: int) { root.theme-mode = mode; root.theme-changed(mode); @@ -1239,6 +1307,10 @@ export component AppWindow inherits Window { if (i < 0) { return; } + if (root.view-mode != 0) { + root.reveal-tile(i); + return; + } // One row of context stays visible above and below the selection. if (max(0, i - 1) * Theme.row-height < -list.content-y) { list.content-y = -max(0, i - 1) * Theme.row-height; @@ -1247,6 +1319,33 @@ export component AppWindow inherits Window { } } + // The same for the icon view: scrolls to the line of tile `i`. + function reveal-tile(i: int) { + let line = floor(i / root.per-line); + let lines = ceil(root.files.length / root.per-line); + if (line * root.tile-height < -grid.content-y) { + grid.content-y = -line * root.tile-height; + } else if ((line + 1) * root.tile-height > grid.visible-height - grid.content-y) { + grid.content-y = min(0, grid.visible-height - min(line + 1, lines) * root.tile-height); + } + } + + function set-view(mode: int) { + root.view-mode = mode; + root.view-mode-changed(mode); + root.reveal-row(root.file-selected); + } + + public function open-search() { + root.search-open = true; + root.search-focus-tick += 1; + } + + public function open-filter() { + root.filter-open = true; + root.filter-focus-tick += 1; + } + // Selections made by the app (opening a path, Back, sorting, …) are kept in view too. changed file-selected => { root.reveal-row(root.file-selected); @@ -1420,6 +1519,44 @@ export component AppWindow inherits Window { activated => { root.show-history(); } } MenuSeparator { } + MenuItem { + title: (root.view-mode == 0 ? "✓ " : "") + @tr("List"); + icon: @image-url("icons/menu/view-list.svg"); + shortcut: @keys(Control + "1"); + activated => { root.set-view(0); } + } + MenuItem { + title: (root.view-mode == 1 ? "✓ " : "") + @tr("Icons"); + icon: @image-url("icons/menu/view-grid.svg"); + shortcut: @keys(Control + "2"); + activated => { root.set-view(1); } + } + MenuItem { + title: (root.view-mode == 2 ? "✓ " : "") + @tr("Large icons"); + icon: @image-url("icons/menu/view-large.svg"); + shortcut: @keys(Control + "3"); + activated => { root.set-view(2); } + } + Menu { + title: @tr("Text size"); + MenuItem { + title: (Theme.text-scale < 0.95 ? "✓ " : "") + @tr("Small"); + activated => { root.text-scale-chosen(0.9); } + } + MenuItem { + title: (Theme.text-scale >= 0.95 && Theme.text-scale < 1.05 ? "✓ " : "") + @tr("Normal"); + activated => { root.text-scale-chosen(1.0); } + } + MenuItem { + title: (Theme.text-scale >= 1.05 && Theme.text-scale < 1.2 ? "✓ " : "") + @tr("Large"); + activated => { root.text-scale-chosen(1.15); } + } + MenuItem { + title: (Theme.text-scale >= 1.2 ? "✓ " : "") + @tr("Larger"); + activated => { root.text-scale-chosen(1.3); } + } + } + MenuSeparator { } Menu { title: @tr("Theme"); MenuItem { @@ -1470,13 +1607,13 @@ export component AppWindow inherits Window { title: @tr("Search"); icon: @image-url("icons/menu/search.svg"); shortcut: @keys(Control + F); - activated => { search-edit.focus(); } + activated => { root.open-search(); } } MenuItem { title: @tr("Filter list"); icon: @image-url("icons/menu/search.svg"); shortcut: @keys(Control + Shift + F); - activated => { filter-edit.focus(); } + activated => { root.open-filter(); } } } Menu { @@ -1497,13 +1634,19 @@ export component AppWindow inherits Window { Menu { title: @tr("Tools"); if root.plugin-tools.length == 0: MenuItem { - title: @tr("No plugin tools (Settings → Plugins)"); + title: @tr("No plugin tools"); enabled: false; } for t[i] in root.plugin-tools: MenuItem { title: t.title; activated => { root.open-tool(i); } } + MenuSeparator { } + MenuItem { + title: @tr("Plugins…"); + icon: @image-url("icons/menu/package.svg"); + activated => { root.open-settings-at(3); } + } } Menu { title: @tr("Help"); @@ -1631,21 +1774,38 @@ export component AppWindow inherits Window { } } } - Rectangle { - width: 16px; - Image { - width: 16px; - height: 16px; - source: @image-url("icons/search.svg"); - colorize: Theme.text-muted; - accessible-role: none; - } + if !root.search-open: IconButton { + y: (parent.height - self.height) / 2; + icon: @image-url("icons/search.svg"); + label: @tr("Search names, hashes, text… (Ctrl+F)"); + clicked => { root.open-search(); } } - search-edit := LineEdit { + if root.search-open: Rectangle { width: 280px; - placeholder-text: @tr("Search names, hashes, text… (Ctrl+F)"); - accessible-label: @tr("Search"); - accepted(text) => { root.search(text); } + min-height: 32px; + FocusScope { + KeyBinding { + keys: @keys(Escape); + activated => { root.search-open = false; } + } + search-edit := LineEdit { + width: parent.width; + height: parent.height; + text <=> root.search-text; + placeholder-text: @tr("Search names, hashes, text…"); + accessible-label: @tr("Search"); + accepted(text) => { root.search(text); } + property tick: root.search-focus-tick; + changed tick => { self.focus(); } + init => { self.focus(); } + // Folds back into the button when left empty. + changed has-focus => { + if (!self.has-focus && self.text == "") { + root.search-open = false; + } + } + } + } } VSeparator { } if root.mods-available: Button { @@ -1818,12 +1978,68 @@ export component AppWindow inherits Window { color: Theme.text-muted; } } - filter-edit := LineEdit { - width: 200px; - text <=> root.filter; - placeholder-text: @tr("Filter this list"); - accessible-label: @tr("Filter this list"); - edited(text) => { root.filter-edited(text); } + if !root.filter-open && root.filter == "": IconButton { + y: (parent.height - self.height) / 2; + icon: @image-url("icons/filter.svg"); + label: @tr("Filter this list (Ctrl+Shift+F)"); + clicked => { root.open-filter(); } + } + if root.filter-open || root.filter != "": Rectangle { + width: 220px; + min-height: 32px; + FocusScope { + KeyBinding { + keys: @keys(Escape); + activated => { + root.filter = ""; + root.filter-edited(""); + root.filter-open = false; + } + } + filter-edit := LineEdit { + width: parent.width; + height: parent.height; + text <=> root.filter; + placeholder-text: @tr("Filter this list"); + accessible-label: @tr("Filter this list"); + edited(text) => { root.filter-edited(text); } + property tick: root.filter-focus-tick; + changed tick => { self.focus(); } + init => { + if (root.filter-open) { + self.focus(); + } + } + changed has-focus => { + if (!self.has-focus && self.text == "") { + root.filter-open = false; + } + } + } + } + } + HorizontalLayout { + IconButton { + y: (parent.height - self.height) / 2; + icon: @image-url("icons/view-list.svg"); + label: @tr("List (Ctrl+1)"); + active: root.view-mode == 0; + clicked => { root.set-view(0); } + } + IconButton { + y: (parent.height - self.height) / 2; + icon: @image-url("icons/view-grid.svg"); + label: @tr("Icons (Ctrl+2)"); + active: root.view-mode == 1; + clicked => { root.set-view(1); } + } + IconButton { + y: (parent.height - self.height) / 2; + icon: @image-url("icons/view-large.svg"); + label: @tr("Large icons (Ctrl+3)"); + active: root.view-mode == 2; + clicked => { root.set-view(2); } + } } } @@ -1990,7 +2206,7 @@ export component AppWindow inherits Window { border-color: drop.has-drag || list-scope.has-focus ? Theme.accent : Theme.border; clip: true; VerticalLayout { - Rectangle { + if root.view-mode == 0: Rectangle { height: 28px; background: Theme.surface; HorizontalLayout { @@ -2042,7 +2258,7 @@ export component AppWindow inherits Window { } } } - Rectangle { + if root.view-mode == 0: Rectangle { height: 1px; background: Theme.border; } @@ -2052,19 +2268,29 @@ export component AppWindow inherits Window { accessible-label: @tr("Files"); KeyBinding { keys: @keys(DownArrow); - activated => { root.move-selection(1); } + activated => { root.move-selection(root.per-line); } } KeyBinding { keys: @keys(UpArrow); + activated => { root.move-selection(-root.per-line); } + } + KeyBinding { + keys: @keys(RightArrow); + enabled: root.view-mode != 0; + activated => { root.move-selection(1); } + } + KeyBinding { + keys: @keys(LeftArrow); + enabled: root.view-mode != 0; activated => { root.move-selection(-1); } } KeyBinding { keys: @keys(PageDown); - activated => { root.move-selection(max(1, floor(list.visible-height / Theme.row-height) - 1)); } + activated => { root.move-selection(root.per-line * max(1, floor(list-box.height / root.line-height) - 1)); } } KeyBinding { keys: @keys(PageUp); - activated => { root.move-selection(-max(1, floor(list.visible-height / Theme.row-height) - 1)); } + activated => { root.move-selection(-root.per-line * max(1, floor(list-box.height / root.line-height) - 1)); } } KeyBinding { keys: @keys(Home); @@ -2096,7 +2322,7 @@ export component AppWindow inherits Window { keys: @keys(Delete); activated => { root.delete-selected(); } } - Rectangle { + list-box := Rectangle { drop := DropArea { enabled: root.archive-mode && root.can-edit; can-drop(event) => { return DragAction.copy; } @@ -2106,6 +2332,7 @@ export component AppWindow inherits Window { } } list := ListView { + visible: root.view-mode == 0; for row[i] in root.files: FileItem { item: row; wide-kind: root.search-mode; @@ -2130,6 +2357,42 @@ export component AppWindow inherits Window { } } } + // Icon view: lines of tiles (a ListView, so only the visible lines exist). + grid := ListView { + visible: root.view-mode != 0; + for line in root.view-mode == 0 ? 0 : ceil(root.files.length / root.per-line): HorizontalLayout { + padding-left: Theme.space-xs; + alignment: start; + for c in root.per-line: Rectangle { + width: root.tile-width; + height: root.tile-height; + property i: line * root.per-line + c; + if i < root.files.length: FileItem { + x: 2px; + y: 2px; + width: parent.width - 4px; + height: parent.height - 4px; + tile-icon: root.tile-icon; + item: root.files[i]; + selected: i == root.file-selected; + focused: list-scope.has-focus; + archive-mode: root.archive-mode; + texture-mode: root.texture-mode; + history-mode: root.history-mode; + can-edit: root.can-edit; + select => { + list-scope.focus(); + root.file-select(i); + } + open => { root.file-open(i); } + action(a) => { + list-scope.focus(); + root.row-action(i, a); + } + } + } + } + } // Empty states if root.files.length == 0 && !root.busy: VerticalLayout { alignment: center; @@ -2449,7 +2712,7 @@ export component AppWindow inherits Window { y: 8px; text: root.preview-text; font-family: root.mono-font; - font-size: 12px; + font-size: 12px * Theme.text-scale; wrap: no-wrap; color: Theme.text; } @@ -2632,7 +2895,7 @@ export component AppWindow inherits Window { y: 8px; text: root.oiv-changes; font-family: root.mono-font; - font-size: 12px; + font-size: 12px * Theme.text-scale; color: Theme.text; } } @@ -2917,7 +3180,7 @@ export component AppWindow inherits Window { horizontal-stretch: 1; read-only: true; wrap: word-wrap; - font-size: 12px; + font-size: 12px * Theme.text-scale; text: root.about-text; } } @@ -3009,7 +3272,7 @@ export component AppWindow inherits Window { } } - // Settings page: appearance, game, behaviour. + // Settings: appearance, game, behaviour and plugins, one tab each. if root.settings-visible: Dialog { title: @tr("Settings"); panel-width: 560px; @@ -3017,279 +3280,342 @@ export component AppWindow inherits Window { closable: true; close => { root.settings-visible = false; } property chosen: root.parse-hex(root.accent-hex); - ScrollView { + TabWidget { vertical-stretch: 1; - // Debug snapshots of the plugin list (`OPENRAGE_SETTINGS=plugins`). - changed content-height => { - if root.settings-scroll-end { - self.content-y = self.visible-height - self.content-height; - } - } - VerticalLayout { - spacing: Theme.space-m; - padding-right: Theme.space-m; - Text { - text: @tr("Appearance"); - font-size: Theme.font-title; - font-weight: 600; - color: Theme.text; - } - HorizontalLayout { - spacing: Theme.space-s; - Text { - width: 120px; - text: @tr("Theme"); - vertical-alignment: center; - color: Theme.text-muted; - } - Button { - text: @tr("System"); - primary: root.theme-mode == 0; - clicked => { root.set-theme(0); } - } - Button { - text: @tr("Light"); - primary: root.theme-mode == 1; - clicked => { root.set-theme(1); } - } - Button { - text: @tr("Dark"); - primary: root.theme-mode == 2; - clicked => { root.set-theme(2); } - } - } - HorizontalLayout { - spacing: Theme.space-s; - Text { - width: 120px; - text: @tr("Accent color"); - vertical-alignment: center; - color: Theme.text-muted; - } - Button { - text: @tr("OpenRAGE orange"); - primary: Theme.accent-mode == 1; - clicked => { root.accent-chosen(1, Theme.accent-custom); } - } - Button { - text: @tr("System default"); - primary: Theme.accent-mode == 0; - clicked => { root.accent-chosen(0, Theme.accent-custom); } - } - } - HorizontalLayout { - spacing: Theme.space-s; - padding-left: 120px + Theme.space-s; - for c in [#c2410c, #2563eb, #0891b2, #16a34a, #9333ea, #db2777, #ca8a04]: Rectangle { - width: 28px; - height: 28px; - border-radius: 14px; - background: c; - border-width: Theme.accent-mode == 2 && Theme.accent-custom == c ? 3px : 0px; - border-color: Theme.text; - accessible-role: button; - accessible-label: root.color-hex(c); - TouchArea { - mouse-cursor: pointer; - clicked => { - root.accent-hex = root.color-hex(c); - root.accent-chosen(2, c); + current-index <=> root.settings-tab; + Tab { + title: @tr("Appearance"); + ScrollView { + VerticalLayout { + alignment: start; + spacing: Theme.space-m; + padding: Theme.space-m; + padding-left: 0; + HorizontalLayout { + spacing: Theme.space-s; + Text { + width: 120px; + text: @tr("Theme"); + vertical-alignment: center; + color: Theme.text-muted; + } + Button { + text: @tr("System"); + primary: root.theme-mode == 0; + clicked => { root.set-theme(0); } + } + Button { + text: @tr("Light"); + primary: root.theme-mode == 1; + clicked => { root.set-theme(1); } + } + Button { + text: @tr("Dark"); + primary: root.theme-mode == 2; + clicked => { root.set-theme(2); } } } - } - } - HorizontalLayout { - spacing: Theme.space-s; - padding-left: 120px + Theme.space-s; - Rectangle { - width: 28px; - height: 28px; - border-radius: Theme.radius; - border-width: 1px; - border-color: Theme.border; - background: chosen; - } - LineEdit { - horizontal-stretch: 1; - text <=> root.accent-hex; - accessible-label: @tr("Own color as #rrggbb"); - placeholder-text: @tr("Own color, e.g. #c2410c"); - accepted => { - if (chosen.alpha > 0) { - root.accent-chosen(2, chosen); + HorizontalLayout { + spacing: Theme.space-s; + Text { + width: 120px; + text: @tr("Accent color"); + vertical-alignment: center; + color: Theme.text-muted; + } + Button { + text: @tr("OpenRAGE orange"); + primary: Theme.accent-mode == 1; + clicked => { root.accent-chosen(1, Theme.accent-custom); } + } + Button { + text: @tr("System default"); + primary: Theme.accent-mode == 0; + clicked => { root.accent-chosen(0, Theme.accent-custom); } + } + } + HorizontalLayout { + spacing: Theme.space-s; + padding-left: 120px + Theme.space-s; + for c in [#c2410c, #2563eb, #0891b2, #16a34a, #9333ea, #db2777, #ca8a04]: Rectangle { + width: 28px; + height: 28px; + border-radius: 14px; + background: c; + border-width: Theme.accent-mode == 2 && Theme.accent-custom == c ? 3px : 0px; + border-color: Theme.text; + accessible-role: button; + accessible-label: root.color-hex(c); + TouchArea { + mouse-cursor: pointer; + clicked => { + root.accent-hex = root.color-hex(c); + root.accent-chosen(2, c); + } + } + } + } + HorizontalLayout { + spacing: Theme.space-s; + padding-left: 120px + Theme.space-s; + Rectangle { + width: 28px; + height: 28px; + border-radius: Theme.radius; + border-width: 1px; + border-color: Theme.border; + background: chosen; + } + LineEdit { + horizontal-stretch: 1; + text <=> root.accent-hex; + accessible-label: @tr("Own color as #rrggbb"); + placeholder-text: @tr("Own color, e.g. #c2410c"); + accepted => { + if (chosen.alpha > 0) { + root.accent-chosen(2, chosen); + } + } + } + Button { + text: @tr("Use"); + enabled: chosen.alpha > 0; + clicked => { root.accent-chosen(2, chosen); } + } + } + HorizontalLayout { + spacing: Theme.space-s; + Text { + width: 120px; + text: @tr("Text size"); + vertical-alignment: center; + color: Theme.text-muted; + } + for s[i] in [{ label: @tr("Small"), scale: 0.9 }, { label: @tr("Normal"), scale: 1.0 }, { label: @tr("Large"), scale: 1.15 }, { label: @tr("Larger"), scale: 1.3 }]: Button { + text: s.label; + primary: Math.abs(Theme.text-scale - s.scale) < 0.01; + clicked => { root.text-scale-chosen(s.scale); } + } + } + HorizontalLayout { + spacing: Theme.space-s; + Text { + width: 120px; + text: @tr("Files"); + vertical-alignment: center; + color: Theme.text-muted; + } + Button { + text: @tr("List"); + primary: root.view-mode == 0; + clicked => { root.set-view(0); } + } + Button { + text: @tr("Icons"); + primary: root.view-mode == 1; + clicked => { root.set-view(1); } + } + Button { + text: @tr("Large icons"); + primary: root.view-mode == 2; + clicked => { root.set-view(2); } } } } - Button { - text: @tr("Use"); - enabled: chosen.alpha > 0; - clicked => { root.accent-chosen(2, chosen); } - } - } - Rectangle { - height: 1px; - background: Theme.border; - } - Text { - text: @tr("Game"); - font-size: Theme.font-title; - font-weight: 600; - color: Theme.text; } - HorizontalLayout { - spacing: Theme.space-s; - Image { - source: @image-url("logo.svg"); - width: 32px; - height: 32px; - } + } + Tab { + title: @tr("Game"); + ScrollView { VerticalLayout { - horizontal-stretch: 1; - Text { - text: root.settings-game; - font-weight: 600; - color: Theme.text; + alignment: start; + spacing: Theme.space-m; + padding: Theme.space-m; + padding-left: 0; + HorizontalLayout { + spacing: Theme.space-s; + Image { + source: @image-url("logo.svg"); + width: 32px; + height: 32px; + } + VerticalLayout { + horizontal-stretch: 1; + Text { + text: root.settings-game; + font-weight: 600; + color: Theme.text; + } + Text { + text: root.settings-game-dir; + font-size: Theme.font-small; + wrap: char-wrap; + color: Theme.text-muted; + } + } } - Text { - text: root.settings-game-dir; - font-size: Theme.font-small; - wrap: char-wrap; - color: Theme.text-muted; + HorizontalLayout { + alignment: start; + spacing: Theme.space-s; + Button { + text: @tr("Switch game…"); + enabled: root.games.length > 1; + clicked => { + root.settings-visible = false; + root.open-game-chooser(true); + } + } + Button { + text: @tr("Add or change a game…"); + clicked => { + root.settings-visible = false; + root.open-setup(); + } + } + } + CheckBox { + text: @tr("Ask which game to open at start"); + enabled: root.games.length > 1; + checked: root.ask-game; + toggled => { root.ask-game-changed(self.checked); } } } } - HorizontalLayout { - alignment: start; - spacing: Theme.space-s; - Button { - text: @tr("Switch game…"); - enabled: root.games.length > 1; - clicked => { - root.settings-visible = false; - root.open-game-chooser(true); + } + Tab { + title: @tr("Behaviour"); + ScrollView { + VerticalLayout { + alignment: start; + spacing: Theme.space-m; + padding: Theme.space-m; + padding-left: 0; + CheckBox { + text: @tr("Show the change history in its own window"); + checked: root.history-in-window; + toggled => { + root.history-in-window = self.checked; + root.history-window-changed(self.checked); + } } - } - Button { - text: @tr("Add or change a game…"); - clicked => { - root.settings-visible = false; - root.open-setup(); + CheckBox { + text: @tr("Show the game as it sees itself with mods (mods overlay)"); + enabled: root.mods-available; + checked: root.mods-overlay; + toggled => { + root.mods-overlay = self.checked; + root.overlay-toggled(self.checked); + } } } } - CheckBox { - text: @tr("Ask which game to open at start"); - enabled: root.games.length > 1; - checked: root.ask-game; - toggled => { root.ask-game-changed(self.checked); } - } - Rectangle { - height: 1px; - background: Theme.border; - } - Text { - text: @tr("Behaviour"); - font-size: Theme.font-title; - font-weight: 600; - color: Theme.text; - } - CheckBox { - text: @tr("Show the change history in its own window"); - checked: root.history-in-window; - toggled => { - root.history-in-window = self.checked; - root.history-window-changed(self.checked); - } - } - CheckBox { - text: @tr("Show the game as it sees itself with mods (mods overlay)"); - enabled: root.mods-available; - checked: root.mods-overlay; - toggled => { - root.mods-overlay = self.checked; - root.overlay-toggled(self.checked); - } - } - Rectangle { - height: 1px; - background: Theme.border; - } - Text { - text: @tr("Plugins"); - font-size: Theme.font-title; - font-weight: 600; - color: Theme.text; - } - Text { - text: @tr("Plugins add previews and actions for more file types. They run in a sandbox: they see only the files you open with them, plus the game's files if you allow it, and cannot change anything or go online. New plugins stay off until you turn them on."); - wrap: word-wrap; - color: Theme.text-muted; - } - if root.plugins.length == 0: Text { - text: @tr("No plugins installed. Put a plugin's folder into the plugin folder, then reload."); - wrap: word-wrap; - color: Theme.text-muted; - } - for p in root.plugins: HorizontalLayout { - spacing: Theme.space-s; + } + Tab { + title: @tr("Plugins"); + ScrollView { VerticalLayout { - horizontal-stretch: 1; - spacing: 2px; + alignment: start; + spacing: Theme.space-m; + padding: Theme.space-m; + padding-left: 0; Text { - text: p.title + " · " + p.status; - font-weight: 600; - color: p.broken ? Theme.danger : Theme.text; + text: @tr("Plugins add previews and actions for more file types. They run in a sandbox: they see only the files you open with them, plus the game's files if you allow it, and cannot change anything or go online. New plugins stay off until you turn them on."); + wrap: word-wrap; + color: Theme.text-muted; } - if p.description != "": Text { - text: p.description; - font-size: Theme.font-small; + HorizontalLayout { + alignment: start; + spacing: Theme.space-s; + Button { + text: @tr("Install plugin…"); + primary: true; + clicked => { root.pick-plugin-package(); } + } + Button { + text: @tr("Open plugin folder"); + clicked => { root.open-plugin-folder(); } + } + Button { + text: @tr("Reload plugins"); + clicked => { root.reload-plugins(); } + } + } + if root.plugins.length == 0: Text { + text: @tr("No plugins installed. Put a plugin's folder into the plugin folder, then reload."); wrap: word-wrap; color: Theme.text-muted; } + for p in root.plugins: HorizontalLayout { + spacing: Theme.space-s; + VerticalLayout { + horizontal-stretch: 1; + spacing: 2px; + Text { + text: p.title + " · " + p.status; + font-weight: 600; + color: p.broken ? Theme.danger : Theme.text; + } + if p.description != "": Text { + text: p.description; + font-size: Theme.font-small; + wrap: word-wrap; + color: Theme.text-muted; + } + Text { + text: p.permissions; + font-size: Theme.font-small; + wrap: word-wrap; + color: p.broken ? Theme.danger : Theme.text-muted; + } + } + if !p.broken: CheckBox { + text: @tr("On"); + checked: p.enabled; + accessible-label: @tr("Enable {}", p.title); + toggled => { root.plugin-toggled(p.id, self.checked); } + } + if p.removable: VerticalLayout { + alignment: center; + Button { + text: @tr("Uninstall"); + accessible-label: @tr("Uninstall {}", p.title); + clicked => { root.uninstall-plugin(p.id); } + } + } + } Text { - text: p.permissions; + text: root.plugin-folder; font-size: Theme.font-small; - wrap: word-wrap; - color: p.broken ? Theme.danger : Theme.text-muted; - } - } - if !p.broken: CheckBox { - text: @tr("On"); - checked: p.enabled; - accessible-label: @tr("Enable {}", p.title); - toggled => { root.plugin-toggled(p.id, self.checked); } - } - if p.removable: VerticalLayout { - alignment: center; - Button { - text: @tr("Uninstall"); - accessible-label: @tr("Uninstall {}", p.title); - clicked => { root.uninstall-plugin(p.id); } + wrap: char-wrap; + color: Theme.text-muted; } } } - Text { - text: root.plugin-folder; - font-size: Theme.font-small; - wrap: char-wrap; - color: Theme.text-muted; - } - HorizontalLayout { - alignment: start; - spacing: Theme.space-s; - Button { - text: @tr("Install plugin…"); - primary: true; - clicked => { root.pick-plugin-package(); } - } - Button { - text: @tr("Open plugin folder"); - clicked => { root.open-plugin-folder(); } - } - Button { - text: @tr("Reload plugins"); - clicked => { root.reload-plugins(); } - } + } + } + } + + // Installing a plugin package: what it is and may do, before anything is written. + if root.plugin-pkg-visible: Dialog { + title: root.plugin-pkg-title; + subtitle: root.plugin-pkg-subtitle; + panel-width: 640px; + panel-height: 460px; + close => { root.plugin-pkg-visible = false; } + Rectangle { + vertical-stretch: 1; + background: Theme.surface-raised; + border-radius: Theme.radius; + ScrollView { + content-width: max(self.visible-width, details.preferred-width + 16px); + content-height: max(self.visible-height, details.preferred-height + 16px); + details := Text { + x: 8px; + y: 8px; + width: parent.visible-width - 16px; + text: root.plugin-pkg-details; + wrap: word-wrap; + color: Theme.text; } } } @@ -3398,7 +3724,7 @@ export component AppWindow inherits Window { text: root.setup-log; wrap: word-wrap; font-family: root.mono-font; - font-size: 12px; + font-size: 12px * Theme.text-scale; color: Theme.text; } } @@ -4243,7 +4569,7 @@ export component EditorWindow inherits Window { height: 100%; text <=> root.text; read-only: !root.editable || root.locked-reason != "" || root.saving; - font-size: 13px; + font-size: 13px * Theme.text-scale; wrap: root.wrap ? TextWrap.word-wrap : TextWrap.no-wrap; edited => { root.modified = true; } } @@ -4706,7 +5032,7 @@ export component XmlWindow inherits Window { horizontal-alignment: right; vertical-alignment: center; font-family: root.mono-font; - font-size: 12px; + font-size: 12px * Theme.text-scale; color: Theme.text-faint; } HorizontalLayout { @@ -4716,7 +5042,7 @@ export component XmlWindow inherits Window { text: s.text; vertical-alignment: center; font-family: root.mono-font; - font-size: 12px; + font-size: 12px * Theme.text-scale; color: root.span-color(s.kind); } } @@ -5834,7 +6160,7 @@ export component ToolWindow inherits Window { vertical-stretch: 1; read-only: true; text: root.result; - font-size: 13px; + font-size: 13px * Theme.text-scale; wrap: no-wrap; accessible-label: @tr("Result"); } diff --git a/crates/openrage-gui/ui/icons/filter.svg b/crates/openrage-gui/ui/icons/filter.svg new file mode 100644 index 0000000..5e83025 --- /dev/null +++ b/crates/openrage-gui/ui/icons/filter.svg @@ -0,0 +1 @@ + diff --git a/crates/openrage-gui/ui/icons/menu/view-grid.svg b/crates/openrage-gui/ui/icons/menu/view-grid.svg new file mode 100644 index 0000000..686a145 --- /dev/null +++ b/crates/openrage-gui/ui/icons/menu/view-grid.svg @@ -0,0 +1 @@ + diff --git a/crates/openrage-gui/ui/icons/menu/view-large.svg b/crates/openrage-gui/ui/icons/menu/view-large.svg new file mode 100644 index 0000000..32091a7 --- /dev/null +++ b/crates/openrage-gui/ui/icons/menu/view-large.svg @@ -0,0 +1 @@ + diff --git a/crates/openrage-gui/ui/icons/menu/view-list.svg b/crates/openrage-gui/ui/icons/menu/view-list.svg new file mode 100644 index 0000000..c0dc61f --- /dev/null +++ b/crates/openrage-gui/ui/icons/menu/view-list.svg @@ -0,0 +1 @@ + diff --git a/crates/openrage-gui/ui/icons/view-grid.svg b/crates/openrage-gui/ui/icons/view-grid.svg new file mode 100644 index 0000000..c2cf1c3 --- /dev/null +++ b/crates/openrage-gui/ui/icons/view-grid.svg @@ -0,0 +1 @@ + diff --git a/crates/openrage-gui/ui/icons/view-large.svg b/crates/openrage-gui/ui/icons/view-large.svg new file mode 100644 index 0000000..4585e80 --- /dev/null +++ b/crates/openrage-gui/ui/icons/view-large.svg @@ -0,0 +1 @@ + diff --git a/crates/openrage-gui/ui/icons/view-list.svg b/crates/openrage-gui/ui/icons/view-list.svg new file mode 100644 index 0000000..8c4458e --- /dev/null +++ b/crates/openrage-gui/ui/icons/view-list.svg @@ -0,0 +1 @@ + diff --git a/crates/openrage-gui/ui/theme.slint b/crates/openrage-gui/ui/theme.slint index 278680a..3c6cd23 100644 --- a/crates/openrage-gui/ui/theme.slint +++ b/crates/openrage-gui/ui/theme.slint @@ -16,14 +16,18 @@ export global Theme { out property radius: 6px; out property radius-s: 4px; - out property row-height: 26px; - out property icon-size: 16px; + + // Text size (View → Text size, saved as `text_size`): text, list rows and + // file icons grow with it. + in-out property text-scale: 1.0; + out property row-height: round(26px * text-scale / 1px) * 1px; + out property icon-size: round(16px * text-scale / 1px) * 1px; // Type scale - out property font-small: 11px; - out property font-body: 13px; - out property font-title: 16px; - out property font-heading: 20px; + out property font-small: 11px * text-scale; + out property font-body: 13px * text-scale; + out property font-title: 16px * text-scale; + out property font-heading: 20px * text-scale; // Surfaces out property background: Palette.background; @@ -89,6 +93,7 @@ export global Icons { if (name == "particles") { return @image-url("icons/particles.svg"); } if (name == "package") { return @image-url("icons/package.svg"); } if (name == "search") { return @image-url("icons/search.svg"); } + if (name == "filter") { return @image-url("icons/filter.svg"); } return @image-url("icons/file.svg"); } } diff --git a/site/content/guide.md b/site/content/guide.md index 45eb58a..f03f30d 100644 --- a/site/content/guide.md +++ b/site/content/guide.md @@ -25,6 +25,12 @@ With several games set up, OpenRAGE first shows a small window that asks which o - The file list is sortable and shows a format icon for each file (textures, models, maps, data, audio, scripts …). - Files that contain other files (texture dictionaries, audio containers) carry a badge on their icon. - The **address bar** has clickable breadcrumbs. Click the free space (or press Ctrl+L) to type a path. +- **Views:** the buttons above the list (or View → List, Icons, Large icons; Ctrl+1, Ctrl+2, Ctrl+3) show the files + as a list with columns or as icons. In the icon views the arrow keys move left, right, up and down. +- **Filter:** the funnel button above the list (Ctrl+Shift+F) opens a field that narrows the list to names containing + the text; Esc clears and closes it. +- **Text size:** View → Text size (or Settings → Appearance) makes text, list rows and icons smaller or larger, in + every window. ### Preview and info panel @@ -71,12 +77,16 @@ The other windows have right-click menus too: | Backspace or Alt+Up | Up one folder | | Ctrl+L | Type a path | | Ctrl+F | Search | +| Ctrl+Shift+F | Filter the list | +| Ctrl+1 / Ctrl+2 / Ctrl+3 | List / icons / large icons | | F2 / Delete | Rename / delete (in edit mode) | | Ctrl+Z | Undo | | F1 | All keyboard shortcuts | ## Search +The magnifier in the toolbar (or Ctrl+F) opens the search field; Enter searches, Esc folds it away again. + OpenRAGE keeps a search index of the whole game. It is built once in about 30 seconds; after a game update only the archives that changed are read again. @@ -96,12 +106,14 @@ Typing `?query` into the address bar searches as well; Back returns to the resul ## Settings -**Settings** (gear button, File → Settings… or Ctrl+,) holds: +**Settings** (gear button, File → Settings… or Ctrl+,) has four tabs: -- the theme (light, dark or system) and the accent colour (a preset or any colour of your own); -- the games: *Switch game…*, *Add or change a game…* and whether to ask at start; -- whether the history opens in its own window and whether the mods overlay is shown; -- the [plugins](#plugins): which are on, their permissions, the plugin folder. +- **Appearance:** the theme (light, dark or system), the accent colour (a preset or any colour of your own), the text + size and the file view; +- **Game:** *Switch game…*, *Add or change a game…* and whether to ask at start; +- **Behaviour:** whether the history opens in its own window and whether the mods overlay is shown; +- **Plugins** (also Tools → Plugins…): installing, which are on, their permissions, the plugin folder; see + [plugins](#plugins). The sun/moon button in the toolbar switches the theme quickly. @@ -112,7 +124,7 @@ in a sandbox: a plugin sees only the files you open with it and, if you allow it change anything, open other files or go online. - **Install:** **Settings → Plugins → Install plugin…** installs a plugin package (`.orp`); opening an `.orp` with - OpenRAGE does the same. You first see what the plugin is, what it may do and its SHA-256 checksum (compare it with + OpenRAGE (a double-click, once OpenRAGE is the file manager's app for it; the Flatpak sets that up) does the same. You first see what the plugin is, what it may do and its SHA-256 checksum (compare it with the one the author publishes). **Uninstall** removes it again. A plugin folder also works: put it into your plugin folder (`~/.config/openrage/plugins` on Linux, `%APPDATA%\openrage\plugins` on Windows, or `plugins` next to the program); **Open plugin folder** opens it, **Reload plugins** picks up new ones. The download comes with four example plugins: *Strings* (shows and From 5c9c19d14ac6c8ae55211ec5a0d41b536a05deff Mon Sep 17 00:00:00 2001 From: Philippe Date: Thu, 19 Nov 2026 22:38:00 +0100 Subject: [PATCH 4/4] Release 0.5.0: version (#135) Flatpak bundle, .orp/.oiv double-click, icon views, text size, settings tabs, the restored plugin install dialog and the RDR2 empty-archive fix. Co-authored-by: Claude Opus 5.5 --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 18 +++++++++--------- README.md | 2 +- docs/publishing.md | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8eba4d8..296e4c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3981,7 +3981,7 @@ dependencies = [ [[package]] name = "openrage-app" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "dirs", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "openrage-cli" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "clap", @@ -4022,7 +4022,7 @@ dependencies = [ [[package]] name = "openrage-gui" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "arboard", @@ -4049,7 +4049,7 @@ dependencies = [ [[package]] name = "openrage-plugins" -version = "0.4.0" +version = "0.5.0" dependencies = [ "anyhow", "dirs", @@ -4528,11 +4528,11 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "rage-core" -version = "0.4.0" +version = "0.5.0" [[package]] name = "rage-crypto" -version = "0.4.0" +version = "0.5.0" dependencies = [ "aes", "flate2", @@ -4543,7 +4543,7 @@ dependencies = [ [[package]] name = "rage-formats" -version = "0.4.0" +version = "0.5.0" dependencies = [ "flate2", "lewton", @@ -4558,7 +4558,7 @@ dependencies = [ [[package]] name = "rage-index" -version = "0.4.0" +version = "0.5.0" dependencies = [ "flate2", "rage-core", @@ -4571,7 +4571,7 @@ dependencies = [ [[package]] name = "rage-mods" -version = "0.4.0" +version = "0.5.0" dependencies = [ "rage-crypto", "rage-rpf", @@ -4579,7 +4579,7 @@ dependencies = [ [[package]] name = "rage-resource" -version = "0.4.0" +version = "0.5.0" dependencies = [ "flate2", "thiserror 2.0.21", @@ -4587,7 +4587,7 @@ dependencies = [ [[package]] name = "rage-rpf" -version = "0.4.0" +version = "0.5.0" dependencies = [ "flate2", "memchr", @@ -4603,7 +4603,7 @@ dependencies = [ [[package]] name = "rage-tfit2" -version = "0.4.0" +version = "0.5.0" [[package]] name = "rand" diff --git a/Cargo.toml b/Cargo.toml index a7bb511..9bc00e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*"] [workspace.package] -version = "0.4.0" +version = "0.5.0" edition = "2024" license = "GPL-3.0-only" repository = "https://github.com/Two-Play/openrage" @@ -13,14 +13,14 @@ authors = ["OpenRAGE contributors"] rust-version = "1.99" [workspace.dependencies] -rage-core = { path = "crates/rage-core", version = "0.4.0" } -rage-crypto = { path = "crates/rage-crypto", version = "0.4.0" } -rage-tfit2 = { path = "crates/rage-tfit2", version = "0.4.0" } -rage-rpf = { path = "crates/rage-rpf", version = "0.4.0", features = ["rdr2"] } -rage-index = { path = "crates/rage-index", version = "0.4.0" } -rage-mods = { path = "crates/rage-mods", version = "0.4.0" } -rage-resource = { path = "crates/rage-resource", version = "0.4.0" } -rage-formats = { path = "crates/rage-formats", version = "0.4.0" } +rage-core = { path = "crates/rage-core", version = "0.5.0" } +rage-crypto = { path = "crates/rage-crypto", version = "0.5.0" } +rage-tfit2 = { path = "crates/rage-tfit2", version = "0.5.0" } +rage-rpf = { path = "crates/rage-rpf", version = "0.5.0", features = ["rdr2"] } +rage-index = { path = "crates/rage-index", version = "0.5.0" } +rage-mods = { path = "crates/rage-mods", version = "0.5.0" } +rage-resource = { path = "crates/rage-resource", version = "0.5.0" } +rage-formats = { path = "crates/rage-formats", version = "0.5.0" } aes = "0.8" anyhow = "1" diff --git a/README.md b/README.md index 1e550ee..ca1f5ea 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ edit game text and install `.oiv` packages — compatible with OpenIV's `mods` f OpenIV's last release was in January 2022. OpenRAGE picks up where it left off and stays compatible with it. -- **Explorer and search:** archives, even nested ones, open like folders; names, hashes and full text of the whole game in milliseconds. +- **Explorer and search:** archives, even nested ones, open like folders, as a list or as icons; names, hashes and full text of the whole game in milliseconds. - **Every major format:** textures, models, audio, animations, metadata as XML, collisions, paths, nav meshes, cutscenes, scripts, game text. - **Coming from OpenIV?** Your `mods` folder and `.oiv` packages work as they are ([how to switch](https://two-play.github.io/openrage/getting-started/#coming-from-openiv)). - **Mods, safely:** changes go to OpenIV's `mods` folder, never into your game files; every change and every `.oiv` package can be undone. diff --git a/docs/publishing.md b/docs/publishing.md index 112ed78..fba6895 100644 --- a/docs/publishing.md +++ b/docs/publishing.md @@ -16,7 +16,7 @@ Each prepared crate has its own `README.md`, a `LICENSE` (a link to the workspace licence; `cargo package` copies the file), and, where code is derived from CodeWalker, a `NOTICE.md` with the MIT notice. -Workspace path dependencies carry `version = "0.4.0"`, so crates.io resolves +Workspace path dependencies carry `version = "0.5.0"`, so crates.io resolves them once the dependency is published. `cargo package` of a crate that depends on an unpublished workspace crate fails at "no matching package"; publish bottom-up (`rage-core`, `rage-crypto`, `rage-resource`, `rage-tfit2`, @@ -70,7 +70,7 @@ every caller in the CLI and GUI; that is left for later. * **Crate names.** `rage-*` names may be taken or confusing on crates.io; check availability (`cargo search rage-core`) or pick a prefix. -* **Version.** The crates share the workspace version (0.4.0). Independent +* **Version.** The crates share the workspace version (0.5.0). Independent versions per crate (and a 0.1.0 start) are an option. * **MSRV.** `rust-version = "1.99"` is the pinned toolchain, the only one checked. A lower MSRV (edition 2024 needs at least 1.85; the code uses