Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/SyncTrayzor.Tests/ConfigurationThemeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using SyncTrayzor.Services.Config;
using SyncTrayzor.Services.Theming;
using Xunit;

namespace SyncTrayzor.Tests
{
public class ConfigurationThemeTests
{
[Fact]
public void DefaultTheme_FollowsSystem()
{
var configuration = new Configuration();

Assert.Equal(ApplicationTheme.System, configuration.Theme);
}

[Theory]
[InlineData(ApplicationTheme.System)]
[InlineData(ApplicationTheme.Light)]
[InlineData(ApplicationTheme.Dark)]
public void CopyConstructor_PreservesTheme(ApplicationTheme theme)
{
var original = new Configuration { Theme = theme };

var copy = new Configuration(original);

Assert.Equal(theme, copy.Theme);
}
}
}
1 change: 1 addition & 0 deletions src/SyncTrayzor/App.Installed.config
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<NotifyOfNewVersions>true</NotifyOfNewVersions>
<ObfuscateDeviceIDs>true</ObfuscateDeviceIDs>
<UseComputerCulture>true</UseComputerCulture>
<Theme>System</Theme>
<SyncthingConsoleHeight>100</SyncthingConsoleHeight>
<SyncthingWebBrowserZoomLevel>0</SyncthingWebBrowserZoomLevel>
<LastSeenInstallCount>0</LastSeenInstallCount>
Expand Down
1 change: 1 addition & 0 deletions src/SyncTrayzor/App.Portable.config
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<NotifyOfNewVersions>true</NotifyOfNewVersions>
<ObfuscateDeviceIDs>true</ObfuscateDeviceIDs>
<UseComputerCulture>true</UseComputerCulture>
<Theme>System</Theme>
<SyncthingConsoleHeight>100</SyncthingConsoleHeight>
<SyncthingWebBrowserZoomLevel>0</SyncthingWebBrowserZoomLevel>
<LastSeenInstallCount>0</LastSeenInstallCount>
Expand Down
4 changes: 3 additions & 1 deletion src/SyncTrayzor/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using System.Reflection;
using SyncTrayzor.Localization;
using SyncTrayzor.Services.Ipc;
using SyncTrayzor.Services.Theming;
using System.Net;
using System.Runtime.Versioning;
using System.Windows.Media;
Expand Down Expand Up @@ -79,6 +80,7 @@ protected override void ConfigureIoC(IStyletIoCBuilder builder)
builder.Bind<IConnectedEventDebouncer>().To<ConnectedEventDebouncer>();
builder.Bind<IDonationManager>().To<DonationManager>().InSingletonScope();
builder.Bind<IInstallationHealthCheck>().To<InstallationHealthCheck>().InSingletonScope();
builder.Bind<IThemeManager>().To<ThemeManager>().InSingletonScope();

