Make preferences non-modal
This commit is contained in:
parent
830b8d8a60
commit
83e3138ddc
|
@ -10,7 +10,7 @@
|
|||
<scene sceneID="5Pm-Xi-FR8">
|
||||
<objects>
|
||||
<windowController storyboardIdentifier="OrganizerWindowController" id="qvz-MB-haa" sceneMemberID="viewController">
|
||||
<window key="window" title="Passepartout" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="iHm-B8-M67">
|
||||
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="iHm-B8-M67">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="zUN-WZ-Zgv">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="SOo-ww-yjs">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
|
||||
|
@ -383,6 +383,31 @@
|
|||
</objects>
|
||||
<point key="canvasLocation" x="473" y="375"/>
|
||||
</scene>
|
||||
<!--Window Controller-->
|
||||
<scene sceneID="fan-9l-p2s">
|
||||
<objects>
|
||||
<windowController storyboardIdentifier="PreferencesWindowController" showSeguePresentationStyle="single" id="SOo-ww-yjs" sceneMemberID="viewController">
|
||||
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="9hQ-OD-a0i">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="239" width="480" height="270"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
|
||||
<view key="contentView" id="fer-NB-U3E">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="SOo-ww-yjs" id="t5d-Qc-Bh8"/>
|
||||
</connections>
|
||||
</window>
|
||||
<connections>
|
||||
<segue destination="zUN-WZ-Zgv" kind="relationship" relationship="window.shadowedContentViewController" id="0hy-xW-q29"/>
|
||||
</connections>
|
||||
</windowController>
|
||||
<customObject id="Aae-SU-7xE" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-915" y="609"/>
|
||||
</scene>
|
||||
<!--Preferences View Controller-->
|
||||
<scene sceneID="ioR-N8-zYC">
|
||||
<objects>
|
||||
|
|
|
@ -22,7 +22,9 @@ internal enum StoryboardScene {
|
|||
internal enum Preferences: StoryboardType {
|
||||
internal static let storyboardName = "Preferences"
|
||||
|
||||
internal static let initialScene = InitialSceneType<PreferencesViewController>(storyboard: Preferences.self)
|
||||
internal static let initialScene = InitialSceneType<AppKit.NSWindowController>(storyboard: Preferences.self)
|
||||
|
||||
internal static let preferencesWindowController = SceneType<AppKit.NSWindowController>(storyboard: Preferences.self, identifier: "PreferencesWindowController")
|
||||
}
|
||||
internal enum Purchase: StoryboardType {
|
||||
internal static let storyboardName = "Purchase"
|
||||
|
|
|
@ -31,24 +31,22 @@ class WindowManager: NSObject {
|
|||
|
||||
private var organizer: NSWindowController?
|
||||
|
||||
// private var preferences: NSWindowController?
|
||||
private var preferences: NSWindowController?
|
||||
|
||||
private override init() {
|
||||
}
|
||||
|
||||
@discardableResult func showOrganizer() -> NSWindowController? {
|
||||
organizer = presentWindowController(StoryboardScene.Main.organizerWindowController, existing: organizer)
|
||||
organizer?.window?.title = "Passepartout"
|
||||
return organizer
|
||||
}
|
||||
|
||||
// @discardableResult func showPreferences() -> NSWindowController? {
|
||||
// preferences = presentWindowController(
|
||||
// StoryboardScene.Preferences.initialScene.instantiate(),
|
||||
// existing: preferences,
|
||||
// title: L10n.App.Preferences.title
|
||||
// )
|
||||
// return preferences
|
||||
// }
|
||||
@discardableResult func showPreferences() -> NSWindowController? {
|
||||
preferences = presentWindowController(StoryboardScene.Preferences.preferencesWindowController, existing: preferences)
|
||||
preferences?.window?.title = L10n.App.Preferences.title
|
||||
return preferences
|
||||
}
|
||||
|
||||
func showAbout() {
|
||||
NSApp.orderFrontStandardAboutPanel(nil)
|
||||
|
|
|
@ -27,8 +27,6 @@ import Cocoa
|
|||
|
||||
class MainMenu: NSObject {
|
||||
@IBAction private func showPreferences(_ sender: Any?) {
|
||||
let organizer = WindowManager.shared.showOrganizer()
|
||||
let preferences = StoryboardScene.Preferences.initialScene.instantiate()
|
||||
organizer?.contentViewController?.presentAsModalWindow(preferences)
|
||||
WindowManager.shared.showPreferences()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -395,9 +395,7 @@ class StatusMenu: NSObject {
|
|||
}
|
||||
|
||||
@objc private func showPreferences() {
|
||||
let organizer = WindowManager.shared.showOrganizer()
|
||||
let preferences = StoryboardScene.Preferences.initialScene.instantiate()
|
||||
organizer?.contentViewController?.presentAsModalWindow(preferences)
|
||||
WindowManager.shared.showPreferences()
|
||||
}
|
||||
|
||||
@objc private func switchActiveProfile(_ sender: Any?) {
|
||||
|
|
|
@ -32,7 +32,6 @@ class PreferencesViewController: NSViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
title = L10n.App.Preferences.title
|
||||
let labels = [
|
||||
L10n.App.Preferences.Sections.General.header,
|
||||
L10n.Core.Service.Sections.Diagnostics.header
|
||||
|
|
Loading…
Reference in New Issue