Skip to content

Commit

Permalink
Merge branch 'release/1.1.9'
Browse files Browse the repository at this point in the history
* release/1.1.9:
  Update version_check.php
  Update changelog
  Add a couple of apparently missing events
  Only try and get the long path name if it contains a tilde
  Events changes for 0.13
  Add options on when to animate the tray icon
  Actually, it's probably a good idea to log when we ignore a path unexpectedly
  Don't be case-sensitive when comparing paths in the file watcher
  Remove code which logs empty responses
  Correct AppData path in README
  Add NLog to the list of third-party components
  Clarify wording of 'devices paused'
  Don't crash if FileSystemWatcher indicates a change to a drive root
  Strip out support for file ignores
  Don't refresh browser when un-minimizing
  Catch empty responses from Syncthing
  Make PortableInstaller handle all edge-cases...
  • Loading branch information
canton7 committed May 3, 2016
2 parents b3d490f + c221228 commit 9e8a245
Show file tree
Hide file tree
Showing 30 changed files with 218 additions and 217 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

v1.1.9
------

- Add support for Syncthing v0.13 (#250)
- Add setting to control tray icon animation (#255)
- Don't refresh browser when un-minimizing (#248)
- Don't crash if the filesystem watcher sees a change at the drive root (#253)
- Handle filesystem notifications when Syncthing is configured with a path of the wrong case (#256)
- Clarify wording when device paused by metered network (#249)

v1.1.8
------

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ Good question. The answer depends on whether you installed SyncTrayzor using the

SyncTrayzor will install itself into `C:\Program Files\SyncTrayzor`.

By default, SyncTrayzor will put its own configuration in `C:\Users\<You>\AppData\Roaming\SyncTrayor`, and let Syncthing use its default folder for its database, which is `C:\Users\<You>\AppData\Local\Syncthing`.
By default, SyncTrayzor will put its own configuration in `C:\Users\<You>\AppData\Roaming\SyncTrayor`, and let Syncthing use its default folder for its database, which is `C:\Users\<You>\AppData\Roaming\Syncthing`.
It will also create a registry key at `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\SyncTrayzor` the first time that it is run, which will let it start when you log in.

You can delete this registry key by unchecking "Automatically start on login" in the settings.

If you uncheck "Use Syncthing's default database location" in the settings, then SyncTrayzor will tell Syncthing to use `C:\Users\<You>\AppData\Local\SyncTrayzor\syncthing` for its database.
If you uncheck "Use Syncthing's default database location" in the settings, then SyncTrayzor will tell Syncthing to use `C:\Users\<You>\AppData\Roaming\SyncTrayzor\syncthing` for its database.
This is useful if you want to keep the copy of Syncthing managed by SyncTrayzor separate from another copy running on your machine.

The auto-update mechanism may download updates to `%TEMP%\SyncTrayzor`.
Expand All @@ -148,9 +148,9 @@ This location is periodically cleared out (once every few days).

SyncTrayzor will put its own configuration in `SyncTrayzorPortable\data`, and tell Syncthing to use `SyncTrayzorPortable\data\syncthing` for its database.
This means that, when manually upgrading, you can simply move the 'data' folder over to move all your settings, and database.
If you check "Use Syncthing's default database location" in the settings (on the Syncthing tab), then Syncthing will use its default folder for its database, which is `C:\Users\<You>\AppData\Local\Syncthing`.
If you check "Use Syncthing's default database location" in the settings (on the Syncthing tab), then Syncthing will use its default folder for its database, which is `C:\Users\<You>\AppData\Roaming\Syncthing`.

If you're moving from "raw" Syncthing to SyncTrayzor, you'll either want to check this setting or move/copy the contents of `C:\Users\<You>\AppData\Local\Syncthing` into `data\syncthing`.
If you're moving from "raw" Syncthing to SyncTrayzor, you'll either want to check this setting or move/copy the contents of `C:\Users\<You>\AppData\Roaming\Syncthing` into `data\syncthing`.

The portable version won't start on login by default. If you check "Automatically start on login" in the settings, then a registry key will be created at `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\SyncTrayzor`.

Expand All @@ -162,13 +162,13 @@ Using Syncthing beta releases

SyncTrayzor keeps two copies of syncthing.exe.

The copy that is executed is at `C:\Users\<You>\AppData\Local\SyncTrayzor\syncthing.exe`.
The copy that is executed is at `C:\Users\<You>\AppData\Roaming\SyncTrayzor\syncthing.exe`.
This one is writable by the user, allowing Syncthing to auto-upgrade.

There's also a backup copy in `C:\Program Files\SyncTrayzor\syncthing.exe`.
This one is copied to `C:\Users\<You>\AppData\Local\SyncTrayzor\syncthing.exe` if that one does not exist (SyncTrayzor has never been run before for that user, for example).
This one is copied to `C:\Users\<You>\AppData\Roaming\SyncTrayzor\syncthing.exe` if that one does not exist (SyncTrayzor has never been run before for that user, for example).

If you want to manually upgrade (e.g. to a beta version) you should download Syncthing from [the releases page](https://github.com/syncthing/syncthing/releases), and replace the `syncthing.exe` in `C:\Users\<You>\AppData\Local\SyncTrayzor`.
If you want to manually upgrade (e.g. to a beta version) you should download Syncthing from [the releases page](https://github.com/syncthing/syncthing/releases), and replace the `syncthing.exe` in `C:\Users\<You>\AppData\Roaming\SyncTrayzor`.


### Portable
Expand Down
5 changes: 3 additions & 2 deletions server/version_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function get_with_wildcard($src, $value, $default = null)
}

$versions = [
'1.1.8' => [
'1.1.9' => [
'installed' => [
'direct_download_url' => [
'x64' => 'https://github.com/canton7/SyncTrayzor/releases/download/v{version}/SyncTrayzorSetup-x64.exe',
Expand All @@ -81,11 +81,12 @@ function get_with_wildcard($src, $value, $default = null)
'sha1sum_download_url' => 'https://github.com/canton7/SyncTrayzor/releases/download/v{version}/sha1sum.txt.asc',
'sha512sum_download_url' => 'https://github.com/canton7/SyncTrayzor/releases/download/v{version}/sha512sum.txt.asc',
'release_page_url' => 'https://github.com/canton7/SyncTrayzor/releases/tag/v{version}',
'release_notes' => "- Fix portable upgrades when there's a space in the path (will fix upgrades from 1.1.8 -> 1.1.9) (#232)\n- Improve quality of small tray icons slightly (#140)\n- Add \"new device\" / \"new folder\" balloon messages (#235)\n- Improve update checking schedule\n- Don't confuse the user when pausing devices on Windows 8+ (#242)\n- Fix touch screen operation (although touch screen scrolling is still broken upstream) (#241)\n- Allow settings window to be resized vertically (#238)\n- Move to SHA512 for verifying downloads\n- Add logging to help debug case where Syncthing returns odd values on startup\n- Remove API Key from settings",
'release_notes' => "- Add support for Syncthing v0.13\n- Add setting to control tray icon animation\n- Don't refresh browser when un-minimizing\n- Don't crash if the filesystem watcher sees a change at the drive root\n- Handle filesystem notifications when Syncthing is configured with a path of the wrong case\n- Clarify wording when device paused by metered network",
]
];

$upgrades = [
'1.1.8' => ['to' => 'latest', 'formatter' => '5'],
'1.1.7' => ['to' => 'latest', 'formatter' => '4'],
'1.1.6' => ['to' => 'latest', 'formatter' => '4'],
'1.1.5' => ['to' => 'latest', 'formatter' => '4'],
Expand Down
34 changes: 31 additions & 3 deletions src/PortableInstaller/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static int Main(string[] args)
// args[4] is a new parameter containing arguments to args[3] (path to restart application)

RecycleBinDeleter.Logger = s => Log("!! " + s);
if (args.Length < 4 || args.Length > 5)
if (args.Length < 4)
{
Console.WriteLine("You should not invoke this executable directly. It is used as part of the automatic upgrade process for portable installations.");
Console.ReadKey();
Expand All @@ -28,8 +28,36 @@ public static int Main(string[] args)
var destinationPath = args[0];
var sourcePath = args[1];
var waitForPid = Int32.Parse(args[2]);
var pathToRestartApplication = args[3];
var pathToRestartApplicationParameters = (args.Length == 5) ? args[4] : String.Empty;

// Right, so we can be called in a variety of painful ways, depending on the version of SyncTrayzor
// we're upgrading from. Possible options:
// 1. { 'path\to\SyncTrayzor.exe' }
// 2. { 'path\to\SyncTrayzor.exe -minimized' }
// 3. { 'path', 'with', 'space\to\SyncTrayzor.exe -minimized' }
// 4. { 'path with space\to\SyncTrayzor.exe' }
// 5. { 'path with space\to\SyncTrayzor.exe', '-minimized' }

var pathToRestartParts = args.Skip(3).ToList();
var pathToRestartApplicationParameters = String.Empty;

// Does the last element end with '-minimized'? Strip it off, and add it as an element at the end
var lastElement = pathToRestartParts.Last();
if (lastElement.EndsWith(" -minimized"))
{
pathToRestartParts[pathToRestartParts.Count - 1] = lastElement.Substring(0, lastElement.Length - " -minimized".Length);
pathToRestartParts.Add("-minimized");
}

// Is the last element "-minimized"? Cut it off.
if (pathToRestartParts.Last() == "-minimized")
{
pathToRestartApplicationParameters = "-minimized";
pathToRestartParts.RemoveAt(pathToRestartParts.Count - 1);
}

// Join the rest together
var pathToRestartApplication = String.Join(" ", pathToRestartParts);

var destinationPathParent = Path.GetDirectoryName(destinationPath);

try
Expand Down
3 changes: 2 additions & 1 deletion src/SyncTrayzor/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<DirectoryWatcherFolderExistenceCheckMilliseconds>3000</DirectoryWatcherFolderExistenceCheckMilliseconds>
<IssuesUrl>http://github.com/canton7/SyncTrayzor/issues</IssuesUrl>
<EnableAutostartOnFirstStart>false</EnableAutostartOnFirstStart>
<CefRemoteDebuggingPort>0</CefRemoteDebuggingPort>
<CefRemoteDebuggingPort>2004</CefRemoteDebuggingPort>
<Variant>Portable</Variant>
<SyncthingConnectTimeoutSeconds>600</SyncthingConnectTimeoutSeconds>
<EnforceSingleProcessPerUser>true</EnforceSingleProcessPerUser>
Expand Down Expand Up @@ -59,6 +59,7 @@
<ConflictResolverDeletesToRecycleBin>true</ConflictResolverDeletesToRecycleBin>
<PauseDevicesOnMeteredNetworks>true</PauseDevicesOnMeteredNetworks>
<HaveDonated>false</HaveDonated>
<IconAnimationMode>DataTransferring</IconAnimationMode>
</DefaultUserConfiguration>
</settings>

Expand Down
39 changes: 36 additions & 3 deletions src/SyncTrayzor/NotifyIcon/NotifyIconViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using SyncTrayzor.Pages;
using SyncTrayzor.Pages.Settings;
using SyncTrayzor.Services;
using SyncTrayzor.Services.Config;
using SyncTrayzor.Syncthing;
using SyncTrayzor.Syncthing.Folders;
using SyncTrayzor.Utils;
Expand All @@ -18,6 +19,7 @@ public class NotifyIconViewModel : PropertyChangedBase, IDisposable
private readonly Func<SettingsViewModel> settingsViewModelFactory;
private readonly IProcessStartProvider processStartProvider;
private readonly IAlertsManager alertsManager;
private readonly IConfigurationProvider configurationProvider;

public bool Visible { get; set; }
public bool MainWindowVisible { get; set; }
Expand All @@ -38,28 +40,37 @@ public class NotifyIconViewModel : PropertyChangedBase, IDisposable

public bool SyncthingSyncing { get; private set; }

private IconAnimationMode iconAnimationmode;

public NotifyIconViewModel(
IWindowManager windowManager,
ISyncthingManager syncthingManager,
Func<SettingsViewModel> settingsViewModelFactory,
IProcessStartProvider processStartProvider,
IAlertsManager alertsManager,
FileTransfersTrayViewModel fileTransfersViewModel)
FileTransfersTrayViewModel fileTransfersViewModel,
IConfigurationProvider configurationProvider)
{
this.windowManager = windowManager;
this.syncthingManager = syncthingManager;
this.settingsViewModelFactory = settingsViewModelFactory;
this.processStartProvider = processStartProvider;
this.alertsManager = alertsManager;
this.FileTransfersViewModel = fileTransfersViewModel;
this.configurationProvider = configurationProvider;

this.syncthingManager.StateChanged += this.StateChanged;
this.SyncthingState = this.syncthingManager.State;

this.syncthingManager.TotalConnectionStatsChanged += this.TotalConnectionStatsChanged;
this.syncthingManager.DataLoaded += this.DataLoaded;
this.syncthingManager.Folders.SyncStateChanged += this.FolderSyncStateChanged;


this.alertsManager.AlertsStateChanged += this.AlertsStateChanged;

this.configurationProvider.ConfigurationChanged += this.ConfigurationChanged;
this.iconAnimationmode = this.configurationProvider.Load().IconAnimationMode;
}

private void StateChanged(object sender, SyncthingStateChangedEventArgs e)
Expand All @@ -71,8 +82,11 @@ private void StateChanged(object sender, SyncthingStateChangedEventArgs e)

private void TotalConnectionStatsChanged(object sender, ConnectionStatsChangedEventArgs e)
{
var stats = e.TotalConnectionStats;
this.SyncthingSyncing = stats.InBytesPerSecond > 0 || stats.OutBytesPerSecond > 0;
if (this.iconAnimationmode == IconAnimationMode.DataTransferring)
{
var stats = e.TotalConnectionStats;
this.SyncthingSyncing = stats.InBytesPerSecond > 0 || stats.OutBytesPerSecond > 0;
}
}

private void DataLoaded(object sender, EventArgs e)
Expand All @@ -82,12 +96,28 @@ private void DataLoaded(object sender, EventArgs e)
.OrderBy(x => x.FolderId));
}

private void FolderSyncStateChanged(object sender, FolderSyncStateChangedEventArgs e)
{
if (this.iconAnimationmode == IconAnimationMode.Syncing)
{
var anySyncing = this.syncthingManager.Folders.FetchAll().Any(x => x.SyncState == FolderSyncState.Syncing);
this.SyncthingSyncing = anySyncing;
}
}

private void AlertsStateChanged(object sender, EventArgs e)
{
this.NotifyOfPropertyChange(nameof(this.SyncthingDevicesPaused));
this.NotifyOfPropertyChange(nameof(this.SyncthingWarning));
}

private void ConfigurationChanged(object sender, ConfigurationChangedEventArgs e)
{
this.iconAnimationmode = e.NewConfiguration.IconAnimationMode;
// Reset, just in case
this.SyncthingSyncing = false;
}

public void DoubleClick()
{
this.OnWindowOpenRequested();
Expand Down Expand Up @@ -144,8 +174,11 @@ public void Dispose()

this.syncthingManager.TotalConnectionStatsChanged -= this.TotalConnectionStatsChanged;
this.syncthingManager.DataLoaded -= this.DataLoaded;
this.syncthingManager.Folders.SyncStateChanged -= this.FolderSyncStateChanged;

this.alertsManager.AlertsStateChanged -= this.AlertsStateChanged;

this.configurationProvider.ConfigurationChanged -= this.ConfigurationChanged;
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/SyncTrayzor/Pages/Settings/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowDeviceConnectivityBalloons.Value}" Content="{l:Loc SettingsView_ShowDeviceConnectivityBalloons}"/>
<CheckBox DockPanel.Dock="Top" IsChecked="{Binding ShowDeviceOrFolderRejectedBalloons.Value}" Content="{l:Loc SettingsView_ShowDeviceOrFolderRejectedBalloons}"/>
<TextBlock DockPanel.Dock="Top" Margin="0,5,0,0" Text="{l:Loc SettingsView_Alerts_SeeFolders}"/>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,5,0,0">
<Label Padding="0,0,5,0" Target="{Binding ElementName=IconAnimationModeSelect}" VerticalAlignment="Center" Content="{l:Loc SettingsView_AnimateTrayIcon}"/>
<ComboBox x:Name="IconAnimationModeSelect" ItemsSource="{Binding IconAnimationModes}" SelectedValuePath="Value" SelectedValue="{Binding IconAnimationMode.Value}"/>
</StackPanel>
</DockPanel>
</GroupBox>

Expand Down Expand Up @@ -129,8 +133,8 @@
Content="{l:Loc SettingsView_SyncthingUseDefaultHome}"
ToolTip="{l:Loc SettingsView_SyncthingUseDefaultHome_ToolTip}"/>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock Margin="0,0,5,0" Text="{l:Loc SettingsView_Syncthing_ProcessPriority}"/>
<ComboBox ItemsSource="{Binding PriorityLevels}" SelectedValuePath="Value" SelectedValue="{Binding SyncthingPriorityLevel.Value}"/>
<Label Padding="0,0,5,0" Target="{Binding ElementName=PropertyLevelsSelect}" VerticalAlignment="Center" Content="{l:Loc SettingsView_Syncthing_ProcessPriority}"/>
<ComboBox x:Name="PropertyLevelsSelect" ItemsSource="{Binding PriorityLevels}" SelectedValuePath="Value" SelectedValue="{Binding SyncthingPriorityLevel.Value}"/>
</StackPanel>

<Label DockPanel.Dock="Top" Target="{Binding ElementName=SyncthingAddress}" Content="{l:Loc SettingsView_SyncthingAddress}" ToolTip="{StaticResource AddressOverride}"/>
Expand Down
11 changes: 11 additions & 0 deletions src/SyncTrayzor/Pages/Settings/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public class SettingsViewModel : Screen
public SettingItem<bool> ShowDeviceConnectivityBalloons { get; }
public SettingItem<bool> ShowDeviceOrFolderRejectedBalloons { get; }

public BindableCollection<LabelledValue<IconAnimationMode>> IconAnimationModes { get; }
public SettingItem<IconAnimationMode> IconAnimationMode { get; }

public SettingItem<bool> StartSyncthingAutomatically { get; }

public BindableCollection<LabelledValue<SyncthingPriorityLevel>> PriorityLevels { get; }
Expand Down Expand Up @@ -129,6 +132,14 @@ public SettingsViewModel(
this.ShowDeviceConnectivityBalloons = this.CreateBasicSettingItem(x => x.ShowDeviceConnectivityBalloons);
this.ShowDeviceOrFolderRejectedBalloons = this.CreateBasicSettingItem(x => x.ShowDeviceOrFolderRejectedBalloons);

this.IconAnimationModes = new BindableCollection<LabelledValue<IconAnimationMode>>()
{
LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_DataTransferring, Services.Config.IconAnimationMode.DataTransferring),
LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_Syncing, Services.Config.IconAnimationMode.Syncing),
LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_Disabled, Services.Config.IconAnimationMode.Disabled),
};
this.IconAnimationMode = this.CreateBasicSettingItem(x => x.IconAnimationMode);

this.StartSyncthingAutomatically = this.CreateBasicSettingItem(x => x.StartSyncthingAutomatically);
this.SyncthingPriorityLevel = this.CreateBasicSettingItem(x => x.SyncthingPriorityLevel);
this.SyncthingPriorityLevel.RequiresSyncthingRestart = true;
Expand Down
Loading

0 comments on commit 9e8a245

Please sign in to comment.