Skip to content

Commit

Permalink
Merge branch 'release/1.0.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
canton7 committed Mar 17, 2015
2 parents ad4fe58 + 85c9ba8 commit 013369e
Show file tree
Hide file tree
Showing 43 changed files with 1,423 additions and 262 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.xaml eol=crlf
*.sln eol=crlf
*.csproj eol=crlf
*.resx eol=crlf
2 changes: 1 addition & 1 deletion .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ type = RESX

; Irritatingly, Transifex likes xx_XX, .NET likes xx-XX and there's no way
; (that I can find) to map between them
lang_map = de_DE:de-DE
lang_map = nl_NL:nl-NL
16 changes: 13 additions & 3 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
Changelog
=========

v1.0.9
------

- Fix bug with directory watcher and paths containing a tilde (~)
- Fix resolution issue with taskbar icon
- Add 'device connected/disconnected' tray icon balloon messages
- Add Dutch transation (thanks Heimen Stoffels!)
- Small redution in memory usage
- Add menu item to restart Syncthing

v1.0.8
------

- Support HTTPS
- Add German translation (thanks Adrian Rudnik)
- Ensure SyncTrayzor is terminated properly when updating/uninstalling using the installer
- Support HTTPS
- Add German translation (thanks Adrian Rudnik)
- Ensure SyncTrayzor is terminated properly when updating/uninstalling using the installer

v1.0.7
------
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,20 @@ Grab the latest standalone .zip from the [releases](https://github.com/canton7/S
Unzip, and run `SyncTrayzor.exe`. If you're updating, you'll need to copy the `data` folder across from your previous standalone installation.


Something went wrong!
---------------------

First, what went wrong? Remember that SyncTrayzor is a wrapper around [Syncthing](http://github.com/syncthing/syncthing).
Syncthing is the file synchronization program, which has a web interface.
SyncTrayzor is the tray utilty, looks like a normal Windows program, and has menus and suchlike, and a big area where Syncthing's web interface is displayed.

- If you're having problems connection to other devices, your files aren't synchronizing, or you're getting error messages in the console area, [raise an issue with Syncthing](http://github.com/syncthing/syncthing) or [post on the Syncthing forums](http://discourse.syncthing.net).
- If SyncTrayzor isn't talking to Syncthing, you're getting error dialogs, it's not auto-starting, etc, [raise an issue with SyncTrayzor](http://github.com/canton7/SyncTrayzor).
- If you're not sure, raise an issue here and I'll redirect you if appropriate.

Contributing
------------

Got a bug? [Raise an issue](https://github.com/canton7/SyncTrayzor/issues), providing as much detail as you can.

Multi-lingual? SyncTrayzor needs you! Please read [Localization](https://github.com/canton7/SyncTrayzor/wiki/Localization).

Want to make a contribution? Fantastic, and thank you! Please read [Contributing](https://github.com/canton7/SyncTrayzor/wiki/Contributing) first.
Expand Down
12 changes: 12 additions & 0 deletions src/SyncTrayzor/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
using NLog;
using Stylet;
using StyletIoC;
using SyncTrayzor.Localization;
using SyncTrayzor.NotifyIcon;
using SyncTrayzor.Pages;
using SyncTrayzor.Properties;
using SyncTrayzor.Services;
using SyncTrayzor.Services.UpdateChecker;
using SyncTrayzor.SyncThing;
using SyncTrayzor.SyncThing.EventWatcher;
using SyncTrayzor.Utils;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -79,9 +81,19 @@ protected override void Configure()
notifyIconManager.Setup((INotifyIconDelegate)this.RootViewModel);
this.Container.Get<ConfigurationApplicator>().ApplyConfiguration();

this.Container.Get<MemoryUsageLogger>().Enabled = true;

// Horrible workaround for a CefSharp crash on logout/shutdown
// https://github.com/cefsharp/CefSharp/issues/800#issuecomment-75058534
this.Application.SessionEnding += (o, e) => Process.GetCurrentProcess().Kill();

MessageBoxViewModel.ButtonLabels = new Dictionary<MessageBoxResult, string>()
{
{ MessageBoxResult.Cancel, Localizer.Translate("Generic_Dialog_Cancel") },
{ MessageBoxResult.No, Localizer.Translate("Generic_Dialog_No") },
{ MessageBoxResult.OK, Localizer.Translate("Generic_Dialog_OK") },
{ MessageBoxResult.Yes, Localizer.Translate("Generic_Dialog_Yes") },
};
}

protected override void OnStart()
Expand Down
6 changes: 6 additions & 0 deletions src/SyncTrayzor/Localization/Localizer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using SyncTrayzor.Properties.Strings;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -18,5 +19,10 @@ public static string Translate(string key, params object[] parameters)

return String.Format(format, parameters);
}

public static string OriginalTranslation(string key)
{
return Resources.ResourceManager.GetString(key, new CultureInfo("en-US", false));
}
}
}
21 changes: 21 additions & 0 deletions src/SyncTrayzor/NotifyIcon/NotifyIconManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public interface INotifyIconManager
bool MinimizeToTray { get; set; }
bool CloseToTray { get; set; }
bool ShowSynchronizedBalloon { get; set; }
bool ShowDeviceConnectivityBalloons { get; set; }

void Setup(INotifyIconDelegate rootViewModel);

Expand Down Expand Up @@ -58,6 +59,7 @@ public bool CloseToTray
}

