Compare commits
83
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90f667e551 | ||
|
|
0cf7d45b89 | ||
|
|
2700e1ffea | ||
|
|
eb079f601a | ||
|
|
cf268cec7a | ||
|
|
d765eabb99
|
||
|
|
12591e256f | ||
|
|
28b4416cf5
|
||
|
|
589857b61f | ||
|
|
8fadbf05e4
|
||
|
|
f0573f7e67 | ||
|
|
516acc5758
|
||
|
|
660aded5f8 | ||
|
|
fad655559a
|
||
|
|
12807bb4fa | ||
|
|
1d112de39f
|
||
|
|
7b3ab04b07 | ||
|
|
3648253156
|
||
|
|
0a23d50ac3
|
||
|
|
abf7810c8b | ||
|
|
1fa5524ede
|
||
|
|
d2e3f990a7
|
||
|
|
cd4e7b7dc9 | ||
|
|
ba703abbdb
|
||
|
|
d3bacec396 | ||
|
|
e2ed465f66
|
||
|
|
10d5f2b2ad
|
||
|
|
3466ee79dc | ||
|
|
3c72f8e0f9
|
||
|
|
1040abd699 | ||
|
|
74f00d0006
|
||
|
|
7725ee13bd | ||
|
|
8bc97df1cc
|
||
|
|
678cd4e5f5 | ||
|
|
99f50141f2
|
||
|
|
237dae4284 | ||
|
|
67762f06e9
|
||
|
|
371ac37ce7
|
||
|
|
a6c28a6e0c
|
||
|
|
b4a27862f3
|
||
|
|
d4bd8535af
|
||
|
|
4a20b5c87c
|
||
|
|
e11bc8fe88
|
||
|
|
d630386a0c
|
||
|
|
d08c3a56b9
|
||
|
|
35a9a6e954
|
||
|
|
aaffcf6db8
|
||
|
|
196089865c
|
||
|
|
9baae8d08f | ||
|
|
331cb08939
|
||
|
|
8fb4582421
|
||
|
|
2b1f691e5f
|
||
|
|
f92a98441e
|
||
|
|
9c77a81383
|
||
|
|
404c5d8e7d
|
||
|
|
b88a8e9c3c
|
||
|
|
6bd9198b65
|
||
|
|
7cbbb884a9
|
||
|
|
daef28386b
|
||
|
|
b5889265fc
|
||
|
|
f6ba62f7de
|
||
|
|
2940ab289d
|
||
|
|
1fc58ce634
|
||
|
|
c095a5920e
|
||
|
|
997bb1df67
|
||
|
|
cbb826e469
|
||
|
|
8c900e592f
|
||
|
|
3f30f2a449
|
||
|
|
ddd9ccb320
|
||
|
|
b529bf0bc5
|
||
|
|
d6f0871561
|
||
|
|
55d879e530 | ||
|
|
e92e70c2d9
|
||
|
|
5b69972ca2
|
||
|
|
56426c7c01
|
||
|
|
cc973aa11b | ||
|
|
cbcd556df9
|
||
|
|
6575c5c5e5
|
||
|
|
1b9304247b | ||
|
|
837e5eba1d
|
||
|
|
f498437ada
|
||
|
|
4305a49291 | ||
|
|
8ba9d620af
|
No files matched your search
@@ -10,7 +10,7 @@
|
||||
"rollForward": false
|
||||
},
|
||||
"dotnet-sonarscanner": {
|
||||
"version": "12.0.0",
|
||||
"version": "12.1.0",
|
||||
"commands": [
|
||||
"dotnet-sonarscanner"
|
||||
],
|
||||
@@ -24,4 +24,4 @@
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Tip: **About → Report bug** inside the app pre-fills this form (version, modules,
|
||||
Tip: **Settings → About → Report a bug** inside the app pre-fills this form (version, modules,
|
||||
console errors) and saves a `bugreport-*.zip` you can attach below.
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: OmniDeck version
|
||||
placeholder: "0.0.1-alpha.1 (1ab1b36) — shown in About"
|
||||
placeholder: "0.3.0-alpha.1 (1a2b3c4) — shown in Settings → About"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
@@ -48,7 +48,7 @@ body:
|
||||
attributes:
|
||||
label: Console errors
|
||||
description: >
|
||||
For web app issues, paste the console errors that About → Report bug captured (they are
|
||||
For web app issues, paste the console errors that Settings → About → Report a bug captured (they are
|
||||
in the pre-filled issue and the zip). Release builds have no DevTools, so there is no
|
||||
other way to copy them. Leave empty for native mini-apps.
|
||||
render: text
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
@@ -63,18 +63,19 @@ jobs:
|
||||
- name: Verify XAML formatting (XamlStyler)
|
||||
run: dotnet xstyler -c Settings.XamlStyler -d src -r -p
|
||||
|
||||
- name: Design tokens only in module and web views
|
||||
- name: Design tokens only in views
|
||||
shell: pwsh
|
||||
run: |
|
||||
# docs/UI-MODES.md §2: module and web-runner views consume Od.* tokens, never a literal FontSize.
|
||||
# docs/UI-MODES.md §2: views consume Od.* tokens, never a literal font size, or a literal
|
||||
# margin, padding or corner radius other than zero.
|
||||
$hits = Get-ChildItem -Path src -Recurse -Filter *.xaml |
|
||||
Where-Object { $_.FullName -match '[\\/]OmniDeck\.(Modules|Web)[\\/]' } |
|
||||
Select-String -Pattern 'FontSize\s*=\s*"\s*\d'
|
||||
Where-Object { $_.FullName -notmatch '[\\/](bin|obj)[\\/]' } |
|
||||
Select-String -Pattern 'FontSize\s*=\s*"\s*\d', '(?<![\w.])(Margin|Padding|CornerRadius)\s*=\s*"[^"{]*[1-9]'
|
||||
if ($hits) {
|
||||
$hits | ForEach-Object { Write-Host "::error file=$($_.Path),line=$($_.LineNumber)::Literal FontSize in a module or web view; use an Od.* token." }
|
||||
$hits | ForEach-Object { Write-Host "::error file=$($_.Path),line=$($_.LineNumber)::Literal size in a view; use an Od.* token." }
|
||||
exit 1
|
||||
}
|
||||
Write-Host 'No literal FontSize in module or web views.'
|
||||
Write-Host 'No literal font sizes, margins, paddings or corner radii in views.'
|
||||
|
||||
- name: Build (Release, warnings are errors)
|
||||
run: dotnet build OmniDeck.slnx -c Release --no-restore
|
||||
@@ -105,7 +106,7 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
|
||||
@@ -49,12 +49,12 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- if: matrix.language == 'csharp'
|
||||
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
@@ -66,6 +66,6 @@ jobs:
|
||||
run: dotnet build OmniDeck.slnx -c Release -p:RunAnalyzers=false
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
fetch-depth: 0 # the main-ancestry check below needs history
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
|
||||
@@ -40,6 +40,6 @@ jobs:
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
- uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
- uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
fetch-depth: 0 # full history: SonarCloud uses blame to tell new code from old
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
@@ -102,9 +102,10 @@ jobs:
|
||||
'/d:sonar.cs.vstest.reportsPaths=TestResults/*.trx',
|
||||
'/d:sonar.cs.roslyn.ignoreIssues=true',
|
||||
'/d:sonar.exclusions=**/bin/**,**/obj/**,**/TestResults/**,publish/**,Releases/**',
|
||||
# Views, and the thin wrappers over the native engines (the WebView2 runtime, libVLC), run only
|
||||
# against those engines, which CI does not load; the logic around them is tested on its own.
|
||||
'/d:sonar.coverage.exclusions=**/*.xaml.cs,**/Program.cs,**/OdWebRuntime.cs,**/OdVlcEngine.cs,**/OdVlcPlayer.cs,scripts/**,.github/**'
|
||||
# Views, and the thin wrappers over the native engines (the WebView2 runtime, libVLC) and over
|
||||
# Velopack's update manager (an installed copy, GitHub's releases), run only against those,
|
||||
# which CI does not have; the logic around them is tested on its own.
|
||||
'/d:sonar.coverage.exclusions=**/*.xaml.cs,**/Program.cs,**/OdWebRuntime.cs,**/OdVlcEngine.cs,**/OdVlcPlayer.cs,**/OdVelopackUpdateService.cs,scripts/**,.github/**'
|
||||
)
|
||||
dotnet sonarscanner @scannerArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "SonarScanner begin failed with exit code $LASTEXITCODE." }
|
||||
|
||||
+99
-1
@@ -6,6 +6,101 @@ All notable changes to OmniDeck are documented here. The format follows
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.3.0-alpha.1] — 2026-11-03
|
||||
|
||||
First P3 alpha, with all of phase P3 in it: Stocks with your own Twelve Data key, alarms in Timer,
|
||||
charts drawn by OmniDeck itself, the finished Dynamic and Comfort layouts, an accessibility pass for
|
||||
screen readers, the keyboard and large text, and OmniDeck in Vietnamese and Japanese. 0.3.0 follows
|
||||
once this alpha has been tried out.
|
||||
|
||||
### Added
|
||||
- Vietnamese (Tiếng Việt) and Japanese (日本語): Settings → General → Language, or the first-run setup.
|
||||
- Settings → About: Get pre-release versions. Without a choice of yours it follows the version you run, so the
|
||||
alphas and betas keep getting alphas and betas, and from 1.0 a stable install gets stable versions only.
|
||||
- Timer: alarms at a time of day, once, every day, on weekdays or at weekends, each with an optional
|
||||
label and a switch. They ring as a notification that opens Timer, while OmniDeck runs (in the
|
||||
notification area too), as the screen says. A one-off alarm turns itself off once it rang; one the PC
|
||||
slept through still rings on waking within the hour, and not after that.
|
||||
- Stocks: a watchlist of US stocks and ETFs with Twelve Data, using your own free (or paid) API key, which
|
||||
stays on this PC encrypted for your Windows account. Add listings by searching for them; each row
|
||||
shows the price, the day's change and a sparkline of the last month. Prices refresh only while Stocks
|
||||
is on screen, while the market trades, and within what your key's plan allows; when credits run out
|
||||
or Twelve Data can't be reached, the last prices stay. Choose a listing for its details: the day's
|
||||
and the year's range, and a price chart over one month to five years that the arrow keys read out
|
||||
bar by bar, also as a table. Delayed or indicative data, not investment advice.
|
||||
- Weather: the next 48 hours also show as a chart, the temperature as a line over the chance of rain.
|
||||
Screen readers hear the chart sum the hours up; with the chart focused, the arrow keys read the
|
||||
hours one by one, as the mouse does when it moves over it. The list of hours stays below it.
|
||||
- First run: each layout card shows its layout's own text sizes and colors, so the three can be
|
||||
compared side by side before you pick one.
|
||||
- Command palette (Ctrl+K): each settings tab, Check for updates, Report a bug and Open the data folder.
|
||||
A module's own window answers Ctrl+K too, and Ctrl+W closes it, which returns the module to the main
|
||||
window. Whatever the palette or Ctrl+1–9 opens takes the keyboard focus.
|
||||
- Enter and Delete play or remove the selected file of the media queue, and bring back or forget the
|
||||
selected calculation of the calculator's history.
|
||||
- The command palette finds what you type whatever its accents: "thoi tiet" finds "Thời tiết".
|
||||
|
||||
### Changed
|
||||
- Screen readers (Narrator, NVDA, JAWS):
|
||||
- the sidebar is two lists, the modules then Settings and the library, whose items say which one is
|
||||
open and can be selected;
|
||||
- a button that every row of a list has also says its row, as in "Remove, Tokyo";
|
||||
- the title bar's, the sidebar's, the scroll bars' and the number boxes' buttons have names;
|
||||
- calendar days give the whole date, and forecast hours and days, laps and calculations read as
|
||||
sentences;
|
||||
- Play and Mute say what they will do, Pause and Unmute once playing or muted, and the symbol keys of
|
||||
the calculator their names, such as "Divide";
|
||||
- page and section titles are headings, and status messages are read out as they change.
|
||||
- Accent colors are a list of named swatches you can pick from the keyboard; High Contrast, which uses
|
||||
Windows' colors, hides them.
|
||||
- With large text, tiles, number boxes and the weather's columns grow with it, and the buttons of the
|
||||
library's tiles and of the timers wrap rather than clip.
|
||||
- A change of language reaches every screen at once, and the lists you pick from keep their choice;
|
||||
web apps follow at OmniDeck's next start. The language list names each language in itself.
|
||||
- Calendar: a repeating event's interval reads as one phrase, such as "every 2 weeks".
|
||||
- The bug report's GitHub issue stays in English, with modules by id, whatever the language of the app.
|
||||
- Fainter text (descriptions, captions, times) is darker on the light theme, so that it reads at a
|
||||
contrast of at least 4.5:1 in every layout; in Comfort it reaches 7:1 on both themes. High Contrast
|
||||
keeps Windows' colors.
|
||||
- Comfort has larger sidebar icons, and in every layout check boxes, radio buttons, drop-downs,
|
||||
switches, list and menu items and sidebar items are at least as tall as the layout's touch target.
|
||||
|
||||
### Fixed
|
||||
- Much of the text on the Settings, Library and Memory pages and in the modules, and the sidebar's labels,
|
||||
stayed small whatever the layout, Settings → Appearance → Text size or Windows' text size said. It
|
||||
now follows all three.
|
||||
- The selected layout card's description was hard to read on the accent color.
|
||||
- Calendar: the days outside the month were too faint to read on the light theme. They stay dimmed,
|
||||
less so, and not at all in High Contrast.
|
||||
- Calculator: the keys lost their labels at large text sizes.
|
||||
- Media: screen readers called the player's controls "LibVLCSharp.WPF"; they are Media's now.
|
||||
|
||||
## [0.2.0] — 2026-11-03
|
||||
|
||||
The end of phase P2. The eight web apps of the catalog run inside OmniDeck on Microsoft Edge
|
||||
WebView2, with their notifications, site permissions and memory figures, beside the clock, timer and
|
||||
calculator and the new weather, calendar and media player modules. Any module can open in a window
|
||||
of its own, web pages go full screen, a bug report can be prepared from inside the app, and the
|
||||
memory governor rests the modules no one is looking at, a minimized window's included. The
|
||||
0.2.0-alpha.1 to 0.2.0-alpha.4 notes list all of it in detail: 0.2.0 is the same app as
|
||||
0.2.0-alpha.4. Stocks, the finished Dynamic and Comfort layouts, Vietnamese and Japanese arrive in P3.
|
||||
|
||||
## [0.2.0-alpha.4] — 2026-11-03
|
||||
|
||||
Fourth P2 alpha, the build to try out before 0.2.0: the memory governor now also rests the module
|
||||
of a minimized window. The web app list every copy downloads was updated the same day: Spotify's
|
||||
"Continue with Google, Facebook or Apple" buttons now sign in inside the app, and a Discord or
|
||||
Facebook call that is playing sound is never put to sleep.
|
||||
|
||||
### Fixed
|
||||
- The module on screen when you minimized OmniDeck, or closed it to the notification area, kept
|
||||
running at full size for as long as the window stayed away, even above the memory limits. It now
|
||||
rests like any other hidden module: suspended after 5 minutes and closed down after 30 (or whatever
|
||||
Settings → Memory says), unless it is playing, kept running or has notifications on. It comes back,
|
||||
on the page it showed, when the window does.
|
||||
- A player that stops after playing out of sight for a while is no longer closed down at once: the
|
||||
time it spent playing does not count as time unused.
|
||||
|
||||
## [0.2.0-alpha.3] — 2026-11-02
|
||||
|
||||
Third P2 alpha, the build to try out before 0.2.0: pop-out windows, web pages in full screen, an icon
|
||||
@@ -235,7 +330,10 @@ user-facing features yet: the window only shows the version.
|
||||
- Supported platform narrowed to Windows 11 (24H2 or later), x64.
|
||||
- App data moves to `%LocalAppData%\OmniDeck.Data`, outside Velopack's install folder.
|
||||
|
||||
[Unreleased]: https://github.com/poli0981/OmniDeck/compare/v0.2.0-alpha.3...HEAD
|
||||
[Unreleased]: https://github.com/poli0981/OmniDeck/compare/v0.3.0-alpha.1...HEAD
|
||||
[0.3.0-alpha.1]: https://github.com/poli0981/OmniDeck/compare/v0.2.0...v0.3.0-alpha.1
|
||||
[0.2.0]: https://github.com/poli0981/OmniDeck/compare/v0.2.0-alpha.4...v0.2.0
|
||||
[0.2.0-alpha.4]: https://github.com/poli0981/OmniDeck/compare/v0.2.0-alpha.3...v0.2.0-alpha.4
|
||||
[0.2.0-alpha.3]: https://github.com/poli0981/OmniDeck/compare/v0.2.0-alpha.2...v0.2.0-alpha.3
|
||||
[0.2.0-alpha.2]: https://github.com/poli0981/OmniDeck/compare/v0.2.0-alpha.1...v0.2.0-alpha.2
|
||||
[0.2.0-alpha.1]: https://github.com/poli0981/OmniDeck/compare/v0.1.1...v0.2.0-alpha.1
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
**OmniDeck** — ứng dụng desktop **Windows 11** (24H2+, x64) gom các mini-app native (đồng hồ, hẹn giờ, máy tính, thời tiết, lịch, chứng khoán, media player) và các web app tuyển chọn (Spotify, Discord, YouTube, Google…, chạy trên WebView2) vào một cửa sổ, với **RAM governor** tự suspend/hibernate module.
|
||||
|
||||
- Open-source **GPL-3.0**; cài & cập nhật bằng **Velopack** (per-user, không admin).
|
||||
- Trạng thái: **pre-alpha** — kickoff 28/10/2026, P0 từ 02/11/2026, v1.0 ~23/05/2027 (`docs/ROADMAP.md`).
|
||||
- Trạng thái: **alpha** — P0–P2 xong (0.2.0, 03/11/2026); P3 đã merge (#58–#69) và ra 0.3.0-alpha.1 (03/11/2026) để dogfood; Legal 1.2 ở #70 (người dùng merge trước tag v0.3.0), 0.3.0 ra sau đợt dogfood; lịch và các mốc ở `docs/ROADMAP.md`.
|
||||
|
||||
## 2. Luật vàng (KHÔNG được vi phạm)
|
||||
|
||||
@@ -26,21 +26,22 @@
|
||||
|
||||
- **.NET 10 (LTS), C# 14**, SDK ghim trong `global.json` · **WPF** + **WPF-UI 4.3** (Fluent; quy ước ở `docs/WPFUI-CONVENTIONS.md`)
|
||||
- **Velopack** 1.2 — `vpk` là local tool trong `.config/dotnet-tools.json`, luôn cùng version với thư viện
|
||||
- Dự kiến từ P1: CommunityToolkit.Mvvm, M.E.DependencyInjection, Serilog, SQLite + Dapper, WebView2 SDK, LibVLCSharp, ScottPlot, Ical.Net, H.NotifyIcon (bảng version ở `docs/SPEC.md` §7)
|
||||
- Thư viện chính: CommunityToolkit.Mvvm, M.E.DependencyInjection, Serilog, SQLite + Dapper, WebView2 SDK, LibVLCSharp + libVLC, Ical.Net, H.NotifyIcon, Markdig (bảng version ở `docs/SPEC.md` §7). Biểu đồ tự vẽ bằng WPF, không dùng thư viện chart.
|
||||
- Test: **xUnit v3** (`xunit.v3.mtp-off`, chạy qua VSTest)
|
||||
- Analyzer (warnings = errors): .NET analyzers latest, **SonarAnalyzer.CSharp**, **Roslynator**, **Meziantou**, **ReferenceTrimmer** — khai báo trong `Directory.Build.props`
|
||||
- i18n: `.resx` EN (neutral) / VI / JA
|
||||
- i18n: `.resx` EN (neutral) / VI / JA; view model dựng chuỗi trong code phải đọc lại khi đổi ngôn ngữ (`OdLocalization.FollowCulture`), danh sách chọn đổi chữ tại chỗ (`OdLocalizedOption`); luật dịch và bảng thuật ngữ ở `docs/TRANSLATING.md`
|
||||
- Accessibility: tên cho mọi control và mọi hàng (`{res:OdLocRow …}`), dòng trạng thái là `OdStatusText`; kiểm bằng `scripts/od-drive.ps1 -Action audit` (`docs/WPFUI-CONVENTIONS.md` §7)
|
||||
|
||||
## 4. Bố cục
|
||||
|
||||
```
|
||||
OmniDeck.slnx · Directory.Build.props · global.json · .config/dotnet-tools.json · Settings.XamlStyler
|
||||
src/OmniDeck.App/ WPF shell — exe OmniDeck.exe; Program.Main (Velopack) → OdApp (OdApp.xaml)
|
||||
src/OmniDeck.Core/ contracts, governor, storage, services (hiện có OdVersionInfo)
|
||||
src/OmniDeck.Modules/ mini-app (tạo ở P1) · src/OmniDeck.Web/ web runner (tạo ở P2)
|
||||
src/OmniDeck.Core/ contracts, module host, governor, storage, settings, localization, token theme
|
||||
src/OmniDeck.Modules/ mini-app (clock, timer, calculator, weather, calendar, media) · src/OmniDeck.Web/ web runner + catalog
|
||||
tests/OmniDeck.Tests/ xUnit v3
|
||||
catalog/ webapps.json + webapps.schema.json
|
||||
scripts/ pack.ps1 (publish + vpk pack), validate-catalog.ps1
|
||||
scripts/ pack.ps1 (publish + vpk pack), validate-catalog.ps1, make-icon.ps1
|
||||
```
|
||||
|
||||
## 5. Lệnh
|
||||
@@ -53,6 +54,7 @@ dotnet format OmniDeck.slnx --verify-no-changes
|
||||
dotnet xstyler -c Settings.XamlStyler -d src -r -p # bỏ -p để tự định dạng
|
||||
pwsh scripts/validate-catalog.ps1
|
||||
pwsh scripts/pack.ps1 -Version 0.0.1-local # publish + Velopack → Releases/ (Velopack cần ≥ 0.0.1)
|
||||
$env:OMNIDECK_DATA_ROOT = "$env:TEMP\OmniDeck.Dev" # chỉ bản Debug đọc: chạy bản dev cạnh bản đã cài, không đụng dữ liệu thật
|
||||
```
|
||||
|
||||
Repo dùng CRLF (`.gitattributes`, `.editorconfig`); file do tool tạo có thể là LF → chạy `unix2dos` cho `.cs`/`.xaml` trước `dotnet format`. XamlStyler ghi XAML kèm BOM (`.editorconfig` khai báo `charset = utf-8-bom` cho `*.xaml`).
|
||||
@@ -85,6 +87,7 @@ Required checks trên `main`: `build`, `package`, `catalog`, `lint`, `Analyze (c
|
||||
| `docs/UI-MODES.md` | Token `Od.*`, 3 preset |
|
||||
| `docs/WPFUI-CONVENTIONS.md` | Cách dùng WPF-UI |
|
||||
| `docs/WEBAPP-CATALOG.md` | Schema + luật review catalog |
|
||||
| `docs/TRANSLATING.md` | Luật dịch, cách app đổi ngôn ngữ, thuật ngữ VI/JA |
|
||||
| `docs/ROADMAP.md` | Phase P0–P4, version, rủi ro |
|
||||
| `docs/legal/*` | EULA, Disclaimer, Privacy, Third-party notices (ship trong app) |
|
||||
| `README.md`, `CONTRIBUTING.md`, `SECURITY.md`, `RELEASING.md`, `CHANGELOG.md` | Tài liệu công khai |
|
||||
|
||||
+5
-3
@@ -26,6 +26,8 @@ $env:OMNIDECK_DATA_ROOT = "$env:TEMP\OmniDeck.Dev"
|
||||
dotnet run --project src/OmniDeck.App
|
||||
```
|
||||
|
||||
`scripts/od-drive.ps1` drives such a build through UI Automation, without the mouse or the keyboard: it opens a module through the palette, invokes a button by name, saves a screenshot, or audits a screen for what screen readers would trip on (`-Action audit`). It is a development tool; CI does not run it.
|
||||
|
||||
## Code style & quality gates (enforced in CI)
|
||||
|
||||
- `.editorconfig` is authoritative. `dotnet format OmniDeck.slnx --verify-no-changes` must pass.
|
||||
@@ -41,11 +43,11 @@ dotnet run --project src/OmniDeck.App
|
||||
|
||||
- Naming: namespace `OmniDeck.*`, public type prefix `Od*`, interfaces `IOd*`; the application class is `OdApp`.
|
||||
- Language: C# 14, nullable enabled, file-scoped namespaces; methods returning an awaitable end in `Async`.
|
||||
- Strings: user-facing text goes in `.resx` (EN neutral + VI + JA). Never concatenate localized fragments; use format placeholders.
|
||||
- Strings: user-facing text goes in `.resx` (EN neutral, VI, JA). Never concatenate localized fragments; use format placeholders. Text a view model builds in code reads its strings again on a change of language (`OdLocalization.FollowCulture`). See [TRANSLATING](docs/TRANSLATING.md) for the rules, and for translating.
|
||||
- App data goes under `%LocalAppData%\OmniDeck.Data`, never into Velopack's install folder `%LocalAppData%\OmniDeck` ([ARCHITECTURE](docs/ARCHITECTURE.md) §5).
|
||||
- Commits: imperative subject ≤ 72 chars; scope prefix encouraged (`governor:`, `web:`, `stocks:`, `docs:`, `ci:`).
|
||||
- Commits: imperative subject ≤ 72 chars, with a type prefix: `feat:`, `fix:`, `docs:`, `chore:`, `ci:` or `deps:`.
|
||||
- Signatures: `main` only accepts verified (signed) commits. Signed commits are appreciated; pull requests with unsigned commits are squash-merged, so GitHub signs the result.
|
||||
- Branches: `feat/…`, `fix/…`, `docs/…`, `chore/…`, `ci/…` off `main`; PRs to `main` with the template filled in. Required checks must pass before merge.
|
||||
- Branches: `feat/…`, `fix/…`, `docs/…`, `chore/…`, `ci/…` off `main` (`release/…` for release preparation); PRs to `main` with the template filled in. Required checks must pass before merge.
|
||||
- One PR = one concern. Screenshots/GIFs for UI changes, please.
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<RepositoryUrl>https://github.com/poli0981/OmniDeck</RepositoryUrl>
|
||||
<PackageProjectUrl>https://github.com/poli0981/OmniDeck</PackageProjectUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Version>0.2.0-alpha.3</Version>
|
||||
<Version>0.3.0-alpha.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Build-time analyzers (warnings are errors). They live here rather than in each .csproj:
|
||||
@@ -63,7 +63,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.318">
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.321">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -13,37 +13,38 @@ OmniDeck combines a set of lightweight native mini-apps (weather, calculator, st
|
||||
|
||||
It is built on WPF (.NET 10 LTS) and **WebView2**, which reuses the Edge runtime that ships with Windows 11 instead of bundling a browser engine. That is what keeps the installer small while still running full web apps.
|
||||
|
||||
**Project status: alpha.** 0.2.0-alpha.2 (phase P2) runs the curated web apps beside the clock, timer, calculator, weather, calendar and media player, with pop-out windows and an in-app bug report. Stocks, the polished Dynamic and Comfort presets, and the Vietnamese and Japanese translations come in P3; the 0.9 public beta is planned for April 2027 and v1.0 for May 2027 ([roadmap](docs/ROADMAP.md)). Until then, expect missing features and changes between versions.
|
||||
**Project status: alpha.** 0.3.0-alpha.1 (phase P3) adds Stocks with your own Twelve Data key, alarms, charts, the polished Dynamic and Comfort presets, an accessibility pass, and the Vietnamese and Japanese translations to 0.2.0's curated web apps, clock, timer, calculator, weather, calendar and media player. 0.3.0 follows once the alpha has been tried out; the 0.9 public beta is planned for December 2026 and v1.0 for the end of January 2027 ([roadmap](docs/ROADMAP.md)). Until then, expect missing features and changes between versions.
|
||||
|
||||
## Planned features (v1.0)
|
||||
|
||||
- **Native mini-apps** — clock & world clocks, countdown timer, calculator, weather (Open-Meteo), local calendar with `.ics` import/export, stock watchlist with candlestick charts (US/EU markets), and a full-codec media player (libVLC).
|
||||
- **Native mini-apps** — clock & world clocks, countdown timer, stopwatch and alarms, calculator, weather (Open-Meteo), local calendar with `.ics` import/export, stock watchlist with candlestick charts (Twelve Data with your own key: its free plan covers US listings, while home-market EU listings and indices need a paid plan), and a full-codec media player (libVLC).
|
||||
- **Curated web apps** — each runs in its own WebView2 profile with a per-app navigation allowlist. Web notifications become Windows toasts. Adding a new app is a JSON entry, not a release ([catalog docs](docs/WEBAPP-CATALOG.md)).
|
||||
- **Pop-out windows** — any module can move into a window of its own, and go full screen there.
|
||||
- **RAM governor** — inactive modules are automatically suspended and then hibernated, with a hard memory cap. A built-in task-manager panel shows per-module RAM with manual suspend/kill ([details](docs/RAM-GOVERNOR.md)).
|
||||
- **RAM governor** — inactive modules are automatically suspended and then hibernated, with a hard memory cap. Settings → Memory lists the running modules with their memory, and Suspend, Hibernate, Close and Keep running buttons ([details](docs/RAM-GOVERNOR.md)).
|
||||
- **Three UI presets** — Dynamic, Standard, and Comfort, implemented as design-token presets over one theme engine, with per-token overrides ([details](docs/UI-MODES.md)).
|
||||
- **Privacy** — zero telemetry, zero data collection. Everything is stored locally ([privacy policy](docs/legal/PRIVACY.md)).
|
||||
- **Languages** — English, Tiếng Việt, 日本語.
|
||||
- **Languages** — English, Tiếng Việt, 日本語, switched live from Settings.
|
||||
- **Accessibility** — screen readers (Narrator, NVDA, JAWS), keyboard throughout, Windows text size and High Contrast.
|
||||
|
||||
## The trade-off, stated up front
|
||||
|
||||
Running web apps means running Chromium processes. OmniDeck manages this aggressively (suspend → hibernate → dispose), but with several web apps active it can legitimately use several GiB of RAM. The governor enforces a hard cap of **6 GiB** (configurable); when the cap is hit, least-recently-used modules are hibernated automatically. If you want a 100 MB app, this is not that app — if you want *one* app instead of six Electron installs, it is.
|
||||
Running web apps means running Chromium processes. OmniDeck manages this aggressively (suspend → hibernate → dispose), but with several web apps active it can legitimately use several GiB of RAM. The governor enforces a hard cap of **6 GiB, or half your RAM if that is less** (configurable); when the cap is hit, least-recently-used modules are hibernated automatically. If you want a 100 MB app, this is not that app — if you want *one* app instead of six Electron installs, it is.
|
||||
|
||||
## Known limitations of web apps
|
||||
|
||||
These are properties of the web versions of the services, documented here so they are not reported as OmniDeck bugs:
|
||||
|
||||
- **Spotify** runs the Web Player: audio quality is lower than the desktop app, and playback relies on DRM (Widevine), which ships with the WebView2 runtime (P0 spike #1). If a future runtime drops it, the entry is disabled with an explanation (see the [ROADMAP](docs/ROADMAP.md) risk register).
|
||||
- **Spotify** runs the Web Player: audio quality is lower than the desktop app, and playback relies on DRM (Widevine), which ships with the WebView2 runtime (P0 spike #1). If a future runtime drops it, the Spotify entry comes out of the catalog until it plays again (see the [ROADMAP](docs/ROADMAP.md) risk register).
|
||||
- **Discord** web has no native global push-to-talk and limited screen sharing. A host-side global hotkey is on the roadmap's backlog.
|
||||
- Web app availability, layout, and sign-in flows are controlled by the respective service providers and can change or break at any time.
|
||||
|
||||
## Install
|
||||
|
||||
1. Requirements: **Windows 11 (24H2 or later), x64.** Windows 10 is not supported. The Microsoft Edge **WebView2 Runtime** ships with Windows 11.
|
||||
2. Download a build from [Releases](https://github.com/poli0981/OmniDeck/releases) and run `OmniDeck-win-Setup.exe` (per-user, no admin required). Every version before 1.0 is published as a **pre-release** for testing.
|
||||
3. On first run, review and acknowledge the legal documents (EULA, disclaimer, privacy policy, third-party notices), then pick a UI preset and language.
|
||||
2. Download a build from [Releases](https://github.com/poli0981/OmniDeck/releases) and run `OmniDeck-win-Setup.exe` (per-user, no admin required). Every version before 1.0 is published as a **pre-release** for testing. The `OmniDeck-win-Portable.zip` beside it is not supported yet: it still keeps its data in `%LocalAppData%\OmniDeck.Data`, and nothing removes that data when you delete the folder.
|
||||
3. On first run, review and acknowledge the legal documents (EULA, disclaimer, privacy policy, third-party notices), then pick a language and a layout preset.
|
||||
|
||||
Updates are delivered in-app via Velopack; you can also check manually from **About**. Builds are not yet Authenticode-signed, so Windows SmartScreen may warn about an unknown publisher — see [SECURITY](SECURITY.md) for how to verify a download.
|
||||
Updates are delivered in-app via Velopack; you can also check manually from **Settings → About**. Builds are not yet Authenticode-signed, so Windows SmartScreen may warn about an unknown publisher — see [SECURITY](SECURITY.md) for how to verify a download.
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
@@ -59,6 +60,7 @@ Use **Settings → About → Report a bug** inside the app, or **Report bug** on
|
||||
| [UI-MODES](docs/UI-MODES.md) | Design tokens and the three presets |
|
||||
| [WPFUI-CONVENTIONS](docs/WPFUI-CONVENTIONS.md) | How the codebase uses WPF-UI: windows, controls, theming, navigation |
|
||||
| [WEBAPP-CATALOG](docs/WEBAPP-CATALOG.md) | Catalog schema and how to propose new web apps |
|
||||
| [TRANSLATING](docs/TRANSLATING.md) | How the translations work, and the Vietnamese and Japanese glossaries |
|
||||
| [ROADMAP](docs/ROADMAP.md) | Phases P0–P4 to v1.0, versioning, risk register |
|
||||
| [CHANGELOG](CHANGELOG.md) | Release history |
|
||||
| [CONTRIBUTING](CONTRIBUTING.md) | Dev setup, code style, quality gates |
|
||||
|
||||
@@ -22,6 +22,7 @@ Releases are automated by [`release.yml`](.github/workflows/release.yml), trigge
|
||||
- publishes and packages with Velopack (`scripts/pack.ps1`): self-contained `win-x64`, ReadyToRun, with the legal documents and the runtimes' notices;
|
||||
- creates **build-provenance attestations** for `Setup.exe`, the portable zip, and this version's `.nupkg` files;
|
||||
- uploads everything as a **draft** GitHub Release, attaches the **SPDX SBOM** (`sbom.spdx.json`) and **`checksums.txt`** (SHA-256 of every published asset), sets the release notes to this version's section of `CHANGELOG.md`, then **publishes** it — as a pre-release, or as the latest release for stable versions. Installed copies only see the update once every asset is in place;
|
||||
- Installed copies offer pre-releases while a pre-release runs, or when the user turns on **Get pre-release versions** in Settings → About (`OdUpdateChannel`); a stable install offers stable releases only. Every release stays on Velopack's one `win` channel, so moving from a beta to 1.0 is an ordinary update.
|
||||
- announces the release on Discord (`DISCORD_RELEASE_WEBHOOK`) with `.github/scripts/discord_notify.py`.
|
||||
5. Check the release page: the assets are all there, and the attestation verifies:
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ These are design requirements from the [SPEC](docs/SPEC.md); each one is enforce
|
||||
- Per-user install, **no admin elevation anywhere** in the app.
|
||||
- Web apps run only from the reviewed catalog: per-app navigation allowlists, per-app cookie profiles, SSO popups restricted to listed identity domains, everything else opens in your default browser.
|
||||
- Release builds disable the WebView2 DevTools UI and browser password autosave/autofill; OmniDeck never sees or stores web credentials.
|
||||
- The only secret the app stores (optional Twelve Data API key) is encrypted with Windows DPAPI, current-user scope.
|
||||
- The only secret the app stores (optional Twelve Data API key) is encrypted with Windows DPAPI, current-user scope. It travels only to Twelve Data, in a request header rather than in a web address, and never into a log or a bug report.
|
||||
- All service calls (Open-Meteo, Twelve Data, GitHub) are HTTPS-only.
|
||||
- Bug reports scrub query strings, cookie values, and token-shaped strings before packaging; nothing is ever uploaded automatically — you attach the zip yourself.
|
||||
- No telemetry, no analytics, no crash auto-upload (see [PRIVACY](docs/legal/PRIVACY.md)).
|
||||
|
||||
+11
-6
@@ -10,16 +10,19 @@ Directory.Build.props shared build settings: nullable, warnings as errors, anal
|
||||
NuGet Audit, product metadata and dev-build version
|
||||
global.json pinned .NET SDK
|
||||
.config/ dotnet-tools.json: vpk, dotnet-sonarscanner, XamlStyler
|
||||
scripts/ pack.ps1 (publish + Velopack), validate-catalog.ps1, make-icon.ps1
|
||||
scripts/ pack.ps1 (publish + Velopack), validate-catalog.ps1, make-icon.ps1,
|
||||
od-drive.ps1 (drives and audits a development build; not in CI)
|
||||
src/
|
||||
OmniDeck.App/ WPF shell: windows, navigation, tray and notifications, command
|
||||
palette, theme engine, legal gate, onboarding, settings UI,
|
||||
task-manager panel, update service (Velopack)
|
||||
OmniDeck.Core/ contracts (IOdModule, IOdNotifier, IOdQuoteProvider, ...), module
|
||||
OmniDeck.Core/ contracts (IOdModule, IOdNotifier, IOdSecretStore, ...), module
|
||||
host, RAM governor, storage (SQLite/Dapper, settings), theme
|
||||
tokens, legal acknowledgment, bug-report composer, i18n helpers
|
||||
tokens and contrast, legal acknowledgment, bug-report composer,
|
||||
i18n (OdLocalization, OdLocRow, OdLanguages), live regions
|
||||
OmniDeck.Modules/ built-in mini-apps: Clock, Timer, Calculator, Weather,
|
||||
Calendar, Stocks, Media — one folder per module (P1)
|
||||
Calendar, Stocks, Media — one folder per module (P1),
|
||||
and Charts, the charts they draw themselves (P3)
|
||||
OmniDeck.Web/ web runner: environment/profile management, catalog loader,
|
||||
navigation policy, notifications bridge, permissions,
|
||||
sign-in health, CDP console capture (P2)
|
||||
@@ -64,6 +67,8 @@ public interface IOdModule
|
||||
|
||||
`OdModuleHost` runs the contract. It initializes a module on first open, builds its view when it has none (first open, or after hibernation), keeps the view of the visible module, and moves hidden ones down the ladder when the shell or the governor asks; it refuses to suspend or hibernate a module whose `CanSuspendAsync` returns false. Calls run one at a time on the UI thread. The shell's navigation view is chrome only: every module item navigates to one shared stage page, whose content is the view the host hands back, so the control never creates or caches module views.
|
||||
|
||||
When the main window is minimized or hidden in the tray, nothing it holds is on screen: `OdModuleHost.SetMainWindowAwayAsync` makes its module Idle, so the ladder and the caps apply to it, while it stays the module the window shows. When the window comes back, the module is activated again, and gets a new view if it was hibernated meanwhile. The stage keeps the old view while the window is away, so a full screen and the page survive a minimize. Since a minimized window never unloads its view, `ActivateAsync` must undo whatever `SuspendAsync` stopped (Clock and Timer restart their ticking there), and a web app hides its browser before asking WebView2 to suspend, which WebView2 does only for a hidden browser.
|
||||
|
||||
A view asks for full screen with `OdFullscreen.Request(view, on)`, a bubbling routed event raised from the view itself, since content it hosts in a window of its own (a video overlay) is outside the main window's tree. The main window then:
|
||||
|
||||
- covers the monitor it is on (`OdMonitors.BoundsOf`, `OdWindowCover`), and keeps where it was;
|
||||
@@ -125,11 +130,11 @@ A single scheduler owns all state transitions. Inputs: per-module visibility + l
|
||||
|
||||
All app data lives under the **data root** `%LocalAppData%\OmniDeck.Data`:
|
||||
|
||||
- `omnideck.db` — SQLite via Dapper. Tables per module (`calendar_events`, `stocks_watchlist`, `stocks_quotes_cache`, `weather_cache`, `media_playlists`, …) plus `app_meta` (legal acknowledgment, schema version). Migrations = ordered idempotent SQL scripts executed at startup.
|
||||
- `omnideck.db` — SQLite via Dapper. Tables per module (`calendar_events`, `stocks_quotes_cache`, `stocks_series_cache`, `weather_cache`, `media_playlists`, …; the stocks watchlist lives in the module's settings document) plus `app_meta` (legal acknowledgment, schema version). Migrations = ordered idempotent SQL scripts executed at startup.
|
||||
- `settings.json` — typed settings tree; import/export from the Data settings page.
|
||||
- `WebView2\` — the WebView2 user data folder (profiles, cookies, caches).
|
||||
- `logs\`, `reports\` — Serilog rolling files and bug-report zips.
|
||||
- Secrets: only the optional Twelve Data key, encrypted with DPAPI (`ProtectedData`, CurrentUser scope).
|
||||
- Secrets: only the optional Twelve Data key, encrypted with DPAPI (`ProtectedData`, CurrentUser scope, OmniDeck's own entropy) in `secrets\twelvedata.bin` by `IOdSecretStore`. It is not in `settings.json`, so a settings export never carries it, and the scrubber takes `Authorization: apikey` values out of bug reports.
|
||||
|
||||
Why not `%LocalAppData%\OmniDeck`: that is Velopack's install folder (packId `OmniDeck`). Velopack deletes it entirely on uninstall and when Setup is run again over an existing install, so nothing the user owns may live there. The data root is a sibling folder that survives updates and reinstalls; the Velopack uninstall hook (`VelopackApp.Build().OnBeforeUninstallFastCallback`, P1) deletes it on uninstall, as PRIVACY promises. It is local, not roaming, because WebView2 caches can reach several GiB.
|
||||
|
||||
|
||||
+11
-1
@@ -14,6 +14,8 @@ The governor is the feature that makes "many apps in one" viable. It moves every
|
||||
|
||||
A module in a window of its own (a pop-out) is visible while that window is open, so it stays Active whatever the main window shows; closing the window puts it back on the ladder as a hidden module.
|
||||
|
||||
The main window's module is hidden too while that window is minimized or hidden in the tray: it goes Idle when the window goes away and down the ladder from there, and it is active again when the window comes back (rebuilt, if it was hibernated meanwhile). Pop-outs keep their rule above, even when their own window is minimized.
|
||||
|
||||
Reactivation from Suspended is instant. From Hibernated it is a cold open (view rebuild and page reload, about 0.6–2.5 s); that is acceptable because the profile keeps the user signed in. After the last web app has been hibernated, the next one also restarts the browser process (about 160 ms).
|
||||
|
||||
## 2. Defaults (all configurable in Settings → Memory)
|
||||
@@ -38,6 +40,8 @@ A module that works while hidden is **resident** (`IOdResidency`): in P2, a web
|
||||
|
||||
Pinned modules are skipped by cap enforcement; if the hard cap is exceeded purely by pinned modules, the governor toasts a warning instead of killing audio.
|
||||
|
||||
Time spent pinned does not count as time hidden: each pass restarts a pinned module's hidden time, so a player that stops after an hour out of sight is suspended `IdleAfter` later and hibernated `HibernateAfter` later, not on the next pass.
|
||||
|
||||
## 4. Cap enforcement
|
||||
|
||||
Total footprint = shell process + Σ all WebView2 processes, sampled every `PollInterval`.
|
||||
@@ -52,7 +56,7 @@ The caps, the toasts and the task-manager panel all use it. The panel may show t
|
||||
- **> SoftCap:** hibernate the least-recently-used unpinned module, since Suspended frees almost no memory. Repeat on the next tick if still above.
|
||||
- **> HardCap:** force-hibernate LRU unpinned modules until below, then raise one toast summarizing what was hibernated. If the shared WebView2 processes alone keep the total above the cap (the GPU process grows with video), the toast says so instead of hibernating apps that would free nothing.
|
||||
|
||||
Ordering hint: `RamClass.Heavy` modules (web apps, media, stocks charts) are preferred victims over `Light` ones at equal recency. Recency counts in poll intervals, so modules hidden within the same interval are equally recent.
|
||||
Ordering hint: `RamClass.Heavy` modules (web apps, media) are preferred victims over `Light` ones at equal recency. Recency counts in poll intervals, so modules hidden within the same interval are equally recent.
|
||||
|
||||
As built in P2:
|
||||
|
||||
@@ -81,3 +85,9 @@ The scheduler is pure logic over an injected clock and an injected memory sample
|
||||
- With that page open, the seven WebView2 processes held 508 MB. The first full screen raised them to about 725 MB, mostly the GPU process's surfaces for the larger window, and they stayed there.
|
||||
|
||||
A signed-in day of use is the P2 exit's dogfooding ([ROADMAP](ROADMAP.md) §1).
|
||||
|
||||
**Resource soak, P3** (3 November 2026, Debug build of the P3 branches up to accessibility, c095a59, with its own data root; one 2560×1440 monitor at 100 %; Idle after 1 minute and Hibernate after 2, so that each visit rebuilt a hibernated module):
|
||||
|
||||
- For 42 minutes a script opened one page a minute through the command palette, in turn: Weather (one saved place, with its 48-hour chart), Stocks (without a key), Calendar, Clock, Timer, Calculator, the library and Settings. The shell held 106–131 MB of private commit, 30–32 GDI and 37–41 USER objects all along.
|
||||
- Its handles stayed between 743 and 757 until minute 32, when Weather's cached forecast had turned 30 minutes old and was fetched again, the run's first web request. They peaked at 913 and settled between 793 and 807: most likely the one-time setup of that first request.
|
||||
- At minute 42, input that did not come from the script switched pages several times within seconds, which took private commit to 163 MB, and left the palette out of the script's reach. For the last 18 minutes nothing was in use: every module went to Suspended, then Hibernated, and the shell held 150 MB, 30 GDI and 37–38 USER objects and 788–804 handles.
|
||||
+22
-10
@@ -1,10 +1,12 @@
|
||||
# OmniDeck — Roadmap to v1.0 (May 2027)
|
||||
# OmniDeck — Roadmap to v1.0 (January 2027)
|
||||
|
||||
Solo-developer plan, ~29 weeks from the start of P0 (2 November 2026). Each phase has exit criteria; slipping triggers the cut order in §4, never a death march.
|
||||
Solo-developer plan from the kickoff (28 October 2026) to v1.0. Each phase has exit criteria; slipping triggers the cut order in §4, never a death march.
|
||||
|
||||
> **Re-baselined 2026-10-28.** The first draft assumed a 20 July 2026 start and a January 2027 release. Development actually starts on 2 November 2026, so every phase keeps its original length and moves; P2 gains one buffer week for Tết (Lunar New Year, 6 February 2027). Windows 10 support was dropped at the same time ([SPEC](SPEC.md) §1).
|
||||
>
|
||||
> **Re-baselined 2026-11-02.** P0 and P1 both finished early, on 30 October 2026, so P2 started on 2 November 2026 instead of 11 January 2027. P3 and P4 keep their dates until P2 exits, and are re-baselined then.
|
||||
>
|
||||
> **Re-baselined 2026-11-03.** P2 exited with `0.2.0` on 3 November 2026, and P3 was written alongside its last days, as draft pull requests that merge once `0.2.0` is out. The remaining phases are planned with a buffer rather than their original lengths: `0.3.0` in early December 2026, the `0.9` public beta in mid-December, and `1.0` at the end of January 2027, before Tết (6 February 2027). 23 May 2027, the previous target, stays as the latest date.
|
||||
|
||||
## 1. Phases
|
||||
|
||||
@@ -47,28 +49,38 @@ As delivered: eight work packages (PRs #20–#25, #27 and #29) and three release
|
||||
- **P3 accessibility:** UI Automation exposes WPF-UI 4.3's navigation items as data items with no Invoke or Select pattern; keyboard users reach them with Tab and Enter. The accent swatches are announced by their hex codes.
|
||||
- **P2:** pop-out module windows, deferred by the P1 plan.
|
||||
|
||||
### P2 — Web runner & core modules (from 2 Nov 2026; planned 11 Jan – 7 Mar 2027)
|
||||
### P2 — Web runner & core modules (11 Jan – 7 Mar 2027) — done early, 3 Nov 2026
|
||||
|
||||
Full web runner (profiles, nav policy, SSO popups, notifications→toast, permissions, downloads, suspend/hibernate, catalog fetch) with the v1 catalog; weather; calendar (local + .ics); media player v1 on LibVLCSharp. Bug-report flow end to end (CDP capture → scrubber → prefilled issue + zip).
|
||||
|
||||
**Exit (0.2.0):** dogfood daily — Gmail + Discord + YouTube stay signed in across hibernation; a full day's use stays under the hard cap.
|
||||
|
||||
As delivered so far: the `0.1.1` hotfix (a tray icon that leaked GDI objects), then the plan's ten work packages and two catalog pull requests, released as `0.2.0-alpha.1` and `0.2.0-alpha.2` on 2 November 2026. `0.2.0` follows about a week of dogfooding against the exit criterion. Changed on the way:
|
||||
As delivered: the `0.1.1` hotfix (a tray icon that leaked GDI objects), then the plan's ten work packages, two catalog pull requests and a fix that lets the governor rest a minimized window's module, released as `0.2.0-alpha.1` to `0.2.0-alpha.4` on 2 and 3 November 2026, and as `0.2.0` on 3 November, once the maintainer signed it off. Changed on the way:
|
||||
|
||||
- Downloads use WebView2's own flyout rather than a progress row of OmniDeck's, and permission questions sit in a bar above the page, because no dialog can cover WebView2 ([SPEC](SPEC.md) §4).
|
||||
- Web apps with notifications on stay resident: the time ladder skips them ([RAM-GOVERNOR](RAM-GOVERNOR.md) §3).
|
||||
- Pop-out windows move the module's view, so web pages and videos keep running through the move ([ARCHITECTURE](ARCHITECTURE.md) §2).
|
||||
- Left for later: web app favicons, `.ics` subscriptions (they would need a privacy policy update) and Discord's global push-to-talk hotkey (all in §5), and the weather charts, which wait for ScottPlot in P3.
|
||||
- Left for later: web app favicons, `.ics` subscriptions (they would need a privacy policy update) and Discord's global push-to-talk hotkey (all in §5), and the weather charts, which came in P3, drawn by OmniDeck itself.
|
||||
|
||||
### P3 — Stocks, presets, i18n (8 Mar – 11 Apr 2027)
|
||||
### P3 — Stocks, presets, i18n (3 Nov – early Dec 2026; planned 8 Mar – 11 Apr 2027)
|
||||
|
||||
Stocks module (Twelve Data with the user's own key, which spike #7 left as the only provider; watchlist, candlesticks); Dynamic and Comfort presets polished to spec (UI-MODES token table); VI + JA translations; accessibility pass (text scaling, contrast themes, keyboard nav).
|
||||
|
||||
**Exit (0.3.0):** feature-complete against SPEC v1 scope.
|
||||
|
||||
### P4 — Beta & release (12 Apr – 23 May 2027)
|
||||
As delivered: twelve work packages, written while 0.2.0 was being dogfooded and opened as draft pull requests (#58–#69) that merged in order once 0.2.0 was tagged, and came out together as `0.3.0-alpha.1` on 3 November 2026:
|
||||
|
||||
**0.9 public beta** (~18 Apr) via GitHub Releases + the community Discord; two stabilization cycles driven by bug reports; docs final pass; **v1.0 target 23 May 2027**.
|
||||
- **Charts** drawn by OmniDeck itself rather than ScottPlot: candlesticks with volume, a line over bars, sparklines; each is one control screen readers read (a summary, then the values under the cursor as the arrow keys move it). Weather got its 48-hour chart from them.
|
||||
- **Stocks** on Twelve Data with the user's own key, kept with DPAPI: a watchlist that refreshes only while on screen and within the key's credits, and a listing's details from one month to five years, as a chart or a table.
|
||||
- **Alarms** in Timer, at a time of day, once, daily, on weekdays or at weekends.
|
||||
- **Updates** can include pre-releases or not: the choice follows the running version until the user makes one, so 1.0 installs stay on stable versions.
|
||||
- **Presets** to the token table: text palettes that reach 4.5:1 everywhere and 7:1 in Comfort, minimum touch targets on every control, larger sidebar icons in Comfort, and live previews in the first-run setup. Text size now reaches pages and modules, which WPF-UI's navigation frame had cut off. Dynamic's gradient accents were cut (text over a gradient changes contrast across it).
|
||||
- **Accessibility:** the sidebar as lists screen readers can use, names for WPF-UI's unnamed buttons and for every row's buttons, headings and live regions, the palette's settings tabs and commands, keyboard shortcuts in pop-outs, widths that grow with the text, and High Contrast checks.
|
||||
- **Translations:** live language changes everywhere, Vietnamese and Japanese, and the rules in [TRANSLATING](TRANSLATING.md).
|
||||
|
||||
### P4 — Beta & release (mid-Dec 2026 – end of Jan 2027; planned 12 Apr – 23 May 2027)
|
||||
|
||||
**0.9 public beta** (~mid-December 2026) via GitHub Releases + the community Discord; two stabilization cycles driven by bug reports; docs final pass; **v1.0 target end of January 2027**, 23 May 2027 at the latest.
|
||||
|
||||
## 2. Versioning
|
||||
|
||||
@@ -89,7 +101,7 @@ Every version below 1.0.0 is published as a GitHub **pre-release**; 1.0.0 is the
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Widevine unavailable in WebView2 on target machines | Spotify won't play | **Retired by spike #1:** the evergreen runtime ships Widevine and Spotify plays without flags. If a future runtime breaks EME, the bug report's EME self-check shows it. Fallback unchanged: ship the Spotify entry disabled with a note |
|
||||
| Widevine unavailable in WebView2 on target machines | Spotify won't play | **Retired by spike #1:** the evergreen runtime ships Widevine and Spotify plays without flags. If a future runtime breaks EME, Spotify stops playing and users report it. Fallback: take the Spotify entry out of the catalog (the schema has no "disabled" state), with a note in the release notes and Discussions |
|
||||
| Google blocks sign-in in WebView2 | Google group unusable | **Spike #2:** sign-in works with the default user agent, and one sign-in covers the `google` group. Google's hop to country-code domains needs `navAllowSets` (P2). Client hints name WebView2, so Google could still block it later; fallback: treat it as an upstream limitation, documented |
|
||||
| LibVLCSharp airspace friction in WPF | Media UX degraded | **Retired by spike #6:** overlay controls and fullscreen in place work in a `FluentWindow`. Pop-out, in P2, moves the same view, so the video keeps playing and the overlay follows. FlyleafLib is not needed |
|
||||
| Free API tiers change (Twelve Data/Stooq) | Stocks degraded | **Materialized for Stooq** (2026-10-30), which now blocks scripted clients. Spike #7 leaves Twelve Data with the user's own key as the only provider; its free plan covers US listings. The provider abstraction stays; Stocks is first in the cut order (§4) |
|
||||
@@ -107,4 +119,4 @@ The web runner, governor, legal gate, and the trivial modules are never cut —
|
||||
|
||||
## 5. Post-v1 backlog (unordered)
|
||||
|
||||
Finnhub provider (real-time US), Google Calendar native sync, `.ics` calendar subscriptions, multi-point global hotkeys per web app (Discord's push-to-talk among them), web app favicons in the sidebar, catalog entries from §4 of WEBAPP-CATALOG, per-module popout window session restore, portable build.
|
||||
Finnhub provider (real-time US), Google Calendar native sync, `.ics` calendar subscriptions, multi-point global hotkeys per web app (Discord's push-to-talk among them), web app favicons in the sidebar, catalog entries from §4 of WEBAPP-CATALOG, per-module popout window session restore, a truly portable build (data beside the program; the Portable zip Velopack makes today still keeps its data in `%LocalAppData%\OmniDeck.Data`).
|
||||
+16
-7
@@ -1,6 +1,6 @@
|
||||
# OmniDeck — Functional Specification
|
||||
|
||||
Status: draft for v1.0 (target May 2027) · Applies to: Windows 11 (24H2 or later), x64 only
|
||||
Status: draft for v1.0 (target January 2027) · Applies to: Windows 11 (24H2 or later), x64 only
|
||||
|
||||
## 1. Goals and non-goals
|
||||
|
||||
@@ -38,6 +38,7 @@ All mini-apps implement the module contract in [ARCHITECTURE](ARCHITECTURE.md) a
|
||||
- World clock: multiple time zones, 12/24 h.
|
||||
- Countdown timer and stopwatch; finished timers raise a Windows toast (works while minimized to tray).
|
||||
- Alarms fire only while OmniDeck is running (tray counts as running); this limitation is stated in the UI.
|
||||
- **As built in P3:** alarms live in Timer: a time of day, once, daily, on weekdays or at weekends, with an optional label and an on/off switch. `OdAlarmService` keeps them in a settings document of their own and outlives the module, like the timers. A one-off alarm turns itself off once it rang; one that came due while OmniDeck was closed is not shown later, and one the PC slept through rings on waking only within the hour. A time that a daylight-saving change skips rings once the clock is past the gap, and one that happens twice rings the first time.
|
||||
|
||||
### 3.2 Calculator
|
||||
- Standard + scientific modes, calculation history (session-scoped), copy result.
|
||||
@@ -52,20 +53,27 @@ All mini-apps implement the module contract in [ARCHITECTURE](ARCHITECTURE.md) a
|
||||
- Import/export **iCalendar (.ics)** via Ical.Net.
|
||||
- Event reminders raise toasts (same running-app caveat as alarms).
|
||||
|
||||
### 3.5 Stocks (US/EU)
|
||||
- **Watchlist** with quote, day change, sparkline; detail view with candlestick/OHLC + volume charts (ScottPlot 5), range 1M/6M/1Y/5Y.
|
||||
### 3.5 Stocks
|
||||
- **Watchlist** with quote, day change, sparkline; detail view with candlestick/OHLC + volume charts, range 1M/6M/1Y/5Y. Charts are drawn by OmniDeck's own WPF controls, which follow the design tokens, High Contrast and screen readers; no charting library is bundled (decided 3 November 2026).
|
||||
- **Provider** behind `IOdQuoteProvider`: `TwelveData`, with the user's own API key (free Basic plan or paid). The module asks for the key on first use; it is stored via **DPAPI**, never in plaintext or logs.
|
||||
- **Coverage depends on the user's plan.** The free plan covers US stocks, ETFs and US-listed ADRs. Home-market EU listings need Grow, and indices need Pro. Symbol search (`show_plan=true`, free) labels each listing with the plan it needs, and a plan error reads "not available on your Twelve Data plan".
|
||||
- **Stooq was dropped** in P0 because it now blocks scripted clients ([spike #7](spikes/07-providers.md)).
|
||||
- Client-side **sliding-window rate limiting**: ≤ 8 credits per rolling 60 s and the plan's daily budget, counting failed calls. Watchlist refreshes use batch quotes. On limit or error, keep the last cached values and show `N/A` for missing fields; never delete cached data on network failure.
|
||||
- Every stocks screen carries the data disclaimer footer ("delayed/indicative data — not investment advice"), mirrored in [DISCLAIMER](legal/DISCLAIMER.md).
|
||||
|
||||
- **As built in P3:**
|
||||
- The first screen explains the key and links to Twelve Data's sign-up page; "Test and save" spends one credit on `api_usage` and keeps the key only if Twelve Data accepts it, along with the plan's limits. The key panel shows the plan and changes or removes the key; removing it keeps the watchlist and its last figures.
|
||||
- The watchlist (in the module's settings document) shows each listing's price, the day's change with its sign and direction, a sparkline of the last month and the time of the price; screen readers hear each row as one sentence. Delete removes a row, Alt+Up and Alt+Down move it, and its context menu does the same.
|
||||
- Search costs nothing and labels every listing the key's plan does not reach ("Needs Twelve Data's Grow plan"); those cannot be added, and a listing that fails for its plan or as unknown is not asked for again that session.
|
||||
- Quotes refresh only while Stocks is on screen: every 15 minutes while the US market trades, once more about 20 minutes after the close for the final price, then not until the next session. A year of daily bars, fetched once per trading day, serves the sparklines. 100 credits a day are kept back for what the user asks for, and when the rest would not last the session the refresh interval grows and the screen says so. A minute or a day without credits, a rejected key or an unreachable service shows in a bar above the list, over the last figures.
|
||||
- The footer of every Stocks screen reads "Delayed or indicative data — not investment advice." with a link to Twelve Data.
|
||||
|
||||
### 3.6 Media player
|
||||
- Engine: **LibVLCSharp + VideoLAN.LibVLC.Windows (x64)**, plugins trimmed to codecs/demux/audio/video output.
|
||||
- Local files and folders, playlist (m3u load/save), subtitles (embedded + external `.srt`/`.ass`, encoding selection), audio track & device selection, speed 0.25–4×, snapshot.
|
||||
- libVLC initializes lazily on first open; the player counts as **pinned** while playback is active (governor may not suspend it). Suspend stops and disposes the player, and hibernate disposes libVLC too: playback holds 280–520 MB committed.
|
||||
- **Fullscreen** makes the module's own window cover the monitor. **Pop-out** moves the player's view, video window included, into the new window, so playback goes on; the track re-selection and seek that a second video view would need ([spike #6](spikes/06-libvlcsharp.md)) are not used.
|
||||
- **Build:** x64 only (`VlcWindowsX86Enabled` and `VlcWindowsArm64Enabled` set to false), with the trimmed plugin set: about 86 MB raw, 39 MB compressed.
|
||||
- **Build:** x64 only (`VlcWindowsX86Enabled` and `VlcWindowsArm64Enabled` set to false), with the trimmed plugin set: about 80 MB raw (as built, below).
|
||||
- **As built in P2:**
|
||||
- The player opens local files, folders and .m3u playlists, from its buttons or dropped on it, and saves the queue as an .m3u.
|
||||
- The queue and where playback stood live in the database (`media_playlists`), so they survive restarts.
|
||||
@@ -98,8 +106,8 @@ All mini-apps implement the module contract in [ARCHITECTURE](ARCHITECTURE.md) a
|
||||
|
||||
## 5. Cross-cutting requirements
|
||||
|
||||
- **i18n:** all shell and mini-app strings in `.resx`, EN (neutral) / VI / JA.
|
||||
- **Accessibility:** honor Windows text scaling (multiplies the preset font token) and High Contrast (overrides palette tokens); full keyboard navigation of the shell.
|
||||
- **i18n:** all shell and mini-app strings in `.resx`, EN (neutral) / VI / JA. As built in P3, a change of language reaches every screen at once, web apps at the next start; the rules and the glossaries are in [TRANSLATING](TRANSLATING.md).
|
||||
- **Accessibility:** honor Windows text scaling (multiplies the preset font token) and High Contrast (overrides palette tokens); full keyboard navigation of the shell. As built in P3: screen readers get the sidebar as lists, names for every control and row, headings and live regions; widths grow with the text; the conventions are in [WPFUI-CONVENTIONS](WPFUI-CONVENTIONS.md) §7.
|
||||
- **Storage:** everything lives under the data root `%LocalAppData%\OmniDeck.Data`: SQLite (`omnideck.db`, via Dapper) for module data; `settings.json` for configuration; Serilog rolling files under `logs\` (7-day retention). Never inside `%LocalAppData%\OmniDeck`, which is Velopack's install folder and is deleted on uninstall and reinstall ([ARCHITECTURE](ARCHITECTURE.md) §5).
|
||||
- **Updates:** Velopack against GitHub Releases; per-user install; delta updates.
|
||||
- **Security:** see [SECURITY](../SECURITY.md) — no admin, DevTools UI off in release builds, password autosave off, DPAPI for the only secret (Twelve Data key), HTTPS-only service calls; in CI, NuGet Audit (restore fails on moderate+ advisories, transitive packages included) and Dependency Review.
|
||||
@@ -122,7 +130,8 @@ All mini-apps implement the module contract in [ARCHITECTURE](ARCHITECTURE.md) a
|
||||
| CommunityToolkit.Mvvm | 8.4.2 | |
|
||||
| Serilog / Serilog.Sinks.File | 4.4.0 / 7.0.0 | |
|
||||
| Dapper / Microsoft.Data.Sqlite | 2.1.89 / 10.0.14 | |
|
||||
| ScottPlot.WPF | 5.1.59 | stocks charts |
|
||||
| Markdig | 1.5.1 | renders the legal documents |
|
||||
| Microsoft.Extensions.DependencyInjection | 10.0.14 | composition root |
|
||||
| LibVLCSharp.WPF / VideoLAN.LibVLC.Windows | 3.10.2 / 3.0.24 | media |
|
||||
| Ical.Net | 5.2.3 | calendar (v5 API) |
|
||||
| H.NotifyIcon.Wpf | 2.4.1 | tray |
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
# Translating OmniDeck
|
||||
|
||||
OmniDeck ships in English, Vietnamese and Japanese ([SPEC](SPEC.md) §5). This page is for translators and for anyone who adds a string.
|
||||
|
||||
## 1. Where the strings are
|
||||
|
||||
Each project that shows text has its own string table, with English as the neutral language:
|
||||
|
||||
| Table | English | Translations |
|
||||
|---|---|---|
|
||||
| The shell (`OmniDeck.App`, and the few strings `OmniDeck.Core` uses) | `src/OmniDeck.App/Resources/Strings.resx` | `Strings.vi.resx`, `Strings.ja.resx` beside it |
|
||||
| The built-in modules | `src/OmniDeck.Modules/Resources/Strings.resx` | likewise |
|
||||
| The web runner | `src/OmniDeck.Web/Resources/Strings.resx` | likewise |
|
||||
|
||||
A translation holds only the keys it translates: a key it lacks shows in English. Edit the `.resx` files in an editor that keeps them as they are (Visual Studio or Rider's resource editor, or any text editor). Read a key's `<comment>` before translating it: it says what the placeholders hold and where the text shows.
|
||||
|
||||
## 2. Rules
|
||||
|
||||
- **Placeholders.** `{0}`, `{1}`… are filled in at run time. A translation keeps every placeholder of the English text (a test checks), in whatever order the sentence needs.
|
||||
- **Whole sentences.** Each key is a whole sentence or label: OmniDeck never builds a sentence out of pieces, so word order is yours. When a screen needs a sentence around a control (a repeat's interval, for one), the control's items are whole phrases instead, such as "every 2 weeks".
|
||||
- **Formats.** A few keys are .NET date and time formats rather than words: `Clock_Time12` (`h:mm:ss tt`) and `Weather_DayFormat` (`ddd d`). Reorder their parts as your language writes them; the day and month names, and AM and PM, come from the user's regional format.
|
||||
- **Numbers and dates.** They follow the user's regional format (Windows → Time & language → Region), not the UI language. A Vietnamese UI on an English (United States) region shows US dates: that is by design.
|
||||
- **Names.** Language names are written in their own language (English, Tiếng Việt, 日本語) whatever the UI language, and are not in the string tables. Brand names are never translated: OmniDeck, Spotify, Discord, Twelve Data, Open-Meteo.
|
||||
|
||||
## 3. What stays in English
|
||||
|
||||
- The legal documents (`docs/legal`), as the app shows them: they exist in English only.
|
||||
- The text of a bug report's GitHub issue, which is for the maintainer: its headings are English and its modules go by id. The bug report dialog itself is translated.
|
||||
- The logs.
|
||||
|
||||
## 4. How the app switches language
|
||||
|
||||
`OdLocalization` holds the UI language. XAML binds its strings with `{res:OdLoc Key}`, and a row's buttons with `{res:OdLocRow Key, Path=…}`, so those follow a change of language at once. Text built in code follows through `OdLocalization.FollowCulture(handler)`: each view model that builds text reads it again on a change, and one that is disposed stops with `UnfollowCulture`; a follower that fails is logged and keeps its old text, without stopping the others. Lists the user picks from keep their entries and change only their text (`OdChoice<T>`, `OdLocalizedOption`, `OdPresetOption`), so the selection bound to them stays. WebView2 takes the UI language when it starts: web apps follow on OmniDeck's next start.
|
||||
|
||||
## 5. Checks
|
||||
|
||||
- `OdResxKeyTests`: every key the sources use exists in English, and every English key is used.
|
||||
- `OdTranslationTests`: a translation has only English keys, the English placeholders, and no empty text.
|
||||
- The tests run in US English, so they pass on Vietnamese and Japanese Windows.
|
||||
|
||||
## 6. Vietnamese
|
||||
|
||||
**Voice.** Short and plain, as Windows says it in Vietnamese: labels and buttons are bare phrases ("Lưu", "Xóa nơi này"), messages are whole sentences. Address the reader as "bạn" only where English says "you", and keep "vui lòng" for the rare request. Tones go on the modern position, as Windows writes them: "hóa", "thủy", "khóa".
|
||||
|
||||
**Terms.** Windows' own Vietnamese terms where Windows has one.
|
||||
|
||||
| English | Tiếng Việt |
|
||||
|---|---|
|
||||
| module | mô-đun |
|
||||
| web app | ứng dụng web |
|
||||
| sidebar | thanh bên |
|
||||
| module library | thư viện mô-đun |
|
||||
| pin / unpin | ghim / bỏ ghim |
|
||||
| pop out / return to main window | mở trong cửa sổ riêng / về cửa sổ chính |
|
||||
| command palette | bảng lệnh |
|
||||
| Settings / Appearance | Cài đặt / Giao diện |
|
||||
| layout (preset): Dynamic, Standard, Comfort | bố cục: Năng động, Tiêu chuẩn, Dễ nhìn |
|
||||
| theme: Light, Dark, Follow Windows | chủ đề: Sáng, Tối, Theo Windows |
|
||||
| accent color | màu nhấn |
|
||||
| text size | cỡ chữ |
|
||||
| animations | hiệu ứng chuyển động |
|
||||
| High Contrast | độ tương phản cao |
|
||||
| notification area | khu vực thông báo |
|
||||
| memory: suspend, hibernate, keep running | bộ nhớ: tạm dừng, ngủ đông, luôn chạy |
|
||||
| sign in / sign-in data | đăng nhập / dữ liệu đăng nhập |
|
||||
| permission | quyền |
|
||||
| pre-release (alpha, beta) | bản thử nghiệm |
|
||||
| report a bug | báo lỗi |
|
||||
| check for updates | kiểm tra bản cập nhật |
|
||||
| data folder | thư mục dữ liệu |
|
||||
| timer, countdown, stopwatch, lap, alarm | hẹn giờ, đếm ngược, bấm giờ, vòng, báo thức |
|
||||
| event, reminder, repeat | sự kiện, lời nhắc, lặp lại |
|
||||
| forecast, chance of rain, feels like | dự báo, khả năng mưa, cảm giác như |
|
||||
| watchlist, listing, API key, plan, credits | danh sách theo dõi, mã, khóa API, gói, lượt gọi |
|
||||
| queue, playlist, subtitles | hàng chờ, danh sách phát, phụ đề |
|
||||
| local time, time zone | giờ địa phương, múi giờ |
|
||||
|
||||
**Formats.** `Clock_Time12` stays `h:mm:ss tt` and `Weather_DayFormat` stays `ddd d`: the region gives "SA"/"CH" and "T2"…"CN".
|
||||
|
||||
## 7. Japanese
|
||||
|
||||
**Voice.** As Windows 11's Japanese UI words things: labels and buttons are short noun phrases or plain verb forms (保存, キャンセル, この場所を削除), messages are sentences in です・ます form. Prefer the kanji terms Windows uses to needless katakana. A half-width space goes between Japanese and Latin letters or numbers, as Windows writes them (Web アプリ, 5 分, API キー), but not next to Japanese punctuation. Japanese has no plurals: "every {0} weeks" is "{0} 週間ごと".
|
||||
|
||||
**Terms.** Windows' own Japanese terms where Windows has one.
|
||||
|
||||
| English | 日本語 |
|
||||
|---|---|
|
||||
| module | モジュール |
|
||||
| web app | Web アプリ |
|
||||
| sidebar | サイドバー |
|
||||
| module library | モジュール ライブラリ |
|
||||
| pin / unpin | ピン留めする / ピン留めを外す |
|
||||
| pop out / return to main window | 別ウィンドウで開く / メイン ウィンドウに戻す |
|
||||
| command palette | コマンド パレット |
|
||||
| Settings / Appearance | 設定 / 外観 |
|
||||
| layout (preset): Dynamic, Standard, Comfort | レイアウト: ダイナミック, 標準, ゆったり |
|
||||
| theme: Light, Dark, Follow Windows | テーマ: ライト, ダーク, Windows の設定に合わせる |
|
||||
| accent color | アクセント カラー |
|
||||
| text size | テキストのサイズ |
|
||||
| animations | アニメーション効果 |
|
||||
| High Contrast | ハイ コントラスト |
|
||||
| notification area | 通知領域 |
|
||||
| memory: suspend, hibernate, keep running | メモリ: 一時停止, 休止, 常に実行 |
|
||||
| sign in / sign-in data | サインイン / サインイン データ |
|
||||
| permission | アクセス許可 |
|
||||
| pre-release (alpha, beta) | プレリリース版 |
|
||||
| report a bug | バグを報告 |
|
||||
| check for updates | 更新プログラムを確認 |
|
||||
| data folder | データ フォルダー |
|
||||
| timer, countdown, stopwatch, lap, alarm | タイマー, カウントダウン, ストップウォッチ, ラップ, アラーム |
|
||||
| event, reminder, repeat | 予定, 通知, 繰り返し |
|
||||
| forecast, chance of rain, feels like | 予報, 降水確率, 体感温度 |
|
||||
| watchlist, listing, API key, plan, credits | ウォッチリスト, 銘柄, API キー, プラン, クレジット |
|
||||
| queue, playlist, subtitles | キュー, プレイリスト, 字幕 |
|
||||
| local time, time zone | 現地時刻, タイム ゾーン |
|
||||
|
||||
**Formats.** `Clock_Time12` is `tt h:mm:ss` and `Weather_DayFormat` is `d日(ddd)`; the region gives 午前/午後 and the day names. A row's button names join with an ideographic comma: `A11y_RowAction` is `{0}、{1}`.
|
||||
|
||||
**Fonts.** Japanese text falls back to Yu Gothic UI, Windows' Japanese UI font (WPF's fallback for `xml:lang="ja"`); OmniDeck tags its windows with the UI language, so that kanji take their Japanese shapes rather than Chinese ones.
|
||||
+15
-4
@@ -26,9 +26,16 @@ Presets are named by their character, never by age, both in the UI and in code:
|
||||
| `Od.Nav.IconLabels` | icons, labels on hover | icons + labels | icons + labels, larger |
|
||||
| `Od.Chart.LineWeight` | 1.5 px | 2 px | 3 px |
|
||||
|
||||
Rules for module authors: never hardcode a font size, padding, radius, or animation duration — consume tokens. CI includes a XAML lint pass (XamlStyler + a grep rule) that flags literal `FontSize=` in module views.
|
||||
Rules for module authors: never hardcode a font size, padding, margin, radius, or animation duration — consume tokens. CI includes a XAML lint pass (XamlStyler + a grep rule over every view in `src`) that flags a literal `FontSize`, and a literal `Margin`, `Padding` or `CornerRadius` with any value other than zero.
|
||||
|
||||
As built in P1, the font, density, hit-target, corner-radius and motion tokens and both `Od.Nav.*` tokens drive the shell. Dynamic closes the sidebar to icons, with each name in a tooltip; Comfort shows at most six modules, always including the one on screen, and the rest stay in the library and the palette. `Od.Contrast.Target` and `Od.Accent.Saturation` are not tokens yet: every preset uses WPF-UI's palette, which meets AA. Comfort's AAA body text and Dynamic's gradient accents come with the P3 preset work, and `Od.Chart.LineWeight` with the first chart (Stocks, P3).
|
||||
As built (P1, then P3), every token in the table drives the app except `Od.Accent.Saturation`:
|
||||
|
||||
- **Sidebar.** Dynamic closes the sidebar to icons, with each name in a tooltip; Comfort shows at most six modules, always including the one on screen, and the rest stay in the library and the palette. `Od.Nav.IconLabels` is two tokens, `Od.Nav.ShowLabels` and `Od.Nav.IconSize` (16 px; 22 px in Comfort); labels are at `Od.Font.Base`, and items at least `Od.HitTarget.Min` tall.
|
||||
- **Spacing.** It all comes from `Od.Density`: `Od.Padding.Control` and `Od.Padding.Card`, and the margins `Od.Margin.Item` (after a block), `Od.Margin.Tile` (after a tile in a grid), `Od.Margin.Leading` and `Od.Margin.Inline` (before and after an element in a row) and `Od.Margin.Tight` (between the keys of a keypad).
|
||||
- **Contrast.** `Od.Contrast.Target` picks the preset's text palette (§6). Secondary and tertiary text meet 4.5:1 in Dynamic and Standard, and 7:1 in Comfort, on every WPF-UI surface of the light and dark themes; WPF-UI's own tertiary text is about 3.3:1 on the light theme. A test reads the surfaces from WPF-UI's theme dictionaries, so an update of WPF-UI is checked too.
|
||||
- **Hit targets.** `Od.HitTarget.Min` is the minimum height of buttons, text boxes, check boxes, radio buttons, combo boxes, toggle switches, list items, menu items and sidebar items.
|
||||
- **No gradients.** Dynamic's gradient accents were cut in P3: text over a gradient changes contrast across the surface, so no preset draws one and `Od.Accent.Saturation` is not a token. Every preset uses the accent Windows or the user chose.
|
||||
- **Charts.** `Od.Chart.LineWeight` sets the line width of the charts (Weather, Stocks).
|
||||
|
||||
## 3. User overrides
|
||||
|
||||
@@ -36,14 +43,18 @@ Appearance settings expose the presets as three cards plus granular overrides on
|
||||
|
||||
## 4. Windows accessibility interplay (non-negotiable)
|
||||
|
||||
- **Text scaling:** the OS text scale factor multiplies `Od.Font.Base` on top of everything else.
|
||||
- **High Contrast:** when `SystemParameters.HighContrast` is on, palette tokens defer to system colors entirely; only layout tokens from the preset remain.
|
||||
- **Text scaling:** the OS text scale factor multiplies `Od.Font.Base` on top of everything else. As built, widths that hold text grow with it too: `Od.Width.Tile`, `Od.Width.TileWide`, `Od.Width.Field` and `Od.Width.Readable` are multiples of `Od.Font.Base`, and rows of buttons in tiles wrap rather than clip.
|
||||
- **High Contrast:** when `SystemParameters.HighContrast` is on, palette tokens defer to system colors entirely; only layout tokens from the preset remain. As built, the preset layer then carries no text palette, `Od.Opacity.Dim` (0.7 otherwise, for what is dimmed but still in use) is 1, and Settings hides the accent swatches.
|
||||
- **Reduced motion:** if the OS animation setting is off, `Od.Motion` is forced off regardless of preset.
|
||||
|
||||
## 5. Onboarding
|
||||
|
||||
Immediately after the legal gate, first-run shows: language (EN/VI/JA) → preset picker (three live preview cards rendered with each preset's actual tokens — no screenshots) → done. Both choices are one click to change later in Settings.
|
||||
|
||||
As built, each card gets that preset's own layer, built by the theme engine at the Windows text size, the user's font scale and the current theme (`OdPresetPreview`), so its title and text show the preset's sizes and text palette. Picking a card applies the preset to the whole window at once.
|
||||
|
||||
## 6. Dark/light
|
||||
|
||||
Independent axis from presets: Light / Dark / Follow Windows (default). Every preset defines both palettes; contrast targets in §2 apply to both.
|
||||
|
||||
As built, a preset's palette replaces WPF-UI's secondary and tertiary text brushes (`OdPalette`); primary text and every other color stay WPF-UI's. Dynamic and Standard keep WPF-UI's values where they already pass and darken the light theme's tertiary text; Comfort's are stronger on both themes. In High Contrast the preset layer carries no palette at all.
|
||||
@@ -53,7 +53,7 @@ Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int, c
|
||||
| id | profile | audioPin | Notes |
|
||||
|---|---|---|---|
|
||||
| spotify | spotify | yes | Web Player; DRM works in the runtime ([spike #1](spikes/01-drm-widevine.md)). "Continue with Google / Facebook / Apple" move the main frame to `accounts.google.com`, `www.facebook.com` and `appleid.apple.com` and back, so those hosts and the `google-account-domains` set are listed (each hop checked up to the provider's sign-in page on 2 November 2026) |
|
||||
| discord | discord | yes | pinned while a voice or video call plays audio; no global PTT on web; host hotkey partial mitigation |
|
||||
| discord | discord | yes | pinned while a voice or video call plays audio; no global push-to-talk on the web; a host-side hotkey is on the post-v1 backlog |
|
||||
| youtube | google | yes | sign-in hops to Google's country-code domains, allowed through the `google-account-domains` set like every `google` entry ([spike #2](spikes/02-google-sign-in.md)) |
|
||||
| gmail | google | no | |
|
||||
| gcalendar | google | no | |
|
||||
@@ -63,4 +63,4 @@ Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int, c
|
||||
|
||||
## 4. Known-good candidates for post-v1 PRs
|
||||
|
||||
WhatsApp Web, Telegram Web, X, Reddit, Notion — all verified-working-in-Edge, low-controversy additions the community can contribute following §2.
|
||||
WhatsApp Web, Telegram Web, X, Reddit, Notion — low-controversy candidates that work in Microsoft Edge but have not been checked in OmniDeck yet; the community can propose them following §2.
|
||||
@@ -89,21 +89,36 @@ Snackbar/dialog services need a presenter host registered from the shell window
|
||||
|
||||
## 6. Theming with Od.* tokens
|
||||
|
||||
- Module views consume **`Od.*` tokens only** (fonts, spacing, radius, motion — see [UI-MODES](UI-MODES.md)). CI greps for literal `FontSize=` in module views.
|
||||
- Module views consume **`Od.*` tokens only** (fonts, spacing, radius, motion — see [UI-MODES](UI-MODES.md)). CI greps every view for a literal `FontSize`, and for a literal `Margin`, `Padding` or `CornerRadius` other than zero.
|
||||
- Text size reaches views through property inheritance, and three things in WPF-UI 4.3 cut it off:
|
||||
- the navigation view's frame passes neither the text color nor the size into its pages, so each page and the module stage set `Foreground` and `FontSize` themselves;
|
||||
- `ListBox` is styled at 14 px and `ToolTip` at 12 px, so `OdStyles.xaml` restyles both from the tokens;
|
||||
- the sidebar item template sets 14 px on its label, so the shell gives its items a label template of its own (`NavLabel`).
|
||||
- Colors come from WPF-UI theme resources via `DynamicResource` (e.g. `TextFillColorPrimaryBrush`, `ControlFillColorDefaultBrush` — look keys up in the Gallery/theme dictionaries, don't guess). Never hardcode a brush.
|
||||
- Preset dictionaries may override WPF-UI resource keys **deliberately and documented** — each override gets a comment stating why.
|
||||
- Accent color (user override in Appearance settings) goes through `ApplicationAccentColorManager` — one call site in the theme engine, nowhere else.
|
||||
- Dark/light is an axis independent of presets; both palettes must pass the contrast targets in UI-MODES for every preset.
|
||||
|
||||
## 7. Icons
|
||||
## 7. Accessibility
|
||||
|
||||
What screen readers and the keyboard need, and what WPF-UI 4.3 leaves out (P3; `scripts/od-drive.ps1 -Action audit` lists what is still missing on a screen):
|
||||
|
||||
- **Sidebar.** WPF-UI hosts the items in plain item controls, whose peers wrap each item in a data item that can be neither invoked nor selected. `OdNavigationView`'s peer lists `OdNavItem`s instead, as two lists (the modules, then Settings and the library) of list items with Invoke and SelectionItem. Both are subclasses, so they take WPF-UI's styles by name; a test lays the view out on WPF-UI's own dictionaries to catch a template that changes.
|
||||
- **Template parts.** `OdAutomationNames` names the buttons WPF-UI leaves unnamed, or named after a glyph such as "CaretUp24": the title bar's (Maximize turns into Restore), the sidebar's pane button (Open or Close navigation), the scroll bar, slider and number box buttons, and the password box's reveal button. An editable combo box's text box, which takes the focus, gets its combo box's name. It names each on its first layout: WPF raises `Loaded` only on elements that handle it themselves.
|
||||
- **Lists.** Screen readers name a list item after its data's `ToString()`, which for a record lists all its members: every item type overrides it, as a sentence where the row shows several values. A button that every row has is named after its row too, with `{res:OdLocRow Key, Path=…}` ("Remove, Tokyo"; `LabelPath=` when the row provides the label).
|
||||
- **State.** A button whose job changes is named for what it does now (Play or Pause, Mute or Unmute), and so is its tooltip.
|
||||
- **Headings and live regions.** Page titles are `AutomationProperties.HeadingLevel="Level1"` and section titles `Level2`. A status line is an `OdStatusText`: WPF knows `LiveSetting`, but makes a change heard only when the element raises the event, which a `TextBlock` never does.
|
||||
- **Keyboard.** Ctrl+K opens the palette in pop-outs too, where Ctrl+W closes the window; the palette and Ctrl+1–9 move the focus into the page they open. Enter and Delete act on the selected item of the media queue and the calculator's history. In a web app the shell's shortcuts come first: WebView2's WPF control hands Ctrl and Alt keys to WPF before the page sees them, so Ctrl+K opens the palette rather than, say, Discord's quick switcher.
|
||||
|
||||
## 8. Icons
|
||||
|
||||
WPF-UI ships Fluent System Icons (MIT). **Segoe Fluent Icons cannot be redistributed** (font EULA); it is present on every supported Windows 11 build, but we still stick to `SymbolRegular`/`SymbolFilled` glyphs so the UI never depends on a system font version. We do not bundle the font.
|
||||
|
||||
## 8. Hard rules
|
||||
## 9. Hard rules
|
||||
|
||||
- Never mix WPF-UI with Material Design In XAML (or any second UI kit) in this app.
|
||||
- `ui:` controls subclass their native counterparts — code and tests targeting base types (`ButtonBase`, `TextBoxBase`) keep working; don't duplicate logic per control flavor.
|
||||
- XamlStyler formats everything, including `ui:` attributes (upstream uses XamlStyler themselves).
|
||||
- High Contrast: when active, WPF-UI/system colors win over presets ([UI-MODES](UI-MODES.md) §4) — verify in the P3 accessibility pass.
|
||||
- High Contrast: when active, WPF-UI/system colors win over presets ([UI-MODES](UI-MODES.md) §4). Colors come from theme keys only (the charts included); `Od.Opacity.Dim` is 1 there, and the accent swatches are hidden.
|
||||
- `FluentWindow` chrome + child-HWND content (LibVLCSharp `VideoView`): fullscreen passed P0 spike #6, and media pop-out passed in P2 by moving the same view, whose overlay must not be owned by a closing window ([ARCHITECTURE](ARCHITECTURE.md) §2).
|
||||
- Version bumps of `WPF-UI*` packages are Dependabot PRs like any other, but read the release notes first — v3→v4 proved this library will rename APIs between majors.
|
||||
@@ -1,6 +1,6 @@
|
||||
# OmniDeck — Disclaimer
|
||||
|
||||
Version 1.1 — effective from the first release after 0.0.1-alpha.1. Changes since 1.0: the Stooq stock data service is no longer used, and Messenger is no longer in the web app catalog.
|
||||
Version 1.2 — effective from 0.3.0. No changes since 1.1; the legal documents share one version number.
|
||||
|
||||
## Pre-release software
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
# OmniDeck — End User License Agreement (EULA)
|
||||
|
||||
Version 1.1 — effective from the first release after 0.0.1-alpha.1. Changes since 1.0: the Stooq stock data service is no longer used, and Messenger is no longer in the web app catalog.
|
||||
Version 1.2 — effective from 0.3.0. Changes since 1.1: libVLC, bundled since the 0.2.0 pre-releases, is no longer described as coming in a later version.
|
||||
|
||||
By installing or using OmniDeck ("the Software"), you acknowledge the terms below. If you do not agree with them, do not install or use the Software.
|
||||
|
||||
@@ -10,7 +10,7 @@ The Software is free software licensed under the **GNU General Public License v3
|
||||
|
||||
## 2. Third-party components and services
|
||||
|
||||
The Software bundles third-party components (such as the .NET runtime, WPF-UI, Velopack and, in later versions, libVLC) that are governed by their own licenses, listed in THIRD-PARTY-NOTICES.md. It relies on the Microsoft Edge WebView2 Runtime that ships with Windows 11; the runtime is not bundled with the Software and is governed by Microsoft's license terms. The Software also loads third-party **web applications and data services** (e.g., Spotify, Discord, Google services, Open-Meteo, Twelve Data). Your use of those services is governed solely by their own terms of service and privacy policies; you are responsible for complying with them. OmniDeck is not affiliated with, endorsed by, or sponsored by any of these providers, and their trademarks belong to their respective owners.
|
||||
The Software bundles third-party components (such as the .NET runtime, WPF-UI, Velopack and libVLC) that are governed by their own licenses, listed in THIRD-PARTY-NOTICES.md. It relies on the Microsoft Edge WebView2 Runtime that ships with Windows 11; the runtime is not bundled with the Software and is governed by Microsoft's license terms. The Software also loads third-party **web applications and data services** (e.g., Spotify, Discord, Google services, Open-Meteo, Twelve Data). Your use of those services is governed solely by their own terms of service and privacy policies; you are responsible for complying with them. OmniDeck is not affiliated with, endorsed by, or sponsored by any of these providers, and their trademarks belong to their respective owners.
|
||||
|
||||
## 3. Your responsibilities
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# OmniDeck — Privacy Policy
|
||||
|
||||
Version 1.1 — effective from the first release after 0.0.1-alpha.1. Changes since 1.0: the Stooq stock data service is no longer used, and Messenger is no longer in the web app catalog.
|
||||
Version 1.2 — effective from 0.3.0. Changes since 1.1: what Open-Meteo and Twelve Data receive is spelled out, requests OmniDeck makes itself name the app and its version, and media snapshots, saved in your Pictures folder, are not removed with the app.
|
||||
|
||||
**Short version: OmniDeck collects nothing.** There is no telemetry, no analytics, no account, no crash auto-upload, and no server operated by the OmniDeck project that receives your data.
|
||||
|
||||
@@ -14,18 +14,22 @@ All of the following stays in `%LocalAppData%\OmniDeck.Data` (the data root) and
|
||||
- Logs (7-day rolling) and any bug-report zips you generate.
|
||||
- Your optional Twelve Data API key, encrypted with Windows DPAPI.
|
||||
|
||||
The app itself is installed separately, in `%LocalAppData%\OmniDeck`. Uninstalling OmniDeck removes both folders. To reset the app without uninstalling it, delete the data root (Settings → Data → open data folder).
|
||||
Snapshots you take in the media player are saved as pictures in `Pictures\OmniDeck`, outside the data root.
|
||||
|
||||
The app itself is installed separately, in `%LocalAppData%\OmniDeck`. Uninstalling OmniDeck removes both folders, but not the snapshots in `Pictures\OmniDeck`: those are yours to keep or delete, like any picture. To reset the app without uninstalling it, delete the data root (Settings → Data → open data folder).
|
||||
|
||||
## 2. Network connections the app makes
|
||||
|
||||
OmniDeck only talks to the internet for the features you use:
|
||||
|
||||
- **Open-Meteo** — weather forecasts and geocoding for your saved locations.
|
||||
- **Twelve Data**, only after you enter your own API key: stock quotes, price history and symbol search for the stocks module.
|
||||
- **Open-Meteo** — weather forecasts and geocoding for your saved locations. It receives the place names you search for, with the UI language for the results, and the coordinates of your saved places, rounded to four decimal places (about 10 m), with the units you chose. No key or identifier is sent.
|
||||
- **Twelve Data**, only after you enter your own API key: stock quotes, price history and symbol search for the stocks module. It receives your key (in a request header, never in a web address), the symbols on your watchlist and the text you search for, and can link them to your Twelve Data account.
|
||||
- **GitHub** — update checks/downloads (Velopack) and the daily web-app catalog refresh; opening a pre-filled bug-report issue happens in your browser and only if you choose to.
|
||||
- **Microsoft Edge WebView2 Runtime** — the Microsoft component that renders the web apps may contact Microsoft services on its own, for example Microsoft Defender SmartScreen reputation checks for the pages you visit and the runtime's own updates and diagnostic data. That traffic is governed by Microsoft's privacy statement and your Windows diagnostic-data settings; OmniDeck does not enable any additional reporting.
|
||||
- **The third-party web apps you open** (Spotify, Discord, Google services, Facebook, etc.) — these connections go directly from your device to those providers. Their handling of your data is governed by **their** privacy policies, not this one. OmniDeck does not inject analytics into, read the contents of, or proxy these sessions.
|
||||
|
||||
Requests OmniDeck makes itself — to Open-Meteo, to Twelve Data and for the web-app catalog — name the app and its version in their User-Agent header (for example `OmniDeck/0.3.0`), as these services ask of apps; they carry nothing else about you or your device.
|
||||
|
||||
## 3. Bug reports
|
||||
|
||||
Bug reporting is manual and transparent: the app shows you the pre-filled issue text, scrubs query strings/cookies/token-shaped values from captured console output and logs, and writes the log zip locally for you to review and attach yourself. Nothing is uploaded automatically.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
OmniDeck is licensed under GPL-3.0. This file lists the third-party components OmniDeck builds include, with their licenses, and ships in the app's `legal` folder. The self-contained .NET runtime's own license and third-party notices ship next to it, in `legal\Microsoft.NETCore.App\` and `legal\Microsoft.WindowsDesktop.App\`.
|
||||
|
||||
**Maintenance note:** verify this file against the shipped packages at every release (`dotnet list src/OmniDeck.App package --include-transitive` plus a license check) — it is authoritative only when it matches what ships. When a planned component (§2) lands, move it to §1 and add its license text to §6.
|
||||
**Maintenance note:** verify this file against the shipped packages at every release (`dotnet list src/OmniDeck.App package --include-transitive` plus a license check) — it is authoritative only when it matches what ships. A newly bundled component goes in §1, with its license text in §5.
|
||||
|
||||
## 1. Bundled in current builds
|
||||
|
||||
@@ -24,24 +24,18 @@ OmniDeck is licensed under GPL-3.0. This file lists the third-party components O
|
||||
| SQLite (the `e_sqlite3` native library) | bundled with SQLitePCLRaw 2.1.13 | public domain | local database engine |
|
||||
| Ical.Net | 5.2.3 | MIT | calendar repeats and .ics import/export |
|
||||
| NodaTime (with the IANA time zone database, public domain) | 3.2.2 | Apache-2.0 | time zones for Ical.Net |
|
||||
| Microsoft.Web.WebView2 (Core, WPF and WinForms bindings, WebView2Loader) | 1.0.4314.35 | BSD-3-Clause | web app engine bindings; the WebView2 Runtime itself is not bundled (§3) |
|
||||
| Microsoft.Web.WebView2 (Core, WPF and WinForms bindings, WebView2Loader) | 1.0.4314.35 | BSD-3-Clause | web app engine bindings; the WebView2 Runtime itself is not bundled (§2) |
|
||||
| LibVLCSharp + LibVLCSharp.WPF | 3.10.2 | LGPL-2.1-or-later | media player bindings |
|
||||
| libVLC (`VideoLAN.LibVLC.Windows`: libvlc, libvlccore and the plugins in `libvlc\win-x64`) | 3.0.24 | LGPL-2.1-or-later core and most plugins; some plugins GPL-2.0-or-later | media engine |
|
||||
|
||||
libVLC note: OmniDeck redistributes the libVLC 3.0.24 binaries unmodified, as separate files in `libvlc\win-x64` that can be replaced, with the plugin folders listed in docs/SPEC.md §3.6. Source for that exact version is available from VideoLAN (https://download.videolan.org/pub/videolan/vlc/3.0.24/) and LibVLCSharp's from https://code.videolan.org/videolan/LibVLCSharp. The combination is distributed under GPL-3.0 terms, compatible with the LGPL-2.1+ and GPL-2.0+ components.
|
||||
|
||||
## 2. Planned components (bundled from the version that introduces them)
|
||||
|
||||
| Component | License | Role | Phase |
|
||||
|---|---|---|---|
|
||||
| ScottPlot.WPF (+ SkiaSharp, OpenTK) | MIT | stock charts | P3 |
|
||||
|
||||
## 3. Not bundled
|
||||
## 2. Not bundled
|
||||
|
||||
- **Microsoft Edge WebView2 Runtime** — ships with Windows 11 and is updated by Microsoft under Microsoft's license terms; OmniDeck does not redistribute it.
|
||||
- **Development-time tools** (used to build and check OmniDeck, never distributed): Roslynator (Apache-2.0), Meziantou.Analyzer (MIT), ReferenceTrimmer (MIT), XamlStyler (Apache-2.0), xUnit (Apache-2.0), coverlet (MIT), Microsoft.NET.Test.Sdk (MIT), Microsoft.Extensions.TimeProvider.Testing (MIT), Velopack CLI `vpk` (MIT), SonarScanner for .NET (LGPL-3.0), SonarAnalyzer.CSharp (SONAR Source-Available License v1.0).
|
||||
|
||||
## 4. Data services (not bundled; accessed at runtime)
|
||||
## 3. Data services (not bundled; accessed at runtime)
|
||||
|
||||
| Service | Terms | Use |
|
||||
|---|---|---|
|
||||
@@ -49,11 +43,11 @@ libVLC note: OmniDeck redistributes the libVLC 3.0.24 binaries unmodified, as se
|
||||
| Twelve Data | user's own API key under Twelve Data's terms | stock quotes, price history and symbol search (only with the user's key) |
|
||||
| GitHub | GitHub Terms of Service | releases, catalog refresh, issues |
|
||||
|
||||
## 5. Third-party web applications
|
||||
## 4. Third-party web applications
|
||||
|
||||
Web apps in the catalog (Spotify, Discord, YouTube, Gmail, Google Calendar, Google Drive, Google Maps, Facebook) are loaded from their providers' own servers and are not components of OmniDeck. All associated trademarks belong to their respective owners; see DISCLAIMER.md.
|
||||
|
||||
## 6. License texts
|
||||
## 5. License texts
|
||||
|
||||
### MIT License
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ The SPEC set keeps the plugin folders access, audio filter, audio mixer, audio o
|
||||
## Consequences
|
||||
|
||||
- **Engine:** LibVLCSharp with libVLC 3.0.x, as [SPEC](../SPEC.md#36-media-player) §3.6 says. FlyleafLib stays unused.
|
||||
- **Fullscreen:** the module's own window (main or pop-out) covers the monitor; the player never moves to a separate fullscreen window. This passes the fullscreen part of [WPFUI-CONVENTIONS](../WPFUI-CONVENTIONS.md#8-hard-rules) §8.
|
||||
- **Fullscreen:** the module's own window (main or pop-out) covers the monitor; the player never moves to a separate fullscreen window. This passes the fullscreen part of [WPFUI-CONVENTIONS](../WPFUI-CONVENTIONS.md#9-hard-rules) §8.
|
||||
- **Pop-out:** move the player to the new `VideoView`, re-select the video track, and seek to the current time. Pop-out ships only after P2 fixes the overlay's sizing in a newly created window and re-tests it, as §8 requires.
|
||||
- **Build:**
|
||||
- set `VlcWindowsX86Enabled` and `VlcWindowsArm64Enabled` to `false` and use the SPEC include list;
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Drives a development OmniDeck through UI Automation, without the mouse or the keyboard.
|
||||
|
||||
.DESCRIPTION
|
||||
For checking a Debug build by hand, beside an installed OmniDeck: run the Debug build with its own
|
||||
data root ($env:OMNIDECK_DATA_ROOT, see CONTRIBUTING.md), then point this script at its process.
|
||||
It never moves the mouse or types: it invokes elements through UI Automation and posts keys to
|
||||
OmniDeck's own windows. Not part of CI.
|
||||
|
||||
Actions:
|
||||
windows the process's top-level windows
|
||||
tree the UI Automation tree (control view) down to -Depth
|
||||
audit what screen readers would trip on: controls without a name, names that are a type's or
|
||||
a record's, list items that can't be invoked or selected, sibling controls sharing a name
|
||||
invoke invokes, selects or toggles the element named -Name (within the element named -Within)
|
||||
open opens -Name through the command palette, as Ctrl+K does
|
||||
capture saves a PNG of the main window to -Path (PrintWindow: it need not be in front)
|
||||
minimize, restore, state the main window's state
|
||||
|
||||
.EXAMPLE
|
||||
$env:OMNIDECK_DATA_ROOT = "$env:TEMP\OmniDeck.Dev"
|
||||
$app = Start-Process src\OmniDeck.App\bin\Debug\net10.0-windows\OmniDeck.exe -PassThru
|
||||
pwsh scripts/od-drive.ps1 -ProcessId $app.Id -Action open -Name Weather
|
||||
pwsh scripts/od-drive.ps1 -ProcessId $app.Id -Action audit
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory)] [int] $ProcessId,
|
||||
[Parameter(Mandatory)] [ValidateSet('windows', 'tree', 'audit', 'invoke', 'open', 'capture', 'minimize', 'restore', 'state')] [string] $Action,
|
||||
[string] $Name,
|
||||
[string] $Within,
|
||||
[string] $Path,
|
||||
[int] $Depth = 6
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Add-Type -AssemblyName UIAutomationClient, UIAutomationTypes, System.Drawing
|
||||
Add-Type -Namespace OdDrive -Name Native -MemberDefinition @'
|
||||
[StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left, Top, Right, Bottom; }
|
||||
[DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||
[DllImport("user32.dll")] public static extern bool IsIconic(IntPtr hWnd);
|
||||
[DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr hWnd);
|
||||
[DllImport("user32.dll")] public static extern bool PostMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
|
||||
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr hWnd, out RECT rect);
|
||||
[DllImport("user32.dll")] public static extern bool PrintWindow(IntPtr hWnd, IntPtr hdc, uint flags);
|
||||
'@
|
||||
|
||||
$ae = [System.Windows.Automation.AutomationElement]
|
||||
$scope = [System.Windows.Automation.TreeScope]
|
||||
$walker = [System.Windows.Automation.TreeWalker]::ControlViewWalker
|
||||
$windows = $ae::RootElement.FindAll($scope::Children, (New-Object System.Windows.Automation.PropertyCondition($ae::ProcessIdProperty, $ProcessId)))
|
||||
$main = (Get-Process -Id $ProcessId).MainWindowHandle
|
||||
|
||||
function Named([string] $text) { New-Object System.Windows.Automation.PropertyCondition($ae::NameProperty, $text) }
|
||||
|
||||
function Patterns($element) { ($element.GetSupportedPatterns() | ForEach-Object { $_.ProgrammaticName -replace 'PatternIdentifiers.Pattern', '' }) -join ',' }
|
||||
|
||||
function Children($element) {
|
||||
$child = $walker.GetFirstChild($element)
|
||||
while ($null -ne $child) {
|
||||
$child
|
||||
$child = $walker.GetNextSibling($child)
|
||||
}
|
||||
}
|
||||
|
||||
function Show-Tree($element, [int] $level) {
|
||||
if ($level -gt $Depth) { return }
|
||||
foreach ($child in Children $element) {
|
||||
$c = $child.Current
|
||||
'{0}{1} "{2}" [{3}] {4}' -f (' ' * $level), $c.ControlType.ProgrammaticName.Replace('ControlType.', ''), $c.Name, $c.AutomationId, (Patterns $child)
|
||||
Show-Tree $child ($level + 1)
|
||||
}
|
||||
}
|
||||
|
||||
$needsName = 'Button', 'CheckBox', 'RadioButton', 'ComboBox', 'Edit', 'Hyperlink', 'ListItem', 'DataItem', 'TabItem', 'MenuItem', 'Slider', 'Spinner', 'TreeItem', 'SplitButton', 'Image'
|
||||
function Audit($element, [string] $path) {
|
||||
$kids = @(Children $element)
|
||||
$kids | Where-Object { $_.Current.Name } |
|
||||
Group-Object { $_.Current.ControlType.ProgrammaticName + ' "' + $_.Current.Name + '"' } |
|
||||
Where-Object { $_.Count -gt 1 -and $_.Name -notmatch '^ControlType\.(Text|Separator)' } |
|
||||
ForEach-Object { 'SHARED {0} x{1} @ {2}' -f $_.Name.Replace('ControlType.', ''), $_.Count, $path }
|
||||
foreach ($kid in $kids) {
|
||||
$c = $kid.Current
|
||||
$type = $c.ControlType.ProgrammaticName.Replace('ControlType.', '')
|
||||
if ($c.IsOffscreen -and $type -ne 'TabItem') { continue }
|
||||
$patterns = Patterns $kid
|
||||
if ($type -in $needsName -and [string]::IsNullOrWhiteSpace($c.Name)) { 'NO NAME {0} [{1}] {2} @ {3}' -f $type, $c.AutomationId, $patterns, $path }
|
||||
if ($c.Name -match '\{ |^Od[A-Z]|^System\.|^Wpf\.|^OmniDeck\.|\d24$|Regular$') { 'BAD NAME {0} "{1}" @ {2}' -f $type, $c.Name, $path }
|
||||
if ($type -in 'DataItem', 'ListItem' -and $patterns -notmatch 'Invoke|SelectionItem|Toggle|ExpandCollapse') { 'NO ACTION {0} "{1}" @ {2}' -f $type, $c.Name, $path }
|
||||
$label = if ($c.Name) { $c.Name.Substring(0, [Math]::Min(30, $c.Name.Length)) } else { $type }
|
||||
Audit $kid "$path > $label"
|
||||
}
|
||||
}
|
||||
|
||||
function Press($element) {
|
||||
$pattern = $null
|
||||
if ($element.TryGetCurrentPattern([System.Windows.Automation.InvokePattern]::Pattern, [ref] $pattern)) { $pattern.Invoke(); return 'invoked' }
|
||||
if ($element.TryGetCurrentPattern([System.Windows.Automation.SelectionItemPattern]::Pattern, [ref] $pattern)) { $pattern.Select(); return 'selected' }
|
||||
if ($element.TryGetCurrentPattern([System.Windows.Automation.TogglePattern]::Pattern, [ref] $pattern)) { $pattern.Toggle(); return 'toggled' }
|
||||
'found, but it has no Invoke, SelectionItem or Toggle pattern'
|
||||
}
|
||||
|
||||
switch ($Action) {
|
||||
'windows' {
|
||||
foreach ($w in $windows) { '"{0}" hwnd={1} class={2}' -f $w.Current.Name, $w.Current.NativeWindowHandle, $w.Current.ClassName }
|
||||
}
|
||||
'tree' {
|
||||
foreach ($w in $windows) { '== "{0}"' -f $w.Current.Name; Show-Tree $w 1 }
|
||||
}
|
||||
'audit' {
|
||||
foreach ($w in $windows) { '== "{0}"' -f $w.Current.Name; Audit $w $w.Current.Name }
|
||||
}
|
||||
'invoke' {
|
||||
foreach ($w in $windows) {
|
||||
$root = if ($Within) { $w.FindFirst($scope::Descendants, (Named $Within)) } else { $w }
|
||||
if ($null -eq $root) { continue }
|
||||
$target = $root.FindFirst($scope::Descendants, (Named $Name))
|
||||
if ($null -ne $target) { "$(Press $target) '$Name'"; return }
|
||||
}
|
||||
"not found: '$Name'"
|
||||
}
|
||||
'open' {
|
||||
# The title bar's search box opens the palette; Enter is posted to the palette's own window.
|
||||
$shell = $windows | Where-Object { $_.Current.NativeWindowHandle -eq [int] $main } | Select-Object -First 1
|
||||
# By automation ID, which no language changes.
|
||||
$search = New-Object System.Windows.Automation.PropertyCondition($ae::AutomationIdProperty, 'PaletteButton')
|
||||
$shell.FindFirst($scope::Descendants, $search).GetCurrentPattern([System.Windows.Automation.InvokePattern]::Pattern).Invoke()
|
||||
|
||||
# The palette is a window the main one owns: UI Automation lists it beside the main window or under it.
|
||||
$palette = $null
|
||||
for ($try = 0; $try -lt 20 -and $null -eq $palette; $try++) {
|
||||
Start-Sleep -Milliseconds 150
|
||||
$palette = $ae::RootElement.FindAll($scope::Children, (New-Object System.Windows.Automation.PropertyCondition($ae::ProcessIdProperty, $ProcessId))) |
|
||||
Where-Object { $_.Current.NativeWindowHandle -ne [int] $main } | Select-Object -First 1
|
||||
if ($null -eq $palette) {
|
||||
$palette = $shell.FindFirst($scope::Children, (New-Object System.Windows.Automation.PropertyCondition($ae::ControlTypeProperty, [System.Windows.Automation.ControlType]::Window)))
|
||||
}
|
||||
}
|
||||
if ($null -eq $palette) { throw 'The palette did not open.' }
|
||||
$edit = $palette.FindFirst($scope::Descendants, (New-Object System.Windows.Automation.PropertyCondition($ae::ControlTypeProperty, [System.Windows.Automation.ControlType]::Edit)))
|
||||
$edit.GetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern).SetValue($Name)
|
||||
Start-Sleep -Milliseconds 400
|
||||
$hwnd = [IntPtr] $palette.Current.NativeWindowHandle
|
||||
[OdDrive.Native]::PostMessage($hwnd, 0x0100, [IntPtr] 0x0D, [IntPtr] 0x001C0001) | Out-Null
|
||||
[OdDrive.Native]::PostMessage($hwnd, 0x0101, [IntPtr] 0x0D, [IntPtr] 0xC01C0001) | Out-Null
|
||||
"opened '$Name' through the palette"
|
||||
}
|
||||
'capture' {
|
||||
if (-not $Path) { throw 'capture needs -Path.' }
|
||||
$rect = New-Object OdDrive.Native+RECT
|
||||
[OdDrive.Native]::GetWindowRect($main, [ref] $rect) | Out-Null
|
||||
$bitmap = New-Object System.Drawing.Bitmap(($rect.Right - $rect.Left), ($rect.Bottom - $rect.Top))
|
||||
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
||||
$hdc = $graphics.GetHdc()
|
||||
[OdDrive.Native]::PrintWindow($main, $hdc, 2) | Out-Null
|
||||
$graphics.ReleaseHdc($hdc)
|
||||
$graphics.Dispose()
|
||||
$bitmap.Save($Path, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
$bitmap.Dispose()
|
||||
"saved $Path"
|
||||
}
|
||||
'minimize' { [OdDrive.Native]::ShowWindow($main, 7) | Out-Null; 'minimized' }
|
||||
'restore' { [OdDrive.Native]::ShowWindow($main, 4) | Out-Null; 'restored' }
|
||||
'state' { "hwnd=$main iconic=$([OdDrive.Native]::IsIconic($main)) visible=$([OdDrive.Native]::IsWindowVisible($main))" }
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public sealed class OdBugReporter(
|
||||
Windows = windows,
|
||||
Preset = preset,
|
||||
Subject = subject,
|
||||
Issue = OdScrubber.Scrub(Issue(windows, preset, subject, errors, error)),
|
||||
Issue = OdScrubber.Scrub(Issue(windows, preset, hosted?.Info.Id ?? "OmniDeck in general", errors, error)),
|
||||
SystemInfo = OdScrubber.Scrub(SystemInfo(windows, preset)),
|
||||
Logs = OdScrubber.Scrub(LogTail()),
|
||||
ConsoleLog = web is null ? null : OdScrubber.Scrub(OdConsoleLog.Write(web.Console.All)),
|
||||
@@ -75,6 +75,7 @@ public sealed class OdBugReporter(
|
||||
return string.IsNullOrEmpty(display) ? $"Windows 11 ({build}{revision})" : $"Windows 11 {display} ({build}{revision})";
|
||||
}
|
||||
|
||||
// The issue is for the maintainer: it stays in English whatever the UI language, so modules go by id.
|
||||
private string Issue(string windows, string preset, string subject, string consoleErrors, string? error)
|
||||
{
|
||||
var issue = new StringBuilder();
|
||||
@@ -96,7 +97,7 @@ public sealed class OdBugReporter(
|
||||
{
|
||||
var hidden = module.State == OdModuleState.Active ? "" : ((int)(now - module.LastActive).TotalMinutes).ToString(CultureInfo.InvariantCulture) + " min";
|
||||
var memory = snapshot?.For(module.Info.Id) is { } bytes ? OdBytes.Format(bytes) : "";
|
||||
modules.Append(CultureInfo.InvariantCulture, $"| {module.Info.Title} | {module.State} | {hidden} | {memory} |\n");
|
||||
modules.Append(CultureInfo.InvariantCulture, $"| {module.Info.Id} | {module.State} | {hidden} | {memory} |\n");
|
||||
}
|
||||
|
||||
Section(issue, "Modules", modules.ToString().TrimEnd());
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
namespace OmniDeck.App.Legal;
|
||||
|
||||
/// <summary>One legal document as the gate shows it: its title and its Markdown text.</summary>
|
||||
public sealed record OdLegalPage(string Title, string Markdown);
|
||||
public sealed record OdLegalPage(string Title, string Markdown)
|
||||
{
|
||||
/// <summary>The title: screen readers name a tab after its data, which would otherwise be the whole text.</summary>
|
||||
public override string ToString() => Title;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Media;
|
||||
using Markdig;
|
||||
using Markdig.Syntax;
|
||||
@@ -35,11 +36,14 @@ internal static class OdMarkdownRenderer
|
||||
ArgumentNullException.ThrowIfNull(markdown);
|
||||
ArgumentNullException.ThrowIfNull(openLink);
|
||||
// A FlowDocument defaults to a serif reading font and justified text; the app's own font reads better here.
|
||||
// The documents exist in English only (docs/legal): they say so to screen readers and to WPF's
|
||||
// text handling, whatever the UI language around them.
|
||||
var document = new FlowDocument
|
||||
{
|
||||
PagePadding = new Thickness(0),
|
||||
FontFamily = SystemFonts.MessageFontFamily,
|
||||
TextAlignment = TextAlignment.Left,
|
||||
Language = XmlLanguage.GetLanguage("en"),
|
||||
};
|
||||
document.SetResourceReference(FlowDocument.FontSizeProperty, OdTokenKeys.FontBase);
|
||||
document.SetResourceReference(FlowDocument.ForegroundProperty, "TextFillColorPrimaryBrush");
|
||||
|
||||
@@ -19,6 +19,7 @@ using OmniDeck.Core.Storage;
|
||||
using OmniDeck.Modules;
|
||||
using OmniDeck.Modules.Calendar;
|
||||
using OmniDeck.Modules.Resources;
|
||||
using OmniDeck.Modules.Timer;
|
||||
using OmniDeck.Web;
|
||||
using OmniDeck.Web.Catalog;
|
||||
using OmniDeck.Web.Resources;
|
||||
@@ -101,11 +102,11 @@ public partial class OdApp
|
||||
Log.ForContext<OdApp>().Information("Database ready ({Applied} migrations applied)", applied);
|
||||
|
||||
var settings = _services.GetRequiredService<IOdSettingsService>();
|
||||
OdLocalization.Instance.SetCulture(OdLocalization.Instance.ResolveCulture(settings.Current.Language));
|
||||
OdLocalization.Instance.TrackWindowLanguage();
|
||||
settings.Changed += (_, e) => Dispatcher.Invoke(() => OdLocalization.Instance.SetCulture(OdLocalization.Instance.ResolveCulture(e.Settings.Language)));
|
||||
FollowLanguage(settings);
|
||||
OdAutomationNames.Register();
|
||||
|
||||
_services.GetRequiredService<OdThemeEngine>().Start(this);
|
||||
var theme = _services.GetRequiredService<OdThemeEngine>();
|
||||
theme.Start(this);
|
||||
|
||||
// The legal gate comes first, on the first run and after each legal update; Quit ends here.
|
||||
var legal = _services.GetRequiredService<OdLegalGate>();
|
||||
@@ -119,7 +120,7 @@ public partial class OdApp
|
||||
var meta = _services.GetRequiredService<IOdAppMeta>();
|
||||
if (OdOnboardingViewModel.IsNeeded(meta))
|
||||
{
|
||||
new OdOnboardingWindow(new OdOnboardingViewModel(settings, meta)).ShowDialog();
|
||||
new OdOnboardingWindow(new OdOnboardingViewModel(settings, meta, theme.Preview)).ShowDialog();
|
||||
}
|
||||
|
||||
// Only now may a second launch bring the window up: never past the gate.
|
||||
@@ -133,9 +134,18 @@ public partial class OdApp
|
||||
_services.GetRequiredService<OdRamGovernor>().Start();
|
||||
_services.GetRequiredService<OdUpdateWatcher>().Start();
|
||||
_services.GetRequiredService<OdReminderService>().Start();
|
||||
_services.GetRequiredService<OdAlarmService>().Start();
|
||||
_services.GetRequiredService<OdCatalogService>().Start();
|
||||
}
|
||||
|
||||
/// <summary>Puts the UI in the language the settings name, now and whenever they change.</summary>
|
||||
private void FollowLanguage(IOdSettingsService settings)
|
||||
{
|
||||
OdLocalization.Instance.SetCulture(OdLocalization.Instance.ResolveCulture(settings.Current.Language));
|
||||
OdLocalization.Instance.TrackWindowLanguage();
|
||||
settings.Changed += (_, e) => Dispatcher.Invoke(() => OdLocalization.Instance.SetCulture(OdLocalization.Instance.ResolveCulture(e.Settings.Language)));
|
||||
}
|
||||
|
||||
/// <summary>The main window, created once. It owns the tray icon, so it exists even while hidden.</summary>
|
||||
private OdMainWindow MainShell()
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:shell="clr-namespace:OmniDeck.App.Shell"
|
||||
xmlns:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="{res:OdLoc App_Name}"
|
||||
@@ -14,6 +15,14 @@
|
||||
PreviewKeyDown="OnPreviewKeyDown"
|
||||
WindowBackdropType="Mica"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<ui:FluentWindow.Resources>
|
||||
<!-- Sidebar labels at the preset's text size: WPF-UI's item template sets 14 px on its content. -->
|
||||
<DataTemplate x:Key="NavLabel">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.Base}"
|
||||
Text="{Binding}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</DataTemplate>
|
||||
</ui:FluentWindow.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -26,13 +35,14 @@
|
||||
<!-- Looks like a search box; opens the command palette, as Ctrl+K does. -->
|
||||
<ui:TitleBar.CenterContent>
|
||||
<ui:Button Width="360"
|
||||
Margin="16,0,0,0"
|
||||
Margin="{DynamicResource Od.Margin.Leading}"
|
||||
HorizontalContentAlignment="Left"
|
||||
AutomationProperties.AutomationId="PaletteButton"
|
||||
AutomationProperties.Name="{res:OdLoc Shell_Search}"
|
||||
Click="OnSearchClick"
|
||||
ToolTip="Ctrl+K">
|
||||
ToolTip="{res:OdLoc Shell_SearchShortcut}">
|
||||
<DockPanel>
|
||||
<ui:SymbolIcon Margin="0,0,8,0"
|
||||
<ui:SymbolIcon Margin="{DynamicResource Od.Margin.Inline}"
|
||||
DockPanel.Dock="Left"
|
||||
Symbol="Search24" />
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
@@ -44,21 +54,25 @@
|
||||
</ui:TitleBar.CenterContent>
|
||||
</ui:TitleBar>
|
||||
|
||||
<!-- Chrome only: items are built in code from OdShellViewModel.Sidebar and every navigation goes through it. -->
|
||||
<ui:NavigationView x:Name="RootNavigation"
|
||||
Grid.Row="1"
|
||||
FrameMargin="0"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsPaneToggleVisible="True"
|
||||
OpenPaneLength="240"
|
||||
PaneDisplayMode="Left"
|
||||
TitleBar="{Binding ElementName=AppTitleBar, Mode=OneWay}">
|
||||
<ui:NavigationView.ContentOverlay>
|
||||
<!--
|
||||
Chrome only: items are built in code from OdShellViewModel.Sidebar and every navigation goes through it.
|
||||
OdNavigationView gives screen readers the sidebar's items; being a subclass, it takes WPF-UI's style by name.
|
||||
-->
|
||||
<shell:OdNavigationView x:Name="RootNavigation"
|
||||
Grid.Row="1"
|
||||
FrameMargin="0"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsPaneToggleVisible="True"
|
||||
OpenPaneLength="240"
|
||||
PaneDisplayMode="Left"
|
||||
Style="{StaticResource {x:Type ui:NavigationView}}"
|
||||
TitleBar="{Binding ElementName=AppTitleBar, Mode=OneWay}">
|
||||
<shell:OdNavigationView.ContentOverlay>
|
||||
<Grid>
|
||||
<ui:SnackbarPresenter x:Name="RootSnackbar" VerticalAlignment="Bottom" />
|
||||
</Grid>
|
||||
</ui:NavigationView.ContentOverlay>
|
||||
</ui:NavigationView>
|
||||
</shell:OdNavigationView.ContentOverlay>
|
||||
</shell:OdNavigationView>
|
||||
|
||||
<!-- In-window dialogs cover the whole window, title bar included. -->
|
||||
<ui:ContentDialogHost x:Name="RootDialogHost"
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using H.NotifyIcon.Core;
|
||||
using OmniDeck.App.Diagnostics;
|
||||
using OmniDeck.App.Legal;
|
||||
@@ -54,7 +55,7 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
private readonly Dictionary<string, OdPopOutWindow> _popOuts = new(StringComparer.Ordinal);
|
||||
private readonly Dictionary<string, Rect> _popOutBounds = new(StringComparer.Ordinal);
|
||||
private OdPanePlacement? _paneBeforeFullscreen;
|
||||
private readonly Dictionary<string, NavigationViewItem> _moduleItems = new(StringComparer.Ordinal);
|
||||
private readonly Dictionary<string, OdNavItem> _moduleItems = new(StringComparer.Ordinal);
|
||||
private readonly NavigationViewItemSeparator _pinnedSeparator = new();
|
||||
private readonly OdTrayIcon _trayIcon = new();
|
||||
private bool? _navLabels;
|
||||
@@ -90,11 +91,7 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
DataContext = shell;
|
||||
_library = new OdLibraryPage { DataContext = shell };
|
||||
_settingsPage = new OdSettingsPage { DataContext = settingsPage };
|
||||
shell.SettingsSectionRequested += (_, e) => settingsPage.ShowSection(e.Section);
|
||||
settingsPage.About.LegalRequested += (_, _) =>
|
||||
new OdLegalWindow(new OdLegalViewModel(legalGate, OdApp.LegalFolder, readOnly: true)) { Owner = this }.Show();
|
||||
settingsPage.About.BugReportRequested += (sender, args) => _ = bugReports.ShowAsync(error: null);
|
||||
bugReportRequests.Requested += (sender, args) => _ = bugReports.ShowAsync(args.Error);
|
||||
ListenForRequests(shell, settingsPage, legalGate, bugReports, bugReportRequests);
|
||||
_stage = new OdModuleStage { DataContext = shell };
|
||||
_host = host;
|
||||
_cover = new OdWindowCover(this);
|
||||
@@ -121,6 +118,7 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
};
|
||||
|
||||
SetUpNavigation(theme);
|
||||
ListenForAway();
|
||||
|
||||
// WPF ignores the Windows text size; re-read it when it may have changed (docs/UI-MODES.md §4).
|
||||
Activated += (_, _) => theme.RefreshTextScale();
|
||||
@@ -187,14 +185,64 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
|
||||
private static Binding Localized(string key) => new($"[{key}]") { Source = OdLocalization.Instance, Mode = BindingMode.OneWay };
|
||||
|
||||
private static NavigationViewItem ShellItem(string target, Binding title, SymbolRegular icon, Type pageType)
|
||||
/// <summary>What the palette, the settings page and a crash ask the window to show.</summary>
|
||||
private void ListenForRequests(OdShellViewModel shell, OdSettingsViewModel settingsPage, OdLegalGate legalGate, OdBugReportFlow bugReports, OdBugReportRequests bugReportRequests)
|
||||
{
|
||||
var item = new NavigationViewItem
|
||||
shell.SettingsSectionRequested += (_, e) => settingsPage.ShowSection(e.Section);
|
||||
shell.CommandRequested += (_, e) => Run(e.Command, settingsPage, bugReports);
|
||||
settingsPage.About.LegalRequested += (_, _) =>
|
||||
new OdLegalWindow(new OdLegalViewModel(legalGate, OdApp.LegalFolder, readOnly: true)) { Owner = this }.Show();
|
||||
settingsPage.About.BugReportRequested += (sender, args) => _ = bugReports.ShowAsync(error: null);
|
||||
bugReportRequests.Requested += (sender, args) => _ = bugReports.ShowAsync(args.Error);
|
||||
}
|
||||
|
||||
/// <summary>Carries out a command the palette ran.</summary>
|
||||
private static void Run(OdShellCommand command, OdSettingsViewModel settingsPage, OdBugReportFlow bugReports)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
Icon = new SymbolIcon { Symbol = icon },
|
||||
case OdShellCommand.CheckForUpdates when settingsPage.About.CheckCommand.CanExecute(null):
|
||||
_ = settingsPage.About.CheckCommand.ExecuteAsync(null);
|
||||
break;
|
||||
case OdShellCommand.ReportBug:
|
||||
_ = bugReports.ShowAsync(error: null);
|
||||
break;
|
||||
case OdShellCommand.OpenDataFolder:
|
||||
settingsPage.OpenDataFolderCommand.Execute(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A sidebar icon at the preset's size: larger in Comfort (docs/UI-MODES.md §2).</summary>
|
||||
private static SymbolIcon NavIcon(SymbolRegular symbol)
|
||||
{
|
||||
var icon = new SymbolIcon { Symbol = symbol };
|
||||
icon.SetResourceReference(FontSizeProperty, OdTokenKeys.NavIconSize);
|
||||
return icon;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A sidebar item screen readers can use (<see cref="OdNavItem"/>), at the preset's text size and
|
||||
/// minimum hit target (docs/UI-MODES.md §2): WPF-UI draws its labels at 14 px and its items 40 px
|
||||
/// tall whatever the preset. Being a subclass, it takes WPF-UI's style by name.
|
||||
/// </summary>
|
||||
private OdNavItem NavItem(SymbolRegular icon, string target, Type pageType)
|
||||
{
|
||||
var item = new OdNavItem
|
||||
{
|
||||
Style = (Style)FindResource(typeof(NavigationViewItem)),
|
||||
Icon = NavIcon(icon),
|
||||
TargetPageTag = target,
|
||||
TargetPageType = pageType,
|
||||
ContentTemplate = (DataTemplate)FindResource("NavLabel"),
|
||||
};
|
||||
item.SetResourceReference(MinHeightProperty, OdTokenKeys.HitTargetMin);
|
||||
return item;
|
||||
}
|
||||
|
||||
private OdNavItem ShellItem(string target, Binding title, SymbolRegular icon, Type pageType)
|
||||
{
|
||||
var item = NavItem(icon, target, pageType);
|
||||
item.SetBinding(ContentControl.ContentProperty, title);
|
||||
item.SetBinding(AutomationProperties.NameProperty, title);
|
||||
item.SetBinding(ToolTipProperty, title);
|
||||
@@ -278,7 +326,7 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
}
|
||||
}
|
||||
|
||||
private NavigationViewItem ModuleItem(OdModuleItemViewModel module)
|
||||
private OdNavItem ModuleItem(OdModuleItemViewModel module)
|
||||
{
|
||||
var pin = new MenuItem { Command = _shell.TogglePinCommand, CommandParameter = module };
|
||||
var popOut = new MenuItem { CommandParameter = module };
|
||||
@@ -292,13 +340,8 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
popOut.Command = module.IsPoppedOut ? _shell.PopInCommand : _shell.PopOutCommand;
|
||||
};
|
||||
|
||||
var item = new NavigationViewItem
|
||||
{
|
||||
Icon = new SymbolIcon { Symbol = OdSymbolConverter.Parse(module.Info.Icon) },
|
||||
TargetPageTag = module.Id,
|
||||
TargetPageType = typeof(OdModuleStage),
|
||||
ContextMenu = menu,
|
||||
};
|
||||
var item = NavItem(OdSymbolConverter.Parse(module.Info.Icon), module.Id, typeof(OdModuleStage));
|
||||
item.ContextMenu = menu;
|
||||
item.SetBinding(ContentControl.ContentProperty, new Binding(nameof(OdModuleItemViewModel.Title)) { Source = module });
|
||||
item.SetBinding(AutomationProperties.NameProperty, new Binding(nameof(OdModuleItemViewModel.Title)) { Source = module });
|
||||
item.SetBinding(ToolTipProperty, new Binding(nameof(OdModuleItemViewModel.Title)) { Source = module });
|
||||
@@ -358,27 +401,62 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
if (e.Key == Key.K)
|
||||
{
|
||||
e.Handled = true;
|
||||
await OpenPaletteAsync();
|
||||
await OpenPaletteAsync(this);
|
||||
}
|
||||
else if (_shell.ShortcutTarget(e.Key, NavMaxVisibleItems) is { } target)
|
||||
{
|
||||
e.Handled = true;
|
||||
await _shell.NavigateAsync(target);
|
||||
FocusPageSoon();
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnSearchClick(object sender, RoutedEventArgs e) => await OpenPaletteAsync();
|
||||
private async void OnSearchClick(object sender, RoutedEventArgs e) => await OpenPaletteAsync(this);
|
||||
|
||||
private async Task OpenPaletteAsync()
|
||||
/// <summary>
|
||||
/// The command palette over <paramref name="owner"/>. What it runs happens in the main window, which
|
||||
/// comes forward first when the palette was opened from a pop-out; a popped-out module brings its own
|
||||
/// window back to the front.
|
||||
/// </summary>
|
||||
private async Task OpenPaletteAsync(Window owner)
|
||||
{
|
||||
var palette = new OdCommandPaletteViewModel(_shell.PaletteEntries());
|
||||
new OdCommandPaletteWindow(palette, this).ShowDialog();
|
||||
new OdCommandPaletteWindow(palette, owner).ShowDialog();
|
||||
if (palette.Chosen is { } chosen)
|
||||
{
|
||||
if (owner != this)
|
||||
{
|
||||
Present();
|
||||
}
|
||||
|
||||
await chosen.RunAsync();
|
||||
if (!_dialogs.IsOpen)
|
||||
{
|
||||
FocusPageSoon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the keyboard into the page on screen once it is shown, as after a palette choice or a Ctrl+1–9
|
||||
/// shortcut: the keyboard otherwise stays where the palette left it, outside the page.
|
||||
/// </summary>
|
||||
private void FocusPageSoon() => _ = Dispatcher.InvokeAsync(
|
||||
() =>
|
||||
{
|
||||
FrameworkElement page = _shell.CurrentTarget switch
|
||||
{
|
||||
OdShellViewModel.LibraryTarget => _library,
|
||||
OdShellViewModel.SettingsTarget => _settingsPage,
|
||||
_ => _stage,
|
||||
};
|
||||
if (IsActive && !page.IsKeyboardFocusWithin)
|
||||
{
|
||||
page.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
|
||||
}
|
||||
},
|
||||
DispatcherPriority.Input);
|
||||
|
||||
private void OnClosing(object? sender, CancelEventArgs e)
|
||||
{
|
||||
if (_lifetime.IsQuitting || !_settings.Current.CloseToTray)
|
||||
@@ -402,13 +480,32 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
|
||||
private void OnTrayNotificationClicked(object sender, RoutedEventArgs e) => _notifier.OnClicked();
|
||||
|
||||
/// <summary>A click on a notification brings the window up, on the module that raised it.</summary>
|
||||
/// <summary>Minimized or in the tray, the window shows nothing: its module goes down the ladder meanwhile.</summary>
|
||||
private void ListenForAway()
|
||||
{
|
||||
IsVisibleChanged += (_, _) => OnAwayChanged(this, EventArgs.Empty);
|
||||
StateChanged += OnAwayChanged;
|
||||
}
|
||||
|
||||
private async void OnAwayChanged(object? sender, EventArgs e) =>
|
||||
await _shell.SetWindowAwayAsync(!IsVisible || WindowState == WindowState.Minimized);
|
||||
|
||||
/// <summary>
|
||||
/// A click on a notification brings the window up, on the module that raised it. It navigates first,
|
||||
/// so a module the window showed before is not woken up only to be hidden again.
|
||||
/// </summary>
|
||||
private async void OnNotificationClicked(object? sender, OdNotificationClickedEventArgs e)
|
||||
{
|
||||
Present();
|
||||
if (e.Target is { } target)
|
||||
try
|
||||
{
|
||||
await _shell.NavigateAsync(target);
|
||||
if (e.Target is { } target)
|
||||
{
|
||||
await _shell.NavigateAsync(target);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Present();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,6 +570,7 @@ public partial class OdMainWindow : INavigationViewPageProvider
|
||||
private void OpenPopOut(OdModuleItemViewModel item, FrameworkElement view)
|
||||
{
|
||||
var window = new OdPopOutWindow(item, view, this);
|
||||
window.PaletteRequested += async (_, _) => await OpenPaletteAsync(window);
|
||||
if (_popOutBounds.TryGetValue(item.Id, out var bounds))
|
||||
{
|
||||
window.Left = bounds.Left;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.4.1" />
|
||||
<PackageReference Include="Markdig" Version="1.5.1" />
|
||||
<PackageReference Include="Markdig" Version="1.6.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.14" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
<PackageReference Include="Velopack" Version="1.2.161" />
|
||||
|
||||
@@ -0,0 +1,568 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!-- The shell's UI strings, Japanese. A key missing here shows in English (Strings.resx). -->
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="App_Name" xml:space="preserve">
|
||||
<value>OmniDeck</value>
|
||||
</data>
|
||||
<data name="Shell_Search" xml:space="preserve">
|
||||
<value>モジュールとコマンドを検索</value>
|
||||
</data>
|
||||
<data name="Shell_Library" xml:space="preserve">
|
||||
<value>ライブラリ</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryTitle" xml:space="preserve">
|
||||
<value>モジュール ライブラリ</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryIntro" xml:space="preserve">
|
||||
<value>モジュールを開くか、ピン留めしてサイドバーに表示したままにします。</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryEmpty" xml:space="preserve">
|
||||
<value>利用できるモジュールはまだありません。</value>
|
||||
</data>
|
||||
<data name="Shell_Open" xml:space="preserve">
|
||||
<value>開く</value>
|
||||
</data>
|
||||
<data name="Shell_Pin" xml:space="preserve">
|
||||
<value>サイドバーにピン留めする</value>
|
||||
</data>
|
||||
<data name="Shell_Unpin" xml:space="preserve">
|
||||
<value>サイドバーからピン留めを外す</value>
|
||||
</data>
|
||||
<data name="Shell_Close" xml:space="preserve">
|
||||
<value>閉じる</value>
|
||||
</data>
|
||||
<data name="Shell_PopOut" xml:space="preserve">
|
||||
<value>別ウィンドウで開く</value>
|
||||
</data>
|
||||
<data name="Shell_PopIn" xml:space="preserve">
|
||||
<value>メイン ウィンドウに戻す</value>
|
||||
</data>
|
||||
<data name="Shell_PaletteCommand" xml:space="preserve">
|
||||
<value>コマンド</value>
|
||||
</data>
|
||||
<data name="Shell_Quit" xml:space="preserve">
|
||||
<value>OmniDeck を終了</value>
|
||||
</data>
|
||||
<data name="Tray_Open" xml:space="preserve">
|
||||
<value>OmniDeck を開く</value>
|
||||
</data>
|
||||
<data name="Tray_QuickTimer" xml:space="preserve">
|
||||
<value>5 分のタイマーを開始</value>
|
||||
</data>
|
||||
<data name="Tray_Quit" xml:space="preserve">
|
||||
<value>終了</value>
|
||||
</data>
|
||||
<data name="Tray_StillRunningTitle" xml:space="preserve">
|
||||
<value>OmniDeck は引き続き実行中です</value>
|
||||
</data>
|
||||
<data name="Tray_StillRunningMessage" xml:space="preserve">
|
||||
<value>通知領域で実行を続けます。終了するには、アイコンのメニューから [終了] を選択してください。</value>
|
||||
</data>
|
||||
<data name="Error_Title" xml:space="preserve">
|
||||
<value>問題が発生しました</value>
|
||||
</data>
|
||||
<data name="Error_UiMessage" xml:space="preserve">
|
||||
<value>問題が発生しましたが、OmniDeck は引き続き実行中です。
|
||||
|
||||
サポート コード: {0}
|
||||
|
||||
{1}</value>
|
||||
</data>
|
||||
<data name="Error_StartFailed" xml:space="preserve">
|
||||
<value>OmniDeck を起動できませんでした。
|
||||
|
||||
{0}</value>
|
||||
</data>
|
||||
<data name="Memory_Title" xml:space="preserve">
|
||||
<value>実行中のモジュール</value>
|
||||
</data>
|
||||
<data name="Memory_Intro" xml:space="preserve">
|
||||
<value>非表示のモジュールは、メモリを節約するため、時間の経過とともにアイドル、一時停止、休止の順に移行します。対象外にするには、モジュールの [常に実行] をオンにします。</value>
|
||||
</data>
|
||||
<data name="Memory_InUse" xml:space="preserve">
|
||||
<value>使用中: {0}</value>
|
||||
</data>
|
||||
<data name="Memory_Limits" xml:space="preserve">
|
||||
<value>ソフト上限 {0} · ハード上限 {1}</value>
|
||||
</data>
|
||||
<data name="Memory_SharedNote" xml:space="preserve">
|
||||
<value>組み込みモジュールは OmniDeck 本体のプロセスを共有するため、個別の数値が表示されるのは Web アプリだけです。</value>
|
||||
</data>
|
||||
<data name="Memory_SharedTitle" xml:space="preserve">
|
||||
<value>共有の Web プロセス</value>
|
||||
</data>
|
||||
<data name="Memory_SharedDescription" xml:space="preserve">
|
||||
<value>すべての Web アプリが使用するブラウザー、グラフィックス、ヘルパーのプロセスです。最後の Web アプリを閉じると終了します。</value>
|
||||
</data>
|
||||
<data name="Memory_KeepRunning" xml:space="preserve">
|
||||
<value>常に実行</value>
|
||||
</data>
|
||||
<data name="Memory_Suspend" xml:space="preserve">
|
||||
<value>一時停止</value>
|
||||
</data>
|
||||
<data name="Memory_Hibernate" xml:space="preserve">
|
||||
<value>休止</value>
|
||||
</data>
|
||||
<data name="Memory_UsedNow" xml:space="preserve">
|
||||
<value>表示中</value>
|
||||
</data>
|
||||
<data name="Memory_UsedJustNow" xml:space="preserve">
|
||||
<value>たった今使用</value>
|
||||
</data>
|
||||
<data name="Memory_UsedMinutesAgo" xml:space="preserve">
|
||||
<value>{0} 分前に使用</value>
|
||||
</data>
|
||||
<data name="Memory_UsedHoursAgo" xml:space="preserve">
|
||||
<value>{0} 時間前に使用</value>
|
||||
</data>
|
||||
<data name="State_Created" xml:space="preserve">
|
||||
<value>未起動</value>
|
||||
</data>
|
||||
<data name="State_Active" xml:space="preserve">
|
||||
<value>アクティブ</value>
|
||||
</data>
|
||||
<data name="State_Idle" xml:space="preserve">
|
||||
<value>アイドル</value>
|
||||
</data>
|
||||
<data name="State_Suspended" xml:space="preserve">
|
||||
<value>一時停止中</value>
|
||||
</data>
|
||||
<data name="State_Hibernated" xml:space="preserve">
|
||||
<value>休止中</value>
|
||||
</data>
|
||||
<data name="State_Closed" xml:space="preserve">
|
||||
<value>終了済み</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapTitle" xml:space="preserve">
|
||||
<value>OmniDeck のメモリ使用量が多くなっています</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapHibernatedOne" xml:space="preserve">
|
||||
<value>上限の {0} を超えないように、モジュールを 1 つ休止しました。</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapHibernated" xml:space="preserve">
|
||||
<value>上限の {1} を超えないように、モジュールを {0} 個休止しました。</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapKept" xml:space="preserve">
|
||||
<value>上限の {0} を超えていますが、これ以上休止できるモジュールはありません。開いているモジュールは使用中か、[常に実行] がオンになっています。</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapShared" xml:space="preserve">
|
||||
<value>開いている Web アプリが共有するプロセスが主にグラフィックスのために {1} を使用しているため、上限の {0} を超えています。他のモジュールを休止しても、この使用量は減りません。</value>
|
||||
</data>
|
||||
<data name="Governor_ResidentHibernatedTitle" xml:space="preserve">
|
||||
<value>メモリを節約するため、{0} を休止しました</value>
|
||||
</data>
|
||||
<data name="Governor_ResidentHibernated" xml:space="preserve">
|
||||
<value>もう一度開くまで、通知は表示されません。ここをクリックすると開きます。</value>
|
||||
</data>
|
||||
<data name="Settings_Nav" xml:space="preserve">
|
||||
<value>設定</value>
|
||||
</data>
|
||||
<data name="Settings_Title" xml:space="preserve">
|
||||
<value>設定</value>
|
||||
</data>
|
||||
<data name="Settings_General" xml:space="preserve">
|
||||
<value>全般</value>
|
||||
</data>
|
||||
<data name="Settings_Appearance" xml:space="preserve">
|
||||
<value>外観</value>
|
||||
</data>
|
||||
<data name="Settings_Memory" xml:space="preserve">
|
||||
<value>メモリ</value>
|
||||
</data>
|
||||
<data name="Settings_Data" xml:space="preserve">
|
||||
<value>データ</value>
|
||||
</data>
|
||||
<data name="Settings_About" xml:space="preserve">
|
||||
<value>バージョン情報</value>
|
||||
</data>
|
||||
<data name="Settings_Language" xml:space="preserve">
|
||||
<value>言語</value>
|
||||
</data>
|
||||
<data name="Settings_CloseToTray" xml:space="preserve">
|
||||
<value>ウィンドウを閉じても通知領域で実行を続ける</value>
|
||||
</data>
|
||||
<data name="Settings_StartWithWindows" xml:space="preserve">
|
||||
<value>Windows にサインインしたときに OmniDeck を起動する</value>
|
||||
</data>
|
||||
<data name="Settings_Theme" xml:space="preserve">
|
||||
<value>テーマ</value>
|
||||
</data>
|
||||
<data name="Settings_Preset" xml:space="preserve">
|
||||
<value>レイアウト</value>
|
||||
</data>
|
||||
<data name="Settings_FontScale" xml:space="preserve">
|
||||
<value>テキストのサイズ</value>
|
||||
</data>
|
||||
<data name="Settings_Motion" xml:space="preserve">
|
||||
<value>アニメーション効果</value>
|
||||
</data>
|
||||
<data name="Settings_AccentSystem" xml:space="preserve">
|
||||
<value>Windows のアクセント カラーを使用する</value>
|
||||
</data>
|
||||
<data name="Settings_IdleAfter" xml:space="preserve">
|
||||
<value>非表示のモジュールを一時停止するまでの時間 (分)</value>
|
||||
</data>
|
||||
<data name="Settings_HibernateAfter" xml:space="preserve">
|
||||
<value>非表示のモジュールを休止するまでの時間 (分)</value>
|
||||
</data>
|
||||
<data name="Settings_SoftCap" xml:space="preserve">
|
||||
<value>メモリのソフト上限 (MB、0 で自動)</value>
|
||||
</data>
|
||||
<data name="Settings_HardCap" xml:space="preserve">
|
||||
<value>メモリのハード上限 (MB、0 で自動)</value>
|
||||
</data>
|
||||
<data name="Settings_DataFolder" xml:space="preserve">
|
||||
<value>データ フォルダー</value>
|
||||
</data>
|
||||
<data name="Settings_OpenDataFolder" xml:space="preserve">
|
||||
<value>開く</value>
|
||||
</data>
|
||||
<data name="Settings_Export" xml:space="preserve">
|
||||
<value>設定をエクスポート…</value>
|
||||
</data>
|
||||
<data name="Settings_Import" xml:space="preserve">
|
||||
<value>設定をインポート…</value>
|
||||
</data>
|
||||
<data name="Settings_FileFilter" xml:space="preserve">
|
||||
<value>OmniDeck の設定 (*.json)|*.json</value>
|
||||
</data>
|
||||
<data name="Settings_Exported" xml:space="preserve">
|
||||
<value>設定をエクスポートしました。</value>
|
||||
</data>
|
||||
<data name="Settings_Imported" xml:space="preserve">
|
||||
<value>設定をインポートしました。</value>
|
||||
</data>
|
||||
<data name="Settings_ImportFailed" xml:space="preserve">
|
||||
<value>このファイルは OmniDeck の設定ファイルではありません。</value>
|
||||
</data>
|
||||
<data name="Language_System" xml:space="preserve">
|
||||
<value>Windows の設定に合わせる</value>
|
||||
</data>
|
||||
<data name="Theme_System" xml:space="preserve">
|
||||
<value>Windows の設定に合わせる</value>
|
||||
</data>
|
||||
<data name="Theme_Light" xml:space="preserve">
|
||||
<value>ライト</value>
|
||||
</data>
|
||||
<data name="Theme_Dark" xml:space="preserve">
|
||||
<value>ダーク</value>
|
||||
</data>
|
||||
<data name="Preset_Dynamic" xml:space="preserve">
|
||||
<value>ダイナミック</value>
|
||||
</data>
|
||||
<data name="Preset_DynamicHint" xml:space="preserve">
|
||||
<value>コンパクトで軽快。文字は小さめ、動きは多めです。</value>
|
||||
</data>
|
||||
<data name="Preset_Standard" xml:space="preserve">
|
||||
<value>標準</value>
|
||||
</data>
|
||||
<data name="Preset_StandardHint" xml:space="preserve">
|
||||
<value>バランスがよく、ほとんどの人に適しています。</value>
|
||||
</data>
|
||||
<data name="Preset_Comfort" xml:space="preserve">
|
||||
<value>ゆったり</value>
|
||||
</data>
|
||||
<data name="Preset_ComfortHint" xml:space="preserve">
|
||||
<value>文字とボタンが大きめで、動きはありません。</value>
|
||||
</data>
|
||||
<data name="Onboarding_Title" xml:space="preserve">
|
||||
<value>OmniDeck へようこそ</value>
|
||||
</data>
|
||||
<data name="Onboarding_Intro" xml:space="preserve">
|
||||
<value>言語とレイアウトを選んでください。レイアウトは選ぶとすぐに適用されます。</value>
|
||||
</data>
|
||||
<data name="Onboarding_Later" xml:space="preserve">
|
||||
<value>どちらも後で [設定] から変更できます。</value>
|
||||
</data>
|
||||
<data name="Onboarding_Done" xml:space="preserve">
|
||||
<value>始める</value>
|
||||
</data>
|
||||
<data name="Legal_Title" xml:space="preserve">
|
||||
<value>始める前に</value>
|
||||
</data>
|
||||
<data name="Legal_Intro" xml:space="preserve">
|
||||
<value>OmniDeck は GNU General Public License v3 に基づくフリー ソフトウェアです。これらの文書をお読みください。続行すると、これらを読んだことが記録されます。これはライセンスの条件ではありません。</value>
|
||||
</data>
|
||||
<data name="Legal_Eula" xml:space="preserve">
|
||||
<value>使用許諾契約</value>
|
||||
</data>
|
||||
<data name="Legal_Disclaimer" xml:space="preserve">
|
||||
<value>免責事項</value>
|
||||
</data>
|
||||
<data name="Legal_Privacy" xml:space="preserve">
|
||||
<value>プライバシー ポリシー</value>
|
||||
</data>
|
||||
<data name="Legal_Notices" xml:space="preserve">
|
||||
<value>サードパーティ通知</value>
|
||||
</data>
|
||||
<data name="Legal_HaveRead" xml:space="preserve">
|
||||
<value>これらの文書を読みました</value>
|
||||
</data>
|
||||
<data name="Legal_Continue" xml:space="preserve">
|
||||
<value>続行</value>
|
||||
</data>
|
||||
<data name="Legal_Quit" xml:space="preserve">
|
||||
<value>終了</value>
|
||||
</data>
|
||||
<data name="Legal_Close" xml:space="preserve">
|
||||
<value>閉じる</value>
|
||||
</data>
|
||||
<data name="Legal_Missing" xml:space="preserve">
|
||||
<value>この OmniDeck には {0} が含まれていません。</value>
|
||||
</data>
|
||||
<data name="About_Version" xml:space="preserve">
|
||||
<value>バージョン {0}</value>
|
||||
</data>
|
||||
<data name="About_CheckUpdates" xml:space="preserve">
|
||||
<value>更新プログラムを確認</value>
|
||||
</data>
|
||||
<data name="About_Checking" xml:space="preserve">
|
||||
<value>更新プログラムを確認しています…</value>
|
||||
</data>
|
||||
<data name="About_UpToDate" xml:space="preserve">
|
||||
<value>OmniDeck は最新の状態です。</value>
|
||||
</data>
|
||||
<data name="About_Available" xml:space="preserve">
|
||||
<value>バージョン {0} を利用できます。</value>
|
||||
</data>
|
||||
<data name="About_Download" xml:space="preserve">
|
||||
<value>ダウンロードして再起動</value>
|
||||
</data>
|
||||
<data name="About_Downloading" xml:space="preserve">
|
||||
<value>更新プログラムをダウンロードしています: {0}%</value>
|
||||
</data>
|
||||
<data name="About_Failed" xml:space="preserve">
|
||||
<value>更新できませんでした: {0}</value>
|
||||
</data>
|
||||
<data name="About_NotInstalled" xml:space="preserve">
|
||||
<value>更新を利用できるのは、インストールされた OmniDeck だけです。開発ビルドでは利用できません。</value>
|
||||
</data>
|
||||
<data name="About_Links" xml:space="preserve">
|
||||
<value>リンク</value>
|
||||
</data>
|
||||
<data name="About_GitHub" xml:space="preserve">
|
||||
<value>GitHub のソース コード</value>
|
||||
</data>
|
||||
<data name="About_Discussions" xml:space="preserve">
|
||||
<value>ディスカッション</value>
|
||||
</data>
|
||||
<data name="About_Discord" xml:space="preserve">
|
||||
<value>Discord</value>
|
||||
</data>
|
||||
<data name="About_Legal" xml:space="preserve">
|
||||
<value>ライセンスと法的文書</value>
|
||||
</data>
|
||||
<data name="About_Credits" xml:space="preserve">
|
||||
<value>OmniDeck は .NET、WPF-UI、Velopack、CommunityToolkit.Mvvm、H.NotifyIcon、Serilog、Dapper、SQLite、Markdig で構築されています。すべてサードパーティ通知に記載されています。</value>
|
||||
</data>
|
||||
<data name="Update_AvailableTitle" xml:space="preserve">
|
||||
<value>OmniDeck {0} を利用できます</value>
|
||||
</data>
|
||||
<data name="Update_AvailableMessage" xml:space="preserve">
|
||||
<value>インストールするには、[設定] → [バージョン情報] を開いてください。</value>
|
||||
</data>
|
||||
<data name="Dialog_OK" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="Dialog_Cancel" xml:space="preserve">
|
||||
<value>キャンセル</value>
|
||||
</data>
|
||||
<data name="Settings_WebApps" xml:space="preserve">
|
||||
<value>Web アプリ</value>
|
||||
</data>
|
||||
<data name="WebApps_Intro" xml:space="preserve">
|
||||
<value>通知を表示できる Web アプリを選択します。通知がオンのアプリは、通知を届けられるよう非表示の間も実行を続け、OmniDeck のメモリが不足したときにだけ閉じられます。</value>
|
||||
</data>
|
||||
<data name="WebApps_Notifications" xml:space="preserve">
|
||||
<value>通知</value>
|
||||
</data>
|
||||
<data name="WebApps_NoPermissions" xml:space="preserve">
|
||||
<value>アクセス許可の要求はまだありません</value>
|
||||
</data>
|
||||
<data name="WebApps_Allowed" xml:space="preserve">
|
||||
<value>{0}: 許可</value>
|
||||
</data>
|
||||
<data name="WebApps_Blocked" xml:space="preserve">
|
||||
<value>{0}: ブロック</value>
|
||||
</data>
|
||||
<data name="WebApps_ResetPermissions" xml:space="preserve">
|
||||
<value>もう一度確認する</value>
|
||||
</data>
|
||||
<data name="WebApps_DataTitle" xml:space="preserve">
|
||||
<value>サインイン データ</value>
|
||||
</data>
|
||||
<data name="WebApps_DataIntro" xml:space="preserve">
|
||||
<value>グループ内のアプリは 1 つのサインインを共有します。グループのデータを消去すると、そのすべてのアプリからサインアウトされ、アプリは閉じられます。</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearData" xml:space="preserve">
|
||||
<value>データを消去</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearTitle" xml:space="preserve">
|
||||
<value>サインイン データを消去しますか?</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearMessage" xml:space="preserve">
|
||||
<value>{0} からサインアウトされます。Cookie、サイト データ、キャッシュされたページは削除されます。</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearConfirm" xml:space="preserve">
|
||||
<value>データを消去</value>
|
||||
</data>
|
||||
<data name="WebApps_Cleared" xml:space="preserve">
|
||||
<value>{0} のデータを消去しました。</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearFailed" xml:space="preserve">
|
||||
<value>データを消去できませんでした。OmniDeck を再起動してから、もう一度お試しください。</value>
|
||||
</data>
|
||||
<data name="WebApps_Catalog" xml:space="preserve">
|
||||
<value>Web アプリ カタログ ({0} 版) には {1} 個のアプリがあります。</value>
|
||||
</data>
|
||||
<data name="WebApps_Checked" xml:space="preserve">
|
||||
<value>新しいカタログを最後に確認したのは {0} です。</value>
|
||||
</data>
|
||||
<data name="WebApps_NotChecked" xml:space="preserve">
|
||||
<value>新しいカタログはまだ確認していません。</value>
|
||||
</data>
|
||||
<data name="About_ReportBug" xml:space="preserve">
|
||||
<value>バグを報告</value>
|
||||
</data>
|
||||
<data name="Error_Report" xml:space="preserve">
|
||||
<value>バグを報告</value>
|
||||
</data>
|
||||
<data name="Report_Title" xml:space="preserve">
|
||||
<value>バグを報告</value>
|
||||
</data>
|
||||
<data name="Report_Intro" xml:space="preserve">
|
||||
<value>OmniDeck はこの PC にレポートを保存し、短い項目を入力した状態で GitHub の新しい Issue をブラウザーで開きます。何も送信されないため、レポートはご自身で Issue に添付してください。Web アドレスからはクエリが除かれ、トークン、Cookie、メール アドレス、長い ID、ユーザー名もあらかじめ取り除かれます。</value>
|
||||
</data>
|
||||
<data name="Report_Subject" xml:space="preserve">
|
||||
<value>何についての報告ですか?</value>
|
||||
</data>
|
||||
<data name="Report_General" xml:space="preserve">
|
||||
<value>OmniDeck 全般</value>
|
||||
</data>
|
||||
<data name="Report_Preview" xml:space="preserve">
|
||||
<value>Issue の本文 (レポートにも issue.md として含まれます)</value>
|
||||
</data>
|
||||
<data name="Report_Save" xml:space="preserve">
|
||||
<value>保存して GitHub を開く</value>
|
||||
</data>
|
||||
<data name="Tray_Play" xml:space="preserve">
|
||||
<value>再生</value>
|
||||
</data>
|
||||
<data name="Tray_Pause" xml:space="preserve">
|
||||
<value>一時停止</value>
|
||||
</data>
|
||||
<data name="Tray_Next" xml:space="preserve">
|
||||
<value>次へ</value>
|
||||
</data>
|
||||
<data name="Tray_Previous" xml:space="preserve">
|
||||
<value>前へ</value>
|
||||
</data>
|
||||
<data name="About_Prereleases" xml:space="preserve">
|
||||
<value>プレリリース版 (アルファ版とベータ版) を入手する</value>
|
||||
</data>
|
||||
<data name="About_PrereleasesNote" xml:space="preserve">
|
||||
<value>1.0 より前のバージョンはすべてプレリリース版です。1.0 以降は、これをオフのままにすると安定版のみを入手します。</value>
|
||||
</data>
|
||||
<data name="Shell_NavModules" xml:space="preserve">
|
||||
<value>モジュール</value>
|
||||
</data>
|
||||
<data name="Shell_NavFooter" xml:space="preserve">
|
||||
<value>設定とライブラリ</value>
|
||||
</data>
|
||||
<data name="A11y_RowAction" xml:space="preserve">
|
||||
<value>{0}、{1}</value>
|
||||
</data>
|
||||
<data name="A11y_Minimize" xml:space="preserve">
|
||||
<value>最小化</value>
|
||||
</data>
|
||||
<data name="A11y_Maximize" xml:space="preserve">
|
||||
<value>最大化</value>
|
||||
</data>
|
||||
<data name="A11y_Restore" xml:space="preserve">
|
||||
<value>元に戻す (縮小)</value>
|
||||
</data>
|
||||
<data name="A11y_Close" xml:space="preserve">
|
||||
<value>閉じる</value>
|
||||
</data>
|
||||
<data name="A11y_OpenNavigation" xml:space="preserve">
|
||||
<value>ナビゲーションを開く</value>
|
||||
</data>
|
||||
<data name="A11y_CloseNavigation" xml:space="preserve">
|
||||
<value>ナビゲーションを閉じる</value>
|
||||
</data>
|
||||
<data name="A11y_Increase" xml:space="preserve">
|
||||
<value>増やす</value>
|
||||
</data>
|
||||
<data name="A11y_Decrease" xml:space="preserve">
|
||||
<value>減らす</value>
|
||||
</data>
|
||||
<data name="A11y_ShowPassword" xml:space="preserve">
|
||||
<value>パスワードを表示</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollUp" xml:space="preserve">
|
||||
<value>上へスクロール</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollDown" xml:space="preserve">
|
||||
<value>下へスクロール</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollLeft" xml:space="preserve">
|
||||
<value>左へスクロール</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollRight" xml:space="preserve">
|
||||
<value>右へスクロール</value>
|
||||
</data>
|
||||
<data name="A11y_PageUp" xml:space="preserve">
|
||||
<value>1 ページ上へ</value>
|
||||
</data>
|
||||
<data name="A11y_PageDown" xml:space="preserve">
|
||||
<value>1 ページ下へ</value>
|
||||
</data>
|
||||
<data name="A11y_PageLeft" xml:space="preserve">
|
||||
<value>1 ページ左へ</value>
|
||||
</data>
|
||||
<data name="A11y_PageRight" xml:space="preserve">
|
||||
<value>1 ページ右へ</value>
|
||||
</data>
|
||||
<data name="Settings_AccentColors" xml:space="preserve">
|
||||
<value>アクセント カラー</value>
|
||||
</data>
|
||||
<data name="Accent_Blue" xml:space="preserve">
|
||||
<value>青</value>
|
||||
</data>
|
||||
<data name="Accent_Purple" xml:space="preserve">
|
||||
<value>紫</value>
|
||||
</data>
|
||||
<data name="Accent_Pink" xml:space="preserve">
|
||||
<value>ピンク</value>
|
||||
</data>
|
||||
<data name="Accent_Red" xml:space="preserve">
|
||||
<value>赤</value>
|
||||
</data>
|
||||
<data name="Accent_Orange" xml:space="preserve">
|
||||
<value>オレンジ</value>
|
||||
</data>
|
||||
<data name="Accent_Green" xml:space="preserve">
|
||||
<value>緑</value>
|
||||
</data>
|
||||
<data name="Shell_OpenDataFolder" xml:space="preserve">
|
||||
<value>データ フォルダーを開く</value>
|
||||
</data>
|
||||
<data name="Shell_SearchShortcut" xml:space="preserve">
|
||||
<value>Ctrl+K</value>
|
||||
</data>
|
||||
<data name="A11y_Clear" xml:space="preserve">
|
||||
<value>クリア</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!-- The shell's UI strings, English (neutral). Vietnamese and Japanese satellites arrive in P3. -->
|
||||
<!-- The shell's UI strings, English (neutral). Translations sit beside it: Strings.vi.resx and Strings.ja.resx (docs/TRANSLATING.md). -->
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
@@ -250,9 +250,6 @@ Support code: {0}
|
||||
<data name="Language_System" xml:space="preserve">
|
||||
<value>Follow Windows</value>
|
||||
</data>
|
||||
<data name="Language_English" xml:space="preserve">
|
||||
<value>English</value>
|
||||
</data>
|
||||
<data name="Theme_System" xml:space="preserve">
|
||||
<value>Follow Windows</value>
|
||||
</data>
|
||||
@@ -472,4 +469,102 @@ Support code: {0}
|
||||
<data name="Tray_Previous" xml:space="preserve">
|
||||
<value>Previous</value>
|
||||
</data>
|
||||
<data name="About_Prereleases" xml:space="preserve">
|
||||
<value>Get pre-release versions (alphas and betas)</value>
|
||||
</data>
|
||||
<data name="About_PrereleasesNote" xml:space="preserve">
|
||||
<value>Every version before 1.0 is a pre-release. From 1.0 on, leave this off to get stable versions only.</value>
|
||||
</data>
|
||||
<data name="Shell_NavModules" xml:space="preserve">
|
||||
<value>Modules</value>
|
||||
</data>
|
||||
<data name="Shell_NavFooter" xml:space="preserve">
|
||||
<value>Settings and library</value>
|
||||
</data>
|
||||
<data name="A11y_RowAction" xml:space="preserve">
|
||||
<value>{0}, {1}</value>
|
||||
<comment>What screen readers hear for a button on a row of a list: {0} is the button's label, {1} the row's name, as in "Remove, Tokyo".</comment>
|
||||
</data>
|
||||
<data name="A11y_Minimize" xml:space="preserve">
|
||||
<value>Minimize</value>
|
||||
</data>
|
||||
<data name="A11y_Maximize" xml:space="preserve">
|
||||
<value>Maximize</value>
|
||||
</data>
|
||||
<data name="A11y_Restore" xml:space="preserve">
|
||||
<value>Restore</value>
|
||||
</data>
|
||||
<data name="A11y_Close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="A11y_OpenNavigation" xml:space="preserve">
|
||||
<value>Open navigation</value>
|
||||
</data>
|
||||
<data name="A11y_CloseNavigation" xml:space="preserve">
|
||||
<value>Close navigation</value>
|
||||
</data>
|
||||
<data name="A11y_Increase" xml:space="preserve">
|
||||
<value>Increase</value>
|
||||
</data>
|
||||
<data name="A11y_Decrease" xml:space="preserve">
|
||||
<value>Decrease</value>
|
||||
</data>
|
||||
<data name="A11y_ShowPassword" xml:space="preserve">
|
||||
<value>Show password</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollUp" xml:space="preserve">
|
||||
<value>Scroll up</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollDown" xml:space="preserve">
|
||||
<value>Scroll down</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollLeft" xml:space="preserve">
|
||||
<value>Scroll left</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollRight" xml:space="preserve">
|
||||
<value>Scroll right</value>
|
||||
</data>
|
||||
<data name="A11y_PageUp" xml:space="preserve">
|
||||
<value>Page up</value>
|
||||
</data>
|
||||
<data name="A11y_PageDown" xml:space="preserve">
|
||||
<value>Page down</value>
|
||||
</data>
|
||||
<data name="A11y_PageLeft" xml:space="preserve">
|
||||
<value>Page left</value>
|
||||
</data>
|
||||
<data name="A11y_PageRight" xml:space="preserve">
|
||||
<value>Page right</value>
|
||||
</data>
|
||||
<data name="Settings_AccentColors" xml:space="preserve">
|
||||
<value>Accent colors</value>
|
||||
</data>
|
||||
<data name="Accent_Blue" xml:space="preserve">
|
||||
<value>Blue</value>
|
||||
</data>
|
||||
<data name="Accent_Purple" xml:space="preserve">
|
||||
<value>Purple</value>
|
||||
</data>
|
||||
<data name="Accent_Pink" xml:space="preserve">
|
||||
<value>Pink</value>
|
||||
</data>
|
||||
<data name="Accent_Red" xml:space="preserve">
|
||||
<value>Red</value>
|
||||
</data>
|
||||
<data name="Accent_Orange" xml:space="preserve">
|
||||
<value>Orange</value>
|
||||
</data>
|
||||
<data name="Accent_Green" xml:space="preserve">
|
||||
<value>Green</value>
|
||||
</data>
|
||||
<data name="Shell_OpenDataFolder" xml:space="preserve">
|
||||
<value>Open the data folder</value>
|
||||
</data>
|
||||
<data name="Shell_SearchShortcut" xml:space="preserve">
|
||||
<value>Ctrl+K</value>
|
||||
<comment>The search box's tooltip: the shortcut that opens it, with the key names your keyboards show.</comment>
|
||||
</data>
|
||||
<data name="A11y_Clear" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,568 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!-- The shell's UI strings, Vietnamese. A key missing here shows in English (Strings.resx). -->
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="App_Name" xml:space="preserve">
|
||||
<value>OmniDeck</value>
|
||||
</data>
|
||||
<data name="Shell_Search" xml:space="preserve">
|
||||
<value>Tìm kiếm mô-đun và lệnh</value>
|
||||
</data>
|
||||
<data name="Shell_Library" xml:space="preserve">
|
||||
<value>Thư viện</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryTitle" xml:space="preserve">
|
||||
<value>Thư viện mô-đun</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryIntro" xml:space="preserve">
|
||||
<value>Mở một mô-đun, hoặc ghim để giữ mô-đun đó trên thanh bên.</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryEmpty" xml:space="preserve">
|
||||
<value>Chưa có mô-đun nào.</value>
|
||||
</data>
|
||||
<data name="Shell_Open" xml:space="preserve">
|
||||
<value>Mở</value>
|
||||
</data>
|
||||
<data name="Shell_Pin" xml:space="preserve">
|
||||
<value>Ghim vào thanh bên</value>
|
||||
</data>
|
||||
<data name="Shell_Unpin" xml:space="preserve">
|
||||
<value>Bỏ ghim khỏi thanh bên</value>
|
||||
</data>
|
||||
<data name="Shell_Close" xml:space="preserve">
|
||||
<value>Đóng</value>
|
||||
</data>
|
||||
<data name="Shell_PopOut" xml:space="preserve">
|
||||
<value>Mở trong cửa sổ riêng</value>
|
||||
</data>
|
||||
<data name="Shell_PopIn" xml:space="preserve">
|
||||
<value>Về cửa sổ chính</value>
|
||||
</data>
|
||||
<data name="Shell_PaletteCommand" xml:space="preserve">
|
||||
<value>Lệnh</value>
|
||||
</data>
|
||||
<data name="Shell_Quit" xml:space="preserve">
|
||||
<value>Thoát OmniDeck</value>
|
||||
</data>
|
||||
<data name="Tray_Open" xml:space="preserve">
|
||||
<value>Mở OmniDeck</value>
|
||||
</data>
|
||||
<data name="Tray_QuickTimer" xml:space="preserve">
|
||||
<value>Bắt đầu hẹn giờ 5 phút</value>
|
||||
</data>
|
||||
<data name="Tray_Quit" xml:space="preserve">
|
||||
<value>Thoát</value>
|
||||
</data>
|
||||
<data name="Tray_StillRunningTitle" xml:space="preserve">
|
||||
<value>OmniDeck vẫn đang chạy</value>
|
||||
</data>
|
||||
<data name="Tray_StillRunningMessage" xml:space="preserve">
|
||||
<value>OmniDeck tiếp tục chạy trong khu vực thông báo. Để thoát, chọn Thoát trong menu của biểu tượng.</value>
|
||||
</data>
|
||||
<data name="Error_Title" xml:space="preserve">
|
||||
<value>Đã xảy ra lỗi</value>
|
||||
</data>
|
||||
<data name="Error_UiMessage" xml:space="preserve">
|
||||
<value>Đã xảy ra lỗi, nhưng OmniDeck vẫn đang chạy.
|
||||
|
||||
Mã hỗ trợ: {0}
|
||||
|
||||
{1}</value>
|
||||
</data>
|
||||
<data name="Error_StartFailed" xml:space="preserve">
|
||||
<value>Không thể khởi động OmniDeck.
|
||||
|
||||
{0}</value>
|
||||
</data>
|
||||
<data name="Memory_Title" xml:space="preserve">
|
||||
<value>Mô-đun đang chạy</value>
|
||||
</data>
|
||||
<data name="Memory_Intro" xml:space="preserve">
|
||||
<value>Theo thời gian, mô-đun bị ẩn sẽ lần lượt chuyển sang nhàn rỗi, tạm dừng rồi ngủ đông để tiết kiệm bộ nhớ. Bật Luôn chạy để một mô-đun không bị chuyển.</value>
|
||||
</data>
|
||||
<data name="Memory_InUse" xml:space="preserve">
|
||||
<value>Đang dùng: {0}</value>
|
||||
</data>
|
||||
<data name="Memory_Limits" xml:space="preserve">
|
||||
<value>Giới hạn mềm {0} · giới hạn cứng {1}</value>
|
||||
</data>
|
||||
<data name="Memory_SharedNote" xml:space="preserve">
|
||||
<value>Mô-đun tích hợp dùng chung tiến trình của OmniDeck, nên chỉ ứng dụng web mới có số liệu riêng.</value>
|
||||
</data>
|
||||
<data name="Memory_SharedTitle" xml:space="preserve">
|
||||
<value>Tiến trình web dùng chung</value>
|
||||
</data>
|
||||
<data name="Memory_SharedDescription" xml:space="preserve">
|
||||
<value>Các tiến trình trình duyệt, đồ họa và trợ giúp mà mọi ứng dụng web đều dùng. Chúng đóng cùng ứng dụng web cuối cùng.</value>
|
||||
</data>
|
||||
<data name="Memory_KeepRunning" xml:space="preserve">
|
||||
<value>Luôn chạy</value>
|
||||
</data>
|
||||
<data name="Memory_Suspend" xml:space="preserve">
|
||||
<value>Tạm dừng</value>
|
||||
</data>
|
||||
<data name="Memory_Hibernate" xml:space="preserve">
|
||||
<value>Ngủ đông</value>
|
||||
</data>
|
||||
<data name="Memory_UsedNow" xml:space="preserve">
|
||||
<value>Đang hiển thị</value>
|
||||
</data>
|
||||
<data name="Memory_UsedJustNow" xml:space="preserve">
|
||||
<value>Vừa dùng</value>
|
||||
</data>
|
||||
<data name="Memory_UsedMinutesAgo" xml:space="preserve">
|
||||
<value>Dùng {0} phút trước</value>
|
||||
</data>
|
||||
<data name="Memory_UsedHoursAgo" xml:space="preserve">
|
||||
<value>Dùng {0} giờ trước</value>
|
||||
</data>
|
||||
<data name="State_Created" xml:space="preserve">
|
||||
<value>Chưa chạy</value>
|
||||
</data>
|
||||
<data name="State_Active" xml:space="preserve">
|
||||
<value>Đang hoạt động</value>
|
||||
</data>
|
||||
<data name="State_Idle" xml:space="preserve">
|
||||
<value>Nhàn rỗi</value>
|
||||
</data>
|
||||
<data name="State_Suspended" xml:space="preserve">
|
||||
<value>Đã tạm dừng</value>
|
||||
</data>
|
||||
<data name="State_Hibernated" xml:space="preserve">
|
||||
<value>Đã ngủ đông</value>
|
||||
</data>
|
||||
<data name="State_Closed" xml:space="preserve">
|
||||
<value>Đã đóng</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapTitle" xml:space="preserve">
|
||||
<value>OmniDeck đang dùng nhiều bộ nhớ</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapHibernatedOne" xml:space="preserve">
|
||||
<value>Đã cho một mô-đun ngủ đông để không vượt quá giới hạn {0}.</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapHibernated" xml:space="preserve">
|
||||
<value>Đã cho {0} mô-đun ngủ đông để không vượt quá giới hạn {1}.</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapKept" xml:space="preserve">
|
||||
<value>Đã vượt giới hạn {0} nhưng không thể cho thêm mô-đun nào ngủ đông: các mô-đun đang mở đều đang được dùng hoặc đang bật Luôn chạy.</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapShared" xml:space="preserve">
|
||||
<value>Đã vượt giới hạn {0} vì các tiến trình dùng chung của những ứng dụng web đang mở chiếm {1}, chủ yếu cho đồ họa. Cho các mô-đun khác ngủ đông cũng không giảm được mức này.</value>
|
||||
</data>
|
||||
<data name="Governor_ResidentHibernatedTitle" xml:space="preserve">
|
||||
<value>Đã cho {0} ngủ đông để tiết kiệm bộ nhớ</value>
|
||||
</data>
|
||||
<data name="Governor_ResidentHibernated" xml:space="preserve">
|
||||
<value>Sẽ không có thông báo cho đến khi bạn mở lại. Bấm vào đây để mở.</value>
|
||||
</data>
|
||||
<data name="Settings_Nav" xml:space="preserve">
|
||||
<value>Cài đặt</value>
|
||||
</data>
|
||||
<data name="Settings_Title" xml:space="preserve">
|
||||
<value>Cài đặt</value>
|
||||
</data>
|
||||
<data name="Settings_General" xml:space="preserve">
|
||||
<value>Chung</value>
|
||||
</data>
|
||||
<data name="Settings_Appearance" xml:space="preserve">
|
||||
<value>Giao diện</value>
|
||||
</data>
|
||||
<data name="Settings_Memory" xml:space="preserve">
|
||||
<value>Bộ nhớ</value>
|
||||
</data>
|
||||
<data name="Settings_Data" xml:space="preserve">
|
||||
<value>Dữ liệu</value>
|
||||
</data>
|
||||
<data name="Settings_About" xml:space="preserve">
|
||||
<value>Giới thiệu</value>
|
||||
</data>
|
||||
<data name="Settings_Language" xml:space="preserve">
|
||||
<value>Ngôn ngữ</value>
|
||||
</data>
|
||||
<data name="Settings_CloseToTray" xml:space="preserve">
|
||||
<value>Tiếp tục chạy trong khu vực thông báo khi đóng cửa sổ</value>
|
||||
</data>
|
||||
<data name="Settings_StartWithWindows" xml:space="preserve">
|
||||
<value>Khởi động OmniDeck khi tôi đăng nhập vào Windows</value>
|
||||
</data>
|
||||
<data name="Settings_Theme" xml:space="preserve">
|
||||
<value>Chủ đề</value>
|
||||
</data>
|
||||
<data name="Settings_Preset" xml:space="preserve">
|
||||
<value>Bố cục</value>
|
||||
</data>
|
||||
<data name="Settings_FontScale" xml:space="preserve">
|
||||
<value>Cỡ chữ</value>
|
||||
</data>
|
||||
<data name="Settings_Motion" xml:space="preserve">
|
||||
<value>Hiệu ứng chuyển động</value>
|
||||
</data>
|
||||
<data name="Settings_AccentSystem" xml:space="preserve">
|
||||
<value>Dùng màu nhấn của Windows</value>
|
||||
</data>
|
||||
<data name="Settings_IdleAfter" xml:space="preserve">
|
||||
<value>Tạm dừng mô-đun bị ẩn sau (phút)</value>
|
||||
</data>
|
||||
<data name="Settings_HibernateAfter" xml:space="preserve">
|
||||
<value>Cho mô-đun bị ẩn ngủ đông sau (phút)</value>
|
||||
</data>
|
||||
<data name="Settings_SoftCap" xml:space="preserve">
|
||||
<value>Giới hạn bộ nhớ mềm (MB, 0: tự động)</value>
|
||||
</data>
|
||||
<data name="Settings_HardCap" xml:space="preserve">
|
||||
<value>Giới hạn bộ nhớ cứng (MB, 0: tự động)</value>
|
||||
</data>
|
||||
<data name="Settings_DataFolder" xml:space="preserve">
|
||||
<value>Thư mục dữ liệu</value>
|
||||
</data>
|
||||
<data name="Settings_OpenDataFolder" xml:space="preserve">
|
||||
<value>Mở</value>
|
||||
</data>
|
||||
<data name="Settings_Export" xml:space="preserve">
|
||||
<value>Xuất cài đặt…</value>
|
||||
</data>
|
||||
<data name="Settings_Import" xml:space="preserve">
|
||||
<value>Nhập cài đặt…</value>
|
||||
</data>
|
||||
<data name="Settings_FileFilter" xml:space="preserve">
|
||||
<value>Cài đặt OmniDeck (*.json)|*.json</value>
|
||||
</data>
|
||||
<data name="Settings_Exported" xml:space="preserve">
|
||||
<value>Đã xuất cài đặt.</value>
|
||||
</data>
|
||||
<data name="Settings_Imported" xml:space="preserve">
|
||||
<value>Đã nhập cài đặt.</value>
|
||||
</data>
|
||||
<data name="Settings_ImportFailed" xml:space="preserve">
|
||||
<value>Tệp đó không phải là tệp cài đặt OmniDeck.</value>
|
||||
</data>
|
||||
<data name="Language_System" xml:space="preserve">
|
||||
<value>Theo Windows</value>
|
||||
</data>
|
||||
<data name="Theme_System" xml:space="preserve">
|
||||
<value>Theo Windows</value>
|
||||
</data>
|
||||
<data name="Theme_Light" xml:space="preserve">
|
||||
<value>Sáng</value>
|
||||
</data>
|
||||
<data name="Theme_Dark" xml:space="preserve">
|
||||
<value>Tối</value>
|
||||
</data>
|
||||
<data name="Preset_Dynamic" xml:space="preserve">
|
||||
<value>Năng động</value>
|
||||
</data>
|
||||
<data name="Preset_DynamicHint" xml:space="preserve">
|
||||
<value>Gọn và sinh động: chữ nhỏ hơn, nhiều chuyển động hơn.</value>
|
||||
</data>
|
||||
<data name="Preset_Standard" xml:space="preserve">
|
||||
<value>Tiêu chuẩn</value>
|
||||
</data>
|
||||
<data name="Preset_StandardHint" xml:space="preserve">
|
||||
<value>Cân bằng, phù hợp với hầu hết mọi người.</value>
|
||||
</data>
|
||||
<data name="Preset_Comfort" xml:space="preserve">
|
||||
<value>Dễ nhìn</value>
|
||||
</data>
|
||||
<data name="Preset_ComfortHint" xml:space="preserve">
|
||||
<value>Chữ và vùng bấm lớn hơn, không có chuyển động.</value>
|
||||
</data>
|
||||
<data name="Onboarding_Title" xml:space="preserve">
|
||||
<value>Chào mừng đến với OmniDeck</value>
|
||||
</data>
|
||||
<data name="Onboarding_Intro" xml:space="preserve">
|
||||
<value>Chọn ngôn ngữ và bố cục. Bố cục được áp dụng ngay khi bạn chọn.</value>
|
||||
</data>
|
||||
<data name="Onboarding_Later" xml:space="preserve">
|
||||
<value>Bạn có thể đổi cả hai sau trong Cài đặt.</value>
|
||||
</data>
|
||||
<data name="Onboarding_Done" xml:space="preserve">
|
||||
<value>Bắt đầu</value>
|
||||
</data>
|
||||
<data name="Legal_Title" xml:space="preserve">
|
||||
<value>Trước khi bạn bắt đầu</value>
|
||||
</data>
|
||||
<data name="Legal_Intro" xml:space="preserve">
|
||||
<value>OmniDeck là phần mềm tự do theo giấy phép GNU General Public License v3. Vui lòng đọc các tài liệu này: khi bạn tiếp tục, OmniDeck ghi nhận rằng bạn đã đọc chúng. Điều này không phải là điều kiện của giấy phép.</value>
|
||||
</data>
|
||||
<data name="Legal_Eula" xml:space="preserve">
|
||||
<value>Thỏa thuận cấp phép</value>
|
||||
</data>
|
||||
<data name="Legal_Disclaimer" xml:space="preserve">
|
||||
<value>Miễn trừ trách nhiệm</value>
|
||||
</data>
|
||||
<data name="Legal_Privacy" xml:space="preserve">
|
||||
<value>Chính sách quyền riêng tư</value>
|
||||
</data>
|
||||
<data name="Legal_Notices" xml:space="preserve">
|
||||
<value>Thông báo của bên thứ ba</value>
|
||||
</data>
|
||||
<data name="Legal_HaveRead" xml:space="preserve">
|
||||
<value>Tôi đã đọc các tài liệu này</value>
|
||||
</data>
|
||||
<data name="Legal_Continue" xml:space="preserve">
|
||||
<value>Tiếp tục</value>
|
||||
</data>
|
||||
<data name="Legal_Quit" xml:space="preserve">
|
||||
<value>Thoát</value>
|
||||
</data>
|
||||
<data name="Legal_Close" xml:space="preserve">
|
||||
<value>Đóng</value>
|
||||
</data>
|
||||
<data name="Legal_Missing" xml:space="preserve">
|
||||
<value>Bản OmniDeck này thiếu {0}.</value>
|
||||
</data>
|
||||
<data name="About_Version" xml:space="preserve">
|
||||
<value>Phiên bản {0}</value>
|
||||
</data>
|
||||
<data name="About_CheckUpdates" xml:space="preserve">
|
||||
<value>Kiểm tra bản cập nhật</value>
|
||||
</data>
|
||||
<data name="About_Checking" xml:space="preserve">
|
||||
<value>Đang kiểm tra bản cập nhật…</value>
|
||||
</data>
|
||||
<data name="About_UpToDate" xml:space="preserve">
|
||||
<value>OmniDeck đã là phiên bản mới nhất.</value>
|
||||
</data>
|
||||
<data name="About_Available" xml:space="preserve">
|
||||
<value>Đã có phiên bản {0}.</value>
|
||||
</data>
|
||||
<data name="About_Download" xml:space="preserve">
|
||||
<value>Tải xuống và khởi động lại</value>
|
||||
</data>
|
||||
<data name="About_Downloading" xml:space="preserve">
|
||||
<value>Đang tải xuống bản cập nhật: {0}%</value>
|
||||
</data>
|
||||
<data name="About_Failed" xml:space="preserve">
|
||||
<value>Không thể cập nhật: {0}</value>
|
||||
</data>
|
||||
<data name="About_NotInstalled" xml:space="preserve">
|
||||
<value>Cập nhật hoạt động trên bản OmniDeck đã cài đặt, không phải trên bản dựng phát triển.</value>
|
||||
</data>
|
||||
<data name="About_Links" xml:space="preserve">
|
||||
<value>Liên kết</value>
|
||||
</data>
|
||||
<data name="About_GitHub" xml:space="preserve">
|
||||
<value>Mã nguồn trên GitHub</value>
|
||||
</data>
|
||||
<data name="About_Discussions" xml:space="preserve">
|
||||
<value>Thảo luận</value>
|
||||
</data>
|
||||
<data name="About_Discord" xml:space="preserve">
|
||||
<value>Discord</value>
|
||||
</data>
|
||||
<data name="About_Legal" xml:space="preserve">
|
||||
<value>Giấy phép và tài liệu pháp lý</value>
|
||||
</data>
|
||||
<data name="About_Credits" xml:space="preserve">
|
||||
<value>OmniDeck được xây dựng bằng .NET, WPF-UI, Velopack, CommunityToolkit.Mvvm, H.NotifyIcon, Serilog, Dapper, SQLite và Markdig. Danh sách đầy đủ có trong Thông báo của bên thứ ba.</value>
|
||||
</data>
|
||||
<data name="Update_AvailableTitle" xml:space="preserve">
|
||||
<value>Đã có OmniDeck {0}</value>
|
||||
</data>
|
||||
<data name="Update_AvailableMessage" xml:space="preserve">
|
||||
<value>Mở Cài đặt → Giới thiệu để cài đặt.</value>
|
||||
</data>
|
||||
<data name="Dialog_OK" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="Dialog_Cancel" xml:space="preserve">
|
||||
<value>Hủy</value>
|
||||
</data>
|
||||
<data name="Settings_WebApps" xml:space="preserve">
|
||||
<value>Ứng dụng web</value>
|
||||
</data>
|
||||
<data name="WebApps_Intro" xml:space="preserve">
|
||||
<value>Chọn những ứng dụng web được hiện thông báo. Ứng dụng đã bật thông báo sẽ tiếp tục chạy khi bị ẩn để có thể thông báo cho bạn; ứng dụng chỉ bị đóng khi OmniDeck thiếu bộ nhớ.</value>
|
||||
</data>
|
||||
<data name="WebApps_Notifications" xml:space="preserve">
|
||||
<value>Thông báo</value>
|
||||
</data>
|
||||
<data name="WebApps_NoPermissions" xml:space="preserve">
|
||||
<value>Chưa có yêu cầu quyền nào</value>
|
||||
</data>
|
||||
<data name="WebApps_Allowed" xml:space="preserve">
|
||||
<value>{0}: đã cho phép</value>
|
||||
</data>
|
||||
<data name="WebApps_Blocked" xml:space="preserve">
|
||||
<value>{0}: đã chặn</value>
|
||||
</data>
|
||||
<data name="WebApps_ResetPermissions" xml:space="preserve">
|
||||
<value>Hỏi lại</value>
|
||||
</data>
|
||||
<data name="WebApps_DataTitle" xml:space="preserve">
|
||||
<value>Dữ liệu đăng nhập</value>
|
||||
</data>
|
||||
<data name="WebApps_DataIntro" xml:space="preserve">
|
||||
<value>Các ứng dụng trong cùng một nhóm dùng chung một lần đăng nhập. Xóa dữ liệu của một nhóm sẽ đăng xuất bạn khỏi tất cả ứng dụng trong nhóm và đóng chúng.</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearData" xml:space="preserve">
|
||||
<value>Xóa dữ liệu</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearTitle" xml:space="preserve">
|
||||
<value>Xóa dữ liệu đăng nhập?</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearMessage" xml:space="preserve">
|
||||
<value>Bạn sẽ bị đăng xuất khỏi {0}. Cookie, dữ liệu trang web và các trang đã lưu trong bộ nhớ đệm của các ứng dụng này sẽ bị xóa.</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearConfirm" xml:space="preserve">
|
||||
<value>Xóa dữ liệu</value>
|
||||
</data>
|
||||
<data name="WebApps_Cleared" xml:space="preserve">
|
||||
<value>Đã xóa dữ liệu của {0}.</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearFailed" xml:space="preserve">
|
||||
<value>Không thể xóa dữ liệu. Khởi động lại OmniDeck rồi thử lại.</value>
|
||||
</data>
|
||||
<data name="WebApps_Catalog" xml:space="preserve">
|
||||
<value>Danh mục ứng dụng web ngày {0}, gồm {1} ứng dụng.</value>
|
||||
</data>
|
||||
<data name="WebApps_Checked" xml:space="preserve">
|
||||
<value>Đã kiểm tra danh mục mới lần cuối vào {0}.</value>
|
||||
</data>
|
||||
<data name="WebApps_NotChecked" xml:space="preserve">
|
||||
<value>Chưa kiểm tra danh mục mới.</value>
|
||||
</data>
|
||||
<data name="About_ReportBug" xml:space="preserve">
|
||||
<value>Báo lỗi</value>
|
||||
</data>
|
||||
<data name="Error_Report" xml:space="preserve">
|
||||
<value>Báo lỗi</value>
|
||||
</data>
|
||||
<data name="Report_Title" xml:space="preserve">
|
||||
<value>Báo lỗi</value>
|
||||
</data>
|
||||
<data name="Report_Intro" xml:space="preserve">
|
||||
<value>OmniDeck lưu một báo cáo trên PC này và mở một issue mới trên GitHub trong trình duyệt của bạn, với các trường ngắn đã điền sẵn. Không có gì được gửi đi: bạn tự đính kèm báo cáo vào issue. Địa chỉ web được bỏ phần truy vấn; token, cookie, địa chỉ email, ID dài và tên người dùng của bạn được lược bỏ trước.</value>
|
||||
</data>
|
||||
<data name="Report_Subject" xml:space="preserve">
|
||||
<value>Lỗi liên quan đến phần nào?</value>
|
||||
</data>
|
||||
<data name="Report_General" xml:space="preserve">
|
||||
<value>OmniDeck nói chung</value>
|
||||
</data>
|
||||
<data name="Report_Preview" xml:space="preserve">
|
||||
<value>Nội dung issue, cũng có trong báo cáo dưới tên issue.md</value>
|
||||
</data>
|
||||
<data name="Report_Save" xml:space="preserve">
|
||||
<value>Lưu và mở GitHub</value>
|
||||
</data>
|
||||
<data name="Tray_Play" xml:space="preserve">
|
||||
<value>Phát</value>
|
||||
</data>
|
||||
<data name="Tray_Pause" xml:space="preserve">
|
||||
<value>Tạm dừng</value>
|
||||
</data>
|
||||
<data name="Tray_Next" xml:space="preserve">
|
||||
<value>Tiếp theo</value>
|
||||
</data>
|
||||
<data name="Tray_Previous" xml:space="preserve">
|
||||
<value>Trước đó</value>
|
||||
</data>
|
||||
<data name="About_Prereleases" xml:space="preserve">
|
||||
<value>Nhận bản thử nghiệm (alpha và beta)</value>
|
||||
</data>
|
||||
<data name="About_PrereleasesNote" xml:space="preserve">
|
||||
<value>Mọi phiên bản trước 1.0 đều là bản thử nghiệm. Từ 1.0 trở đi, tắt tùy chọn này để chỉ nhận bản ổn định.</value>
|
||||
</data>
|
||||
<data name="Shell_NavModules" xml:space="preserve">
|
||||
<value>Mô-đun</value>
|
||||
</data>
|
||||
<data name="Shell_NavFooter" xml:space="preserve">
|
||||
<value>Cài đặt và thư viện</value>
|
||||
</data>
|
||||
<data name="A11y_RowAction" xml:space="preserve">
|
||||
<value>{0}, {1}</value>
|
||||
</data>
|
||||
<data name="A11y_Minimize" xml:space="preserve">
|
||||
<value>Thu nhỏ</value>
|
||||
</data>
|
||||
<data name="A11y_Maximize" xml:space="preserve">
|
||||
<value>Phóng to</value>
|
||||
</data>
|
||||
<data name="A11y_Restore" xml:space="preserve">
|
||||
<value>Khôi phục</value>
|
||||
</data>
|
||||
<data name="A11y_Close" xml:space="preserve">
|
||||
<value>Đóng</value>
|
||||
</data>
|
||||
<data name="A11y_OpenNavigation" xml:space="preserve">
|
||||
<value>Mở ngăn dẫn hướng</value>
|
||||
</data>
|
||||
<data name="A11y_CloseNavigation" xml:space="preserve">
|
||||
<value>Đóng ngăn dẫn hướng</value>
|
||||
</data>
|
||||
<data name="A11y_Increase" xml:space="preserve">
|
||||
<value>Tăng</value>
|
||||
</data>
|
||||
<data name="A11y_Decrease" xml:space="preserve">
|
||||
<value>Giảm</value>
|
||||
</data>
|
||||
<data name="A11y_ShowPassword" xml:space="preserve">
|
||||
<value>Hiện mật khẩu</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollUp" xml:space="preserve">
|
||||
<value>Cuộn lên</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollDown" xml:space="preserve">
|
||||
<value>Cuộn xuống</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollLeft" xml:space="preserve">
|
||||
<value>Cuộn sang trái</value>
|
||||
</data>
|
||||
<data name="A11y_ScrollRight" xml:space="preserve">
|
||||
<value>Cuộn sang phải</value>
|
||||
</data>
|
||||
<data name="A11y_PageUp" xml:space="preserve">
|
||||
<value>Lên một trang</value>
|
||||
</data>
|
||||
<data name="A11y_PageDown" xml:space="preserve">
|
||||
<value>Xuống một trang</value>
|
||||
</data>
|
||||
<data name="A11y_PageLeft" xml:space="preserve">
|
||||
<value>Sang trái một trang</value>
|
||||
</data>
|
||||
<data name="A11y_PageRight" xml:space="preserve">
|
||||
<value>Sang phải một trang</value>
|
||||
</data>
|
||||
<data name="Settings_AccentColors" xml:space="preserve">
|
||||
<value>Màu nhấn</value>
|
||||
</data>
|
||||
<data name="Accent_Blue" xml:space="preserve">
|
||||
<value>Xanh lam</value>
|
||||
</data>
|
||||
<data name="Accent_Purple" xml:space="preserve">
|
||||
<value>Tím</value>
|
||||
</data>
|
||||
<data name="Accent_Pink" xml:space="preserve">
|
||||
<value>Hồng</value>
|
||||
</data>
|
||||
<data name="Accent_Red" xml:space="preserve">
|
||||
<value>Đỏ</value>
|
||||
</data>
|
||||
<data name="Accent_Orange" xml:space="preserve">
|
||||
<value>Cam</value>
|
||||
</data>
|
||||
<data name="Accent_Green" xml:space="preserve">
|
||||
<value>Xanh lục</value>
|
||||
</data>
|
||||
<data name="Shell_OpenDataFolder" xml:space="preserve">
|
||||
<value>Mở thư mục dữ liệu</value>
|
||||
</data>
|
||||
<data name="Shell_SearchShortcut" xml:space="preserve">
|
||||
<value>Ctrl+K</value>
|
||||
</data>
|
||||
<data name="A11y_Clear" xml:space="preserve">
|
||||
<value>Xóa</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -23,7 +23,12 @@ public sealed partial class OdAboutViewModel(IOdUpdateService updates, Action<Ur
|
||||
[ObservableProperty]
|
||||
private string _statusText = "";
|
||||
|
||||
public string VersionText { get; } = OdLocalization.Format("About_Version", OdVersionInfo.FromAssembly(typeof(OdAboutViewModel).Assembly).DisplayText);
|
||||
private readonly string _version = OdVersionInfo.FromAssembly(typeof(OdAboutViewModel).Assembly).DisplayText;
|
||||
|
||||
// The status as a sentence to read again after a change of language.
|
||||
private Func<string> _status = () => "";
|
||||
|
||||
public string VersionText => OdLocalization.Format("About_Version", _version);
|
||||
|
||||
public bool CanDownload => State == OdUpdateState.Available;
|
||||
|
||||
@@ -33,6 +38,13 @@ public sealed partial class OdAboutViewModel(IOdUpdateService updates, Action<Ur
|
||||
/// <summary>Raised when the user asks to read the legal documents again.</summary>
|
||||
public event EventHandler? LegalRequested;
|
||||
|
||||
/// <summary>Reads the version and the status again, after a change of language.</summary>
|
||||
public void RefreshTexts()
|
||||
{
|
||||
OnPropertyChanged(nameof(VersionText));
|
||||
StatusText = _status();
|
||||
}
|
||||
|
||||
/// <summary>Opening About checks for updates (docs/ARCHITECTURE.md §7), unless a check already ran.</summary>
|
||||
public Task CheckOnOpenAsync() => State == OdUpdateState.Idle ? CheckCommand.ExecuteAsync(null) : Task.CompletedTask;
|
||||
|
||||
@@ -41,42 +53,42 @@ public sealed partial class OdAboutViewModel(IOdUpdateService updates, Action<Ur
|
||||
{
|
||||
if (!updates.IsInstalled)
|
||||
{
|
||||
Show(OdUpdateState.NotInstalled, OdLocalization.Get("About_NotInstalled"));
|
||||
Show(OdUpdateState.NotInstalled, () => OdLocalization.Get("About_NotInstalled"));
|
||||
return;
|
||||
}
|
||||
|
||||
Show(OdUpdateState.Checking, OdLocalization.Get("About_Checking"));
|
||||
Show(OdUpdateState.Checking, () => OdLocalization.Get("About_Checking"));
|
||||
try
|
||||
{
|
||||
var version = await updates.CheckAsync(CancellationToken.None);
|
||||
if (version is null)
|
||||
{
|
||||
Show(OdUpdateState.UpToDate, OdLocalization.Get("About_UpToDate"));
|
||||
Show(OdUpdateState.UpToDate, () => OdLocalization.Get("About_UpToDate"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Show(OdUpdateState.Available, OdLocalization.Format("About_Available", version));
|
||||
Show(OdUpdateState.Available, () => OdLocalization.Format("About_Available", version));
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
// Offline, rate-limited or a broken release: say so and let the user try again.
|
||||
Show(OdUpdateState.Failed, OdLocalization.Format("About_Failed", ex.Message));
|
||||
Show(OdUpdateState.Failed, () => OdLocalization.Format("About_Failed", ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task DownloadAsync()
|
||||
{
|
||||
Show(OdUpdateState.Downloading, OdLocalization.Format("About_Downloading", 0));
|
||||
Show(OdUpdateState.Downloading, () => OdLocalization.Format("About_Downloading", 0));
|
||||
try
|
||||
{
|
||||
await updates.DownloadAsync(new Progress<int>(percent => StatusText = OdLocalization.Format("About_Downloading", percent)), CancellationToken.None);
|
||||
await updates.DownloadAsync(new Progress<int>(percent => Show(OdUpdateState.Downloading, () => OdLocalization.Format("About_Downloading", percent))), CancellationToken.None);
|
||||
updates.ApplyAndRestart();
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
Show(OdUpdateState.Failed, OdLocalization.Format("About_Failed", ex.Message));
|
||||
Show(OdUpdateState.Failed, () => OdLocalization.Format("About_Failed", ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,9 +101,10 @@ public sealed partial class OdAboutViewModel(IOdUpdateService updates, Action<Ur
|
||||
[RelayCommand]
|
||||
private void ReportBug() => BugReportRequested?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
private void Show(OdUpdateState state, string text)
|
||||
private void Show(OdUpdateState state, Func<string> status)
|
||||
{
|
||||
State = state;
|
||||
StatusText = text;
|
||||
_status = status;
|
||||
StatusText = status();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using OmniDeck.Core.Localization;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>An accent color to pick in Settings → Appearance, with the name screen readers say for it.</summary>
|
||||
public sealed class OdAccentSwatch : ObservableObject
|
||||
{
|
||||
private readonly Func<string> _name;
|
||||
|
||||
public OdAccentSwatch(string color, Func<string> name)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(name);
|
||||
Color = color;
|
||||
_name = name;
|
||||
Name = name();
|
||||
}
|
||||
|
||||
public string Color { get; }
|
||||
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary>The swatches, in the order Settings shows them.</summary>
|
||||
public static IReadOnlyList<OdAccentSwatch> All() =>
|
||||
[
|
||||
new("#0067C0", () => OdLocalization.Get("Accent_Blue")),
|
||||
new("#8764B8", () => OdLocalization.Get("Accent_Purple")),
|
||||
new("#C239B3", () => OdLocalization.Get("Accent_Pink")),
|
||||
new("#E74856", () => OdLocalization.Get("Accent_Red")),
|
||||
new("#CA5010", () => OdLocalization.Get("Accent_Orange")),
|
||||
new("#10893E", () => OdLocalization.Get("Accent_Green")),
|
||||
];
|
||||
|
||||
/// <summary>Reads the name again, after a change of language.</summary>
|
||||
public void RefreshName()
|
||||
{
|
||||
Name = _name();
|
||||
OnPropertyChanged(nameof(Name));
|
||||
}
|
||||
|
||||
/// <summary>The color's name: screen readers name a list item after its data.</summary>
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
@@ -1,8 +1,40 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>One entry of a settings choice: the value stored and the text shown.</summary>
|
||||
public sealed record OdChoice<T>(T Value, string Title)
|
||||
/// <summary>
|
||||
/// One entry of a settings choice: the value stored and the text shown. The text follows the UI language
|
||||
/// in place (<see cref="RefreshTitle"/>): a list rebuilt instead would clear the selection bound to it.
|
||||
/// </summary>
|
||||
public sealed class OdChoice<T> : ObservableObject
|
||||
{
|
||||
private readonly Func<string> _title;
|
||||
|
||||
public OdChoice(T value, Func<string> title)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(title);
|
||||
Value = value;
|
||||
_title = title;
|
||||
Title = title();
|
||||
}
|
||||
|
||||
/// <summary>A choice whose text is not localized, such as a module's name.</summary>
|
||||
public OdChoice(T value, string title)
|
||||
: this(value, () => title)
|
||||
{
|
||||
}
|
||||
|
||||
public T Value { get; }
|
||||
|
||||
public string Title { get; private set; }
|
||||
|
||||
/// <summary>Reads the text again, after a change of language.</summary>
|
||||
public void RefreshTitle()
|
||||
{
|
||||
Title = _title();
|
||||
OnPropertyChanged(nameof(Title));
|
||||
}
|
||||
|
||||
/// <summary>The text shown: screen readers name a list item after its data.</summary>
|
||||
public override string ToString() => Title;
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
using OmniDeck.Core.Theming;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// First-run setup, right after the legal gate: the language and the UI preset. A preset applies as
|
||||
/// soon as it is picked, so the window itself is the preview. Get started records that setup is done.
|
||||
/// First-run setup, right after the legal gate: the language and the UI preset. Each preset card
|
||||
/// previews its preset with the layer the theme engine builds for it, and a preset applies to the
|
||||
/// whole window as soon as it is picked. Get started records that setup is done.
|
||||
/// </summary>
|
||||
public sealed partial class OdOnboardingViewModel : ObservableObject
|
||||
{
|
||||
@@ -20,13 +24,15 @@ public sealed partial class OdOnboardingViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _preset;
|
||||
|
||||
public OdOnboardingViewModel(IOdSettingsService settings, IOdAppMeta meta)
|
||||
public OdOnboardingViewModel(IOdSettingsService settings, IOdAppMeta meta, Func<OdPreset, ResourceDictionary>? preview = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
_settings = settings;
|
||||
_meta = meta;
|
||||
_language = settings.Current.Language;
|
||||
_preset = settings.Current.Preset;
|
||||
Presets = OdPresetOption.All(preview);
|
||||
OdLocalization.FollowCulture(OnCultureChanged);
|
||||
}
|
||||
|
||||
/// <summary>Raised once the user is done.</summary>
|
||||
@@ -34,7 +40,7 @@ public sealed partial class OdOnboardingViewModel : ObservableObject
|
||||
|
||||
public IReadOnlyList<OdChoice<string>> Languages { get; } = OdSettingsViewModel.LanguageChoices();
|
||||
|
||||
public IReadOnlyList<OdPresetOption> Presets { get; } = OdPresetOption.All();
|
||||
public IReadOnlyList<OdPresetOption> Presets { get; }
|
||||
|
||||
/// <summary>Whether this is the first run, so setup still has to happen.</summary>
|
||||
public static bool IsNeeded(IOdAppMeta meta)
|
||||
@@ -52,5 +58,19 @@ public sealed partial class OdOnboardingViewModel : ObservableObject
|
||||
|
||||
partial void OnLanguageChanged(string value) => _settings.Update(s => s with { Language = value });
|
||||
|
||||
// Picking a language here switches it at once: the lists' texts follow, in place.
|
||||
private void OnCultureChanged(object? sender, EventArgs e)
|
||||
{
|
||||
foreach (var choice in Languages)
|
||||
{
|
||||
choice.RefreshTitle();
|
||||
}
|
||||
|
||||
foreach (var option in Presets)
|
||||
{
|
||||
option.RefreshTexts();
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnPresetChanged(string value) => _settings.Update(s => s with { Preset = value });
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:settings="clr-namespace:OmniDeck.App.Settings"
|
||||
xmlns:theming="clr-namespace:OmniDeck.App.Theming"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="{res:OdLoc Onboarding_Title}"
|
||||
Width="760"
|
||||
@@ -21,7 +22,8 @@
|
||||
<ui:TitleBar Title="{res:OdLoc Onboarding_Title}" Grid.Row="0" />
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H1}"
|
||||
<TextBlock AutomationProperties.HeadingLevel="Level1"
|
||||
FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Onboarding_Title}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
@@ -29,7 +31,7 @@
|
||||
Text="{res:OdLoc Onboarding_Intro}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock FontWeight="SemiBold" Text="{res:OdLoc Settings_Language}" />
|
||||
<ComboBox Width="260"
|
||||
<ComboBox Width="{DynamicResource Od.Width.Tile}"
|
||||
Margin="{DynamicResource Od.Margin.Item}"
|
||||
HorizontalAlignment="Left"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_Language}"
|
||||
@@ -53,14 +55,17 @@
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type settings:OdPresetOption}">
|
||||
<StackPanel Width="200" Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Title}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding Hint}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
<!-- The card's text has its preset's own layer: each card shows that preset's sizes and text colors. -->
|
||||
<Border Width="200" Padding="{DynamicResource Od.Padding.Control}">
|
||||
<StackPanel theming:OdPresetPreview.Layer="{Binding Preview}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Title}" />
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.Base}"
|
||||
Style="{StaticResource PresetHint}"
|
||||
Text="{Binding Hint}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
@@ -1,14 +1,42 @@
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Theming;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>A UI preset as the preset cards show it (docs/UI-MODES.md).</summary>
|
||||
public sealed record OdPresetOption(string Name, string Title, string Hint)
|
||||
/// <summary>A UI preset as the preset cards show it (docs/UI-MODES.md); its texts follow the UI language in place.</summary>
|
||||
public sealed class OdPresetOption : ObservableObject
|
||||
{
|
||||
/// <summary>The three presets, in the order the cards show them.</summary>
|
||||
public static IReadOnlyList<OdPresetOption> All() =>
|
||||
[.. OdPreset.All.Select(preset => new OdPresetOption(preset.Name, OdLocalization.Get("Preset_" + preset.Name), OdLocalization.Get("Preset_" + preset.Name + "Hint")))];
|
||||
public OdPresetOption(string name, ResourceDictionary? preview = null)
|
||||
{
|
||||
Name = name;
|
||||
Preview = preview;
|
||||
Title = OdLocalization.Get("Preset_" + name);
|
||||
Hint = OdLocalization.Get("Preset_" + name + "Hint");
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public string Title { get; private set; }
|
||||
|
||||
public string Hint { get; private set; }
|
||||
|
||||
/// <summary>The preset's own layer, when the card previews it (<see cref="Theming.OdPresetPreview"/>).</summary>
|
||||
public ResourceDictionary? Preview { get; }
|
||||
|
||||
/// <summary>The three presets, in the order the cards show them, each with its preview when <paramref name="preview"/> builds one.</summary>
|
||||
public static IReadOnlyList<OdPresetOption> All(Func<OdPreset, ResourceDictionary>? preview = null) =>
|
||||
[.. OdPreset.All.Select(preset => new OdPresetOption(preset.Name, preview?.Invoke(preset)))];
|
||||
|
||||
/// <summary>Reads the texts again, after a change of language.</summary>
|
||||
public void RefreshTexts()
|
||||
{
|
||||
Title = OdLocalization.Get("Preset_" + Name);
|
||||
Hint = OdLocalization.Get("Preset_" + Name + "Hint");
|
||||
OnPropertyChanged(nameof(Title));
|
||||
OnPropertyChanged(nameof(Hint));
|
||||
}
|
||||
|
||||
/// <summary>The card's title: screen readers name a list item after its data.</summary>
|
||||
public override string ToString() => Title;
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
<UserControl x:Class="OmniDeck.App.Settings.OdSettingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:a11y="clr-namespace:OmniDeck.Core.Accessibility;assembly=OmniDeck.Core"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:settings="clr-namespace:OmniDeck.App.Settings"
|
||||
xmlns:shell="clr-namespace:OmniDeck.App.Shell"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
FontSize="{DynamicResource Od.Font.Base}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<!-- The navigation view's frame does not pass the window's text color down: pages set their own. -->
|
||||
<!-- The navigation view's frame does not pass the window's text color and size down: pages set their own. -->
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="Visible" />
|
||||
</UserControl.Resources>
|
||||
<DockPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
DockPanel.Dock="Top"
|
||||
FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Settings_Title}" />
|
||||
<TabControl SelectedIndex="{Binding SectionIndex}">
|
||||
<TabControl AutomationProperties.Name="{res:OdLoc Settings_Title}" SelectedIndex="{Binding SectionIndex}">
|
||||
<TabItem Header="{res:OdLoc Settings_General}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_Language}">
|
||||
<ComboBox MinWidth="200"
|
||||
<ComboBox MinWidth="{DynamicResource Od.Width.Field}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_Language}"
|
||||
DisplayMemberPath="Title"
|
||||
ItemsSource="{Binding Languages}"
|
||||
@@ -42,7 +45,7 @@
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_Theme}">
|
||||
<ComboBox MinWidth="200"
|
||||
<ComboBox MinWidth="{DynamicResource Od.Width.Field}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_Theme}"
|
||||
DisplayMemberPath="Title"
|
||||
ItemsSource="{Binding Themes}"
|
||||
@@ -71,9 +74,7 @@
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Title}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding Hint}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Style="{StaticResource PresetHint}" Text="{Binding Hint}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
@@ -96,30 +97,43 @@
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_Motion}">
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{res:OdLoc Settings_Motion}" IsChecked="{Binding MotionEnabled}" />
|
||||
</ui:CardControl>
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_AccentSystem}">
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{res:OdLoc Settings_AccentSystem}" IsChecked="{Binding UseSystemAccent}" />
|
||||
</ui:CardControl>
|
||||
<ItemsControl Margin="{DynamicResource Od.Margin.Item}"
|
||||
Focusable="False"
|
||||
ItemsSource="{Binding AccentSwatches}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Width="{DynamicResource Od.HitTarget.Min}"
|
||||
Height="{DynamicResource Od.HitTarget.Min}"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
AutomationProperties.Name="{Binding}"
|
||||
Background="{Binding}"
|
||||
Command="{Binding DataContext.ChooseAccentCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<!-- High Contrast uses Windows' colors, the accent included (docs/UI-MODES.md §4): no accent to pick there. -->
|
||||
<StackPanel>
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="StackPanel">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=(SystemParameters.HighContrast)}" Value="True">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_AccentSystem}">
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{res:OdLoc Settings_AccentSystem}" IsChecked="{Binding UseSystemAccent}" />
|
||||
</ui:CardControl>
|
||||
<ListBox Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_AccentColors}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemsSource="{Binding AccentSwatches}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectedItem="{Binding SelectedSwatch}">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type settings:OdAccentSwatch}">
|
||||
<Border Width="{DynamicResource Od.HitTarget.Min}"
|
||||
Height="{DynamicResource Od.HitTarget.Min}"
|
||||
Background="{Binding Color}"
|
||||
CornerRadius="{DynamicResource Od.Corner.Radius}"
|
||||
ToolTip="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
@@ -129,7 +143,7 @@
|
||||
<WrapPanel Margin="{DynamicResource Od.Padding.Control}" DockPanel.Dock="Top">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Text="{res:OdLoc Settings_IdleAfter}" />
|
||||
<ui:NumberBox Width="180"
|
||||
<ui:NumberBox Width="{DynamicResource Od.Width.Field}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_IdleAfter}"
|
||||
MaxDecimalPlaces="0"
|
||||
Maximum="10080"
|
||||
@@ -138,7 +152,7 @@
|
||||
</StackPanel>
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Text="{res:OdLoc Settings_HibernateAfter}" />
|
||||
<ui:NumberBox Width="180"
|
||||
<ui:NumberBox Width="{DynamicResource Od.Width.Field}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_HibernateAfter}"
|
||||
MaxDecimalPlaces="0"
|
||||
Maximum="10080"
|
||||
@@ -147,7 +161,7 @@
|
||||
</StackPanel>
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Text="{res:OdLoc Settings_SoftCap}" />
|
||||
<ui:NumberBox Width="180"
|
||||
<ui:NumberBox Width="{DynamicResource Od.Width.Field}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_SoftCap}"
|
||||
MaxDecimalPlaces="0"
|
||||
Minimum="0"
|
||||
@@ -155,7 +169,7 @@
|
||||
</StackPanel>
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Text="{res:OdLoc Settings_HardCap}" />
|
||||
<ui:NumberBox Width="180"
|
||||
<ui:NumberBox Width="{DynamicResource Od.Width.Field}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_HardCap}"
|
||||
MaxDecimalPlaces="0"
|
||||
Minimum="0"
|
||||
@@ -196,6 +210,8 @@
|
||||
<ui:Button Grid.Column="1"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{res:OdLocRow WebApps_ResetPermissions,
|
||||
Path=Name}"
|
||||
Command="{Binding DataContext.ResetPermissionsCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc WebApps_ResetPermissions}"
|
||||
@@ -203,6 +219,8 @@
|
||||
<ui:ToggleSwitch Grid.Column="2"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{res:OdLocRow WebApps_Notifications,
|
||||
Path=Name}"
|
||||
Command="{Binding DataContext.ToggleNotificationsCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc WebApps_Notifications}"
|
||||
@@ -214,6 +232,7 @@
|
||||
</ItemsControl>
|
||||
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc WebApps_DataTitle}" />
|
||||
@@ -228,6 +247,8 @@
|
||||
<DockPanel>
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{res:OdLocRow WebApps_ClearData,
|
||||
Path=AppNames}"
|
||||
Command="{Binding DataContext.ClearDataCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc WebApps_ClearData}"
|
||||
@@ -240,9 +261,9 @@
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
Text="{Binding Message}"
|
||||
TextWrapping="Wrap" />
|
||||
<a11y:OdStatusText Margin="{DynamicResource Od.Padding.Control}"
|
||||
Text="{Binding Message}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
@@ -270,14 +291,15 @@
|
||||
Click="OnImportClick"
|
||||
Content="{res:OdLoc Settings_Import}" />
|
||||
</StackPanel>
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}" Text="{Binding DataMessage}" />
|
||||
<a11y:OdStatusText Margin="{DynamicResource Od.Padding.Control}" Text="{Binding DataMessage}" />
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="{res:OdLoc Settings_About}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}" DataContext="{Binding About}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
<TextBlock AutomationProperties.HeadingLevel="Level2"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc App_Name}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}" Text="{Binding VersionText}" />
|
||||
@@ -294,9 +316,18 @@
|
||||
Command="{Binding ReportBugCommand}"
|
||||
Content="{res:OdLoc About_ReportBug}" />
|
||||
</StackPanel>
|
||||
<a11y:OdStatusText Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
Text="{Binding StatusText}"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc About_Prereleases}">
|
||||
<ui:CardControl.Content>
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{res:OdLoc About_Prereleases}" IsChecked="{Binding DataContext.ReceivePrereleases, RelativeSource={RelativeSource AncestorType=TabItem}}" />
|
||||
</ui:CardControl.Content>
|
||||
</ui:CardControl>
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
Text="{Binding StatusText}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc About_PrereleasesNote}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
FontWeight="SemiBold"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.App.Shell;
|
||||
using OmniDeck.Core;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
@@ -32,6 +33,10 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
[ObservableProperty]
|
||||
private bool _startWithWindows;
|
||||
|
||||
/// <summary>Whether updates include alphas and betas: the user's choice, or what the running build is.</summary>
|
||||
[ObservableProperty]
|
||||
private bool _receivePrereleases;
|
||||
|
||||
[ObservableProperty]
|
||||
private OdThemeMode _theme;
|
||||
|
||||
@@ -86,21 +91,36 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
DataFolder = dataRoot.Root;
|
||||
Load(settings.Current);
|
||||
settings.Changed += OnSettingsChanged;
|
||||
OdLocalization.FollowCulture(OnCultureChanged);
|
||||
}
|
||||
|
||||
public IReadOnlyList<OdChoice<string>> Languages { get; } = LanguageChoices();
|
||||
|
||||
public IReadOnlyList<OdChoice<OdThemeMode>> Themes { get; } =
|
||||
[
|
||||
new(OdThemeMode.System, OdLocalization.Get("Theme_System")),
|
||||
new(OdThemeMode.Light, OdLocalization.Get("Theme_Light")),
|
||||
new(OdThemeMode.Dark, OdLocalization.Get("Theme_Dark")),
|
||||
new(OdThemeMode.System, () => OdLocalization.Get("Theme_System")),
|
||||
new(OdThemeMode.Light, () => OdLocalization.Get("Theme_Light")),
|
||||
new(OdThemeMode.Dark, () => OdLocalization.Get("Theme_Dark")),
|
||||
];
|
||||
|
||||
public IReadOnlyList<OdPresetOption> Presets { get; } = OdPresetOption.All();
|
||||
|
||||
/// <summary>Accent colors to pick from when the Windows accent is not used.</summary>
|
||||
public IReadOnlyList<string> AccentSwatches { get; } = ["#0067C0", "#8764B8", "#C239B3", "#E74856", "#CA5010", "#10893E"];
|
||||
public IReadOnlyList<OdAccentSwatch> AccentSwatches { get; } = OdAccentSwatch.All();
|
||||
|
||||
/// <summary>The swatch in use, or null with the Windows accent; picking one leaves the Windows accent.</summary>
|
||||
public OdAccentSwatch? SelectedSwatch
|
||||
{
|
||||
get => UseSystemAccent ? null : AccentSwatches.FirstOrDefault(swatch => string.Equals(swatch.Color, AccentColor, StringComparison.OrdinalIgnoreCase));
|
||||
set
|
||||
{
|
||||
if (value is not null)
|
||||
{
|
||||
AccentColor = value.Color;
|
||||
UseSystemAccent = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OdMemoryViewModel Memory { get; }
|
||||
|
||||
@@ -110,11 +130,14 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
|
||||
public string DataFolder { get; }
|
||||
|
||||
/// <summary>The language choices: Windows' display language, then the languages OmniDeck ships.</summary>
|
||||
/// <summary>
|
||||
/// The language choices: Windows' display language, then the languages OmniDeck ships, each named in
|
||||
/// itself, so that whoever reads the list finds their own language whatever the UI's.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<OdChoice<string>> LanguageChoices() =>
|
||||
[
|
||||
new("", OdLocalization.Get("Language_System")),
|
||||
new("en", OdLocalization.Get("Language_English")),
|
||||
new("", () => OdLocalization.Get("Language_System")),
|
||||
.. OdLanguages.Shipped.Select(name => new OdChoice<string>(name, OdLanguages.NativeName(name))),
|
||||
];
|
||||
|
||||
public void ShowSection(OdSettingsSection section) => SectionIndex = (int)section;
|
||||
@@ -128,18 +151,15 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
public void ImportFrom(string path) =>
|
||||
DataMessage = _settings.Import(path) ? OdLocalization.Get("Settings_Imported") : OdLocalization.Get("Settings_ImportFailed");
|
||||
|
||||
public void Dispose() => _settings.Changed -= OnSettingsChanged;
|
||||
public void Dispose()
|
||||
{
|
||||
OdLocalization.UnfollowCulture(OnCultureChanged);
|
||||
_settings.Changed -= OnSettingsChanged;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenDataFolder() => _openFolder(DataFolder);
|
||||
|
||||
[RelayCommand]
|
||||
private void ChooseAccent(string color)
|
||||
{
|
||||
AccentColor = color;
|
||||
UseSystemAccent = false;
|
||||
}
|
||||
|
||||
partial void OnSectionIndexChanged(int value)
|
||||
{
|
||||
if (value == (int)OdSettingsSection.About)
|
||||
@@ -156,6 +176,8 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
|
||||
partial void OnCloseToTrayChanged(bool value) => Apply(s => s with { CloseToTray = value });
|
||||
|
||||
partial void OnReceivePrereleasesChanged(bool value) => Apply(s => s with { Prereleases = value });
|
||||
|
||||
partial void OnStartWithWindowsChanged(bool value)
|
||||
{
|
||||
if (!_loading)
|
||||
@@ -176,11 +198,16 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
partial void OnUseSystemAccentChanged(bool value)
|
||||
{
|
||||
// Leaving the Windows accent keeps the color already picked, or starts from the first swatch.
|
||||
var custom = AccentColor.Length > 0 ? AccentColor : AccentSwatches[0];
|
||||
var custom = AccentColor.Length > 0 ? AccentColor : AccentSwatches[0].Color;
|
||||
Apply(s => s with { AccentColor = value ? "" : custom });
|
||||
OnPropertyChanged(nameof(SelectedSwatch));
|
||||
}
|
||||
|
||||
partial void OnAccentColorChanged(string value) => Apply(s => s with { AccentColor = UseSystemAccent ? "" : value });
|
||||
partial void OnAccentColorChanged(string value)
|
||||
{
|
||||
Apply(s => s with { AccentColor = UseSystemAccent ? "" : value });
|
||||
OnPropertyChanged(nameof(SelectedSwatch));
|
||||
}
|
||||
|
||||
partial void OnIdleAfterMinutesChanged(double? value) =>
|
||||
Apply(s => s with { Memory = s.Memory with { IdleAfterMinutes = WholeNumber(value, s.Memory.IdleAfterMinutes) } });
|
||||
@@ -207,6 +234,33 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
|
||||
private void OnSettingsChanged(object? sender, OdSettingsChangedEventArgs e) => Load(e.Settings);
|
||||
|
||||
// The lists keep their items, whose texts change in place: the selections bound to them stay.
|
||||
private void OnCultureChanged(object? sender, EventArgs e)
|
||||
{
|
||||
foreach (var choice in Languages)
|
||||
{
|
||||
choice.RefreshTitle();
|
||||
}
|
||||
|
||||
foreach (var choice in Themes)
|
||||
{
|
||||
choice.RefreshTitle();
|
||||
}
|
||||
|
||||
foreach (var option in Presets)
|
||||
{
|
||||
option.RefreshTexts();
|
||||
}
|
||||
|
||||
foreach (var swatch in AccentSwatches)
|
||||
{
|
||||
swatch.RefreshName();
|
||||
}
|
||||
|
||||
About.RefreshTexts();
|
||||
WebApps.Refresh();
|
||||
}
|
||||
|
||||
/// <summary>Shows <paramref name="settings"/> without writing anything back.</summary>
|
||||
private void Load(OdSettings settings)
|
||||
{
|
||||
@@ -215,6 +269,7 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
Language = settings.Language;
|
||||
CloseToTray = settings.CloseToTray;
|
||||
ReceivePrereleases = OdUpdateChannel.IncludesPrereleases(settings.Prereleases, OdVersionInfo.FromAssembly(typeof(OdSettingsViewModel).Assembly).Version);
|
||||
StartWithWindows = _startup.IsEnabled;
|
||||
Theme = settings.Theme;
|
||||
Preset = settings.Preset;
|
||||
|
||||
@@ -4,4 +4,8 @@ namespace OmniDeck.App.Settings;
|
||||
/// <param name="Profile">The catalog profile.</param>
|
||||
/// <param name="AppIds">The apps' ids, in catalog order.</param>
|
||||
/// <param name="AppNames">The apps' names, as one list to show.</param>
|
||||
public sealed record OdWebProfileGroup(string Profile, IReadOnlyList<string> AppIds, string AppNames);
|
||||
public sealed record OdWebProfileGroup(string Profile, IReadOnlyList<string> AppIds, string AppNames)
|
||||
{
|
||||
/// <summary>The apps' names: screen readers name a list item after its data.</summary>
|
||||
public override string ToString() => AppNames;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using OmniDeck.Core.Localization;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Names the buttons inside WPF-UI's templates that screen readers reach with no name, or with a
|
||||
/// glyph's name such as "CaretUp24": the title bar's buttons, the sidebar's pane button, the scroll bar,
|
||||
/// slider and number box buttons, a text box's clear button and the password box's reveal button. An
|
||||
/// editable combo box's text box, which takes the focus, gets its combo box's name. Registered once,
|
||||
/// for every window, on the first layout of each such button: WPF raises Loaded only on elements that
|
||||
/// handle it themselves.
|
||||
/// </summary>
|
||||
internal static class OdAutomationNames
|
||||
{
|
||||
private static readonly IMultiValueConverter Choose = new ChooseConverter();
|
||||
|
||||
// By automation ID, which WPF-UI's templates set (or x:Name, which stands in for it).
|
||||
private static readonly Dictionary<string, Binding> ByPart = new(StringComparer.Ordinal)
|
||||
{
|
||||
["TitleBarMinimizeButton"] = Localized("A11y_Minimize"),
|
||||
["TitleBarCloseButton"] = Localized("A11y_Close"),
|
||||
["PART_InlineIncrementButton"] = Localized("A11y_Increase"),
|
||||
["PART_InlineDecrementButton"] = Localized("A11y_Decrease"),
|
||||
["RevealButton"] = Localized("A11y_ShowPassword"),
|
||||
["PART_ClearButton"] = Localized("A11y_Clear"),
|
||||
["PageUp"] = Localized("A11y_PageUp"),
|
||||
["PageDown"] = Localized("A11y_PageDown"),
|
||||
["PageLeft"] = Localized("A11y_PageLeft"),
|
||||
["PageRight"] = Localized("A11y_PageRight"),
|
||||
["DecreaseLarge"] = Localized("A11y_Decrease"),
|
||||
["IncreaseLarge"] = Localized("A11y_Increase"),
|
||||
};
|
||||
|
||||
public static void Register()
|
||||
{
|
||||
EventManager.RegisterClassHandler(typeof(ButtonBase), FrameworkElement.SizeChangedEvent, new SizeChangedEventHandler(OnButtonSized));
|
||||
EventManager.RegisterClassHandler(typeof(System.Windows.Controls.TextBox), FrameworkElement.SizeChangedEvent, new SizeChangedEventHandler(OnTextBoxSized));
|
||||
}
|
||||
|
||||
/// <summary>The name <paramref name="button"/> gets, as a binding to its string, or null when it is not one of these.</summary>
|
||||
internal static Binding? NameFor(ButtonBase button)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(button);
|
||||
return (button.Command is { } command ? ByCommand(command) : null) ?? ByPart.GetValueOrDefault(PartOf(button));
|
||||
}
|
||||
|
||||
/// <summary>The automation ID WPF-UI gave the button, or else its x:Name, which UI Automation reports in its place.</summary>
|
||||
private static string PartOf(ButtonBase button) =>
|
||||
AutomationProperties.GetAutomationId(button) is { Length: > 0 } id ? id : button.Name;
|
||||
|
||||
private static Binding? ByCommand(ICommand command) => command switch
|
||||
{
|
||||
_ when command == ScrollBar.LineUpCommand => Localized("A11y_ScrollUp"),
|
||||
_ when command == ScrollBar.LineDownCommand => Localized("A11y_ScrollDown"),
|
||||
_ when command == ScrollBar.LineLeftCommand => Localized("A11y_ScrollLeft"),
|
||||
_ when command == ScrollBar.LineRightCommand => Localized("A11y_ScrollRight"),
|
||||
_ when command == ScrollBar.PageUpCommand => Localized("A11y_PageUp"),
|
||||
_ when command == ScrollBar.PageDownCommand => Localized("A11y_PageDown"),
|
||||
_ when command == ScrollBar.PageLeftCommand => Localized("A11y_PageLeft"),
|
||||
_ when command == ScrollBar.PageRightCommand => Localized("A11y_PageRight"),
|
||||
_ when command == Slider.DecreaseLarge => Localized("A11y_Decrease"),
|
||||
_ when command == Slider.IncreaseLarge => Localized("A11y_Increase"),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
private static void OnButtonSized(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (sender is not ButtonBase button || !string.IsNullOrEmpty(AutomationProperties.GetName(button)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var part = PartOf(button);
|
||||
if (string.Equals(part, "TitleBarMaximizeButton", StringComparison.Ordinal))
|
||||
{
|
||||
// Maximize, or Restore once the window is maximized, as Windows' own title bars say.
|
||||
NameAfter(button, new Binding(nameof(Window.WindowState)) { RelativeSource = Ancestor(typeof(Window)), Converter = IsMaximized.Instance }, Localized("A11y_Maximize"), Localized("A11y_Restore"));
|
||||
}
|
||||
else if (string.Equals(part, "NavigationToggleButton", StringComparison.Ordinal))
|
||||
{
|
||||
NameAfter(button, new Binding(nameof(NavigationView.IsPaneOpen)) { RelativeSource = Ancestor(typeof(NavigationView)) }, Localized("A11y_OpenNavigation"), Localized("A11y_CloseNavigation"));
|
||||
}
|
||||
else if (NameFor(button) is { } name)
|
||||
{
|
||||
button.SetBinding(AutomationProperties.NameProperty, name);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnTextBoxSized(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (sender is System.Windows.Controls.TextBox { TemplatedParent: ComboBox combo } box && string.IsNullOrEmpty(AutomationProperties.GetName(box)))
|
||||
{
|
||||
box.SetBinding(AutomationProperties.NameProperty, new Binding { Path = new PropertyPath(AutomationProperties.NameProperty), Source = combo, Mode = BindingMode.OneWay });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Names <paramref name="button"/> <paramref name="whenFalse"/> or <paramref name="whenTrue"/>, following <paramref name="condition"/>.</summary>
|
||||
private static void NameAfter(ButtonBase button, Binding condition, Binding whenFalse, Binding whenTrue)
|
||||
{
|
||||
var name = new MultiBinding { Converter = Choose, Mode = BindingMode.OneWay };
|
||||
name.Bindings.Add(condition);
|
||||
name.Bindings.Add(whenFalse);
|
||||
name.Bindings.Add(whenTrue);
|
||||
button.SetBinding(AutomationProperties.NameProperty, name);
|
||||
}
|
||||
|
||||
private static RelativeSource Ancestor(Type type) => new(RelativeSourceMode.FindAncestor, type, 1);
|
||||
|
||||
private static Binding Localized(string key) => new($"[{key}]") { Source = OdLocalization.Instance, Mode = BindingMode.OneWay };
|
||||
|
||||
private sealed class ChooseConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) => values switch
|
||||
{
|
||||
[true, string, string whenTrue] => whenTrue,
|
||||
[_, string whenFalse, string] => whenFalse,
|
||||
_ => DependencyProperty.UnsetValue,
|
||||
};
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
private sealed class IsMaximized : IValueConverter
|
||||
{
|
||||
public static readonly IsMaximized Instance = new();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => value is WindowState.Maximized;
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,20 @@
|
||||
<UserControl x:Class="OmniDeck.App.Shell.OdLibraryPage"
|
||||
<UserControl x:Class="OmniDeck.App.Shell.OdLibraryPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:shell="clr-namespace:OmniDeck.App.Shell"
|
||||
xmlns:theme="clr-namespace:OmniDeck.App.Theming"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
FontSize="{DynamicResource Od.Font.Base}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<!-- The navigation view's frame does not pass the window's text color down: pages set their own. -->
|
||||
<!-- The navigation view's frame does not pass the window's text color and size down: pages set their own. -->
|
||||
<UserControl.Resources>
|
||||
<shell:OdSymbolConverter x:Key="Symbol" />
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H1}"
|
||||
<TextBlock AutomationProperties.HeadingLevel="Level1"
|
||||
FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Shell_LibraryTitle}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
@@ -39,7 +41,7 @@
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type shell:OdModuleItemViewModel}">
|
||||
<ui:Card Width="260"
|
||||
<ui:Card Width="{DynamicResource Od.Width.Tile}"
|
||||
Margin="{DynamicResource Od.Margin.Tile}"
|
||||
VerticalAlignment="Stretch"
|
||||
theme:OdMotion.HoverScale="True">
|
||||
@@ -61,16 +63,18 @@
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}"
|
||||
DockPanel.Dock="Bottom"
|
||||
Orientation="Horizontal">
|
||||
<!-- Wraps rather than clips once large text makes the buttons wider than the tile. -->
|
||||
<WrapPanel Margin="{DynamicResource Od.Padding.Control}" DockPanel.Dock="Bottom">
|
||||
<ui:Button Appearance="Primary"
|
||||
AutomationProperties.Name="{res:OdLocRow Shell_Open,
|
||||
Path=Title}"
|
||||
Command="{Binding DataContext.OpenCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Shell_Open}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Appearance="Transparent"
|
||||
AutomationProperties.Name="{res:OdLoc Shell_PopOut}"
|
||||
AutomationProperties.Name="{res:OdLocRow Shell_PopOut,
|
||||
Path=Title}"
|
||||
Command="{Binding DataContext.PopOutCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip="{res:OdLoc Shell_PopOut}">
|
||||
@@ -83,11 +87,11 @@
|
||||
<ui:Button.Style>
|
||||
<Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
|
||||
<Setter Property="ToolTip" Value="{res:OdLoc Shell_Pin}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{res:OdLoc Shell_Pin}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{res:OdLocRow Shell_Pin, Path=Title}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsPinned}" Value="True">
|
||||
<Setter Property="ToolTip" Value="{res:OdLoc Shell_Unpin}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{res:OdLoc Shell_Unpin}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{res:OdLocRow Shell_Unpin, Path=Title}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -105,7 +109,7 @@
|
||||
</ui:SymbolIcon.Style>
|
||||
</ui:SymbolIcon>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
</ui:Card>
|
||||
</DataTemplate>
|
||||
|
||||
@@ -4,14 +4,17 @@
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:shell="clr-namespace:OmniDeck.App.Shell"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
FontSize="{DynamicResource Od.Font.Base}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<!-- The navigation view's frame does not pass the window's text color and size down: pages set their own. -->
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="Visible" />
|
||||
<shell:OdSymbolConverter x:Key="Symbol" />
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H1}"
|
||||
<TextBlock AutomationProperties.HeadingLevel="Level2"
|
||||
FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Memory_Title}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
@@ -52,8 +55,8 @@
|
||||
Text="{Binding Title}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<WrapPanel>
|
||||
<TextBlock Margin="0,0,12,0" Text="{Binding StateText}" />
|
||||
<TextBlock Margin="0,0,12,0"
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Inline}" Text="{Binding StateText}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Inline}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding LastUsedText}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="{Binding MemoryText}" />
|
||||
@@ -63,6 +66,8 @@
|
||||
<ui:ToggleSwitch Grid.Column="1"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{res:OdLocRow Memory_KeepRunning,
|
||||
Path=Title}"
|
||||
Command="{Binding DataContext.ToggleKeepRunningCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Memory_KeepRunning}"
|
||||
@@ -71,16 +76,22 @@
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
AutomationProperties.Name="{res:OdLocRow Memory_Suspend,
|
||||
Path=Title}"
|
||||
Command="{Binding DataContext.SuspendCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Memory_Suspend}"
|
||||
IsEnabled="{Binding CanSuspend}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
AutomationProperties.Name="{res:OdLocRow Memory_Hibernate,
|
||||
Path=Title}"
|
||||
Command="{Binding DataContext.HibernateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Memory_Hibernate}"
|
||||
IsEnabled="{Binding CanHibernate}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
AutomationProperties.Name="{res:OdLocRow Shell_Close,
|
||||
Path=Title}"
|
||||
Command="{Binding DataContext.CloseCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Shell_Close}"
|
||||
@@ -103,7 +114,9 @@
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
Symbol="Globe24" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock FontWeight="SemiBold" Text="{res:OdLoc Memory_SharedTitle}" />
|
||||
<TextBlock AutomationProperties.HeadingLevel="Level3"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Memory_SharedTitle}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc Memory_SharedDescription}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
@@ -5,4 +5,5 @@
|
||||
VerticalContentAlignment="Stretch"
|
||||
Content="{Binding CurrentView}"
|
||||
Focusable="False"
|
||||
FontSize="{DynamicResource Od.Font.Base}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
@@ -0,0 +1,68 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Automation.Provider;
|
||||
using System.Windows.Threading;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// A sidebar item screen readers can use: a list item that says whether its page is on screen, and that
|
||||
/// they can select or invoke. WPF-UI's own item peer never reaches them, because the sidebar's list wraps
|
||||
/// each item in a data item that has neither (<see cref="OdNavigationView"/> lists these instead).
|
||||
/// </summary>
|
||||
public sealed class OdNavItem : NavigationViewItem
|
||||
{
|
||||
/// <summary>Navigates as a click does.</summary>
|
||||
internal void Open() => OnClick();
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new OdNavItemAutomationPeer(this);
|
||||
|
||||
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnPropertyChanged(e);
|
||||
if (e.Property == IsActiveProperty && UIElementAutomationPeer.FromElement(this) is { } peer)
|
||||
{
|
||||
peer.RaisePropertyChangedEvent(SelectionItemPatternIdentifiers.IsSelectedProperty, e.OldValue, e.NewValue);
|
||||
if (e.NewValue is true)
|
||||
{
|
||||
peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class OdNavItemAutomationPeer(OdNavItem owner) : FrameworkElementAutomationPeer(owner), IInvokeProvider, ISelectionItemProvider
|
||||
{
|
||||
public bool IsSelected => owner.IsActive;
|
||||
|
||||
public IRawElementProviderSimple? SelectionContainer => GetParent() is { } list ? ProviderFromPeer(list) : null;
|
||||
|
||||
public override object? GetPattern(PatternInterface patternInterface) =>
|
||||
patternInterface is PatternInterface.Invoke or PatternInterface.SelectionItem ? this : base.GetPattern(patternInterface);
|
||||
|
||||
public void Invoke()
|
||||
{
|
||||
if (!IsEnabled())
|
||||
{
|
||||
throw new ElementNotEnabledException();
|
||||
}
|
||||
|
||||
// As WPF's own buttons do: the client's call returns before the navigation runs.
|
||||
_ = owner.Dispatcher.BeginInvoke(DispatcherPriority.Input, owner.Open);
|
||||
}
|
||||
|
||||
public void Select() => Invoke();
|
||||
|
||||
public void AddToSelection() => throw new InvalidOperationException();
|
||||
|
||||
public void RemoveFromSelection() => throw new InvalidOperationException();
|
||||
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.ListItem;
|
||||
|
||||
protected override string GetClassNameCore() => nameof(OdNavItem);
|
||||
|
||||
// The name says it all: the icon's glyph and the label would only repeat it.
|
||||
protected override List<AutomationPeer>? GetChildrenCore() => null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Automation.Provider;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using OmniDeck.Core.Localization;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// WPF-UI's navigation view, with a peer that gives screen readers the sidebar as two lists of
|
||||
/// <see cref="OdNavItem"/>: the modules, then Settings and the library. WPF-UI hosts the items in plain
|
||||
/// item controls, whose peers wrap each item in a data item that can be neither selected nor invoked.
|
||||
/// </summary>
|
||||
public sealed class OdNavigationView : NavigationView
|
||||
{
|
||||
public OdNavigationView()
|
||||
{
|
||||
// Modules come and go from the sidebar; screen readers then read the lists again.
|
||||
foreach (var items in new[] { MenuItems, FooterMenuItems })
|
||||
{
|
||||
if (items is INotifyCollectionChanged changes)
|
||||
{
|
||||
changes.CollectionChanged += (_, _) => (UIElementAutomationPeer.FromElement(this) as OdNavigationViewAutomationPeer)?.ListsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The template's list of modules; WPF-UI keeps it protected.</summary>
|
||||
internal ItemsControl? Menu => MenuItemsItemsControl;
|
||||
|
||||
/// <summary>The template's list at the foot of the sidebar.</summary>
|
||||
internal ItemsControl? Footer => FooterMenuItemsItemsControl;
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new OdNavigationViewAutomationPeer(this);
|
||||
|
||||
private sealed class OdNavigationViewAutomationPeer(OdNavigationView owner) : FrameworkElementAutomationPeer(owner)
|
||||
{
|
||||
private OdNavListAutomationPeer? _menu;
|
||||
private OdNavListAutomationPeer? _footer;
|
||||
|
||||
internal void ListsChanged()
|
||||
{
|
||||
_menu?.InvalidatePeer();
|
||||
_footer?.InvalidatePeer();
|
||||
}
|
||||
|
||||
// Not an element of its own: the pane button, the lists and the page stay beside the title bar.
|
||||
protected override bool IsControlElementCore() => false;
|
||||
|
||||
protected override bool IsContentElementCore() => false;
|
||||
|
||||
// As UIElementAutomationPeer walks the visual tree, except that the two item controls (and so
|
||||
// their wrapping peers) are replaced by lists of the items' own peers.
|
||||
protected override List<AutomationPeer> GetChildrenCore()
|
||||
{
|
||||
var children = new List<AutomationPeer>();
|
||||
Collect(owner, children);
|
||||
return children;
|
||||
}
|
||||
|
||||
private void Collect(DependencyObject parent, List<AutomationPeer> children)
|
||||
{
|
||||
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(parent, i);
|
||||
if (ReferenceEquals(child, owner.Menu))
|
||||
{
|
||||
children.Add(ListFor(ref _menu, owner.Menu, () => OdLocalization.Get("Shell_NavModules")));
|
||||
}
|
||||
else if (ReferenceEquals(child, owner.Footer))
|
||||
{
|
||||
children.Add(ListFor(ref _footer, owner.Footer, () => OdLocalization.Get("Shell_NavFooter")));
|
||||
}
|
||||
else if (child is UIElement element && !HoldsAList(element) && CreatePeerForElement(element) is { } peer)
|
||||
{
|
||||
children.Add(peer);
|
||||
}
|
||||
else
|
||||
{
|
||||
Collect(child, children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The lists sit in a scroll viewer, whose peer would list them wrapped as WPF-UI does.
|
||||
private bool HoldsAList(UIElement element) =>
|
||||
owner.Menu?.IsDescendantOf(element) == true || owner.Footer?.IsDescendantOf(element) == true;
|
||||
|
||||
private static OdNavListAutomationPeer ListFor(ref OdNavListAutomationPeer? cached, ItemsControl list, Func<string> name)
|
||||
{
|
||||
// A new template brings new item controls, and so new lists.
|
||||
if (cached?.Owner != list)
|
||||
{
|
||||
cached = new OdNavListAutomationPeer(list, name);
|
||||
}
|
||||
|
||||
return cached;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>One of the sidebar's lists: the items' own peers, and the one whose page is on screen.</summary>
|
||||
private sealed class OdNavListAutomationPeer(ItemsControl list, Func<string> name) : FrameworkElementAutomationPeer(list), ISelectionProvider
|
||||
{
|
||||
public bool CanSelectMultiple => false;
|
||||
|
||||
public bool IsSelectionRequired => false;
|
||||
|
||||
public IRawElementProviderSimple[] GetSelection() =>
|
||||
[.. Items().Where(item => item.IsActive).Select(CreatePeerForElement).OfType<AutomationPeer>().Select(ProviderFromPeer)];
|
||||
|
||||
public override object? GetPattern(PatternInterface patternInterface) =>
|
||||
patternInterface == PatternInterface.Selection ? this : base.GetPattern(patternInterface);
|
||||
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.List;
|
||||
|
||||
protected override string GetClassNameCore() => "OdNavList";
|
||||
|
||||
protected override string GetNameCore() => name();
|
||||
|
||||
protected override List<AutomationPeer> GetChildrenCore() => [.. Items().Select(CreatePeerForElement).OfType<AutomationPeer>()];
|
||||
|
||||
private IEnumerable<OdNavItem> Items() => list.Items.OfType<OdNavItem>();
|
||||
}
|
||||
}
|
||||
@@ -5,4 +5,8 @@ namespace OmniDeck.App.Shell;
|
||||
/// <param name="Detail">The second line: the module's category, or "Command".</param>
|
||||
/// <param name="Icon">A WPF-UI <c>SymbolRegular</c> name.</param>
|
||||
/// <param name="RunAsync">What choosing the entry does.</param>
|
||||
public sealed record OdPaletteEntry(string Title, string Detail, string Icon, Func<Task> RunAsync);
|
||||
public sealed record OdPaletteEntry(string Title, string Detail, string Icon, Func<Task> RunAsync)
|
||||
{
|
||||
/// <summary>The title: screen readers name a list item after its data.</summary>
|
||||
public override string ToString() => Title;
|
||||
}
|
||||
@@ -37,6 +37,9 @@ public partial class OdPopOutWindow
|
||||
/// <summary>The user closed the window, which has let go of the view: the module goes back to the main window.</summary>
|
||||
internal event EventHandler? Returned;
|
||||
|
||||
/// <summary>Ctrl+K, as in the main window: the command palette.</summary>
|
||||
internal event EventHandler? PaletteRequested;
|
||||
|
||||
/// <summary>Where the window was, out of full screen, when it let go of the view.</summary>
|
||||
internal Rect LastBounds { get; private set; }
|
||||
|
||||
@@ -113,6 +116,25 @@ public partial class OdPopOutWindow
|
||||
{
|
||||
e.Handled = true;
|
||||
SetFullscreen(on: false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Exactly Ctrl, as in the main window: AltGr arrives as Ctrl+Alt. Ctrl+W closes this window,
|
||||
// which returns the module to the main window, as the title bar's Close does.
|
||||
if (Keyboard.Modifiers != ModifierKeys.Control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Key == Key.K)
|
||||
{
|
||||
e.Handled = true;
|
||||
PaletteRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
else if (e.Key == Key.W)
|
||||
{
|
||||
e.Handled = true;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>A command the palette offers that the main window carries out.</summary>
|
||||
public enum OdShellCommand
|
||||
{
|
||||
/// <summary>Check for updates, on Settings → About.</summary>
|
||||
CheckForUpdates,
|
||||
|
||||
/// <summary>Open the bug report form.</summary>
|
||||
ReportBug,
|
||||
|
||||
/// <summary>Open the data folder in File Explorer.</summary>
|
||||
OpenDataFolder,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>Which <see cref="OdShellCommand"/> the palette ran.</summary>
|
||||
public sealed class OdShellCommandEventArgs(OdShellCommand command) : EventArgs
|
||||
{
|
||||
public OdShellCommand Command { get; } = command;
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
|
||||
private readonly List<OdModuleItemViewModel> _openOrder = [];
|
||||
private IReadOnlyList<string> _pinned = [];
|
||||
private string _sidebarShape = "";
|
||||
private bool _windowAway;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _currentTarget = LibraryTarget;
|
||||
@@ -58,6 +59,9 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
|
||||
/// <summary>Raised when a settings tab should come to the front, such as the palette's "Running modules".</summary>
|
||||
public event EventHandler<OdSettingsSectionEventArgs>? SettingsSectionRequested;
|
||||
|
||||
/// <summary>Raised when the palette runs a command the window carries out (<see cref="OdShellCommand"/>).</summary>
|
||||
public event EventHandler<OdShellCommandEventArgs>? CommandRequested;
|
||||
|
||||
/// <summary>A module moved into a window of its own, which shows <see cref="OdPopOutEventArgs.View"/>.</summary>
|
||||
public event EventHandler<OdPopOutEventArgs>? PopOutOpened;
|
||||
|
||||
@@ -146,16 +150,49 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The palette's entries in the current language: every module, then the shell commands.</summary>
|
||||
/// <summary>
|
||||
/// The main window was minimized or hidden in the tray (<paramref name="away"/>), or is back. Away,
|
||||
/// its module goes down the ladder like any hidden one; back, it is active again. The stage keeps its
|
||||
/// view meanwhile, so a full screen and the page stay as they were; a module hibernated while away
|
||||
/// comes back with a new view.
|
||||
/// </summary>
|
||||
public async Task SetWindowAwayAsync(bool away)
|
||||
{
|
||||
if (away == _windowAway)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_windowAway = away;
|
||||
if (await _host.SetMainWindowAwayAsync(away) is { } view)
|
||||
{
|
||||
CurrentView = view;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The palette's entries in the current language (docs/SPEC.md §2): every module, the library and
|
||||
/// each settings tab, then the shell's commands.
|
||||
/// </summary>
|
||||
public IReadOnlyList<OdPaletteEntry> PaletteEntries()
|
||||
{
|
||||
var command = OdLocalization.Get("Shell_PaletteCommand");
|
||||
var settings = OdLocalization.Get("Settings_Title");
|
||||
return
|
||||
[
|
||||
.. Library.Select(item => new OdPaletteEntry(item.Title, item.Category, item.Info.Icon, () => NavigateAsync(item.Id))),
|
||||
new(OdLocalization.Get("Shell_LibraryTitle"), command, "Apps24", () => NavigateAsync(LibraryTarget)),
|
||||
new(OdLocalization.Get("Settings_Title"), command, "Settings24", () => NavigateAsync(SettingsTarget)),
|
||||
new(settings, command, "Settings24", () => NavigateAsync(SettingsTarget)),
|
||||
new(OdLocalization.Get("Settings_General"), settings, "Options24", () => ShowSettingsAsync(OdSettingsSection.General)),
|
||||
new(OdLocalization.Get("Settings_Appearance"), settings, "PaintBrush24", () => ShowSettingsAsync(OdSettingsSection.Appearance)),
|
||||
new(OdLocalization.Get("Settings_Memory"), settings, "DataUsage24", () => ShowSettingsAsync(OdSettingsSection.Memory)),
|
||||
new(OdLocalization.Get("Settings_WebApps"), settings, "Globe24", () => ShowSettingsAsync(OdSettingsSection.WebApps)),
|
||||
new(OdLocalization.Get("Settings_Data"), settings, "Database24", () => ShowSettingsAsync(OdSettingsSection.Data)),
|
||||
new(OdLocalization.Get("Settings_About"), settings, "Info24", () => ShowSettingsAsync(OdSettingsSection.About)),
|
||||
new(OdLocalization.Get("Memory_Title"), command, "DataUsage24", () => ShowSettingsAsync(OdSettingsSection.Memory)),
|
||||
new(OdLocalization.Get("About_CheckUpdates"), command, "ArrowSync24", CheckForUpdatesAsync),
|
||||
new(OdLocalization.Get("About_ReportBug"), command, "Bug24", () => RunAsync(OdShellCommand.ReportBug)),
|
||||
new(OdLocalization.Get("Shell_OpenDataFolder"), command, "FolderOpen24", () => RunAsync(OdShellCommand.OpenDataFolder)),
|
||||
new(OdLocalization.Get("Shell_Quit"), command, "Power24", QuitAsync),
|
||||
];
|
||||
}
|
||||
@@ -222,6 +259,19 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
|
||||
: [.. s.PinnedModules, item.Id],
|
||||
});
|
||||
|
||||
/// <summary>Settings → About, where the check runs and says what it found.</summary>
|
||||
private async Task CheckForUpdatesAsync()
|
||||
{
|
||||
await ShowSettingsAsync(OdSettingsSection.About);
|
||||
await RunAsync(OdShellCommand.CheckForUpdates);
|
||||
}
|
||||
|
||||
private Task RunAsync(OdShellCommand command)
|
||||
{
|
||||
CommandRequested?.Invoke(this, new OdShellCommandEventArgs(command));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task ShowSettingsAsync(OdSettingsSection section)
|
||||
{
|
||||
SettingsSectionRequested?.Invoke(this, new OdSettingsSectionEventArgs(section));
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace OmniDeck.App.Theming;
|
||||
|
||||
/// <summary>
|
||||
/// Gives an element a preset layer of its own, so what it holds renders with that preset's tokens
|
||||
/// whatever the window's preset: onboarding's preset cards are live previews (docs/UI-MODES.md §5).
|
||||
/// </summary>
|
||||
public static class OdPresetPreview
|
||||
{
|
||||
public static readonly DependencyProperty LayerProperty = DependencyProperty.RegisterAttached(
|
||||
"Layer",
|
||||
typeof(ResourceDictionary),
|
||||
typeof(OdPresetPreview),
|
||||
new PropertyMetadata(null, OnLayerChanged));
|
||||
|
||||
public static ResourceDictionary? GetLayer(DependencyObject element)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(element);
|
||||
return (ResourceDictionary?)element.GetValue(LayerProperty);
|
||||
}
|
||||
|
||||
public static void SetLayer(DependencyObject element, ResourceDictionary? value)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(element);
|
||||
element.SetValue(LayerProperty, value);
|
||||
}
|
||||
|
||||
private static void OnLayerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
// DynamicResource looks in an element's own resources first, so the element and everything in
|
||||
// it, stock controls' templates included, find the preview's tokens before the window's.
|
||||
if (d is FrameworkElement element)
|
||||
{
|
||||
element.Resources = e.NewValue as ResourceDictionary ?? new ResourceDictionary();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,4 +21,43 @@
|
||||
<Style BasedOn="{StaticResource DefaultUiCardControlStyle}" TargetType="{x:Type ui:CardControl}">
|
||||
<Setter Property="Padding" Value="{DynamicResource Od.Padding.Card}" />
|
||||
</Style>
|
||||
<!-- The preset's minimum hit target (docs/UI-MODES.md §2) on the other controls people click or tap. -->
|
||||
<Style BasedOn="{StaticResource DefaultCheckBoxStyle}" TargetType="{x:Type CheckBox}">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource Od.HitTarget.Min}" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource DefaultRadioButtonStyle}" TargetType="{x:Type RadioButton}">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource Od.HitTarget.Min}" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource DefaultComboBoxStyle}" TargetType="{x:Type ComboBox}">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource Od.HitTarget.Min}" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource DefaultListBoxItemStyle}" TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource Od.HitTarget.Min}" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource DefaultUiToggleSwitchStyle}" TargetType="{x:Type ui:ToggleSwitch}">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource Od.HitTarget.Min}" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource UiMenuItem}" TargetType="{x:Type MenuItem}">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource Od.HitTarget.Min}" />
|
||||
</Style>
|
||||
<!--
|
||||
A preset card's hint: secondary text, but the selected card's own text color once the card is
|
||||
filled with the accent, where secondary text would fall short of AA.
|
||||
-->
|
||||
<Style x:Key="PresetHint" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" Value="True">
|
||||
<Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ListBoxItem}}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<!-- WPF-UI sets lists at 14 px and tooltips at 12 px whatever the preset; these follow its text sizes. -->
|
||||
<Style BasedOn="{StaticResource DefaultListBoxStyle}" TargetType="{x:Type ListBox}">
|
||||
<Setter Property="FontSize" Value="{DynamicResource Od.Font.Base}" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource DefaultToolTipStyle}" TargetType="{x:Type ToolTip}">
|
||||
<Setter Property="FontSize" Value="{DynamicResource Od.Font.Caption}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -61,6 +61,17 @@ public sealed class OdThemeEngine : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The preset layer <paramref name="preset"/> would have now, at the Windows text size, the user's
|
||||
/// font scale and the current theme, for a card that previews it (docs/UI-MODES.md §5).
|
||||
/// </summary>
|
||||
public ResourceDictionary Preview(OdPreset preset)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(preset);
|
||||
var tokens = OdTokens.Compute(preset, _textScale, _settings.Current.FontScale, motionEnabled: false);
|
||||
return OdThemeResources.Build(tokens, Variant());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Records Windows' look as it is <paramref name="now"/>; true when it differs from the look the
|
||||
/// theme was last applied for.
|
||||
@@ -95,7 +106,7 @@ public sealed class OdThemeEngine : IDisposable
|
||||
_textScale,
|
||||
settings.FontScale,
|
||||
settings.MotionEnabled && SystemParameters.ClientAreaAnimation);
|
||||
OdThemeResources.Apply(_app.Resources, OdThemeResources.Build(Current));
|
||||
OdThemeResources.Apply(_app.Resources, OdThemeResources.Build(Current, Variant()));
|
||||
_log.Debug("Preset {Preset} applied (text scale {TextScale}, font scale {FontScale})", Current.PresetName, _textScale, settings.FontScale);
|
||||
Applied?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
@@ -122,6 +133,16 @@ public sealed class OdThemeEngine : IDisposable
|
||||
return (followSystem, theme, accent);
|
||||
}
|
||||
|
||||
/// <summary>The palette the window shows now: the preset's text palette applies to Light and Dark only.</summary>
|
||||
private static OdThemeVariant Variant() => SystemParameters.HighContrast
|
||||
? OdThemeVariant.HighContrast
|
||||
: ApplicationThemeManager.GetAppTheme() switch
|
||||
{
|
||||
ApplicationTheme.Dark => OdThemeVariant.Dark,
|
||||
ApplicationTheme.HighContrast => OdThemeVariant.HighContrast,
|
||||
_ => OdThemeVariant.Light,
|
||||
};
|
||||
|
||||
private static ApplicationTheme SystemAppTheme()
|
||||
{
|
||||
SystemThemeManager.UpdateSystemThemeCache();
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using OmniDeck.Core.Theming;
|
||||
|
||||
namespace OmniDeck.App.Theming;
|
||||
|
||||
/// <summary>
|
||||
/// Turns resolved tokens into the preset layer: one <see cref="ResourceDictionary"/> merged after
|
||||
/// WPF-UI's dictionaries and replaced in place when the preset, the user's overrides or the Windows
|
||||
/// text size change (docs/spikes/05-theme-swap.md).
|
||||
/// WPF-UI's dictionaries and replaced in place when the preset, the user's overrides, the Windows text
|
||||
/// size or the theme change (docs/spikes/05-theme-swap.md). On the light and dark themes it also carries
|
||||
/// the preset's text palette (<see cref="OdPalette"/>); in High Contrast, Windows' colors stay.
|
||||
/// </summary>
|
||||
internal static class OdThemeResources
|
||||
{
|
||||
public static ResourceDictionary Build(OdTokens tokens)
|
||||
public static ResourceDictionary Build(OdTokens tokens, OdThemeVariant variant)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(tokens);
|
||||
var d = tokens.Density;
|
||||
var controlPadding = new Thickness(d * 2, d, d * 2, d);
|
||||
return new ResourceDictionary
|
||||
var layer = new ResourceDictionary
|
||||
{
|
||||
[OdTokenKeys.PresetMarker] = tokens.PresetName,
|
||||
[OdTokenKeys.FontBase] = tokens.FontBase,
|
||||
@@ -27,12 +29,22 @@ internal static class OdThemeResources
|
||||
[OdTokenKeys.PaddingCard] = new Thickness(d * 3),
|
||||
[OdTokenKeys.MarginItem] = new Thickness(0, 0, 0, d * 2),
|
||||
[OdTokenKeys.MarginTile] = new Thickness(0, 0, d * 2, d * 2),
|
||||
[OdTokenKeys.MarginLeading] = new Thickness(d * 2, 0, 0, 0),
|
||||
[OdTokenKeys.MarginInline] = new Thickness(0, 0, d * 2, 0),
|
||||
[OdTokenKeys.MarginTight] = new Thickness(d / 2),
|
||||
[OdTokenKeys.HitTargetMin] = tokens.HitTargetMin,
|
||||
[OdTokenKeys.CornerRadius] = new CornerRadius(tokens.CornerRadius),
|
||||
[OdTokenKeys.MotionDuration] = new Duration(TimeSpan.FromMilliseconds(tokens.MotionMilliseconds)),
|
||||
[OdTokenKeys.ChartLineWeight] = tokens.ChartLineWeight,
|
||||
[OdTokenKeys.NavMaxVisibleItems] = tokens.NavMaxVisibleItems,
|
||||
[OdTokenKeys.NavShowLabels] = tokens.NavShowLabels,
|
||||
[OdTokenKeys.NavIconSize] = tokens.NavIconSize,
|
||||
[OdTokenKeys.ContrastTarget] = tokens.ContrastTarget,
|
||||
[OdTokenKeys.DimOpacity] = variant == OdThemeVariant.HighContrast ? 1.0 : 0.7,
|
||||
[OdTokenKeys.WidthTile] = tokens.TileWidth,
|
||||
[OdTokenKeys.WidthTileWide] = tokens.WideTileWidth,
|
||||
[OdTokenKeys.WidthField] = tokens.FieldWidth,
|
||||
[OdTokenKeys.WidthReadable] = tokens.ReadableWidth,
|
||||
|
||||
// Deliberate WPF-UI overrides (docs/WPFUI-CONVENTIONS.md §6): WPF-UI 4.3 templates read these
|
||||
// keys through DynamicResource, so stock controls follow the preset without a style of ours.
|
||||
@@ -41,6 +53,22 @@ internal static class OdThemeResources
|
||||
["TextControlThemePadding"] = controlPadding,
|
||||
["TextControlThemeMinHeight"] = tokens.HitTargetMin,
|
||||
};
|
||||
|
||||
// WPF-UI's text brushes take their colors through StaticResource, so the brushes themselves are replaced.
|
||||
if (OdPalette.For(OdPreset.FromName(tokens.PresetName), variant) is { } palette)
|
||||
{
|
||||
layer["TextFillColorSecondaryBrush"] = Brush(palette.TextSecondary);
|
||||
layer["TextFillColorTertiaryBrush"] = Brush(palette.TextTertiary);
|
||||
}
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
private static SolidColorBrush Brush(uint argb)
|
||||
{
|
||||
var brush = new SolidColorBrush(Color.FromArgb((byte)(argb >> 24), (byte)(argb >> 16), (byte)(argb >> 8), (byte)argb));
|
||||
brush.Freeze();
|
||||
return brush;
|
||||
}
|
||||
|
||||
/// <summary>Puts <paramref name="preset"/> in place of the current preset layer, or adds it last.</summary>
|
||||
|
||||
@@ -1,38 +1,50 @@
|
||||
using OmniDeck.Core;
|
||||
using OmniDeck.Core.Settings;
|
||||
using Velopack;
|
||||
using Velopack.Sources;
|
||||
|
||||
namespace OmniDeck.App.Updates;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="IOdUpdateService"/> over Velopack and this repository's GitHub releases. Every version
|
||||
/// below 1.0.0 is a pre-release, so pre-releases are included. Per-user install: no UAC.
|
||||
/// <see cref="IOdUpdateService"/> over Velopack and this repository's GitHub releases. Each check asks
|
||||
/// the channel in use (<see cref="OdUpdateChannel"/>): with pre-releases while the user wants them or a
|
||||
/// pre-release build runs, stable releases only otherwise. Per-user install: no UAC.
|
||||
/// </summary>
|
||||
public sealed class OdVelopackUpdateService : IOdUpdateService
|
||||
public sealed class OdVelopackUpdateService(IOdSettingsService settings) : IOdUpdateService
|
||||
{
|
||||
private const string Repository = "https://github.com/poli0981/OmniDeck";
|
||||
|
||||
private readonly Lazy<UpdateManager> _manager = new(() => new UpdateManager(new GithubSource(Repository, accessToken: null, prerelease: true)));
|
||||
private UpdateInfo? _pending;
|
||||
private static readonly string Running = OdVersionInfo.FromAssembly(typeof(OdVelopackUpdateService).Assembly).Version;
|
||||
|
||||
public bool IsInstalled => _manager.Value.IsInstalled;
|
||||
private readonly Lazy<UpdateManager> _installed = new(() => Manager(prereleases: true));
|
||||
|
||||
// The manager that found the pending update downloads and applies it, whatever the channel is by then.
|
||||
private (UpdateManager Manager, UpdateInfo Update)? _pending;
|
||||
|
||||
public bool IsInstalled => _installed.Value.IsInstalled;
|
||||
|
||||
public async Task<string?> CheckAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var manager = Manager(OdUpdateChannel.IncludesPrereleases(settings.Current.Prereleases, Running));
|
||||
|
||||
// CheckForUpdatesAsync takes no token; waiting on it through Task.Run makes the wait cancellable.
|
||||
_pending = await Task.Run(() => _manager.Value.CheckForUpdatesAsync(), cancellationToken);
|
||||
return _pending?.TargetFullRelease.Version.ToString();
|
||||
var update = await Task.Run(() => manager.CheckForUpdatesAsync(), cancellationToken);
|
||||
_pending = update is null ? null : (manager, update);
|
||||
return update?.TargetFullRelease.Version.ToString();
|
||||
}
|
||||
|
||||
public Task DownloadAsync(IProgress<int> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(progress);
|
||||
var pending = _pending ?? throw new InvalidOperationException("Check for updates first.");
|
||||
return _manager.Value.DownloadUpdatesAsync(pending, progress.Report, cancelToken: cancellationToken);
|
||||
var (manager, update) = _pending ?? throw new InvalidOperationException("Check for updates first.");
|
||||
return manager.DownloadUpdatesAsync(update, progress.Report, cancelToken: cancellationToken);
|
||||
}
|
||||
|
||||
public void ApplyAndRestart()
|
||||
{
|
||||
var pending = _pending ?? throw new InvalidOperationException("Check for updates first.");
|
||||
_manager.Value.ApplyUpdatesAndRestart(pending.TargetFullRelease);
|
||||
var (manager, update) = _pending ?? throw new InvalidOperationException("Check for updates first.");
|
||||
manager.ApplyUpdatesAndRestart(update.TargetFullRelease);
|
||||
}
|
||||
|
||||
private static UpdateManager Manager(bool prereleases) => new(new GithubSource(Repository, accessToken: null, prerelease: prereleases));
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace OmniDeck.Core.Accessibility;
|
||||
|
||||
/// <summary>
|
||||
/// A status line that screen readers read out whenever its text changes once shown: a live region,
|
||||
/// polite unless <see cref="AutomationProperties.LiveSettingProperty"/> says otherwise. WPF knows the
|
||||
/// setting, but makes a change heard only when the element raises the event, which a TextBlock never does.
|
||||
/// </summary>
|
||||
public sealed class OdStatusText : TextBlock
|
||||
{
|
||||
static OdStatusText()
|
||||
{
|
||||
AutomationProperties.LiveSettingProperty.OverrideMetadata(typeof(OdStatusText), new FrameworkPropertyMetadata(AutomationLiveSetting.Polite));
|
||||
|
||||
// Added to TextBlock's own callback, which still runs first.
|
||||
TextProperty.OverrideMetadata(typeof(OdStatusText), new FrameworkPropertyMetadata(OnTextChanged));
|
||||
}
|
||||
|
||||
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is OdStatusText { IsLoaded: true } status && e.NewValue is string { Length: > 0 }
|
||||
&& AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged)
|
||||
&& UIElementAutomationPeer.CreatePeerForElement(status) is { } peer)
|
||||
{
|
||||
peer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,12 @@ public sealed class OdRamGovernor : IDisposable
|
||||
var demoted = false;
|
||||
foreach (var hosted in Demotable().Where(hosted => !StaysResident(hosted)))
|
||||
{
|
||||
// A player that plays is in use even though hidden: its hidden time starts when it stops.
|
||||
if (await _host.IsPinnedAsync(hosted.Info.Id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var hiddenFor = now - hosted.LastActive;
|
||||
if (hiddenFor >= options.HibernateAfter)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace OmniDeck.Core.Legal;
|
||||
public static class OdLegal
|
||||
{
|
||||
/// <summary>The version every document in docs/legal carries; a test keeps the two in step.</summary>
|
||||
public const string Version = "1.1";
|
||||
public const string Version = "1.2";
|
||||
|
||||
/// <summary>The documents the legal gate shows, in order.</summary>
|
||||
public static IReadOnlyList<OdLegalDocument> Documents { get; } =
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace OmniDeck.Core.Localization;
|
||||
|
||||
/// <summary>The languages OmniDeck has strings for, by culture name, English (the neutral strings) first.</summary>
|
||||
public static class OdLanguages
|
||||
{
|
||||
public static IReadOnlyList<string> Shipped { get; } = ["en", "vi", "ja"];
|
||||
|
||||
/// <summary>A language's name in that language, as language lists show it: English, Tiếng Việt, 日本語.</summary>
|
||||
public static string NativeName(string name)
|
||||
{
|
||||
var culture = CultureInfo.GetCultureInfo(name);
|
||||
var native = culture.NativeName;
|
||||
return native.Length == 0 ? name : culture.TextInfo.ToUpper(native[0]) + native[1..];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace OmniDeck.Core.Localization;
|
||||
|
||||
/// <summary>
|
||||
/// <c>{res:OdLocRow Key, Path=Title}</c>: a control's label with the name of its row, such as
|
||||
/// "Remove, Tokyo", for lists whose rows all have the same buttons. Screen readers then tell the rows'
|
||||
/// buttons apart; the label comes first, as on screen. Both follow the UI language and the row live.
|
||||
/// A label the row itself provides, such as Start or Pause, is <c>{res:OdLocRow LabelPath=…, Path=…}</c>.
|
||||
/// </summary>
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public sealed class OdLocRowExtension : MarkupExtension
|
||||
{
|
||||
private static readonly IMultiValueConverter Joiner = new RowNameConverter();
|
||||
|
||||
public OdLocRowExtension()
|
||||
{
|
||||
}
|
||||
|
||||
public OdLocRowExtension(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
|
||||
[ConstructorArgument("key")]
|
||||
public string Key { get; set; } = "";
|
||||
|
||||
/// <summary>The path to the row's name, from the row's data context.</summary>
|
||||
public string Path { get; set; } = "";
|
||||
|
||||
/// <summary>The path to the label, when the row provides it instead of a key.</summary>
|
||||
public string LabelPath { get; set; } = "";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
var binding = new MultiBinding { Converter = Joiner, Mode = BindingMode.OneWay };
|
||||
binding.Bindings.Add(Localized("A11y_RowAction"));
|
||||
binding.Bindings.Add(LabelPath.Length > 0 ? new Binding(LabelPath) { Mode = BindingMode.OneWay } : Localized(Key));
|
||||
binding.Bindings.Add(new Binding(Path) { Mode = BindingMode.OneWay });
|
||||
return binding.ProvideValue(serviceProvider);
|
||||
}
|
||||
|
||||
private static Binding Localized(string key) => new($"[{key}]") { Source = OdLocalization.Instance, Mode = BindingMode.OneWay };
|
||||
|
||||
private sealed class RowNameConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) => values switch
|
||||
{
|
||||
[string format, string label, var row] when row is not null && !string.IsNullOrEmpty(row.ToString()) =>
|
||||
string.Format(CultureInfo.CurrentCulture, format, label, row),
|
||||
[_, string label, ..] => label,
|
||||
_ => DependencyProperty.UnsetValue,
|
||||
};
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Windows;
|
||||
using System.Windows.Markup;
|
||||
using Serilog;
|
||||
|
||||
namespace OmniDeck.Core.Localization;
|
||||
|
||||
@@ -14,6 +16,8 @@ namespace OmniDeck.Core.Localization;
|
||||
/// </summary>
|
||||
public sealed class OdLocalization : INotifyPropertyChanged
|
||||
{
|
||||
// What FollowCulture registered: each target held weakly, with the method to call on it.
|
||||
private readonly List<(WeakReference Target, MethodInfo Method)> _followers = [];
|
||||
private ResourceManager[] _resources = [];
|
||||
|
||||
private OdLocalization()
|
||||
@@ -39,6 +43,38 @@ public sealed class OdLocalization : INotifyPropertyChanged
|
||||
|
||||
public static string Get(string key) => Instance[key];
|
||||
|
||||
/// <summary>
|
||||
/// Calls <paramref name="handler"/> after each change of language, holding its target weakly, so a
|
||||
/// view model that outlives no one needs no unsubscribing. <paramref name="handler"/> must be a
|
||||
/// method of that view model: nothing else would keep a lambda's closure alive. A view model that
|
||||
/// lets go of what its texts come from, when it is disposed, calls <see cref="UnfollowCulture"/>.
|
||||
/// One follower that fails keeps its old texts; the others still follow.
|
||||
/// </summary>
|
||||
public static void FollowCulture(EventHandler<EventArgs> handler)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(handler);
|
||||
if (handler.Target is null)
|
||||
{
|
||||
throw new ArgumentException("Only an instance method can follow the culture: it is held by its target.", nameof(handler));
|
||||
}
|
||||
|
||||
lock (Instance._followers)
|
||||
{
|
||||
Instance._followers.Add((new WeakReference(handler.Target), handler.Method));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stops calling <paramref name="handler"/> on a change of language.</summary>
|
||||
public static void UnfollowCulture(EventHandler<EventArgs> handler)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(handler);
|
||||
lock (Instance._followers)
|
||||
{
|
||||
Instance._followers.RemoveAll(follower => !follower.Target.IsAlive
|
||||
|| (ReferenceEquals(follower.Target.Target, handler.Target) && follower.Method == handler.Method));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Fills a format string; numbers and dates follow the regional format, not the UI language.</summary>
|
||||
public static string Format(string key, params object?[] args) =>
|
||||
string.Format(CultureInfo.CurrentCulture, Instance[key], args);
|
||||
@@ -92,6 +128,7 @@ public sealed class OdLocalization : INotifyPropertyChanged
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Item[]"));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Culture)));
|
||||
CultureChanged?.Invoke(this, EventArgs.Empty);
|
||||
NotifyFollowers();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -113,6 +150,35 @@ public sealed class OdLocalization : INotifyPropertyChanged
|
||||
TagOpenWindows();
|
||||
}
|
||||
|
||||
// Each follower is called on its own: one that throws (a view model whose database is gone, say)
|
||||
// is logged and skipped, and the others still read their texts again.
|
||||
private void NotifyFollowers()
|
||||
{
|
||||
(object? Target, MethodInfo Method)[] followers;
|
||||
lock (_followers)
|
||||
{
|
||||
_followers.RemoveAll(follower => !follower.Target.IsAlive);
|
||||
followers = [.. _followers.Select(follower => (follower.Target.Target, follower.Method))];
|
||||
}
|
||||
|
||||
foreach (var (target, method) in followers)
|
||||
{
|
||||
if (target is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
method.Invoke(target, [this, EventArgs.Empty]);
|
||||
}
|
||||
catch (TargetInvocationException ex)
|
||||
{
|
||||
Log.ForContext<OdLocalization>().Warning(ex, "{Follower} could not follow the change of language", target.GetType().Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TagOpenWindows()
|
||||
{
|
||||
if (Application.Current is not { } app)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace OmniDeck.Core.Localization;
|
||||
|
||||
/// <summary>
|
||||
/// An entry of a list whose label follows the UI language in place (<see cref="RefreshLabel"/>): the
|
||||
/// selection bound to the list stays when the language changes, which a rebuilt list would clear.
|
||||
/// </summary>
|
||||
public abstract class OdLocalizedOption(Func<string> label) : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public string Label { get; private set; } = label();
|
||||
|
||||
/// <summary>Reads the label again, after a change of language.</summary>
|
||||
public void RefreshLabel()
|
||||
{
|
||||
Label = label();
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Label)));
|
||||
}
|
||||
|
||||
/// <summary>The label: screen readers name a list item after its data.</summary>
|
||||
public override string ToString() => Label;
|
||||
}
|
||||
@@ -20,6 +20,13 @@ public interface IOdModule
|
||||
/// <summary>The module became visible.</summary>
|
||||
Task ActivateAsync();
|
||||
|
||||
/// <summary>
|
||||
/// The module left the screen (another one shows, its window went away, or its own window closed):
|
||||
/// stop what only matters on screen, such as refreshes and ticking. Its view is kept; nothing is
|
||||
/// released yet. Most modules have nothing to stop.
|
||||
/// </summary>
|
||||
Task DeactivateAsync() => Task.CompletedTask;
|
||||
|
||||
/// <summary>Returning <see langword="false"/> pins the module, for example while media plays.</summary>
|
||||
Task<bool> CanSuspendAsync();
|
||||
|
||||
|
||||
@@ -58,9 +58,15 @@ public sealed class OdModuleHost : IDisposable
|
||||
/// <summary>Every registered module, in registration order.</summary>
|
||||
public IReadOnlyList<OdHostedModule> Modules { get; }
|
||||
|
||||
/// <summary>The module visible in the main window; <see langword="null"/> while the shell shows one of its own pages.</summary>
|
||||
/// <summary>
|
||||
/// The main window's module; <see langword="null"/> while the shell shows one of its own pages. While
|
||||
/// the window is away (<see cref="IsMainWindowAway"/>) it stays here but goes down the ladder.
|
||||
/// </summary>
|
||||
public OdHostedModule? Current { get; private set; }
|
||||
|
||||
/// <summary>Whether the main window is minimized or hidden in the tray, so that nothing it holds is on screen.</summary>
|
||||
public bool IsMainWindowAway { get; private set; }
|
||||
|
||||
public OdHostedModule? Find(string moduleId) => _byId.GetValueOrDefault(moduleId);
|
||||
|
||||
/// <summary>
|
||||
@@ -81,14 +87,14 @@ public sealed class OdModuleHost : IDisposable
|
||||
throw new InvalidOperationException($"Module '{moduleId}' shows in a window of its own.");
|
||||
}
|
||||
|
||||
if (hosted == Current && hosted.View is { } shown)
|
||||
if (hosted == Current && hosted.View is { } shown && hosted.State == OdModuleState.Active)
|
||||
{
|
||||
return shown;
|
||||
}
|
||||
|
||||
var view = await EnsureViewAsync(hosted);
|
||||
await hosted.Module.ActivateAsync();
|
||||
HideCurrent();
|
||||
await HideCurrentAsync();
|
||||
Current = hosted;
|
||||
hosted.LastActive = _time.GetUtcNow();
|
||||
SetState(hosted, OdModuleState.Active);
|
||||
@@ -147,8 +153,77 @@ public sealed class OdModuleHost : IDisposable
|
||||
}
|
||||
|
||||
hosted.IsPoppedOut = false;
|
||||
await IdleAsync(hosted);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_gate.Release();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main window went away (minimized, or hidden in the tray) or came back. Away, its module is
|
||||
/// hidden like any other and goes down the ladder (docs/RAM-GOVERNOR.md §1), yet stays
|
||||
/// <see cref="Current"/>. Back, that module is active again, with a new view if it was hibernated
|
||||
/// meanwhile; the view to show is returned, or <see langword="null"/> when the window shows a shell page
|
||||
/// or is away. Calls that overtake each other settle on the latest one.
|
||||
/// </summary>
|
||||
public async Task<FrameworkElement?> SetMainWindowAwayAsync(bool away)
|
||||
{
|
||||
IsMainWindowAway = away;
|
||||
await _gate.WaitAsync();
|
||||
try
|
||||
{
|
||||
if (Current is not { } current)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (IsMainWindowAway)
|
||||
{
|
||||
if (current.State == OdModuleState.Active)
|
||||
{
|
||||
await IdleAsync(current);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (current.State == OdModuleState.Active && current.View is { } shown)
|
||||
{
|
||||
return shown;
|
||||
}
|
||||
|
||||
var view = await EnsureViewAsync(current);
|
||||
await current.Module.ActivateAsync();
|
||||
current.LastActive = _time.GetUtcNow();
|
||||
SetState(current, OdModuleState.Active);
|
||||
return view;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_gate.Release();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether a hidden module refuses to be suspended right now, as a player does while it plays. Time
|
||||
/// spent so pinned is not time hidden: its hidden time restarts, so the ladder counts from the moment
|
||||
/// the pin ends (docs/RAM-GOVERNOR.md §3).
|
||||
/// </summary>
|
||||
public async Task<bool> IsPinnedAsync(string moduleId)
|
||||
{
|
||||
var hosted = Get(moduleId);
|
||||
await _gate.WaitAsync();
|
||||
try
|
||||
{
|
||||
if (hosted.State is not (OdModuleState.Idle or OdModuleState.Suspended) || await hosted.Module.CanSuspendAsync())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
hosted.LastActive = _time.GetUtcNow();
|
||||
SetState(hosted, OdModuleState.Idle);
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -162,7 +237,7 @@ public sealed class OdModuleHost : IDisposable
|
||||
await _gate.WaitAsync();
|
||||
try
|
||||
{
|
||||
HideCurrent();
|
||||
await HideCurrentAsync();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -301,7 +376,7 @@ public sealed class OdModuleHost : IDisposable
|
||||
_http,
|
||||
_database);
|
||||
|
||||
private void HideCurrent()
|
||||
private async Task HideCurrentAsync()
|
||||
{
|
||||
if (Current is not { } previous)
|
||||
{
|
||||
@@ -309,8 +384,31 @@ public sealed class OdModuleHost : IDisposable
|
||||
}
|
||||
|
||||
Current = null;
|
||||
previous.LastActive = _time.GetUtcNow();
|
||||
SetState(previous, OdModuleState.Idle);
|
||||
|
||||
// One the window already hid while it was away keeps its place on the ladder.
|
||||
if (previous.State == OdModuleState.Active)
|
||||
{
|
||||
await IdleAsync(previous);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A module that was on screen goes Idle and down the ladder, after it is told to stop what only
|
||||
/// matters on screen. One that fails to stop is logged, and hidden all the same.
|
||||
/// </summary>
|
||||
private async Task IdleAsync(OdHostedModule hosted)
|
||||
{
|
||||
try
|
||||
{
|
||||
await hosted.Module.DeactivateAsync();
|
||||
}
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
_log.Warning(ex, "Module {ModuleId} failed to deactivate", hosted.Info.Id);
|
||||
}
|
||||
|
||||
hosted.LastActive = _time.GetUtcNow();
|
||||
SetState(hosted, OdModuleState.Idle);
|
||||
}
|
||||
|
||||
private void SetState(OdHostedModule hosted, OdModuleState state)
|
||||
|
||||
@@ -3,6 +3,7 @@ using OmniDeck.Core.Governor;
|
||||
using OmniDeck.Core.Legal;
|
||||
using OmniDeck.Core.Modules;
|
||||
using OmniDeck.Core.Net;
|
||||
using OmniDeck.Core.Security;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
|
||||
@@ -21,6 +22,7 @@ public static class OdCoreServiceCollectionExtensions
|
||||
services.AddSingleton<OdDatabase>();
|
||||
services.AddSingleton<IOdAppMeta, OdAppMeta>();
|
||||
services.AddSingleton<OdLegalGate>();
|
||||
services.AddSingleton<IOdSecretStore, OdDpapiSecretStore>();
|
||||
services.AddSingleton(_ => OdHttp.Create(OdVersionInfo.FromAssembly(typeof(OdHttp).Assembly)));
|
||||
|
||||
// Modules register as IOdModule; the app supplies IOdNotifier (the tray).
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace OmniDeck.Core.Reports;
|
||||
/// <summary>
|
||||
/// Takes what could identify the user out of text before it goes into a bug report
|
||||
/// (docs/legal/PRIVACY.md §3): the user's profile folder, query strings and fragments of URLs, cookie
|
||||
/// values, token-shaped values (bearer tokens, JWTs, long hex or base64 runs), email addresses, and
|
||||
/// values, token-shaped values (bearer and API keys, JWTs, long hex or base64 runs), email addresses, and
|
||||
/// numeric ids of 15 digits or more, such as Discord's (docs/spikes/04-cdp-console.md).
|
||||
/// </summary>
|
||||
public static partial class OdScrubber
|
||||
@@ -39,7 +39,8 @@ public static partial class OdScrubber
|
||||
[GeneratedRegex(@"(?<name>\b(?:set-)?cookie\s*[:=]\s*)[^\r\n]+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
|
||||
private static partial Regex Cookie();
|
||||
|
||||
[GeneratedRegex(@"(?<scheme>\bbearer)\s+[a-z0-9\-._~+/]+=*", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
|
||||
// Authorization values: bearer tokens, and the "apikey" scheme Twelve Data takes.
|
||||
[GeneratedRegex(@"(?<scheme>\b(?:bearer|apikey))\s+[a-z0-9\-._~+/]+=*", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
|
||||
private static partial Regex Bearer();
|
||||
|
||||
[GeneratedRegex(@"\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*", RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace OmniDeck.Core.Search;
|
||||
|
||||
/// <summary>
|
||||
/// The command palette's matcher (docs/SPEC.md §2): every query character must appear in order;
|
||||
/// matches at the start, after a word break and in a row score higher, so "cal" ranks
|
||||
/// "Calculator" and "Calendar" above "Local time".
|
||||
/// "Calculator" and "Calendar" above "Local time". Accents on Latin letters do not count, so
|
||||
/// "thoi tiet" finds "Thời tiết" and "d" finds "đ".
|
||||
/// </summary>
|
||||
public static class OdFuzzyMatcher
|
||||
{
|
||||
@@ -17,6 +21,9 @@ public static class OdFuzzyMatcher
|
||||
return 0;
|
||||
}
|
||||
|
||||
query = Fold(query);
|
||||
text = Fold(text);
|
||||
|
||||
var score = 0;
|
||||
var position = 0;
|
||||
var previousMatch = -2;
|
||||
@@ -52,6 +59,39 @@ public static class OdFuzzyMatcher
|
||||
.Select(x => x.item)];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <paramref name="text"/> without the accents of its Latin letters, and with đ as d. Marks on other
|
||||
/// scripts stay: a kana's dakuten makes another sound, not an accent.
|
||||
/// </summary>
|
||||
internal static string Fold(string text)
|
||||
{
|
||||
var decomposed = text.Normalize(NormalizationForm.FormD);
|
||||
var folded = new StringBuilder(decomposed.Length);
|
||||
var latin = false;
|
||||
foreach (var c in decomposed)
|
||||
{
|
||||
if (CharUnicodeInfo.GetUnicodeCategory(c) == UnicodeCategory.NonSpacingMark)
|
||||
{
|
||||
if (!latin)
|
||||
{
|
||||
folded.Append(c);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
latin = char.IsAsciiLetter(c) || c is 'đ' or 'Đ';
|
||||
folded.Append(c switch
|
||||
{
|
||||
'đ' => 'd',
|
||||
'Đ' => 'D',
|
||||
_ => c,
|
||||
});
|
||||
}
|
||||
|
||||
return folded.ToString().Normalize(NormalizationForm.FormC);
|
||||
}
|
||||
|
||||
private static int BoundaryBonus(string text, int index)
|
||||
{
|
||||
if (index == 0)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace OmniDeck.Core.Security;
|
||||
|
||||
/// <summary>
|
||||
/// Secrets the user gives OmniDeck, such as their Twelve Data key (SECURITY.md): stored encrypted
|
||||
/// for the signed-in Windows user, never in settings, exports, logs or bug reports.
|
||||
/// </summary>
|
||||
public interface IOdSecretStore
|
||||
{
|
||||
/// <summary>The secret called <paramref name="name"/>; null when there is none, or when it cannot be decrypted.</summary>
|
||||
string? Read(string name);
|
||||
|
||||
void Write(string name, string secret);
|
||||
|
||||
void Delete(string name);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using OmniDeck.Core.Storage;
|
||||
using Serilog;
|
||||
|
||||
namespace OmniDeck.Core.Security;
|
||||
|
||||
/// <summary>
|
||||
/// The secret store: one file per secret in <see cref="OdDataRoot.SecretsDirectory"/>, encrypted with
|
||||
/// DPAPI for the current Windows user (CLAUDE.md rule 4), so another account or another PC cannot read
|
||||
/// it. It is written atomically, and the plain text is wiped from memory once encrypted. A file that
|
||||
/// no longer decrypts (a profile restored on another PC, say) reads as no secret, and the user is
|
||||
/// asked again. Nothing about a secret's value is ever logged.
|
||||
/// </summary>
|
||||
public sealed class OdDpapiSecretStore(OdDataRoot dataRoot, ILogger log) : IOdSecretStore
|
||||
{
|
||||
// Ties the ciphertext to OmniDeck: another program running as the same user cannot decrypt it by
|
||||
// accident with ProtectedData alone.
|
||||
private static readonly byte[] Entropy = "OmniDeck.Secret.v1"u8.ToArray();
|
||||
|
||||
private readonly ILogger _log = log.ForContext<OdDpapiSecretStore>();
|
||||
|
||||
public string? Read(string name)
|
||||
{
|
||||
var path = PathOf(name);
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[]? plain = null;
|
||||
try
|
||||
{
|
||||
plain = ProtectedData.Unprotect(File.ReadAllBytes(path), Entropy, DataProtectionScope.CurrentUser);
|
||||
return Encoding.UTF8.GetString(plain);
|
||||
}
|
||||
catch (CryptographicException ex)
|
||||
{
|
||||
// The exception says why DPAPI refused, never anything of the secret.
|
||||
_log.Warning(ex, "The stored secret {Name} could not be decrypted; it will be asked for again", name);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (plain is not null)
|
||||
{
|
||||
CryptographicOperations.ZeroMemory(plain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Write(string name, string secret)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(secret);
|
||||
var path = PathOf(name);
|
||||
var plain = Encoding.UTF8.GetBytes(secret);
|
||||
byte[] cipher;
|
||||
try
|
||||
{
|
||||
cipher = ProtectedData.Protect(plain, Entropy, DataProtectionScope.CurrentUser);
|
||||
}
|
||||
finally
|
||||
{
|
||||
CryptographicOperations.ZeroMemory(plain);
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(dataRoot.SecretsDirectory);
|
||||
var temp = Path.Combine(dataRoot.SecretsDirectory, $".{name}.{Guid.NewGuid():N}.tmp");
|
||||
try
|
||||
{
|
||||
File.WriteAllBytes(temp, cipher);
|
||||
File.Move(temp, path, overwrite: true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(temp);
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string name) => File.Delete(PathOf(name));
|
||||
|
||||
/// <summary>The file of <paramref name="name"/>: lowercase letters, digits and dashes only, so a name never leaves the folder.</summary>
|
||||
private string PathOf(string name)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(name);
|
||||
if (!name.All(c => c is (>= 'a' and <= 'z') or (>= '0' and <= '9') or '-'))
|
||||
{
|
||||
throw new ArgumentException("A secret's name is lowercase letters, digits and dashes.", nameof(name));
|
||||
}
|
||||
|
||||
return Path.Combine(dataRoot.SecretsDirectory, name + ".bin");
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,12 @@ public sealed record OdSettings
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> PinnedModules { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Whether the update check offers pre-releases; null leaves it to the running build
|
||||
/// (<see cref="OdUpdateChannel"/>), so a beta keeps getting betas and 1.0 gets stable releases only.
|
||||
/// </summary>
|
||||
public bool? Prereleases { get; init; }
|
||||
|
||||
/// <summary>The RAM governor's thresholds and the modules it must keep running.</summary>
|
||||
public OdMemorySettings Memory { get; init; } = new();
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace OmniDeck.Core.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Which releases the update check offers (RELEASING.md): with pre-releases (alphas and betas), or only
|
||||
/// stable ones. Without a choice of the user's it follows the build that runs: a pre-release build keeps
|
||||
/// taking pre-releases, as every version below 1.0.0 is one, and a stable build takes stable ones only.
|
||||
/// </summary>
|
||||
public static class OdUpdateChannel
|
||||
{
|
||||
/// <summary>Whether updates include pre-releases, given the user's <paramref name="choice"/> and the <paramref name="runningVersion"/>.</summary>
|
||||
public static bool IncludesPrereleases(bool? choice, string runningVersion) => choice ?? IsPrerelease(runningVersion);
|
||||
|
||||
/// <summary>A version with a suffix (0.3.0-alpha.1, 1.1.0-beta.2) or below 1.0.0 is a pre-release; "unknown" is taken as one.</summary>
|
||||
public static bool IsPrerelease(string version)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(version);
|
||||
var core = version.Split('+')[0];
|
||||
if (core.Contains('-', StringComparison.Ordinal))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return !Version.TryParse(core, out var parsed) || parsed.Major < 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
-- The stocks module's last quote per listing, and its last price series per listing and range
|
||||
-- (docs/ARCHITECTURE.md §5). The watchlist itself lives in the module's settings document.
|
||||
CREATE TABLE IF NOT EXISTS stocks_quotes_cache (
|
||||
ticker TEXT NOT NULL PRIMARY KEY,
|
||||
fetched_at TEXT NOT NULL,
|
||||
payload TEXT NOT NULL
|
||||
) WITHOUT ROWID;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS stocks_series_cache (
|
||||
series_key TEXT NOT NULL PRIMARY KEY,
|
||||
fetched_at TEXT NOT NULL,
|
||||
payload TEXT NOT NULL
|
||||
) WITHOUT ROWID;
|
||||
@@ -67,6 +67,9 @@ public sealed class OdDataRoot
|
||||
|
||||
public string WebView2Directory => Path.Combine(Root, "WebView2");
|
||||
|
||||
/// <summary>Secrets the user entered (the Twelve Data key), each encrypted for this Windows user only.</summary>
|
||||
public string SecretsDirectory => Path.Combine(Root, "secrets");
|
||||
|
||||
/// <summary>The last web-app catalog fetched from the repository (docs/WEBAPP-CATALOG.md).</summary>
|
||||
public string CatalogFile => Path.Combine(Root, "catalog", "webapps.json");
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace OmniDeck.Core.Theming;
|
||||
|
||||
/// <summary>
|
||||
/// WCAG 2.x contrast (https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio): relative luminance, the ratio
|
||||
/// between two colors (1 to 21), and what a translucent color looks like over an opaque one, since
|
||||
/// WPF-UI's text brushes are black or white at partial opacity.
|
||||
/// </summary>
|
||||
public static class OdContrast
|
||||
{
|
||||
/// <summary>WCAG AA for body text.</summary>
|
||||
public const double Aa = 4.5;
|
||||
|
||||
/// <summary>WCAG AAA for body text, Comfort's target (docs/UI-MODES.md §2).</summary>
|
||||
public const double Aaa = 7.0;
|
||||
|
||||
/// <summary>What <paramref name="argb"/>, alpha included, looks like over <paramref name="background"/>.</summary>
|
||||
public static OdRgb Over(uint argb, OdRgb background)
|
||||
{
|
||||
var alpha = (argb >> 24) / 255.0;
|
||||
var color = OdRgb.FromArgb(argb);
|
||||
return new OdRgb(Blend(color.R, background.R), Blend(color.G, background.G), Blend(color.B, background.B));
|
||||
|
||||
byte Blend(byte top, byte bottom) => (byte)Math.Round((top * alpha) + (bottom * (1 - alpha)), MidpointRounding.AwayFromZero);
|
||||
}
|
||||
|
||||
public static double Luminance(OdRgb color) => (0.2126 * Linear(color.R)) + (0.7152 * Linear(color.G)) + (0.0722 * Linear(color.B));
|
||||
|
||||
public static double Ratio(OdRgb a, OdRgb b)
|
||||
{
|
||||
var first = Luminance(a);
|
||||
var second = Luminance(b);
|
||||
return (Math.Max(first, second) + 0.05) / (Math.Min(first, second) + 0.05);
|
||||
}
|
||||
|
||||
/// <summary>The contrast of the translucent <paramref name="foreground"/> over <paramref name="background"/>.</summary>
|
||||
public static double Ratio(uint foreground, OdRgb background) => Ratio(Over(foreground, background), background);
|
||||
|
||||
private static double Linear(byte channel)
|
||||
{
|
||||
var value = channel / 255.0;
|
||||
return value <= 0.04045 ? value / 12.92 : Math.Pow((value + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace OmniDeck.Core.Theming;
|
||||
|
||||
/// <summary>
|
||||
/// The text colors a preset puts over WPF-UI's (docs/UI-MODES.md §2, §6), as <c>#AARRGGBB</c>, so that
|
||||
/// secondary and tertiary text meet the preset's contrast target on every surface: AA (4.5:1) for
|
||||
/// Dynamic and Standard, AAA (7:1) for Comfort. WPF-UI 4.3's own tertiary text on the light theme is
|
||||
/// about 3.3:1. High Contrast has no palette of ours: Windows' colors rule there (§4).
|
||||
/// </summary>
|
||||
public sealed record OdPalette(uint TextSecondary, uint TextTertiary)
|
||||
{
|
||||
// WPF-UI 4.3's light and dark values, which Dynamic and Standard keep where they already pass.
|
||||
private const uint StockLightSecondary = 0x9E000000;
|
||||
private const uint StockDarkSecondary = 0xC5FFFFFF;
|
||||
private const uint StockDarkTertiary = 0x87FFFFFF;
|
||||
|
||||
/// <summary>The palette for <paramref name="preset"/> on <paramref name="variant"/>; null in High Contrast.</summary>
|
||||
public static OdPalette? For(OdPreset preset, OdThemeVariant variant)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(preset);
|
||||
var comfort = preset.ContrastTarget >= OdContrast.Aaa;
|
||||
return variant switch
|
||||
{
|
||||
OdThemeVariant.Light when comfort => new OdPalette(0xC8000000, 0xB0000000),
|
||||
OdThemeVariant.Light => new OdPalette(StockLightSecondary, 0x8F000000),
|
||||
OdThemeVariant.Dark when comfort => new OdPalette(0xE6FFFFFF, 0xB8FFFFFF),
|
||||
OdThemeVariant.Dark => new OdPalette(StockDarkSecondary, StockDarkTertiary),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -14,16 +14,18 @@ public sealed record OdPreset(
|
||||
int MotionMilliseconds,
|
||||
double ChartLineWeight,
|
||||
int NavMaxVisibleItems,
|
||||
bool NavShowLabels)
|
||||
bool NavShowLabels,
|
||||
double ContrastTarget,
|
||||
double NavIconSize)
|
||||
{
|
||||
/// <summary>Dense, vivid, animated.</summary>
|
||||
public static readonly OdPreset Dynamic = new("Dynamic", 13.5, 1.35, 4, 32, 8, 180, 1.5, 0, NavShowLabels: false);
|
||||
public static readonly OdPreset Dynamic = new("Dynamic", 13.5, 1.35, 4, 32, 8, 180, 1.5, 0, NavShowLabels: false, OdContrast.Aa, NavIconSize: 16);
|
||||
|
||||
/// <summary>The default, balanced.</summary>
|
||||
public static readonly OdPreset Standard = new("Standard", 15.5, 1.30, 6, 36, 6, 100, 2, 0, NavShowLabels: true);
|
||||
public static readonly OdPreset Standard = new("Standard", 15.5, 1.30, 6, 36, 6, 100, 2, 0, NavShowLabels: true, OdContrast.Aa, NavIconSize: 16);
|
||||
|
||||
/// <summary>Large type, calm, no motion.</summary>
|
||||
public static readonly OdPreset Comfort = new("Comfort", 19, 1.25, 10, 44, 6, 0, 3, 6, NavShowLabels: true);
|
||||
public static readonly OdPreset Comfort = new("Comfort", 19, 1.25, 10, 44, 6, 0, 3, 6, NavShowLabels: true, OdContrast.Aaa, NavIconSize: 22);
|
||||
|
||||
public static IReadOnlyList<OdPreset> All { get; } = [Dynamic, Standard, Comfort];
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OmniDeck.Core.Theming;
|
||||
|
||||
/// <summary>An opaque color, as the eye sees it on screen.</summary>
|
||||
[StructLayout(LayoutKind.Auto)]
|
||||
public readonly record struct OdRgb(byte R, byte G, byte B)
|
||||
{
|
||||
/// <summary>The color of <c>#RRGGBB</c> or <c>#AARRGGBB</c> written as a number, alpha ignored.</summary>
|
||||
public static OdRgb FromArgb(uint argb) => new((byte)(argb >> 16), (byte)(argb >> 8), (byte)argb);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace OmniDeck.Core.Theming;
|
||||
|
||||
/// <summary>Which palette the window shows: the preset's palettes cover Light and Dark; High Contrast is Windows' own.</summary>
|
||||
public enum OdThemeVariant
|
||||
{
|
||||
Light,
|
||||
Dark,
|
||||
HighContrast,
|
||||
}
|
||||
@@ -18,6 +18,15 @@ public static class OdTokenKeys
|
||||
/// <summary>The gap after a tile in a wrapping grid, such as the module library.</summary>
|
||||
public const string MarginTile = "Od.Margin.Tile";
|
||||
|
||||
/// <summary>The gap before an element in a row, such as the title bar's search box after the title.</summary>
|
||||
public const string MarginLeading = "Od.Margin.Leading";
|
||||
|
||||
/// <summary>The gap after an element in a row of text or icons.</summary>
|
||||
public const string MarginInline = "Od.Margin.Inline";
|
||||
|
||||
/// <summary>Half a density unit all round, between the keys of a keypad.</summary>
|
||||
public const string MarginTight = "Od.Margin.Tight";
|
||||
|
||||
public const string HitTargetMin = "Od.HitTarget.Min";
|
||||
public const string CornerRadius = "Od.Corner.Radius";
|
||||
public const string MotionDuration = "Od.Motion.Duration";
|
||||
@@ -25,6 +34,27 @@ public static class OdTokenKeys
|
||||
public const string NavMaxVisibleItems = "Od.Nav.MaxVisibleItems";
|
||||
public const string NavShowLabels = "Od.Nav.ShowLabels";
|
||||
|
||||
/// <summary>
|
||||
/// The opacity of what is dimmed but still in use, such as the days outside the month: 0.7 keeps
|
||||
/// primary text above 4.5:1 on the light theme, and High Contrast dims nothing.
|
||||
/// </summary>
|
||||
public const string DimOpacity = "Od.Opacity.Dim";
|
||||
|
||||
/// <summary>Widths that grow with the text (<see cref="OdTokens.TileWidth"/> and the next ones).</summary>
|
||||
public const string WidthTile = "Od.Width.Tile";
|
||||
|
||||
public const string WidthTileWide = "Od.Width.TileWide";
|
||||
|
||||
public const string WidthField = "Od.Width.Field";
|
||||
|
||||
public const string WidthReadable = "Od.Width.Readable";
|
||||
|
||||
/// <summary>The size of the sidebar's icons.</summary>
|
||||
public const string NavIconSize = "Od.Nav.IconSize";
|
||||
|
||||
/// <summary>The contrast secondary and tertiary text meet: 4.5 (AA) or 7 (AAA, Comfort).</summary>
|
||||
public const string ContrastTarget = "Od.Contrast.Target";
|
||||
|
||||
/// <summary>Marks the preset dictionary inside the merged dictionaries; its value is the preset name.</summary>
|
||||
public const string PresetMarker = "Od.Preset";
|
||||
}
|
||||
@@ -17,7 +17,9 @@ public sealed record OdTokens(
|
||||
int MotionMilliseconds,
|
||||
double ChartLineWeight,
|
||||
int NavMaxVisibleItems,
|
||||
bool NavShowLabels)
|
||||
bool NavShowLabels,
|
||||
double ContrastTarget,
|
||||
double NavIconSize)
|
||||
{
|
||||
/// <summary>The range of the user's font-size slider (docs/UI-MODES.md §3).</summary>
|
||||
public const double MinFontScale = 0.85;
|
||||
@@ -27,6 +29,18 @@ public sealed record OdTokens(
|
||||
/// <summary>Windows text size runs from 100 % to 225 %.</summary>
|
||||
public const double MaxTextScale = 2.25;
|
||||
|
||||
/// <summary>The width of a tile, such as a module in the library: it grows with the text, so its title and buttons fit.</summary>
|
||||
public double TileWidth => Pixels(FontBase * 17);
|
||||
|
||||
/// <summary>The width of a wider tile, such as a clock or a countdown.</summary>
|
||||
public double WideTileWidth => Pixels(FontBase * 20.5);
|
||||
|
||||
/// <summary>The width of a short field, such as a number box, a name or a drop-down of a few words.</summary>
|
||||
public double FieldWidth => Pixels(FontBase * 11.5);
|
||||
|
||||
/// <summary>The widest a column of text runs: about 720 px at Standard's base size.</summary>
|
||||
public double ReadableWidth => Pixels(FontBase * 46);
|
||||
|
||||
/// <summary>
|
||||
/// Applies the user's font scale and the Windows text size on top of <paramref name="preset"/>
|
||||
/// (docs/UI-MODES.md §3–4). Motion is off when the user or Windows turned it off, or the preset has none.
|
||||
@@ -47,8 +61,12 @@ public sealed record OdTokens(
|
||||
MotionMilliseconds: motionEnabled ? preset.MotionMilliseconds : 0,
|
||||
preset.ChartLineWeight,
|
||||
preset.NavMaxVisibleItems,
|
||||
preset.NavShowLabels);
|
||||
preset.NavShowLabels,
|
||||
preset.ContrastTarget,
|
||||
preset.NavIconSize);
|
||||
}
|
||||
|
||||
private static double Round(double value) => Math.Round(value, 2, MidpointRounding.AwayFromZero);
|
||||
|
||||
private static double Pixels(double value) => Math.Round(value, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
namespace OmniDeck.Modules.Calculator;
|
||||
|
||||
/// <summary>One finished calculation in the session's history.</summary>
|
||||
public sealed record OdCalcHistoryEntry(string Expression, string Result);
|
||||
public sealed record OdCalcHistoryEntry(string Expression, string Result)
|
||||
{
|
||||
/// <summary>The calculation as the history shows it, for screen readers.</summary>
|
||||
public override string ToString() => Expression + " = " + Result;
|
||||
}
|
||||
@@ -16,4 +16,6 @@ public sealed record OdCalcKey(string Label, string Token, OdCalcKeyKind Kind =
|
||||
public string AccessibleName => Name ?? Label;
|
||||
|
||||
public bool IsPrimary => Kind == OdCalcKeyKind.Evaluate;
|
||||
|
||||
public override string ToString() => AccessibleName;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<UserControl x:Class="OmniDeck.Modules.Calculator.OdCalculatorView"
|
||||
<UserControl x:Class="OmniDeck.Modules.Calculator.OdCalculatorView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:a11y="clr-namespace:OmniDeck.Core.Accessibility;assembly=OmniDeck.Core"
|
||||
xmlns:calc="clr-namespace:OmniDeck.Modules.Calculator"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
@@ -13,8 +14,10 @@
|
||||
|
||||
<!-- One template for every keypad key; the keys themselves are data (OdCalculatorViewModel). -->
|
||||
<DataTemplate x:Key="Key" DataType="{x:Type calc:OdCalcKey}">
|
||||
<!-- No padding: a key fills its cell, and its label must fit there at any text size. -->
|
||||
<ui:Button x:Name="KeyButton"
|
||||
Margin="2"
|
||||
Margin="{DynamicResource Od.Margin.Tight}"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
AutomationProperties.Name="{Binding AccessibleName}"
|
||||
@@ -42,6 +45,7 @@
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Calc_Name}" />
|
||||
@@ -69,13 +73,12 @@
|
||||
Text="{Binding Expression}"
|
||||
TextAlignment="Right"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock AutomationProperties.LiveSetting="Polite"
|
||||
FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Result}"
|
||||
TextAlignment="Right"
|
||||
TextWrapping="Wrap">
|
||||
<TextBlock.Style>
|
||||
<a11y:OdStatusText FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Result}"
|
||||
TextAlignment="Right"
|
||||
TextWrapping="Wrap">
|
||||
<a11y:OdStatusText.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasError}" Value="True">
|
||||
@@ -83,8 +86,8 @@
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</a11y:OdStatusText.Style>
|
||||
</a11y:OdStatusText>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</ui:Card>
|
||||
@@ -122,6 +125,7 @@
|
||||
Icon="{ui:SymbolIcon Delete24}"
|
||||
ToolTip="{res:OdLoc Calc_ClearHistory}" />
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Calc_History}" />
|
||||
@@ -134,6 +138,7 @@
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemsSource="{Binding History}"
|
||||
KeyDown="OnHistoryKeyDown"
|
||||
MouseDoubleClick="OnHistoryDoubleClick"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||
<ListBox.ItemTemplate>
|
||||
|
||||
@@ -85,4 +85,25 @@ public partial class OdCalculatorView
|
||||
ViewModel?.RecallCommand.Execute(entry);
|
||||
}
|
||||
}
|
||||
|
||||
// In the history, Enter brings the selected calculation back, as a double click does, and Delete
|
||||
// forgets it; neither reaches the keypad's keys.
|
||||
private void OnHistoryKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (sender is not ListBox { SelectedItem: OdCalcHistoryEntry entry } || ViewModel is not { } calculator)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
e.Handled = true;
|
||||
calculator.RecallCommand.Execute(entry);
|
||||
}
|
||||
else if (e.Key == Key.Delete)
|
||||
{
|
||||
e.Handled = true;
|
||||
calculator.ForgetCommand.Execute(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,34 +42,54 @@ public sealed partial class OdCalculatorViewModel : ObservableObject
|
||||
_save = save;
|
||||
_copy = copy;
|
||||
History.CollectionChanged += (_, _) => HistoryIsEmpty = History.Count == 0;
|
||||
StandardKeys =
|
||||
[
|
||||
new("C", "", OdCalcKeyKind.Clear, OdLocalization.Get("Calc_Clear")),
|
||||
new("⌫", "", OdCalcKeyKind.Backspace, OdLocalization.Get("Calc_Backspace")),
|
||||
new("%"), new("÷"),
|
||||
new("7"), new("8"), new("9"), new("×"),
|
||||
new("4"), new("5"), new("6"), new("−", "-"),
|
||||
new("1"), new("2"), new("3"), new("+"),
|
||||
new("±", "", OdCalcKeyKind.Negate, OdLocalization.Get("Calc_Negate")),
|
||||
new("0"), new("."),
|
||||
new("=", "", OdCalcKeyKind.Evaluate),
|
||||
];
|
||||
StandardKeys = NewStandardKeys();
|
||||
OdLocalization.FollowCulture(OnCultureChanged);
|
||||
}
|
||||
|
||||
/// <summary>This session's calculations, newest first.</summary>
|
||||
public ObservableCollection<OdCalcHistoryEntry> History { get; } = [];
|
||||
|
||||
/// <summary>The standard keypad, row by row (four keys per row).</summary>
|
||||
public IReadOnlyList<OdCalcKey> StandardKeys { get; }
|
||||
public IReadOnlyList<OdCalcKey> StandardKeys { get; private set; }
|
||||
|
||||
/// <summary>The scientific keys (five per row); functions type their "(", which the user closes.</summary>
|
||||
public IReadOnlyList<OdCalcKey> ScientificKeys { get; } =
|
||||
public IReadOnlyList<OdCalcKey> ScientificKeys { get; private set; } = NewScientificKeys();
|
||||
|
||||
// A change of language: the keys again, with their names in it.
|
||||
private void OnCultureChanged(object? sender, EventArgs e)
|
||||
{
|
||||
StandardKeys = NewStandardKeys();
|
||||
ScientificKeys = NewScientificKeys();
|
||||
OnPropertyChanged(nameof(StandardKeys));
|
||||
OnPropertyChanged(nameof(ScientificKeys));
|
||||
}
|
||||
|
||||
private static OdCalcKey[] NewStandardKeys() =>
|
||||
[
|
||||
new("sin("), new("cos("), new("tan("), new("ln("), new("log("),
|
||||
new("asin("), new("acos("), new("atan("), new("√("), new("^"),
|
||||
new("("), new(")"), new("π"), new("e"), new("!"),
|
||||
new("C", "", OdCalcKeyKind.Clear, OdLocalization.Get("Calc_Clear")),
|
||||
new("⌫", "", OdCalcKeyKind.Backspace, OdLocalization.Get("Calc_Backspace")),
|
||||
Named("%", OdLocalization.Get("Calc_Percent")), Named("÷", OdLocalization.Get("Calc_Divide")),
|
||||
new("7"), new("8"), new("9"), Named("×", OdLocalization.Get("Calc_Multiply")),
|
||||
new("4"), new("5"), new("6"), new("−", "-", OdCalcKeyKind.Input, OdLocalization.Get("Calc_Minus")),
|
||||
new("1"), new("2"), new("3"), Named("+", OdLocalization.Get("Calc_Plus")),
|
||||
new("±", "", OdCalcKeyKind.Negate, OdLocalization.Get("Calc_Negate")),
|
||||
new("0"), Named(".", OdLocalization.Get("Calc_Decimal")),
|
||||
new("=", "", OdCalcKeyKind.Evaluate, OdLocalization.Get("Calc_Equals")),
|
||||
];
|
||||
|
||||
private static OdCalcKey[] NewScientificKeys() =>
|
||||
[
|
||||
Named("sin(", OdLocalization.Get("Calc_Sine")), Named("cos(", OdLocalization.Get("Calc_Cosine")), Named("tan(", OdLocalization.Get("Calc_Tangent")),
|
||||
Named("ln(", OdLocalization.Get("Calc_NaturalLog")), Named("log(", OdLocalization.Get("Calc_Log")),
|
||||
Named("asin(", OdLocalization.Get("Calc_Arcsine")), Named("acos(", OdLocalization.Get("Calc_Arccosine")), Named("atan(", OdLocalization.Get("Calc_Arctangent")),
|
||||
Named("√(", OdLocalization.Get("Calc_SquareRoot")), Named("^", OdLocalization.Get("Calc_Power")),
|
||||
Named("(", OdLocalization.Get("Calc_OpenParenthesis")), Named(")", OdLocalization.Get("Calc_CloseParenthesis")),
|
||||
Named("π", OdLocalization.Get("Calc_Pi")), Named("e", OdLocalization.Get("Calc_Euler")), Named("!", OdLocalization.Get("Calc_Factorial")),
|
||||
];
|
||||
|
||||
/// <summary>An input key that types its own label, with the name screen readers say for its symbol.</summary>
|
||||
private static OdCalcKey Named(string label, string name) => new(label, label, OdCalcKeyKind.Input, name);
|
||||
|
||||
/// <summary>Starts a new session: an empty display and no history.</summary>
|
||||
public void Reset()
|
||||
{
|
||||
@@ -189,6 +209,10 @@ public sealed partial class OdCalculatorViewModel : ObservableObject
|
||||
[RelayCommand]
|
||||
private void ClearHistory() => History.Clear();
|
||||
|
||||
/// <summary>Removes one calculation from the history.</summary>
|
||||
[RelayCommand]
|
||||
private void Forget(OdCalcHistoryEntry entry) => History.Remove(entry);
|
||||
|
||||
partial void OnIsScientificChanged(bool value) => Save();
|
||||
|
||||
partial void OnUseDegreesChanged(bool value) => Save();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using OmniDeck.Core.Localization;
|
||||
|
||||
namespace OmniDeck.Modules.Calendar;
|
||||
|
||||
/// <summary>A labelled choice in one of the editor's lists: a time, a repeat or a reminder.</summary>
|
||||
public sealed record OdCalendarChoice<T>(T Value, string Label)
|
||||
/// <summary>A labelled choice in one of the editor's lists: a time, a repeat, an interval or a reminder.</summary>
|
||||
public sealed class OdCalendarChoice<T>(T value, Func<string> label) : OdLocalizedOption(label)
|
||||
{
|
||||
/// <summary>What the list shows, and what screen readers announce.</summary>
|
||||
public override string ToString() => Label;
|
||||
public T Value { get; } = value;
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
using System.Globalization;
|
||||
using OmniDeck.Core.Localization;
|
||||
|
||||
namespace OmniDeck.Modules.Calendar;
|
||||
|
||||
/// <summary>
|
||||
@@ -11,4 +14,11 @@ public sealed record OdCalendarDay(DateOnly Date, string Label, bool IsInPeriod,
|
||||
public bool IsEmpty => Items.Count == 0;
|
||||
|
||||
public bool HasMore => More is not null;
|
||||
|
||||
/// <summary>The whole date, as screen readers name the day's cell; the cell itself shows only its number.</summary>
|
||||
public override string ToString()
|
||||
{
|
||||
var date = Date.ToString("D", CultureInfo.CurrentCulture);
|
||||
return IsToday ? OdLocalization.Format("Calendar_DayToday", date) : date;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,8 @@
|
||||
Icon="{ui:SymbolIcon ArrowExportLtr24}"
|
||||
ToolTip="{res:OdLoc Calendar_Export}" />
|
||||
</StackPanel>
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H1}"
|
||||
<TextBlock AutomationProperties.HeadingLevel="Level1"
|
||||
FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Calendar_Name}" />
|
||||
</DockPanel>
|
||||
@@ -94,6 +95,7 @@
|
||||
ToolTip="{res:OdLoc Calendar_Next}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding PeriodText}" />
|
||||
@@ -143,15 +145,13 @@
|
||||
ItemsSource="{Binding Repeats}"
|
||||
SelectedItem="{Binding EditRepeat}"
|
||||
ToolTip="{res:OdLoc Calendar_Repeat}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
Text="{res:OdLoc Calendar_Every}"
|
||||
Visibility="{Binding IsRepeating, Converter={StaticResource Visible}}" />
|
||||
<!-- Each interval reads as a whole phrase ("every 2 weeks"): no sentence is built from pieces. -->
|
||||
<ComboBox Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{res:OdLoc Calendar_Every}"
|
||||
AutomationProperties.Name="{res:OdLoc Calendar_Interval}"
|
||||
ItemsSource="{Binding Intervals}"
|
||||
SelectedItem="{Binding EditInterval}"
|
||||
SelectedValue="{Binding EditInterval}"
|
||||
SelectedValuePath="Value"
|
||||
Visibility="{Binding IsRepeating, Converter={StaticResource Visible}}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
@@ -237,15 +237,19 @@
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<!-- Dimmed outside the month, but never below AA, and not at all in High Contrast. -->
|
||||
<DataTrigger Binding="{Binding IsInPeriod}" Value="False">
|
||||
<Setter Property="Opacity" Value="0.55" />
|
||||
<Setter Property="Opacity" Value="{DynamicResource Od.Opacity.Dim}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<StackPanel>
|
||||
<!-- Screen readers hear the whole date; the cell shows only its number. -->
|
||||
<ui:Button HorizontalAlignment="Left"
|
||||
Appearance="Transparent"
|
||||
AutomationProperties.HelpText="{res:OdLoc Calendar_New}"
|
||||
AutomationProperties.Name="{Binding}"
|
||||
Command="{Binding DataContext.NewEventCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip="{res:OdLoc Calendar_New}">
|
||||
@@ -277,7 +281,8 @@
|
||||
<StackPanel Margin="{DynamicResource Od.Margin.Item}">
|
||||
<DockPanel>
|
||||
<ui:Button Appearance="Transparent"
|
||||
AutomationProperties.Name="{res:OdLoc Calendar_New}"
|
||||
AutomationProperties.Name="{res:OdLocRow Calendar_New,
|
||||
Path=.}"
|
||||
Command="{Binding DataContext.NewEventCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
DockPanel.Dock="Right"
|
||||
|
||||
@@ -29,26 +29,27 @@ public sealed partial class OdCalendarViewModel : ObservableObject, IDisposable
|
||||
Times = [.. Enumerable.Range(0, 96).Select(quarter => TimeChoice(TimeOnly.FromTimeSpan(TimeSpan.FromMinutes(15 * quarter))))];
|
||||
Repeats =
|
||||
[
|
||||
new(OdRepeat.None, OdLocalization.Get("Calendar_RepeatNone")),
|
||||
new(OdRepeat.Daily, OdLocalization.Get("Calendar_RepeatDaily")),
|
||||
new(OdRepeat.Weekly, OdLocalization.Get("Calendar_RepeatWeekly")),
|
||||
new(OdRepeat.Monthly, OdLocalization.Get("Calendar_RepeatMonthly")),
|
||||
new(OdRepeat.Yearly, OdLocalization.Get("Calendar_RepeatYearly")),
|
||||
new(OdRepeat.None, () => OdLocalization.Get("Calendar_RepeatNone")),
|
||||
new(OdRepeat.Daily, () => OdLocalization.Get("Calendar_RepeatDaily")),
|
||||
new(OdRepeat.Weekly, () => OdLocalization.Get("Calendar_RepeatWeekly")),
|
||||
new(OdRepeat.Monthly, () => OdLocalization.Get("Calendar_RepeatMonthly")),
|
||||
new(OdRepeat.Yearly, () => OdLocalization.Get("Calendar_RepeatYearly")),
|
||||
];
|
||||
Intervals = [.. Enumerable.Range(1, 12)];
|
||||
Intervals = [.. Enumerable.Range(1, 12).Select(interval => new OdCalendarChoice<int>(interval, () => EveryLabel(interval)))];
|
||||
Reminders =
|
||||
[
|
||||
new(null, OdLocalization.Get("Calendar_ReminderNone")),
|
||||
new(0, OdLocalization.Get("Calendar_ReminderAtStart")),
|
||||
new(5, OdLocalization.Format("Calendar_ReminderMinutes", 5)),
|
||||
new(15, OdLocalization.Format("Calendar_ReminderMinutes", 15)),
|
||||
new(30, OdLocalization.Format("Calendar_ReminderMinutes", 30)),
|
||||
new(60, OdLocalization.Get("Calendar_ReminderHour")),
|
||||
new(1440, OdLocalization.Get("Calendar_ReminderDay")),
|
||||
new(null, () => OdLocalization.Get("Calendar_ReminderNone")),
|
||||
new(0, () => OdLocalization.Get("Calendar_ReminderAtStart")),
|
||||
new(5, () => OdLocalization.Format("Calendar_ReminderMinutes", 5)),
|
||||
new(15, () => OdLocalization.Format("Calendar_ReminderMinutes", 15)),
|
||||
new(30, () => OdLocalization.Format("Calendar_ReminderMinutes", 30)),
|
||||
new(60, () => OdLocalization.Get("Calendar_ReminderHour")),
|
||||
new(1440, () => OdLocalization.Get("Calendar_ReminderDay")),
|
||||
];
|
||||
WeekdayNames = [.. Enumerable.Range(0, 7).Select(day => Culture.DateTimeFormat.AbbreviatedDayNames[((int)FirstDay + day) % 7])];
|
||||
_store.Changed += OnStoreChanged;
|
||||
Refresh();
|
||||
OdLocalization.FollowCulture(OnCultureChanged);
|
||||
}
|
||||
|
||||
public ObservableCollection<OdCalendarDay> MonthDays { get; } = [];
|
||||
@@ -62,7 +63,8 @@ public sealed partial class OdCalendarViewModel : ObservableObject, IDisposable
|
||||
|
||||
public IReadOnlyList<OdCalendarChoice<OdRepeat>> Repeats { get; }
|
||||
|
||||
public IReadOnlyList<int> Intervals { get; }
|
||||
/// <summary>"every 2 weeks": each interval as a phrase in the repeat's unit, which follows the repeat chosen.</summary>
|
||||
public IReadOnlyList<OdCalendarChoice<int>> Intervals { get; }
|
||||
|
||||
public IReadOnlyList<OdCalendarChoice<int?>> Reminders { get; }
|
||||
|
||||
@@ -197,7 +199,11 @@ public sealed partial class OdCalendarViewModel : ObservableObject, IDisposable
|
||||
/// <summary>Reports a file that could not be read or written.</summary>
|
||||
public void Report(string message) => Message = message;
|
||||
|
||||
public void Dispose() => _store.Changed -= OnStoreChanged;
|
||||
public void Dispose()
|
||||
{
|
||||
OdLocalization.UnfollowCulture(OnCultureChanged);
|
||||
_store.Changed -= OnStoreChanged;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ShowMonth() => Mode = OdCalendarMode.Month;
|
||||
@@ -320,9 +326,39 @@ public sealed partial class OdCalendarViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
EditCustomRule = null;
|
||||
}
|
||||
|
||||
// The intervals say the repeat's unit: every 2 weeks, every 2 months.
|
||||
foreach (var interval in Intervals)
|
||||
{
|
||||
interval.RefreshLabel();
|
||||
}
|
||||
}
|
||||
|
||||
private static OdCalendarChoice<TimeOnly> TimeChoice(TimeOnly time) => new(time, time.ToString("t", Culture));
|
||||
// A change of language: the editor's lists in place, so their selections stay, and the days again.
|
||||
private void OnCultureChanged(object? sender, EventArgs e)
|
||||
{
|
||||
foreach (var choice in Repeats.Concat<OdLocalizedOption>(Reminders).Concat(Intervals))
|
||||
{
|
||||
choice.RefreshLabel();
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
/// <summary>The interval as one phrase in the repeat's unit, worded as each language words it.</summary>
|
||||
private string EveryLabel(int interval) => (EditRepeat?.Value ?? OdRepeat.Weekly, interval) switch
|
||||
{
|
||||
(OdRepeat.Daily, 1) => OdLocalization.Get("Calendar_EveryDay"),
|
||||
(OdRepeat.Daily, _) => OdLocalization.Format("Calendar_EveryDays", interval),
|
||||
(OdRepeat.Monthly, 1) => OdLocalization.Get("Calendar_EveryMonth"),
|
||||
(OdRepeat.Monthly, _) => OdLocalization.Format("Calendar_EveryMonths", interval),
|
||||
(OdRepeat.Yearly, 1) => OdLocalization.Get("Calendar_EveryYear"),
|
||||
(OdRepeat.Yearly, _) => OdLocalization.Format("Calendar_EveryYears", interval),
|
||||
(_, 1) => OdLocalization.Get("Calendar_EveryWeek"),
|
||||
_ => OdLocalization.Format("Calendar_EveryWeeks", interval),
|
||||
};
|
||||
|
||||
private static OdCalendarChoice<TimeOnly> TimeChoice(TimeOnly time) => new(time, () => time.ToString("t", Culture));
|
||||
|
||||
private static string Title(OdCalendarEvent value) => value.Title.Length > 0 ? value.Title : OdLocalization.Get("Calendar_Untitled");
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace OmniDeck.Modules.Charts;
|
||||
|
||||
/// <summary>
|
||||
/// A price chart: candles or OHLC bars over a time axis, with the price axis on the right and, when
|
||||
/// the bars carry it, the volume in a band below. A rising candle is hollow and a falling one filled,
|
||||
/// so the direction does not rest on color alone.
|
||||
/// </summary>
|
||||
public sealed class OdCandleChart : OdChartAxes
|
||||
{
|
||||
public static readonly DependencyProperty BarsProperty = DependencyProperty.Register(
|
||||
nameof(Bars), typeof(IReadOnlyList<OdOhlc>), typeof(OdCandleChart), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty KindProperty = DependencyProperty.Register(
|
||||
nameof(Kind), typeof(OdCandleKind), typeof(OdCandleChart), new FrameworkPropertyMetadata(OdCandleKind.Candles, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty UpBrushProperty = DependencyProperty.Register(
|
||||
nameof(UpBrush), typeof(Brush), typeof(OdCandleChart), new FrameworkPropertyMetadata(Brushes.SeaGreen, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty DownBrushProperty = DependencyProperty.Register(
|
||||
nameof(DownBrush), typeof(Brush), typeof(OdCandleChart), new FrameworkPropertyMetadata(Brushes.Firebrick, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
public static readonly DependencyProperty VolumeBrushProperty = DependencyProperty.Register(
|
||||
nameof(VolumeBrush), typeof(Brush), typeof(OdCandleChart), new FrameworkPropertyMetadata(Brushes.Silver, FrameworkPropertyMetadataOptions.AffectsRender));
|
||||
|
||||
/// <summary>The share of the plot's height the prices take when a volume band is drawn below them.</summary>
|
||||
private const double PriceShare = 0.75;
|
||||
|
||||
public OdCandleChart()
|
||||
{
|
||||
SetResourceReference(UpBrushProperty, "SystemFillColorSuccessBrush");
|
||||
SetResourceReference(DownBrushProperty, "SystemFillColorCriticalBrush");
|
||||
SetResourceReference(VolumeBrushProperty, "ControlStrongStrokeColorDefaultBrush");
|
||||
}
|
||||
|
||||
public IReadOnlyList<OdOhlc>? Bars
|
||||
{
|
||||
get => (IReadOnlyList<OdOhlc>?)GetValue(BarsProperty);
|
||||
set => SetValue(BarsProperty, value);
|
||||
}
|
||||
|
||||
public OdCandleKind Kind
|
||||
{
|
||||
get => (OdCandleKind)GetValue(KindProperty);
|
||||
set => SetValue(KindProperty, value);
|
||||
}
|
||||
|
||||
public Brush UpBrush
|
||||
{
|
||||
get => (Brush)GetValue(UpBrushProperty);
|
||||
set => SetValue(UpBrushProperty, value);
|
||||
}
|
||||
|
||||
public Brush DownBrush
|
||||
{
|
||||
get => (Brush)GetValue(DownBrushProperty);
|
||||
set => SetValue(DownBrushProperty, value);
|
||||
}
|
||||
|
||||
public Brush VolumeBrush
|
||||
{
|
||||
get => (Brush)GetValue(VolumeBrushProperty);
|
||||
set => SetValue(VolumeBrushProperty, value);
|
||||
}
|
||||
|
||||
protected override int PointCount => Bars?.Count ?? 0;
|
||||
|
||||
protected override void OnRender(DrawingContext drawingContext)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(drawingContext);
|
||||
if (Bars is not { Count: > 0 } bars || ActualWidth <= 0 || ActualHeight <= 0)
|
||||
{
|
||||
Plot = Rect.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var scale = OdChartScale.Nice(bars.Min(bar => bar.Low), bars.Max(bar => bar.High), MaxValueTicks);
|
||||
var axisWidth = AxisWidth(scale, "");
|
||||
var labelHeight = LabelHeight;
|
||||
Plot = new Rect(0, labelHeight / 2, Math.Max(1, ActualWidth - axisWidth), Math.Max(1, ActualHeight - (labelHeight * 2) - LabelGap));
|
||||
|
||||
var hasVolume = bars.Any(bar => bar.Volume > 0);
|
||||
var prices = hasVolume ? new Rect(Plot.Left, Plot.Top, Plot.Width, Plot.Height * PriceShare) : Plot;
|
||||
DrawValueAxis(drawingContext, scale, prices, labelsOnRight: true, "");
|
||||
if (hasVolume)
|
||||
{
|
||||
DrawVolume(drawingContext, bars, new Rect(Plot.Left, prices.Bottom + LabelGap, Plot.Width, Math.Max(1, Plot.Bottom - prices.Bottom - LabelGap)));
|
||||
}
|
||||
|
||||
var pens = (Up: Stroke(UpBrush, Math.Max(1, LineWeight / 2)), Down: Stroke(DownBrush, Math.Max(1, LineWeight / 2)));
|
||||
for (var i = 0; i < bars.Count; i++)
|
||||
{
|
||||
DrawBar(drawingContext, bars[i], SlotCenter(i), scale, prices, bars[i].IsUp ? pens.Up : pens.Down);
|
||||
}
|
||||
|
||||
DrawTimeAxis(drawingContext, [.. bars.Select(bar => bar.Time)]);
|
||||
DrawCursor(drawingContext);
|
||||
}
|
||||
|
||||
private void DrawBar(DrawingContext drawingContext, OdOhlc bar, double x, OdChartScale scale, Rect area, Pen pen)
|
||||
{
|
||||
double Y(double value) => scale.Map(value, area.Bottom, area.Top);
|
||||
var width = Math.Max(1, Plot.Width / PointCount * 0.6);
|
||||
if (Kind == OdCandleKind.Bars)
|
||||
{
|
||||
drawingContext.DrawLine(pen, new Point(x, Y(bar.High)), new Point(x, Y(bar.Low)));
|
||||
drawingContext.DrawLine(pen, new Point(x - (width / 2), Y(bar.Open)), new Point(x, Y(bar.Open)));
|
||||
drawingContext.DrawLine(pen, new Point(x, Y(bar.Close)), new Point(x + (width / 2), Y(bar.Close)));
|
||||
return;
|
||||
}
|
||||
|
||||
var top = Y(Math.Max(bar.Open, bar.Close));
|
||||
var bottom = Y(Math.Min(bar.Open, bar.Close));
|
||||
drawingContext.DrawLine(pen, new Point(x, Y(bar.High)), new Point(x, top));
|
||||
drawingContext.DrawLine(pen, new Point(x, bottom), new Point(x, Y(bar.Low)));
|
||||
|
||||
// Too narrow to show a hollow body: a rising candle is filled too, and its outline still tells.
|
||||
var hollow = bar.IsUp && width >= 3;
|
||||
drawingContext.DrawRectangle(hollow ? null : pen.Brush, pen, new Rect(x - (width / 2), top, width, Math.Max(1, bottom - top)));
|
||||
}
|
||||
|
||||
private void DrawVolume(DrawingContext drawingContext, IReadOnlyList<OdOhlc> bars, Rect area)
|
||||
{
|
||||
var most = bars.Max(bar => bar.Volume ?? 0);
|
||||
var width = Math.Max(1, area.Width / bars.Count * 0.6);
|
||||
for (var i = 0; i < bars.Count; i++)
|
||||
{
|
||||
if (bars[i].Volume is { } volume && volume > 0)
|
||||
{
|
||||
var height = area.Height * volume / most;
|
||||
drawingContext.DrawRectangle(VolumeBrush, null, new Rect(SlotCenter(i) - (width / 2), area.Bottom - height, width, height));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace OmniDeck.Modules.Charts;
|
||||
|
||||
/// <summary>How a price chart draws each bar.</summary>
|
||||
public enum OdCandleKind
|
||||
{
|
||||
/// <summary>Candles: a body from open to close, hollow when the price rose, with wicks to the high and low.</summary>
|
||||
Candles,
|
||||
|
||||
/// <summary>OHLC bars: a line from high to low, with the open ticked on the left and the close on the right.</summary>
|
||||
Bars,
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Automation.Provider;
|
||||
using OmniDeck.Core.Localization;
|
||||
|
||||
namespace OmniDeck.Modules.Charts;
|
||||
|
||||
/// <summary>
|
||||
/// What screen readers get from a chart: its summary as the name, a hint for the keys, and the values
|
||||
/// at the cursor as a read-only value that changes as the cursor moves.
|
||||
/// </summary>
|
||||
public sealed class OdChartAutomationPeer(OdChartBase owner) : FrameworkElementAutomationPeer(owner), IValueProvider
|
||||
{
|
||||
public bool IsReadOnly => true;
|
||||
|
||||
public string Value => owner.Readout;
|
||||
|
||||
public void SetValue(string value) => throw new ElementNotEnabledException();
|
||||
|
||||
public override object? GetPattern(PatternInterface patternInterface) =>
|
||||
patternInterface == PatternInterface.Value ? this : base.GetPattern(patternInterface);
|
||||
|
||||
/// <summary>Tells screen readers that the values at the cursor changed.</summary>
|
||||
internal void RaiseValueChanged(string oldValue, string newValue) =>
|
||||
RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, oldValue, newValue);
|
||||
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Custom;
|
||||
|
||||
protected override string GetLocalizedControlTypeCore() => OdLocalization.Get("Chart_Type");
|
||||
|
||||
protected override string GetClassNameCore() => owner.GetType().Name;
|
||||
|
||||
protected override string GetNameCore()
|
||||
{
|
||||
var name = base.GetNameCore();
|
||||
return string.IsNullOrEmpty(name) ? owner.Summary : name;
|
||||
}
|
||||
|
||||
protected override string GetHelpTextCore()
|
||||
{
|
||||
var help = base.GetHelpTextCore();
|
||||
return string.IsNullOrEmpty(help) ? OdLocalization.Get("Chart_KeyboardHint") : help;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 221 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user