Base gui, player, side, top nav, song list

Super happy with this
This commit is contained in:
Gvidas Juknevičius 2024-11-14 00:56:02 +02:00
parent 4dcd36c3d8
commit 9bcfcb9209
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB
22 changed files with 859 additions and 25 deletions

427
Cargo.lock generated
View File

@ -23,6 +23,10 @@ name = "accesskit"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74a4b14f3d99c1255dcba8f45621ab1a2e7540a0009652d33989005a4d0bfc6b"
dependencies = [
"enumn",
"serde",
]
[[package]]
name = "accesskit_consumer"
@ -113,6 +117,7 @@ dependencies = [
"cfg-if",
"getrandom",
"once_cell",
"serde",
"version_check",
"zerocopy",
]
@ -515,6 +520,18 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "base64"
version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
[[package]]
name = "base64"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bit-set"
version = "0.5.3"
@ -988,6 +1005,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
[[package]]
name = "data-url"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a"
[[package]]
name = "derivative"
version = "2.2.0"
@ -1047,6 +1070,16 @@ checksum = "20930a432bbd57a6d55e07976089708d4893f3d556cf42a0d79e9e321fa73b10"
dependencies = [
"bytemuck",
"color-hex",
"serde",
]
[[package]]
name = "ecolor"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e6b451ff1143f6de0f33fc7f1b68fecfd2c7de06e104de96c4514de3f5396f8"
dependencies = [
"emath 0.28.1",
]
[[package]]
@ -1058,7 +1091,7 @@ dependencies = [
"bytemuck",
"cocoa",
"document-features",
"egui",
"egui 0.27.2",
"egui-wgpu",
"egui-winit",
"egui_glow",
@ -1091,9 +1124,31 @@ checksum = "584c5d1bf9a67b25778a3323af222dbe1a1feb532190e103901187f92c7fe29a"
dependencies = [
"accesskit",
"ahash",
"epaint",
"epaint 0.27.2",
"log",
"nohash-hasher",
"serde",
]
[[package]]
name = "egui"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20c97e70a2768de630f161bb5392cbd3874fcf72868f14df0e002e82e06cb798"
dependencies = [
"ahash",
"emath 0.28.1",
"epaint 0.28.1",
"nohash-hasher",
]
[[package]]
name = "egui-aesthetix"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0b91e1b07193fa9bc71849e39a76d30ffd6a2f57bfc54552e3a2df263da577b"
dependencies = [
"egui 0.28.1",
]
[[package]]
@ -1104,8 +1159,8 @@ checksum = "469ff65843f88a702b731a1532b7d03b0e8e96d283e70f3a22b0e06c46cb9b37"
dependencies = [
"bytemuck",
"document-features",
"egui",
"epaint",
"egui 0.27.2",
"epaint 0.27.2",
"log",
"thiserror",
"type-map",
@ -1122,7 +1177,7 @@ checksum = "2e3da0cbe020f341450c599b35b92de4af7b00abde85624fd16f09c885573609"
dependencies = [
"accesskit_winit",
"arboard",
"egui",
"egui 0.27.2",
"log",
"raw-window-handle 0.6.2",
"smithay-clipboard",
@ -1131,6 +1186,22 @@ dependencies = [
"winit",
]
[[package]]
name = "egui_extras"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b78779f35ded1a853786c9ce0b43fe1053e10a21ea3b23ebea411805ce41593"
dependencies = [
"egui 0.27.2",
"ehttp",
"enum-map",
"image",
"log",
"mime_guess2",
"resvg",
"serde",
]
[[package]]
name = "egui_glow"
version = "0.27.2"
@ -1138,7 +1209,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0e5d975f3c86edc3d35b1db88bb27c15dde7c55d3b5af164968ab5ede3f44ca"
dependencies = [
"bytemuck",
"egui",
"egui 0.27.2",
"glow",
"log",
"memoffset 0.9.1",
@ -1147,6 +1218,20 @@ dependencies = [
"winit",
]
[[package]]
name = "ehttp"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59a81c221a1e4dad06cb9c9deb19aea1193a5eea084e8cd42d869068132bf876"
dependencies = [
"document-features",
"js-sys",
"ureq",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "emath"
version = "0.27.2"
@ -1154,6 +1239,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4c3a552cfca14630702449d35f41c84a0d15963273771c6059175a803620f3f"
dependencies = [
"bytemuck",
"serde",
]
[[package]]
name = "emath"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a6a21708405ea88f63d8309650b4d77431f4bc28fb9d8e6f77d3963b51249e6"
[[package]]
name = "enum-map"
version = "2.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9"
dependencies = [
"enum-map-derive",
"serde",
]
[[package]]
name = "enum-map-derive"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.87",
]
[[package]]
@ -1177,6 +1290,17 @@ dependencies = [
"syn 2.0.87",
]
[[package]]
name = "enumn"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.87",
]
[[package]]
name = "env_filter"
version = "0.1.2"
@ -1209,11 +1333,26 @@ dependencies = [
"ab_glyph",
"ahash",
"bytemuck",
"ecolor",
"emath",
"ecolor 0.27.2",
"emath 0.27.2",
"log",
"nohash-hasher",
"parking_lot",
"serde",
]
[[package]]
name = "epaint"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f0dcc0a0771e7500e94cd1cb797bd13c9f23b9409bdc3c824e2cbc562b7fa01"
dependencies = [
"ab_glyph",
"ahash",
"ecolor 0.28.1",
"emath 0.28.1",
"nohash-hasher",
"parking_lot",
]
[[package]]
@ -1310,6 +1449,12 @@ dependencies = [
"miniz_oxide",
]
[[package]]
name = "float-cmp"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
[[package]]
name = "foreign-types"
version = "0.5.0"
@ -1701,6 +1846,12 @@ dependencies = [
"png",
]
[[package]]
name = "imagesize"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284"
[[package]]
name = "indexmap"
version = "2.6.0"
@ -1800,6 +1951,15 @@ version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
[[package]]
name = "kurbo"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b"
dependencies = [
"arrayvec",
]
[[package]]
name = "lazy_static"
version = "1.5.0"
@ -1934,6 +2094,22 @@ dependencies = [
"paste",
]
[[package]]
name = "mime"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "mime_guess2"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25a3333bb1609500601edc766a39b4c1772874a4ce26022f4d866854dc020c41"
dependencies = [
"mime",
"unicase",
]
[[package]]
name = "miniz_oxide"
version = "0.8.0"
@ -2299,6 +2475,12 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pico-args"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
[[package]]
name = "pin-project-lite"
version = "0.2.15"
@ -2481,6 +2663,12 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
[[package]]
name = "rctree"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f"
[[package]]
name = "redox_syscall"
version = "0.3.5"
@ -2534,6 +2722,50 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
[[package]]
name = "resvg"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cadccb3d99a9efb8e5e00c16fbb732cbe400db2ec7fc004697ee7d97d86cf1f4"
dependencies = [
"log",
"pico-args",
"rgb",
"svgtypes",
"tiny-skia",
"usvg",
]
[[package]]
name = "rgb"
version = "0.8.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
dependencies = [
"bytemuck",
]
[[package]]
name = "ring"
version = "0.17.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
dependencies = [
"cc",
"cfg-if",
"getrandom",
"libc",
"spin",
"untrusted",
"windows-sys 0.52.0",
]
[[package]]
name = "roxmltree"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f"
[[package]]
name = "rustc-demangle"
version = "0.1.24"
@ -2573,6 +2805,38 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "rustls"
version = "0.23.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e"
dependencies = [
"log",
"once_cell",
"ring",
"rustls-pki-types",
"rustls-webpki",
"subtle",
"zeroize",
]
[[package]]
name = "rustls-pki-types"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
[[package]]
name = "rustls-webpki"
version = "0.102.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
dependencies = [
"ring",
"rustls-pki-types",
"untrusted",
]
[[package]]
name = "ryu"
version = "1.0.18"
@ -2688,6 +2952,21 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
[[package]]
name = "simplecss"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a11be7c62927d9427e9f40f3444d5499d868648e2edbc4e2116de69e7ec0e89d"
dependencies = [
"log",
]
[[package]]
name = "siphasher"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "slab"
version = "0.4.9"
@ -2792,6 +3071,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
[[package]]
name = "spirv"
version = "0.3.0+sdk-1.3.268.0"
@ -2812,6 +3097,9 @@ name = "strict-num"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
dependencies = [
"float-cmp",
]
[[package]]
name = "strsim"
@ -2819,6 +3107,22 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "subtle"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "svgtypes"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e44e288cd960318917cbd540340968b90becc8bc81f171345d706e7a89d9d70"
dependencies = [
"kurbo",
"siphasher",
]
[[package]]
name = "syn"
version = "1.0.109"
@ -2894,6 +3198,7 @@ dependencies = [
"bytemuck",
"cfg-if",
"log",
"png",
"tiny-skia-path",
]
@ -3041,6 +3346,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "unicase"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df"
[[package]]
name = "unicode-bidi"
version = "0.3.17"
@ -3080,6 +3391,28 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "ureq"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a"
dependencies = [
"base64 0.22.1",
"flate2",
"log",
"once_cell",
"rustls",
"rustls-pki-types",
"url",
"webpki-roots",
]
[[package]]
name = "url"
version = "2.5.2"
@ -3092,6 +3425,50 @@ dependencies = [
"serde",
]
[[package]]
name = "usvg"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b0a51b72ab80ca511d126b77feeeb4fb1e972764653e61feac30adc161a756"
dependencies = [
"base64 0.21.7",
"log",
"pico-args",
"usvg-parser",
"usvg-tree",
"xmlwriter",
]
[[package]]
name = "usvg-parser"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bd4e3c291f45d152929a31f0f6c819245e2921bfd01e7bd91201a9af39a2bdc"
dependencies = [
"data-url",
"flate2",
"imagesize",
"kurbo",
"log",
"roxmltree",
"simplecss",
"siphasher",
"svgtypes",
"usvg-tree",
]
[[package]]
name = "usvg-tree"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ee3d202ebdb97a6215604b8f5b4d6ef9024efd623cf2e373a6416ba976ec7d3"
dependencies = [
"rctree",
"strict-num",
"svgtypes",
"tiny-skia-path",
]
[[package]]
name = "utf8parse"
version = "0.2.2"
@ -3374,6 +3751,15 @@ dependencies = [
"web-sys",
]
[[package]]
name = "webpki-roots"
version = "0.26.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958"
dependencies = [
"rustls-pki-types",
]
[[package]]
name = "wgpu"
version = "0.19.4"
@ -3919,6 +4305,12 @@ version = "0.8.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26"
[[package]]
name = "xmlwriter"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
[[package]]
name = "xmpd-cli"
version = "2.0.0"
@ -3937,6 +4329,14 @@ dependencies = [
"xmpd-manifest",
]
[[package]]
name = "xmpd-derive"
version = "2.0.0"
dependencies = [
"quote",
"syn 2.0.87",
]
[[package]]
name = "xmpd-dl"
version = "2.0.0"
@ -3947,10 +4347,13 @@ version = "2.0.0"
dependencies = [
"anyhow",
"eframe",
"egui",
"egui 0.27.2",
"egui-aesthetix",
"egui_extras",
"lazy_static",
"log",
"tokio",
"xmpd-derive",
"xmpd-manifest",
]
@ -4052,6 +4455,12 @@ dependencies = [
"syn 2.0.87",
]
[[package]]
name = "zeroize"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
[[package]]
name = "zvariant"
version = "3.15.2"

View File

@ -4,7 +4,7 @@ members=[
"xmpd-core",
"xmpd-manifest",
"xmpd-gui",
"xmpd-cli", "xmpd-dl",
"xmpd-cli", "xmpd-dl", "xmpd-derive",
# "xmpd-tui"
]

4
assets/next.svg Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 15H2V1H4L10 7V1H14V15H10V9L4 15Z" fill="#FFFFFF"/>
</svg>

After

Width:  |  Height:  |  Size: 295 B

6
assets/pause.svg Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" stroke="#FFFFFF" stroke-width="2"/>
<path d="M14 9L14 15" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10 9L10 15" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 604 B

12
assets/play.svg Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#FFFFFF" height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 60 60" xml:space="preserve">
<g>
<path d="M45.563,29.174l-22-15c-0.307-0.208-0.703-0.231-1.031-0.058C22.205,14.289,22,14.629,22,15v30
c0,0.371,0.205,0.711,0.533,0.884C22.679,45.962,22.84,46,23,46c0.197,0,0.394-0.059,0.563-0.174l22-15
C45.836,30.64,46,30.331,46,30S45.836,29.36,45.563,29.174z M24,43.107V16.893L43.225,30L24,43.107z"/>
<path d="M30,0C13.458,0,0,13.458,0,30s13.458,30,30,30s30-13.458,30-30S46.542,0,30,0z M30,58C14.561,58,2,45.439,2,30
S14.561,2,30,2s28,12.561,28,28S45.439,58,30,58z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 827 B

4
assets/prev.svg Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2 1H6V7L12 1H14V15H12L6 9V15H2V1Z" fill="#FFFFFF"/>
</svg>

After

Width:  |  Height:  |  Size: 294 B

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,52 @@
"""
Converts legacy manifest to v1 json
"""
import uuid
import json
import sys
def main(inp: str, out: str):
manifest = {
"songs": {},
"playlists": {}
}
with open(inp, "r", encoding="utf-8") as f:
data = json.load(f)
_format = data["format"] # unused
for pname in data["playlists"]:
pid = str(uuid.uuid4())
manifest["playlists"][pid] = {
"name": pname,
"author": "Unknown",
"songs": []
}
for sname in data["playlists"][pname]["songs"]:
asn = sname.split(" - ", 2)
author = None
name = None
if len(asn) < 2:
author = "Unknown"
name = sname
else:
author = asn[0]
name = asn[1]
song = data["playlists"][pname]["songs"][sname]
sid = str(uuid.uuid4())
manifest["playlists"][pid]["songs"].append(sid)
manifest["songs"][sid] = {
"name": name,
"author": author,
"url": song["url"],
"source_type": song["typ"]
}
converted = json.dumps(manifest)
with open(out, "w", encoding="utf-8") as f:
f.write(converted)
if __name__ == "__main__":
if len(sys.argv) < 3:
print(f"Usage: {sys.argv[0]} [in] [out]")
sys.exit(1)
main(sys.argv[1], sys.argv[2])

15
xmpd-derive/Cargo.toml Normal file
View File

@ -0,0 +1,15 @@
[package]
name = "xmpd-derive"
edition = "2021"
version.workspace = true
repository.workspace = true
license.workspace = true
authors.workspace = true
[lib]
proc-macro=true
[dependencies]
quote = "1.0.37"
syn = "2.0.87"
# xmpd-gui.path = "../xmpd-gui"

26
xmpd-derive/src/lib.rs Normal file
View File

@ -0,0 +1,26 @@
use proc_macro::TokenStream;
#[macro_use]
extern crate quote;
#[macro_use]
extern crate syn;
extern crate proc_macro;
#[proc_macro_derive(UiComponent)]
pub fn ui_comp_impl(input: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(input).unwrap();
let name = &ast.ident;
let vis = &ast.vis;
let attr = &ast.attrs;
let data = &ast.data;
let generics = &ast.generics;
let gen = quote! {
impl xmp
};
gen.into()
}

View File

@ -19,9 +19,12 @@ bench = false
[dependencies]
xmpd-manifest.path = "../xmpd-manifest"
xmpd-derive.path = "../xmpd-derive"
egui.workspace = true
eframe.workspace = true
tokio.workspace = true
anyhow.workspace = true
lazy_static.workspace = true
log.workspace = true
egui_extras.workspace = true
egui-aesthetix = "0.2.4"

View File

@ -0,0 +1,40 @@
use xmpd_manifest::store::BaseStore;
use super::CompUi;
#[derive(Debug, Default)]
pub struct LeftNav;
component_register!(LeftNav);
impl CompUi for LeftNav {
fn draw(ui: &mut egui::Ui, state: &mut crate::GuiState) -> crate::Result<()> {
let height = ui.available_height();
egui::ScrollArea::vertical().id_source("left_nav").show(ui, |ui| {
//ui.horizontal(|ui| {
ui.vertical(|ui| {
let playlists = state.manifest.store().get_playlists();
for (_pid, playlist) in playlists.iter() {
ui.horizontal(|ui| {
ui.add_space(5.0);
ui.add(
egui::Image::new(crate::data::NOTE_ICON)
.tint(crate::data::C_ACCENT)
.fit_to_exact_size(egui::Vec2::new(32.0, 32.0))
);
ui.label(playlist.name());
ui.with_layout(egui::Layout::bottom_up(egui::Align::RIGHT), |ui| {
ui.label(format!("{}", playlist.songs().len()));
});
});
ui.separator();
}
});
// });
});
Ok(())
}
}

View File

@ -0,0 +1,16 @@
use std::sync::{MutexGuard, PoisonError};
use crate::GuiState;
pub mod left_nav;
pub mod song_list;
pub mod top_nav;
pub mod player;
pub trait CompUi {
fn draw(ui: &mut egui::Ui, state: &mut GuiState) -> crate::Result<()>;
}
pub trait CompGetter {
fn get() -> crate::Result<MutexGuard<'static, Self>>;
}

View File

@ -0,0 +1,55 @@
use egui::{Stroke, Vec2};
use super::{CompGetter, CompUi};
#[derive(Debug, Default)]
pub struct Player {
slider_progress: usize
}
component_register!(Player);
impl CompUi for Player {
fn draw(ui: &mut egui::Ui, state: &mut crate::GuiState) -> crate::Result<()> {
let avail = ui.available_size();
ui.vertical_centered_justified(|ui| {
ui.add_space(3.0);
ui.horizontal(|ui| {
{
ui.add_space(avail.x * 0.05 / 2.0);
let mut slf = handle_error_ui!(Player::get());
let slider = egui::Slider::new(&mut slf.slider_progress, 0..=100)
.show_value(false);
ui.style_mut().spacing.slider_width = avail.x * 0.90;
let s = Stroke {
color: crate::data::C_ACCENT,
width: 2.0
};
ui.style_mut().visuals.widgets.inactive.fg_stroke = s;
ui.style_mut().visuals.widgets.active.fg_stroke = s;
ui.add(slider);
ui.label("00:00");
}
});
ui.horizontal(|ui| {
ui.add_space((avail.x / 2.0) - 16.0 - 8.0 - ui.spacing().item_spacing.x);
let prev = egui::Image::new(crate::data::PREV_ICON)
.tint(crate::data::C_ACCENT)
.max_size(Vec2::new(16.0, 16.0));
let play = egui::Image::new(crate::data::PLAY_ICON)
.tint(crate::data::C_ACCENT)
.max_size(Vec2::new(16.0, 16.0));
let next = egui::Image::new(crate::data::NEXT_ICON)
.tint(crate::data::C_ACCENT)
.max_size(Vec2::new(16.0, 16.0));
if ui.add(prev).clicked() {}
if ui.add(play).clicked() {}
if ui.add(next).clicked() {}
});
ui.add_space(3.0);
});
Ok(())
}
}

View File

@ -0,0 +1,34 @@
use egui::{Color32, Vec2};
use xmpd_manifest::store::BaseStore;
use super::CompUi;
#[derive(Debug, Default)]
pub struct SongList;
component_register!(SongList);
impl CompUi for SongList {
fn draw(ui: &mut egui::Ui, state: &mut crate::GuiState) -> crate::Result<()> {
egui::ScrollArea::vertical().id_source("song_list").show(ui, |ui| {
ui.vertical(|ui| {
let songs = state.manifest.store().get_songs();
for (sid, song) in songs.iter() {
ui.horizontal(|ui| {
ui.add(
egui::Image::new(crate::data::NOTE_ICON)
.tint(crate::data::C_ACCENT)
.fit_to_exact_size(Vec2::new(32.0, 32.0))
);
ui.label(song.author());
ui.strong(" - ");
ui.label(song.name());
});
ui.separator();
}
});
});
Ok(())
}
}

View File

@ -0,0 +1,30 @@
use super::CompUi;
#[derive(Debug, Default)]
pub struct TopNav;
component_register!(TopNav);
impl CompUi for TopNav {
fn draw(ui: &mut egui::Ui, state: &mut crate::GuiState) -> crate::Result<()> {
ui.add_space(3.0);
ui.horizontal(|ui| {
ui.add_space(3.0);
egui::menu::bar(ui, |ui| {
ui.menu_button("File", |ui| {
// TBD
});
ui.menu_button("Help", |ui| {
if ui.button("Source").clicked() {
ui.ctx().open_url(egui::OpenUrl::new_tab("https://git.mcorangehq.xyz/XOR64/music"));
}
})
});
});
Ok(())
}
}

18
xmpd-gui/src/data.rs Normal file
View File

@ -0,0 +1,18 @@
// pub const APP_ICON: egui::ImageSource = egui::include_image!("../../assets/app_icon.png");
pub const APP_ICON_BYTES: &[u8] = include_bytes!("../../assets/app_icon.png");
pub const NOTE_ICON: egui::ImageSource = egui::include_image!("../../assets/note.svg");
pub const SEARCH_ICON: egui::ImageSource = egui::include_image!("../../assets/search.svg");
pub const PREV_ICON: egui::ImageSource = egui::include_image!("../../assets/prev.svg");
pub const NEXT_ICON: egui::ImageSource = egui::include_image!("../../assets/next.svg");
pub const PLAY_ICON: egui::ImageSource = egui::include_image!("../../assets/play.svg");
pub const PAUSE_ICON: egui::ImageSource = egui::include_image!("../../assets/pause.svg");
// TODO: Replace this with config for theming
// pub const C_ACCENT: egui::Color32 = egui::Color32::from_rgb(51, 51, 119);
pub const C_ACCENT: egui::Color32 = egui::Color32::from_rgb(5, 102, 146); // #0566F6
pub const C_PRIM_BG: egui::Color32 = egui::Color32::from_rgb(31, 34, 40); // #1F2228
pub const C_SEC_BG: egui::Color32 = egui::Color32::from_rgb(47, 53, 61); // #2f353d
pub const C_TEXT: egui::Color32 = egui::Color32::from_rgb(223, 223, 223); // #dfdfdf

View File

@ -1,12 +1,17 @@
#![feature(async_closure)]
use std::{path::{Path, PathBuf}, sync::mpsc, thread::JoinHandle};
use std::{path::{Path, PathBuf}, time::Duration};
use egui::TextStyle;
use windows::WindowId;
use xmpd_manifest::{store::JsonStore, Manifest};
#[macro_use]
mod macros;
mod main_window;
mod windows;
mod components;
mod data;
mod utils;
const W_NAME: &str = "xmpd v2.0.0a";
@ -15,12 +20,24 @@ type Result<T> = anyhow::Result<T>;
pub fn start(manifest_path: PathBuf) -> Result<()> {
let options = eframe::NativeOptions::default();
let mut state = GuiState::new(&manifest_path)?;
state.windows.toggle(&WindowId::Error, true);
let res = eframe::run_simple_native(W_NAME, options, move |ctx, _frame| {
egui_extras::install_image_loaders(ctx);
state.windows.clone().draw_all(ctx, &mut state);
egui::CentralPanel::default().show(ctx, |ui| main_window::draw(ui, &mut state));
ctx.request_repaint();
egui::CentralPanel::default()
.frame(
egui::Frame::none()
.fill(data::C_PRIM_BG)
.stroke(egui::Stroke::new(
1.0,
data::C_SEC_BG,
)),
)
.show(ctx, |ui| {
ui.style_mut().visuals.override_text_color = Some(crate::data::C_TEXT);
main_window::draw(ui, &mut state)
});
ctx.request_repaint_after(Duration::from_millis(500));
});
if let Err(e) = res { // dumb err value by eframe
anyhow::bail!(e.to_string());

29
xmpd-gui/src/macros.rs Normal file
View File

@ -0,0 +1,29 @@
macro_rules! component_register {
($comp:ident) => {
lazy_static::lazy_static! {
static ref __COMPONENT: std::sync::Arc<std::sync::Mutex<$comp>> =
std::sync::Arc::new(std::sync::Mutex::new($comp::default()));
}
impl crate::components::CompGetter for $comp {
fn get() -> crate::Result<std::sync::MutexGuard<'static, Self>> {
match __COMPONENT.lock() {
Ok(l) => Ok(l),
Err(e) => Err(anyhow::anyhow!(format!("{e:?}"))),
}
}
}
};
}
macro_rules! handle_error_ui {
($val:expr) => {
match $val {
Ok(v) => v,
Err(e) => {
log::error!("Error in ui: {e:?}");
return;
}
}
};
}

View File

@ -1,14 +1,71 @@
use egui::ViewportId;
use xmpd_manifest::store::JsonStore;
use crate::GuiState;
use crate::{components::{CompGetter, CompUi}, GuiState};
pub fn draw(ui: &mut egui::Ui, state: &mut GuiState) -> crate::Result<()> {
ui.label("Hello! this is root of main window");
if ui.button("open iwndow").clicked() {
state.windows.toggle(&crate::windows::WindowId::Error, true);
}
// The central panel the region left after adding TopPanel's and SidePanel's
// ui.heading(format!("Songs ({})", self.manifest.get_song_count()));
let avail = ui.available_size();
ui.vertical(|ui| {
handle_error_ui!(crate::components::top_nav::TopNav::draw(ui, state));
crate::utils::super_separator(ui, crate::data::C_ACCENT, avail.x, 2.0);
let avail = ui.available_size();
ui.horizontal(|ui| {
ui.set_height(avail.y);
ui.group(|ui| {
ui.set_height(avail.y);
ui.set_width(avail.x * 0.25);
handle_error_ui!(crate::components::left_nav::LeftNav::draw(ui, state));
});
handle_error_ui!(crate::components::song_list::SongList::draw(ui, state));
});
egui::TopBottomPanel::new(egui::panel::TopBottomSide::Bottom, "player")
.frame(
egui::Frame::none()
.fill(crate::data::C_PRIM_BG)
.stroke(egui::Stroke::new(
1.0,
crate::data::C_SEC_BG,
)),
)
.show(ui.ctx(), |ui| {
ui.style_mut().visuals.override_text_color = Some(crate::data::C_TEXT);
handle_error_ui!(crate::components::player::Player::draw(ui, state));
});
});
//ui.vertical_centered_justified(|ui| {
// ui.with_layout(egui::Layout::top_down_justified(egui::Align::TOP), |ui| {
// let avail = ui.available_size();
// ui.vertical(|ui| {
// let avail_width = ui.available_width();
// ui.set_height(avail.y);
// ui.vertical(|ui| {
// ui.set_height(avail.y * 0.9);
// ui.horizontal(|ui| {
//
// ui.group(|ui| {
// ui.set_width(avail_width * 0.25);
// handle_error_ui!(crate::components::left_nav::LeftNav::draw(ui, state));
// });
// // crate::utils::super_separator(ui, crate::data::C_ACCENT, 3.0, avail_width);
// // handle_error_ui!(crate::components::song_list::SongList::draw(ui, state));
// });
// // handle_error_ui!(crate::components::player::Player::draw(ui, state));
// });
// });
//
// ui.with_layout(egui::Layout::bottom_up(egui::Align::LEFT), |ui| {
// egui::warn_if_debug_build(ui);
// });
// });
//});
//
Ok(())
}

11
xmpd-gui/src/utils.rs Normal file
View File

@ -0,0 +1,11 @@
pub fn super_separator(ui: &mut egui::Ui, color: egui::Color32, width: f32, height: f32) {
egui::Frame::none()
.fill(color)
// .stroke(egui::Stroke { color: crate::data::C_ACCENT, width: 1.0 })
.show(ui, |ui| {
ui.set_width(width);
ui.set_height(height);
});
}

View File

@ -64,7 +64,6 @@ impl Windows {
if status {
OPEN_WINDOWS.lock().unwrap().insert(id.clone());
} else {
log::debug!("tried to kill");
OPEN_WINDOWS.lock().unwrap().remove(id);
}
}