모든 플랫폼의 공통 응용 프로그램 아이콘을 적용함
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
16886eb218fba1b4b99d9a4c22ab918c01973dee- 부모
- d36e672
변경된 파일 17개
+109-1| @@ -363,3 +363,11 @@ | ||
| 363 | 363 | ## 12. 범위 밖 |
| 364 | 364 | |
| 365 | 365 | 다크 모드, 설정 화면, 미리보기, 최근 연 파일 목록, 언어 선택, 화면 크기에 따른 글자 크기 조절, 기존 압축파일 재암호화는 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 축소로 만든다. 새 플랫폼의 아이콘 형식도 같은 원본에서 변환한다. |
| @@ -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 | 추가: } |
| @@ -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 | 추가: } |
| @@ -153,6 +153,7 @@ impl WorkWindow { | ||
| 153 | 153 | } |
| 154 | 154 | let mut builder = egui::ViewportBuilder::default() |
| 155 | 155 | .with_title(title) |
| 156 | 추가: .with_icon(crate::app_icon::load()) | |
| 156 | 157 | .with_decorations(decorations) |
| 157 | 158 | .with_inner_size(size) |
| 158 | 159 | .with_resizable(false) |
바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기| @@ -23,3 +23,6 @@ pub mod archive_theme; | ||
| 23 | 23 | pub mod window_frame; |
| 24 | 24 | |
| 25 | 25 | pub mod archive_path; |
| 26 | 추가: | |
| 27 | 추가: #[cfg(feature = "ui")] | |
| 28 | 추가: pub mod app_icon; |
| @@ -30,6 +30,10 @@ pub fn try_backends<E>( | ||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | pub 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()); | |
| 33 | 37 | options.renderer = eframe::Renderer::Glow; |
| 34 | 38 | options.run_and_return = true; |
| 35 | 39 | #[cfg(target_os = "windows")] |
| @@ -43,6 +43,9 @@ def build(args): | ||
| 43 | 43 | desktop = stage / "usr/share/applications" |
| 44 | 44 | desktop.mkdir(parents=True) |
| 45 | 45 | 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") | |
| 46 | 49 | subprocess.run(["desktop-file-validate", str(desktop / "zipelo.desktop")], check=True) |
| 47 | 50 | shutil.copyfile(ROOT / "LICENSE", docs / "copyright") |
| 48 | 51 | control = stage / "DEBIAN" |
| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | #!/bin/sh |
| 2 | 2 | set -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 | |
| 3 | 6 | if command -v update-desktop-database >/dev/null 2>&1; then |
| 4 | 7 | update-desktop-database /usr/share/applications |
| 5 | 8 | fi |
| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | #!/bin/sh |
| 2 | 2 | set -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 | |
| 3 | 6 | if command -v update-desktop-database >/dev/null 2>&1; then |
| 4 | 7 | update-desktop-database /usr/share/applications |
| 5 | 8 | fi |
| @@ -3,7 +3,7 @@ Type=Application | ||
| 3 | 3 | Name=Zipelo |
| 4 | 4 | Exec=/usr/bin/zipelo %f |
| 5 | 5 | TryExec=/usr/bin/zipelo |
| 6 | 삭제: Icon=package-x-generic | |
| 6 | 추가: Icon=zipelo | |
| 7 | 7 | Terminal=false |
| 8 | 8 | Categories=Utility;Archiving; |
| 9 | 9 | MimeType=application/zip;application/x-7z-compressed;application/x-compressed-tar;application/gzip;application/x-tar; |
| @@ -88,6 +88,7 @@ def build(args): | ||
| 88 | 88 | "profile": args.profile, "target": TARGET, "files": records} |
| 89 | 89 | (payload / "BUILD-INFO.json").write_text(json.dumps(records, indent=4) + "\n", encoding="utf-8") |
| 90 | 90 | 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") | |
| 91 | 92 | subprocess.run(["makensis", "-WX", "installer.nsi"], cwd=output, check=True) |
| 92 | 93 | installer = output / "Zipelo-0.1.0-dev-windows-x64-setup.exe" |
| 93 | 94 | if pe_machine(installer) not in (0x14C, 0x8664): |
| @@ -13,6 +13,8 @@ SetCompressor /SOLID lzma | ||
| 13 | 13 | SetOverwrite off |
| 14 | 14 | AllowSkipFiles off |
| 15 | 15 | ShowInstDetails show |
| 16 | 추가: !define MUI_ICON "zipelo.ico" | |
| 17 | 추가: !define MUI_UNICON "zipelo.ico" | |
| 16 | 18 | !define MUI_ABORTWARNING |
| 17 | 19 | !define MUI_CUSTOMFUNCTION_ABORT Rollback |
| 18 | 20 | !insertmacro MUI_PAGE_WELCOME |
| @@ -111,6 +113,7 @@ Section "Zipelo" | ||
| 111 | 113 | IfErrors failed |
| 112 | 114 | StrCpy $UninstallOwned 1 |
| 113 | 115 | WriteRegStr HKCU "${UNKEY}" "DisplayName" "Zipelo 개발판" |
| 116 | 추가: WriteRegStr HKCU "${UNKEY}" "DisplayIcon" '$\"$INSTDIR\Zipelo.exe$\",0' | |
| 114 | 117 | WriteRegStr HKCU "${UNKEY}" "DisplayVersion" "0.1.0-dev" |
| 115 | 118 | WriteRegStr HKCU "${UNKEY}" "UninstallString" '$\"$INSTDIR\Uninstall.exe$\"' |
| 116 | 119 | IfErrors failed |
| @@ -134,6 +137,7 @@ Function Rollback | ||
| 134 | 137 | Delete "$SMPROGRAMS\Zipelo 개발판.lnk" |
| 135 | 138 | ${EndIf} |
| 136 | 139 | ${If} $UninstallOwned == 1 |
| 140 | 추가: DeleteRegValue HKCU "${UNKEY}" "DisplayIcon" | |
| 137 | 141 | DeleteRegValue HKCU "${UNKEY}" "DisplayName" |
| 138 | 142 | DeleteRegValue HKCU "${UNKEY}" "DisplayVersion" |
| 139 | 143 | DeleteRegValue HKCU "${UNKEY}" "UninstallString" |
| @@ -179,6 +183,7 @@ Function ApplyAssociations | ||
| 179 | 183 | Pop $0 |
| 180 | 184 | ClearErrors |
| 181 | 185 | WriteRegStr HKCU "${PROGKEY}" "" "Zipelo 압축파일" |
| 186 | 추가: WriteRegStr HKCU "${PROGKEY}\DefaultIcon" "" '$\"$INSTDIR\Zipelo.exe$\",0' | |
| 182 | 187 | WriteRegStr HKCU "${PROGKEY}\shell\open\command" "" '$\"$INSTDIR\Zipelo.exe$\" $\"%1$\"' |
| 183 | 188 | WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationName" "Zipelo 개발판" |
| 184 | 189 | WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationDescription" "압축파일 열기와 풀기" |
| @@ -247,11 +252,14 @@ Section "Uninstall" | ||
| 247 | 252 | DeleteRegKey /ifempty HKCU "${APPKEY}\Capabilities" |
| 248 | 253 | DeleteRegKey /ifempty HKCU "${APPKEY}" |
| 249 | 254 | DeleteRegValue HKCU "${PROGKEY}\shell\open\command" "" |
| 255 | 추가: DeleteRegValue HKCU "${PROGKEY}\DefaultIcon" "" | |
| 256 | 추가: DeleteRegKey /ifempty HKCU "${PROGKEY}\DefaultIcon" | |
| 250 | 257 | DeleteRegValue HKCU "${PROGKEY}" "" |
| 251 | 258 | DeleteRegKey /ifempty HKCU "${PROGKEY}\shell\open\command" |
| 252 | 259 | DeleteRegKey /ifempty HKCU "${PROGKEY}\shell\open" |
| 253 | 260 | DeleteRegKey /ifempty HKCU "${PROGKEY}\shell" |
| 254 | 261 | DeleteRegKey /ifempty HKCU "${PROGKEY}" |
| 262 | 추가: DeleteRegValue HKCU "${UNKEY}" "DisplayIcon" | |
| 255 | 263 | DeleteRegValue HKCU "${UNKEY}" "DisplayName" |
| 256 | 264 | DeleteRegValue HKCU "${UNKEY}" "DisplayVersion" |
| 257 | 265 | DeleteRegValue HKCU "${UNKEY}" "UninstallString" |
| @@ -60,6 +60,7 @@ class InstallerInputTests(unittest.TestCase): | ||
| 60 | 60 | for name in ("Zipelo.exe", "zipelo-archive-worker.exe", "LICENSE", "BUILD-INFO.json", "THIRD-PARTY-LICENSES.txt"): |
| 61 | 61 | (payload / name).write_bytes(b"compile-only test fixture") |
| 62 | 62 | 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") | |
| 63 | 64 | completed = subprocess.run(["makensis", "-WX", "installer.nsi"], cwd=self.root, |
| 64 | 65 | stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) |
| 65 | 66 | self.assertEqual(completed.returncode, 0, completed.stdout) |
| @@ -79,3 +79,14 @@ fn options_keep_event_loop_available_for_retry() { | ||
| 79 | 79 | assert!(options.run_and_return); |
| 80 | 80 | assert!(matches!(options.renderer, eframe::Renderer::Glow)); |
| 81 | 81 | } |
| 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 | 추가: } |