mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 06:27:21 +00:00
Added a setting to change the size of the interface (#1136)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
c2b62c6dbd
commit
e0337a99bc
27 files changed
+1742
-27
No files matched your search
@@ -66,6 +66,49 @@ public sealed class DataApp(Expression<Func<Data, DataApp>>? configSelection = n
|
||||
/// </summary>
|
||||
public StartPage StartPage { get; set; } = ManagedConfiguration.Register(configSelection, n => n.StartPage, StartPage.HOME);
|
||||
|
||||
/// <summary>
|
||||
/// How large AI Studio shows its interface on the screens the user chose a size for, the most
|
||||
/// recently set first.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Kept per screen, as the operating systems keep their scaling per monitor: a laptop calls for
|
||||
/// another size than an external monitor, and the same scale looks different on screens of
|
||||
/// different densities. A screen missing here gets InterfaceSize.APP_DEFAULT when it is the
|
||||
/// screen of a laptop, and InterfaceSize.SYSTEM_SCALING otherwise. The
|
||||
/// user's own, like the scaling of the operating system: no configuration plugin manages it.
|
||||
/// </remarks>
|
||||
public List<InterfaceScreenSize> InterfaceScreenSizes { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// How many screens keep their interface size. Setting the size of one more forgets the screen
|
||||
/// whose size was set the longest time ago, which then gets its default size again.
|
||||
/// </summary>
|
||||
public const int MAX_REMEMBERED_INTERFACE_SCREENS = 20;
|
||||
|
||||
/// <summary>
|
||||
/// What the user chose for the given screen, or null when they chose nothing for it.
|
||||
/// </summary>
|
||||
/// <param name="screenKey">The screen, as the runtime names it.</param>
|
||||
public InterfaceScreenSize? GetInterfaceScreenSize(string screenKey) => this.InterfaceScreenSizes.FirstOrDefault(screen => screen.ScreenKey == screenKey);
|
||||
|
||||
/// <summary>
|
||||
/// Remembers what the user chose for a screen, as the most recently set one.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Keeps MAX_REMEMBERED_INTERFACE_SCREENS screens at most and forgets the ones beyond, those whose
|
||||
/// size was set the longest time ago. Replaces the list instead of changing it, since the
|
||||
/// InterfaceSizeService may read it at the same time.
|
||||
/// </remarks>
|
||||
/// <param name="screenSize">What the user chose for the screen.</param>
|
||||
public void RememberInterfaceScreenSize(InterfaceScreenSize screenSize)
|
||||
{
|
||||
this.InterfaceScreenSizes = this.InterfaceScreenSizes
|
||||
.Where(screen => screen.ScreenKey != screenSize.ScreenKey)
|
||||
.Prepend(screenSize)
|
||||
.Take(MAX_REMEMBERED_INTERFACE_SCREENS)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether an alert dialog should be shown when prompt-injection content is blocked.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
/// <summary>
|
||||
/// The interface size the user chose for one screen.
|
||||
/// </summary>
|
||||
/// <param name="ScreenKey">The screen, as the runtime names it: its resolution and its physical size, such as "1920x1200@287x179mm".</param>
|
||||
/// <param name="Size">The size on this screen.</param>
|
||||
/// <param name="CustomPercent">The scale of the custom size in percent, counted like the scaling of the operating system, or null when the user never set one for this screen. Kept while another size applies, so that it returns with the custom size.</param>
|
||||
public sealed record InterfaceScreenSize(string ScreenKey, InterfaceSize Size, int? CustomPercent);
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
/// <summary>
|
||||
/// How large AI Studio shows its interface on a screen.
|
||||
/// </summary>
|
||||
public enum InterfaceSize
|
||||
{
|
||||
/// <summary>
|
||||
/// The same size on every laptop, whatever the scaling of its system. The default on the screen
|
||||
/// of a laptop. Larger screens, such as external monitors, and screens which do not report their
|
||||
/// size keep the scaling of the system with it.
|
||||
/// </summary>
|
||||
APP_DEFAULT,
|
||||
|
||||
/// <summary>
|
||||
/// The scaling of the system, unchanged. The default on any screen but the one of a laptop.
|
||||
/// </summary>
|
||||
SYSTEM_SCALING,
|
||||
|
||||
/// <summary>
|
||||
/// A scale of the user's own, see InterfaceScreenSize.CustomPercent.
|
||||
/// </summary>
|
||||
CUSTOM,
|
||||
}
|
||||
Reference in new issue
Block a user