feat: add theme-matching sidebar icon, cover aspect settings and hidden games option
- Sidebar icon follows the theme's colours and hover/selected shades by default; colored, white and black icons can be chosen in the settings - Aspect ratio and stretch mode settings for collection posters and game covers, with presets (DVD Box, Epic, GOG Galaxy 2.0, IGDB, Square, Steam, Twitch) - Option to include hidden games in a dynamic collection, off by default - Bump version to 1.4.0
This commit is contained in:
1 parent
089f3e0f23
commit
792ec393ca
26 files changed
+621
-34
No files matched your search
@@ -3,6 +3,14 @@
|
|||||||
Every release must also be added to [manifests/installer_manifest.yaml](manifests/installer_manifest.yaml),
|
Every release must also be added to [manifests/installer_manifest.yaml](manifests/installer_manifest.yaml),
|
||||||
which is what Playnite reads to offer updates.
|
which is what Playnite reads to offer updates.
|
||||||
|
|
||||||
|
## 1.4.0 – 2026-11-24
|
||||||
|
|
||||||
|
- Changed: The sidebar icon now matches the theme's other icons, including their hover and selected shades. The
|
||||||
|
colored icon, and fixed white and black versions, can be chosen in the settings.
|
||||||
|
- Added: Settings for the aspect ratio and stretch mode of collection posters and of game covers on a collection's
|
||||||
|
page, with presets for common cover shapes such as Steam, GOG Galaxy and DVD boxes.
|
||||||
|
- Added: Option to include hidden games in a dynamic collection. They're still left out by default.
|
||||||
|
|
||||||
## 1.3.0 – 2026-11-06
|
## 1.3.0 – 2026-11-06
|
||||||
|
|
||||||
- Added: Collapse a collection page's header to just its title, game count and dynamic badge.
|
- Added: Collapse a collection page's header to just its title, game count and dynamic badge.
|
||||||
|
|||||||
+17
-1
@@ -117,7 +117,23 @@ Version history: **1** was the initial format (extension 1.0.0); **2** added `Ga
|
|||||||
`GameCollectionsSettings` is saved by Playnite to `config.json`. Add a property using `SetValue`, and bind to
|
`GameCollectionsSettings` is saved by Playnite to `config.json`. Add a property using `SetValue`, and bind to
|
||||||
`Settings.<Name>` in `GameCollectionsSettingsView.xaml`. Mark state that shouldn't be saved with `[DontSerialize]`.
|
`Settings.<Name>` in `GameCollectionsSettingsView.xaml`. Mark state that shouldn't be saved with `[DontSerialize]`.
|
||||||
Themes can read these properties through `{PluginSettings Plugin=GameCollections, Path=<Name>}`.
|
Themes can read these properties through `{PluginSettings Plugin=GameCollections, Path=<Name>}`.
|
||||||
`SettingsChanged` fires after the settings dialog is saved or cancelled.
|
`SettingsChanged` fires after the settings dialog is saved or cancelled. The plugin uses it to swap the sidebar
|
||||||
|
icon and to call `CollectionsRootViewModel.OnDisplaySettingsChanged`, which passes poster and cover changes on to
|
||||||
|
the open pages.
|
||||||
|
|
||||||
|
- **Aspect ratios** are stored as two numbers each (`CollectionPosterAspectWidth/Height`,
|
||||||
|
`GameCoverAspectWidth/Height`). Views read the computed `CollectionPosterRatio` and `GameCoverRatio` (height per
|
||||||
|
unit of width), which fall back to 2:3 for invalid values and are clamped to between 1:4 and 4:1.
|
||||||
|
`VerifySettings` rejects values that aren't greater than 0. The **Presets** menus come from
|
||||||
|
`GameCollectionsSettingsViewModel.Presets` and are built in the settings view's code-behind; picking one sets both
|
||||||
|
numbers.
|
||||||
|
- **Stretch modes** are WPF `Stretch` values, applied by `PosterImage.Stretch` to its image brush.
|
||||||
|
- **Sidebar icons**: `icon-white.png` and `icon-black.png` sit next to `icon.png` and are copied to the output by
|
||||||
|
the `icon*.png` item in the project file. They were made from `icon.png` with the folder solid and the cards
|
||||||
|
behind it in fainter tones, so regenerate them if the icon changes.
|
||||||
|
- **Match theme** (`SidebarIconStyle.Theme`) uses `ThemedSidebarIcon` instead of a path: a rectangle filled with the
|
||||||
|
inherited `Foreground` and masked by `icon-black.png`'s opacity, sized by the inherited font size. Themes change the
|
||||||
|
sidebar button's `Foreground` on hover and selection, so it follows those shades the way font glyph icons do.
|
||||||
|
|
||||||
## Manual order
|
## Manual order
|
||||||
|
|
||||||
|
|||||||
+27
-1
@@ -25,6 +25,31 @@ Click **Collections** in the sidebar. The page keeps its state (open collection,
|
|||||||
|
|
||||||
Deleting a collection never deletes or changes any games.
|
Deleting a collection never deletes or changes any games.
|
||||||
|
|
||||||
|
## Appearance settings
|
||||||
|
|
||||||
|
In the extension's settings (*Add-ons → Extension settings → Generic → Game Collections*):
|
||||||
|
|
||||||
|
- **Sidebar → Icon**: **Match theme** (default) draws the icon in the same colours as the theme's other sidebar
|
||||||
|
icons, including their hover and selected shades. You can also choose the **Colored** icon, or a fixed **White**
|
||||||
|
or **Black** version. It changes as soon as you save.
|
||||||
|
- **Collection posters**: the shape of posters on the Collections page and in a collection's header, as an
|
||||||
|
**aspect ratio** (width : height, default 2 : 3), and the **stretch mode**.
|
||||||
|
- **Game covers on a collection's page**: the same for the game cards. The card size slider sets their width, and
|
||||||
|
the ratio sets their height.
|
||||||
|
|
||||||
|
| Stretch mode | What the image does |
|
||||||
|
|---|---|
|
||||||
|
| None | Keeps its original size, centered. It may be cut off or leave empty space. |
|
||||||
|
| Fill | Fills the shape exactly; the image is squashed or stretched if its shape differs. |
|
||||||
|
| Uniform | Fits inside the shape without being cut off, leaving empty space at the sides or top and bottom. |
|
||||||
|
| Uniform to fill (default) | Covers the shape without distortion, cutting off whatever doesn't fit. |
|
||||||
|
|
||||||
|
Ratios can be decimals, such as 1.85 : 1. Very thin or tall shapes are limited to between 4 : 1 and 1 : 4.
|
||||||
|
|
||||||
|
**Presets**, next to each ratio, fills in a common shape: DVD Box (27 : 38), Epic Games Store (3 : 4),
|
||||||
|
GOG Galaxy 2.0 (22 : 31), IGDB (3 : 4), Square (1 : 1), Steam Banner (92 : 43), Steam Vertical Cover (2 : 3) or
|
||||||
|
Twitch (3 : 4). The preset matching the current ratio is ticked.
|
||||||
|
|
||||||
## Creating and editing a collection
|
## Creating and editing a collection
|
||||||
|
|
||||||
| Field | Notes |
|
| Field | Notes |
|
||||||
@@ -46,7 +71,8 @@ editing a collection.
|
|||||||
- Between blocks, choose **AND** or **OR**. Blocks combine from top to bottom, so
|
- Between blocks, choose **AND** or **OR**. Blocks combine from top to bottom, so
|
||||||
*A OR B AND C* means *(A or B) and C*.
|
*A OR B AND C* means *(A or B) and C*.
|
||||||
- The bar at the bottom shows how many games currently match, and some of their names.
|
- The bar at the bottom shows how many games currently match, and some of their names.
|
||||||
- Hidden games are never included.
|
- Games hidden in Playnite are left out unless you tick **Include hidden games** below the blocks. When it's on,
|
||||||
|
the collection's rules summary says *(including hidden games)*. Hiding or unhiding a game updates the collection.
|
||||||
|
|
||||||
| You can filter by | Conditions |
|
| You can filter by | Conditions |
|
||||||
|---|---|
|
|---|---|
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
AddonId: GameCollections_3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54
|
AddonId: GameCollections_3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54
|
||||||
Packages:
|
Packages:
|
||||||
|
- Version: 1.4.0
|
||||||
|
RequiredApiVersion: 6.11.0
|
||||||
|
ReleaseDate: 2026-11-24
|
||||||
|
PackageUrl: https://github.com/X4Lo/GameCollections/releases/download/v1.4.0/GameCollections_3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54_1_4_0.pext
|
||||||
|
Changelog:
|
||||||
|
- 'Changed: Sidebar icon matches the theme''s other icons, including hover and selected shades'
|
||||||
|
- 'Added: Colored, white and black sidebar icon options'
|
||||||
|
- 'Added: Aspect ratio and stretch mode settings for collection posters and game covers, with presets'
|
||||||
|
- 'Added: Option to include hidden games in a dynamic collection'
|
||||||
- Version: 1.3.0
|
- Version: 1.3.0
|
||||||
RequiredApiVersion: 6.11.0
|
RequiredApiVersion: 6.11.0
|
||||||
ReleaseDate: 2026-11-06
|
ReleaseDate: 2026-11-06
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<RootNamespace>GameCollections</RootNamespace>
|
<RootNamespace>GameCollections</RootNamespace>
|
||||||
<AssemblyName>GameCollections</AssemblyName>
|
<AssemblyName>GameCollections</AssemblyName>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<Version>1.3.0</Version>
|
<Version>1.4.0</Version>
|
||||||
<Product>Game Collections</Product>
|
<Product>Game Collections</Product>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
@@ -26,7 +26,8 @@
|
|||||||
<Page Remove="Localization\*.xaml" />
|
<Page Remove="Localization\*.xaml" />
|
||||||
<None Include="Localization\*.xaml" CopyToOutputDirectory="PreserveNewest" />
|
<None Include="Localization\*.xaml" CopyToOutputDirectory="PreserveNewest" />
|
||||||
<None Update="extension.yaml" CopyToOutputDirectory="PreserveNewest" />
|
<None Update="extension.yaml" CopyToOutputDirectory="PreserveNewest" />
|
||||||
<None Update="icon.png" CopyToOutputDirectory="PreserveNewest" />
|
<!-- icon.png plus the white and black versions offered for the sidebar. -->
|
||||||
|
<None Update="icon*.png" CopyToOutputDirectory="PreserveNewest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Creates an installable .pext package (a zip of the output folder) in <repo>\dist after Release builds.
|
<!-- Creates an installable .pext package (a zip of the output folder) in <repo>\dist after Release builds.
|
||||||
|
|||||||
@@ -50,6 +50,16 @@ namespace GameCollections
|
|||||||
new PosterStorage(Path.Combine(dataDirectory, "Posters")));
|
new PosterStorage(Path.Combine(dataDirectory, "Posters")));
|
||||||
dialogs = new DialogService(api, manager);
|
dialogs = new DialogService(api, manager);
|
||||||
|
|
||||||
|
settings.SettingsChanged += (s, e) =>
|
||||||
|
{
|
||||||
|
if (sidebarItem != null)
|
||||||
|
{
|
||||||
|
sidebarItem.Icon = GetSidebarIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
rootViewModel?.OnDisplaySettingsChanged();
|
||||||
|
};
|
||||||
|
|
||||||
AddSettingsSupport(new AddSettingsSupportArgs
|
AddSettingsSupport(new AddSettingsSupportArgs
|
||||||
{
|
{
|
||||||
SourceName = SourceName,
|
SourceName = SourceName,
|
||||||
@@ -168,7 +178,7 @@ namespace GameCollections
|
|||||||
{
|
{
|
||||||
Title = Loc.Get("LOCGameCollections_SidebarTitle"),
|
Title = Loc.Get("LOCGameCollections_SidebarTitle"),
|
||||||
Type = SiderbarItemType.View,
|
Type = SiderbarItemType.View,
|
||||||
Icon = Path.Combine(GetPluginDirectory(), "icon.png"),
|
Icon = GetSidebarIcon(),
|
||||||
// A new view is built on every open, while the view model (current page, search,
|
// A new view is built on every open, while the view model (current page, search,
|
||||||
// sort) persists so the user returns to where they left off.
|
// sort) persists so the user returns to where they left off.
|
||||||
Opened = () =>
|
Opened = () =>
|
||||||
@@ -287,6 +297,49 @@ namespace GameCollections
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The icon version chosen in the settings: the colored icon, or a white or black one that suits themes
|
||||||
|
/// with monochrome sidebar icons.
|
||||||
|
/// </summary>
|
||||||
|
// A path for the picture icons, or a control drawn in the theme's colours for Match theme.
|
||||||
|
private object GetSidebarIcon()
|
||||||
|
{
|
||||||
|
var colored = Path.Combine(GetPluginDirectory(), "icon.png");
|
||||||
|
string file;
|
||||||
|
switch (settings.Settings.SidebarIcon)
|
||||||
|
{
|
||||||
|
case SidebarIconStyle.Theme:
|
||||||
|
// Only the black icon's opacity is used, as the shape to paint.
|
||||||
|
var mask = Path.Combine(GetPluginDirectory(), "icon-black.png");
|
||||||
|
if (!File.Exists(mask))
|
||||||
|
{
|
||||||
|
return colored;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ThemedSidebarIcon.Create(mask);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.Error(e, "Failed to create the theme-coloured sidebar icon.");
|
||||||
|
return colored;
|
||||||
|
}
|
||||||
|
case SidebarIconStyle.White:
|
||||||
|
file = "icon-white.png";
|
||||||
|
break;
|
||||||
|
case SidebarIconStyle.Black:
|
||||||
|
file = "icon-black.png";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
file = "icon.png";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var path = Path.Combine(GetPluginDirectory(), file);
|
||||||
|
return File.Exists(path) ? path : colored;
|
||||||
|
}
|
||||||
|
|
||||||
private static string GetPluginDirectory()
|
private static string GetPluginDirectory()
|
||||||
{
|
{
|
||||||
return Path.GetDirectoryName(typeof(GameCollectionsPlugin).Assembly.Location);
|
return Path.GetDirectoryName(typeof(GameCollectionsPlugin).Assembly.Location);
|
||||||
|
|||||||
@@ -95,7 +95,10 @@
|
|||||||
<sys:String x:Key="LOCGameCollections_RuleRemoveBlock">Remove block</sys:String>
|
<sys:String x:Key="LOCGameCollections_RuleRemoveBlock">Remove block</sys:String>
|
||||||
<sys:String x:Key="LOCGameCollections_RuleJoinAnd">AND</sys:String>
|
<sys:String x:Key="LOCGameCollections_RuleJoinAnd">AND</sys:String>
|
||||||
<sys:String x:Key="LOCGameCollections_RuleJoinOr">OR</sys:String>
|
<sys:String x:Key="LOCGameCollections_RuleJoinOr">OR</sys:String>
|
||||||
<sys:String x:Key="LOCGameCollections_RuleOrderHint">Blocks are combined in order, from top to bottom. Hidden games are never included.</sys:String>
|
<sys:String x:Key="LOCGameCollections_RuleOrderHint">Blocks are combined in order, from top to bottom.</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_RuleIncludeHidden">Include hidden games</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_RuleIncludeHiddenTooltip">When off, games hidden in Playnite are left out even if they match the rules.</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_RuleIncludesHiddenSuffix">(including hidden games)</sys:String>
|
||||||
<sys:String x:Key="LOCGameCollections_RuleAnd">and</sys:String>
|
<sys:String x:Key="LOCGameCollections_RuleAnd">and</sys:String>
|
||||||
<sys:String x:Key="LOCGameCollections_RuleOr">or</sys:String>
|
<sys:String x:Key="LOCGameCollections_RuleOr">or</sys:String>
|
||||||
<sys:String x:Key="LOCGameCollections_RuleFieldLabel">Field</sys:String>
|
<sys:String x:Key="LOCGameCollections_RuleFieldLabel">Field</sys:String>
|
||||||
@@ -178,6 +181,36 @@
|
|||||||
<sys:String x:Key="LOCGameCollections_SettingThemeSpecificPlacement">Use special placement for Stardust, Nova X, Helium and Harmony</sys:String>
|
<sys:String x:Key="LOCGameCollections_SettingThemeSpecificPlacement">Use special placement for Stardust, Nova X, Helium and Harmony</sys:String>
|
||||||
<sys:String x:Key="LOCGameCollections_SettingThemeSpecificPlacementHint">Temporary fix. These themes don't have a normal spot for the list, so it goes next to their Game Relations section instead. No effect in other themes.</sys:String>
|
<sys:String x:Key="LOCGameCollections_SettingThemeSpecificPlacementHint">Temporary fix. These themes don't have a normal spot for the list, so it goes next to their Game Relations section instead. No effect in other themes.</sys:String>
|
||||||
<sys:String x:Key="LOCGameCollections_SettingAddListToAnyThemeHint">Adds the list below the game description. Turn this off if it looks wrong in your theme.</sys:String>
|
<sys:String x:Key="LOCGameCollections_SettingAddListToAnyThemeHint">Adds the list below the game description. Turn this off if it looks wrong in your theme.</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingSectionSidebar">Sidebar</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingSidebarIcon">Icon</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingIconColored">Colored</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingIconTheme">Match theme</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingIconWhite">White</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingIconBlack">Black</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingSectionCollectionPosters">Collection posters</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingCollectionPostersHint">Used on the Collections page and in a collection's header.</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingSectionGameCovers">Game covers on a collection's page</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingGameCoversHint">The card size slider on a collection's page sets the width; the height follows this ratio.</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingSectionDetails">Game details view</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingAspectRatio">Aspect ratio (width : height)</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingAspectWidth">Aspect ratio width</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingAspectHeight">Aspect ratio height</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_AspectPresets">Presets</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_PresetDvdBox">DVD Box</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_PresetEpic">Epic Games Store</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_PresetGog">GOG Galaxy 2.0</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_PresetIgdb">IGDB</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_PresetSquare">Square</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_PresetSteamBanner">Steam Banner</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_PresetSteamCover">Steam Vertical Cover</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_PresetTwitch">Twitch</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingStretchMode">Stretch mode</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_StretchNone">None</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_StretchFill">Fill</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_StretchUniform">Uniform</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_StretchUniformToFill">Uniform to fill</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingCollectionAspectInvalid">The collection poster aspect ratio needs two numbers greater than 0.</sys:String>
|
||||||
|
<sys:String x:Key="LOCGameCollections_SettingGameAspectInvalid">The game cover aspect ratio needs two numbers greater than 0.</sys:String>
|
||||||
|
|
||||||
<!-- Opening a collection from game details -->
|
<!-- Opening a collection from game details -->
|
||||||
<sys:String x:Key="LOCGameCollections_OpenInCollections">Open in Collections</sys:String>
|
<sys:String x:Key="LOCGameCollections_OpenInCollections">Open in Collections</sys:String>
|
||||||
|
|||||||
@@ -129,5 +129,11 @@ namespace GameCollections.Models
|
|||||||
public class DynamicRules
|
public class DynamicRules
|
||||||
{
|
{
|
||||||
public List<RuleBlock> Blocks { get; set; } = new List<RuleBlock>();
|
public List<RuleBlock> Blocks { get; set; } = new List<RuleBlock>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether games hidden in Playnite can match. Off by default, as it was before the option existed,
|
||||||
|
/// so older data files need no migration.
|
||||||
|
/// </summary>
|
||||||
|
public bool IncludeHidden { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,8 +139,8 @@ namespace GameCollections.Services
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Builds a predicate for the rules. Blocks are combined strictly from top to bottom, matching how
|
/// Builds a predicate for the rules. Blocks are combined strictly from top to bottom, matching how
|
||||||
/// they read in the editor. Hidden games never match, and neither do damaged or incomplete rules,
|
/// they read in the editor. Hidden games match only when the rules include them. Damaged or incomplete
|
||||||
/// so a broken rule can never fill a collection with the whole library.
|
/// rules never match, so a broken rule can never fill a collection with the whole library.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Func<Game, bool> Compile(DynamicRules rules, DateTime now)
|
public static Func<Game, bool> Compile(DynamicRules rules, DateTime now)
|
||||||
{
|
{
|
||||||
@@ -152,10 +152,11 @@ namespace GameCollections.Services
|
|||||||
var blocks = rules.Blocks
|
var blocks = rules.Blocks
|
||||||
.Select(b => new { b.Join, Test = CompileBlock(b, now) })
|
.Select(b => new { b.Join, Test = CompileBlock(b, now) })
|
||||||
.ToList();
|
.ToList();
|
||||||
|
var includeHidden = rules.IncludeHidden;
|
||||||
|
|
||||||
return game =>
|
return game =>
|
||||||
{
|
{
|
||||||
if (game == null || game.Hidden)
|
if (game == null || (game.Hidden && !includeHidden))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,11 @@ namespace GameCollections.Services
|
|||||||
parts.Add(rules.Blocks.Count > 1 ? "(" + text + ")" : text);
|
parts.Add(rules.Blocks.Count > 1 ? "(" + text + ")" : text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rules.IncludeHidden)
|
||||||
|
{
|
||||||
|
parts.Add(Loc.Get("LOCGameCollections_RuleIncludesHiddenSuffix"));
|
||||||
|
}
|
||||||
|
|
||||||
return string.Join(" ", parts);
|
return string.Join(" ", parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,119 @@
|
|||||||
using GameCollections.Models;
|
using GameCollections.Models;
|
||||||
|
using GameCollections.Services;
|
||||||
using Playnite.SDK;
|
using Playnite.SDK;
|
||||||
using Playnite.SDK.Data;
|
using Playnite.SDK.Data;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace GameCollections.Settings
|
namespace GameCollections.Settings
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Which version of the extension's icon the sidebar shows.
|
||||||
|
/// </summary>
|
||||||
|
public enum SidebarIconStyle
|
||||||
|
{
|
||||||
|
Colored = 0,
|
||||||
|
White = 1,
|
||||||
|
Black = 2,
|
||||||
|
Theme = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A choice in one of the settings view's dropdowns.
|
||||||
|
/// </summary>
|
||||||
|
public class SettingOption
|
||||||
|
{
|
||||||
|
public object Value { get; }
|
||||||
|
public string Label { get; }
|
||||||
|
|
||||||
|
public SettingOption(object value, string label)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
Label = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A common cover shape that fills both aspect ratio fields at once.
|
||||||
|
/// </summary>
|
||||||
|
public class AspectPreset
|
||||||
|
{
|
||||||
|
public string Name { get; }
|
||||||
|
public double Width { get; }
|
||||||
|
public double Height { get; }
|
||||||
|
public string Label => $"{Name} ({Width}:{Height})";
|
||||||
|
|
||||||
|
public AspectPreset(string name, double width, double height)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Width = width;
|
||||||
|
Height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Matches(double width, double height)
|
||||||
|
{
|
||||||
|
return Math.Abs(width - Width) < 1e-9 && Math.Abs(height - Height) < 1e-9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class GameCollectionsSettings : ObservableObject
|
public class GameCollectionsSettings : ObservableObject
|
||||||
{
|
{
|
||||||
|
// Ratios outside this range would make cards absurdly thin or tall.
|
||||||
|
private const double MinAspectRatio = 0.25;
|
||||||
|
private const double MaxAspectRatio = 4;
|
||||||
|
private const double DefaultAspectRatio = 1.5;
|
||||||
|
|
||||||
|
private SidebarIconStyle sidebarIcon = SidebarIconStyle.Theme;
|
||||||
|
public SidebarIconStyle SidebarIcon { get => sidebarIcon; set => SetValue(ref sidebarIcon, value); }
|
||||||
|
|
||||||
|
// Shape of collection posters on the Collections page, as width : height, and how images fill it.
|
||||||
|
private double collectionPosterAspectWidth = 2;
|
||||||
|
public double CollectionPosterAspectWidth { get => collectionPosterAspectWidth; set => SetValue(ref collectionPosterAspectWidth, value); }
|
||||||
|
|
||||||
|
private double collectionPosterAspectHeight = 3;
|
||||||
|
public double CollectionPosterAspectHeight { get => collectionPosterAspectHeight; set => SetValue(ref collectionPosterAspectHeight, value); }
|
||||||
|
|
||||||
|
private Stretch collectionPosterStretch = Stretch.UniformToFill;
|
||||||
|
public Stretch CollectionPosterStretch { get => collectionPosterStretch; set => SetValue(ref collectionPosterStretch, value); }
|
||||||
|
|
||||||
|
// The same for game covers on a collection's page.
|
||||||
|
private double gameCoverAspectWidth = 2;
|
||||||
|
public double GameCoverAspectWidth { get => gameCoverAspectWidth; set => SetValue(ref gameCoverAspectWidth, value); }
|
||||||
|
|
||||||
|
private double gameCoverAspectHeight = 3;
|
||||||
|
public double GameCoverAspectHeight { get => gameCoverAspectHeight; set => SetValue(ref gameCoverAspectHeight, value); }
|
||||||
|
|
||||||
|
private Stretch gameCoverStretch = Stretch.UniformToFill;
|
||||||
|
public Stretch GameCoverStretch { get => gameCoverStretch; set => SetValue(ref gameCoverStretch, value); }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Height of a collection poster per unit of width.
|
||||||
|
/// </summary>
|
||||||
|
[DontSerialize]
|
||||||
|
public double CollectionPosterRatio => Ratio(collectionPosterAspectWidth, collectionPosterAspectHeight);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Height of a game cover per unit of width.
|
||||||
|
/// </summary>
|
||||||
|
[DontSerialize]
|
||||||
|
public double GameCoverRatio => Ratio(gameCoverAspectWidth, gameCoverAspectHeight);
|
||||||
|
|
||||||
|
private static double Ratio(double width, double height)
|
||||||
|
{
|
||||||
|
if (!IsValidAspectValue(width) || !IsValidAspectValue(height))
|
||||||
|
{
|
||||||
|
return DefaultAspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.Max(MinAspectRatio, Math.Min(MaxAspectRatio, height / width));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsValidAspectValue(double value)
|
||||||
|
{
|
||||||
|
return value > 0 && !double.IsInfinity(value) && !double.IsNaN(value);
|
||||||
|
}
|
||||||
|
|
||||||
// Remembered UI state rather than a user-facing option, so it is not shown in the settings view.
|
// Remembered UI state rather than a user-facing option, so it is not shown in the settings view.
|
||||||
private CollectionsViewMode viewMode = CollectionsViewMode.Grid;
|
private CollectionsViewMode viewMode = CollectionsViewMode.Grid;
|
||||||
public CollectionsViewMode ViewMode { get => viewMode; set => SetValue(ref viewMode, value); }
|
public CollectionsViewMode ViewMode { get => viewMode; set => SetValue(ref viewMode, value); }
|
||||||
@@ -52,6 +158,36 @@ namespace GameCollections.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IReadOnlyList<SettingOption> SidebarIconOptions { get; } = new List<SettingOption>
|
||||||
|
{
|
||||||
|
new SettingOption(SidebarIconStyle.Colored, Loc.Get("LOCGameCollections_SettingIconColored")),
|
||||||
|
new SettingOption(SidebarIconStyle.Theme, Loc.Get("LOCGameCollections_SettingIconTheme")),
|
||||||
|
new SettingOption(SidebarIconStyle.White, Loc.Get("LOCGameCollections_SettingIconWhite")),
|
||||||
|
new SettingOption(SidebarIconStyle.Black, Loc.Get("LOCGameCollections_SettingIconBlack"))
|
||||||
|
};
|
||||||
|
|
||||||
|
public IReadOnlyList<SettingOption> StretchOptions { get; } = new List<SettingOption>
|
||||||
|
{
|
||||||
|
new SettingOption(Stretch.None, Loc.Get("LOCGameCollections_StretchNone")),
|
||||||
|
new SettingOption(Stretch.Fill, Loc.Get("LOCGameCollections_StretchFill")),
|
||||||
|
new SettingOption(Stretch.Uniform, Loc.Get("LOCGameCollections_StretchUniform")),
|
||||||
|
new SettingOption(Stretch.UniformToFill, Loc.Get("LOCGameCollections_StretchUniformToFill"))
|
||||||
|
};
|
||||||
|
|
||||||
|
public IReadOnlyList<AspectPreset> AspectPresets => Presets;
|
||||||
|
|
||||||
|
public static readonly IReadOnlyList<AspectPreset> Presets = new List<AspectPreset>
|
||||||
|
{
|
||||||
|
new AspectPreset(Loc.Get("LOCGameCollections_PresetDvdBox"), 27, 38),
|
||||||
|
new AspectPreset(Loc.Get("LOCGameCollections_PresetEpic"), 3, 4),
|
||||||
|
new AspectPreset(Loc.Get("LOCGameCollections_PresetGog"), 22, 31),
|
||||||
|
new AspectPreset(Loc.Get("LOCGameCollections_PresetIgdb"), 3, 4),
|
||||||
|
new AspectPreset(Loc.Get("LOCGameCollections_PresetSquare"), 1, 1),
|
||||||
|
new AspectPreset(Loc.Get("LOCGameCollections_PresetSteamBanner"), 92, 43),
|
||||||
|
new AspectPreset(Loc.Get("LOCGameCollections_PresetSteamCover"), 2, 3),
|
||||||
|
new AspectPreset(Loc.Get("LOCGameCollections_PresetTwitch"), 3, 4)
|
||||||
|
};
|
||||||
|
|
||||||
public GameCollectionsSettingsViewModel(GameCollectionsPlugin plugin)
|
public GameCollectionsSettingsViewModel(GameCollectionsPlugin plugin)
|
||||||
{
|
{
|
||||||
// The plugin instance is required for Save/Load because Playnite stores data per plugin.
|
// The plugin instance is required for Save/Load because Playnite stores data per plugin.
|
||||||
@@ -84,7 +220,19 @@ namespace GameCollections.Settings
|
|||||||
public bool VerifySettings(out List<string> errors)
|
public bool VerifySettings(out List<string> errors)
|
||||||
{
|
{
|
||||||
errors = new List<string>();
|
errors = new List<string>();
|
||||||
return true;
|
if (!GameCollectionsSettings.IsValidAspectValue(Settings.CollectionPosterAspectWidth) ||
|
||||||
|
!GameCollectionsSettings.IsValidAspectValue(Settings.CollectionPosterAspectHeight))
|
||||||
|
{
|
||||||
|
errors.Add(Loc.Get("LOCGameCollections_SettingCollectionAspectInvalid"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GameCollectionsSettings.IsValidAspectValue(Settings.GameCoverAspectWidth) ||
|
||||||
|
!GameCollectionsSettings.IsValidAspectValue(Settings.GameCoverAspectHeight))
|
||||||
|
{
|
||||||
|
errors.Add(Loc.Get("LOCGameCollections_SettingGameAspectInvalid"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors.Count == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,26 +4,121 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="200" d:DesignWidth="600">
|
d:DesignHeight="600" d:DesignWidth="600">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<Style x:Key="SectionTitle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
|
||||||
|
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}" />
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold" />
|
||||||
|
<Setter Property="Margin" Value="0,0,0,10" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="Hint" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextBrushDarker}" />
|
||||||
|
<Setter Property="TextWrapping" Value="Wrap" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="Label" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}">
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Margin" Value="0,0,10,0" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="AspectBox" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||||
|
<Setter Property="Width" Value="50" />
|
||||||
|
<Setter Property="TextAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
</Style>
|
||||||
|
</UserControl.Resources>
|
||||||
|
|
||||||
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
<StackPanel Margin="20">
|
<StackPanel Margin="20">
|
||||||
|
<!-- Sidebar -->
|
||||||
|
<TextBlock Text="{DynamicResource LOCGameCollections_SettingSectionSidebar}" Style="{StaticResource SectionTitle}" />
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{DynamicResource LOCGameCollections_SettingSidebarIcon}" Style="{StaticResource Label}" />
|
||||||
|
<ComboBox MinWidth="140"
|
||||||
|
ItemsSource="{Binding SidebarIconOptions}"
|
||||||
|
DisplayMemberPath="Label"
|
||||||
|
SelectedValuePath="Value"
|
||||||
|
SelectedValue="{Binding Settings.SidebarIcon}"
|
||||||
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_SettingSidebarIcon}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Collections page -->
|
||||||
|
<TextBlock Text="{DynamicResource LOCGameCollections_SettingSectionCollectionPosters}" Style="{StaticResource SectionTitle}" Margin="0,24,0,10" />
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="{DynamicResource LOCGameCollections_SettingAspectRatio}" Style="{StaticResource Label}" />
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||||
|
<TextBox Style="{StaticResource AspectBox}" Text="{Binding Settings.CollectionPosterAspectWidth}"
|
||||||
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_SettingAspectWidth}" />
|
||||||
|
<TextBlock Text=":" Style="{StaticResource Label}" Margin="6,0" />
|
||||||
|
<TextBox Style="{StaticResource AspectBox}" Text="{Binding Settings.CollectionPosterAspectHeight}"
|
||||||
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_SettingAspectHeight}" />
|
||||||
|
<Button Content="{DynamicResource LOCGameCollections_AspectPresets}" Tag="Collection" Margin="10,0,0,0"
|
||||||
|
VerticalAlignment="Center" Click="PresetsButton_Click" />
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Grid.Row="1" Text="{DynamicResource LOCGameCollections_SettingStretchMode}" Style="{StaticResource Label}" Margin="0,8,10,0" />
|
||||||
|
<ComboBox Grid.Row="1" Grid.Column="1" MinWidth="140" HorizontalAlignment="Left" Margin="0,8,0,0"
|
||||||
|
ItemsSource="{Binding StretchOptions}"
|
||||||
|
DisplayMemberPath="Label"
|
||||||
|
SelectedValuePath="Value"
|
||||||
|
SelectedValue="{Binding Settings.CollectionPosterStretch}"
|
||||||
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_SettingStretchMode}" />
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Style="{StaticResource Hint}" Margin="0,6,0,0"
|
||||||
|
Text="{DynamicResource LOCGameCollections_SettingCollectionPostersHint}" />
|
||||||
|
|
||||||
|
<!-- Games on a collection's page -->
|
||||||
|
<TextBlock Text="{DynamicResource LOCGameCollections_SettingSectionGameCovers}" Style="{StaticResource SectionTitle}" Margin="0,24,0,10" />
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Text="{DynamicResource LOCGameCollections_SettingAspectRatio}" Style="{StaticResource Label}" />
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||||
|
<TextBox Style="{StaticResource AspectBox}" Text="{Binding Settings.GameCoverAspectWidth}"
|
||||||
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_SettingAspectWidth}" />
|
||||||
|
<TextBlock Text=":" Style="{StaticResource Label}" Margin="6,0" />
|
||||||
|
<TextBox Style="{StaticResource AspectBox}" Text="{Binding Settings.GameCoverAspectHeight}"
|
||||||
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_SettingAspectHeight}" />
|
||||||
|
<Button Content="{DynamicResource LOCGameCollections_AspectPresets}" Tag="Game" Margin="10,0,0,0"
|
||||||
|
VerticalAlignment="Center" Click="PresetsButton_Click" />
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Grid.Row="1" Text="{DynamicResource LOCGameCollections_SettingStretchMode}" Style="{StaticResource Label}" Margin="0,8,10,0" />
|
||||||
|
<ComboBox Grid.Row="1" Grid.Column="1" MinWidth="140" HorizontalAlignment="Left" Margin="0,8,0,0"
|
||||||
|
ItemsSource="{Binding StretchOptions}"
|
||||||
|
DisplayMemberPath="Label"
|
||||||
|
SelectedValuePath="Value"
|
||||||
|
SelectedValue="{Binding Settings.GameCoverStretch}"
|
||||||
|
AutomationProperties.Name="{DynamicResource LOCGameCollections_SettingStretchMode}" />
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Style="{StaticResource Hint}" Margin="0,6,0,0"
|
||||||
|
Text="{DynamicResource LOCGameCollections_SettingGameCoversHint}" />
|
||||||
|
|
||||||
|
<!-- Game details view -->
|
||||||
|
<TextBlock Text="{DynamicResource LOCGameCollections_SettingSectionDetails}" Style="{StaticResource SectionTitle}" Margin="0,24,0,10" />
|
||||||
<CheckBox IsChecked="{Binding Settings.AddDetailsListToAnyTheme}"
|
<CheckBox IsChecked="{Binding Settings.AddDetailsListToAnyTheme}"
|
||||||
Content="{DynamicResource LOCGameCollections_SettingAddListToAnyTheme}" />
|
Content="{DynamicResource LOCGameCollections_SettingAddListToAnyTheme}" />
|
||||||
<TextBlock Style="{StaticResource BaseTextBlockStyle}"
|
<TextBlock Style="{StaticResource Hint}" Margin="0,4,0,16"
|
||||||
Foreground="{DynamicResource TextBrushDarker}"
|
|
||||||
TextWrapping="Wrap" Margin="0,4,0,16"
|
|
||||||
Text="{DynamicResource LOCGameCollections_SettingAddListToAnyThemeHint}" />
|
Text="{DynamicResource LOCGameCollections_SettingAddListToAnyThemeHint}" />
|
||||||
<CheckBox IsChecked="{Binding Settings.UseThemeSpecificPlacement}"
|
<CheckBox IsChecked="{Binding Settings.UseThemeSpecificPlacement}"
|
||||||
IsEnabled="{Binding Settings.AddDetailsListToAnyTheme}"
|
IsEnabled="{Binding Settings.AddDetailsListToAnyTheme}"
|
||||||
Content="{DynamicResource LOCGameCollections_SettingThemeSpecificPlacement}" />
|
Content="{DynamicResource LOCGameCollections_SettingThemeSpecificPlacement}" />
|
||||||
<TextBlock Style="{StaticResource BaseTextBlockStyle}"
|
<TextBlock Style="{StaticResource Hint}" Margin="0,4,0,16"
|
||||||
Foreground="{DynamicResource TextBrushDarker}"
|
|
||||||
TextWrapping="Wrap" Margin="0,4,0,16"
|
|
||||||
Text="{DynamicResource LOCGameCollections_SettingThemeSpecificPlacementHint}" />
|
Text="{DynamicResource LOCGameCollections_SettingThemeSpecificPlacementHint}" />
|
||||||
<CheckBox IsChecked="{Binding Settings.ShowDynamicCollectionsInDetails}"
|
<CheckBox IsChecked="{Binding Settings.ShowDynamicCollectionsInDetails}"
|
||||||
Content="{DynamicResource LOCGameCollections_SettingShowDynamicInDetails}" />
|
Content="{DynamicResource LOCGameCollections_SettingShowDynamicInDetails}" />
|
||||||
<TextBlock Style="{StaticResource BaseTextBlockStyle}"
|
<TextBlock Style="{StaticResource Hint}" Margin="0,4,0,0"
|
||||||
Foreground="{DynamicResource TextBrushDarker}"
|
|
||||||
TextWrapping="Wrap" Margin="0,4,0,0"
|
|
||||||
Text="{DynamicResource LOCGameCollections_SettingShowDynamicInDetailsHint}" />
|
Text="{DynamicResource LOCGameCollections_SettingShowDynamicInDetailsHint}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
|
|
||||||
namespace GameCollections.Settings
|
namespace GameCollections.Settings
|
||||||
{
|
{
|
||||||
@@ -8,5 +10,53 @@ namespace GameCollections.Settings
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opens the list of aspect ratio presets below the button. The button's Tag says which
|
||||||
|
// fields it fills: "Collection" for collection posters, "Game" for game covers.
|
||||||
|
private void PresetsButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var button = (Button)sender;
|
||||||
|
if (!(DataContext is GameCollectionsSettingsViewModel vm) || vm.Settings == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var settings = vm.Settings;
|
||||||
|
var forCollections = (string)button.Tag == "Collection";
|
||||||
|
var width = forCollections ? settings.CollectionPosterAspectWidth : settings.GameCoverAspectWidth;
|
||||||
|
var height = forCollections ? settings.CollectionPosterAspectHeight : settings.GameCoverAspectHeight;
|
||||||
|
|
||||||
|
var menu = new ContextMenu
|
||||||
|
{
|
||||||
|
PlacementTarget = button,
|
||||||
|
Placement = PlacementMode.Bottom
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var preset in vm.AspectPresets)
|
||||||
|
{
|
||||||
|
var item = new MenuItem
|
||||||
|
{
|
||||||
|
Header = preset.Label,
|
||||||
|
IsCheckable = false,
|
||||||
|
IsChecked = preset.Matches(width, height)
|
||||||
|
};
|
||||||
|
item.Click += (s, args) =>
|
||||||
|
{
|
||||||
|
if (forCollections)
|
||||||
|
{
|
||||||
|
settings.CollectionPosterAspectWidth = preset.Width;
|
||||||
|
settings.CollectionPosterAspectHeight = preset.Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
settings.GameCoverAspectWidth = preset.Width;
|
||||||
|
settings.GameCoverAspectHeight = preset.Height;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
menu.Items.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.IsOpen = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ using System.Globalization;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace GameCollections.ViewModels
|
namespace GameCollections.ViewModels
|
||||||
@@ -284,7 +285,6 @@ namespace GameCollections.ViewModels
|
|||||||
|
|
||||||
public const double MinCardWidth = 80;
|
public const double MinCardWidth = 80;
|
||||||
public const double MaxCardWidth = 260;
|
public const double MaxCardWidth = 260;
|
||||||
private const double CardAspectRatio = 1.5;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Width of the game cards, set with the size slider. Shared by all collection pages.
|
/// Width of the game cards, set with the size slider. Shared by all collection pages.
|
||||||
@@ -303,7 +303,28 @@ namespace GameCollections.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double CardHeight => CardWidth * CardAspectRatio;
|
public double CardHeight => CardWidth * root.Settings.Settings.GameCoverRatio;
|
||||||
|
public Stretch CoverStretch => root.Settings.Settings.GameCoverStretch;
|
||||||
|
|
||||||
|
// The header poster fits a box 210 high and at most 280 wide, so a wide poster doesn't take over the page.
|
||||||
|
private const double HeaderPosterMaxHeight = 210;
|
||||||
|
private const double HeaderPosterMaxWidth = 280;
|
||||||
|
public double HeaderPosterWidth => Math.Min(HeaderPosterMaxWidth, HeaderPosterMaxHeight / root.Settings.Settings.CollectionPosterRatio);
|
||||||
|
public double HeaderPosterHeight => HeaderPosterWidth * root.Settings.Settings.CollectionPosterRatio;
|
||||||
|
public Stretch HeaderPosterStretch => root.Settings.Settings.CollectionPosterStretch;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called after the settings are saved, so posters and covers take their new shape.
|
||||||
|
/// </summary>
|
||||||
|
public void OnDisplaySettingsChanged()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(CardWidth));
|
||||||
|
OnPropertyChanged(nameof(CardHeight));
|
||||||
|
OnPropertyChanged(nameof(CoverStretch));
|
||||||
|
OnPropertyChanged(nameof(HeaderPosterWidth));
|
||||||
|
OnPropertyChanged(nameof(HeaderPosterHeight));
|
||||||
|
OnPropertyChanged(nameof(HeaderPosterStretch));
|
||||||
|
}
|
||||||
|
|
||||||
private readonly DispatcherTimer cardSizeSaveTimer;
|
private readonly DispatcherTimer cardSizeSaveTimer;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace GameCollections.ViewModels
|
namespace GameCollections.ViewModels
|
||||||
{
|
{
|
||||||
@@ -46,6 +47,28 @@ namespace GameCollections.ViewModels
|
|||||||
public string ViewModeToggleGlyph => IsGridView ? ListGlyph : GridGlyph;
|
public string ViewModeToggleGlyph => IsGridView ? ListGlyph : GridGlyph;
|
||||||
public string ViewModeToggleTooltip => Loc.Get(IsGridView ? "LOCGameCollections_SwitchToListView" : "LOCGameCollections_SwitchToGridView");
|
public string ViewModeToggleTooltip => Loc.Get(IsGridView ? "LOCGameCollections_SwitchToListView" : "LOCGameCollections_SwitchToGridView");
|
||||||
|
|
||||||
|
// Poster shapes follow the aspect ratio setting. Grid cards keep their width, and list rows keep
|
||||||
|
// their height unless a wide ratio would make the thumbnail too wide.
|
||||||
|
private const double CardPosterWidth = 170;
|
||||||
|
private const double RowPosterHeight = 72;
|
||||||
|
private const double MaxRowPosterWidth = 128;
|
||||||
|
|
||||||
|
public double CardPosterHeight => CardPosterWidth * settings.Settings.CollectionPosterRatio;
|
||||||
|
public double RowPosterWidth => Math.Min(MaxRowPosterWidth, RowPosterHeight / settings.Settings.CollectionPosterRatio);
|
||||||
|
public double RowPosterActualHeight => RowPosterWidth * settings.Settings.CollectionPosterRatio;
|
||||||
|
public Stretch PosterStretch => settings.Settings.CollectionPosterStretch;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called after the settings are saved, so the posters take their new shape.
|
||||||
|
/// </summary>
|
||||||
|
public void OnDisplaySettingsChanged()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(CardPosterHeight));
|
||||||
|
OnPropertyChanged(nameof(RowPosterWidth));
|
||||||
|
OnPropertyChanged(nameof(RowPosterActualHeight));
|
||||||
|
OnPropertyChanged(nameof(PosterStretch));
|
||||||
|
}
|
||||||
|
|
||||||
public string CountText => Loc.CollectionCount(Cards.Count);
|
public string CountText => Loc.CollectionCount(Cards.Count);
|
||||||
public bool IsEmpty => Cards.Count == 0;
|
public bool IsEmpty => Cards.Count == 0;
|
||||||
public bool HasNoResults => !IsEmpty && CardsView.Count == 0;
|
public bool HasNoResults => !IsEmpty && CardsView.Count == 0;
|
||||||
|
|||||||
@@ -47,6 +47,16 @@ namespace GameCollections.ViewModels
|
|||||||
manager.CollectionsChanged += OnCollectionsChanged;
|
manager.CollectionsChanged += OnCollectionsChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Passes saved settings on to the open pages. A collection's own window is modal, so the
|
||||||
|
/// settings can't change while it's open.
|
||||||
|
/// </summary>
|
||||||
|
public void OnDisplaySettingsChanged()
|
||||||
|
{
|
||||||
|
Home.OnDisplaySettingsChanged();
|
||||||
|
(CurrentPage as CollectionDetailsViewModel)?.OnDisplaySettingsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
public void ShowHome()
|
public void ShowHome()
|
||||||
{
|
{
|
||||||
CurrentPage = Home;
|
CurrentPage = Home;
|
||||||
|
|||||||
@@ -491,10 +491,22 @@ namespace GameCollections.ViewModels
|
|||||||
|
|
||||||
public RelayCommand AddBlockCommand { get; }
|
public RelayCommand AddBlockCommand { get; }
|
||||||
|
|
||||||
|
private bool includeHidden;
|
||||||
|
public bool IncludeHidden
|
||||||
|
{
|
||||||
|
get => includeHidden;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetValue(ref includeHidden, value);
|
||||||
|
OnRulesChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DynamicRulesViewModel(IPlayniteAPI playniteApi, DynamicRules source)
|
public DynamicRulesViewModel(IPlayniteAPI playniteApi, DynamicRules source)
|
||||||
{
|
{
|
||||||
this.playniteApi = playniteApi;
|
this.playniteApi = playniteApi;
|
||||||
ruleText = new RuleText(playniteApi);
|
ruleText = new RuleText(playniteApi);
|
||||||
|
includeHidden = source?.IncludeHidden ?? false;
|
||||||
AddBlockCommand = new RelayCommand(AddBlock);
|
AddBlockCommand = new RelayCommand(AddBlock);
|
||||||
|
|
||||||
// Waits for a pause in typing, so the library isn't searched on every keystroke.
|
// Waits for a pause in typing, so the library isn't searched on every keystroke.
|
||||||
@@ -524,7 +536,7 @@ namespace GameCollections.ViewModels
|
|||||||
|
|
||||||
public DynamicRules ToModel()
|
public DynamicRules ToModel()
|
||||||
{
|
{
|
||||||
return new DynamicRules { Blocks = Blocks.Select(b => b.ToModel()).ToList() };
|
return new DynamicRules { Blocks = Blocks.Select(b => b.ToModel()).ToList(), IncludeHidden = includeHidden };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRulesChanged()
|
public void OnRulesChanged()
|
||||||
|
|||||||
@@ -41,10 +41,11 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<DataTemplate x:Key="GameTemplate" DataType="{x:Type vm:CollectionGameViewModel}">
|
<DataTemplate x:Key="GameTemplate" DataType="{x:Type vm:CollectionGameViewModel}">
|
||||||
<!-- Sized by the card size slider on the page. -->
|
<!-- Width from the card size slider; height and stretch from the cover settings. -->
|
||||||
<StackPanel Width="{Binding DataContext.CardWidth, RelativeSource={RelativeSource AncestorType=ListBox}}">
|
<StackPanel Width="{Binding DataContext.CardWidth, RelativeSource={RelativeSource AncestorType=ListBox}}">
|
||||||
<Grid Height="{Binding DataContext.CardHeight, RelativeSource={RelativeSource AncestorType=ListBox}}">
|
<Grid Height="{Binding DataContext.CardHeight, RelativeSource={RelativeSource AncestorType=ListBox}}">
|
||||||
<local:PosterImage GlyphSize="40" Glyph="" Source="{Binding Cover}" />
|
<local:PosterImage GlyphSize="40" Glyph="" Source="{Binding Cover}"
|
||||||
|
Stretch="{Binding DataContext.CoverStretch, RelativeSource={RelativeSource AncestorType=ListBox}}" />
|
||||||
<!-- Dim games that are not installed, as Playnite's own grid does. -->
|
<!-- Dim games that are not installed, as Playnite's own grid does. -->
|
||||||
<Border Background="#80000000" CornerRadius="4" IsHitTestVisible="False"
|
<Border Background="#80000000" CornerRadius="4" IsHitTestVisible="False"
|
||||||
Visibility="{Binding IsInstalled, Converter={StaticResource InverseBoolToVisibility}}" />
|
Visibility="{Binding IsInstalled, Converter={StaticResource InverseBoolToVisibility}}" />
|
||||||
@@ -77,7 +78,9 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<local:PosterImage Width="140" Height="210" GlyphSize="52" Source="{Binding Header.Poster}" VerticalAlignment="Top"
|
<local:PosterImage x:Name="HeaderPoster" GlyphSize="52" Source="{Binding Header.Poster}" VerticalAlignment="Top"
|
||||||
|
Width="{Binding HeaderPosterWidth}" Height="{Binding HeaderPosterHeight}"
|
||||||
|
Stretch="{Binding HeaderPosterStretch}"
|
||||||
Margin="0,0,20,0"
|
Margin="0,0,20,0"
|
||||||
Visibility="{Binding IsHeaderCollapsed, Converter={StaticResource InverseBoolToVisibility}}" />
|
Visibility="{Binding IsHeaderCollapsed, Converter={StaticResource InverseBoolToVisibility}}" />
|
||||||
<Button Grid.Column="2" Style="{StaticResource GcIconButton}" VerticalAlignment="Top" Margin="10,0,0,0"
|
<Button Grid.Column="2" Style="{StaticResource GcIconButton}" VerticalAlignment="Top" Margin="10,0,0,0"
|
||||||
|
|||||||
@@ -38,11 +38,13 @@
|
|||||||
<EventSetter Event="MouseDoubleClick" Handler="RowItem_MouseDoubleClick" />
|
<EventSetter Event="MouseDoubleClick" Handler="RowItem_MouseDoubleClick" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Grid card: fixed size so every card lines up regardless of its content. -->
|
<!-- Grid card: fixed size so every card lines up regardless of its content. The poster's
|
||||||
|
height and stretch come from the settings, through the page's view model. -->
|
||||||
<DataTemplate x:Key="CardTemplate" DataType="{x:Type vm:CollectionCardViewModel}">
|
<DataTemplate x:Key="CardTemplate" DataType="{x:Type vm:CollectionCardViewModel}">
|
||||||
<StackPanel Width="170">
|
<StackPanel Width="170">
|
||||||
<Grid Width="170" Height="255">
|
<Grid Width="170" Height="{Binding DataContext.CardPosterHeight, RelativeSource={RelativeSource AncestorType=ListBox}}">
|
||||||
<local:PosterImage GlyphSize="56" Source="{Binding Poster}" />
|
<local:PosterImage GlyphSize="56" Source="{Binding Poster}"
|
||||||
|
Stretch="{Binding DataContext.PosterStretch, RelativeSource={RelativeSource AncestorType=ListBox}}" />
|
||||||
<Border Style="{StaticResource GcBadge}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6"
|
<Border Style="{StaticResource GcBadge}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6"
|
||||||
Visibility="{Binding IsDynamic, Converter={StaticResource BoolToVisibility}}">
|
Visibility="{Binding IsDynamic, Converter={StaticResource BoolToVisibility}}">
|
||||||
<TextBlock Text="{DynamicResource LOCGameCollections_DynamicBadge}" Style="{StaticResource GcBadgeText}" />
|
<TextBlock Text="{DynamicResource LOCGameCollections_DynamicBadge}" Style="{StaticResource GcBadgeText}" />
|
||||||
@@ -77,7 +79,10 @@
|
|||||||
<ColumnDefinition Width="100" />
|
<ColumnDefinition Width="100" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<local:PosterImage Width="48" Height="72" GlyphSize="22" CornerRadius="3" Source="{Binding Poster}" />
|
<local:PosterImage GlyphSize="22" CornerRadius="3" Source="{Binding Poster}" VerticalAlignment="Center"
|
||||||
|
Width="{Binding DataContext.RowPosterWidth, RelativeSource={RelativeSource AncestorType=ListBox}}"
|
||||||
|
Height="{Binding DataContext.RowPosterActualHeight, RelativeSource={RelativeSource AncestorType=ListBox}}"
|
||||||
|
Stretch="{Binding DataContext.PosterStretch, RelativeSource={RelativeSource AncestorType=ListBox}}" />
|
||||||
<StackPanel Grid.Column="1" Margin="14,0,10,0" VerticalAlignment="Center">
|
<StackPanel Grid.Column="1" Margin="14,0,10,0" VerticalAlignment="Center">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="{Binding Title}" Style="{StaticResource GcItemTitleText}" />
|
<TextBlock Text="{Binding Title}" Style="{StaticResource GcItemTitleText}" />
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<Border CornerRadius="{Binding CornerRadius, ElementName=Root}"
|
<Border CornerRadius="{Binding CornerRadius, ElementName=Root}"
|
||||||
Background="{DynamicResource NormalBrush}">
|
Background="{DynamicResource NormalBrush}">
|
||||||
<TextBlock Text="{Binding Glyph, ElementName=Root}"
|
<TextBlock x:Name="PlaceholderGlyph"
|
||||||
|
Text="{Binding Glyph, ElementName=Root}"
|
||||||
FontFamily="{DynamicResource FontIcoFont}"
|
FontFamily="{DynamicResource FontIcoFont}"
|
||||||
FontSize="{Binding GlyphSize, ElementName=Root}"
|
FontSize="{Binding GlyphSize, ElementName=Root}"
|
||||||
Foreground="{DynamicResource GlyphBrush}"
|
Foreground="{DynamicResource GlyphBrush}"
|
||||||
|
|||||||
@@ -20,6 +20,18 @@ namespace GameCollections.Views
|
|||||||
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
|
||||||
nameof(CornerRadius), typeof(CornerRadius), typeof(PosterImage), new PropertyMetadata(new CornerRadius(4)));
|
nameof(CornerRadius), typeof(CornerRadius), typeof(PosterImage), new PropertyMetadata(new CornerRadius(4)));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty StretchProperty = DependencyProperty.Register(
|
||||||
|
nameof(Stretch), typeof(Stretch), typeof(PosterImage), new PropertyMetadata(Stretch.UniformToFill, OnSourceChanged));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How the image fills the poster's shape.
|
||||||
|
/// </summary>
|
||||||
|
public Stretch Stretch
|
||||||
|
{
|
||||||
|
get => (Stretch)GetValue(StretchProperty);
|
||||||
|
set => SetValue(StretchProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
public ImageSource Source
|
public ImageSource Source
|
||||||
{
|
{
|
||||||
get => (ImageSource)GetValue(SourceProperty);
|
get => (ImageSource)GetValue(SourceProperty);
|
||||||
@@ -52,10 +64,12 @@ namespace GameCollections.Views
|
|||||||
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
var control = (PosterImage)d;
|
var control = (PosterImage)d;
|
||||||
var source = e.NewValue as ImageSource;
|
var source = control.Source;
|
||||||
control.ImageBorder.Background = source == null
|
control.ImageBorder.Background = source == null
|
||||||
? null
|
? null
|
||||||
: new ImageBrush(source) { Stretch = Stretch.UniformToFill };
|
: new ImageBrush(source) { Stretch = control.Stretch };
|
||||||
|
// With a stretch that doesn't cover the whole shape, the placeholder glyph would show around the image.
|
||||||
|
control.PlaceholderGlyph.Visibility = source == null ? Visibility.Visible : Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,5 +190,9 @@
|
|||||||
FontSize="{DynamicResource FontSizeSmall}" TextWrapping="Wrap"
|
FontSize="{DynamicResource FontSizeSmall}" TextWrapping="Wrap"
|
||||||
VerticalAlignment="Center" Margin="12,0,0,0" />
|
VerticalAlignment="Center" Margin="12,0,0,0" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
<CheckBox Margin="0,12,0,0"
|
||||||
|
IsChecked="{Binding IncludeHidden}"
|
||||||
|
Content="{DynamicResource LOCGameCollections_RuleIncludeHidden}"
|
||||||
|
ToolTip="{DynamicResource LOCGameCollections_RuleIncludeHiddenTooltip}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace GameCollections.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Sidebar icon drawn in the sidebar button's text colour, like the font glyphs Playnite and
|
||||||
|
/// other extensions use. Themes change that colour when the button is hovered or selected, so the
|
||||||
|
/// icon follows those shades. The picture only supplies the shape: its opacity is used as a mask,
|
||||||
|
/// so the fainter cards behind the folder stay fainter.
|
||||||
|
/// </summary>
|
||||||
|
public static class ThemedSidebarIcon
|
||||||
|
{
|
||||||
|
public static FrameworkElement Create(string maskPath)
|
||||||
|
{
|
||||||
|
var mask = new BitmapImage();
|
||||||
|
mask.BeginInit();
|
||||||
|
mask.UriSource = new Uri(maskPath, UriKind.Absolute);
|
||||||
|
mask.CacheOption = BitmapCacheOption.OnLoad;
|
||||||
|
mask.EndInit();
|
||||||
|
mask.Freeze();
|
||||||
|
|
||||||
|
var icon = new Rectangle
|
||||||
|
{
|
||||||
|
OpacityMask = new ImageBrush(mask) { Stretch = Stretch.Uniform },
|
||||||
|
SnapsToDevicePixels = true
|
||||||
|
};
|
||||||
|
|
||||||
|
// Foreground and font size are inherited from the sidebar button. The size matches a
|
||||||
|
// glyph icon's, which is about as tall as the font size.
|
||||||
|
var self = new RelativeSource(RelativeSourceMode.Self);
|
||||||
|
icon.SetBinding(Shape.FillProperty, new Binding { Path = new PropertyPath(TextElement.ForegroundProperty), RelativeSource = self });
|
||||||
|
icon.SetBinding(FrameworkElement.WidthProperty, new Binding { Path = new PropertyPath(TextElement.FontSizeProperty), RelativeSource = self });
|
||||||
|
icon.SetBinding(FrameworkElement.HeightProperty, new Binding { Path = new PropertyPath(TextElement.FontSizeProperty), RelativeSource = self });
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
Id: GameCollections_3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54
|
Id: GameCollections_3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54
|
||||||
Name: Game Collections
|
Name: Game Collections
|
||||||
Author: X4Lo
|
Author: X4Lo
|
||||||
Version: 1.3.0
|
Version: 1.4.0
|
||||||
Module: GameCollections.dll
|
Module: GameCollections.dll
|
||||||
Type: GenericPlugin
|
Type: GenericPlugin
|
||||||
Icon: icon.png
|
Icon: icon.png
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Reference in new issue
Block a user