public bool ShowSynchronizedBalloon { get; set; }
public bool ShowDeviceConnectivityBalloons { get; set; }

public NotifyIconManager(
IViewManager viewManager,
Expand All @@ -81,12 +83,31 @@ public NotifyIconManager(
{
if (this.ShowSynchronizedBalloon &&
DateTime.UtcNow - this.syncThingManager.LastConnectivityEventTime > syncedDeadTime &&
DateTime.UtcNow - this.syncThingManager.StartedTime > syncedDeadTime &&
e.SyncState == FolderSyncState.Idle && e.PrevSyncState == FolderSyncState.Syncing)
{
Application.Current.Dispatcher.CheckAccess(); // Double-check
this.taskbarIcon.ShowBalloonTip(Localizer.Translate("TrayIcon_Balloon_FinishedSyncing_Title"), Localizer.Translate("TrayIcon_Balloon_FinishedSyncing_Message", e.Folder.FolderId), BalloonIcon.Info);
}
};

this.syncThingManager.DeviceConnected += (o, e) =>
{
if (this.ShowDeviceConnectivityBalloons &&
DateTime.UtcNow - this.syncThingManager.StartedTime > syncedDeadTime)
{
this.taskbarIcon.ShowBalloonTip(Localizer.Translate("TrayIcon_Balloon_DeviceConnected_Title"), Localizer.Translate("TrayIcon_Balloon_DeviceConnected_Message", e.Device.Name), BalloonIcon.Info);
}
};

this.syncThingManager.DeviceDisconnected += (o, e) =>
{
if (this.ShowDeviceConnectivityBalloons &&
DateTime.UtcNow - this.syncThingManager.StartedTime > syncedDeadTime)
{
this.taskbarIcon.ShowBalloonTip(Localizer.Translate("TrayIcon_Balloon_DeviceDisconnected_Title"), Localizer.Translate("TrayIcon_Balloon_DeviceDisconnected_Message", e.Device.Name), BalloonIcon.Info);
}
};
}

private void SetShutdownMode()
Expand Down
9 changes: 9 additions & 0 deletions src/SyncTrayzor/NotifyIcon/NotifyIconViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ public void Stop()
this.syncThingManager.StopAsync();
}

public bool CanRestart
{
get { return this.SyncThingState == SyncThingState.Running; }
}
public void Restart()
{
this.syncThingManager.RestartAsync();
}

