add about section in settings page

This commit is contained in:
Maarifa Maarifa
2023-07-20 04:01:51 +03:00
parent ebdd13870d
commit ec02b132fa
5 changed files with 142 additions and 0 deletions

82
Cargo.lock generated
View File

@@ -269,6 +269,17 @@ dependencies = [
"generic-array",
]
[[package]]
name = "built"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b99c4cdc7b2c2364182331055623bdf45254fcb679fea565c40c3c11c101889a"
dependencies = [
"cargo-lock",
"chrono",
"git2",
]
[[package]]
name = "bumpalo"
version = "3.13.0"
@@ -330,11 +341,26 @@ dependencies = [
"vec_map",
]
[[package]]
name = "cargo-lock"
version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72"
dependencies = [
"semver",
"serde",
"toml 0.7.4",
"url",
]
[[package]]
name = "cc"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
dependencies = [
"jobserver",
]
[[package]]
name = "cfg-expr"
@@ -1320,6 +1346,19 @@ dependencies = [
"winapi",
]
[[package]]
name = "git2"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044"
dependencies = [
"bitflags",
"libc",
"libgit2-sys",
"log",
"url",
]
[[package]]
name = "glam"
version = "0.21.3"
@@ -1961,6 +2000,15 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jobserver"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2"
dependencies = [
"libc",
]
[[package]]
name = "jpeg-decoder"
version = "0.3.0"
@@ -2041,6 +2089,18 @@ version = "0.2.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
[[package]]
name = "libgit2-sys"
version = "0.15.2+1.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa"
dependencies = [
"cc",
"libc",
"libz-sys",
"pkg-config",
]
[[package]]
name = "libloading"
version = "0.7.4"
@@ -2057,6 +2117,18 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
[[package]]
name = "libz-sys"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "linked-hash-map"
version = "0.5.6"
@@ -3277,6 +3349,15 @@ dependencies = [
"libc",
]
[[package]]
name = "semver"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
dependencies = [
"serde",
]
[[package]]
name = "serde"
version = "1.0.163"
@@ -3335,6 +3416,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bincode",
"built",
"bytes",
"chrono",
"clap",

View File

@@ -36,6 +36,9 @@ html2text = "0.6.0"
bytes = "1.4.0"
rfd = "0.11.4"
[build-dependencies]
built = { version = "0.6.1", features = ["git2", "chrono"] }
[profile.release]
lto = true
strip = true

3
build.rs Normal file
View File

@@ -0,0 +1,3 @@
fn main() {
built::write_built_file().expect("Failed to acquire build-time information");
}

View File

@@ -9,6 +9,7 @@ use crate::gui::{styles, troxide_widget, Message as GuiMessage, Tab};
use caching_widget::{Caching, Message as CachingMessage};
use database_widget::{Database, Message as DatabaseMessage};
mod about_widget;
mod caching_widget;
mod database_widget;
@@ -79,6 +80,7 @@ impl SettingsTab {
self.appearance_settings_view(),
self.database_settings.view().map(Message::Database),
self.caching_settings.view().map(Message::Caching),
about_widget::about_widget(),
]
.spacing(5)
.padding(5);

View File

@@ -0,0 +1,52 @@
use crate::gui::styles;
use super::Message;
use iced::{
widget::{column, container, text},
Element, Renderer,
};
use iced_aw::Grid;
pub fn about_widget() -> Element<'static, Message, Renderer> {
let mut grid = Grid::with_columns(2);
grid.insert(text("Program"));
grid.insert(text(built_info::PKG_NAME));
grid.insert(text("Author"));
grid.insert(text(built_info::PKG_AUTHORS));
grid.insert(text("Version"));
grid.insert(text(built_info::PKG_VERSION));
if !built_info::GIT_DIRTY.unwrap_or(false) {
if let Some(commit_hash) = built_info::GIT_COMMIT_HASH {
grid.insert(text("Commit Hash"));
grid.insert(text(commit_hash));
}
}
grid.insert(text("Build Time"));
grid.insert(text(built_info::BUILT_TIME_UTC));
grid.insert(text("Rust Version ")); // adding some space in grid since it is the longest text
grid.insert(text(built_info::RUSTC_VERSION));
let content = column![
text("About")
.style(styles::text_styles::purple_text_theme())
.size(25),
grid
]
.spacing(10);
container(content)
.style(styles::container_styles::first_class_container_theme())
.width(1000)
.padding(5)
.into()
}
mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}