team-ljyzipelo

공개

모든 플랫폼의 공통 응용 프로그램 아이콘을 적용함

작성자
호시노 히나타
작성 시각
커밋
16886eb218fba1b4b99d9a4c22ab918c01973dee
부모
d36e672
이 시점의 파일 보기

변경된 파일 17개

+109-1
수정docs/ui-design-v0.1.md+8-0
@@ -363,3 +363,11 @@
363363## 12. 범위 밖
364364
365365다크 모드, 설정 화면, 미리보기, 최근 연 파일 목록, 언어 선택, 화면 크기에 따른 글자 크기 조절, 기존 압축파일 재암호화는 v0.1 이후에 다룬다.
366추가:
367추가: ## 공통 응용 프로그램 아이콘
368추가:
369추가: 모든 Zipelo 플랫폼과 후속 응용 프로그램은 `experiments/rust-ui-memory-app/src/assets/icons/zipelo.png`를 공통 원본으로 사용한다. 사용자가 제공한 원본의 모양과 투명도를 유지하며 별도 디자인으로 대체하지 않는다.
370추가:
371추가: - `zipelo-256.png`: 실행 창과 Ubuntu의 hicolor 앱 아이콘이다.
372추가: - `zipelo.ico`: Windows 실행 파일, 설치 및 제거 프로그램의 아이콘이다. 16, 24, 32, 48, 64, 128, 256픽셀을 포함한다.
373추가: - 파생 파일은 공통 PNG에서 Lanczos 축소로 만든다. 새 플랫폼의 아이콘 형식도 같은 원본에서 변환한다.
추가experiments/rust-ui-memory-app/build.rs+58-0
@@ -0,0 +1,58 @@
1추가: use std::{env, path::PathBuf, process::Command};
2추가:
3추가: fn main() {
4추가: println!("cargo:rerun-if-changed=src/assets/icons/zipelo.ico");
5추가: println!("cargo:rerun-if-env-changed=RC");
6추가: if env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows")
7추가: || env::var_os("CARGO_FEATURE_UI").is_none()
8추가: {
9추가: return;
10추가: }
11추가: let output = PathBuf::from(env::var_os("OUT_DIR").unwrap());
12추가: let icon = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap())
13추가: .join("src/assets/icons/zipelo.ico");
14추가: let resource = output.join("zipelo.rc");
15추가: std::fs::write(
16추가: &resource,
17추가: format!(
18추가: "1 ICON \"{}\"\n",
19추가: icon.display().to_string().replace('\\', "/")
20추가: ),
21추가: )
22추가: .unwrap();
23추가: let msvc = env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc");
24추가: let compiled = output.join(if msvc { "zipelo.res" } else { "zipelo.o" });
25추가: let compiler = env::var("RC").unwrap_or_else(|_| {
26추가: if msvc {
27추가: "rc.exe"
28추가: } else {
29추가: "x86_64-w64-mingw32-windres"
30추가: }
31추가: .into()
32추가: });
33추가: let mut command = Command::new(compiler);
34추가: if msvc {
35추가: command
36추가: .arg("/nologo")
37추가: .arg(format!("/fo{}", compiled.display()))
38추가: .arg(&resource);
39추가: } else {
40추가: command
41추가: .arg("-i")
42추가: .arg(&resource)
43추가: .arg("-o")
44추가: .arg(&compiled)
45추가: .arg("-O")
46추가: .arg("coff");
47추가: }
48추가: assert!(
49추가: command
50추가: .status()
51추가: .expect("Windows 리소스 컴파일러가 필요함")
52추가: .success()
53추가: );
54추가: println!(
55추가: "cargo:rustc-link-arg-bin=zipelo-ui-memory-app={}",
56추가: compiled.display()
57추가: );
58추가: }
추가experiments/rust-ui-memory-app/src/app_icon.rs+4-0
@@ -0,0 +1,4 @@
1추가: pub fn load() -> eframe::egui::IconData {
2추가: eframe::icon_data::from_png_bytes(include_bytes!("assets/icons/zipelo-256.png"))
3추가: .expect("공통 앱 아이콘 PNG가 유효해야 함")
4추가: }
수정experiments/rust-ui-memory-app/src/archive_screen.rs+1-0
@@ -153,6 +153,7 @@ impl WorkWindow {
153153 }
154154 let mut builder = egui::ViewportBuilder::default()
155155 .with_title(title)
156추가: .with_icon(crate::app_icon::load())
156157 .with_decorations(decorations)
157158 .with_inner_size(size)
158159 .with_resizable(false)
추가experiments/rust-ui-memory-app/src/assets/icons/zipelo-256.png

바이너리 파일이라 Diff를 표시하지 않아요.

파일 내려받기
추가experiments/rust-ui-memory-app/src/assets/icons/zipelo.ico