if (AppSettings.Instance.Variant == SyncTrayzorVariant.Installed)
builder.Bind<IUpdateVariantHandler>().To<InstalledUpdateVariantHandler>();
Expand Down Expand Up @@ -397,4 +399,4 @@ public override void Dispose()
base.Dispose();
}
}
}
}
2 changes: 1 addition & 1 deletion src/SyncTrayzor/Pages/BarAlerts/BarAlertsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemsControl ItemsSource="{Binding Items}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="LightGray" BorderThickness="0,0,0,1"
<Border BorderBrush="{DynamicResource AppBorderBrush}" BorderThickness="0,0,0,1"
Background="{Binding Severity, Converter={x:Static local:AlertSeverityToBackgroundColorConverter.Instance}}">
<ContentControl Margin="8,5" s:View.Model="{Binding}"/>
</Border>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="Button">
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Padding" Value="5,3"/>
<Setter Property="Margin" Value="0,0,0,5"/>
Expand Down
2 changes: 1 addition & 1 deletion src/SyncTrayzor/Pages/NewVersionAlertToastView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:l="clr-namespace:SyncTrayzor.Localization"
mc:Ignorable="d"
Width="500">
<Border CornerRadius="6" BorderThickness="4" BorderBrush="Gray" Background="White">
<Border CornerRadius="6" BorderThickness="4" BorderBrush="{DynamicResource AppBorderBrush}" Background="{DynamicResource AppSurfaceBrush}">
<DockPanel Margin="10" LastChildFill="False">
<TextBlock DockPanel.Dock="Top" TextAlignment="Center" FontWeight="Bold" FontSize="20" Text="{l:Loc NewVersionAlertView_Title}"/>
<TextBlock DockPanel.Dock="Top" TextWrapping="Wrap" Margin="0,10,0,0">
Expand Down
2 changes: 1 addition & 1 deletion src/SyncTrayzor/Pages/NewVersionInstalledToastView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:l="clr-namespace:SyncTrayzor.Localization"
mc:Ignorable="d">
<Border CornerRadius="6" BorderThickness="2" BorderBrush="Gray" Background="White">
<Border CornerRadius="6" BorderThickness="2" BorderBrush="{DynamicResource AppBorderBrush}" Background="{DynamicResource AppSurfaceBrush}">
<DockPanel Margin="10" LastChildFill="False">
<TextBlock DockPanel.Dock="Top" TextAlignment="Center" FontWeight="Bold" FontSize="20" Text="{l:Loc NewVersionInstalledView_Title}"/>
<TextBlock DockPanel.Dock="Top" Margin="0,10" Text="{l:Loc NewVersionInstalledView_Message, ValueBinding={Binding Version}}"/>
Expand Down
10 changes: 8 additions & 2 deletions src/SyncTrayzor/Pages/Settings/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</i:Interaction.Behaviors>
<Window.Resources>
<s:BoolToVisibilityConverter x:Key="InverseVisibilityConverter" TrueVisibility="Collapsed" FalseVisibility="Visible"/>
<Style TargetType="CheckBox">
<Style TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
Expand All @@ -38,7 +38,7 @@

<TabControl Background="Transparent" BorderThickness="0,1,0,0" SelectedIndex="{Binding SelectedTabIndex}">
<TabControl.Resources>
<Style TargetType="GroupBox">
<Style TargetType="GroupBox" BasedOn="{StaticResource {x:Type GroupBox}}">
<Setter Property="Padding" Value="5"/>
<Setter Property="Margin" Value="0,5,0,5"/>
</Style>
Expand All @@ -55,6 +55,12 @@
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding CloseToTray.Value}" Content="{l:Loc SettingsView_CloseToTray}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding NotifyOfNewVersions.Value}" Content="{l:Loc SettingsView_AlertOnNewVersion}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ObfuscateDeviceIDs.Value}" Content="{l:Loc SettingsView_ObfuscateDeviceIds}"/>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,2,0,4">
<Label Padding="0,0,8,0" Target="{Binding ElementName=ThemeSelect}" VerticalAlignment="Center"
Content="{l:Loc SettingsView_Theme}"/>
<ComboBox x:Name="ThemeSelect" MinWidth="140" ItemsSource="{Binding ApplicationThemes}"
SelectedValuePath="Value" SelectedValue="{Binding Theme.Value}"/>
</StackPanel>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding UseComputerCulture.Value}"
Content="{l:Loc SettingsView_UseComputerCulture}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding DisableHardwareRendering.Value}"
Expand Down
10 changes: 10 additions & 0 deletions src/SyncTrayzor/Pages/Settings/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Windows;
using System.IO;
using SyncTrayzor.Services.Metering;
using SyncTrayzor.Services.Theming;