public void Exit()
{
this.OnExitRequested();
Expand Down
3 changes: 2 additions & 1 deletion src/SyncTrayzor/NotifyIcon/TaskbarIconResources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<BeginStoryboard Storyboard="{StaticResource IconAnimation}" Name="IconAnimation"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<StopStoryboard BeginStoryboardName="IconAnimation"/>
<RemoveStoryboard BeginStoryboardName="IconAnimation"/>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
Expand All @@ -76,6 +76,7 @@

<MenuItem Header="{l:Loc TrayIcon_Menu_StartSyncthing}" Command="{s:Action Start, ActionNotFound=Disable}"/>
<MenuItem Header="{l:Loc TrayIcon_Menu_StopSyncthing}" Command="{s:Action Stop, ActionNotFound=Disable}"/>
<MenuItem Header="{l:Loc TrayIcon_Menu_RestartSyncthing}" Command="{s:Action Restart, ActionNotFound=Disable}"/>

<MenuItem Header="{l:Loc TrayIcon_Menu_Settings}" Command="{s:Action ShowSettings, ActionNotFound=Disable}"/>
<MenuItem Header="{l:Loc TrayIcon_Menu_Exit}" Command="{s:Action Exit, ActionNotFound=Disable}"/>
Expand Down
9 changes: 8 additions & 1 deletion src/SyncTrayzor/Pages/AboutView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:s="https://github.com/canton7/Stylet"
xmlns:l="clr-namespace:SyncTrayzor.Localization"
Height="300" Width="250"
WindowStyle="None" SizeToContent="WidthAndHeight"
WindowStyle="None" SizeToContent="Height"
ShowInTaskbar="False">
<Window.Resources>
<s:BoolToVisibilityConverter x:Key="NoNewVersionVisibility" TrueVisibility="Collapsed" FalseVisibility="Visible"/>
Expand All @@ -29,6 +29,13 @@
</StackPanel>
<TextBlock DockPanel.Dock="Top" Margin="0,5,0,0" Text="{l:Loc AboutView_CreatedByAuthor}"/>
<TextBlock DockPanel.Dock="Top" Margin="0,0,0,5" Text="{l:Loc AboutView_ReleasedLicense}"/>

<Grid DockPanel.Dock="Top">
<TextBlock DockPanel.Dock="Top" Margin="0,5" Text="{l:Loc TranslatorAttributation}" TextWrapping="Wrap"
Width="{Binding Parent.ActualWidth, RelativeSource={RelativeSource Self}}"
Visibility="{Binding ShowTranslatorAttributation, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}"/>
</Grid>

<TextBlock DockPanel.Dock="Top" Margin="0,5">
<Hyperlink Command="{s:Action ShowHomepage}">
<TextBlock Text="{Binding HomepageUrl}"/>
Expand Down
4 changes: 4 additions & 0 deletions src/SyncTrayzor/Pages/AboutViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public class AboutViewModel : Screen
public string HomepageUrl { get; set; }

public string NewerVersion { get; set; }
public bool ShowTranslatorAttributation
{
get { return Localizer.Translate("TranslatorAttributation") == Localizer.OriginalTranslation("TranslatorAttributation"); }
}
private string newerVersionDownloadUrl;

public AboutViewModel(
Expand Down
27 changes: 10 additions & 17 deletions src/SyncTrayzor/Pages/ConsoleView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,25 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
mc:Ignorable="d"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:xaml="clr-namespace:SyncTrayzor.Xaml"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<xaml:LogMessageListToStringConverter x:Key="LogMessagesConverter"/>
</UserControl.Resources>
<Grid>
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" xaml:ScrollViewerUtilities.ScrollToEndSource="{Binding LogMessages}">
<ItemsControl ItemsSource="{Binding LogMessages}" VirtualizingPanel.IsVirtualizing="True">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Mode=OneWay}"
FontFamily="Consolas"
FontSize="11"
IsReadOnly="True"
BorderThickness="0"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

<!--<TextBox xaml:TextBoxUtilities.AlwaysScrollToEnd="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
<TextBox ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
FontFamily="Consolas"
FontSize="11"
IsReadOnly="True"
UndoLimit="0"
Text="{Binding LogMessages}"/>-->
Text="{Binding LogMessages, Converter={StaticResource LogMessagesConverter}}">
<i:Interaction.Behaviors>
<xaml:ScrollToEndBehaviour/>
</i:Interaction.Behaviors>
</TextBox>
</Grid>
</UserControl>
5 changes: 3 additions & 2 deletions src/SyncTrayzor/Pages/ConsoleViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public class ConsoleViewModel : Screen
private readonly ISyncThingManager syncThingManager;
private readonly IConfigurationProvider configurationProvider;

public ObservableQueue<string> LogMessages { get; private set; }
public Queue<string> LogMessages { get; private set; }

public ConsoleViewModel(
ISyncThingManager syncThingManager,
IConfigurationProvider configurationProvider)
{
this.syncThingManager = syncThingManager;
this.configurationProvider = configurationProvider;
this.LogMessages = new ObservableQueue<string>();
this.LogMessages = new Queue<string>();

var configuration = this.configurationProvider.Load();
this.configurationProvider.ConfigurationChanged += (o, e) => configuration = e.NewConfiguration;
Expand All @@ -45,6 +45,7 @@ public ConsoleViewModel(
this.LogMessages.Enqueue(message);
if (this.LogMessages.Count > maxLogMessages)
this.LogMessages.Dequeue();
this.NotifyOfPropertyChange(() => this.LogMessages);
};
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/SyncTrayzor/Pages/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,19 @@
<DockPanel>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding MinimizeToTray}" Content="{l:Loc SettingsView_MinimizeToTray}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding CloseToTray}" Content="{l:Loc SettingsView_CloseToTray}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowTrayIconOnlyOnClose}" Content="{l:Loc SettingsView_OnlyShowTrayIconOnClose}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowSynchronizedBalloon}" Content="{l:Loc SettingsView_ShowBalloonWhenSynchronized}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding NotifyOfNewVersions}" Content="{l:Loc SettingsView_AlertOnNewVersion}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ObfuscateDeviceIDs}" Content="{l:Loc SettingsView_ObfuscateDeviceIds}"/>
</DockPanel>
</GroupBox>

