Skip to content

Commit

Permalink
Merge branch 'tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
JosefNemec committed May 7, 2017
2 parents 9c30585 + 859350b commit 8632106
Show file tree
Hide file tree
Showing 65 changed files with 2,213 additions and 1,863 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ paket-files/
.vscode/

build/nuget.exe
build/playnite.exe
build/playnite.zip
build/PlayniteInstaller.exe
build/PlaynitePortable.zip
build/TestPackage/*
build/PlayniteServices/*

Expand Down
2 changes: 1 addition & 1 deletion build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if ($Portable -and $appCompileSuccess)
{
Write-Host "Building portable package..." -ForegroundColor Green

$packageName = "playnite.zip"
$packageName = "PlaynitePortable.zip"

if (Test-path $packageName)
{
Expand Down
2 changes: 1 addition & 1 deletion build/setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Var /GLOBAL ProgressOnly
Var /GLOBAL Portable
OutFile "playnite.exe"
OutFile "PlayniteInstaller.exe"
Unicode true
SetCompressor /SOLID lzma

Expand Down
4 changes: 4 additions & 0 deletions source/Playnite/Database/GameDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ public MemoryStream GetFileStream(string id)
CheckDbState();

var file = Database.FileStorage.FindById(id);
if (file == null)
{
return null;
}

lock (fileLock)
{
Expand Down
1 change: 1 addition & 0 deletions source/PlayniteUI/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
{
Settings.ConfigureLogger();
Settings.ConfigureCef();
Settings.LoadSettings();

#if !DEBUG
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Expand Down
29 changes: 14 additions & 15 deletions source/PlayniteUI/Controls/FilterSelector.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@
mc:Ignorable="d">
<Grid>
<StackPanel>
<local:FilterSelectorItem Text="Installed" CountText="{Binding Path=Stats.Installed, Mode=OneWay}"
IsChecked="{Binding Settings.Installed}" Padding="5,5,5,3" />
<local:FilterSelectorItem Text="Hidden" CountText="{Binding Path=Stats.Hidden, Mode=OneWay}"
IsChecked="{Binding Settings.Hidden}" Padding="5,0,5,3" />
<Separator/>
<TextBlock Text="Providers" FontSize="16" Foreground="LightGray" FontStyle="Italic" Margin="5" Padding="5,0,5,3"/>
<StackPanel>
<local:FilterSelectorItem IsChecked="{Binding Path=Settings.Providers[(playniteModels:Provider)Steam]}"
<local:FilterSelectorItem x:Name="FilterInstalled" Text="Installed" CountText="{Binding Path=Stats.Installed, Mode=OneWay}"
IsChecked="{Binding Settings.Installed}" Padding="5,5,5,3" Margin="0,5,0,0" />
<local:FilterSelectorItem x:Name="FilterHidden" Text="Hidden" CountText="{Binding Path=Stats.Hidden, Mode=OneWay}"
IsChecked="{Binding Settings.Hidden}" Padding="5,0,5,3" Margin="0,5,0,5"/>
<Border BorderThickness="0,1,0,0" BorderBrush="{StaticResource NormalBorderBrush}"/>
<StackPanel Margin="0,3,0,0">
<local:FilterSelectorItem Text="Steam" x:Name="FilterSteam" IsChecked="{Binding Path=Settings.Providers[(playniteModels:Provider)Steam]}"
CountText="{Binding Path=Stats.Steam, Mode=OneWay}"
Padding="5,0,5,3" Text="Steam"/>
<local:FilterSelectorItem IsChecked="{Binding Path=Settings.Providers[(playniteModels:Provider)GOG]}"
Padding="5,0,5,3" Margin="0,5,0,5"/>
<local:FilterSelectorItem Text="GOG" x:Name="FilterGOG" IsChecked="{Binding Path=Settings.Providers[(playniteModels:Provider)GOG]}"
CountText="{Binding Path=Stats.GOG, Mode=OneWay}"
Padding="5,0,5,3" Text="GOG"/>
<local:FilterSelectorItem IsChecked="{Binding Path=Settings.Providers[(playniteModels:Provider)Origin]}"
Padding="5,0,5,3" Margin="0,0,0,5" />
<local:FilterSelectorItem Text="Origin" x:Name="FilterOrigin" IsChecked="{Binding Path=Settings.Providers[(playniteModels:Provider)Origin]}"
CountText="{Binding Path=Stats.Origin, Mode=OneWay}"
Padding="5,0,5,3" Text="Origin"/>
<local:FilterSelectorItem IsChecked="{Binding Path=Settings.Providers[(playniteModels:Provider)Custom]}"
Padding="5,0,5,3" Margin="0,0,0,5" />
<local:FilterSelectorItem Text="Custom" x:Name="FilterCustom" IsChecked="{Binding Path=Settings.Providers[(playniteModels:Provider)Custom]}"
CountText="{Binding Path=Stats.Custom, Mode=OneWay}"
Padding="5,0,5,3" Text="Custom" />
Padding="5,0,5,3" Margin="0,0,0,5" />
</StackPanel>
</StackPanel>
</Grid>
Expand Down
20 changes: 10 additions & 10 deletions source/PlayniteUI/Controls/FilterSelectorItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PlayniteUI.Controls"
mc:Ignorable="d"
d:DesignWidth="300"
Name="MainControl">
d:DesignWidth="300">

<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</UserControl.Resources>

<Border CornerRadius="2" MouseUp="mainControl_MouseUp" Cursor="Hand" Name="BorderMain">
<Border CornerRadius="3" MouseUp="MainControl_MouseUp" Cursor="Hand" Name="BorderMain"
BorderThickness="2" BorderBrush="{StaticResource NormalBorderBrush}">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=MainControl}" Value="True">
<Setter Property="Background" Value="{StaticResource NormalBrush}" />
<DataTrigger Binding="{Binding IsChecked, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="True">
<Setter Property="Background" Value="{StaticResource PopupBorderBrush}" />
</DataTrigger>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=BorderMain}" Value="True">
<Setter Property="Background" Value="{StaticResource NormalBrush}" />
<Setter Property="Background" Value="{StaticResource IndicatorBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>

<DockPanel LastChildFill="True" Margin="5">
<TextBlock Text="{Binding Text, ElementName=MainControl}" DockPanel.Dock="Left" FontSize="16" VerticalAlignment="Center"/>
<TextBlock Text="(" DockPanel.Dock="Left" FontSize="16" VerticalAlignment="Center" Padding="5,0,0,0"/>
<TextBlock Text="{Binding CountText, ElementName=MainControl}" DockPanel.Dock="Left" FontSize="16" VerticalAlignment="Center" />
<TextBlock Text=")" DockPanel.Dock="Left" FontSize="16" VerticalAlignment="Center" />
<Label Content="{Binding Text, RelativeSource={RelativeSource AncestorType=UserControl}}" DockPanel.Dock="Left" FontSize="16" VerticalAlignment="Center"/>
<Label Content=" (" DockPanel.Dock="Left" FontSize="16" VerticalAlignment="Center" Padding="5,0,0,0"/>
<Label Content="{Binding CountText, RelativeSource={RelativeSource AncestorType=UserControl}}" DockPanel.Dock="Left" VerticalAlignment="Center" />
<Label Content=")" DockPanel.Dock="Left" FontSize="16" VerticalAlignment="Center" HorizontalContentAlignment="Stretch" />
</DockPanel>
</Border>
</UserControl>
87 changes: 86 additions & 1 deletion source/PlayniteUI/Controls/FilterSelectorItem.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,89 @@
using System.Windows.Navigation;
using System.Windows.Shapes;
using Playnite;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;

namespace PlayniteUI.Controls
{
public class FilterSelectorItemAutomationPeer : FrameworkElementAutomationPeer, IValueProvider, IToggleProvider
{
private FilterSelectorItem OwnerControl
{
get
{
return (FilterSelectorItem)Owner;
}
}

public string Value
{
get
{
return OwnerControl.CountText;
}
}

public bool IsReadOnly
{
get
{
return true;
}
}

public System.Windows.Automation.ToggleState ToggleState
{
get
{
if (OwnerControl.IsChecked)
{
return System.Windows.Automation.ToggleState.On;
}
else
{
return System.Windows.Automation.ToggleState.Off;
}
}
}

public FilterSelectorItemAutomationPeer(FilterSelectorItem owner) : base(owner) { }

protected override string GetClassNameCore()
{
return "FilterSelectorItem";
}
protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Custom;
}

public override object GetPattern(PatternInterface patternInterface)
{
if (patternInterface == PatternInterface.Value)
{
return this;
}

if (patternInterface == PatternInterface.Toggle)
{
return this;
}

return base.GetPattern(patternInterface);
}

public void SetValue(string value)
{
throw new NotImplementedException();
}

public void Toggle()
{
OwnerControl.IsChecked = !OwnerControl.IsChecked;
}
}

/// <summary>
/// Interaction logic for FilterSelectorItem.xaml
/// </summary>
Expand Down Expand Up @@ -84,9 +164,14 @@ public FilterSelectorItem()
InitializeComponent();
}

private void mainControl_MouseUp(object sender, MouseButtonEventArgs e)
private void MainControl_MouseUp(object sender, MouseButtonEventArgs e)
{
IsChecked = !IsChecked;
}

protected override AutomationPeer OnCreateAutomationPeer()
{
return new FilterSelectorItemAutomationPeer(this);
}
}
}
38 changes: 21 additions & 17 deletions source/PlayniteUI/Controls/GameDetails.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:models="clr-namespace:Playnite.Models;assembly=Playnite"
xmlns:playniteControls="clr-namespace:PlayniteUI.Controls"
mc:Ignorable="d"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="600" DataContextChanged="UserControl_DataContextChanged">

<UserControl.Resources>
Expand All @@ -25,14 +25,14 @@
<BooleanToVisibilityConverter/>
</local:ValueConverterGroup>
</UserControl.Resources>

<Grid Visibility="{Binding ShowContent, RelativeSource={RelativeSource AncestorType=UserControl}, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}">
<Grid.Background>
<ImageBrush Stretch="Uniform" AlignmentX="Center" AlignmentY="Top" RenderOptions.BitmapScalingMode="Fant"
ImageSource="{Binding BackgroundImage, IsAsync=True, Mode=OneTime, Converter={StaticResource ImageUrlToImageSourceConverter}}" />
</Grid.Background>

<DockPanel Name="gameDetails" Margin="0,10,0,0">
<DockPanel Margin="0,10,0,0">
<playniteControls:GamePopupMenu x:Name="PopupMore" StaysOpen="False" Placement="Relative" VerticalOffset="{Binding ActualHeight, ElementName=ButtonMore}"/>

<DockPanel DockPanel.Dock="Top">
Expand All @@ -45,7 +45,7 @@
</Image.Source>
</Image>
<TextBlock Text="{Binding Name, Mode=OneWay}" FontSize="20" Margin="10,10,0,10" TextWrapping="Wrap" DockPanel.Dock="Left"
HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White">
HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="{StaticResource TextBrush}">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="3"/>
</TextBlock.Effect>
Expand All @@ -60,40 +60,44 @@
<Button Style="{StaticResource PlayButton}" Name="ButtonPlay" Width="100" HorizontalAlignment="Left" Click="ButtonPlay_Click"
Visibility="{Binding IsInstalled, Converter={StaticResource BooleanToVisibilityConverter}}" Content="Play" />
<UserControl Visibility="{Binding Provider, Converter={StaticResource EnumCompVisibilityConverterInverted}, ConverterParameter={x:Static models:Provider.Custom}}">
<Button Width="100" Click="ButtonInstall_Click" Content="Install"
<Button Width="100" Click="ButtonInstall_Click" Content="Install" Name="ButtonInstall"
Visibility="{Binding IsInstalled, Converter={StaticResource InvertableBooleanToVisibilityConverter}, ConverterParameter=Inverted}" />
</UserControl>
</StackPanel>
<Button Name="ButtonSetupProgress" Width="100" Content="Setup Running..." Click="ButtonSetupProgress_Click"
<Button Name="ButtonSetupProgress" Content="Setup Running..." Click="ButtonSetupProgress_Click"
Visibility="{Binding IsSetupInProgress, Converter={StaticResource BooleanToVisibilityConverter}, Mode=OneWay}"/>
<Button Name="ButtonMore" Width="100" Margin="10, 0, 0, 0" Click="ButtonMore_Click" Content="More" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0,5,5,5" Background="#66000000" Padding="5" Width="75" TextAlignment="Center"
<TextBlock Margin="0,5,5,5" Background="#66000000" Padding="7" Width="75" TextAlignment="Center" VerticalAlignment="Center"
Visibility="{Binding CommunityHubUrl, Converter={StaticResource StringNullOrEmptyToVisibilityConverter}}">
<Hyperlink Style="{DynamicResource DetailsHyperlink}" NavigateUri="{Binding CommunityHubUrl, TargetNullValue={x:Null}}"
TextDecorations="{x:Null}" RequestNavigate="Link_RequestNavigate">
<Hyperlink Name="HyperlinkForum" Style="{DynamicResource DetailsHyperlink}" NavigateUri="{Binding CommunityHubUrl, TargetNullValue={x:Null}}"
RequestNavigate="Link_RequestNavigate">
Forum
</Hyperlink>
</TextBlock>
<TextBlock Margin="5" Background="#66000000" Padding="5" Width="75" TextAlignment="Center"
<TextBlock Margin="5" Background="#66000000" Padding="7" Width="75" TextAlignment="Center" VerticalAlignment="Center"
Visibility="{Binding StoreUrl, Converter={StaticResource StringNullOrEmptyToVisibilityConverter}}">
<Hyperlink Style="{DynamicResource DetailsHyperlink}" NavigateUri="{Binding StoreUrl, TargetNullValue={x:Null}}"
TextDecorations="{x:Null}" RequestNavigate="Link_RequestNavigate">
<Hyperlink Name="HyperlinkStore" Style="{DynamicResource DetailsHyperlink}" NavigateUri="{Binding StoreUrl, TargetNullValue={x:Null}}"
RequestNavigate="Link_RequestNavigate">
Store
</Hyperlink>
</TextBlock>
<TextBlock Margin="5,5,0,5" Background="#66000000" Padding="5" Width="75" TextAlignment="Center"
<TextBlock Margin="5,5,0,5" Background="#66000000" Padding="7" Width="75" TextAlignment="Center" VerticalAlignment="Center"
Visibility="{Binding WikiUrl, Converter={StaticResource StringNullOrEmptyToVisibilityConverter}}">
<Hyperlink Style="{DynamicResource DetailsHyperlink}" NavigateUri="{Binding WikiUrl, TargetNullValue={x:Null}}"
TextDecorations="{x:Null}" RequestNavigate="Link_RequestNavigate">
<Hyperlink Name="HyperlinkWiki" Style="{DynamicResource DetailsHyperlink}" NavigateUri="{Binding WikiUrl, TargetNullValue={x:Null}}"
RequestNavigate="Link_RequestNavigate">
Wiki
</Hyperlink>
</TextBlock>
</StackPanel>
</WrapPanel>
</DockPanel>
<html:HtmlPanel Name="htmlPanel" Background="Transparent" Text="{Binding DescriptionView, Mode=OneWay}" Margin="10,20,0,0"/>
</DockPanel>
<ScrollViewer>
<html:HtmlPanel Background="Transparent" Text="{Binding DescriptionView, Mode=OneWay}" Margin="10,20,0,0" BorderThickness="0"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
</ScrollViewer>
</DockPanel>
</Grid>
</UserControl>
20 changes: 19 additions & 1 deletion source/PlayniteUI/Controls/GameDetails.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,25 @@ private void UserControl_DataContextChanged(object sender, DependencyPropertyCha
if (e.NewValue != null)
{
var game = (IGame)e.NewValue;
this.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Theme.BackgroundColors[game.Provider]));

switch (game.Provider)
{
case Provider.Custom:
Background = FindResource("ControlBackgroundBrush") as Brush;
break;
case Provider.GOG:
Background = FindResource("GogGameBackgroundBrush") as Brush;
break;
case Provider.Origin:
Background = FindResource("ControlBackgroundBrush") as Brush;
break;
case Provider.Steam:
Background = FindResource("SteamGameBackgroundBrush") as Brush;
break;
default:
Background = FindResource("ControlBackgroundBrush") as Brush;
break;
}
}

PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ShowContent"));
Expand Down
Loading

0 comments on commit 8632106

Please sign in to comment.