namespace SyncTrayzor.Pages.Settings
{
Expand Down Expand Up @@ -60,6 +61,8 @@ public class SettingsViewModel : Screen
public SettingItem<bool> ObfuscateDeviceIDs { get; }
public SettingItem<bool> UseComputerCulture { get; }
public SettingItem<bool> DisableHardwareRendering { get; }
public BindableCollection<LabelledValue<ApplicationTheme>> ApplicationThemes { get; }
public SettingItem<ApplicationTheme> Theme { get; }
public SettingItem<bool> EnableConflictFileMonitoring { get; }
public SettingItem<bool> EnableFailedTransferAlerts { get; }

Expand Down Expand Up @@ -135,6 +138,13 @@ public SettingsViewModel(
UseComputerCulture.RequiresSyncTrayzorRestart = true;
DisableHardwareRendering = CreateBasicSettingItem(x => x.DisableHardwareRendering);
DisableHardwareRendering.RequiresSyncTrayzorRestart = true;
ApplicationThemes = new BindableCollection<LabelledValue<ApplicationTheme>>()
{
LabelledValue.Create(Resources.SettingsView_Theme_System, ApplicationTheme.System),
LabelledValue.Create(Resources.SettingsView_Theme_Light, ApplicationTheme.Light),
LabelledValue.Create(Resources.SettingsView_Theme_Dark, ApplicationTheme.Dark),
};
Theme = CreateBasicSettingItem(x => x.Theme);
EnableConflictFileMonitoring = CreateBasicSettingItem(x => x.EnableConflictFileMonitoring);
EnableFailedTransferAlerts = CreateBasicSettingItem(x => x.EnableFailedTransferAlerts);

Expand Down
20 changes: 10 additions & 10 deletions src/SyncTrayzor/Pages/Tray/FileTransfersTrayView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
d:DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=FileTransfersTrayViewModel}">
<UserControl.Resources>
<Style x:Key="SectionTitleStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="DimGray"/>
<Setter Property="Foreground" Value="{DynamicResource AppMutedForegroundBrush}"/>
<Setter Property="Margin" Value="5,3,0,3"/>
<Setter Property="FontSize" Value="14"/>
</Style>
Expand All @@ -25,12 +25,12 @@
</Style>
<Style x:Key="ItemBorderStyle" TargetType="Border">
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderBrush" Value="{DynamicResource AppBorderBrush}"/>
</Style>
</UserControl.Resources>
<Border CornerRadius="6" BorderThickness="0" Background="White">
<Border CornerRadius="6" BorderThickness="0" Background="{DynamicResource AppBackgroundBrush}">
<DockPanel>
<Border DockPanel.Dock="Top" BorderBrush="Gray" BorderThickness="0,0,0,1">
<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource AppBorderBrush}" BorderThickness="0,0,0,1">
<StackPanel Margin="5,8,5,8" Orientation="Horizontal">
<StackPanel Margin="0,0,10,0" Orientation="Horizontal" Visibility="{Binding InConnectionRate, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Line X2="10" Stroke="Red" StrokeThickness="2" VerticalAlignment="Center" />
Expand All @@ -54,7 +54,7 @@

<ScrollViewer VerticalScrollBarVisibility="Auto">
<DockPanel LastChildFill="False">
<Border DockPanel.Dock="Top" BorderBrush="LightGray" BorderThickness="0,0,0,1"
<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource AppBorderBrush}" BorderThickness="0,0,0,1"
Visibility="{Binding HasInProgressTransfers, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<TextBlock Style="{StaticResource SectionTitleStyle}" Text="{l:Loc FileTranfersTrayView_Header_Downloading}"/>
</Border>
Expand All @@ -66,7 +66,7 @@
<Image DockPanel.Dock="Left" Style="{StaticResource IconStyle}"
Source="{Binding Icon}"/>
<TextBlock DockPanel.Dock="Top" Text="{Binding Path}" TextTrimming="CharacterEllipsis"/>
<TextBlock DockPanel.Dock="Top" Foreground="DimGray" Text="{Binding ProgressString}"/>
<TextBlock DockPanel.Dock="Top" Foreground="{DynamicResource AppMutedForegroundBrush}" Text="{Binding ProgressString}"/>
<ProgressBar DockPanel.Dock="Top" Margin="0,4,0,0" Minimum="0" Maximum="100" Height="10"
Value="{Binding ProgressPercent, Mode=OneWay}"/>
</DockPanel>
Expand All @@ -75,7 +75,7 @@
</ItemsControl.ItemTemplate>
</ItemsControl>