<GroupBox DockPanel.Dock="Top" Header="{l:Loc SettingsView_Section_TrayIcon}">
<DockPanel>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowTrayIconOnlyOnClose}" Content="{l:Loc SettingsView_OnlyShowTrayIconOnClose}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowSynchronizedBalloon}" Content="{l:Loc SettingsView_ShowBalloonWhenSynchronized}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowDeviceConnectivityBalloons}" Content="{l:Loc SettingsView_ShowDeviceConnectivityBalloons}"/>
</DockPanel>
</GroupBox>

<GroupBox DockPanel.Dock="Top" Header="{l:Loc SettingsView_Section_Syncthing}">
<DockPanel>
<DockPanel.Resources>
Expand Down
18 changes: 12 additions & 6 deletions src/SyncTrayzor/Pages/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ public class SettingsViewModel : Screen
private readonly IConfigurationProvider configurationProvider;
private readonly IAutostartProvider autostartProvider;

public bool ShowTrayIconOnlyOnClose { get; set;}
public bool MinimizeToTray { get; set; }
public bool CloseToTray { get; set; }
public bool ShowSynchronizedBalloon { get; set; }
public bool NotifyOfNewVersions { get; set; }
public bool ObfuscateDeviceIDs { get; set; }

public bool ShowTrayIconOnlyOnClose { get; set; }
public bool ShowSynchronizedBalloon { get; set; }
public bool ShowDeviceConnectivityBalloons { get; set; }