바이너리 파일이라 Diff를 표시하지 않아요.

파일 내려받기
추가experiments/rust-ui-memory-app/src/assets/icons/zipelo.png

바이너리 파일이라 Diff를 표시하지 않아요.

파일 내려받기
수정experiments/rust-ui-memory-app/src/lib.rs+3-0
@@ -23,3 +23,6 @@ pub mod archive_theme;
2323pub mod window_frame;
2424
2525pub mod archive_path;
26추가:
27추가: #[cfg(feature = "ui")]
28추가: pub mod app_icon;
수정experiments/rust-ui-memory-app/src/renderer.rs+4-0
@@ -30,6 +30,10 @@ pub fn try_backends<E>(
3030}
3131
3232pub fn options(backend: Backend, mut options: eframe::NativeOptions) -> eframe::NativeOptions {
33추가: options.viewport = options
34추가: .viewport
35추가: .with_app_id("zipelo")
36추가: .with_icon(zipelo_ui_memory_app::app_icon::load());
3337 options.renderer = eframe::Renderer::Glow;
3438 options.run_and_return = true;
3539 #[cfg(target_os = "windows")]
수정packaging/ubuntu/rust/build.py+3-0
@@ -43,6 +43,9 @@ def build(args):
4343 desktop = stage / "usr/share/applications"
4444 desktop.mkdir(parents=True)
4545 shutil.copyfile(Path(__file__).with_name("zipelo.desktop"), desktop / "zipelo.desktop")
46추가: icons = stage / "usr/share/icons/hicolor/256x256/apps"
47추가: icons.mkdir(parents=True)
48추가: shutil.copyfile(ROOT / "experiments/rust-ui-memory-app/src/assets/icons/zipelo-256.png", icons / "zipelo.png")
4649 subprocess.run(["desktop-file-validate", str(desktop / "zipelo.desktop")], check=True)
4750 shutil.copyfile(ROOT / "LICENSE", docs / "copyright")
4851 control = stage / "DEBIAN"
수정packaging/ubuntu/rust/postinst+3-0
@@ -1,5 +1,8 @@
11#!/bin/sh
22set -eu
3추가: if command -v gtk-update-icon-cache >/dev/null 2>&1; then
4추가: gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor
5추가: fi
36if command -v update-desktop-database >/dev/null 2>&1; then
47 update-desktop-database /usr/share/applications
58fi
수정packaging/ubuntu/rust/postrm+3-0
@@ -1,5 +1,8 @@
11#!/bin/sh
22set -eu
3추가: if command -v gtk-update-icon-cache >/dev/null 2>&1; then
4추가: gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor
5추가: fi
36if command -v update-desktop-database >/dev/null 2>&1; then
47 update-desktop-database /usr/share/applications
58fi
수정packaging/ubuntu/rust/zipelo.desktop+1-1
@@ -3,7 +3,7 @@ Type=Application
33Name=Zipelo
44Exec=/usr/bin/zipelo %f
55TryExec=/usr/bin/zipelo
6삭제: Icon=package-x-generic
6추가: Icon=zipelo
77Terminal=false
88Categories=Utility;Archiving;
99MimeType=application/zip;application/x-7z-compressed;application/x-compressed-tar;application/gzip;application/x-tar;
수정packaging/windows/rust/build.py+1-0
@@ -88,6 +88,7 @@ def build(args):
8888 "profile": args.profile, "target": TARGET, "files": records}
8989 (payload / "BUILD-INFO.json").write_text(json.dumps(records, indent=4) + "\n", encoding="utf-8")
9090 shutil.copyfile(Path(__file__).with_name("installer.nsi"), output / "installer.nsi")
91추가: shutil.copyfile(ROOT / "experiments/rust-ui-memory-app/src/assets/icons/zipelo.ico", output / "zipelo.ico")
9192 subprocess.run(["makensis", "-WX", "installer.nsi"], cwd=output, check=True)
9293 installer = output / "Zipelo-0.1.0-dev-windows-x64-setup.exe"
9394 if pe_machine(installer) not in (0x14C, 0x8664):
수정packaging/windows/rust/installer.nsi+8-0
@@ -13,6 +13,8 @@ SetCompressor /SOLID lzma
1313SetOverwrite off
1414AllowSkipFiles off
1515ShowInstDetails show
16추가: !define MUI_ICON "zipelo.ico"
17추가: !define MUI_UNICON "zipelo.ico"
1618!define MUI_ABORTWARNING
1719!define MUI_CUSTOMFUNCTION_ABORT Rollback
1820!insertmacro MUI_PAGE_WELCOME
@@ -111,6 +113,7 @@ Section "Zipelo"
111113 IfErrors failed
112114 StrCpy $UninstallOwned 1
113115 WriteRegStr HKCU "${UNKEY}" "DisplayName" "Zipelo 개발판"
116추가: WriteRegStr HKCU "${UNKEY}" "DisplayIcon" '$\"$INSTDIR\Zipelo.exe$\",0'
114117 WriteRegStr HKCU "${UNKEY}" "DisplayVersion" "0.1.0-dev"
115118 WriteRegStr HKCU "${UNKEY}" "UninstallString" '$\"$INSTDIR\Uninstall.exe$\"'
116119 IfErrors failed
@@ -134,6 +137,7 @@ Function Rollback
134137 Delete "$SMPROGRAMS\Zipelo 개발판.lnk"
135138 ${EndIf}
136139 ${If} $UninstallOwned == 1
140추가: DeleteRegValue HKCU "${UNKEY}" "DisplayIcon"
137141 DeleteRegValue HKCU "${UNKEY}" "DisplayName"
138142 DeleteRegValue HKCU "${UNKEY}" "DisplayVersion"
139143 DeleteRegValue HKCU "${UNKEY}" "UninstallString"
@@ -179,6 +183,7 @@ Function ApplyAssociations
179183 Pop $0
180184 ClearErrors
181185 WriteRegStr HKCU "${PROGKEY}" "" "Zipelo 압축파일"
186추가: WriteRegStr HKCU "${PROGKEY}\DefaultIcon" "" '$\"$INSTDIR\Zipelo.exe$\",0'
182187 WriteRegStr HKCU "${PROGKEY}\shell\open\command" "" '$\"$INSTDIR\Zipelo.exe$\" $\"%1$\"'
183188 WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationName" "Zipelo 개발판"
184189 WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationDescription" "압축파일 열기와 풀기"
@@ -247,11 +252,14 @@ Section "Uninstall"
247252 DeleteRegKey /ifempty HKCU "${APPKEY}\Capabilities"
248253 DeleteRegKey /ifempty HKCU "${APPKEY}"
249254 DeleteRegValue HKCU "${PROGKEY}\shell\open\command" ""
255추가: DeleteRegValue HKCU "${PROGKEY}\DefaultIcon" ""
256추가: DeleteRegKey /ifempty HKCU "${PROGKEY}\DefaultIcon"
250257 DeleteRegValue HKCU "${PROGKEY}" ""
251258 DeleteRegKey /ifempty HKCU "${PROGKEY}\shell\open\command"
252259 DeleteRegKey /ifempty HKCU "${PROGKEY}\shell\open"
253260 DeleteRegKey /ifempty HKCU "${PROGKEY}\shell"
254261 DeleteRegKey /ifempty HKCU "${PROGKEY}"
262추가: DeleteRegValue HKCU "${UNKEY}" "DisplayIcon"
255263 DeleteRegValue HKCU "${UNKEY}" "DisplayName"
256264 DeleteRegValue HKCU "${UNKEY}" "DisplayVersion"
257265 DeleteRegValue HKCU "${UNKEY}" "UninstallString"
수정tests/ci/test_windows_installer.py+1-0
@@ -60,6 +60,7 @@ class InstallerInputTests(unittest.TestCase):
6060 for name in ("Zipelo.exe", "zipelo-archive-worker.exe", "LICENSE", "BUILD-INFO.json", "THIRD-PARTY-LICENSES.txt"):
6161 (payload / name).write_bytes(b"compile-only test fixture")
6262 shutil.copyfile(ROOT / "packaging/windows/rust/installer.nsi", self.root / "installer.nsi")
63추가: shutil.copyfile(ROOT / "experiments/rust-ui-memory-app/src/assets/icons/zipelo.ico", self.root / "zipelo.ico")
6364 completed = subprocess.run(["makensis", "-WX", "installer.nsi"], cwd=self.root,
6465 stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
6566 self.assertEqual(completed.returncode, 0, completed.stdout)
수정tests/rust-app-ui/renderer_fallback.rs+11-0
@@ -79,3 +79,14 @@ fn options_keep_event_loop_available_for_retry() {
7979 assert!(options.run_and_return);
8080 assert!(matches!(options.renderer, eframe::Renderer::Glow));
8181}
82추가:
83추가: #[test]
84추가: fn application_windows_use_the_shared_transparent_icon() {
85추가: let icon = zipelo_ui_memory_app::app_icon::load();
86추가: assert_eq!((icon.width, icon.height), (256, 256));
87추가: assert_eq!(icon.rgba[3], 0);
88추가: assert!(icon.rgba.chunks_exact(4).any(|pixel| pixel[3] == 255));
89추가: let options = renderer::options(Backend::Glow, eframe::NativeOptions::default());
90추가: assert_eq!(options.viewport.app_id.as_deref(), Some("zipelo"));
91추가: assert_eq!(options.viewport.icon.unwrap().rgba, icon.rgba);
92추가: }