mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 02:29:59 +00:00
Convert native receiver app to build with xcode
This commit is contained in:
@@ -1,54 +0,0 @@
|
|||||||
import Cocoa
|
|
||||||
|
|
||||||
|
|
||||||
class AppDelegate : NSObject, NSApplicationDelegate {
|
|
||||||
var mainWindow: NSWindow?
|
|
||||||
var mainWindowController: NSWindowController?
|
|
||||||
var mainWindowViewController: ViewController?
|
|
||||||
|
|
||||||
|
|
||||||
func applicationDidFinishLaunching (_ aNotification: Notification) {
|
|
||||||
let window = NSWindow(
|
|
||||||
contentRect: NSZeroRect
|
|
||||||
, styleMask: [ .titled, .closable ]
|
|
||||||
, backing: .buffered
|
|
||||||
, defer: false)
|
|
||||||
|
|
||||||
window.titleVisibility = .hidden
|
|
||||||
window.isMovableByWindowBackground = true
|
|
||||||
window.orderFrontRegardless()
|
|
||||||
|
|
||||||
if let screen = NSScreen.main {
|
|
||||||
let windowX = InitDataProvider.shared.data.windowPositionX
|
|
||||||
let windowY = Int(screen.frame.height - CGFloat(
|
|
||||||
InitDataProvider.shared.data.windowPositionY))
|
|
||||||
|
|
||||||
window.setFrameTopLeftPoint(NSPoint(x: windowX, y: windowY))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let windowController = NSWindowController(window: window)
|
|
||||||
windowController.showWindow(window)
|
|
||||||
|
|
||||||
let viewController = ViewController()
|
|
||||||
window.contentViewController = viewController
|
|
||||||
window.makeKeyAndOrderFront(self)
|
|
||||||
|
|
||||||
self.mainWindow = window
|
|
||||||
self.mainWindowController = windowController
|
|
||||||
self.mainWindowViewController = viewController
|
|
||||||
|
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func applicationDidResignActive (_ aNotification: Notification) {
|
|
||||||
if InitDataProvider.shared.data.closeIfFocusLost {
|
|
||||||
self.mainWindow?.performClose(aNotification)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func applicationShouldTerminateAfterLastWindowClosed (
|
|
||||||
_ app: NSApplication) -> Bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import Cocoa
|
|
||||||
|
|
||||||
|
|
||||||
let app = NSApplication.shared
|
|
||||||
|
|
||||||
let delegate = AppDelegate()
|
|
||||||
app.delegate = delegate
|
|
||||||
|
|
||||||
app.setActivationPolicy(.regular)
|
|
||||||
app.run()
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
struct Receiver : Codable {
|
|
||||||
struct Status: Codable {
|
|
||||||
let application: Application
|
|
||||||
let volume: Volume
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Application: Codable {
|
|
||||||
let displayName: String
|
|
||||||
let isIdleScreen: Bool
|
|
||||||
let statusText: String
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Volume: Codable {
|
|
||||||
let level: Double
|
|
||||||
let muted: Bool
|
|
||||||
}
|
|
||||||
|
|
||||||
let friendlyName: String
|
|
||||||
let host: String
|
|
||||||
let id: String
|
|
||||||
let port: Int
|
|
||||||
let status: Status
|
|
||||||
}
|
|
||||||
@@ -189,25 +189,23 @@ async function build () {
|
|||||||
|
|
||||||
// Build NativeMacReceiverSelector
|
// Build NativeMacReceiverSelector
|
||||||
if (isBuildingForMacOnMac) {
|
if (isBuildingForMacOnMac) {
|
||||||
const sourceFiles = glob.sync("**/*.swift", {
|
const selectorPath = path.join(__dirname, "../selector/mac/");
|
||||||
cwd: path.join(__dirname, "../NativeMacReceiverSelector")
|
const derivedDataPath = path.join(__dirname, "../selector/mac/build/");
|
||||||
, absolute: true
|
|
||||||
});
|
|
||||||
|
|
||||||
const formattedSourceFiles = sourceFiles
|
|
||||||
.map(fileName => `"${fileName}"`)
|
|
||||||
.join(" ");
|
|
||||||
|
|
||||||
let buildCommand = `
|
let buildCommand = `
|
||||||
swiftc -o "${path.join(BUILD_PATH, selectorExecutableName)}" \
|
xcodebuild -project ${selectorPath}/fx_cast_selector.xcodeproj \
|
||||||
${formattedSourceFiles}`;
|
-configuration Release \
|
||||||
|
-scheme fx_cast_selector \
|
||||||
// Build with optimizations if packaging
|
-derivedDataPath ${derivedDataPath} \
|
||||||
if (argv.package) {
|
build`;
|
||||||
buildCommand += " -Osize";
|
|
||||||
}
|
|
||||||
|
|
||||||
spawnSync(buildCommand, spawnOptions);
|
spawnSync(buildCommand, spawnOptions);
|
||||||
|
|
||||||
|
const selectorBundlePath = path.join(derivedDataPath
|
||||||
|
, "Build/Products/Release/", selectorExecutableName);
|
||||||
|
|
||||||
|
fs.moveSync(selectorBundlePath, path.join(BUILD_PATH, selectorExecutableName));
|
||||||
|
fs.removeSync(derivedDataPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ exports.manifestPath = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.selectorExecutableName = "selector";
|
exports.selectorExecutableName = "fx_cast_selector.app";
|
||||||
|
|
||||||
exports.pkgPlatform = {
|
exports.pkgPlatform = {
|
||||||
win32: "win"
|
win32: "win"
|
||||||
|
|||||||
4
app/selector/mac/.gitignore
vendored
Normal file
4
app/selector/mac/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Ignore contents of xcodeproj, besides main project file
|
||||||
|
*.xcodeproj/*
|
||||||
|
!*.xcodeproj/project.pbxproj
|
||||||
|
build/
|
||||||
372
app/selector/mac/fx_cast_selector.xcodeproj/project.pbxproj
Normal file
372
app/selector/mac/fx_cast_selector.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,372 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 50;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
C9667DF32329C6900008D030 /* ReceiverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9667DF22329C68F0008D030 /* ReceiverView.swift */; };
|
||||||
|
C9667DF52329C6A10008D030 /* util.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9667DF42329C6A10008D030 /* util.swift */; };
|
||||||
|
C9EF71522314055C00EBDE93 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EF71512314055C00EBDE93 /* AppDelegate.swift */; };
|
||||||
|
C9EF71542314055C00EBDE93 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EF71532314055C00EBDE93 /* ViewController.swift */; };
|
||||||
|
C9EF71562314055E00EBDE93 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C9EF71552314055E00EBDE93 /* Assets.xcassets */; };
|
||||||
|
C9EF71592314055E00EBDE93 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C9EF71572314055E00EBDE93 /* Main.storyboard */; };
|
||||||
|
C9EF71622314062500EBDE93 /* InitDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EF71612314062500EBDE93 /* InitDataProvider.swift */; };
|
||||||
|
C9EF71682314075900EBDE93 /* InitData.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EF71672314075900EBDE93 /* InitData.swift */; };
|
||||||
|
C9EF716A2314077E00EBDE93 /* MediaType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EF71692314077E00EBDE93 /* MediaType.swift */; };
|
||||||
|
C9EF716C2314079600EBDE93 /* Receiver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EF716B2314079600EBDE93 /* Receiver.swift */; };
|
||||||
|
C9EF716E231407DC00EBDE93 /* ReceiverSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EF716D231407DC00EBDE93 /* ReceiverSelection.swift */; };
|
||||||
|
C9EF717023140B3800EBDE93 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9EF716F23140B3800EBDE93 /* WindowController.swift */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
C9667DF22329C68F0008D030 /* ReceiverView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReceiverView.swift; sourceTree = "<group>"; };
|
||||||
|
C9667DF42329C6A10008D030 /* util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = util.swift; sourceTree = "<group>"; };
|
||||||
|
C9EF714E2314055C00EBDE93 /* fx_cast_selector.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = fx_cast_selector.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
C9EF71512314055C00EBDE93 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
|
C9EF71532314055C00EBDE93 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||||
|
C9EF71552314055E00EBDE93 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
|
C9EF71582314055E00EBDE93 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||||
|
C9EF715A2314055E00EBDE93 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
C9EF715B2314055E00EBDE93 /* fx_cast_selector.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = fx_cast_selector.entitlements; sourceTree = "<group>"; };
|
||||||
|
C9EF71612314062500EBDE93 /* InitDataProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InitDataProvider.swift; sourceTree = "<group>"; };
|
||||||
|
C9EF71672314075900EBDE93 /* InitData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InitData.swift; sourceTree = "<group>"; };
|
||||||
|
C9EF71692314077E00EBDE93 /* MediaType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaType.swift; sourceTree = "<group>"; };
|
||||||
|
C9EF716B2314079600EBDE93 /* Receiver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Receiver.swift; sourceTree = "<group>"; };
|
||||||
|
C9EF716D231407DC00EBDE93 /* ReceiverSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiverSelection.swift; sourceTree = "<group>"; };
|
||||||
|
C9EF716F23140B3800EBDE93 /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
C9EF714B2314055C00EBDE93 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
C9EF71452314055C00EBDE93 = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
C9EF71502314055C00EBDE93 /* fx_cast_selector */,
|
||||||
|
C9EF714F2314055C00EBDE93 /* Products */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
C9EF714F2314055C00EBDE93 /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
C9EF714E2314055C00EBDE93 /* fx_cast_selector.app */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
C9EF71502314055C00EBDE93 /* fx_cast_selector */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
C9EF71662314073800EBDE93 /* models */,
|
||||||
|
C9EF71612314062500EBDE93 /* InitDataProvider.swift */,
|
||||||
|
C9EF71512314055C00EBDE93 /* AppDelegate.swift */,
|
||||||
|
C9EF71532314055C00EBDE93 /* ViewController.swift */,
|
||||||
|
C9667DF22329C68F0008D030 /* ReceiverView.swift */,
|
||||||
|
C9667DF42329C6A10008D030 /* util.swift */,
|
||||||
|
C9EF716F23140B3800EBDE93 /* WindowController.swift */,
|
||||||
|
C9EF71552314055E00EBDE93 /* Assets.xcassets */,
|
||||||
|
C9EF71572314055E00EBDE93 /* Main.storyboard */,
|
||||||
|
C9EF715A2314055E00EBDE93 /* Info.plist */,
|
||||||
|
C9EF715B2314055E00EBDE93 /* fx_cast_selector.entitlements */,
|
||||||
|
);
|
||||||
|
path = fx_cast_selector;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
C9EF71662314073800EBDE93 /* models */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
C9EF71672314075900EBDE93 /* InitData.swift */,
|
||||||
|
C9EF71692314077E00EBDE93 /* MediaType.swift */,
|
||||||
|
C9EF716B2314079600EBDE93 /* Receiver.swift */,
|
||||||
|
C9EF716D231407DC00EBDE93 /* ReceiverSelection.swift */,
|
||||||
|
);
|
||||||
|
path = models;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
C9EF714D2314055C00EBDE93 /* fx_cast_selector */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = C9EF715E2314055E00EBDE93 /* Build configuration list for PBXNativeTarget "fx_cast_selector" */;
|
||||||
|
buildPhases = (
|
||||||
|
C9EF714A2314055C00EBDE93 /* Sources */,
|
||||||
|
C9EF714B2314055C00EBDE93 /* Frameworks */,
|
||||||
|
C9EF714C2314055C00EBDE93 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = fx_cast_selector;
|
||||||
|
productName = fx_cast_selector;
|
||||||
|
productReference = C9EF714E2314055C00EBDE93 /* fx_cast_selector.app */;
|
||||||
|
productType = "com.apple.product-type.application";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
C9EF71462314055C00EBDE93 /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
LastSwiftUpdateCheck = 1030;
|
||||||
|
LastUpgradeCheck = 1030;
|
||||||
|
ORGANIZATIONNAME = "Matt Hensman";
|
||||||
|
TargetAttributes = {
|
||||||
|
C9EF714D2314055C00EBDE93 = {
|
||||||
|
CreatedOnToolsVersion = 10.3;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buildConfigurationList = C9EF71492314055C00EBDE93 /* Build configuration list for PBXProject "fx_cast_selector" */;
|
||||||
|
compatibilityVersion = "Xcode 9.3";
|
||||||
|
developmentRegion = en;
|
||||||
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
Base,
|
||||||
|
);
|
||||||
|
mainGroup = C9EF71452314055C00EBDE93;
|
||||||
|
productRefGroup = C9EF714F2314055C00EBDE93 /* Products */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
C9EF714D2314055C00EBDE93 /* fx_cast_selector */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
C9EF714C2314055C00EBDE93 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
C9EF71562314055E00EBDE93 /* Assets.xcassets in Resources */,
|
||||||
|
C9EF71592314055E00EBDE93 /* Main.storyboard in Resources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
C9EF714A2314055C00EBDE93 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
C9EF716A2314077E00EBDE93 /* MediaType.swift in Sources */,
|
||||||
|
C9EF716C2314079600EBDE93 /* Receiver.swift in Sources */,
|
||||||
|
C9EF71622314062500EBDE93 /* InitDataProvider.swift in Sources */,
|
||||||
|
C9667DF52329C6A10008D030 /* util.swift in Sources */,
|
||||||
|
C9EF71542314055C00EBDE93 /* ViewController.swift in Sources */,
|
||||||
|
C9EF71682314075900EBDE93 /* InitData.swift in Sources */,
|
||||||
|
C9EF717023140B3800EBDE93 /* WindowController.swift in Sources */,
|
||||||
|
C9EF716E231407DC00EBDE93 /* ReceiverSelection.swift in Sources */,
|
||||||
|
C9667DF32329C6900008D030 /* ReceiverView.swift in Sources */,
|
||||||
|
C9EF71522314055C00EBDE93 /* AppDelegate.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXVariantGroup section */
|
||||||
|
C9EF71572314055E00EBDE93 /* Main.storyboard */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
C9EF71582314055E00EBDE93 /* Base */,
|
||||||
|
);
|
||||||
|
name = Main.storyboard;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXVariantGroup section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
C9EF715C2314055E00EBDE93 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SDKROOT = macosx;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
C9EF715D2314055E00EBDE93 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
SDKROOT = macosx;
|
||||||
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
C9EF715F2314055E00EBDE93 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = fx_cast_selector/fx_cast_selector.entitlements;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
DEVELOPMENT_TEAM = 7NS3H2Z7RF;
|
||||||
|
INFOPLIST_FILE = fx_cast_selector/Info.plist;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/../Frameworks",
|
||||||
|
);
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "tf.matt.fx-cast-selector";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
C9EF71602314055E00EBDE93 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = fx_cast_selector/fx_cast_selector.entitlements;
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
DEVELOPMENT_TEAM = 7NS3H2Z7RF;
|
||||||
|
INFOPLIST_FILE = fx_cast_selector/Info.plist;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/../Frameworks",
|
||||||
|
);
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "tf.matt.fx-cast-selector";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
C9EF71492314055C00EBDE93 /* Build configuration list for PBXProject "fx_cast_selector" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
C9EF715C2314055E00EBDE93 /* Debug */,
|
||||||
|
C9EF715D2314055E00EBDE93 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
C9EF715E2314055E00EBDE93 /* Build configuration list for PBXNativeTarget "fx_cast_selector" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
C9EF715F2314055E00EBDE93 /* Debug */,
|
||||||
|
C9EF71602314055E00EBDE93 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = C9EF71462314055C00EBDE93 /* Project object */;
|
||||||
|
}
|
||||||
18
app/selector/mac/fx_cast_selector/AppDelegate.swift
Normal file
18
app/selector/mac/fx_cast_selector/AppDelegate.swift
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import Cocoa
|
||||||
|
|
||||||
|
@NSApplicationMain
|
||||||
|
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
|
weak var mainWindow: NSWindow!
|
||||||
|
|
||||||
|
func applicationDidResignActive (_ aNotification: Notification) {
|
||||||
|
if InitDataProvider.shared.data.closeIfFocusLost {
|
||||||
|
self.mainWindow?.performClose(aNotification)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func applicationShouldTerminateAfterLastWindowClosed(
|
||||||
|
_ sender: NSApplication) -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "16x16",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "16x16",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "32x32",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "32x32",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "128x128",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "128x128",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "256x256",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "256x256",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "512x512",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "mac",
|
||||||
|
"size" : "512x512",
|
||||||
|
"scale" : "2x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
||||||
206
app/selector/mac/fx_cast_selector/Base.lproj/Main.storyboard
Normal file
206
app/selector/mac/fx_cast_selector/Base.lproj/Main.storyboard
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||||
|
<dependencies>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--Application-->
|
||||||
|
<scene sceneID="JPo-4y-FX3">
|
||||||
|
<objects>
|
||||||
|
<application id="hnw-xV-0zn" sceneMemberID="viewController">
|
||||||
|
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||||
|
<items>
|
||||||
|
<menuItem title="fx_cast_selector" id="1Xt-HY-uBw">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<menu key="submenu" title="fx_cast_selector" systemMenu="apple" id="uQy-DD-JDr">
|
||||||
|
<items>
|
||||||
|
<menuItem title="About fx_cast_selector" id="5kV-Vb-QxS">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
||||||
|
<menuItem title="Services" id="NMo-om-nkz">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||||
|
<menuItem title="Hide fx_cast_selector" keyEquivalent="h" id="Olw-nP-bQN">
|
||||||
|
<connections>
|
||||||
|
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="hideOtherApplications:" target="Ady-hI-5gd" id="VT4-aY-XCT"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="unhideAllApplications:" target="Ady-hI-5gd" id="Dhg-Le-xox"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||||
|
<menuItem title="Quit fx_cast_selector" keyEquivalent="q" id="4sb-4s-VLi">
|
||||||
|
<connections>
|
||||||
|
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
</menu>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Window" id="aUF-d1-5bR">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||||
|
<items>
|
||||||
|
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||||
|
<connections>
|
||||||
|
<action selector="performMiniaturize:" target="Ady-hI-5gd" id="VwT-WD-YPe"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="performZoom:" target="Ady-hI-5gd" id="DIl-cC-cCs"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||||
|
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="arrangeInFront:" target="Ady-hI-5gd" id="DRN-fu-gQh"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
</menu>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem title="Help" id="wpr-3q-Mcd">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||||
|
<items>
|
||||||
|
<menuItem title="fx_cast_selector Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||||
|
<connections>
|
||||||
|
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
</menu>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
</menu>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
|
||||||
|
</connections>
|
||||||
|
</application>
|
||||||
|
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="fx_cast_selector" customModuleProvider="target"/>
|
||||||
|
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||||
|
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="75" y="0.0"/>
|
||||||
|
</scene>
|
||||||
|
<!--Window Controller-->
|
||||||
|
<scene sceneID="R2V-B0-nI4">
|
||||||
|
<objects>
|
||||||
|
<windowController id="B8D-0N-5wS" customClass="WindowController" customModule="fx_cast_selector" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
<window key="window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" animationBehavior="default" titleVisibility="hidden" id="IQv-IB-iLA">
|
||||||
|
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||||
|
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||||
|
<rect key="contentRect" x="196" y="240" width="350" height="200"/>
|
||||||
|
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
||||||
|
<value key="minSize" type="size" width="350" height="0.0"/>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
|
||||||
|
</connections>
|
||||||
|
</window>
|
||||||
|
<connections>
|
||||||
|
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
|
||||||
|
</connections>
|
||||||
|
</windowController>
|
||||||
|
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="75" y="250"/>
|
||||||
|
</scene>
|
||||||
|
<!--View Controller-->
|
||||||
|
<scene sceneID="hIz-AP-VOD">
|
||||||
|
<objects>
|
||||||
|
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="fx_cast_selector" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
<view key="view" id="m2S-Jp-Qdl">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="366" height="200"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
<subviews>
|
||||||
|
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zKh-Ee-xHy">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="366" height="200"/>
|
||||||
|
<subviews>
|
||||||
|
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tT2-aJ-P6y">
|
||||||
|
<rect key="frame" x="8" y="8" width="33" height="184"/>
|
||||||
|
<subviews>
|
||||||
|
<textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8rD-dd-SO3">
|
||||||
|
<rect key="frame" x="-2" y="167" width="32" height="17"/>
|
||||||
|
<textFieldCell key="cell" lineBreakMode="clipping" placeholderString="Cast" id="xTR-SS-aI8">
|
||||||
|
<font key="font" usesAppearanceFont="YES"/>
|
||||||
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
</textFieldCell>
|
||||||
|
</textField>
|
||||||
|
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vOS-XX-x6r">
|
||||||
|
<rect key="frame" x="-2" y="79" width="38" height="25"/>
|
||||||
|
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="border" inset="2" autoenablesItems="NO" id="NlJ-61-ko4">
|
||||||
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
|
<font key="font" metaFont="menu"/>
|
||||||
|
<menu key="menu" autoenablesItems="NO" id="P9E-Cx-ZPa"/>
|
||||||
|
</popUpButtonCell>
|
||||||
|
</popUpButton>
|
||||||
|
<textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tTK-NT-lcd">
|
||||||
|
<rect key="frame" x="-2" y="167" width="20" height="17"/>
|
||||||
|
<textFieldCell key="cell" lineBreakMode="clipping" placeholderString="to:" id="gcc-sz-chP">
|
||||||
|
<font key="font" metaFont="system"/>
|
||||||
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
</textFieldCell>
|
||||||
|
</textField>
|
||||||
|
</subviews>
|
||||||
|
<visibilityPriorities>
|
||||||
|
<integer value="1000"/>
|
||||||
|
<integer value="1000"/>
|
||||||
|
<integer value="1000"/>
|
||||||
|
</visibilityPriorities>
|
||||||
|
<customSpacing>
|
||||||
|
<real value="3.4028234663852886e+38"/>
|
||||||
|
<real value="3.4028234663852886e+38"/>
|
||||||
|
<real value="3.4028234663852886e+38"/>
|
||||||
|
</customSpacing>
|
||||||
|
</stackView>
|
||||||
|
</subviews>
|
||||||
|
<edgeInsets key="edgeInsets" left="8" right="8" top="8" bottom="8"/>
|
||||||
|
<visibilityPriorities>
|
||||||
|
<integer value="1000"/>
|
||||||
|
</visibilityPriorities>
|
||||||
|
<customSpacing>
|
||||||
|
<real value="3.4028234663852886e+38"/>
|
||||||
|
</customSpacing>
|
||||||
|
</stackView>
|
||||||
|
</subviews>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstItem="zKh-Ee-xHy" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" id="30L-Wg-jxM"/>
|
||||||
|
<constraint firstItem="zKh-Ee-xHy" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" id="PE3-2g-Abh"/>
|
||||||
|
<constraint firstAttribute="bottom" secondItem="zKh-Ee-xHy" secondAttribute="bottom" id="R8r-bh-yQB"/>
|
||||||
|
<constraint firstAttribute="trailing" secondItem="zKh-Ee-xHy" secondAttribute="trailing" id="pV4-97-kss"/>
|
||||||
|
</constraints>
|
||||||
|
</view>
|
||||||
|
<connections>
|
||||||
|
<outlet property="labelCast" destination="8rD-dd-SO3" id="xWx-ZB-Cvy"/>
|
||||||
|
<outlet property="labelTo" destination="tTK-NT-lcd" id="STT-ut-O1z"/>
|
||||||
|
<outlet property="mainStackView" destination="zKh-Ee-xHy" id="wXQ-Fz-27i"/>
|
||||||
|
<outlet property="mediaTypePopUpButton" destination="vOS-XX-x6r" id="jvR-GV-bGW"/>
|
||||||
|
</connections>
|
||||||
|
</viewController>
|
||||||
|
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="75" y="635"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
||||||
32
app/selector/mac/fx_cast_selector/Info.plist
Normal file
32
app/selector/mac/fx_cast_selector/Info.plist
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string></string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>$(PRODUCT_NAME)</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>0.0.2</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright © 2019 Matt Hensman. All rights reserved.</string>
|
||||||
|
<key>NSMainStoryboardFile</key>
|
||||||
|
<string>Main</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
|
|
||||||
protocol ReceiverViewDelegate : AnyObject {
|
protocol ReceiverViewDelegate : AnyObject {
|
||||||
func didCast (_ receiver: Receiver)
|
func didCast (_ receiver: Receiver)
|
||||||
}
|
}
|
||||||
@@ -14,17 +13,11 @@ class ReceiverView : NSStackView {
|
|||||||
var castButton: NSButton!
|
var castButton: NSButton!
|
||||||
var castingSpinner: NSProgressIndicator!
|
var castingSpinner: NSProgressIndicator!
|
||||||
|
|
||||||
|
|
||||||
var isEnabled: Bool {
|
var isEnabled: Bool {
|
||||||
get {
|
get { return self.castButton.isEnabled }
|
||||||
return self.castButton.isEnabled
|
set { self.castButton.isEnabled = newValue }
|
||||||
}
|
|
||||||
set {
|
|
||||||
self.castButton.isEnabled = newValue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override init (frame: CGRect) {
|
override init (frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
}
|
}
|
||||||
@@ -68,8 +61,8 @@ class ReceiverView : NSStackView {
|
|||||||
, action: #selector(ReceiverView.onCast))
|
, action: #selector(ReceiverView.onCast))
|
||||||
|
|
||||||
self.castButton.bezelStyle = .rounded
|
self.castButton.bezelStyle = .rounded
|
||||||
self.castButton.widthAnchor.constraint(equalToConstant: 100).isActive = true
|
self.castButton.widthAnchor.constraint(
|
||||||
|
equalToConstant: 100).isActive = true
|
||||||
|
|
||||||
self.castingSpinner = NSProgressIndicator()
|
self.castingSpinner = NSProgressIndicator()
|
||||||
self.castingSpinner.style = .spinning
|
self.castingSpinner.style = .spinning
|
||||||
@@ -1,62 +1,28 @@
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
|
class ViewController: NSViewController {
|
||||||
|
@IBOutlet weak var labelCast: NSTextField!
|
||||||
|
@IBOutlet weak var labelTo: NSTextField!
|
||||||
|
@IBOutlet weak var mediaTypePopUpButton: NSPopUpButton!
|
||||||
|
|
||||||
|
@IBOutlet weak var mainStackView: NSStackView!
|
||||||
|
|
||||||
class ViewController : NSViewController {
|
|
||||||
var mediaTypePopUpButton: NSPopUpButton!
|
|
||||||
var receiverViews = [ReceiverView]()
|
var receiverViews = [ReceiverView]()
|
||||||
|
|
||||||
var filePath: String?
|
var filePath: String?
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
override func loadView () {
|
|
||||||
/*let visualEffectView = NSVisualEffectView()
|
|
||||||
visualEffectView.blendingMode = .behindWindow
|
|
||||||
visualEffectView.state = .active*/
|
|
||||||
|
|
||||||
self.view = NSView()
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidLoad () {
|
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
let initData = InitDataProvider.shared.data
|
let initData = InitDataProvider.shared.data
|
||||||
|
|
||||||
/**
|
|
||||||
* View Hierarchy
|
|
||||||
* --------------
|
|
||||||
*
|
|
||||||
* stackView \ (NSStackView)
|
|
||||||
* ├ mediaTypeStackView \ (NSStackView)
|
|
||||||
* │ ├ mediaSelectCastLabel \ (NSTextField)
|
|
||||||
* │ ├ mediaTypePopUpButton \ (NSPopUpButton)
|
|
||||||
* │ └ mediaSelectToLabel \ (NSTextField)
|
|
||||||
* │
|
|
||||||
* ├ receiverSeparator \ (NSBox) ┐
|
|
||||||
* └ receiverView \ (ReceiverView:NSStackView) │
|
|
||||||
* ├ metaStackView \ (NSStackView) │
|
|
||||||
* │ ├ receiver name \ (NSTextField) ├ Repeats
|
|
||||||
* │ └ receiver host \ (NSTextField) │
|
|
||||||
* ├ spinner \ (NSProgressIndicator) │
|
|
||||||
* └ button \ (NSButton) ┘
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
let stackView = NSStackView()
|
|
||||||
stackView.orientation = .vertical
|
|
||||||
stackView.alignment = .leading
|
|
||||||
stackView.autoresizingMask = [ .width, .height ]
|
|
||||||
stackView.edgeInsets = NSEdgeInsetsMake(8, 8, 8, 8)
|
|
||||||
|
|
||||||
|
|
||||||
self.mediaTypePopUpButton = NSPopUpButton()
|
|
||||||
self.mediaTypePopUpButton.autoenablesItems = false
|
|
||||||
self.mediaTypePopUpButton.addItems(withTitles: [
|
self.mediaTypePopUpButton.addItems(withTitles: [
|
||||||
initData.i18n_mediaTypeApp
|
initData.i18n_mediaTypeApp
|
||||||
, initData.i18n_mediaTypeTab
|
, initData.i18n_mediaTypeTab
|
||||||
, initData.i18n_mediaTypeScreen
|
, initData.i18n_mediaTypeScreen
|
||||||
, initData.i18n_mediaTypeFile
|
, initData.i18n_mediaTypeFile
|
||||||
])
|
])
|
||||||
|
|
||||||
if let appItem = self.mediaTypePopUpButton
|
if let appItem = self.mediaTypePopUpButton
|
||||||
.item(withTitle: initData.i18n_mediaTypeApp)
|
.item(withTitle: initData.i18n_mediaTypeApp)
|
||||||
, let tabItem = self.mediaTypePopUpButton
|
, let tabItem = self.mediaTypePopUpButton
|
||||||
@@ -65,128 +31,97 @@ class ViewController : NSViewController {
|
|||||||
.item(withTitle: initData.i18n_mediaTypeScreen)
|
.item(withTitle: initData.i18n_mediaTypeScreen)
|
||||||
, let fileItem = self.mediaTypePopUpButton
|
, let fileItem = self.mediaTypePopUpButton
|
||||||
.item(withTitle: initData.i18n_mediaTypeFile) {
|
.item(withTitle: initData.i18n_mediaTypeFile) {
|
||||||
|
|
||||||
if let mediaTypePopUpButtonMenu = self.mediaTypePopUpButton.menu {
|
if let menu = self.mediaTypePopUpButton.menu {
|
||||||
mediaTypePopUpButtonMenu.delegate = self
|
menu.delegate = self
|
||||||
mediaTypePopUpButtonMenu.insertItem(NSMenuItem.separator()
|
menu.insertItem(NSMenuItem.separator()
|
||||||
, at: mediaTypePopUpButtonMenu.index(of: fileItem))
|
, at: self.mediaTypePopUpButton.index(of: fileItem))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set tags to enum value
|
|
||||||
appItem.tag = MediaType.app.rawValue
|
appItem.tag = MediaType.app.rawValue
|
||||||
tabItem.tag = MediaType.tab.rawValue
|
tabItem.tag = MediaType.tab.rawValue
|
||||||
screenItem.tag = MediaType.screen.rawValue
|
screenItem.tag = MediaType.screen.rawValue
|
||||||
fileItem.tag = MediaType.file.rawValue
|
fileItem.tag = MediaType.file.rawValue
|
||||||
}
|
}
|
||||||
|
|
||||||
for item in self.mediaTypePopUpButton.itemArray {
|
for item in self.mediaTypePopUpButton.itemArray {
|
||||||
if (initData.availableMediaTypes & item.tag) == 0 {
|
if (initData.availableMediaTypes & item.tag) == 0 {
|
||||||
item.isEnabled = false
|
item.isEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.mediaTypePopUpButton.selectItem(
|
self.mediaTypePopUpButton.selectItem(
|
||||||
withTag: initData.defaultMediaType.rawValue)
|
withTag: initData.defaultMediaType.rawValue)
|
||||||
|
|
||||||
|
|
||||||
let mediaTypeStackView = NSStackView()
|
|
||||||
|
|
||||||
if initData.i18n_mediaSelectCastLabel != "" {
|
if initData.i18n_mediaSelectCastLabel != "" {
|
||||||
mediaTypeStackView.addView(
|
labelCast.stringValue = initData.i18n_mediaSelectCastLabel
|
||||||
makeLabel(initData.i18n_mediaSelectCastLabel), in: .leading)
|
labelCast.isHidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaTypeStackView.addView(self.mediaTypePopUpButton, in: .leading)
|
|
||||||
|
|
||||||
if initData.i18n_mediaSelectToLabel != "" {
|
if initData.i18n_mediaSelectToLabel != "" {
|
||||||
mediaTypeStackView.addView(
|
labelTo.stringValue = initData.i18n_mediaSelectToLabel
|
||||||
makeLabel(initData.i18n_mediaSelectToLabel), in: .leading)
|
labelTo.isHidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
stackView.addArrangedSubview(mediaTypeStackView)
|
if initData.receivers.count == 0 {
|
||||||
|
|
||||||
|
|
||||||
if initData.receivers.count < 1 {
|
|
||||||
let separator = NSBox()
|
let separator = NSBox()
|
||||||
separator.boxType = .separator
|
separator.boxType = .separator
|
||||||
|
|
||||||
let notFoundStackView = NSStackView(views: [
|
let notFoundPlaceholder = NSStackView(views: [
|
||||||
makeLabel(initData.i18n_noReceiversFound)
|
makeLabel(initData.i18n_noReceiversFound)
|
||||||
])
|
])
|
||||||
|
|
||||||
notFoundStackView.alignment = .centerX
|
notFoundPlaceholder.alignment = .centerX
|
||||||
notFoundStackView.edgeInsets = NSEdgeInsetsMake(18, 0, 18, 0)
|
notFoundPlaceholder.edgeInsets = NSEdgeInsetsMake(18, 0, 18, 0)
|
||||||
|
|
||||||
stackView.addArrangedSubview(separator)
|
self.mainStackView.addArrangedSubview(separator)
|
||||||
stackView.addArrangedSubview(notFoundStackView)
|
self.mainStackView.addArrangedSubview(notFoundPlaceholder)
|
||||||
} else {
|
} else {
|
||||||
/**
|
|
||||||
* For each receiver in the initData list, create a new
|
|
||||||
* ReceiverView, set self as a ReceiverViewDelegate and
|
|
||||||
* appends to main stack view.
|
|
||||||
*
|
|
||||||
* Keeps a reference to the receiver view to call disable()
|
|
||||||
* later.
|
|
||||||
*/
|
|
||||||
for receiver in initData.receivers {
|
for receiver in initData.receivers {
|
||||||
// Create separator between last receiver / media type
|
|
||||||
let receiverSeparator = NSBox()
|
let receiverSeparator = NSBox()
|
||||||
receiverSeparator.boxType = .separator
|
receiverSeparator.boxType = .separator
|
||||||
|
|
||||||
let receiverView = ReceiverView(receiver: receiver)
|
let receiverView = ReceiverView(receiver: receiver)
|
||||||
receiverView.receiverViewDelegate = self
|
receiverView.receiverViewDelegate = self
|
||||||
|
|
||||||
if UInt(initData.availableMediaTypes) == 0
|
if UInt(initData.availableMediaTypes) == 0
|
||||||
|| (initData.availableMediaTypes
|
|| (initData.availableMediaTypes
|
||||||
& initData.defaultMediaType.rawValue) == 0 {
|
& initData.defaultMediaType.rawValue) == 0 {
|
||||||
receiverView.isEnabled = false
|
receiverView.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
self.receiverViews.append(receiverView)
|
self.receiverViews.append(receiverView)
|
||||||
|
|
||||||
stackView.addArrangedSubview(receiverSeparator)
|
self.mainStackView.addArrangedSubview(receiverSeparator)
|
||||||
stackView.addArrangedSubview(receiverView)
|
self.mainStackView.addArrangedSubview(receiverView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.view.frame.size.height = 0
|
||||||
// Add to main view and set width to resize window
|
|
||||||
self.view.addSubview(stackView)
|
|
||||||
self.view.autoresizesSubviews = true
|
|
||||||
self.view.frame.size.width = 350
|
self.view.frame.size.width = 350
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidAppear () {
|
|
||||||
// Set window title and update visibility
|
|
||||||
if let window = self.view.window {
|
|
||||||
window.title = InitDataProvider.shared.data.i18n_extensionName
|
|
||||||
window.titleVisibility = .visible
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ViewController : NSMenuDelegate {
|
extension ViewController: NSMenuDelegate {
|
||||||
func menuDidClose (_ menu: NSMenu) {
|
func menuDidClose (_ menu: NSMenu) {
|
||||||
let initData = InitDataProvider.shared.data
|
let initData = InitDataProvider.shared.data
|
||||||
|
|
||||||
guard let selectedItem = self.mediaTypePopUpButton.selectedItem
|
guard let selectedItem = self.mediaTypePopUpButton.selectedItem
|
||||||
, let mediaType = MediaType(rawValue: selectedItem.tag) else {
|
, let mediaType = MediaType(rawValue: selectedItem.tag) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if initData.availableMediaTypes & mediaType.rawValue != 0 {
|
if initData.availableMediaTypes & mediaType.rawValue != 0 {
|
||||||
for receiverView in self.receiverViews {
|
for receiverView in self.receiverViews {
|
||||||
receiverView.isEnabled = true
|
receiverView.isEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let fileItem = self.mediaTypePopUpButton
|
guard let fileItem = self.mediaTypePopUpButton
|
||||||
.item(at: self.mediaTypePopUpButton.indexOfItem(
|
.item(at: self.mediaTypePopUpButton.indexOfItem(
|
||||||
withTag: MediaType.file.rawValue)) else {
|
withTag: MediaType.file.rawValue)) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaType == .file) {
|
if (mediaType == .file) {
|
||||||
let panel = NSOpenPanel()
|
let panel = NSOpenPanel()
|
||||||
panel.allowsMultipleSelection = false
|
panel.allowsMultipleSelection = false
|
||||||
@@ -194,38 +129,38 @@ extension ViewController : NSMenuDelegate {
|
|||||||
panel.canChooseDirectories = false
|
panel.canChooseDirectories = false
|
||||||
panel.canCreateDirectories = false
|
panel.canCreateDirectories = false
|
||||||
panel.canChooseFiles = true
|
panel.canChooseFiles = true
|
||||||
|
|
||||||
guard let window = self.view.window else { return }
|
guard let window = self.view.window else { return }
|
||||||
|
|
||||||
panel.beginSheetModal(for: window) { (result) in
|
panel.beginSheetModal(for: window) { (result) in
|
||||||
if (result == .OK) {
|
if (result == .OK) {
|
||||||
let url = panel.urls[0]
|
let url = panel.urls[0]
|
||||||
let fileName = url.lastPathComponent
|
let fileName = url.lastPathComponent
|
||||||
|
|
||||||
// Truncate file name and set as title
|
// Truncate file name and set as title
|
||||||
fileItem.title = fileName.count > 12
|
fileItem.title = fileName.count > 12
|
||||||
? "\(fileName.prefix(12))..."
|
? "\(fileName.prefix(12))..."
|
||||||
: fileName
|
: fileName
|
||||||
|
|
||||||
self.filePath = url.path
|
self.filePath = url.path
|
||||||
|
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
// Re-select the default media type item
|
// Re-select the default media type item
|
||||||
self.mediaTypePopUpButton.selectItem(
|
self.mediaTypePopUpButton.selectItem(
|
||||||
withTag: initData.defaultMediaType.rawValue)
|
withTag: initData.defaultMediaType.rawValue)
|
||||||
|
|
||||||
let defaultMediaTypeAvailable = initData.availableMediaTypes
|
let defaultMediaTypeAvailable = initData.availableMediaTypes
|
||||||
& initData.defaultMediaType.rawValue != 0
|
& initData.defaultMediaType.rawValue != 0
|
||||||
|
|
||||||
for receiverView in self.receiverViews {
|
for receiverView in self.receiverViews {
|
||||||
receiverView.isEnabled = defaultMediaTypeAvailable
|
receiverView.isEnabled = defaultMediaTypeAvailable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Reset file item
|
// Reset file item
|
||||||
fileItem.title = initData.i18n_mediaTypeFile
|
fileItem.title = initData.i18n_mediaTypeFile
|
||||||
self.filePath = nil
|
self.filePath = nil
|
||||||
@@ -234,26 +169,26 @@ extension ViewController : NSMenuDelegate {
|
|||||||
|
|
||||||
extension ViewController : ReceiverViewDelegate {
|
extension ViewController : ReceiverViewDelegate {
|
||||||
func didCast (_ receiver: Receiver) {
|
func didCast (_ receiver: Receiver) {
|
||||||
|
|
||||||
// Disable media type UI
|
// Disable media type UI
|
||||||
self.mediaTypePopUpButton.isEnabled = false
|
self.mediaTypePopUpButton.isEnabled = false
|
||||||
|
|
||||||
// Disable cast buttons
|
// Disable cast buttons
|
||||||
for receiverView in self.receiverViews {
|
for receiverView in self.receiverViews {
|
||||||
receiverView.isEnabled = false
|
receiverView.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
guard let selectedItem = self.mediaTypePopUpButton.selectedItem
|
guard let selectedItem = self.mediaTypePopUpButton.selectedItem
|
||||||
, let mediaType = MediaType(rawValue: selectedItem.tag) else {
|
, let mediaType = MediaType(rawValue: selectedItem.tag) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let selection = ReceiverSelection(
|
let selection = ReceiverSelection(
|
||||||
receiver: receiver
|
receiver: receiver
|
||||||
, mediaType: mediaType
|
, mediaType: mediaType
|
||||||
, filePath: self.filePath ?? nil)
|
, filePath: self.filePath ?? nil)
|
||||||
|
|
||||||
if let jsonData = try? JSONEncoder().encode(selection)
|
if let jsonData = try? JSONEncoder().encode(selection)
|
||||||
, let jsonString = String(data: jsonData, encoding: .utf8) {
|
, let jsonString = String(data: jsonData, encoding: .utf8) {
|
||||||
print(jsonString)
|
print(jsonString)
|
||||||
25
app/selector/mac/fx_cast_selector/WindowController.swift
Normal file
25
app/selector/mac/fx_cast_selector/WindowController.swift
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import Cocoa
|
||||||
|
|
||||||
|
class WindowController: NSWindowController {
|
||||||
|
override func windowDidLoad() {
|
||||||
|
super.windowDidLoad()
|
||||||
|
|
||||||
|
if let appDelegate = NSApplication.shared.delegate as? AppDelegate {
|
||||||
|
appDelegate.mainWindow = self.window
|
||||||
|
}
|
||||||
|
|
||||||
|
if let window = self.window
|
||||||
|
, let screen = window.screen {
|
||||||
|
let windowX = InitDataProvider.shared.data.windowPositionX
|
||||||
|
let windowY = Int(screen.frame.height - CGFloat(
|
||||||
|
InitDataProvider.shared.data.windowPositionY))
|
||||||
|
|
||||||
|
window.setFrameTopLeftPoint(NSPoint(x: windowX, y: windowY))
|
||||||
|
|
||||||
|
window.title = InitDataProvider.shared.data.i18n_extensionName
|
||||||
|
window.titleVisibility = .visible
|
||||||
|
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>com.apple.security.app-sandbox</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.files.user-selected.read-only</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
struct InitData : Codable {
|
struct InitData : Decodable {
|
||||||
let receivers: [Receiver]
|
let receivers: [Receiver]
|
||||||
let defaultMediaType: MediaType
|
let defaultMediaType: MediaType
|
||||||
let availableMediaTypes: Int
|
let availableMediaTypes: Int
|
||||||
|
|
||||||
let closeIfFocusLost: Bool
|
let closeIfFocusLost: Bool
|
||||||
|
|
||||||
let windowPositionX: Int
|
let windowPositionX: Int
|
||||||
let windowPositionY: Int
|
let windowPositionY: Int
|
||||||
|
|
||||||
let i18n_extensionName: String
|
let i18n_extensionName: String
|
||||||
let i18n_castButtonTitle: String
|
let i18n_castButtonTitle: String
|
||||||
let i18n_mediaTypeApp: String
|
let i18n_mediaTypeApp: String
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
import Foundation
|
|
||||||
|
|
||||||
|
|
||||||
enum MediaType: Int, Codable {
|
enum MediaType: Int, Codable {
|
||||||
case app = 1
|
case app = 1
|
||||||
case tab = 2
|
case tab = 2
|
||||||
23
app/selector/mac/fx_cast_selector/models/Receiver.swift
Normal file
23
app/selector/mac/fx_cast_selector/models/Receiver.swift
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
struct Receiver : Codable {
|
||||||
|
struct Status: Codable {
|
||||||
|
struct Application: Codable {
|
||||||
|
let displayName: String
|
||||||
|
let isIdleScreen: Bool
|
||||||
|
let statusText: String
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Volume: Codable {
|
||||||
|
let level: Double
|
||||||
|
let muted: Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
let application: Application
|
||||||
|
let volume: Volume
|
||||||
|
}
|
||||||
|
|
||||||
|
let friendlyName: String
|
||||||
|
let host: String
|
||||||
|
let id: String
|
||||||
|
let port: Int
|
||||||
|
let status: Status
|
||||||
|
}
|
||||||
@@ -204,8 +204,11 @@ function handleReceiverSelectorMessage (message: Message) {
|
|||||||
receiverSelectorApp.kill();
|
receiverSelectorApp.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const receiverSelectorPath = path.join(process.cwd()
|
||||||
|
, "fx_cast_selector.app/Contents/MacOS/fx_cast_selector");
|
||||||
|
|
||||||
receiverSelectorApp = child_process.spawn(
|
receiverSelectorApp = child_process.spawn(
|
||||||
path.join(process.cwd(), "selector")
|
receiverSelectorPath
|
||||||
, [ receiverSelectorData ]);
|
, [ receiverSelectorData ]);
|
||||||
|
|
||||||
receiverSelectorAppClosed = false;
|
receiverSelectorAppClosed = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user