Persist the 'Hide thumbnail' option value
This commit is contained in:
@@ -3,9 +3,9 @@ using System.Drawing;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace EveOPreview.Configuration
|
namespace EveOPreview.Configuration.Omplementation
|
||||||
{
|
{
|
||||||
class ThumbnailConfiguration : IThumbnailConfiguration
|
sealed class ThumbnailConfiguration : IThumbnailConfiguration
|
||||||
{
|
{
|
||||||
public ThumbnailConfiguration()
|
public ThumbnailConfiguration()
|
||||||
{
|
{
|
||||||
@@ -39,6 +39,7 @@ namespace EveOPreview.Configuration
|
|||||||
this.FlatLayout = new Dictionary<string, Point>();
|
this.FlatLayout = new Dictionary<string, Point>();
|
||||||
this.ClientLayout = new Dictionary<string, ClientLayout>();
|
this.ClientLayout = new Dictionary<string, ClientLayout>();
|
||||||
this.ClientHotkey = new Dictionary<string, string>();
|
this.ClientHotkey = new Dictionary<string, string>();
|
||||||
|
this.DisableThumbnail = new Dictionary<string, bool>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MinimizeToTray { get; set; }
|
public bool MinimizeToTray { get; set; }
|
||||||
@@ -79,6 +80,8 @@ namespace EveOPreview.Configuration
|
|||||||
private Dictionary<string, ClientLayout> ClientLayout { get; set; }
|
private Dictionary<string, ClientLayout> ClientLayout { get; set; }
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
private Dictionary<string, string> ClientHotkey { get; set; }
|
private Dictionary<string, string> ClientHotkey { get; set; }
|
||||||
|
[JsonProperty]
|
||||||
|
private Dictionary<string, bool> DisableThumbnail { get; set; }
|
||||||
|
|
||||||
public Point GetDefaultThumbnailLocation()
|
public Point GetDefaultThumbnailLocation()
|
||||||
{
|
{
|
||||||
@@ -168,6 +171,16 @@ namespace EveOPreview.Configuration
|
|||||||
this.ClientHotkey[currentClient] = (new KeysConverter()).ConvertToInvariantString(hotkey);
|
this.ClientHotkey[currentClient] = (new KeysConverter()).ConvertToInvariantString(hotkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsThumbnailDisabled(string currentClient)
|
||||||
|
{
|
||||||
|
return this.DisableThumbnail.TryGetValue(currentClient, out bool isDisabled) && isDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ToggleThumbnail(string currentClient, bool isDisabled)
|
||||||
|
{
|
||||||
|
this.DisableThumbnail[currentClient] = isDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies restrictions to different parameters of the config
|
/// Applies restrictions to different parameters of the config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -41,6 +41,9 @@ namespace EveOPreview.Configuration
|
|||||||
Keys GetClientHotkey(string currentClient);
|
Keys GetClientHotkey(string currentClient);
|
||||||
void SetClientHotkey(string currentClient, Keys hotkey);
|
void SetClientHotkey(string currentClient, Keys hotkey);
|
||||||
|
|
||||||
|
bool IsThumbnailDisabled(string currentClient);
|
||||||
|
void ToggleThumbnail(string currentClient, bool isDisabled);
|
||||||
|
|
||||||
void ApplyRestrictions();
|
void ApplyRestrictions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
<Compile Include="Configuration\AppConfig.cs" />
|
<Compile Include="Configuration\AppConfig.cs" />
|
||||||
<Compile Include="Configuration\ConfigurationStorage.cs" />
|
<Compile Include="Configuration\ConfigurationStorage.cs" />
|
||||||
<Compile Include="Configuration\IAppConfig.cs" />
|
<Compile Include="Configuration\IAppConfig.cs" />
|
||||||
<Compile Include="Configuration\IThumbnailConfiguration.cs" />
|
<Compile Include="Configuration\Interface\IThumbnailConfiguration.cs" />
|
||||||
<Compile Include="Configuration\ZoomAnchor.cs" />
|
<Compile Include="Configuration\ZoomAnchor.cs" />
|
||||||
<Compile Include="Mediator\Handlers\Configuration\SaveConfigurationHandler.cs" />
|
<Compile Include="Mediator\Handlers\Configuration\SaveConfigurationHandler.cs" />
|
||||||
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailFrameSettingsUpdatedHandler.cs" />
|
<Compile Include="Mediator\Handlers\Thumbnails\ThumbnailFrameSettingsUpdatedHandler.cs" />
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
<Compile Include="ApplicationBase\IView.cs" />
|
<Compile Include="ApplicationBase\IView.cs" />
|
||||||
<Compile Include="View\Interface\IThumbnailDescription.cs" />
|
<Compile Include="View\Interface\IThumbnailDescription.cs" />
|
||||||
<Compile Include="View\Interface\ViewZoomAnchor.cs" />
|
<Compile Include="View\Interface\ViewZoomAnchor.cs" />
|
||||||
<Compile Include="Configuration\ThumbnailConfiguration.cs" />
|
<Compile Include="Configuration\Implementation\ThumbnailConfiguration.cs" />
|
||||||
<Compile Include="Hotkeys\HotkeyHandler.cs" />
|
<Compile Include="Hotkeys\HotkeyHandler.cs" />
|
||||||
<Compile Include="Hotkeys\HotkeyHandlerNativeMethods.cs" />
|
<Compile Include="Hotkeys\HotkeyHandlerNativeMethods.cs" />
|
||||||
<Compile Include="View\Implementation\MainForm.cs">
|
<Compile Include="View\Implementation\MainForm.cs">
|
||||||
|
|||||||
@@ -199,14 +199,16 @@ namespace EveOPreview.Presenters
|
|||||||
|
|
||||||
private IThumbnailDescription CreateThumbnailDescription(string title)
|
private IThumbnailDescription CreateThumbnailDescription(string title)
|
||||||
{
|
{
|
||||||
// TODO Read here persisted value for the IsDisabled parameter
|
bool isDisabled = this._configuration.IsThumbnailDisabled(title);
|
||||||
return new ThumbnailDescription(title, false);
|
return new ThumbnailDescription(title, isDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateThumbnailState(String title)
|
private void UpdateThumbnailState(String title)
|
||||||
{
|
{
|
||||||
// TODO This setting doesn't work atm
|
if (this._descriptionsCache.TryGetValue(title, out IThumbnailDescription description))
|
||||||
//this._thumbnailManager.SetThumbnailState(thumbnailId, this._thumbnailDescriptionViews[thumbnailId].IsDisabled);
|
{
|
||||||
|
this._configuration.ToggleThumbnail(title, description.IsDisabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateThumbnailSize(Size size)
|
public void UpdateThumbnailSize(Size size)
|
||||||
|
|||||||
@@ -68,29 +68,12 @@ namespace EveOPreview.Services
|
|||||||
this._thumbnailUpdateTimer.Stop();
|
this._thumbnailUpdateTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetThumbnailState(IntPtr thumbnailId, bool hideAlways)
|
|
||||||
{
|
|
||||||
if (!this._thumbnailViews.TryGetValue(thumbnailId, out IThumbnailView thumbnail))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
thumbnail.IsEnabled = !hideAlways;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateThumbnailsSize()
|
public void UpdateThumbnailsSize()
|
||||||
{
|
{
|
||||||
this.InternalSetThumbnailsSize(this._configuration.ThumbnailSize);
|
this.SetThumbnailsSize(this._configuration.ThumbnailSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void SetThumbnailsSize(Size size)
|
private void SetThumbnailsSize(Size size)
|
||||||
{
|
|
||||||
this.InternalSetThumbnailsSize(size);
|
|
||||||
|
|
||||||
await this._mediator.Publish(new ThumbnailActiveSizeUpdated(size));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InternalSetThumbnailsSize(Size size)
|
|
||||||
{
|
{
|
||||||
this.DisableViewEvents();
|
this.DisableViewEvents();
|
||||||
|
|
||||||
@@ -115,7 +98,7 @@ namespace EveOPreview.Services
|
|||||||
{
|
{
|
||||||
IThumbnailView view = entry.Value;
|
IThumbnailView view = entry.Value;
|
||||||
|
|
||||||
if (hideAllThumbnails || !view.IsEnabled)
|
if (hideAllThumbnails || this._configuration.IsThumbnailDisabled(view.Title))
|
||||||
{
|
{
|
||||||
if (view.IsActive)
|
if (view.IsActive)
|
||||||
{
|
{
|
||||||
@@ -204,7 +187,6 @@ namespace EveOPreview.Services
|
|||||||
foreach (IProcessInfo process in addedProcesses)
|
foreach (IProcessInfo process in addedProcesses)
|
||||||
{
|
{
|
||||||
IThumbnailView view = this._thumbnailViewFactory.Create(process.Handle, process.Title, this._configuration.ThumbnailSize);
|
IThumbnailView view = this._thumbnailViewFactory.Create(process.Handle, process.Title, this._configuration.ThumbnailSize);
|
||||||
view.IsEnabled = true;
|
|
||||||
view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
|
view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
|
||||||
view.SetFrames(this._configuration.ShowThumbnailFrames);
|
view.SetFrames(this._configuration.ShowThumbnailFrames);
|
||||||
// Max/Min size limitations should be set AFTER the frames are disabled
|
// Max/Min size limitations should be set AFTER the frames are disabled
|
||||||
@@ -368,7 +350,7 @@ namespace EveOPreview.Services
|
|||||||
this.RefreshThumbnails();
|
this.RefreshThumbnails();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThumbnailViewResized(IntPtr id)
|
private async void ThumbnailViewResized(IntPtr id)
|
||||||
{
|
{
|
||||||
if (this._ignoreViewEvents)
|
if (this._ignoreViewEvents)
|
||||||
{
|
{
|
||||||
@@ -380,6 +362,8 @@ namespace EveOPreview.Services
|
|||||||
this.SetThumbnailsSize(view.ThumbnailSize);
|
this.SetThumbnailsSize(view.ThumbnailSize);
|
||||||
|
|
||||||
view.Refresh(false);
|
view.Refresh(false);
|
||||||
|
|
||||||
|
await this._mediator.Publish(new ThumbnailActiveSizeUpdated(view.ThumbnailSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ThumbnailViewMoved(IntPtr id)
|
private async void ThumbnailViewMoved(IntPtr id)
|
||||||
|
|||||||
@@ -1,15 +1,10 @@
|
|||||||
using System;
|
namespace EveOPreview.Services
|
||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace EveOPreview.Services
|
|
||||||
{
|
{
|
||||||
public interface IThumbnailManager
|
public interface IThumbnailManager
|
||||||
{
|
{
|
||||||
void Start();
|
void Start();
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
void SetThumbnailState(IntPtr thumbnailId, bool hideAlways);
|
|
||||||
void SetThumbnailsSize(Size size);
|
|
||||||
void UpdateThumbnailsSize();
|
void UpdateThumbnailsSize();
|
||||||
void UpdateThumbnailFrames();
|
void UpdateThumbnailFrames();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -708,6 +708,7 @@ namespace EveOPreview.View
|
|||||||
//
|
//
|
||||||
this.ThumbnailsList.BackColor = System.Drawing.SystemColors.Window;
|
this.ThumbnailsList.BackColor = System.Drawing.SystemColors.Window;
|
||||||
this.ThumbnailsList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.ThumbnailsList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.ThumbnailsList.CheckOnClick = true;
|
||||||
this.ThumbnailsList.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.ThumbnailsList.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.ThumbnailsList.FormattingEnabled = true;
|
this.ThumbnailsList.FormattingEnabled = true;
|
||||||
this.ThumbnailsList.IntegralHeight = false;
|
this.ThumbnailsList.IntegralHeight = false;
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ namespace EveOPreview.View
|
|||||||
|
|
||||||
foreach (IThumbnailDescription view in thumbnails)
|
foreach (IThumbnailDescription view in thumbnails)
|
||||||
{
|
{
|
||||||
this.ThumbnailsList.Items.Add(view);
|
this.ThumbnailsList.SetItemChecked(this.ThumbnailsList.Items.Add(view), view.IsDisabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ThumbnailsList.EndUpdate();
|
this.ThumbnailsList.EndUpdate();
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ namespace EveOPreview.View
|
|||||||
{
|
{
|
||||||
this._windowManager = windowManager;
|
this._windowManager = windowManager;
|
||||||
|
|
||||||
this.IsEnabled = true;
|
|
||||||
this.IsActive = false;
|
this.IsActive = false;
|
||||||
|
|
||||||
this.IsOverlayEnabled = false;
|
this.IsOverlayEnabled = false;
|
||||||
@@ -68,8 +67,6 @@ namespace EveOPreview.View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEnabled { get; set; }
|
|
||||||
|
|
||||||
public bool IsActive { get; set; }
|
public bool IsActive { get; set; }
|
||||||
|
|
||||||
public bool IsOverlayEnabled { get; set; }
|
public bool IsOverlayEnabled { get; set; }
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ namespace EveOPreview.View
|
|||||||
IntPtr Id { get; set; }
|
IntPtr Id { get; set; }
|
||||||
string Title { get; set; }
|
string Title { get; set; }
|
||||||
|
|
||||||
bool IsEnabled { get; set; }
|
|
||||||
bool IsActive { get; set; }
|
bool IsActive { get; set; }
|
||||||
Point ThumbnailLocation { get; set; }
|
Point ThumbnailLocation { get; set; }
|
||||||
Size ThumbnailSize { get; set; }
|
Size ThumbnailSize { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user