Split the internal and addons destinations, as the list was getting very large. Fixed a type on the about view, also fixed a bug which was introduced in the previous commit.

This commit is contained in:
Robin 2018-06-09 15:19:09 +02:00
commit e21230a52b
12 changed files with 95 additions and 18 deletions

View file

@ -49,10 +49,20 @@ namespace Greenshot.Addon.ExternalCommand
.AsSelf() .AsSelf()
.SingleInstance(); .SingleInstance();
IniConfig.Current.AfterLoad<IExternalCommandConfiguration>(externalCommandConfiguration => externalCommandConfiguration.AfterLoad()); builder.RegisterType<SetupConfig>()
.As<IStartable>()
.SingleInstance();
base.Load(builder); base.Load(builder);
} }
/// <inheritdoc />
private class SetupConfig : IStartable
{
public void Start()
{
IniConfig.Current.AfterLoad<IExternalCommandConfiguration>(externalCommandConfiguration => externalCommandConfiguration.AfterLoad());
}
}
} }
} }

View file

@ -54,7 +54,7 @@ namespace Greenshot.Addon.LegacyEditor.ViewModels
_disposables = new CompositeDisposable(); _disposables = new CompositeDisposable();
// Place this under the Ui parent // Place this under the Ui parent
ParentId = nameof(ConfigIds.Destinations); ParentId = nameof(ConfigIds.InternalDestinations);
// Make sure Commit/Rollback is called on the IUiConfiguration // Make sure Commit/Rollback is called on the IUiConfiguration
config.Register(EditorConfiguration); config.Register(EditorConfiguration);

View file

@ -46,10 +46,22 @@ namespace Greenshot.Addons
builder builder
.RegisterType<PleaseWaitForm>() .RegisterType<PleaseWaitForm>()
.AsSelf(); .AsSelf();
// REgister the after load, so it's called when the configuration is created builder.RegisterType<SetupConfig>()
IniConfig.Current.AfterLoad<ICoreConfiguration>(coreConfiguration => coreConfiguration.AfterLoad()); .As<IStartable>()
.SingleInstance();
base.Load(builder); base.Load(builder);
} }
/// <inheritdoc />
private class SetupConfig : IStartable
{
public void Start()
{
// Register the after load, so it's called when the configuration is created
IniConfig.Current.AfterLoad<ICoreConfiguration>(coreConfiguration => coreConfiguration.AfterLoad());
}
}
} }
} }

View file

@ -27,6 +27,7 @@ namespace Greenshot.Addons.Core
{ {
Ui, Ui,
Capture, Capture,
Destinations Destinations,
InternalDestinations
} }
} }

View file

@ -266,14 +266,15 @@
</Compile> </Compile>
<Compile Include="GreenshotAutofacModule.cs" /> <Compile Include="GreenshotAutofacModule.cs" />
<Compile Include="Startup.cs" /> <Compile Include="Startup.cs" />
<Compile Include="Ui\Configuration\AddonDestinationsConfigNode.cs" />
<Compile Include="Ui\Configuration\ViewModels\ClipboardDestinationConfigViewModel.cs" /> <Compile Include="Ui\Configuration\ViewModels\ClipboardDestinationConfigViewModel.cs" />
<Compile Include="Ui\Configuration\ViewModels\PrintConfigViewModel.cs" /> <Compile Include="Ui\Configuration\ViewModels\PrintConfigViewModel.cs" />
<Compile Include="Ui\Configuration\ViewModels\OutputConfigViewModel.cs" /> <Compile Include="Ui\Configuration\ViewModels\OutputConfigViewModel.cs" />
<Compile Include="Ui\Configuration\ViewModels\NetworkConfigViewModel.cs" /> <Compile Include="Ui\Configuration\ViewModels\NetworkConfigViewModel.cs" />
<Compile Include="Ui\Configuration\ViewModels\GeneralConfigViewModel.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\InternalDestinationsConfigNode.cs" />
<Compile Include="Ui\Configuration\ViewModels\CaptureConfigNodeViewModel.cs" /> <Compile Include="Ui\Configuration\CaptureConfigNode.cs" />
<Compile Include="Ui\Configuration\ViewModels\ConfigViewModel.cs" /> <Compile Include="Ui\Configuration\ViewModels\ConfigViewModel.cs" />
<Compile Include="Ui\Configuration\ViewModels\CaptureConfigViewModel.cs" /> <Compile Include="Ui\Configuration\ViewModels\CaptureConfigViewModel.cs" />
<Compile Include="Ui\Configuration\ViewModels\UiConfigViewModel.cs" /> <Compile Include="Ui\Configuration\ViewModels\UiConfigViewModel.cs" />

View file

