Skip to content

Commit

Permalink
Merge branch 'release/1.0.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
canton7 committed Mar 23, 2015
2 parents 013369e + 7a23e2d commit 3870b4f
Show file tree
Hide file tree
Showing 43 changed files with 2,028 additions and 1,110 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.sln eol=crlf
*.csproj eol=crlf
*.resx eol=crlf
*.settings eol=crlf
*.config 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 = nl_NL:nl-NL
lang_map = nl_NL:nl,es_ES:es
18 changes: 18 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Changelog
=========

v1.0.10
-------

- Add "Open Folder" buttons (#32):
- In the GUI, next to 'Edit' and 'Rescan'
- In the tray icon's right-click menu
- Add settings to:
- Stop Syncthing auto-upgrading
- Run Syncthing as a low-priority process (#24)
- Disable localization (#35)
- Check for updates when resuming from sleep (#34)
- Add Spanish translation (thanks Diego Sierra!)
- Break Settings dialog into multiple tabs, for those with small screens (#29)
- Always use HTTPS (#33)
- Store path configuration and default user configuration in SyncTrayzor.exe.config (#30)
- Reload Syncthing's address / home dir / API key / etc when it's restarted (#31)
- Fix tray icon

v1.0.9
------

Expand Down
75 changes: 40 additions & 35 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'rexml/document'
require 'tmpdir'

begin
require 'albacore'
rescue LoadError
Expand All @@ -7,15 +8,13 @@ rescue LoadError
end

ISCC = 'C:\Program Files (x86)\Inno Setup 5\ISCC.exe'
unless File.exist?(ISCC)
warn "Please install Inno Setup"
exit 1
end
SZIP = 'C:\Program Files\7-Zip\7z.exe'

CONFIG = ENV['CONFIG'] || 'Release'

SRC_DIR = 'src/SyncTrayzor'
INSTALLER_DIR = 'installer'
PORTABLE_DIR = 'portable'

class ArchDirConfig
attr_reader :arch
Expand All @@ -24,14 +23,16 @@ class ArchDirConfig
attr_reader :installer_output
attr_reader :installer_iss
attr_reader :portable_output_dir
attr_reader :portable_output_file

def initialize(arch)
@arch = arch
@bin_dir = "bin/#{@arch}/#{CONFIG}"
@installer_dir = File.join(INSTALLER_DIR, @arch)
@installer_output = File.join(@installer_dir, "SyncTrayzorSetup-#{@arch}.exe")
@installer_iss = File.join(@installer_dir, "installer-#{@arch}.iss")
@portable_output_dir = File.absolute_path("SyncTrayzorPortable-#{@arch}")
@portable_output_dir = "SyncTrayzorPortable-#{@arch}"
@portable_output_file = File.join(PORTABLE_DIR, "SyncTrayzorPortable-#{@arch}.zip")
end
end

Expand All @@ -55,7 +56,12 @@ task :build => ARCH_CONFIG.map{ |x| :"build:#{x.arch}" }
namespace :installer do
ARCH_CONFIG.each do |arch_config|
desc "Create the installer (#{arch_config.arch})"
task arch_config.arch do
task arch_config.arch => [:"build:#{arch_config.arch}"] do
unless File.exist?(ISCC)
warn "Please install Inno Setup"
exit 1
end

rm arch_config.installer_output if File.exist?(arch_config.installer_output)
sh %Q{"#{ISCC}"}, arch_config.installer_iss
end
Expand All @@ -78,39 +84,38 @@ end
namespace :portable do
ARCH_CONFIG.each do |arch_config|
desc "Create the portable package (#{arch_config.arch})"
task arch_config.arch do
rm_rf arch_config.portable_output_dir
mkdir_p arch_config.portable_output_dir
task arch_config.arch => [:"build:#{arch_config.arch}"] do
unless File.exist?(SZIP)
warn "Please installe 7-Zip"
exit 1
end

mkdir_p File.dirname(arch_config.portable_output_file)
rm arch_config.portable_output_file if File.exist?(arch_config.portable_output_file)

Dir.chdir(arch_config.bin_dir) do
files = FileList['**/*'].exclude('*.xml', '*.vshost.*', '*.log', '*/FluentValidation.resources.dll', '*/System.Windows.Interactivity.resources.dll')
Dir.mktmpdir do |tmp|
portable_dir = File.join(tmp, arch_config.portable_output_dir)
Dir.chdir(arch_config.bin_dir) do
files = FileList['**/*'].exclude('*.xml', '*.vshost.*', '*.log', '*.Installer.config', '*/FluentValidation.resources.dll', '*/System.Windows.Interactivity.resources.dll')

files.each do |file|
cp_to_portable(arch_config.portable_output_dir, file)
files.each do |file|
cp_to_portable(portable_dir, file)
end
end
end

cp File.join(SRC_DIR, 'Icons', 'default.ico'), arch_config.portable_output_dir
cp File.join(SRC_DIR, 'Icons', 'default.ico'), arch_config.portable_output_dir

FileList['*.md', '*.txt'].each do |file|
cp_to_portable(arch_config.portable_output_dir, file)
end

Dir.chdir(arch_config.installer_dir) do
FileList['syncthing.exe', '*.dll'].each do |file|
cp_to_portable(arch_config.portable_output_dir, file)
FileList['*.md', '*.txt'].each do |file|
cp_to_portable(portable_dir, file)
end

Dir.chdir(arch_config.installer_dir) do
FileList['syncthing.exe', '*.dll'].each do |file|
cp_to_portable(portable_dir, file)
end
end
end

puts 'Rewriting app.config'
config_path = File.join(arch_config.portable_output_dir, 'SyncTrayzor.exe.config')
doc = File.open(config_path, 'r') do |f|
doc = REXML::Document.new(f)
REXML::XPath.first(doc, '/configuration/applicationSettings//setting[@name="PortableMode"]/value').text = 'True'
doc
end
File.open(config_path, 'w') do |f|
doc.write(f)
sh %Q{"#{SZIP}"}, "a -tzip -mx=7 #{arch_config.portable_output_file} #{portable_dir}"
end
end
end
Expand All @@ -123,7 +128,7 @@ namespace :clean do
ARCH_CONFIG.each do |arch_config|
desc "Clean everything (#{arch_config.arch})"
task arch_config.arch do
rm_rf arch_config.portable_output_dir if File.exist?(arch_config.portable_output_dir)
rm_rf arch_config.portable_output_file if File.exist?(arch_config.portable_output_file)
rm arch_config.installer_output if File.exist?(arch_config.installer_output)
end
end
Expand All @@ -135,7 +140,7 @@ task :clean => ARCH_CONFIG.map{ |x| :"clean:#{x.arch}" }
namespace :package do
ARCH_CONFIG.each do |arch_config|
desc "Build installer and portable (#{arch_config.arch})"
task arch_config.arch => [:"clean:#{arch_config.arch}", :"build:#{arch_config.arch}", :"installer:#{arch_config.arch}", :"portable:#{arch_config.arch}"]
task arch_config.arch => [:"clean:#{arch_config.arch}", :"installer:#{arch_config.arch}", :"portable:#{arch_config.arch}"]
end
end

Expand Down
3 changes: 2 additions & 1 deletion installer/x64/installer-x64.iss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
Name: "{userappdata}\{#AppDataFolder}"

[Files]
Source: "{#AppBin}\*"; DestDir: "{app}"; Excludes: "*.xml,*.vshost.*,*.log,FluentValidation.resources.dll,System.Windows.Interactivity.resources.dll"; Flags: ignoreversion recursesubdirs
Source: "{#AppBin}\*"; DestDir: "{app}"; Excludes: "*.xml,*.vshost.*,*.config,*.log,FluentValidation.resources.dll,System.Windows.Interactivity.resources.dll"; Flags: ignoreversion recursesubdirs
Source: "{#AppBin}\SyncTrayzor.exe.Installer.config"; DestDir: "{app}"; DestName: "SyncTrayzor.exe.config"; Flags: ignoreversion
Source: "{#AppSrc}\Icons\default.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#AppRoot}\*.md"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#AppRoot}\*.txt"; DestDir: "{app}"; Flags: ignoreversion
Expand Down
3 changes: 2 additions & 1 deletion installer/x86/installer-x86.iss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
Name: "{userappdata}\{#AppDataFolder}"

[Files]
Source: "{#AppBin}\*"; DestDir: "{app}"; Excludes: "*.xml,*.vshost.*,*.log,FluentValidation.resources.dll,System.Windows.Interactivity.resources.dll"; Flags: ignoreversion recursesubdirs
Source: "{#AppBin}\*"; DestDir: "{app}"; Excludes: "*.xml,*.vshost.*,*.config,*.log,FluentValidation.resources.dll,System.Windows.Interactivity.resources.dll"; Flags: ignoreversion recursesubdirs
Source: "{#AppBin}\SyncTrayzor.exe.Installer.config"; DestDir: "{app}"; DestName: "SyncTrayzor.exe.config"; Flags: ignoreversion
Source: "{#AppSrc}\Icons\default.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#AppRoot}\*.md"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#AppRoot}\*.txt"; DestDir: "{app}"; Flags: ignoreversion
Expand Down
21 changes: 21 additions & 0 deletions src/SyncTrayzor/App.Installer.config.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="/configuration/applicationSettings//setting[@name='EnableAutostartOnFirstStart']/value/text()">True</xsl:template>

<xsl:template match="/configuration/applicationSettings//setting[@name='PathConfiguration']//LogFilePath/text()">%APPDATA%\SyncTrayzor\logs</xsl:template>
<xsl:template match="/configuration/applicationSettings//setting[@name='PathConfiguration']//SyncthingCustomHomePath/text()">%LOCALAPPDATA%\SyncTrayzor\syncthing</xsl:template>
<xsl:template match="/configuration/applicationSettings//setting[@name='PathConfiguration']//SyncthingPath/text()">%APPDATA%\SyncTrayzor\syncthing.exe</xsl:template>
<xsl:template match="/configuration/applicationSettings//setting[@name='PathConfiguration']//ConfigurationFilePath/text()">%APPDATA%\SyncTrayzor\config.xml</xsl:template>

<xsl:template match="/configuration/applicationSettings//setting[@name='DefaultUserConfiguration']//SyncthingUseCustomHome/text()">false</xsl:template>

<!-- Default template -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
34 changes: 33 additions & 1 deletion src/SyncTrayzor/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,41 @@
<setting name="IssuesUrl" serializeAs="String">
<value>http://github.com/canton7/SyncTrayzor/issues</value>
</setting>
<setting name="PortableMode" serializeAs="String">
<setting name="EnableAutostartOnFirstStart" serializeAs="String">
<value>False</value>
</setting>
<setting name="PathConfiguration" serializeAs="Xml">
<value>
<PathConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<LogFilePath>%EXEPATH%\data\logs</LogFilePath>
<SyncthingCustomHomePath>%EXEPATH%\data\syncthing</SyncthingCustomHomePath>
<SyncthingPath>%EXEPATH%\syncthing.exe</SyncthingPath>
<ConfigurationFilePath>%EXEPATH%\data\config.xml</ConfigurationFilePath>
</PathConfiguration>
</value>
</setting>
<setting name="DefaultUserConfiguration" serializeAs="Xml">
<value>
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ShowTrayIconOnlyOnClose>false</ShowTrayIconOnlyOnClose>
<MinimizeToTray>false</MinimizeToTray>
<CloseToTray>true</CloseToTray>
<ShowSynchronizedBalloon>true</ShowSynchronizedBalloon>
<ShowDeviceConnectivityBalloons>true</ShowDeviceConnectivityBalloons>
<SyncthingAddress>localhost:8384</SyncthingAddress>
<StartSyncthingAutomatically>true</StartSyncthingAutomatically>
<SyncthingUseCustomHome>true</SyncthingUseCustomHome>
<SyncthingDenyUpgrade>false</SyncthingDenyUpgrade>
<SyncthingRunLowPriority>false</SyncthingRunLowPriority>
<Folders />
<NotifyOfNewVersions>true</NotifyOfNewVersions>
<ObfuscateDeviceIDs>true</ObfuscateDeviceIDs>
<UseComputerCulture>true</UseComputerCulture>
</Configuration>
</value>
</setting>
</SyncTrayzor.Properties.Settings>
</applicationSettings>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Expand Down
40 changes: 24 additions & 16 deletions src/SyncTrayzor/Bootstrapper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CefSharp;
using FluentValidation;
using Microsoft.Win32;
using NLog;
using Stylet;
using StyletIoC;
Expand All @@ -8,6 +9,7 @@
using SyncTrayzor.Pages;
using SyncTrayzor.Properties;
using SyncTrayzor.Services;
using SyncTrayzor.Services.Config;
using SyncTrayzor.Services.UpdateChecker;
using SyncTrayzor.SyncThing;
using SyncTrayzor.SyncThing.EventWatcher;
Expand Down Expand Up @@ -51,16 +53,20 @@ protected override void ConfigureIoC(IStyletIoCBuilder builder)

protected override void Configure()
{
var pathConfiguration = Settings.Default.PathConfiguration;
pathConfiguration.Transform(EnvVarTransformer.Transform);
GlobalDiagnosticsContext.Set("LogFilePath", pathConfiguration.LogFilePath);

var configurationProvider = this.Container.Get<IConfigurationProvider>();
// Debug builds are always 'portable'
#if DEBUG
configurationProvider.IsPortableMode = true;
#else
configurationProvider.IsPortableMode = Settings.Default.PortableMode;
#endif
configurationProvider.EnsureEnvironmentConsistency();
configurationProvider.Initialize(pathConfiguration, Settings.Default.DefaultUserConfiguration);
var configuration = this.Container.Get<IConfigurationProvider>().Load();

GlobalDiagnosticsContext.Set("LogFilePath", configurationProvider.LogFilePath);
// Has to be done before the VMs are fetched from the container
var languageArg = this.Args.FirstOrDefault(x => x.StartsWith("-culture="));
if (languageArg != null)
Thread.CurrentThread.CurrentUICulture = new CultureInfo(languageArg.Substring("-culture=".Length));
else if (!configuration.UseComputerCulture)
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

var autostartProvider = this.Container.Get<IAutostartProvider>();
#if DEBUG
Expand All @@ -71,7 +77,7 @@ protected override void Configure()
{
// If it's not in portable mode, and if we had to create config (i.e. it's the first start ever), then enable autostart
// Else, keep the config as it was, but update the path to us (if we're not in debug)
if (!configurationProvider.IsPortableMode && configurationProvider.HadToCreateConfiguration)
if (Settings.Default.EnableAutostartOnFirstStart && configurationProvider.HadToCreateConfiguration)
autostartProvider.SetAutoStart(new AutostartConfiguration() { AutoStart = true, StartMinimized = true });
else
autostartProvider.UpdatePathToSelf();
Expand All @@ -87,6 +93,15 @@ protected override void Configure()
// https://github.com/cefsharp/CefSharp/issues/800#issuecomment-75058534
this.Application.SessionEnding += (o, e) => Process.GetCurrentProcess().Kill();

if (configurationProvider.Load().NotifyOfNewVersions)
{
SystemEvents.PowerModeChanged += (o, e) =>
{
if (e.Mode == PowerModes.Resume)
this.Container.Get<IUpdateChecker>().CheckForUpdatesAsync();
};
}

MessageBoxViewModel.ButtonLabels = new Dictionary<MessageBoxResult, string>()
{
{ MessageBoxResult.Cancel, Localizer.Translate("Generic_Dialog_Cancel") },
Expand All @@ -96,13 +111,6 @@ protected override void Configure()
};
}

protected override void OnStart()
{
var languageArg = this.Args.FirstOrDefault(x => x.StartsWith("-culture="));
if (languageArg != null)
Thread.CurrentThread.CurrentUICulture = new CultureInfo(languageArg.Substring("-culture=".Length));
}

protected override void Launch()
{
if (this.Args.Contains("-minimized"))
Expand Down
Loading

0 comments on commit 3870b4f

Please sign in to comment.