ssg: advanced config BuildPublishPanel: attributes, loading

This commit is contained in:
Nick Vella 2019-07-29 16:19:04 +10:00
parent 506e9a3638
commit e8af31e41c
3 changed files with 81 additions and 15 deletions

View File

@ -26,6 +26,8 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
private const string CONFIG_CMD_TIMEOUT_MS = "SSGCmdTimeoutMs";
private const string CONFIG_INITIALISED = "SSGInitialised";
public static int DEFAULT_CMD_TIMEOUT = 60000;
// Public Site Url is stored in the blog's BlogConfig. Loading is handled in this class, but saving is handled from the WizardController.
// This is done to avoid referencing PostEditor from this project.
@ -114,9 +116,9 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
public bool ShowCmdWindows { get; set; } = false;
/// <summary>
/// Timeout for commands. Default is 30k MS (30 seconds).
/// Timeout for commands. Default is 60k MS (60 seconds).
/// </summary>
public int CmdTimeoutMs { get; set; } = 60000;
public int CmdTimeoutMs { get; set; } = DEFAULT_CMD_TIMEOUT;
/// <summary>
/// Used to determine if parameter detection has occurred, default false.

View File

@ -17,6 +17,7 @@ using OpenLiveWriter.BlogClient;
using OpenLiveWriter.PostEditor;
using OpenLiveWriter.ApplicationFramework.Preferences;
using OpenLiveWriter.PostEditor.Configuration.Wizard;
using OpenLiveWriter.BlogClient.Clients.StaticSite;
namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
{
@ -62,6 +63,61 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
RecomputeEnabledStates();
}
public bool ShowCmdWindows
{
get => checkBoxShowCommandWindows.Checked;
set => checkBoxShowCommandWindows.Checked = value;
}
public int CmdTimeoutMs
{
get
{
if (checkBoxEnableCmdTimeout.Checked)
return Convert.ToInt32(numericUpDownCmdTimeout.Value);
return StaticSiteConfig.DEFAULT_CMD_TIMEOUT;
}
set
{
if (value >= 0)
{
checkBoxEnableCmdTimeout.Checked = true;
numericUpDownCmdTimeout.Value = value;
}
else
checkBoxEnableCmdTimeout.Checked = false;
RecomputeEnabledStates();
}
}
public bool BuildingEnabled
{
get => checkBoxBuildingEnabled.Checked;
set => checkBoxBuildingEnabled.Checked = value;
}
public string BuildCommand
{
get => textBoxBuildCommand.Text;
set => textBoxBuildCommand.Text = value;
}
public string OutputPath
{
get => textBoxOutputPath.Text;
set => textBoxOutputPath.Text = value;
}
public string PublishCommand
{
get => textBoxPublishCommand.Text;
set => textBoxPublishCommand.Text = value;
}
#region Component Designer generated code

View File

@ -71,25 +71,33 @@ namespace OpenLiveWriter.PostEditor.Configuration.StaticSiteAdvanced
return ssgConfig;
}
private void LoadFromStaticSiteConfig(StaticSiteConfig ssgConfig)
private void LoadFromStaticSiteConfig(StaticSiteConfig config)
{
// General
panelGeneral.SiteTitle = ssgConfig.SiteTitle;
panelGeneral.SiteUrl = ssgConfig.SiteUrl;
panelGeneral.LocalSitePath = ssgConfig.LocalSitePath;
panelGeneral.SiteTitle = config.SiteTitle;
panelGeneral.SiteUrl = config.SiteUrl;
panelGeneral.LocalSitePath = config.LocalSitePath;
// Authoring
panelAuthoring.PostsPath = ssgConfig.PostsPath;
panelAuthoring.DraftsEnabled = ssgConfig.DraftsEnabled;
panelAuthoring.DraftsPath = ssgConfig.DraftsPath;
panelAuthoring.PagesEnabled = ssgConfig.PagesEnabled;
panelAuthoring.PagesPath = ssgConfig.PagesPath;
panelAuthoring.PagesStoredInRoot = ssgConfig.PagesPath == ".";
panelAuthoring.ImagesEnabled = ssgConfig.ImagesEnabled;
panelAuthoring.ImagesPath = ssgConfig.ImagesPath;
panelAuthoring.PostsPath = config.PostsPath;
panelAuthoring.DraftsEnabled = config.DraftsEnabled;
panelAuthoring.DraftsPath = config.DraftsPath;
panelAuthoring.PagesEnabled = config.PagesEnabled;
panelAuthoring.PagesPath = config.PagesPath;
panelAuthoring.PagesStoredInRoot = config.PagesPath == ".";
panelAuthoring.ImagesEnabled = config.ImagesEnabled;
panelAuthoring.ImagesPath = config.ImagesPath;
// Front Matter
panelFrontMatter.Keys = ssgConfig.FrontMatterKeys;
panelFrontMatter.Keys = config.FrontMatterKeys;
// Building and Publishing
panelBuildPublish.ShowCmdWindows = config.ShowCmdWindows;
panelBuildPublish.CmdTimeoutMs = config.CmdTimeoutMs;
panelBuildPublish.BuildingEnabled = config.BuildingEnabled;
panelBuildPublish.BuildCommand = config.BuildCommand;
panelBuildPublish.OutputPath = config.OutputPath;
panelBuildPublish.PublishCommand = config.PublishCommand;
}
public void GeneralPanel_RunAccountWizard()