mirror of
https://github.com/greenshot/greenshot
synced 2025-08-26 16:16:06 -07:00
Added more settings.
This commit is contained in:
parent
0aa4aa2d0e
commit
d6313ed956
14 changed files with 387 additions and 73 deletions
|
@ -214,6 +214,10 @@ namespace Greenshot.Addons.Core
|
||||||
[Description("Comma separated list of destinations which should be disabled.")]
|
[Description("Comma separated list of destinations which should be disabled.")]
|
||||||
IList<string> ExcludeDestinations { get; set; }
|
IList<string> ExcludeDestinations { get; set; }
|
||||||
|
|
||||||
|
[Description("Should Greenshot check for updates?")]
|
||||||
|
[DefaultValue(true)]
|
||||||
|
bool CheckForUpdates { get; set; }
|
||||||
|
|
||||||
[Description("How many days between every update check? (0=no checks)")]
|
[Description("How many days between every update check? (0=no checks)")]
|
||||||
[DefaultValue(14)]
|
[DefaultValue(14)]
|
||||||
int UpdateCheckInterval { get; set; }
|
int UpdateCheckInterval { get; set; }
|
||||||
|
|
49
src/Greenshot.Addons/Core/INetworkConfiguration.cs
Normal file
49
src/Greenshot.Addons/Core/INetworkConfiguration.cs
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#region Greenshot GNU General License
|
||||||
|
|
||||||
|
// Greenshot - a free and open source screenshot tool
|
||||||
|
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
|
//
|
||||||
|
// For more information see: http://getgreenshot.org/
|
||||||
|
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General License as published by
|
||||||
|
// the Free Software Foundation, either version 1 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Usings
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using Dapplo.HttpExtensions;
|
||||||
|
using Dapplo.Ini;
|
||||||
|
using Dapplo.InterfaceImpl.Extensions;
|
||||||
|
using Dapplo.Windows.Common.Structs;
|
||||||
|
using Greenshot.Addons.Core.Enums;
|
||||||
|
using Greenshot.Addons.Interfaces;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
namespace Greenshot.Addons.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Network (HTTP) configuration.
|
||||||
|
/// </summary>
|
||||||
|
[IniSection("Network")]
|
||||||
|
[Description("Greenshot network configuration")]
|
||||||
|
public interface INetworkConfiguration : IIniSection, IHttpSettings, INotifyPropertyChanged, IWriteProtectProperties, IDefaultValue, ITransactionalProperties
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -210,6 +210,7 @@
|
||||||
<Compile Include="Core\ExplorerHelper.cs" />
|
<Compile Include="Core\ExplorerHelper.cs" />
|
||||||
<Compile Include="Core\Enums\OutputFormats.cs" />
|
<Compile Include="Core\Enums\OutputFormats.cs" />
|
||||||
<Compile Include="Core\Enums\WindowCaptureModes.cs" />
|
<Compile Include="Core\Enums\WindowCaptureModes.cs" />
|
||||||
|
<Compile Include="Core\INetworkConfiguration.cs" />
|
||||||
<Compile Include="Core\IDestinationFileConfiguration.cs" />
|
<Compile Include="Core\IDestinationFileConfiguration.cs" />
|
||||||
<Compile Include="Core\ImageOutput.cs" />
|
<Compile Include="Core\ImageOutput.cs" />
|
||||||
<Compile Include="Core\InteropWindowExtensions.cs" />
|
<Compile Include="Core\InteropWindowExtensions.cs" />
|
||||||
|
|
|
@ -42,11 +42,12 @@ namespace Greenshot.Addons.ViewModels
|
||||||
private bool _useOwnSettings;
|
private bool _useOwnSettings;
|
||||||
|
|
||||||
[Import]
|
[Import]
|
||||||
public ICoreConfiguration FileConfiguration { get; set; }
|
public ICoreConfiguration CoreConfiguration { get; set; }
|
||||||
|
|
||||||
[Import]
|
[Import]
|
||||||
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A NPC wrapper for the UseOwnSettings in the IDestinationFileConfiguration, as this doesn't work when ITransactionalProperties is used
|
/// A NPC wrapper for the UseOwnSettings in the IDestinationFileConfiguration, as this doesn't work when ITransactionalProperties is used
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -62,9 +63,18 @@ namespace Greenshot.Addons.ViewModels
|
||||||
_destinationFileConfiguration.UseOwnSettings = value;
|
_destinationFileConfiguration.UseOwnSettings = value;
|
||||||
}
|
}
|
||||||
NotifyOfPropertyChange();
|
NotifyOfPropertyChange();
|
||||||
|
NotifyOfPropertyChange(nameof(AreSettingsEnabled));
|
||||||
|
NotifyOfPropertyChange(nameof(FileConfiguration));
|
||||||
|
NotifyOfPropertyChange(nameof(SelectedFormat));
|
||||||
|
NotifyOfPropertyChange(nameof(JpegSettingsVisibility));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IFileConfiguration FileConfiguration =>
|
||||||
|
DestinationFileConfiguration?.UseOwnSettings == true
|
||||||
|
? (IFileConfiguration)DestinationFileConfiguration
|
||||||
|
: CoreConfiguration;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This needs to be set with the IDestinationFileConfiguration to have make local configuration for a destination possible
|
/// This needs to be set with the IDestinationFileConfiguration to have make local configuration for a destination possible
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -73,10 +83,13 @@ namespace Greenshot.Addons.ViewModels
|
||||||
get => _destinationFileConfiguration;
|
get => _destinationFileConfiguration;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Equals(value, _destinationFileConfiguration)) return;
|
if (Equals(value, _destinationFileConfiguration))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
_destinationFileConfiguration = value;
|
_destinationFileConfiguration = value;
|
||||||
NotifyOfPropertyChange(nameof(DestinationFileConfigurationVisiblity));
|
NotifyOfPropertyChange(nameof(AreSettingsEnabled));
|
||||||
NotifyOfPropertyChange(nameof(AreGlobalSettingsEnabled));
|
NotifyOfPropertyChange(nameof(FileConfiguration));
|
||||||
NotifyOfPropertyChange(nameof(OwnSettingsVisibility));
|
NotifyOfPropertyChange(nameof(OwnSettingsVisibility));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,60 +97,31 @@ namespace Greenshot.Addons.ViewModels
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies if the global settings can be modified, which is the case when there are is no DestinationFileConfiguration
|
/// Specifies if the global settings can be modified, which is the case when there are is no DestinationFileConfiguration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AreGlobalSettingsEnabled => DestinationFileConfiguration == null;
|
public bool AreSettingsEnabled => DestinationFileConfiguration == null || DestinationFileConfiguration.UseOwnSettings;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If there is a DestinationFileConfiguration, the checkbox is shown
|
/// If there is a DestinationFileConfiguration, the checkbox is shown
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Visibility OwnSettingsVisibility => DestinationFileConfiguration != null? Visibility.Visible : Visibility.Collapsed;
|
public Visibility OwnSettingsVisibility => DestinationFileConfiguration != null? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If there is a DestinationFileConfiguration and use own settings is set the configuration is shown
|
|
||||||
/// </summary>
|
|
||||||
public Visibility DestinationFileConfigurationVisiblity => DestinationFileConfiguration != null && _useOwnSettings ? Visibility.Visible : Visibility.Collapsed;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If there is a DestinationFileConfiguration, the global configuration is not shown
|
|
||||||
/// </summary>
|
|
||||||
public Visibility GlobalFileConfigurationVisiblity => AreGlobalSettingsEnabled || !_useOwnSettings ? Visibility.Visible : Visibility.Collapsed;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The globally selected format
|
/// The globally selected format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OutputFormats SelectedFormat
|
public OutputFormats SelectedFormat
|
||||||
{
|
{
|
||||||
get => FileConfiguration.OutputFileFormat ;
|
get => FileConfiguration.OutputFileFormat;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
FileConfiguration.OutputFileFormat = value;
|
FileConfiguration.OutputFileFormat = value;
|
||||||
NotifyOfPropertyChange();
|
NotifyOfPropertyChange();
|
||||||
NotifyOfPropertyChange(nameof(GlobalJpegSettingsVisibility));
|
NotifyOfPropertyChange(nameof(JpegSettingsVisibility));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The global jpeg quality settings visibility
|
/// The global jpeg quality settings visibility
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Visibility GlobalJpegSettingsVisibility => SelectedFormat == OutputFormats.jpg ? Visibility.Visible : Visibility.Collapsed;
|
public Visibility JpegSettingsVisibility => SelectedFormat == OutputFormats.jpg ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The locally selected format
|
|
||||||
/// </summary>
|
|
||||||
public OutputFormats DestinationSelectedFormat
|
|
||||||
{
|
|
||||||
get => DestinationFileConfiguration.OutputFileFormat;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
DestinationFileConfiguration.OutputFileFormat = value;
|
|
||||||
NotifyOfPropertyChange();
|
|
||||||
NotifyOfPropertyChange(nameof(DestinationJpegSettingsVisibility));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The global jpeg quality settings visibility
|
|
||||||
/// </summary>
|
|
||||||
public Visibility DestinationJpegSettingsVisibility => DestinationSelectedFormat == OutputFormats.jpg ? Visibility.Visible : Visibility.Collapsed;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The formats available, with their translation
|
/// The formats available, with their translation
|
||||||
|
|
|
@ -11,25 +11,22 @@
|
||||||
<StackPanel Visibility="{Binding OwnSettingsVisibility}">
|
<StackPanel Visibility="{Binding OwnSettingsVisibility}">
|
||||||
<CheckBox Content="Use destination settings" IsChecked="{Binding UseOwnSettings}" />
|
<CheckBox Content="Use destination settings" IsChecked="{Binding UseOwnSettings}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Visibility="{Binding DestinationFileConfigurationVisiblity}" IsEnabled="{Binding UseOwnSettings}">
|
|
||||||
<DockPanel LastChildFill="True">
|
<StackPanel IsEnabled="{Binding AreSettingsEnabled}">
|
||||||
<Label Content="{Binding GreenshotLanguage.SettingsPrimaryimageformat}" Width="100" />
|
|
||||||
<ComboBox SelectedValue="{Binding DestinationSelectedFormat}" ItemsSource="{Binding Formats}" SelectedValuePath="Key" DisplayMemberPath="Value" />
|
|
||||||
</DockPanel>
|
|
||||||
<DockPanel LastChildFill="True" Visibility="{Binding DestinationJpegSettingsVisibility}">
|
|
||||||
<Label Content="{Binding GreenshotLanguage.SettingsJpegquality}" Width="100" />
|
|
||||||
<Slider Maximum="100" Value="{Binding DestinationFileConfiguration.OutputFileJpegQuality}"/>
|
|
||||||
</DockPanel>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel IsEnabled="{Binding AreGlobalSettingsEnabled}" Visibility="{Binding GlobalFileConfigurationVisiblity}">
|
|
||||||
<DockPanel LastChildFill="True">
|
<DockPanel LastChildFill="True">
|
||||||
<Label Content="{Binding GreenshotLanguage.SettingsPrimaryimageformat}" Width="100" />
|
<Label Content="{Binding GreenshotLanguage.SettingsPrimaryimageformat}" Width="100" />
|
||||||
<ComboBox SelectedValue="{Binding SelectedFormat}" ItemsSource="{Binding Formats}" SelectedValuePath="Key" DisplayMemberPath="Value" />
|
<ComboBox SelectedValue="{Binding SelectedFormat}" ItemsSource="{Binding Formats}" SelectedValuePath="Key" DisplayMemberPath="Value" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<DockPanel LastChildFill="True" Visibility="{Binding GlobalJpegSettingsVisibility}">
|
<DockPanel LastChildFill="True" Visibility="{Binding JpegSettingsVisibility}">
|
||||||
<Label Content="{Binding GreenshotLanguage.SettingsJpegquality}" Width="100" />
|
<Label Content="{Binding GreenshotLanguage.SettingsJpegquality}" Width="100" />
|
||||||
<Slider Maximum="100" Value="{Binding FileConfiguration.OutputFileJpegQuality}"/>
|
<Slider Maximum="100" Value="{Binding FileConfiguration.OutputFileJpegQuality}"/>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
<CheckBox Content="{Binding GreenshotLanguage.SettingsReducecolors}" IsChecked="{Binding FileConfiguration.OutputFileReduceColors}"/>
|
||||||
|
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<Label Content="{Binding GreenshotLanguage.SettingsFilenamepattern}" Width="100" />
|
||||||
|
<TextBox Text="{Binding FileConfiguration.OutputFileFilenamePattern}"/>
|
||||||
|
</DockPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -265,6 +265,9 @@
|
||||||
<DependentUpon>BugReportForm.cs</DependentUpon>
|
<DependentUpon>BugReportForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Startup.cs" />
|
<Compile Include="Startup.cs" />
|
||||||
|
<Compile Include="Ui\Configuration\ViewModels\OutputConfigViewModel.cs" />
|
||||||
|
<Compile Include="Ui\Configuration\ViewModels\NetworkConfigViewModel.cs" />
|
||||||
|
<Compile Include="Ui\Configuration\ViewModels\GeneralConfigViewModel.cs" />
|
||||||
<Compile Include="Ui\Configuration\ViewModels\DestinationPickerConfigViewModel.cs" />
|
<Compile Include="Ui\Configuration\ViewModels\DestinationPickerConfigViewModel.cs" />
|
||||||
<Compile Include="Ui\Configuration\ViewModels\DestinationsConfigNodeViewModel.cs" />
|
<Compile Include="Ui\Configuration\ViewModels\DestinationsConfigNodeViewModel.cs" />
|
||||||
<Compile Include="Ui\Configuration\ViewModels\CaptureConfigNodeViewModel.cs" />
|
<Compile Include="Ui\Configuration\ViewModels\CaptureConfigNodeViewModel.cs" />
|
||||||
|
@ -489,6 +492,18 @@
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Ui\Configuration\Views\OutputConfigView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Ui\Configuration\Views\NetworkConfigView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Ui\Configuration\Views\GeneralConfigView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Ui\Configuration\Views\UiConfigView.xaml">
|
<Page Include="Ui\Configuration\Views\UiConfigView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|
|
@ -21,14 +21,11 @@
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
using Dapplo.CaliburnMicro.Configuration;
|
using Dapplo.CaliburnMicro.Configuration;
|
||||||
using Dapplo.CaliburnMicro.Extensions;
|
using Dapplo.CaliburnMicro.Extensions;
|
||||||
using Dapplo.CaliburnMicro.Metro;
|
|
||||||
using Greenshot.Addons;
|
using Greenshot.Addons;
|
||||||
using Greenshot.Addons.Core;
|
using Greenshot.Addons.Core;
|
||||||
using Greenshot.Addons.Core.Enums;
|
using Greenshot.Addons.Core.Enums;
|
||||||
|
@ -46,16 +43,6 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private CompositeDisposable _disposables;
|
private CompositeDisposable _disposables;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The avaible theme accents
|
|
||||||
/// </summary>
|
|
||||||
public ObservableCollection<Tuple<ThemeAccents, string>> AvailableThemeAccents { get; set; } = new ObservableCollection<Tuple<ThemeAccents, string>>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The avaible themes
|
|
||||||
/// </summary>
|
|
||||||
public ObservableCollection<Tuple<Themes, string>> AvailableThemes { get; set; } = new ObservableCollection<Tuple<Themes, string>>();
|
|
||||||
|
|
||||||
[Import]
|
[Import]
|
||||||
public ICoreConfiguration CoreConfiguration { get; set; }
|
public ICoreConfiguration CoreConfiguration { get; set; }
|
||||||
|
|
||||||
|
@ -69,7 +56,6 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
||||||
{
|
{
|
||||||
// Prepare disposables
|
// Prepare disposables
|
||||||
_disposables?.Dispose();
|
_disposables?.Dispose();
|
||||||
_disposables = new CompositeDisposable();
|
|
||||||
|
|
||||||
// Place this under the Ui parent
|
// Place this under the Ui parent
|
||||||
ParentId = nameof(ConfigIds.Capture);
|
ParentId = nameof(ConfigIds.Capture);
|
||||||
|
@ -78,10 +64,10 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
||||||
config.Register(CoreConfiguration);
|
config.Register(CoreConfiguration);
|
||||||
|
|
||||||
// automatically update the DisplayName
|
// automatically update the DisplayName
|
||||||
var greenshotLanguageBinding = GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsCapture));
|
_disposables = new CompositeDisposable
|
||||||
|
{
|
||||||
// Make sure the greenshotLanguageBinding is disposed when this is no longer active
|
GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsCapture))
|
||||||
_disposables.Add(greenshotLanguageBinding);
|
};
|
||||||
|
|
||||||
base.Initialize(config);
|
base.Initialize(config);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
#region Greenshot GNU General Public License
|
||||||
|
|
||||||
|
// Greenshot - a free and open source screenshot tool
|
||||||
|
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
|
//
|
||||||
|
// For more information see: http://getgreenshot.org/
|
||||||
|
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 1 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.ComponentModel.Composition;
|
||||||
|
using System.Reactive.Disposables;
|
||||||
|
using Dapplo.CaliburnMicro.Configuration;
|
||||||
|
using Dapplo.CaliburnMicro.Extensions;
|
||||||
|
using Greenshot.Addons;
|
||||||
|
using Greenshot.Addons.Core;
|
||||||
|
using Greenshot.Configuration;
|
||||||
|
|
||||||
|
namespace Greenshot.Ui.Configuration.ViewModels
|
||||||
|
{
|
||||||
|
[Export(typeof(IConfigScreen))]
|
||||||
|
public sealed class GeneralConfigViewModel : SimpleConfigScreen
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Here all disposables are registered, so we can clean the up
|
||||||
|
/// </summary>
|
||||||
|
private CompositeDisposable _disposables;
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public ICoreConfiguration CoreConfiguration { get; set; }
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public IConfigTranslations ConfigTranslations { get; set; }
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||||
|
|
||||||
|
public override void Initialize(IConfig config)
|
||||||
|
{
|
||||||
|
// Prepare disposables
|
||||||
|
_disposables?.Dispose();
|
||||||
|
|
||||||
|
// Make sure Commit/Rollback is called on the IUiConfiguration
|
||||||
|
config.Register(CoreConfiguration);
|
||||||
|
|
||||||
|
// automatically update the DisplayName
|
||||||
|
_disposables = new CompositeDisposable
|
||||||
|
{
|
||||||
|
GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsGeneral))
|
||||||
|
};
|
||||||
|
|
||||||
|
base.Initialize(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDeactivate(bool close)
|
||||||
|
{
|
||||||
|
_disposables.Dispose();
|
||||||
|
base.OnDeactivate(close);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
#region Greenshot GNU General Public License
|
||||||
|
|
||||||
|
// Greenshot - a free and open source screenshot tool
|
||||||
|
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
|
//
|
||||||
|
// For more information see: http://getgreenshot.org/
|
||||||
|
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 1 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.ComponentModel.Composition;
|
||||||
|
using System.Reactive.Disposables;
|
||||||
|
using Dapplo.CaliburnMicro.Configuration;
|
||||||
|
using Dapplo.CaliburnMicro.Extensions;
|
||||||
|
using Greenshot.Addons;
|
||||||
|
using Greenshot.Addons.Core;
|
||||||
|
|
||||||
|
namespace Greenshot.Ui.Configuration.ViewModels
|
||||||
|
{
|
||||||
|
[Export(typeof(IConfigScreen))]
|
||||||
|
public sealed class NetworkConfigViewModel : SimpleConfigScreen
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Here all disposables are registered, so we can clean the up
|
||||||
|
/// </summary>
|
||||||
|
private CompositeDisposable _disposables;
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public INetworkConfiguration NetworkConfiguration { get; set; }
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||||
|
|
||||||
|
public override void Initialize(IConfig config)
|
||||||
|
{
|
||||||
|
// Prepare disposables
|
||||||
|
_disposables?.Dispose();
|
||||||
|
|
||||||
|
// Make sure Commit/Rollback is called on the IUiConfiguration
|
||||||
|
config.Register(NetworkConfiguration);
|
||||||
|
|
||||||
|
// automatically update the DisplayName
|
||||||
|
_disposables = new CompositeDisposable
|
||||||
|
{
|
||||||
|
GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsNetwork))
|
||||||
|
};
|
||||||
|
|
||||||
|
base.Initialize(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDeactivate(bool close)
|
||||||
|
{
|
||||||
|
_disposables.Dispose();
|
||||||
|
base.OnDeactivate(close);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
#region Greenshot GNU General Public License
|
||||||
|
|
||||||
|
// Greenshot - a free and open source screenshot tool
|
||||||
|
// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
|
//
|
||||||
|
// For more information see: http://getgreenshot.org/
|
||||||
|
// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 1 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.ComponentModel.Composition;
|
||||||
|
using System.Reactive.Disposables;
|
||||||
|
using Dapplo.CaliburnMicro.Configuration;
|
||||||
|
using Dapplo.CaliburnMicro.Extensions;
|
||||||
|
using Greenshot.Addons;
|
||||||
|
using Greenshot.Addons.Core;
|
||||||
|
using Greenshot.Addons.ViewModels;
|
||||||
|
using Greenshot.Configuration;
|
||||||
|
|
||||||
|
namespace Greenshot.Ui.Configuration.ViewModels
|
||||||
|
{
|
||||||
|
[Export(typeof(IConfigScreen))]
|
||||||
|
public sealed class OutputConfigViewModel : SimpleConfigScreen
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Here all disposables are registered, so we can clean the up
|
||||||
|
/// </summary>
|
||||||
|
private CompositeDisposable _disposables;
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public ICoreConfiguration CoreConfiguration { get; set; }
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public IConfigTranslations ConfigTranslations { get; set; }
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public IGreenshotLanguage GreenshotLanguage { get; set; }
|
||||||
|
|
||||||
|
[Import]
|
||||||
|
public FileConfigPartViewModel FileConfigPartViewModel { get; set; }
|
||||||
|
|
||||||
|
public override void Initialize(IConfig config)
|
||||||
|
{
|
||||||
|
// Prepare disposables
|
||||||
|
_disposables?.Dispose();
|
||||||
|
|
||||||
|
// Make sure Commit/Rollback is called on the IUiConfiguration
|
||||||
|
config.Register(CoreConfiguration);
|
||||||
|
|
||||||
|
// automatically update the DisplayName
|
||||||
|
_disposables = new CompositeDisposable
|
||||||
|
{
|
||||||
|
GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsOutput))
|
||||||
|
};
|
||||||
|
|
||||||
|
base.Initialize(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDeactivate(bool close)
|
||||||
|
{
|
||||||
|
_disposables.Dispose();
|
||||||
|
base.OnDeactivate(close);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -100,7 +100,6 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
||||||
{
|
{
|
||||||
// Prepare disposables
|
// Prepare disposables
|
||||||
_disposables?.Dispose();
|
_disposables?.Dispose();
|
||||||
_disposables = new CompositeDisposable();
|
|
||||||
|
|
||||||
AvailableThemeAccents.Clear();
|
AvailableThemeAccents.Clear();
|
||||||
foreach (var themeAccent in Enum.GetValues(typeof(ThemeAccents)).Cast<ThemeAccents>())
|
foreach (var themeAccent in Enum.GetValues(typeof(ThemeAccents)).Cast<ThemeAccents>())
|
||||||
|
@ -123,10 +122,10 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
||||||
config.Register(MetroConfiguration);
|
config.Register(MetroConfiguration);
|
||||||
|
|
||||||
// automatically update the DisplayName
|
// automatically update the DisplayName
|
||||||
var greenshotLanguageBinding = GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsTitle));
|
_disposables = new CompositeDisposable
|
||||||
|
{
|
||||||
// Make sure the greenshotLanguageBinding is disposed when this is no longer active
|
GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsTitle))
|
||||||
_disposables.Add(greenshotLanguageBinding);
|
};
|
||||||
|
|
||||||
base.Initialize(config);
|
base.Initialize(config);
|
||||||
}
|
}
|
||||||
|
|
17
src/Greenshot/Ui/Configuration/Views/GeneralConfigView.xaml
Normal file
17
src/Greenshot/Ui/Configuration/Views/GeneralConfigView.xaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<UserControl x:Class="Greenshot.Ui.Configuration.Views.GeneralConfigView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:viewModels="clr-namespace:Greenshot.Ui.Configuration.ViewModels"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance viewModels:GeneralConfigViewModel,IsDesignTimeCreatable=False}"
|
||||||
|
>
|
||||||
|
<StackPanel>
|
||||||
|
<CheckBox Content="{Binding GreenshotLanguage.SettingsCheckperiod}" IsChecked="{Binding CoreConfiguration.CheckForUpdates}"></CheckBox>
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<Label Content="{Binding GreenshotLanguage.SettingsCheckperiod}" Width="100" />
|
||||||
|
<TextBox Text="{Binding CoreConfiguration.UpdateCheckInterval}"/>
|
||||||
|
</DockPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
26
src/Greenshot/Ui/Configuration/Views/NetworkConfigView.xaml
Normal file
26
src/Greenshot/Ui/Configuration/Views/NetworkConfigView.xaml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<UserControl x:Class="Greenshot.Ui.Configuration.Views.NetworkConfigView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:viewModels="clr-namespace:Greenshot.Ui.Configuration.ViewModels"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance viewModels:NetworkConfigViewModel,IsDesignTimeCreatable=False}"
|
||||||
|
>
|
||||||
|
<StackPanel>
|
||||||
|
<CheckBox Content="Allow auto redirect" IsChecked="{Binding NetworkConfiguration.AllowAutoRedirect}" />
|
||||||
|
<CheckBox Content="Allow pipelining" IsChecked="{Binding NetworkConfiguration.AllowPipelining}" />
|
||||||
|
<CheckBox Content="Ignore SSL certificate errors" IsChecked="{Binding NetworkConfiguration.IgnoreSslCertificateErrors}" />
|
||||||
|
<CheckBox Content="Pre authenticate" IsChecked="{Binding NetworkConfiguration.PreAuthenticate}" />
|
||||||
|
<CheckBox Content="Expect 100 continue" IsChecked="{Binding NetworkConfiguration.Expect100Continue}" />
|
||||||
|
<CheckBox Content="Use cookies" IsChecked="{Binding NetworkConfiguration.UseCookies}" />
|
||||||
|
<CheckBox Content="Use default credentials" IsChecked="{Binding NetworkConfiguration.UseDefaultCredentials}" />
|
||||||
|
<CheckBox Content="Use default proxy" IsChecked="{Binding NetworkConfiguration.UseDefaultProxy}" />
|
||||||
|
<CheckBox Content="Use proxy" IsChecked="{Binding NetworkConfiguration.UseProxy}" />
|
||||||
|
<CheckBox Content="Use default credentials for proxy" IsChecked="{Binding NetworkConfiguration.UseDefaultCredentialsForProxy}" />
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<Label Content="DefaultUseAgent" Width="100" />
|
||||||
|
<TextBox Text="{Binding NetworkConfiguration.DefaultUserAgent}"></TextBox>
|
||||||
|
</DockPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
13
src/Greenshot/Ui/Configuration/Views/OutputConfigView.xaml
Normal file
13
src/Greenshot/Ui/Configuration/Views/OutputConfigView.xaml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<UserControl x:Class="Greenshot.Ui.Configuration.Views.OutputConfigView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:viewModels="clr-namespace:Greenshot.Ui.Configuration.ViewModels"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance viewModels:OutputConfigViewModel,IsDesignTimeCreatable=False}"
|
||||||
|
>
|
||||||
|
<StackPanel>
|
||||||
|
<ContentControl x:Name="FileConfigPartViewModel"/>
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
Loading…
Add table
Add a link
Reference in a new issue