improving pro messaging
getting details for locked tools to be available
This commit is contained in:
parent
353d86268b
commit
9b3a36ba6e
9 changed files with 88 additions and 36 deletions
|
|
@ -546,7 +546,7 @@ namespace MatterHackers.MatterControl
|
|||
// check permission to a purchase
|
||||
public Func<string, bool> UserHasPermissionToId { get; set; }
|
||||
|
||||
public Func<IObject3D, string> GetUnlockPage { get; set; }
|
||||
public Func<IObject3D, (string url, string markDown)> GetUnlockData { get; set; }
|
||||
|
||||
private static ApplicationController globalInstance;
|
||||
|
||||
|
|
@ -2304,9 +2304,31 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public DragDropData DragDropData { get; set; } = new DragDropData();
|
||||
|
||||
public string ShortProductName => "MatterControl";
|
||||
public string ShortProductName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.IsMatterControlPro())
|
||||
{
|
||||
return "MatterControl Pro";
|
||||
}
|
||||
|
||||
public string ProductName => "MatterHackers: MatterControl";
|
||||
return "MatterControl";
|
||||
}
|
||||
}
|
||||
|
||||
public string ProductName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.IsMatterControlPro())
|
||||
{
|
||||
return "MatterControl Pro Edition";
|
||||
}
|
||||
|
||||
return "MatterHackers: MatterControl";
|
||||
}
|
||||
}
|
||||
|
||||
public void SwitchToPurchasedLibrary()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace MatterHackers.MatterControl.DataStorage
|
|||
|
||||
public virtual void Commit()
|
||||
{
|
||||
//Assumes that autoincremented ids start with 1
|
||||
// Assumes that autoincremented ids start with 1
|
||||
if (this.Id == 0)
|
||||
{
|
||||
TryHandleInsert();
|
||||
|
|
@ -210,7 +210,7 @@ namespace MatterHackers.MatterControl.DataStorage
|
|||
|
||||
public string DeviceToken { get; set; }
|
||||
|
||||
//Auto connect to printer (if available)
|
||||
// Auto connect to printer (if available)
|
||||
public string DeviceType { get; set; }
|
||||
|
||||
// all the data about print leveling
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public string Name => "Builder";
|
||||
|
||||
public bool Unlocked { get; } = true;
|
||||
|
||||
private string compilerPath = UserSettings.Instance.get(UserSettingsKey.OpenScadPath) ?? "/usr/bin/openscad";
|
||||
|
||||
|
|
|
|||
|
|
@ -98,8 +98,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
public string Name => "Property Editor";
|
||||
|
||||
public bool Unlocked { get; } = true;
|
||||
|
||||
public IEnumerable<Type> SupportedTypes() => new Type[] { typeof(IObject3D) };
|
||||
|
||||
private static readonly Type[] allowedTypes =
|
||||
|
|
@ -863,15 +861,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public static void AddUnlockLinkIfRequired(IObject3D item, GuiWidget editControlsContainer, ThemeConfig theme)
|
||||
{
|
||||
var unlockUrl = ApplicationController.Instance.GetUnlockPage?.Invoke(item);
|
||||
var unlockdata = ApplicationController.Instance.GetUnlockData?.Invoke(item);
|
||||
if (!item.Persistable
|
||||
&& !string.IsNullOrEmpty(unlockUrl))
|
||||
&& unlockdata != null
|
||||
&& !string.IsNullOrEmpty(unlockdata.Value.url))
|
||||
{
|
||||
editControlsContainer.AddChild(GetUnlockRow(theme, unlockUrl));
|
||||
editControlsContainer.AddChild(GetUnlockRow(theme, unlockdata.Value));
|
||||
}
|
||||
}
|
||||
|
||||
public static GuiWidget GetUnlockRow(ThemeConfig theme, string unlockLinkUrl)
|
||||
public static GuiWidget GetUnlockRow(ThemeConfig theme, (string url, string markDown) unlockData)
|
||||
{
|
||||
var detailsLink = new TextIconButton("Unlock".Localize(), AggContext.StaticData.LoadIcon("locked.png", 16, 16, theme.InvertIcons), theme)
|
||||
{
|
||||
|
|
@ -880,7 +879,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
};
|
||||
detailsLink.Click += (s, e) =>
|
||||
{
|
||||
ApplicationController.Instance.LaunchBrowser(unlockLinkUrl);
|
||||
ApplicationController.Instance.LaunchBrowser(unlockData.url);
|
||||
};
|
||||
theme.ApplyPrimaryActionStyle(detailsLink);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public class ImageEditor : IObject3DEditor
|
||||
{
|
||||
bool IObject3DEditor.Unlocked => true;
|
||||
|
||||
string IObject3DEditor.Name => "Image Editor";
|
||||
|
||||
IEnumerable<Type> IObject3DEditor.SupportedTypes() => new[] { typeof(ImageObject3D) };
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
public interface IObject3DEditor
|
||||
{
|
||||
bool Unlocked { get; }
|
||||
string Name { get; }
|
||||
IEnumerable<Type> SupportedTypes();
|
||||
GuiWidget Create(IObject3D item, UndoBuffer undoBuffer, ThemeConfig theme);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
this.MinimumSize = minSize;
|
||||
|
||||
this.Title = $"MatterHackers: MatterControl {version}";
|
||||
this.Title = $"{ApplicationController.Instance.ProductName} {version}";
|
||||
if (OemSettings.Instance.WindowTitleExtra != null && OemSettings.Instance.WindowTitleExtra.Trim().Length > 0)
|
||||
{
|
||||
this.Title += $" - {OemSettings.Instance.WindowTitleExtra}";
|
||||
|
|
|
|||
|
|
@ -1,10 +1,37 @@
|
|||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.SettingsManagement;
|
||||
/*
|
||||
Copyright (c) 2020, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.SettingsManagement;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -21,13 +48,18 @@ namespace MatterHackers.MatterControl
|
|||
public class ApplicationSettings
|
||||
{
|
||||
public static string ValidFileExtensions { get; } = ".STL;.AMF;.OBJ";
|
||||
|
||||
public static string LibraryMeshFileExtensions { get; } = ".stl,.obj,.amf,.mcx";
|
||||
|
||||
public static string LibraryFilterFileExtensions { get; } = LibraryMeshFileExtensions + ",.gcode";
|
||||
|
||||
public static string OpenPrintableFileParams { get; } = "STL, AMF, OBJ, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx";
|
||||
|
||||
public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx";
|
||||
|
||||
private static ApplicationSettings globalInstance = null;
|
||||
public Dictionary<string, SystemSetting> settingsDictionary;
|
||||
|
||||
public Dictionary<string, SystemSetting> SettingsDictionary { get; set; }
|
||||
|
||||
public static ApplicationSettings Instance
|
||||
{
|
||||
|
|
@ -131,14 +163,15 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
|
||||
allocatedCount++;
|
||||
}
|
||||
while (!string.IsNullOrEmpty(clientToken));
|
||||
|
||||
} while (!string.IsNullOrEmpty(clientToken));
|
||||
return allocatedClientTokens;
|
||||
}
|
||||
|
||||
private HashSet<string> GetRunningClientTokens()
|
||||
{
|
||||
var runningClientTokens = new HashSet<string>();
|
||||
var runningClientTokens = new HashSet<string>();
|
||||
|
||||
// Only deserialize if greater than one
|
||||
if (ApplicationController.ApplicationInstanceCount > 1)
|
||||
|
|
@ -188,41 +221,43 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
allocatedCount++;
|
||||
|
||||
} while (!firstEmptySlot);
|
||||
}
|
||||
while (!firstEmptySlot);
|
||||
}
|
||||
|
||||
public string get(string key)
|
||||
{
|
||||
string result;
|
||||
if (settingsDictionary == null)
|
||||
if (SettingsDictionary == null)
|
||||
{
|
||||
globalInstance.LoadData();
|
||||
}
|
||||
|
||||
if (settingsDictionary.ContainsKey(key))
|
||||
if (SettingsDictionary.ContainsKey(key))
|
||||
{
|
||||
result = settingsDictionary[key].Value;
|
||||
result = SettingsDictionary[key].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void set(string key, string value)
|
||||
{
|
||||
SystemSetting setting;
|
||||
if (settingsDictionary.ContainsKey(key))
|
||||
if (SettingsDictionary.ContainsKey(key))
|
||||
{
|
||||
setting = settingsDictionary[key];
|
||||
setting = SettingsDictionary[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
setting = new SystemSetting();
|
||||
setting.Name = key;
|
||||
|
||||
settingsDictionary[key] = setting;
|
||||
SettingsDictionary[key] = setting;
|
||||
}
|
||||
|
||||
setting.Value = value;
|
||||
|
|
@ -231,16 +266,16 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void LoadData()
|
||||
{
|
||||
settingsDictionary = new Dictionary<string, SystemSetting>();
|
||||
SettingsDictionary = new Dictionary<string, SystemSetting>();
|
||||
foreach (SystemSetting s in GetApplicationSettings())
|
||||
{
|
||||
settingsDictionary[s.Name] = s;
|
||||
SettingsDictionary[s.Name] = s;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<SystemSetting> GetApplicationSettings()
|
||||
{
|
||||
//Retrieve SystemSettings from the Datastore
|
||||
// Retrieve SystemSettings from the Datastore
|
||||
return Datastore.Instance.dbSQLite.Query<SystemSetting>("SELECT * FROM SystemSetting;");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit e9eee6d8b662a49481b83d5ce66b03d59b7f3b23
|
||||
Subproject commit 929a7968c8099e1eea33f5128cb60701f0200eca
|
||||
Loading…
Add table
Add a link
Reference in a new issue