Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from baskerville:master #36

Merged
merged 4 commits into from
Feb 26, 2024
Merged
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
459 changes: 262 additions & 197 deletions Cargo.lock

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[package]
authors = ["Bastien Dejean <[email protected]>"]
name = "plato-core"
version = "0.9.40"
version = "0.9.41"
edition = "2021"

[lib]
crate-type = ["rlib"]

[dependencies]
bitflags = "2.4.1"
bitflags = "2.4.2"
downcast-rs = "1.2.0"
lazy_static = "1.4.0"
libc = "0.2.150"
png = "0.17.10"
regex = "1.10.2"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
libc = "0.2.153"
png = "0.17.13"
regex = "1.10.3"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
titlecase = "2.2.1"
unicode-normalization = "0.1.22"
toml = "0.8.8"
unicode-normalization = "0.1.23"
toml = "0.8.10"
zip = "0.6.6"
kl-hyphenate = "0.7.3"
entities = "1.0.1"
Expand All @@ -28,14 +28,14 @@ septem = "1.1.0"
byteorder = "1.5.0"
flate2 = "1.0.28"
levenshtein = "1.0.5"
nix = { version = "0.27.1", features = ["fs", "ioctl"] }
indexmap = { version = "2.1.0", features = ["serde"] }
anyhow = "1.0.75"
thiserror = "1.0.50"
nix = { version = "0.28.0", features = ["fs", "ioctl"] }
indexmap = { version = "2.2.3", features = ["serde"] }
anyhow = "1.0.80"
thiserror = "1.0.57"
walkdir = "2.4.0"
globset = "0.4.14"
fxhash = "0.2.1"
rand_core = "0.6.4"
rand_xoshiro = "0.6.0"
percent-encoding = "2.3.1"
chrono = { version = "0.4.31", features = ["serde", "clock"], default-features = false }
chrono = { version = "0.4.34", features = ["serde", "clock"], default-features = false }
6 changes: 6 additions & 0 deletions crates/core/src/battery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pub enum Status {
// Full,
}

impl Status {
pub fn is_wired(self) -> bool {
matches!(self, Status::Charging | Status::Charged)
}
}

pub trait Battery {
fn capacity(&mut self) -> Result<Vec<f32>, Error>;
fn status(&mut self) -> Result<Vec<Status>, Error>;
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl Library {
// The path is known: update the fp.
} else if let Some(fp2) = self.paths.get(relat).cloned() {
println!("Update fingerprint for {}: {} → {}.", relat.display(), fp2, fp);
let mut info = self.db.remove(&fp2).unwrap();
let mut info = self.db.swap_remove(&fp2).unwrap();
if settings.sync_metadata && settings.metadata_kinds.contains(&info.file.kind) {
extract_metadata_from_document(&self.home, &mut info);
}
Expand Down Expand Up @@ -286,7 +286,7 @@ impl Library {
// and moved within another.
if let Some(nfp) = nfp {
println!("Update fingerprint for {}: {} → {}.", self.db[&nfp].file.path.display(), nfp, fp);
let info = self.db.remove(&nfp).unwrap();
let info = self.db.swap_remove(&nfp).unwrap();
self.db.insert(fp, info);
let rp1 = self.reading_state_path(nfp);
let rp2 = self.reading_state_path(fp);
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/battery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl View for Battery {

pt = self.rect.min + pt!(dx, dy) + pt!(border_thickness);

if self.status != Status::Discharging {
if self.status.is_wired() {
let name = if self.status == Status::Charging { "plug" } else { "check_mark-small" };
let pixmap = ICONS_PIXMAPS.get(name).unwrap();
pt += pt!((max_fill_width - pixmap.width as i32) / 2,
Expand Down
4 changes: 2 additions & 2 deletions crates/emulator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Bastien Dejean <[email protected]>"]
name = "emulator"
version = "0.9.40"
version = "0.9.41"
edition = "2021"

[[bin]]
Expand All @@ -10,4 +10,4 @@ path = "src/main.rs"

[dependencies]
plato-core = { path = "../core" }
sdl2 = "0.35.2"
sdl2 = "0.36.0"
4 changes: 2 additions & 2 deletions crates/fetcher/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Bastien Dejean <[email protected]>"]
name = "fetcher"
version = "0.9.40"
version = "0.9.41"
edition = "2021"

[[bin]]
Expand All @@ -13,6 +13,6 @@ plato-core = { path = "../core" }
signal-hook = "0.3.17"

[dependencies.reqwest]
version = "0.11.22"
version = "0.11.24"
features = ["rustls-tls", "json", "blocking"]
default-features = false
2 changes: 1 addition & 1 deletion crates/importer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Bastien Dejean <[email protected]>"]
name = "importer"
version = "0.9.40"
version = "0.9.41"
edition = "2021"

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion crates/plato/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Bastien Dejean <[email protected]>"]
name = "plato"
version = "0.9.40"
version = "0.9.41"
edition = "2021"

[[bin]]
Expand Down
6 changes: 5 additions & 1 deletion crates/plato/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ fn set_wifi(enable: bool, context: &mut Context) {
}
}

#[derive(PartialEq)]
enum ExitStatus {
Quit,
Reboot,
Expand All @@ -221,6 +222,9 @@ pub fn run() -> Result<(), Error> {
}

let mut context = build_context(fb).context("can't build context")?;

context.plugged = context.battery.status().is_ok_and(|v| v[0].is_wired());

if context.settings.import.startup_trigger {
context.batch_import();
}
Expand Down Expand Up @@ -981,7 +985,7 @@ pub fn run() -> Result<(), Error> {
}
}

if !CURRENT_DEVICE.has_gyroscope() && context.display.rotation != initial_rotation {
if exit_status == ExitStatus::Quit && !CURRENT_DEVICE.has_gyroscope() && context.display.rotation != initial_rotation {
context.fb.set_rotation(initial_rotation).ok();
}

Expand Down