Skip to content

Commit

Permalink
Merge pull request #337 from swiftDialog/dev_2.4.0
Browse files Browse the repository at this point in the history
SwiftDialog v2.4.0
  • Loading branch information
bartreardon committed Feb 6, 2024
2 parents 78122aa + 77a7b3e commit a9280e5
Show file tree
Hide file tree
Showing 39 changed files with 929 additions and 604 deletions.
42 changes: 29 additions & 13 deletions dialog.xcodeproj/project.pbxproj
Expand Up @@ -61,6 +61,7 @@
41D81E6C25F8209F00D1F7E1 /* CLOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41D81E6B25F8209F00D1F7E1 /* CLOptions.swift */; };
41D81E7125F845D200D1F7E1 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41D81E7025F845D200D1F7E1 /* AppState.swift */; };
41D81E7925F870A500D1F7E1 /* System.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41D81E7825F870A500D1F7E1 /* System.swift */; };
94072E492AFE931300B2A5C3 /* Font+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94072E482AFE931300B2A5C3 /* Font+Additions.swift */; };
CC21904B2A7B994A00269525 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC21904A2A7B994A00269525 /* Preferences.swift */; };
CC21904E2A7BC3E000269525 /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC21904D2A7BC3E000269525 /* Strings.swift */; };
CC2190502A7BC9FE00269525 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC21904F2A7BC9FE00269525 /* Log.swift */; };
Expand All @@ -72,6 +73,7 @@
CC21905F2A7BD7F200269525 /* CommandLineArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC21905E2A7BD7F200269525 /* CommandLineArguments.swift */; };
CC8D96302A01CCAB00CC84C6 /* Theme+sdMarkdown.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC8D962F2A01CCAB00CC84C6 /* Theme+sdMarkdown.swift */; };
CC9F8FEF2A5EC76400802A88 /* ImageProcessing.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC9F8FEE2A5EC76400802A88 /* ImageProcessing.swift */; };
CCB334702B2320F20079FB83 /* SolidColourView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCB3346F2B2320F20079FB83 /* SolidColourView.swift */; };
CCD8ACEC2A011C9500D98695 /* RadioView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCD8ACEB2A011C9500D98695 /* RadioView.swift */; };
CCE934AD2ACC29F60094BD06 /* TextFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCE934AC2ACC29F60094BD06 /* TextFileView.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -162,6 +164,7 @@
41D81E7825F870A500D1F7E1 /* System.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = System.swift; sourceTree = "<group>"; };
41FD45FD26C40366006976FC /* TimerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimerView.swift; sourceTree = "<group>"; };
41FD45FF26C8DC5D006976FC /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = "<group>"; };
94072E482AFE931300B2A5C3 /* Font+Additions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Font+Additions.swift"; sourceTree = "<group>"; };
CC21904A2A7B994A00269525 /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
CC21904D2A7BC3E000269525 /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
CC21904F2A7BC9FE00269525 /* Log.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = "<group>"; };
Expand All @@ -174,6 +177,7 @@
CC2190622A7DCA1A00269525 /* preinstall */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = preinstall; sourceTree = "<group>"; };
CC8D962F2A01CCAB00CC84C6 /* Theme+sdMarkdown.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+sdMarkdown.swift"; sourceTree = "<group>"; };
CC9F8FEE2A5EC76400802A88 /* ImageProcessing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageProcessing.swift; sourceTree = "<group>"; };
CCB3346F2B2320F20079FB83 /* SolidColourView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SolidColourView.swift; sourceTree = "<group>"; };
CCD8ACEB2A011C9500D98695 /* RadioView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioView.swift; sourceTree = "<group>"; };
CCE934AC2ACC29F60094BD06 /* TextFileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFileView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -259,9 +263,10 @@
children = (
417BBA6F297A15A600E13A45 /* Package */,
CC2190532A7BCD3400269525 /* Extensions */,
CC6538122B204DE700482768 /* Command Line */,
CC21904C2A7BC3BC00269525 /* Functions */,
CC21905A2A7BD47800269525 /* Structs */,
CC21905B2A7BD4C300269525 /* Classes */,
CC21905A2A7BD47800269525 /* App Processing */,
CC21905B2A7BD4C300269525 /* Updatable Content */,
41C8259825F99AF90042DC50 /* Views */,
4154C30C25F782E900A3D373 /* extras */,
4154C2DD25F76BDB00A3D373 /* dialogApp.swift */,
Expand Down Expand Up @@ -389,6 +394,7 @@
41A5A6A528E546A000BD3D5E /* WebContentView.swift */,
4124EFD129455861003B00F4 /* HelpView.swift */,
CCE934AC2ACC29F60094BD06 /* TextFileView.swift */,
CCB3346F2B2320F20079FB83 /* SolidColourView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand All @@ -408,8 +414,6 @@
CC2190512A7BCC3A00269525 /* Images.swift */,
41D81E7825F870A500D1F7E1 /* System.swift */,
CC21904A2A7B994A00269525 /* Preferences.swift */,
41D81E6B25F8209F00D1F7E1 /* CLOptions.swift */,
415934D726DB1B44009C9C3A /* ProcessCLOptions.swift */,
411FC34528E2DDFD003EA2C2 /* Notifications.swift */,
);
path = Functions;
Expand All @@ -423,29 +427,28 @@
CC2190582A7BCDDD00269525 /* View+Additions.swift */,
CC8D962F2A01CCAB00CC84C6 /* Theme+sdMarkdown.swift */,
415934D926DB7604009C9C3A /* NSWindow+Additions.swift */,
94072E482AFE931300B2A5C3 /* Font+Additions.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
CC21905A2A7BD47800269525 /* Structs */ = {
CC21905A2A7BD47800269525 /* App Processing */ = {
isa = PBXGroup;
children = (
41D81E7025F845D200D1F7E1 /* AppState.swift */,
CC21905C2A7BD7D300269525 /* AppVariables.swift */,
CC21905E2A7BD7F200269525 /* CommandLineArguments.swift */,
41A44EB126F4C43A00FEE1AC /* HelpText.swift */,
CC9F8FEE2A5EC76400802A88 /* ImageProcessing.swift */,
41D6FE8426DB11BA0083BE61 /* jamfHelper.swift */,
);
path = Structs;
path = "App Processing";
sourceTree = "<group>";
};
CC21905B2A7BD4C300269525 /* Classes */ = {
CC21905B2A7BD4C300269525 /* Updatable Content */ = {
isa = PBXGroup;
children = (
417BD4342798FE38009AE34A /* DialogUpdatableContent.swift */,
);
path = Classes;
path = "Updatable Content";
sourceTree = "<group>";
};
CC2190602A7BDCB100269525 /* Localisations */ = {
Expand All @@ -456,6 +459,17 @@
path = Localisations;
sourceTree = "<group>";
};
CC6538122B204DE700482768 /* Command Line */ = {
isa = PBXGroup;
children = (
415934D726DB1B44009C9C3A /* ProcessCLOptions.swift */,
41D81E6B25F8209F00D1F7E1 /* CLOptions.swift */,
CC21905E2A7BD7F200269525 /* CommandLineArguments.swift */,
41A44EB126F4C43A00FEE1AC /* HelpText.swift */,
);
path = "Command Line";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -527,7 +541,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1500;
TargetAttributes = {
4154C2D925F76BDB00A3D373 = {
CreatedOnToolsVersion = 12.4;
Expand Down Expand Up @@ -639,6 +653,7 @@
418A7B512759949A00E4D6F1 /* VideoView.swift in Sources */,
418A7B522759949A00E4D6F1 /* WatermarkView.swift in Sources */,
418A7B532759949A00E4D6F1 /* TextEntryView.swift in Sources */,
CCB334702B2320F20079FB83 /* SolidColourView.swift in Sources */,
CC21905F2A7BD7F200269525 /* CommandLineArguments.swift in Sources */,
CCE934AD2ACC29F60094BD06 /* TextFileView.swift in Sources */,
418A7B542759949A00E4D6F1 /* TimerView.swift in Sources */,
Expand Down Expand Up @@ -685,6 +700,7 @@
CC21905D2A7BD7D300269525 /* AppVariables.swift in Sources */,
4124EFD229455861003B00F4 /* HelpView.swift in Sources */,
CC2190502A7BC9FE00269525 /* Log.swift in Sources */,
94072E492AFE931300B2A5C3 /* Font+Additions.swift in Sources */,
41D81E7925F870A500D1F7E1 /* System.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -883,7 +899,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 2.3.3;
MARKETING_VERSION = 2.4.0;
PRODUCT_BUNDLE_IDENTIFIER = au.csiro.dialog;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -912,7 +928,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 2.3.3;
MARKETING_VERSION = 2.4.0;
PRODUCT_BUNDLE_IDENTIFIER = au.csiro.dialog;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -56,20 +56,24 @@
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--moveable"
argument = "--listitem &quot;test1&quot;,icon=&quot;sf=applelogo&quot;,status=wait,subtitle=&quot;Here is a sub title. Here is a sub title. Here is a sub title. Here is a sub title. Here is a sub title. Here is a sub title. &quot; --icon sf=applelogo --listitem &quot;test 2&quot;,icon=&quot;sf=applelogo&quot;,status=progress"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--moveable"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--bannerimage &quot;https://img.freepik.com/free-vector/abstract-orange-background-with-lines-halftone-effect_1017-32107.jpg&quot;"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--textfield &quot;Textfield Test&quot;,required --selecttitle &quot;Dropdown Test&quot;,required --selectvalues &quot;one, two, three&quot;"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--ontop"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "--icon &quot;https://www.dropbox.com/s/4batk8v5outfxo5/install.png?dl=0&quot;"
Expand Down
Expand Up @@ -47,10 +47,13 @@ struct TextFieldState {
var prompt: String = ""
var regex: String = ""
var regexError: String = ""
var backgroundColour: Color = .clear
var required: Bool = false
var secure: Bool = false
var title: String
var value: String = ""
var date: Date = Date.now
var isDate: Bool = false
var requiredTextfieldHighlight: Color = .clear
var dictionary: [String: Any] {
return ["title": title,
Expand Down Expand Up @@ -82,16 +85,20 @@ struct CheckBoxes {
var icon: String = ""
var checked: Bool = false
var disabled: Bool = false
var enablesButton1: Bool = false
}

struct ListItems: Codable {
var title: String
var subTitle: String = ""
var icon: String = ""
var statusText: String = ""
var statusIcon: String = ""
var progress: CGFloat = 0
var dictionary: [String: Any] {
return ["title": title,
"subtitle": subTitle,
"icon": icon,
"statustext": statusText,
"status": statusIcon,
"progress": progress]
Expand Down
Expand Up @@ -10,7 +10,7 @@ import SwiftUI

struct AppVariables {

var cliversion = "2.3.3"
var cliversion = "2.4.0"
let launchTime = Date.now
// message default strings
let titleDefault = String("default-title".localized)
Expand All @@ -34,7 +34,8 @@ struct AppVariables {
let button2Default = String("button-cancel".localized)
let buttonInfoDefault = String("button-more-info".localized)
let buttonInfoActionDefault = String("")
let button1DefaultAction = KeyboardShortcut.defaultAction
var button1DefaultAction = KeyboardShortcut.defaultAction
var button2DefaultAction = KeyboardShortcut.cancelAction

var helpButtonHoverText = String("help-hover".localized)

Expand All @@ -47,6 +48,8 @@ struct AppVariables {
var windowWidth = CGFloat(820) // set default dialog width
var windowHeight = CGFloat(380) // set default dialog height

var windowBackgroundColour = Color.clear

// Content padding
let sidePadding = CGFloat(15)
let topPadding = CGFloat(10)
Expand All @@ -64,6 +67,10 @@ struct AppVariables {
var windowPositionHorozontal = NSWindow.Position.Horizontal.center
var windowPositionOffset = CGFloat(16)

var windowCloseEnabled = Bool(true)
var windowMinimiseEnabled = Bool(true)
var windowMaximiseEnabled = Bool(true)

var iconWidth = CGFloat(150) // set default image area width
var iconHeight = CGFloat(260) // set default image area height
var titleHeight = CGFloat(50)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import SwiftyJSON

struct CommandlineArgument {
var long: String
Expand All @@ -16,8 +17,31 @@ struct CommandlineArgument {
var helpUsage: String = "<text>"
var present: Bool = false
var isbool: Bool = false
}

public mutating func evaluate(json: JSON = "{}", defaultValue: Any = "") {
self.present = json[self.long].exists() || CLOptionPresent(optionName: self)
if !self.isbool && json[self.long].bool ?? false {
self.present = false
}

if self.present {
if let numberValue = json[self.long].number {
self.value = numberValue.stringValue
} else {
self.value = json[self.long].string ?? CLOptionText(optionName: self)
}
}
if self.value.isEmpty {
if let floatValue = defaultValue as? CGFloat {
self.value = floatValue.stringValue
} else if let stringValue = defaultValue as? String {
self.value = stringValue
} else {
self.value = defaultValue as? String ?? ""
}
}
}
}


struct CommandLineArguments {
Expand All @@ -39,6 +63,7 @@ struct CommandLineArguments {
var bannerImage = CommandlineArgument(long: "bannerimage", short: "n")
var bannerTitle = CommandlineArgument(long: "bannertitle")
var bannerText = CommandlineArgument(long: "bannertext")
var bannerHeight = CommandlineArgument(long: "bannerheight")
var button1TextOption = CommandlineArgument(long: "button1text")
var button1ActionOption = CommandlineArgument(long: "button1action")
var button1ShellActionOption = CommandlineArgument(long: "button1shellaction",short: "")
Expand All @@ -54,6 +79,7 @@ struct CommandLineArguments {
var titleFont = CommandlineArgument(long: "titlefont")
var messageFont = CommandlineArgument(long: "messagefont")
var textField = CommandlineArgument(long: "textfield")
var textFieldLiveValidation = CommandlineArgument(long: "textfieldlivevalidation", isbool: true)
var checkbox = CommandlineArgument(long: "checkbox")
var checkboxStyle = CommandlineArgument(long: "checkboxstyle")
var timerBar = CommandlineArgument(long: "timer")
Expand Down Expand Up @@ -118,6 +144,9 @@ struct CommandLineArguments {
var jsonOutPut = CommandlineArgument(long: "json", short: "j", isbool: true)
var ignoreDND = CommandlineArgument(long: "ignorednd", short: "d", isbool: true)
var jamfHelperMode = CommandlineArgument(long: "jh", short: "jh", isbool: true)
var miniMode = CommandlineArgument(long: "mini")
var miniMode = CommandlineArgument(long: "mini", isbool: true)
var eulaMode = CommandlineArgument(long: "eula", isbool: true)
var windowButtonsEnabled = CommandlineArgument(long: "windowbuttons")
var windowResizable = CommandlineArgument(long: "resizable", isbool: true)
var hideDefaultKeyboardAction = CommandlineArgument(long: "hidedefaultkeyboardaction", isbool: true)
}
Expand Up @@ -789,8 +789,29 @@ struct SDHelp {
argument.quitKey.helpShort = "Set dialog quit key"
argument.quitKey.helpUsage = "<char>"
argument.quitKey.helpLong = """
Use the specified character as the command+ key combination for quitting instead of "q".
Capitol letters can be used in which case command+shift+<key> will be required
Use the specified character as the Command ⇧ + <key> combination for quitting instead of "q".
Capitol letters can be used in which case Command ⇧ + Shift ⇧ + <key> will be required
"""

argument.windowButtonsEnabled.helpShort = "Enables window buttons"
argument.windowButtonsEnabled.helpUsage = "[close,min,max]"
argument.windowButtonsEnabled.helpLong = """
Enables window buttons, close, minimize and maximise(zoom)
You can optionally specify one or more of "close", "min" or "max" as comma seperated values.
e.g. to enable only the min and max(zoom) buttons:
--\(argument.windowButtonsEnabled.long) min,max
"""

argument.hideDefaultKeyboardAction.helpShort = "Hides the default behaviour of Return ↵ and Esc ⎋ keys"
argument.hideDefaultKeyboardAction.helpUsage = ""
argument.hideDefaultKeyboardAction.helpLong = """
When specified, the behaviour to action the default button (Return ↵) or secondary button (Esc ⎋) will be modified
to require Command ⌘ + Shift ⇧ in order to action.
This effectively disables unintentional activation of either of these buttons. They can still be activated
with the keyboard, but it is harder to do so without intent.
"""

argument.jamfHelperMode.helpShort = "Enable jamfHelper mode"
Expand Down Expand Up @@ -834,6 +855,14 @@ struct SDHelp {
echo -n <string> | shasum -a 256
"""

argument.windowResizable.helpShort = "Enable the dialog window to be resizable"
argument.windowResizable.helpUsage = ""
argument.windowResizable.helpLong = """
Enables the dialog window to be resizable.
This option also implies the --\(argument.movableWindow.long) flag
"""

argument.getVersion.helpShort = "Print version string"
argument.getVersion.helpUsage = ""
argument.getVersion.helpLong = ""
Expand Down

0 comments on commit a9280e5

Please sign in to comment.