Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Moonif committed May 6, 2023
1 parent 9358f8d commit 0fd8393
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
4 changes: 2 additions & 2 deletions MacBox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.2.5;
MARKETING_VERSION = 0.2.6;
PRODUCT_BUNDLE_IDENTIFIER = Moonif.MacBox;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -414,7 +414,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.2.5;
MARKETING_VERSION = 0.2.6;
PRODUCT_BUNDLE_IDENTIFIER = Moonif.MacBox;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
57 changes: 54 additions & 3 deletions MacBox/ViewControllers/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ class MainViewController: NSViewController {
if let bundleVersion = bundle.infoDictionary?["CFBundleVersion"] as? String {
// Return only the build version
buildVer = String((bundleVersion).suffix(4))
// Check if locally built
if buildVer == ".0.0" {
buildVer = String((bundleVersion).prefix(3))
}
}
}
}
Expand Down Expand Up @@ -247,6 +251,12 @@ class MainViewController: NSViewController {
DispatchQueue.main.async {
self.spinningProgressIndicator.stopAnimation(self)

// Check for local build
if localVer.count == 3 {
self.statusLabel.stringValue = "🟢 86Box \(localVer) (local build) is installed."
return
}

// Compare Jenkins version with local version
if onlineVer != localVer {
// Version mismatch
Expand Down Expand Up @@ -430,8 +440,19 @@ class MainViewController: NSViewController {
var vmAppVersion = "net.86Box.86Box"
var vmAppArg = "-b"
if let customAppPath = vmList[currentSelectedVM ?? 0].appPath {
vmAppVersion = customAppPath
vmAppArg = "-a"
if FileManager.default.fileExists(atPath: customAppPath) {
vmAppVersion = customAppPath
vmAppArg = "-a"
}
else {
// Custom app version was not found (Probably got moved or deleted)
let alert = NSAlert()

alert.messageText = "Selected 86Box file is not found. VM will open using default version."
alert.alertStyle = .critical

alert.runModal()
}
}

// Set process arguments
Expand Down Expand Up @@ -599,7 +620,37 @@ class MainViewController: NSViewController {
vmSpecMachineLogo.image = NSImage(named: machineLogo)
}
else {
vmSpecMachineLogo.image = nil
// Check for used machine name and set a logo by default
switch vmSpecMachine.stringValue {
case _ where vmSpecMachine.stringValue.hasPrefix("IBM"):
vmSpecMachineLogo.image = NSImage(named: "IBM_logo")
break
case _ where vmSpecMachine.stringValue.hasPrefix("Compaq"):
vmSpecMachineLogo.image = NSImage(named: "Compaq_logo")
break
case _ where vmSpecMachine.stringValue.hasPrefix("Amstrad"):
vmSpecMachineLogo.image = NSImage(named: "Amstrad_logo")
break
case _ where vmSpecMachine.stringValue.hasPrefix("Commodore"):
vmSpecMachineLogo.image = NSImage(named: "Commodore_logo")
break
case _ where vmSpecMachine.stringValue.hasPrefix("Epson"):
vmSpecMachineLogo.image = NSImage(named: "Epson_logo")
break
case _ where vmSpecMachine.stringValue.hasPrefix("NEC"):
vmSpecMachineLogo.image = NSImage(named: "NEC_logo")
break
case _ where vmSpecMachine.stringValue.hasPrefix("Packard Bell"):
vmSpecMachineLogo.image = NSImage(named: "Pb_logo")
break
case _ where vmSpecMachine.stringValue.hasPrefix("Tandy"):
vmSpecMachineLogo.image = NSImage(named: "Tandy_logo")
break
default:
// No machine logo
vmSpecMachineLogo.image = nil
break
}
}
}
else {
Expand Down

0 comments on commit 0fd8393

Please sign in to comment.