Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ AGENTS.md
/reference

*.log
*.mo

# Git should not follow this IN ANY CASE
Cargo.lock
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ install-data-rog_gui:
$(INSTALL_DATA) "./rog-control-center/data/$(BIN_ROG).png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/$(BIN_ROG).png"
$(INSTALL_DATA) "./rog-control-center/data/$(APP_ID).metainfo.xml" "$(DESTDIR)$(datarootdir)/metainfo/$(APP_ID).metainfo.xml"
cd rog-aura/data/layouts && find . -type f -name "*.ron" -exec $(INSTALL_DATA) "{}" "$(DESTDIR_REALPATH)$(datarootdir)/rog-gui/layouts/{}" \;
cd rog-control-center/translations && find . -type f -name "*.mo" -exec $(INSTALL_DATA) "{}" "$(DESTDIR_REALPATH)$(datarootdir)/locale/{}" \;
Comment thread
coderabbitai[bot] marked this conversation as resolved.

$(INSTALL_DATA) "./data/icons/asus_notif_yellow.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_yellow.png"
$(INSTALL_DATA) "./data/icons/asus_notif_green.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_green.png"
Expand Down Expand Up @@ -164,6 +165,7 @@ uninstall:
rm -rf "$(DESTDIR)$(datarootdir)/asusd"
rm -rf "$(DESTDIR)$(datarootdir)/asusctl"
rm -rf "$(DESTDIR)$(datarootdir)/rog-gui"
cd rog-control-center/translations && find . -type f -name "*.mo" -exec rm -f "$(DESTDIR_REALPATH)$(datarootdir)/locale/{}" \;

update:
cargo update
Expand Down
57 changes: 52 additions & 5 deletions rog-control-center/build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,61 @@
use std::path::PathBuf;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;

use slint_build::CompilerConfiguration;

fn compile_translations(manifest_dir: &Path) -> Result<(), Box<dyn std::error::Error>> {
let translations_dir = manifest_dir.join("translations");
if !translations_dir.exists() {
return Ok(());
}

println!("cargo:rerun-if-changed={}", translations_dir.display());

for entry in fs::read_dir(&translations_dir)? {
let entry = entry?;
let path = entry.path();
if path.is_dir() {
let po_file = path.join("rog-control-center.po");
let lc_messages_dir = path.join("LC_MESSAGES");
let mo_file = lc_messages_dir.join("rog-control-center.mo");

if po_file.exists() {
println!("cargo:rerun-if-changed={}", po_file.display());
Comment thread
scardracs marked this conversation as resolved.
println!("cargo:rerun-if-changed={}", mo_file.display());
fs::create_dir_all(&lc_messages_dir)?;

Comment thread
coderabbitai[bot] marked this conversation as resolved.
let status = Command::new("msgfmt")
.arg(&po_file)
.arg("-o")
.arg(&mo_file)
.status()
.map_err(|e| format!("Failed to execute msgfmt: {}", e))?;

if !status.success() {
return Err(format!(
"msgfmt failed for {}: exit status {}",
po_file.display(),
status
)
.into());
}
} else if mo_file.exists() {
fs::remove_file(&mo_file)?;
}
}
}
Ok(())
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

fn main() -> Result<(), Box<dyn std::error::Error>> {
// write_locales();
let root = env!("CARGO_MANIFEST_DIR");
let mut main = PathBuf::from(root);
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
compile_translations(&root)?;

let mut main = root.clone();
main.push("ui/main_window.slint");

let mut include = PathBuf::from(root);
let mut include = root.clone();
include.push("ui");

slint_build::print_rustc_flags()?;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.