Skip to content

Commit

Permalink
ReviewViewer: Setting to change description height
Browse files Browse the repository at this point in the history
  • Loading branch information
darklinkpower committed Sep 22, 2021
1 parent 4ab50ad commit 1271562
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion source/Generic/ReviewViewer/Controls/ReviewsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<Button Name="ButtonNextReview" Background="Transparent" BorderThickness="0" Content="&#xEACA;" FontSize="40" FontFamily="{DynamicResource FontIcoFont}"
Command="{Binding NextReviewCommand}" Margin="5,0,10,0" Padding="0" VerticalAlignment="Center"/>
</StackPanel>
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="0,0,0,10" Height="180">
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="0,0,0,10" Height="{Binding SettingsModel.Settings.DescriptionHeight}">
<TextBlock Text="{Binding SelectedReview.ReviewReview}" TextWrapping="Wrap"/>
</ScrollViewer>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected void OnPropertyChanged([CallerMemberName] string name = null)
}
private static readonly Regex steamLinkRegex = new Regex(@"^https?:\/\/store\.steampowered\.com\/app\/(\d+)", RegexOptions.Compiled);
IPlayniteAPI PlayniteApi;
private ReviewViewerSettingsViewModel SettingsModel { get; }
public ReviewViewerSettingsViewModel SettingsModel { get; }

private string currentSteamId;
private Game currentGame;
Expand Down
1 change: 1 addition & 0 deletions source/Generic/ReviewViewer/Localization/en_US.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<sys:String x:Key="LOCReview_Viewer_SettingUseMatchingSteamApiLang">Use language used by Playnite to search for reviews if it's available on Steam</sys:String>
<sys:String x:Key="LOCReview_Viewer_SettingDownloadOnGameSelectionDescription">Download review data on game selection if it's missing</sys:String>
<sys:String x:Key="LOCReview_Viewer_SettingDescriptionHeightDescription">Description height</sys:String>
<sys:String x:Key="LOCReview_Viewer_TotalUserReviews">Total user reviews</sys:String>
<sys:String x:Key="LOCReview_Viewer_PositiveUserReviews">Positive user reviews</sys:String>
<sys:String x:Key="LOCReview_Viewer_NegativeUserReviews">Negative user reviews</sys:String>
Expand Down
12 changes: 12 additions & 0 deletions source/Generic/ReviewViewer/ReviewViewerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ public bool DownloadDataOnGameSelection
OnPropertyChanged();
}
}

[DontSerialize]
private double descriptionHeight { get; set; } = 180;
public double DescriptionHeight
{
get => descriptionHeight;
set
{
descriptionHeight = value;
OnPropertyChanged();
}
}
}

public class ReviewViewerSettingsViewModel : ObservableObject, ISettings
Expand Down
10 changes: 8 additions & 2 deletions source/Generic/ReviewViewer/ReviewViewerSettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
d:DesignHeight="400" d:DesignWidth="600">
<StackPanel Margin="20">
<CheckBox IsChecked="{Binding Settings.UseMatchingSteamApiLang}"
Content="{DynamicResource LOCReview_Viewer_SettingUseMatchingSteamApiLang}" Margin="0,10,0,0"/>
Content="{DynamicResource LOCReview_Viewer_SettingUseMatchingSteamApiLang}" Margin="0,0,0,10"/>
<CheckBox IsChecked="{Binding Settings.DownloadDataOnGameSelection}"
Content="{DynamicResource LOCReview_Viewer_SettingDownloadOnGameSelectionDescription}"/>
Content="{DynamicResource LOCReview_Viewer_SettingDownloadOnGameSelectionDescription}" Margin="0,0,0,10"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
<Label Content="{DynamicResource LOCReview_Viewer_SettingDescriptionHeightDescription}" Margin="0,0,0,0" VerticalAlignment="Center" />
<Slider Value="{Binding Settings.DescriptionHeight, UpdateSourceTrigger=PropertyChanged}" Width="150" Minimum="50" Maximum="400" VerticalAlignment="Center"
TickFrequency="5" Margin="0,0,10,0" IsSnapToTickEnabled="True"/>
<TextBlock Text="{Binding Settings.DescriptionHeight, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/>
</StackPanel>
</StackPanel>
</UserControl>

0 comments on commit 1271562

Please sign in to comment.