<Border DockPanel.Dock="Top" BorderBrush="LightGray" BorderThickness="0,0,0,1"
<Border DockPanel.Dock="Top" BorderBrush="{DynamicResource AppBorderBrush}" BorderThickness="0,0,0,1"
Visibility="{Binding HasCompletedTransfers, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<TextBlock Style="{StaticResource SectionTitleStyle}" Text="{l:Loc FileTransfersTrayView_Header_RecentlyUpdated}"/>
</Border>
Expand Down Expand Up @@ -103,7 +103,7 @@
<Condition Binding="{Binding WasDeleted}" Value="False"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="Background" Value="#F5F9FF"/>
<Setter Property="Background" Value="{DynamicResource AppHoverBrush}"/>
<Setter Property="Cursor" Value="Hand"/>
</MultiDataTrigger.Setters>
</MultiDataTrigger>
Expand Down Expand Up @@ -135,12 +135,12 @@
</TextBlock.ToolTip>
</TextBlock>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
<TextBlock Foreground="DimGray" Text="{Binding CompletedTimeAgo}">
<TextBlock Foreground="{DynamicResource AppMutedForegroundBrush}" Text="{Binding CompletedTimeAgo}">
<TextBlock.ToolTip>
<TextBlock Text="{xaml:CultureAwareBinding Completed, StringFormat={}{0:g}}"/>
</TextBlock.ToolTip>
</TextBlock>
<TextBlock Foreground="DimGray" Margin="5,0,0,0" Text="{l:Loc FileTransfersTrayView_Deleted}"
<TextBlock Foreground="{DynamicResource AppMutedForegroundBrush}" Margin="5,0,0,0" Text="{l:Loc FileTransfersTrayView_Deleted}"
Visibility="{Binding WasDeleted, Converter={x:Static s:BoolToVisibilityConverter.Instance}}"/>
</StackPanel>
</DockPanel>
Expand Down
2 changes: 1 addition & 1 deletion src/SyncTrayzor/Pages/Tray/NetworkGraphView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Height="50"
Visibility="{Binding ShowGraph, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<DockPanel>
<TextBlock DockPanel.Dock="Right" VerticalAlignment="Top" Margin="0,3,5,0" Foreground="DarkGray" FontSize="10" Text="{Binding MaxYValue}"/>
<TextBlock DockPanel.Dock="Right" VerticalAlignment="Top" Margin="0,3,5,0" Foreground="{DynamicResource AppMutedForegroundBrush}" FontSize="10" Text="{Binding MaxYValue}"/>

<oxy:PlotView Model="{Binding OxyPlotModel}" DefaultTrackerTemplate="{x:Null}"/>
</DockPanel>
Expand Down
26 changes: 25 additions & 1 deletion src/SyncTrayzor/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/SyncTrayzor/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,18 @@
<value>SyncTrayzor</value>
<comment>Section header for settings to do with configuring SyncTrayzor</comment>
</data>
<data name="SettingsView_Theme" xml:space="preserve">
<value>Theme:</value>
</data>
<data name="SettingsView_Theme_System" xml:space="preserve">
<value>Use system setting</value>
</data>
<data name="SettingsView_Theme_Light" xml:space="preserve">
<value>Light</value>
</data>
<data name="SettingsView_Theme_Dark" xml:space="preserve">
<value>Dark</value>
</data>
<data name="SettingsView_StartMinimized" xml:space="preserve">
<value>Start Minimized</value>
<comment>Setting allowing the user to specify that, when SyncTrayzor is started automatically on login, it should start in the tray, rather than being visible to the user</comment>
Expand Down
14 changes: 13 additions & 1 deletion src/SyncTrayzor/Properties/Resources.tr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@
<data name="SettingsView_Section_SyncTrayzor" xml:space="preserve">
<value>SyncTrayzor</value>
</data>
<data name="SettingsView_Theme" xml:space="preserve">
<value>Tema:</value>
</data>
<data name="SettingsView_Theme_System" xml:space="preserve">
<value>Sistem ayarını kullan</value>
</data>
<data name="SettingsView_Theme_Light" xml:space="preserve">
<value>Açık</value>
</data>
<data name="SettingsView_Theme_Dark" xml:space="preserve">
<value>Koyu</value>
</data>
<data name="SettingsView_StartMinimized" xml:space="preserve">
<value>Simge Durumunda başlat</value>
</data>
Expand Down Expand Up @@ -801,4 +813,4 @@ Syncthing'i şimdi yeniden başlatmak istiyor musunuz?</value>
<data name="SettingsView_KeepActivityPopupOnTop" xml:space="preserve">
<value>Etkinlik açılır penceresini en üstte tut</value>
</data>
</root>
</root>
Loading