diff --git a/Queueify.Core/Services/Strings.En.cs b/Queueify.Core/Services/Strings.En.cs
index ea31147..62e0819 100644
--- a/Queueify.Core/Services/Strings.En.cs
+++ b/Queueify.Core/Services/Strings.En.cs
@@ -294,7 +294,7 @@ public static partial class Loc
["help.trouble.2"] = "• An album isn't found: use fewer words (artist + main title), check the spelling, or add it without a link.",
["help.trouble.3"] = "• Text on a photo is read wrong: use good light and shoot the page straight on. Install Spanish text recognition from the Magazine photo page for accents and ñ.",
["help.trouble.4"] = "• Sync shows a warning: point at the Sync icon for the reason. Usually it's no internet, or the security rules weren't published in Firebase.",
- ["help.trouble.5"] = "• An update fails: click “Try again” in the bar (or Check for updates in About), or download the new exe from github.com/PAumedes/Queueify/releases and put it in place of yours, with the same name.",
+ ["help.trouble.5"] = "• An update fails: click “Try again” in Help → About (or Check for updates there), or download the new exe from github.com/PAumedes/Queueify/releases and put it in place of yours, with the same name.",
["help.about"] = "About Queueify",
["help.data"] = "Open data folder",
["help.data.tip"] = "Your queue, settings and layout live here. To carry them on a USB stick, put them in a Data folder next to the Queueify exe.",
@@ -309,6 +309,9 @@ public static partial class Loc
["update.retry"] = "Try again",
["update.cancel"] = "Cancel",
["update.skip"] = "Skip this version",
+ ["nav.help.update"] = "{0}, new version available",
+ ["nav.help.update_problem"] = "{0}, there's a problem with the update",
+ ["update.show"] = "Show",
["update.start_failed"] = "Queueify {0} is in place but didn't start, so your Queueify exe won't open until it's replaced. Keep this window open and download a version that works from the releases page (an earlier one, if this one is broken). Try again only helps if something on this PC got in the way, like a full disk or an antivirus.",
["update.releases"] = "Releases page",
["update.ok"] = "OK",
diff --git a/Queueify.Core/Services/Strings.Es.cs b/Queueify.Core/Services/Strings.Es.cs
index 88bcd02..57645fb 100644
--- a/Queueify.Core/Services/Strings.Es.cs
+++ b/Queueify.Core/Services/Strings.Es.cs
@@ -295,7 +295,7 @@ public static partial class Loc
["help.trouble.2"] = "• No aparece un álbum: usá menos palabras (artista + título principal), revisá cómo está escrito o agregalo sin enlace.",
["help.trouble.3"] = "• El texto de una foto se lee mal: usá buena luz y sacá la página de frente. Instalá el reconocimiento de texto en español desde Foto de revista para los acentos y la ñ.",
["help.trouble.4"] = "• Sincronizar muestra una advertencia: pasá el mouse por el ícono para ver el motivo. Casi siempre es falta de internet, o que no se publicaron las reglas de seguridad en Firebase.",
- ["help.trouble.5"] = "• Una actualización falla: hacé clic en “Probar de nuevo” en la barra (o en Buscar actualizaciones, en Acerca de), o descargá el exe nuevo de github.com/PAumedes/Queueify/releases y ponelo en lugar del tuyo, con el mismo nombre.",
+ ["help.trouble.5"] = "• Una actualización falla: hacé clic en “Probar de nuevo” en Ayuda → Acerca de (o en Buscar actualizaciones, ahí mismo), o descargá el exe nuevo de github.com/PAumedes/Queueify/releases y ponelo en lugar del tuyo, con el mismo nombre.",
["help.about"] = "Acerca de Queueify",
["help.data"] = "Abrir la carpeta de datos",
["help.data.tip"] = "Acá viven tu lista, la configuración y el diseño. Para llevarlos en un pendrive, ponelos en una carpeta Data al lado del exe de Queueify.",
@@ -310,6 +310,9 @@ public static partial class Loc
["update.retry"] = "Probar de nuevo",
["update.cancel"] = "Cancelar",
["update.skip"] = "Saltear esta versión",
+ ["nav.help.update"] = "{0}, hay una versión nueva",
+ ["nav.help.update_problem"] = "{0}, hay un problema con la actualización",
+ ["update.show"] = "Ver",
["update.start_failed"] = "Queueify {0} quedó en su lugar pero no arrancó, así que tu exe de Queueify no va a abrir hasta que lo reemplaces. Dejá esta ventana abierta y descargá una versión que funcione desde la página de versiones (una anterior, si esta viene fallada). Probar de nuevo solo sirve si algo de esta PC se interpuso, como un disco lleno o un antivirus.",
["update.releases"] = "Página de versiones",
["update.ok"] = "Entendido",
diff --git a/Queueify.Launcher/Bundle.cs b/Queueify.Launcher/Bundle.cs
index 86c4d4c..e331578 100644
--- a/Queueify.Launcher/Bundle.cs
+++ b/Queueify.Launcher/Bundle.cs
@@ -183,6 +183,9 @@ public static string PlaceUnpacked(string unpacked, string target)
}
}
+ /// Whether this version is already unpacked, so starting it is quick.
+ public static bool IsUnpacked(string cacheFolder, BundleInfo info) => IsComplete(Path.Combine(cacheFolder, info.Id));
+
private static bool IsComplete(string folder) => File.Exists(Path.Combine(folder, Complete));
///
diff --git a/Queueify.Launcher/LoadingScreen.cs b/Queueify.Launcher/LoadingScreen.cs
new file mode 100644
index 0000000..6030288
--- /dev/null
+++ b/Queueify.Launcher/LoadingScreen.cs
@@ -0,0 +1,272 @@
+using System.Runtime.InteropServices;
+
+namespace Queueify.Launcher;
+
+///
+/// The first thing on screen: Queueify's icon and name with a line of status, in a small window of its own,
+/// while the starter unpacks the app and until the app's window opens. Plain Win32 on a thread of its own,
+/// so the starter stays small and keeps working underneath. Light or dark like Windows' apps.
+///
+[System.Runtime.Versioning.SupportedOSPlatform("windows")]
+internal sealed unsafe partial class LoadingScreen : IDisposable
+{
+ public const string ClassName = "QueueifyLoading";
+
+ private static string s_status = "";
+ private static bool s_dark;
+
+ private readonly Lock _lock = new();
+ private readonly ManualResetEventSlim _closing = new();
+ private readonly Thread _thread;
+ private nint _hwnd;
+
+ private LoadingScreen(string status, TimeSpan delay)
+ {
+ s_status = status;
+ s_dark = WindowsUsesDarkApps();
+ _thread = new Thread(() => Run(delay)) { IsBackground = true, Name = "Loading screen" };
+ _thread.Start();
+ }
+
+ /// Shows the screen after , unless it's closed before that.
+ public static LoadingScreen Show(string status, TimeSpan delay) => new(status, delay);
+
+ public void Dispose()
+ {
+ lock (_lock)
+ {
+ _closing.Set();
+ if (_hwnd != 0) PostMessageW(_hwnd, WM_CLOSE, 0, 0);
+ }
+ _thread.Join(TimeSpan.FromSeconds(2));
+ }
+
+ private void Run(TimeSpan delay)
+ {
+ if (_closing.Wait(delay)) return;
+ var instance = GetModuleHandleW(null);
+ fixed (char* className = ClassName)
+ {
+ var windowClass = new WNDCLASSEXW
+ {
+ cbSize = (uint)sizeof(WNDCLASSEXW),
+ style = CS_DROPSHADOW,
+ lpfnWndProc = &WndProc,
+ hInstance = instance,
+ hCursor = LoadCursorW(0, IDC_APPSTARTING),
+ hIcon = LoadImageW(instance, IconId, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE),
+ lpszClassName = className,
+ };
+ RegisterClassExW(&windowClass);
+
+ // On the screen the mouse is on, where the user just opened Queueify.
+ GetCursorPos(out var cursor);
+ var info = new MONITORINFO { cbSize = (uint)sizeof(MONITORINFO) };
+ GetMonitorInfoW(MonitorFromPoint(cursor, MONITOR_DEFAULTTONEAREST), ref info);
+
+ nint hwnd;
+ lock (_lock)
+ {
+ if (_closing.IsSet) return;
+ // The status as the title too: it's what Narrator reads, and the taskbar shows.
+ hwnd = CreateWindowExW(WS_EX_APPWINDOW, className, s_status, WS_POPUP,
+ info.rcWork.left, info.rcWork.top, 1, 1, 0, 0, instance, 0);
+ if (hwnd == 0) return;
+ _hwnd = hwnd;
+ }
+
+ // Sized for this screen's scaling, then centred on it.
+ var scale = GetDpiForWindow(hwnd) / 96.0;
+ int width = (int)(Width * scale), height = (int)(Height * scale);
+ int x = info.rcWork.left + (info.rcWork.right - info.rcWork.left - width) / 2;
+ int y = info.rcWork.top + (info.rcWork.bottom - info.rcWork.top - height) / 2;
+ SetWindowPos(hwnd, 0, x, y, width, height, SWP_NOZORDER);
+ int round = DWMWCP_ROUND;
+ DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &round, sizeof(int)); // Windows 11; ignored before
+ ShowWindow(hwnd, SW_SHOWNORMAL);
+ UpdateWindow(hwnd);
+
+ MSG msg;
+ while (GetMessageW(&msg, 0, 0, 0) > 0)
+ {
+ TranslateMessage(&msg);
+ DispatchMessageW(&msg);
+ }
+ }
+ }
+
+ // Layout in device-independent pixels.
+ private const int Width = 400, Height = 150, IconSize = 64, Margin = 32, TitleSize = 28, StatusSize = 15;
+
+ [UnmanagedCallersOnly]
+ private static nint WndProc(nint hwnd, uint message, nint wParam, nint lParam)
+ {
+ switch (message)
+ {
+ case WM_PAINT:
+ Paint(hwnd);
+ return 0;
+ case WM_CLOSE:
+ DestroyWindow(hwnd);
+ return 0;
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return 0;
+ default:
+ return DefWindowProcW(hwnd, message, wParam, lParam);
+ }
+ }
+
+ private static void Paint(nint hwnd)
+ {
+ PAINTSTRUCT paint;
+ var dc = BeginPaint(hwnd, &paint);
+ var scale = GetDpiForWindow(hwnd) / 96.0;
+ int S(int dip) => (int)(dip * scale);
+ GetClientRect(hwnd, out var client);
+
+ // Windows 11's base colours, or the user's own in high contrast.
+ var contrast = new HIGHCONTRASTW { cbSize = (uint)sizeof(HIGHCONTRASTW) };
+ bool highContrast = SystemParametersInfoW(SPI_GETHIGHCONTRAST, contrast.cbSize, &contrast, 0) && (contrast.dwFlags & HCF_HIGHCONTRASTON) != 0;
+ uint background = highContrast ? GetSysColor(COLOR_WINDOW) : s_dark ? Rgb(0x20, 0x20, 0x20) : Rgb(0xF3, 0xF3, 0xF3);
+ uint primary = highContrast ? GetSysColor(COLOR_WINDOWTEXT) : s_dark ? Rgb(0xFF, 0xFF, 0xFF) : Rgb(0x1A, 0x1A, 0x1A);
+ uint secondary = highContrast ? GetSysColor(COLOR_WINDOWTEXT) : s_dark ? Rgb(0xC5, 0xC5, 0xC5) : Rgb(0x5F, 0x5F, 0x5F);
+ var brush = CreateSolidBrush(background);
+ FillRect(dc, &client, brush);
+ DeleteObject(brush);
+
+ var icon = LoadImageW(GetModuleHandleW(null), IconId, IMAGE_ICON, S(IconSize), S(IconSize), 0);
+ int iconTop = (client.bottom - S(IconSize)) / 2;
+ if (icon != 0)
+ {
+ DrawIconEx(dc, S(Margin), iconTop, icon, S(IconSize), S(IconSize), 0, 0, DI_NORMAL);
+ DestroyIcon(icon);
+ }
+
+ SetBkMode(dc, TRANSPARENT);
+ int textLeft = S(Margin + IconSize + 20);
+ var title = CreateFontW(-S(TitleSize), 0, 0, 0, FW_SEMIBOLD, 0, 0, 0, DEFAULT_CHARSET, 0, 0, CLEARTYPE_QUALITY, 0, Windows11 ? "Segoe UI Variable Display" : "Segoe UI Semibold");
+ var status = CreateFontW(-S(StatusSize), 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, 0, 0, CLEARTYPE_QUALITY, 0, Windows11 ? "Segoe UI Variable Text" : "Segoe UI");
+ var old = SelectObject(dc, title);
+ SetTextColor(dc, primary);
+ var titleRect = new RECT { left = textLeft, top = iconTop - S(2), right = client.right - S(Margin), bottom = iconTop + S(40) };
+ DrawTextW(dc, "Queueify", -1, &titleRect, DT_SINGLELINE | DT_NOPREFIX);
+ SelectObject(dc, status);
+ SetTextColor(dc, secondary);
+ var statusRect = new RECT { left = textLeft, top = iconTop + S(40), right = client.right - S(Margin), bottom = client.bottom };
+ DrawTextW(dc, s_status, -1, &statusRect, DT_SINGLELINE | DT_NOPREFIX | DT_END_ELLIPSIS);
+ SelectObject(dc, old);
+ DeleteObject(title);
+ DeleteObject(status);
+ EndPaint(hwnd, &paint);
+ }
+
+ /// Segoe UI Variable comes with Windows 11; Windows 10 has Segoe UI.
+ private static bool Windows11 => Environment.OSVersion.Version.Build >= 22000;
+
+ private static uint Rgb(byte r, byte g, byte b) => (uint)(r | g << 8 | b << 16);
+
+ private static bool WindowsUsesDarkApps()
+ {
+ try
+ {
+ using var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
+ return key?.GetValue("AppsUseLightTheme") is int light && light == 0;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+
+ // ── Win32 ──
+
+ /// The exe's own icon: .NET puts the ApplicationIcon in as resource 32512.
+ private const nint IconId = 32512;
+ private const uint IMAGE_ICON = 1, LR_DEFAULTSIZE = 0x40, DI_NORMAL = 3;
+ private const uint CS_DROPSHADOW = 0x20000, WS_POPUP = 0x80000000, WS_EX_APPWINDOW = 0x40000;
+ private const uint WM_PAINT = 0x000F, WM_CLOSE = 0x0010, WM_DESTROY = 0x0002;
+ private const int SW_SHOWNORMAL = 1, TRANSPARENT = 1, FW_NORMAL = 400, FW_SEMIBOLD = 600;
+ private const uint SWP_NOZORDER = 0x4, MONITOR_DEFAULTTONEAREST = 2, DEFAULT_CHARSET = 1, CLEARTYPE_QUALITY = 5;
+ private const uint DT_SINGLELINE = 0x20, DT_NOPREFIX = 0x800, DT_END_ELLIPSIS = 0x8000;
+ private const uint DWMWA_WINDOW_CORNER_PREFERENCE = 33;
+ private const int DWMWCP_ROUND = 2;
+ private const nint IDC_APPSTARTING = 32650;
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct WNDCLASSEXW
+ {
+ public uint cbSize, style;
+ public delegate* unmanaged lpfnWndProc;
+ public int cbClsExtra, cbWndExtra;
+ public nint hInstance, hIcon, hCursor, hbrBackground;
+ public char* lpszMenuName, lpszClassName;
+ public nint hIconSm;
+ }
+
+ private const uint SPI_GETHIGHCONTRAST = 0x42, HCF_HIGHCONTRASTON = 1;
+ private const int COLOR_WINDOW = 5, COLOR_WINDOWTEXT = 8;
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct HIGHCONTRASTW { public uint cbSize, dwFlags; public nint lpszDefaultScheme; }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct RECT { public int left, top, right, bottom; }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct POINT { public int x, y; }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct MONITORINFO { public uint cbSize; public RECT rcMonitor, rcWork; public uint dwFlags; }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct MSG { public nint hwnd; public uint message; public nint wParam, lParam; public uint time; public POINT pt; }
+
+ [StructLayout(LayoutKind.Sequential)]
+ private struct PAINTSTRUCT
+ {
+ public nint hdc;
+ public int fErase;
+ public RECT rcPaint;
+ public int fRestore, fIncUpdate;
+ public fixed byte rgbReserved[32];
+ }
+
+ [LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)] private static partial nint GetModuleHandleW(string? name);
+ [LibraryImport("user32.dll")] private static partial ushort RegisterClassExW(WNDCLASSEXW* windowClass);
+ [LibraryImport("user32.dll", StringMarshalling = StringMarshalling.Utf16)]
+ private static partial nint CreateWindowExW(uint exStyle, char* className, string title, uint style, int x, int y, int width, int height, nint parent, nint menu, nint instance, nint param);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool SetWindowPos(nint hwnd, nint after, int x, int y, int cx, int cy, uint flags);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool ShowWindow(nint hwnd, int command);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool UpdateWindow(nint hwnd);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool DestroyWindow(nint hwnd);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool PostMessageW(nint hwnd, uint message, nint wParam, nint lParam);
+ [LibraryImport("user32.dll")] private static partial void PostQuitMessage(int code);
+ [LibraryImport("user32.dll")] private static partial int GetMessageW(MSG* msg, nint hwnd, uint min, uint max);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool TranslateMessage(MSG* msg);
+ [LibraryImport("user32.dll")] private static partial nint DispatchMessageW(MSG* msg);
+ [LibraryImport("user32.dll")] private static partial nint DefWindowProcW(nint hwnd, uint message, nint wParam, nint lParam);
+ [LibraryImport("user32.dll")] private static partial nint BeginPaint(nint hwnd, PAINTSTRUCT* paint);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool EndPaint(nint hwnd, PAINTSTRUCT* paint);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool GetClientRect(nint hwnd, out RECT rect);
+ [LibraryImport("user32.dll")] private static partial int FillRect(nint dc, RECT* rect, nint brush);
+ [LibraryImport("user32.dll", StringMarshalling = StringMarshalling.Utf16)] private static partial int DrawTextW(nint dc, string text, int length, RECT* rect, uint format);
+ [LibraryImport("user32.dll")] private static partial uint GetDpiForWindow(nint hwnd);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool GetCursorPos(out POINT point);
+ [LibraryImport("user32.dll")] private static partial nint MonitorFromPoint(POINT point, uint flags);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool GetMonitorInfoW(nint monitor, ref MONITORINFO info);
+ [LibraryImport("user32.dll")] private static partial nint LoadImageW(nint instance, nint name, uint type, int cx, int cy, uint flags);
+ [LibraryImport("user32.dll")] private static partial nint LoadCursorW(nint instance, nint name);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool DrawIconEx(nint dc, int x, int y, nint icon, int cx, int cy, uint step, nint brush, uint flags);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool DestroyIcon(nint icon);
+ [LibraryImport("gdi32.dll")] private static partial nint CreateSolidBrush(uint color);
+ [LibraryImport("gdi32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool DeleteObject(nint obj);
+ [LibraryImport("gdi32.dll")] private static partial nint SelectObject(nint dc, nint obj);
+ [LibraryImport("gdi32.dll")] private static partial int SetBkMode(nint dc, int mode);
+ [LibraryImport("gdi32.dll")] private static partial uint SetTextColor(nint dc, uint color);
+ [LibraryImport("gdi32.dll", StringMarshalling = StringMarshalling.Utf16)]
+ private static partial nint CreateFontW(int height, int width, int escapement, int orientation, int weight, uint italic, uint underline, uint strikeOut, uint charSet, uint outPrecision, uint clipPrecision, uint quality, uint pitchAndFamily, string face);
+ [LibraryImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] private static partial bool SystemParametersInfoW(uint action, uint param, void* value, uint winIni);
+ [LibraryImport("user32.dll")] private static partial uint GetSysColor(int index);
+ [LibraryImport("dwmapi.dll")] private static partial int DwmSetWindowAttribute(nint hwnd, uint attribute, void* value, int size);
+}
diff --git a/Queueify.Launcher/Program.cs b/Queueify.Launcher/Program.cs
index 65d773c..fd78efa 100644
--- a/Queueify.Launcher/Program.cs
+++ b/Queueify.Launcher/Program.cs
@@ -6,14 +6,16 @@ namespace Queueify.Launcher;
///
/// The download's entry point: unpacks the app appended to this exe (once per version) into
/// %LOCALAPPDATA%\Queueify\app and starts it, passing its own path so the app finds a portable Data
-/// folder next to it and pins itself to the taskbar through it.
+/// folder next to it and pins itself to the taskbar through it. A loading screen covers the wait.
///
internal static partial class Program
{
private static int Main(string[] args)
{
+ var spanish = (GetUserDefaultUILanguage() & 0x3FF) == 0x0A;
string cache;
BundleInfo info;
+ LoadingScreen? loading = null;
try
{
var self = Environment.ProcessPath ?? throw new InvalidOperationException("No path for this exe.");
@@ -22,6 +24,8 @@ private static int Main(string[] args)
using (var exe = new FileStream(self, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete))
{
info = Bundle.Read(exe) ?? throw new BundleDamagedException("No app appended.");
+ var unpacking = !Bundle.IsUnpacked(cache, info);
+ loading = LoadingScreen.Show(StarterMessage.Loading(unpacking, spanish), StarterMessage.LoadingDelay(unpacking));
folder = Bundle.Unpack(exe, info, cache);
}
@@ -29,13 +33,24 @@ private static int Main(string[] args)
var start = new ProcessStartInfo(Path.Combine(folder, "Queueify.exe")) { UseShellExecute = false, WorkingDirectory = folder };
foreach (var arg in args) start.ArgumentList.Add(arg);
start.Environment["QUEUEIFY_EXE"] = self;
- Process.Start(start)?.Dispose();
+ using var app = Process.Start(start);
+ // The loading screen has the foreground; the app's window takes it over when it opens.
+ if (app != null) AllowSetForegroundWindow(app.Id);
+ // Gone before its window opened: say so, rather than leave the user with nothing on screen.
+ if (WaitForWindow(app) is { } exitCode && exitCode != 0)
+ {
+ loading.Dispose();
+ MessageBox(0, StarterMessage.ClosedWhileStarting(exitCode, spanish), "Queueify", MB_ICONWARNING | OnTop);
+ return 1;
+ }
}
catch (Exception ex)
{
- MessageBox(0, StarterMessage.For(ex, (GetUserDefaultUILanguage() & 0x3FF) == 0x0A), "Queueify", 0x10 /* MB_ICONERROR */);
+ loading?.Dispose();
+ MessageBox(0, StarterMessage.For(ex, spanish), "Queueify", MB_ICONERROR | OnTop);
return 1;
}
+ loading.Dispose();
try
{
@@ -48,15 +63,39 @@ private static int Main(string[] args)
return 0;
}
+ /// Until the app's window is open, so the loading screen hands over to it; the exit code if it ended first.
+ private static int? WaitForWindow(Process? app)
+ {
+ if (app == null) return null;
+ var until = DateTime.UtcNow.AddSeconds(30);
+ while (DateTime.UtcNow < until)
+ {
+ app.Refresh();
+ if (app.HasExited) return app.ExitCode;
+ if (app.MainWindowHandle != 0) return null;
+ Thread.Sleep(100);
+ }
+ return null;
+ }
+
/// Same rule as the app (AppData.LocalAppDataRoot): the variable only when it's a full path.
private static string LocalAppData() =>
Environment.GetEnvironmentVariable("LOCALAPPDATA") is { Length: > 0 } v && v.IndexOfAny(['"', '<', '>', '*', '?', '|', '\0', '\t', '\r', '\n']) < 0 && Path.IsPathFullyQualified(v)
? v : Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+ private const uint MB_ICONERROR = 0x10, MB_ICONWARNING = 0x30;
+ /// MB_SETFOREGROUND | MB_TOPMOST: the loading screen that had the foreground is gone, and the message
+ /// mustn't open behind other windows (or, after an update, behind the old Queueify waiting for it).
+ private const uint OnTop = 0x10000 | 0x40000;
+
// The starter has no culture data (InvariantGlobalization keeps it small), so it asks Windows directly.
[LibraryImport("kernel32.dll")]
private static partial ushort GetUserDefaultUILanguage();
[LibraryImport("user32.dll", EntryPoint = "MessageBoxW", StringMarshalling = StringMarshalling.Utf16)]
private static partial int MessageBox(nint owner, string text, string caption, uint type);
+
+ [LibraryImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static partial bool AllowSetForegroundWindow(int processId);
}
diff --git a/Queueify.Launcher/StarterMessage.cs b/Queueify.Launcher/StarterMessage.cs
index db8c03d..054d921 100644
--- a/Queueify.Launcher/StarterMessage.cs
+++ b/Queueify.Launcher/StarterMessage.cs
@@ -1,10 +1,26 @@
namespace Queueify.Launcher;
-/// What the starter shows when it can't start the app. It has no string tables of its own.
+/// What the starter says: its loading screen, and when it can't start the app. It has no string tables of its own.
public static class StarterMessage
{
public static string For(Exception error, bool spanish) => error is BundleDamagedException
? (spanish ? "Esta copia de Queueify está dañada o incompleta. Descargala de nuevo."
: "This copy of Queueify is damaged or incomplete. Download it again.")
: (spanish ? "Queueify no pudo arrancar." : "Queueify couldn't start.") + "\n\n" + error.Message;
-}
+
+ /// The line under the name on the loading screen.
+ public static string Loading(bool unpacking, bool spanish) => unpacking
+ ? (spanish ? "Preparando Queueify…" : "Getting Queueify ready…")
+ : (spanish ? "Abriendo…" : "Starting…");
+
+ ///
+ /// How long to wait before showing the loading screen: at once when a new version unpacks (a few
+ /// seconds), and only when it's slow otherwise (an unpacked version opens in under a second).
+ ///
+ public static TimeSpan LoadingDelay(bool unpacking) => unpacking ? TimeSpan.Zero : TimeSpan.FromMilliseconds(600);
+
+ /// The app ended before showing its window: what to tell the user instead of nothing.
+ public static string ClosedWhileStarting(int exitCode, bool spanish) => spanish
+ ? $"Queueify se cerró al arrancar (código {exitCode}). Si vuelve a pasar, crash.log en la carpeta de datos de Queueify dice por qué."
+ : $"Queueify closed while starting (code {exitCode}). If it keeps happening, crash.log in Queueify's data folder says why.";
+}
\ No newline at end of file
diff --git a/Queueify.Tests/BundleTests.cs b/Queueify.Tests/BundleTests.cs
index 8b28b86..1852012 100644
--- a/Queueify.Tests/BundleTests.cs
+++ b/Queueify.Tests/BundleTests.cs
@@ -113,6 +113,22 @@ public void A_version_already_unpacked_is_reused_not_unpacked_again()
Assert.Equal("marker", File.ReadAllText(Path.Combine(second, "Queueify.exe")));
}
+ [Fact]
+ public void A_version_is_known_to_be_unpacked_only_when_complete()
+ {
+ var output = Path.Combine(_dir, "Queueify.exe");
+ Bundle.Write(Starter(), App("app"), output);
+ var cache = Path.Combine(_dir, "cache");
+ using var exe = File.OpenRead(output);
+ var info = Bundle.Read(exe)!;
+ Assert.False(Bundle.IsUnpacked(cache, info));
+ Directory.CreateDirectory(Path.Combine(cache, info.Id));
+ Assert.False(Bundle.IsUnpacked(cache, info)); // half done
+
+ Bundle.Unpack(exe, info, cache);
+
+ Assert.True(Bundle.IsUnpacked(cache, info));
+ }
[Fact]
public void A_half_finished_unpack_is_done_again()
{
diff --git a/Queueify.Tests/StarterMessageTests.cs b/Queueify.Tests/StarterMessageTests.cs
index 69172ed..6513834 100644
--- a/Queueify.Tests/StarterMessageTests.cs
+++ b/Queueify.Tests/StarterMessageTests.cs
@@ -20,4 +20,30 @@ public void Anything_else_says_what_happened()
Assert.Equal("Queueify couldn't start.\n\nDisk full.", StarterMessage.For(new IOException("Disk full."), spanish: false));
Assert.Equal("Queueify no pudo arrancar.\n\nDisk full.", StarterMessage.For(new IOException("Disk full."), spanish: true));
}
-}
+
+ [Fact]
+ public void The_loading_screen_says_what_is_happening()
+ {
+ Assert.Equal("Getting Queueify ready…", StarterMessage.Loading(unpacking: true, spanish: false));
+ Assert.Equal("Preparando Queueify…", StarterMessage.Loading(unpacking: true, spanish: true));
+ Assert.Equal("Starting…", StarterMessage.Loading(unpacking: false, spanish: false));
+ Assert.Equal("Abriendo…", StarterMessage.Loading(unpacking: false, spanish: true));
+ }
+
+ [Fact]
+ public void The_loading_screen_shows_at_once_for_a_new_version_and_only_when_slow_otherwise()
+ {
+ // A version already unpacked opens in well under a second: no screen that flashes and goes.
+ Assert.Equal(TimeSpan.Zero, StarterMessage.LoadingDelay(unpacking: true));
+ Assert.Equal(TimeSpan.FromMilliseconds(600), StarterMessage.LoadingDelay(unpacking: false));
+ }
+
+ [Fact]
+ public void An_app_that_closes_before_its_window_opens_says_where_to_look()
+ {
+ Assert.Equal("Queueify closed while starting (code 3). If it keeps happening, crash.log in Queueify's data folder says why.",
+ StarterMessage.ClosedWhileStarting(3, spanish: false));
+ Assert.Equal("Queueify se cerró al arrancar (código 3). Si vuelve a pasar, crash.log en la carpeta de datos de Queueify dice por qué.",
+ StarterMessage.ClosedWhileStarting(3, spanish: true));
+ }
+}
\ No newline at end of file
diff --git a/Queueify/MainWindow.xaml b/Queueify/MainWindow.xaml
index 89f3633..a295268 100644
--- a/Queueify/MainWindow.xaml
+++ b/Queueify/MainWindow.xaml
@@ -327,6 +327,10 @@
+
+
+
+
@@ -383,7 +387,8 @@
PlaceholderText="{l:Tr Key=pane.search.placeholder}"
TextChanged="OnSearchTextChanged" PreviewKeyDown="OnSearchKeyDown" />
-
+
+
@@ -489,10 +494,6 @@
-
-
-
-
@@ -502,10 +503,6 @@
Style="{StaticResource CaptionTextBlockStyle}"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
-
-
@@ -664,6 +661,8 @@
+
+
@@ -839,7 +838,8 @@
-
+
+
diff --git a/Queueify/MainWindow.xaml.cs b/Queueify/MainWindow.xaml.cs
index 7dd83d8..52c883e 100644
--- a/Queueify/MainWindow.xaml.cs
+++ b/Queueify/MainWindow.xaml.cs
@@ -105,6 +105,10 @@ public MainWindow()
RefreshQueue();
ShowResults([]);
FillHelp();
+ // The line under the search box shows only while it has something to say.
+ SearchStatus.RegisterPropertyChangedCallback(TextBlock.TextProperty, (_, _) => UpdateSearchStatusPanel());
+ SearchProgress.RegisterPropertyChangedCallback(UIElement.VisibilityProperty, (_, _) => UpdateSearchStatusPanel());
+ AddWithoutLink.RegisterPropertyChangedCallback(UIElement.VisibilityProperty, (_, _) => UpdateSearchStatusPanel());
// The bar keeps its height from state to state while open; a new window size starts it over.
UpdateBar.Closed += (_, _) => UpdateBar.MinHeight = 0;
SizeChanged += (_, _) => UpdateBar.MinHeight = 0;
@@ -135,6 +139,10 @@ private static HttpClient CreateHttpClient()
// ───────────────────────── Window & layout ─────────────────────────
+ private void UpdateSearchStatusPanel() =>
+ SearchStatusPanel.Visibility = SearchStatus.Text.Length > 0 || SearchProgress.Visibility == Visibility.Visible
+ || AddWithoutLink.Visibility == Visibility.Visible ? Visibility.Visible : Visibility.Collapsed;
+
private void RestoreWindow()
{
if (_ui.WindowBounds is [var x, var y, var w, var h] && w > 400 && h > 300
@@ -527,6 +535,12 @@ private void RefreshQueue()
QueuePanel.Visibility = QueueCommands.Visibility = queuePage ? Visibility.Visible : Visibility.Collapsed;
PhotoPanel.Visibility = PhotoCommands.Visibility = _page == Page.Photo ? Visibility.Visible : Visibility.Collapsed;
HelpPanel.Visibility = _page == Page.Help ? Visibility.Visible : Visibility.Collapsed;
+ // Opening Help clears the dot and goes straight to the update.
+ if (_page == Page.Help && UpdateBadge.Visibility == Visibility.Visible)
+ {
+ SetUpdateBadge(false);
+ DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () => UpdateBar.StartBringIntoView());
+ }
SettingsPanel.Visibility = _page == Page.Settings ? Visibility.Visible : Visibility.Collapsed;
ApplyPaneLayout();
@@ -544,6 +558,25 @@ private static void SetBadge(NavigationViewItem item, InfoBadge badge, string la
Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(item, count > 0 ? Loc.F(count == 1 ? nameKey + ".one" : nameKey, label, count) : label);
}
+ ///
+ /// The dot on Help while something about an update waits there: a new version, or a problem with one
+ /// (then in the caution colour). Named for screen readers, and in the tooltip.
+ ///
+ private void SetUpdateBadge(bool shown, bool problem = false)
+ {
+ UpdateBadge.Visibility = shown ? Visibility.Visible : Visibility.Collapsed;
+ UpdateBadge.Style = problem ? (Style)Application.Current.Resources["CautionDotInfoBadgeStyle"] : null;
+ var key = problem ? "nav.help.update_problem" : "nav.help.update";
+ var name = shown ? Loc.F(key, Loc.T("nav.help")) : Loc.T("nav.help");
+ Microsoft.UI.Xaml.Automation.AutomationProperties.SetName(HelpNav, name);
+ ToolTipService.SetToolTip(HelpNav, shown ? Loc.F(key, Loc.T("nav.help")) + " (F1)" : Loc.T("nav.help.tip"));
+ if (shown) Announce(HelpNav, name);
+ }
+
+ /// A short note at the bottom with a way to Help → About, for update news found on another page.
+ private void ShowUpdateToast(string message, InfoBarSeverity severity) =>
+ ShowToast(message, undo: () => GoTo(Page.Help), actionText: Loc.T("update.show"), severity: severity);
+
private enum Page { Queue, Listened, Photo, Help, Settings }
private Page _page = Page.Queue;
@@ -1528,8 +1561,19 @@ private async Task CheckForUpdatesAsync(bool quiet)
try
{
var release = await _updater.CheckAsync(AppInfo.Version, CancellationToken.None);
- if (release != null && !_updating && Updater.IsWanted(release, _ui.SkippedVersion, asked: _reportCheck)) OfferUpdate(release);
- if (_reportCheck) ShowUpdateStatus(release != null ? Loc.F("update.available", release.Version) : Loc.T("update.latest"));
+ if (release != null && !_updating && Updater.IsWanted(release, _ui.SkippedVersion, asked: _reportCheck))
+ {
+ OfferUpdate(release);
+ // Found while on another page: a dot on Help and a short note say so; the offer itself waits
+ // in About.
+ if (_page != Page.Help)
+ {
+ SetUpdateBadge(true);
+ ShowUpdateToast(Loc.F("update.available", release.Version), InfoBarSeverity.Informational);
+ }
+ }
+ // The offer, right above, already says what's new; the line under the button says the rest.
+ if (_reportCheck) ShowUpdateStatus(release != null ? "" : Loc.T("update.latest"));
}
catch (Exception ex)
{
@@ -1546,6 +1590,7 @@ private async Task CheckForUpdatesAsync(bool quiet)
private void ShowUpdateStatus(string text)
{
UpdateStatus.Text = text;
+ if (text.Length == 0) return;
// At the bottom of Help, maybe below the window's edge; and said aloud for screen readers.
UpdateStatus.StartBringIntoView();
Announce(UpdateStatus, text);
@@ -1563,6 +1608,7 @@ private void OfferUpdate(AppRelease release)
_ui.SkippedVersion = release.Version;
_ui.Save();
UpdateBar.IsOpen = false;
+ SetUpdateBadge(false);
};
var links = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 20, Margin = new Thickness(0, 0, 0, 8), Children = { whatsNew, skip } };
ShowUpdateBar(InfoBarSeverity.Informational, Loc.F("update.available", release.Version), InstallButton(release, "update.install"), links, closable: true);
@@ -1638,7 +1684,10 @@ private async Task InstallUpdateAsync(AppRelease release)
var retry = new HyperlinkButton { Content = Loc.T("update.retry"), Padding = new Thickness(0, 2, 0, 2), Margin = new Thickness(0, 0, 0, 8) };
AutomationProperties.SetAutomationId(retry, "InstallUpdateButton");
retry.Click += (_, _) => _ = InstallUpdateAsync(release);
+ // Too important to wait behind a dot: the user mustn't close Queueify without reading it.
+ GoTo(Page.Help);
ShowUpdateBar(InfoBarSeverity.Error, Loc.F("update.start_failed", release.Version), releases, retry, closable: false);
+ DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () => UpdateBar.StartBringIntoView());
break;
}
case Restart.NotStarted:
@@ -1691,6 +1740,12 @@ private void ShowUpdateBar(InfoBarSeverity severity, string message, Microsoft.U
UpdateBar.Content = content;
UpdateBar.IsClosable = closable;
UpdateBar.IsOpen = true;
+ // A problem while the user is on another page: the dot comes back, and a note says what happened.
+ if (_page != Page.Help && severity is InfoBarSeverity.Warning or InfoBarSeverity.Error)
+ {
+ SetUpdateBadge(true, problem: true);
+ ShowUpdateToast(message, severity);
+ }
// Opening, the bar announces itself; later states are said here.
if (wasOpen) Announce(UpdateBar, message);
// Only grows while open, so the page below doesn't jump up and down from one state to the next.
@@ -2126,6 +2181,7 @@ private void UpdateLanguageRestart()
bool pending = Loc.Resolve(_ui.Language, Loc.WindowsLanguage) != Loc.Language;
LanguageRestartInfo.ActionButton = pending ? RestartButton() : null;
LanguageRestartInfo.IsOpen = pending;
+ LanguageRow.RowSpacing = pending ? 12 : 0;
}
private void ApplyTheme()
diff --git a/README.md b/README.md
index e5354b9..c524be5 100644
--- a/README.md
+++ b/README.md
@@ -26,10 +26,10 @@ you've heard it, rate it, move on.
Windows 10 (version 2004 or later) or Windows 11, 64-bit. Nothing else to install. Windows SmartScreen may
warn the first time because the app isn't signed: *More info → Run anyway*. The first start of each
-version takes a moment longer: the exe unpacks the app into `%LOCALAPPDATA%\Queueify\app` (about 70 MB)
+version takes a moment longer, behind a small loading screen: the exe unpacks the app into `%LOCALAPPDATA%\Queueify\app` (about 70 MB)
and runs it from there. The copy of the previous version is removed by itself.
-**Updates**: when a new version is out, a bar under the page title offers it. *Update and restart*
+**Updates**: when a new version is out, a dot appears on Help, and Help → About offers it. *Update and restart*
downloads it, checks it against the release and puts it in place of your exe, under the same name. Help →
About → *Check for updates* asks right away; *Skip this version* stops one version from being offered at start; Settings → Updates turns off the check at start. (From 1.3.0 or
earlier, download 1.4.0 by hand once.)
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 2d2cf73..428b54e 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -32,7 +32,7 @@ flowchart LR
| --- | --- |
| `Queueify\` | The window: navigation, pages (To listen, Listened, Magazine photo, Help, Settings), dialogs, quick tour, theme, assets. `Tr.cs` is the `{l:Tr Key=…}` markup extension. |
| `Queueify.Core\` | Everything that isn't UI. No WinUI references, so it's tested directly. |
-| `Queueify.Launcher\` | The download's starter: `Bundle` (append, read and unpack the app, with `X86Filter` and the LZMA SDK in `Lzma\`) and `Program` (unpack, start the app with `QUEUEIFY_EXE`, remove older versions). No WinUI. |
+| `Queueify.Launcher\` | The download's starter: `Bundle` (append, read and unpack the app, with `X86Filter` and the LZMA SDK in `Lzma\`) and `Program` (unpack, start the app with `QUEUEIFY_EXE`, remove older versions), with `LoadingScreen` (plain Win32) covering the wait. No WinUI. |
| `Queueify.Tests\` | xUnit v3 tests for Core and the starter's `Bundle` and `X86Filter`, on Microsoft Testing Platform. |
| `tests\ui\` | PowerShell + Windows UI Automation tests that drive the published app. |
| `tests\tools\` | Tests for the release tool. |
diff --git a/docs/adr/0008-native-aot-and-a-starter-exe.md b/docs/adr/0008-native-aot-and-a-starter-exe.md
index 89aa9a4..2c45383 100644
--- a/docs/adr/0008-native-aot-and-a-starter-exe.md
+++ b/docs/adr/0008-native-aot-and-a-starter-exe.md
@@ -51,7 +51,9 @@ into the exe and which a PC without the runtime must get from the download.
- One 17.6 MB exe (from 35 MB, and 93 MB in 1.1.0), nothing to install. The first start of a version takes
about 5 s (unpacking about 70 MB, held in memory with the 64 MB dictionary while it decompresses); later
- starts skip it.
+ starts skip it. The starter shows a small loading screen meanwhile (`LoadingScreen`, plain Win32: icon, name,
+ "Getting Queueify ready…"), until the app's window opens; on a start that needs no unpacking, only if the
+ window takes over 0.6 s, so it never flashes.
- Building needs Visual Studio's C++ build tools, and a release build takes about 4 minutes (AOT, and a
minute of LZMA). GitHub's Windows runners have them.
- `crash.log` stack traces name methods but have no file and line (the symbols would be a 50 MB file).
diff --git a/docs/adr/0009-update-from-github-releases.md b/docs/adr/0009-update-from-github-releases.md
index 3059d76..50c2e85 100644
--- a/docs/adr/0009-update-from-github-releases.md
+++ b/docs/adr/0009-update-from-github-releases.md
@@ -16,7 +16,10 @@ and while the app runs nothing has that exe open: the starter unpacks the app, s
skips drafts and pre-releases). It's offered only when its version is higher and it has an asset named
`Queueify--win-x64.exe` under `https://github.com/PAumedes/Queueify/releases/download/` with a
`sha256:` digest (GitHub computes one for every release asset).
-- The offer is a bar under the page title, in a row of its own. Nothing is downloaded until the user clicks
+- Found at start, it shows as a dot on Help (an InfoBadge, as Windows' guidance suggests for updates;
+ Narrator reads "Help, new version available"); the offer itself, and everything that follows, is in Help →
+ About, never over the pages. (1.4.0's first design put a bar under every page title: too big, and in the
+ way.) Nothing is downloaded until the user clicks
**Update and restart**. Then the exe is downloaded next to the one the user started, always into a new
file (`.download`; a file already there is removed first, and if it can't be, nothing is updated; at
most 256 MB; a download that sends nothing for 30 s gives up, a slow one doesn't, and **Cancel** stops
diff --git a/tests/ui/Queueify.SyncUiTests.ps1 b/tests/ui/Queueify.SyncUiTests.ps1
index fc22a62..d3045d5 100644
--- a/tests/ui/Queueify.SyncUiTests.ps1
+++ b/tests/ui/Queueify.SyncUiTests.ps1
@@ -43,8 +43,10 @@ $realLocalAppData = $env:LOCALAPPDATA
$env:LOCALAPPDATA = Join-Path ([System.IO.Path]::GetTempPath()) ("queueify-uitest-local-" + [guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Force $env:LOCALAPPDATA | Out-Null
$appCache = Join-Path $env:LOCALAPPDATA 'Queueify\app'
+# The download (a starter) shows its own loading screen while it unpacks; only the app it starts counts.
+$isStarter = [System.Text.Encoding]::ASCII.GetString([System.IO.File]::ReadAllBytes($Exe), (Get-Item $Exe).Length - 8, 8) -like 'QFYAPP*'
function Get-AppProcess {
- Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.Path -and ($_.Path -eq $Exe -or $_.Path.StartsWith("$appCache\", [StringComparison]::OrdinalIgnoreCase)) }
+ Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.Path -and (($_.Path -eq $Exe -and -not $isStarter) -or $_.Path.StartsWith("$appCache\", [StringComparison]::OrdinalIgnoreCase)) }
}
function Stop-TestApp {
Get-AppProcess | ForEach-Object { $_.Kill(); $_.WaitForExit(10000) | Out-Null }
diff --git a/tests/ui/Queueify.UiTests.ps1 b/tests/ui/Queueify.UiTests.ps1
index 80d0c8e..addf5f8 100644
--- a/tests/ui/Queueify.UiTests.ps1
+++ b/tests/ui/Queueify.UiTests.ps1
@@ -27,8 +27,10 @@ $realLocalAppData = $env:LOCALAPPDATA
$env:LOCALAPPDATA = Join-Path ([System.IO.Path]::GetTempPath()) ("queueify-uitest-local-" + [guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Force $env:LOCALAPPDATA | Out-Null
$appCache = Join-Path $env:LOCALAPPDATA 'Queueify\app'
+# The download (a starter) shows its own loading screen while it unpacks; only the app it starts counts.
+$isStarter = [System.Text.Encoding]::ASCII.GetString([System.IO.File]::ReadAllBytes($Exe), (Get-Item $Exe).Length - 8, 8) -like 'QFYAPP*'
function Get-AppProcess {
- Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.Path -and ($_.Path -eq $Exe -or $_.Path.StartsWith("$appCache\", [StringComparison]::OrdinalIgnoreCase)) }
+ Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.Path -and (($_.Path -eq $Exe -and -not $isStarter) -or $_.Path.StartsWith("$appCache\", [StringComparison]::OrdinalIgnoreCase)) }
}
function Start-App {
@@ -153,7 +155,11 @@ Check ($null -ne (Find 'Saved with every album*' 'Text')) 'the magazine field sa
Check ($null -ne $magazineTitle -and $null -ne $searchTitle -and
$searchTitle.Current.BoundingRectangle.Top -lt $magazineTitle.Current.BoundingRectangle.Top) `
'the search comes first; the optional magazine field is below it'
-
+# With nothing to report, the line for search results takes no room: the fields sit close together.
+$searchEdit = Find 'Find an album' 'Edit'
+$gap = if ($searchEdit -and $magazineTitle) { $magazineTitle.Current.BoundingRectangle.Top - $searchEdit.Current.BoundingRectangle.Bottom } else { 999 }
+# (What's left is the field title's own spacing: 25 px here at 150 %; an empty status line made it 45.)
+Check ($gap -lt 30) "no empty gap between the search and the magazine field ($gap px)"
# ── Every button says what it does ──
$unnamed = All | Where-Object {
$_.Current.ControlType.ProgrammaticName -in 'ControlType.Button', 'ControlType.SplitButton' -and
@@ -298,6 +304,13 @@ Check ($installed.Length -gt 0) "installed text recognition languages are listed
Check ($null -ne (FindId 'OcrInstallBox') -and $null -ne (FindId 'OcrInstallButton')) 'more languages can be installed'
Check ($null -ne (Find 'Windows language settings' 'Hyperlink')) 'a way out to Windows language settings'
+# Every settings row is as tall as the next: the Theme, Language and Layout controls (each centred in its
+# row) are equally spaced. Scrolled to the end of the page, so all three are on screen.
+(FindId 'SettingsPanel').GetCurrentPattern([System.Windows.Automation.ScrollPattern]::Pattern).SetScrollPercent(-1, 100); Start-Sleep 1
+$resetLayout = Find 'Reset layout' 'Button'
+$centres = (FindId 'ThemeBox'), (FindId 'LanguageBox'), $resetLayout | ForEach-Object { $r = $_.Current.BoundingRectangle; $r.Top + $r.Height / 2 }
+# (Layout's longer caption may wrap and add a few pixels; the spacing kept for a hidden note added 12 and more.)
+Check ([math]::Abs(($centres[1] - $centres[0]) - ($centres[2] - $centres[1])) -le 8) "settings rows are the same height ($($centres -join ', '))"
$theme = FindId 'ThemeBox'
$theme.GetCurrentPattern([System.Windows.Automation.ExpandCollapsePattern]::Pattern).Expand()
Start-Sleep 1
@@ -320,6 +333,8 @@ Start-App
Select-Item (Find 'Settings*' 'ListItem')
Check ($null -eq (Find 'Restart Queueify' 'Button')) 'no restart offered while the language is unchanged'
$languageBox = FindId 'LanguageBox'
+# On screen first (focus scrolls to it): a dropdown below the window's edge doesn't open.
+$languageBox.SetFocus(); Start-Sleep -Milliseconds 500
$languageBox.GetCurrentPattern([System.Windows.Automation.ExpandCollapsePattern]::Pattern).Expand()
Start-Sleep 1
Select-Item (Find 'Español' 'ListItem')
diff --git a/tests/ui/Queueify.UpdateUiTests.ps1 b/tests/ui/Queueify.UpdateUiTests.ps1
index 7501a25..84516f4 100644
--- a/tests/ui/Queueify.UpdateUiTests.ps1
+++ b/tests/ui/Queueify.UpdateUiTests.ps1
@@ -1,4 +1,4 @@
-# UI tests for updating Queueify from inside the app, driven through Windows UI Automation.
+# UI tests for updating Queueify from inside the app, driven through Windows UI Automation.
#
# powershell -ExecutionPolicy Bypass -File tests\ui\Queueify.UpdateUiTests.ps1 -Exe
#
@@ -109,16 +109,21 @@ function Offer([string]$version, [string]$digest) {
try {
-# ── The offer never squeezes the page: a narrow window with the panel open (1.4.0's first try put the bar
-# beside the title, which then wrapped a letter per line) ──
+# ── Found at the start: a dot on Help, and the offer itself in Help → About, nowhere else ──
+function Open-Help { Select-Item (Find 'Help*' 'ListItem'); Start-Sleep 1 }
+function Badge { Find 'Help, new version available' 'ListItem' }
'{ "Language": "en", "TourSeen": true, "PaneVisible": true, "WindowBounds": [50, 50, 1100, 700] }' | Set-Content -Encoding UTF8 (Join-Path $env:LOCALAPPDATA 'Queueify\ui.json')
Offer '99.0.0' ('0' * 64)
Start-App
Check ($null -ne $script:root) 'Queueify starts from the copy'
-Check ($null -ne (Wait-Find '*new version is out: Queueify 99.0.0*')) 'a newer release is offered at the start'
-$title = (FindId 'PageTitle').Current.BoundingRectangle
-Check (-not $title.IsEmpty -and $title.Height -lt 60 -and $title.Width -gt 100) "the page title keeps its line beside the offer ($($title.Width) x $($title.Height))"
-Check ((Find 'Find an album' 'Edit').Current.HasKeyboardFocus) 'the offer leaves the keyboard in the search box'
+$badge = $null
+for ($i = 0; $i -lt 30 -and -not $badge; $i++) { Start-Sleep -Milliseconds 500; $badge = Badge }
+Check ($null -ne $badge) 'a newer release shows as a dot on Help'
+Check ($null -ne (Find '*new version is out: Queueify 99.0.0*') -and $null -ne (Find 'Show' 'Button')) 'and a short note at the bottom, with Show'
+Check ((Find 'Find an album' 'Edit').Current.HasKeyboardFocus) 'the keyboard stays in the search box'
+Open-Help
+Check ($null -ne (Wait-Find '*new version is out: Queueify 99.0.0*')) 'Help → About offers it'
+Check ($null -eq (Badge) -and $null -ne (Find 'Help' 'ListItem')) 'opening Help clears the dot'
# ── A download that doesn't match the release is refused, the exe stays, and it can be tried again ──
$stamp = (Get-Item $copy).LastWriteTimeUtc
@@ -133,12 +138,28 @@ Check ($null -ne $retry -and $retry.Current.Name -eq 'Try again' -and $retry.Cur
Stop-App
+# ── A result that comes while the user is elsewhere still reaches them: the dot comes back, and a note ──
+Offer '99.0.0' ('0' * 64)
+$routes['/Queueify-99.0.0-win-x64.exe'].Delay = 3000
+Start-App
+Open-Help
+Invoke (FindId 'InstallUpdateButton')
+Select-Item (Find 'To listen*' 'ListItem')
+$problem = $null
+for ($i = 0; $i -lt 40 -and -not $problem; $i++) { Start-Sleep -Milliseconds 500; $problem = Find 'Help, there''s a problem with the update' 'ListItem' }
+Check ($null -ne $problem) 'a failure found on another page puts the dot back on Help'
+Check ($null -ne (Find "*doesn't match the release*")) 'and a note says what happened'
+Open-Help
+Check ($null -ne (Find "*doesn't match the release*") -and $null -ne (FindId 'InstallUpdateButton')) 'Help shows it, with Try again'
+Stop-App
+
# ── A download that fails can be tried again; then the new exe takes the old one's place, and Queueify
# restarts through it without a moment with no window ──
Offer '99.0.0' $sha256
# Slow to fail, so there's time to go back to adding albums meanwhile.
$routes['/Queueify-99.0.0-win-x64.exe'] = @{ Status = '404 Not Found'; Delay = 3000; Type = 'text/plain'; Body = [byte[]]@() }
Start-App
+Open-Help
Invoke (FindId 'InstallUpdateButton')
(Find 'Find an album' 'Edit').SetFocus()
Check ($null -ne (Wait-Find '*GitHub answered with an error (404)*')) 'a failed download says so'
@@ -167,8 +188,8 @@ Stop-App
$version = (Get-Item $Exe).VersionInfo.FileVersion -replace '^(\d+\.\d+\.\d+).*', '$1'
Offer $version $sha256
Start-App
-Check ($null -eq (Find '*new version is out*')) 'no offer when this is the latest version'
-Select-Item (Find 'Help*' 'ListItem')
+Check ($null -eq (Badge)) 'no dot on Help when this is the latest version'
+Open-Help
Invoke (FindId 'CheckUpdatesButton')
Check ($null -ne (Wait-Find 'You have the latest version.')) 'About: checking says this is the latest version'
Stop-App
@@ -182,8 +203,8 @@ $toggle.GetCurrentPattern([System.Windows.Automation.TogglePattern]::Pattern).To
Stop-App
Start-App
Start-Sleep 3
-Check ($null -eq (Find '*new version is out*')) 'with checks turned off, nothing is offered at the start'
-Select-Item (Find 'Help*' 'ListItem')
+Check ($null -eq (Badge)) 'with checks turned off, nothing is offered at the start'
+Open-Help
Invoke (FindId 'CheckUpdatesButton')
Check ($null -ne (Wait-Find '*new version is out: Queueify 99.0.0*')) 'checking by hand still finds it'
Stop-App
@@ -193,13 +214,14 @@ Stop-App
# ── Skip this version: not offered at the next start, still found by Check for updates ──
Offer '99.0.0' $sha256
Start-App
+Open-Help
Invoke (FindId 'SkipUpdateButton')
Check ($null -eq (Find '*new version is out*')) 'Skip this version closes the offer'
Stop-App
Start-App
Start-Sleep 3
-Check ($null -eq (Find '*new version is out*')) 'a skipped version is not offered at the next start'
-Select-Item (Find 'Help*' 'ListItem')
+Check ($null -eq (Badge)) 'a skipped version is not offered at the next start'
+Open-Help
Invoke (FindId 'CheckUpdatesButton')
Check ($null -ne (Wait-Find '*new version is out: Queueify 99.0.0*')) 'Check for updates still offers a skipped version'
Stop-App
@@ -213,6 +235,7 @@ $broken[$broken.Length - 1] = $broken[$broken.Length - 1] -bxor 0x40
$newExe = $broken
Offer '99.0.0' ([System.BitConverter]::ToString([System.Security.Cryptography.SHA256]::Create().ComputeHash($broken)).Replace('-', '').ToLowerInvariant())
Start-App
+Open-Help
$before = @(Get-AppProcess | ForEach-Object Id)
Invoke (FindId 'InstallUpdateButton')
# The starter's own message box: read it and press OK.
@@ -226,7 +249,8 @@ if ($box) { Invoke ($box.FindAll($Tree::Descendants, $Cond::TrueCondition) | Whe
Check ($null -ne (Wait-Find "*is in place but didn't start, so your Queueify exe won't open*")) 'this window stays and says the new version did not start'
Check ($null -ne (Find 'Releases page' 'Button')) 'the releases page comes first'
Check ($null -ne (FindId 'InstallUpdateButton') -and (FindId 'InstallUpdateButton').Current.Name -eq 'Try again') 'and offers to download it again'
-Check (@(Get-AppProcess | Where-Object { $_.Id -notin $before }).Count -eq 0) 'no second Queueify started'}
+Check (@(Get-AppProcess | Where-Object { $_.Id -notin $before }).Count -eq 0) 'no second Queueify started'
+}
finally {
Stop-App
$listener.Stop()
diff --git a/tools/package.ps1 b/tools/package.ps1
index 70da0b2..b8cfd9a 100644
--- a/tools/package.ps1
+++ b/tools/package.ps1
@@ -64,6 +64,7 @@ namespace QueueifySmoke {
[StructLayout(LayoutKind.Sequential)] struct PropertyKey { public Guid FormatId; public uint Pid; }
[StructLayout(LayoutKind.Explicit, Size = 24)] struct PropVariant { [FieldOffset(0)] public ushort Type; [FieldOffset(8)] public IntPtr Pointer; }
public static class Window {
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindow(string className, string title);
[DllImport("shell32.dll")] static extern int SHGetPropertyStoreForWindow(IntPtr hwnd, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IPropertyStore store);
public static string RelaunchCommand(IntPtr hwnd) {
var iid = typeof(IPropertyStore).GUID; IPropertyStore store;
@@ -85,8 +86,11 @@ try {
$starter = Start-Process "$smoke\app\Queueify (1).exe" -PassThru
$cache = "$smoke\local\Queueify\app\"
# Up means a window: a crash before .NET starts writes no crash log and may linger in error reporting.
- for ($i = 0; $i -lt 60 -and -not $app; $i++) {
- Start-Sleep -Milliseconds 500
+ # A first start unpacks for a few seconds behind the starter's loading screen.
+ $sawLoading = $false
+ for ($i = 0; $i -lt 300 -and -not $app; $i++) {
+ Start-Sleep -Milliseconds 100
+ if ([QueueifySmoke.Window]::FindWindow('QueueifyLoading', [NullString]::Value) -ne [IntPtr]::Zero) { $sawLoading = $true }
$app = Get-Process Queueify -ErrorAction SilentlyContinue |
Where-Object { $_.Path -and $_.Path.StartsWith($cache, [StringComparison]::OrdinalIgnoreCase) -and $_.MainWindowHandle -ne 0 } |
Select-Object -First 1
@@ -97,6 +101,8 @@ try {
$why = if (Test-Path $crash) { Get-Content -Raw $crash } elseif ($starterExit -ne 0) { "the starter ended with $starterExit" } else { 'no window after 30 s' }
throw "The downloadable exe doesn't start: $why"
}
+ if (-not $sawLoading) { throw "No loading screen while the first start unpacked the app." }
+ if ([QueueifySmoke.Window]::FindWindow('QueueifyLoading', [NullString]::Value) -ne [IntPtr]::Zero) { throw "The loading screen stayed after the app's window opened." }
if ((Test-Path "$smoke\app\Data") -or -not (Test-Path "$smoke\local\Queueify\queueify.db")) {
throw "The downloadable exe should keep its data in %LOCALAPPDATA%\Queueify, not next to itself."
}