@ -7,7 +7,7 @@
<resource name="about_host">Greenshot is hosted by GitHub at</resource> <resource name="about_host">Greenshot is hosted by GitHub at</resource>
<resource name="about_icons">Icons from Yusuke Kamiyamane's Fugue icon set (Creative Commons Attribution 3.0 license)</resource> <resource name="about_icons">Icons from Yusuke Kamiyamane's Fugue icon set (Creative Commons Attribution 3.0 license)</resource>
<resource name="about_license"> <resource name="about_license">
Copyright (C) 2007-201( Thomas Braun, Jens Klingen, Robin Krom Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
Greenshot comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Greenshot comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.
Details about the GNU General Public License: Details about the GNU General Public License:
</resource> </resource>

View file

@ -7,7 +7,7 @@
<resource name="about_host">Greenshot está alojado en GitHub en</resource> <resource name="about_host">Greenshot está alojado en GitHub en</resource>
<resource name="about_icons">Iconos del conjunto de iconos Fugue de Yusuke Kamiyamane(Creative Commons Attribution 3.0 license)</resource> <resource name="about_icons">Iconos del conjunto de iconos Fugue de Yusuke Kamiyamane(Creative Commons Attribution 3.0 license)</resource>
<resource name="about_license"> <resource name="about_license">
Copyright (C) 2007-201( Thomas Braun, Jens Klingen, Robin Krom Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
Greenshot viene ABSOLUTAMENTE SIN GARANTIA. Este es software gratuito, y eres bienvenido a redistribuirlo bajo ciertas condiciones. Greenshot viene ABSOLUTAMENTE SIN GARANTIA. Este es software gratuito, y eres bienvenido a redistribuirlo bajo ciertas condiciones.
Detalles acerca de la Licencia General Publica GNU: Detalles acerca de la Licencia General Publica GNU:
</resource> </resource>

View file

@ -26,16 +26,16 @@ using Dapplo.CaliburnMicro.Extensions;
using Greenshot.Addons; using Greenshot.Addons;
using Greenshot.Addons.Core; using Greenshot.Addons.Core;
namespace Greenshot.Ui.Configuration.ViewModels namespace Greenshot.Ui.Configuration
{ {
/// <summary> /// <summary>
/// This represents a node in the config /// This represents a node in the config
/// </summary> /// </summary>
public sealed class DestinationsConfigNodeViewModel : ConfigNode public sealed class AddonDestinationsConfigNode : ConfigNode
{ {
public IGreenshotLanguage GreenshotLanguage { get; } public IGreenshotLanguage GreenshotLanguage { get; }
public DestinationsConfigNodeViewModel(IGreenshotLanguage greenshotLanguage) public AddonDestinationsConfigNode(IGreenshotLanguage greenshotLanguage)
{ {
GreenshotLanguage = greenshotLanguage; GreenshotLanguage = greenshotLanguage;

View file

@ -26,16 +26,16 @@ using Dapplo.CaliburnMicro.Extensions;
using Greenshot.Addons; using Greenshot.Addons;
using Greenshot.Addons.Core; using Greenshot.Addons.Core;
namespace Greenshot.Ui.Configuration.ViewModels namespace Greenshot.Ui.Configuration
{ {
/// <summary> /// <summary>
/// This represents a node in the config /// This represents a node in the config
/// </summary> /// </summary>
public sealed class CaptureConfigNodeViewModel : ConfigNode public sealed class CaptureConfigNode : ConfigNode
{ {
public IGreenshotLanguage GreenshotLanguage { get; } public IGreenshotLanguage GreenshotLanguage { get; }
public CaptureConfigNodeViewModel(IGreenshotLanguage greenshotLanguage) public CaptureConfigNode(IGreenshotLanguage greenshotLanguage)
{ {
GreenshotLanguage = greenshotLanguage; GreenshotLanguage = greenshotLanguage;

View file

@ -0,0 +1,50 @@
#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 Dapplo.CaliburnMicro.Configuration;
using Dapplo.CaliburnMicro.Extensions;
using Greenshot.Addons;
using Greenshot.Addons.Core;
namespace Greenshot.Ui.Configuration
{
/// <summary>
/// This represents a node in the config
/// </summary>
public sealed class InternalDestinationsConfigNode : ConfigNode
{
public IGreenshotLanguage GreenshotLanguage { get; }
public InternalDestinationsConfigNode(IGreenshotLanguage greenshotLanguage)
{
GreenshotLanguage = greenshotLanguage;
// automatically update the DisplayName
GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsDestination));
// automatically update the DisplayName
CanActivate = false;
Id = nameof(ConfigIds.InternalDestinations);
}
}
}

View file

@ -30,7 +30,9 @@ using Dapplo.CaliburnMicro.Extensions;
using Greenshot.Addons; using Greenshot.Addons;
using Greenshot.Addons.Core; using Greenshot.Addons.Core;
using Greenshot.Addons.Core.Enums; using Greenshot.Addons.Core.Enums;
using Greenshot.Addons.Extensions;
using Greenshot.Configuration; using Greenshot.Configuration;
using Greenshot.Destinations;
namespace Greenshot.Ui.Configuration.ViewModels namespace Greenshot.Ui.Configuration.ViewModels
{ {
@ -65,7 +67,7 @@ namespace Greenshot.Ui.Configuration.ViewModels
_disposables?.Dispose(); _disposables?.Dispose();
// Place this under the Ui parent // Place this under the Ui parent
ParentId = nameof(ConfigIds.Destinations); ParentId = nameof(ConfigIds.InternalDestinations);
// Make sure Commit/Rollback is called on the IUiConfiguration // Make sure Commit/Rollback is called on the IUiConfiguration
config.Register(CoreConfiguration); config.Register(CoreConfiguration);
@ -75,6 +77,7 @@ namespace Greenshot.Ui.Configuration.ViewModels
{ {
GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsDestinationClipboard)) GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsDestinationClipboard))
}; };
DisplayName = typeof(ClipboardDestination).GetDesignation();
UsedDestinations.Clear(); UsedDestinations.Clear();

View file

@ -68,7 +68,7 @@ namespace Greenshot.Ui.Configuration.ViewModels
_disposables?.Dispose(); _disposables?.Dispose();
// Place this under the Ui parent // Place this under the Ui parent
ParentId = nameof(ConfigIds.Destinations); ParentId = nameof(ConfigIds.InternalDestinations);
// Make sure Commit/Rollback is called on the IUiConfiguration // Make sure Commit/Rollback is called on the IUiConfiguration
config.Register(CoreConfiguration); config.Register(CoreConfiguration);