Design Popup
- Create crates
This commit is contained in:
parent
2e73350d36
commit
72eeef781f
6
.gitignore
vendored
6
.gitignore
vendored
@ -20,3 +20,9 @@ Cargo.lock
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
||||
test/
|
||||
|
||||
12
Cargo.toml
Normal file
12
Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = [
|
||||
"alarm_widg_config", "alarm_widg",
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
codegen-units = 1
|
||||
strip = "symbols"
|
||||
opt-level = "z"
|
||||
panic = "abort"
|
||||
14
alarm_widg/Cargo.toml
Normal file
14
alarm_widg/Cargo.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "alarm_widg"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
alarm_widg_config = {path = "../alarm_widg_config"}
|
||||
dirs = "6.0.0"
|
||||
i-slint-backend-winit = "1.15.1"
|
||||
slint = "1.15.1"
|
||||
toml = "1.0.3"
|
||||
|
||||
[build-dependencies]
|
||||
slint-build = "1.15.1"
|
||||
3
alarm_widg/src/main.rs
Normal file
3
alarm_widg/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
94
alarm_widg/ui/widget-popup.slint
Normal file
94
alarm_widg/ui/widget-popup.slint
Normal file
@ -0,0 +1,94 @@
|
||||
export component MainWindow inherits Window {
|
||||
|
||||
in property <string> alarm_name: "Sample Alarm";
|
||||
in property <string> alarm_time: "11:45AM";
|
||||
in property <color> alarm_color: #232323;
|
||||
in property <int> popup_width: 300;
|
||||
in property <int> popup_height: 124;
|
||||
in property <string> default_font: "IosevkaTermSlab Nerd Font Mono";
|
||||
in property <string> alarm_icon: "🕓";
|
||||
|
||||
always-on-top: true;
|
||||
no-frame: true;
|
||||
width: popup_width *1px;
|
||||
height: popup_height *1px;
|
||||
background: transparent;
|
||||
default-font-family: default_font;
|
||||
|
||||
Rectangle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12px;
|
||||
background: alarm_color;
|
||||
drop-shadow-blur: 15px;
|
||||
drop-shadow-color: #00000066;
|
||||
|
||||
GridLayout {
|
||||
padding: 12px;
|
||||
width: 100%;
|
||||
|
||||
// Icon
|
||||
Rectangle {
|
||||
row: 0;
|
||||
col: 0;
|
||||
colspan: 1;
|
||||
rowspan: 3;
|
||||
height: 100px;
|
||||
width: 86px;
|
||||
//background: #a13939;
|
||||
Text {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
vertical-alignment: center;
|
||||
horizontal-alignment: center;
|
||||
font-size: 85px;
|
||||
text: root.alarm_icon;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
// Name
|
||||
Rectangle {
|
||||
row: 0;
|
||||
col: 1;
|
||||
colspan: 4;
|
||||
rowspan: 1;
|
||||
height: 40px;
|
||||
//width: 211px;
|
||||
width: 186px;
|
||||
//min-width: 0px;
|
||||
//background: #2d888f;
|
||||
Text {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
vertical-alignment: center;
|
||||
horizontal-alignment: TextHorizontalAlignment.left;
|
||||
font-size: 18px;
|
||||
text: root.alarm_name;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
// Time
|
||||
Rectangle {
|
||||
row: 1;
|
||||
col: 1;
|
||||
colspan: 3;
|
||||
rowspan: 2;
|
||||
height: 60px;
|
||||
width: 186px;
|
||||
//background: #575757;
|
||||
|
||||
Text {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
vertical-alignment: center;
|
||||
horizontal-alignment: TextHorizontalAlignment.left;
|
||||
font-size: 50px;
|
||||
text: root.alarm_time;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
alarm_widg_config/Cargo.toml
Normal file
9
alarm_widg_config/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "alarm_widg_config"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
dirs = "6.0.0"
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
toml = "1.0.3"
|
||||
14
alarm_widg_config/src/lib.rs
Normal file
14
alarm_widg_config/src/lib.rs
Normal file
@ -0,0 +1,14 @@
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user