Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,6 @@ impl FmxApp {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(trf("hint.back_to", &[("category", &self.browse_label())]))
.clicked()
{
self.in_editor = false;
Expand Down Expand Up @@ -2340,7 +2339,6 @@ impl FmxApp {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(tr("drive.refresh"))
.clicked()
};
let mut look_again = false;
Expand Down Expand Up @@ -3159,7 +3157,6 @@ impl FmxApp {
widgets::icon_button(ui, icon, hint, Kind::Ghost, Size::Small)
})
.inner
.on_hover_text(hint)
.on_disabled_hover_text(hint)
.clicked()
{
Expand Down Expand Up @@ -4169,7 +4166,6 @@ impl FmxApp {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(tr("settings.open_logs"))
.clicked()
&& let Some(dir) = diagnostics::logs_dir()
{
Expand Down Expand Up @@ -4311,7 +4307,6 @@ impl FmxApp {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(tr("settings.sound_test"))
.clicked()
{
sound::play(
Expand All @@ -4327,7 +4322,6 @@ impl FmxApp {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(path.display().to_string())
.clicked()
&& let Some(file) = pick_sound_file()
{
Expand Down Expand Up @@ -4377,7 +4371,6 @@ impl FmxApp {
Kind::Ghost,
Size::Small,
)
.on_hover_text(tr("action.rescan"))
.clicked()
{
self.toolbox = Toolbox::detect(self.settings.ffmpeg_path.as_deref());
Expand Down Expand Up @@ -4422,7 +4415,6 @@ impl FmxApp {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(tr("action.browse"))
.clicked()
&& let Some(path) = rfd::FileDialog::new().pick_file()
{
Expand Down Expand Up @@ -6683,7 +6675,6 @@ fn file_slot(ui: &mut egui::Ui, slot: &mut Option<PathBuf>, exts: &[&str]) {
ui.label(file_name(path))
.on_hover_text(path.display().to_string());
if widgets::icon_button(ui, icons::X, tr("action.remove"), Kind::Ghost, Size::Small)
.on_hover_text(tr("action.remove"))
.clicked()
{
*slot = None;
Expand Down
6 changes: 0 additions & 6 deletions src/collage_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ impl CollageEditor {
Kind::Ghost,
Size::Small,
)
.on_hover_text(tr("collage.undo"))
.clicked()
})
.inner;
Expand All @@ -203,7 +202,6 @@ impl CollageEditor {
Kind::Ghost,
Size::Small,
)
.on_hover_text(tr("collage.redo"))
.clicked()
})
.inner;
Expand Down Expand Up @@ -239,7 +237,6 @@ impl CollageEditor {
Kind::Secondary,
Size::Small,
)
.on_hover_text(tr("collage.rotate_left"))
.clicked()
{
edit.turns = (edit.turns + 3) % 4;
Expand All @@ -251,7 +248,6 @@ impl CollageEditor {
Kind::Secondary,
Size::Small,
)
.on_hover_text(tr("collage.rotate"))
.clicked()
{
edit.turns = (edit.turns + 1) % 4;
Expand Down Expand Up @@ -662,7 +658,6 @@ impl CollageEditor {
Kind::Secondary,
Size::Regular,
)
.on_hover_text(tr("collage.rotate_left"))
.clicked()
{
edit.turns = (edit.turns + 3) % 4;
Expand All @@ -680,7 +675,6 @@ impl CollageEditor {
Kind::Secondary,
Size::Regular,
)
.on_hover_text(tr("collage.rotate"))
.clicked()
{
edit.turns = (edit.turns + 1) % 4;
Expand Down
3 changes: 0 additions & 3 deletions src/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,6 @@ impl Preview {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(tr("preview.set_start_hint"))
.clicked()
{
edit.trim_start = compact_timestamp(self.time);
Expand All @@ -878,7 +877,6 @@ impl Preview {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(tr("preview.set_end_hint"))
.clicked()
{
edit.trim_end = compact_timestamp(self.time);
Expand All @@ -891,7 +889,6 @@ impl Preview {
Kind::Ghost,
Size::Regular,
)
.on_hover_text(tr("preview.clear"))
.clicked()
{
edit.trim_start.clear();
Expand Down
41 changes: 41 additions & 0 deletions src/widgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,47 @@ fn paint_section_header(
mod tests {
use super::*;

/// `icon_button` already shows its label as a tooltip; a second
/// `on_hover_text` stacks another tooltip under it.
#[test]
fn icon_buttons_do_not_add_a_second_tooltip() {
let mut doubled = Vec::new();
let dir = concat!(env!("CARGO_MANIFEST_DIR"), "/src");
let mut stack = vec![std::path::PathBuf::from(dir)];
while let Some(dir) = stack.pop() {
for entry in std::fs::read_dir(&dir).unwrap() {
let path = entry.unwrap().path();
if path.is_dir() {
stack.push(path);
continue;
}
if path.extension().is_none_or(|ext| ext != "rs") {
continue;
}
let text = std::fs::read_to_string(&path).unwrap();
for (at, marker) in text.match_indices("icon_button(") {
let rest = &text[at + marker.len()..];
let mut depth = 1usize;
let Some(end) = rest.char_indices().find_map(|(i, c)| {
match c {
'(' => depth += 1,
')' => depth -= 1,
_ => {}
}
(depth == 0).then_some(i)
}) else {
continue;
};
if rest[end + 1..].trim_start().starts_with(".on_hover_text(") {
let line = text[..at].lines().count();
doubled.push(format!("{}:{line}", path.display()));
}
}
}
}
assert!(doubled.is_empty(), "duplicate tooltips at {doubled:?}");
}

#[test]
fn preference_controls_fit_below_wrapped_text_in_narrow_rows() {
let ctx = egui::Context::default();
Expand Down
4 changes: 2 additions & 2 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ From this directory:
cargo run --release
```

Edit `static/index.html`, `static/style.css`, and `static/app.js`, then rebuild. Commit both source and `dist` changes. The build works from any current directory with `cargo run --manifest-path /path/to/website/Cargo.toml`.
Edit `static/index.html`, `static/style.css`, `static/app.js`, and `static/translations.js`, then rebuild. The build writes the English page to `dist/index.html` and a translated, server-rendered page for each other language to `dist/<code>/index.html`, with `hreflang` links, a language switcher, and `dist/sitemap.xml`. On a first visit to `/`, the browser's preferred language redirects once to its page; choosing a language in the footer is remembered. Run the tests with `node --test tests/i18n.test.js`. Commit both source and `dist` changes. The build works from any current directory with `cargo run --manifest-path /path/to/website/Cargo.toml`.

## Preview

Expand All @@ -28,4 +28,4 @@ Import the repository into Vercel. Set **Root Directory** to `website`. Select *

The page reads the public GitHub API for `sudo-py-dev/fmx` and links to matching Windows setup, macOS DMG, Debian package, Linux archive, and Android APK assets in the latest release. If the API fails, is rate-limited, or lacks a matching asset, desktop buttons retain links to the release page. Android retains its development-source link. No fake installer links or package sizes are shown. When a production Android APK is published, update the development-status copy in `static/index.html` and rebuild.

The site uses local app artwork and screenshots copied from FMX. Google Fonts is optional; system sans-serif fallbacks work offline. JavaScript is progressive enhancement: navigation, release links, and FAQs work without it.
The site uses local app artwork and screenshots copied from FMX. All fonts, images, and scripts are served from this site; the page loads nothing from Google or other font CDNs. JavaScript is progressive enhancement: navigation, release links, and FAQs work without it.
44 changes: 24 additions & 20 deletions website/dist/app.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
'use strict';
const preferredLanguages = navigator.languages?.length ? navigator.languages : [navigator.language || 'en'];
const language = preferredLanguages.map(value => {
const code = value.toLowerCase().split(/[-_]/)[0];
return code === 'iw' ? 'he' : code;
}).find(code => Object.hasOwn(translations, code)) || 'en';
// Each language has its own server-rendered page; the page's lang attribute is the source of truth.
const language = Object.hasOwn(translations, document.documentElement.lang) ? document.documentElement.lang : 'en';
const messages = translations[language];
const markupKeys = new Set(['heroTitle', 'mediaTypes', 'featureTitle', 'featureIntro', 'faqTitle']);
function translatePage() {
document.documentElement.lang = language;
document.documentElement.dir = language === 'he' ? 'rtl' : 'ltr';
document.querySelectorAll('[data-i18n]').forEach(element => {
const key = element.dataset.i18n;
if (!Object.hasOwn(messages, key)) return;
if (markupKeys.has(key)) element.innerHTML = messages[key];
else element.textContent = messages[key];
});
document.querySelectorAll('[data-i18n-attr]').forEach(element => {
const [key, attribute] = element.dataset.i18nAttr.split(':');
if (Object.hasOwn(messages, key)) element.setAttribute(attribute, messages[key]);
});
const choiceKey = 'fmx-language';
const redirectedKey = 'fmx-language-redirected';
function readStorage(key) {
try { return localStorage.getItem(key); } catch { return null; }
}
function writeStorage(key, value) {
try { localStorage.setItem(key, value); } catch { /* Storage can be unavailable; the links still work. */ }
}
function preferredLanguage() {
const preferred = navigator.languages?.length ? navigator.languages : [navigator.language || 'en'];
return preferred.map(value => {
const code = value.toLowerCase().split(/[-_]/)[0];
return code === 'iw' ? 'he' : code;
}).find(code => Object.hasOwn(translations, code)) || 'en';
}
document.querySelectorAll('[data-language]').forEach(link => link.addEventListener('click', () => writeStorage(choiceKey, link.dataset.language)));
// Send first-time visitors of the English home page to their language once; an explicit choice always wins.
// The automatic redirect is recorded separately so returning to / later keeps the English page.
const redirectTo = location.pathname === '/' && language === 'en' && !readStorage(choiceKey) && !readStorage(redirectedKey) && preferredLanguage();
if (redirectTo && redirectTo !== 'en') {
writeStorage(redirectedKey, redirectTo);
location.replace(`/${redirectTo}/${location.hash}`);
}
translatePage();
const repository = 'sudo-py-dev/fmx';
const patterns = {
windows: /windows.*setup\.exe$/i,
Expand Down
Binary file added website/dist/assets/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/dist/assets/fmx-desktop.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 93 additions & 0 deletions website/dist/assets/fonts/LICENSE-DMSans.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts) DMSans-Italic[opsz,wght].ttf: Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Loading
Loading