public bool StartSyncThingAutomatically { get; set; }
public string SyncThingAddress { get; set; }
public string SyncThingApiKey { get; set; }
Expand Down Expand Up @@ -84,13 +86,15 @@ public SettingsViewModel(

var configuration = this.configurationProvider.Load();

this.ShowTrayIconOnlyOnClose = configuration.ShowTrayIconOnlyOnClose;
this.MinimizeToTray = configuration.MinimizeToTray;
this.CloseToTray = configuration.CloseToTray;
this.ShowSynchronizedBalloon = configuration.ShowSynchronizedBalloon;
this.NotifyOfNewVersions = configuration.NotifyOfNewVersions;
this.ObfuscateDeviceIDs = configuration.ObfuscateDeviceIDs;

this.ShowTrayIconOnlyOnClose = configuration.ShowTrayIconOnlyOnClose;
this.ShowSynchronizedBalloon = configuration.ShowSynchronizedBalloon;
this.ShowDeviceConnectivityBalloons = configuration.ShowDeviceConnectivityBalloons;

this.StartSyncThingAutomatically = configuration.StartSyncthingAutomatically;
this.SyncThingAddress = configuration.SyncthingAddress;
this.SyncThingApiKey = configuration.SyncthingApiKey;
Expand Down Expand Up @@ -127,13 +131,15 @@ public void Save()
{
var configuration = this.configurationProvider.Load();

configuration.ShowTrayIconOnlyOnClose = this.ShowTrayIconOnlyOnClose;
configuration.MinimizeToTray = this.MinimizeToTray;
configuration.CloseToTray = this.CloseToTray;
configuration.ShowSynchronizedBalloon = this.ShowSynchronizedBalloon;
configuration.NotifyOfNewVersions = this.NotifyOfNewVersions;
configuration.ObfuscateDeviceIDs = this.ObfuscateDeviceIDs;

configuration.ShowTrayIconOnlyOnClose = this.ShowTrayIconOnlyOnClose;
configuration.ShowSynchronizedBalloon = this.ShowSynchronizedBalloon;
configuration.ShowDeviceConnectivityBalloons = this.ShowDeviceConnectivityBalloons;

configuration.StartSyncthingAutomatically = this.StartSyncThingAutomatically;
configuration.SyncthingAddress = this.SyncThingAddress;
configuration.SyncthingApiKey = this.SyncThingApiKey;
Expand Down
4 changes: 2 additions & 2 deletions src/SyncTrayzor/Pages/ShellView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
xmlns:xaml="clr-namespace:SyncTrayzor.Xaml"
xmlns:l="clr-namespace:SyncTrayzor.Localization"
Height="700" Width="1100"
Title="SyncTrayzor"
Icon="..\Icons\default_tray.ico">
Title="SyncTrayzor">
<i:Interaction.Behaviors>
<xaml:ActivateBehaviour Activated="{Binding WindowActivated}"/>
</i:Interaction.Behaviors>
Expand All @@ -20,6 +19,7 @@
<MenuItem Header="{l:Loc ShellView_Menu_Syncthing}">
<MenuItem Header="{l:Loc ShellView_Menu_Syncthing_Start}" Command="{s:Action Start}"/>
<MenuItem Header="{l:Loc ShellView_Menu_Syncthing_Stop}" Command="{s:Action Stop}"/>
<MenuItem Header="{l:Loc ShellView_Menu_Syncthing_Restart}" Command="{s:Action Restart}"/>
<MenuItem Header="{l:Loc ShellView_Menu_Syncthing_Kill}" Command="{s:Action Kill}"/>
<MenuItem Header="{l:Loc ShellView_Menu_Syncthing_Refresh}" Command="{s:Action RefreshBrowser}"/>
<MenuItem Header="{l:Loc ShellView_Menu_Syncthing_OpenExternal}" Command="{s:Action OpenBrowser}"/>
Expand Down
Loading

0 comments on commit 013369e

Please sign in to comment.