Add windowTitle var to Inspector protocol
This commit is contained in:
parent
ef63c18265
commit
c7aa5656d8
|
@ -26,6 +26,7 @@ final class BuiltinSmartFeedInspectorViewController: NSViewController, Inspector
|
||||||
updateSmartFeed()
|
updateSmartFeed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var windowTitle: String = NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title")
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool {
|
func canInspect(_ objects: [Any]) -> Bool {
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ final class FolderInspectorViewController: NSViewController, Inspector {
|
||||||
updateFolder()
|
updateFolder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var windowTitle: String = NSLocalizedString("Folder Inspector", comment: "Folder Inspector window title")
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool {
|
func canInspect(_ objects: [Any]) -> Bool {
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ protocol Inspector: class {
|
||||||
|
|
||||||
var objects: [Any]? { get set }
|
var objects: [Any]? { get set }
|
||||||
var isFallbackInspector: Bool { get } // Can handle nothing-to-inspect or unexpected type of objects.
|
var isFallbackInspector: Bool { get } // Can handle nothing-to-inspect or unexpected type of objects.
|
||||||
|
var windowTitle: String { get }
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool
|
func canInspect(_ objects: [Any]) -> Bool
|
||||||
}
|
}
|
||||||
|
@ -62,6 +63,7 @@ final class InspectorWindowController: NSWindowController {
|
||||||
|
|
||||||
inspectors = [feedInspector, folderInspector, builtinSmartFeedInspector, nothingInspector]
|
inspectors = [feedInspector, folderInspector, builtinSmartFeedInspector, nothingInspector]
|
||||||
currentInspector = nothingInspector
|
currentInspector = nothingInspector
|
||||||
|
window?.title = currentInspector.windowTitle
|
||||||
|
|
||||||
if let savedOrigin = originFromDefaults() {
|
if let savedOrigin = originFromDefaults() {
|
||||||
window?.setFlippedOriginAdjustingForScreen(savedOrigin)
|
window?.setFlippedOriginAdjustingForScreen(savedOrigin)
|
||||||
|
@ -109,30 +111,7 @@ private extension InspectorWindowController {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch inspector {
|
window.title = inspector.windowTitle
|
||||||
case is NothingInspectorViewController:
|
|
||||||
window.title = NSLocalizedString("Inspector", comment: "Inspector window title")
|
|
||||||
case is FolderInspectorViewController:
|
|
||||||
if let folderName = (inspector as? FolderInspectorViewController)?.nameTextField?.stringValue {
|
|
||||||
window.title = folderName
|
|
||||||
} else {
|
|
||||||
window.title = NSLocalizedString("Folder Inspector", comment: "Folder Inspector window title")
|
|
||||||
}
|
|
||||||
case is WebFeedInspectorViewController:
|
|
||||||
if let feedName = (inspector as? WebFeedInspectorViewController)?.nameTextField?.stringValue {
|
|
||||||
window.title = feedName
|
|
||||||
} else {
|
|
||||||
window.title = NSLocalizedString("Feed Inspector", comment: "Feed Inspector window title")
|
|
||||||
}
|
|
||||||
case is BuiltinSmartFeedInspectorViewController:
|
|
||||||
if let smartFeedName = (inspector as? BuiltinSmartFeedInspectorViewController)?.nameTextField?.stringValue {
|
|
||||||
window.title = smartFeedName
|
|
||||||
} else {
|
|
||||||
window.title = NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title")
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
window.title = NSLocalizedString("Inspector", comment: "Inspector window title")
|
|
||||||
}
|
|
||||||
|
|
||||||
let flippedOrigin = window.flippedOrigin
|
let flippedOrigin = window.flippedOrigin
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ final class NothingInspectorViewController: NSViewController, Inspector {
|
||||||
updateTextFields()
|
updateTextFields()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var windowTitle: String = NSLocalizedString("Inspector", comment: "Inspector window title")
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool {
|
func canInspect(_ objects: [Any]) -> Bool {
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ final class WebFeedInspectorViewController: NSViewController, Inspector {
|
||||||
updateFeed()
|
updateFeed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var windowTitle: String = NSLocalizedString("Feed Inspector", comment: "Feed Inspector window title")
|
||||||
|
|
||||||
func canInspect(_ objects: [Any]) -> Bool {
|
func canInspect(_ objects: [Any]) -> Bool {
|
||||||
return objects.count == 1 && objects.first is WebFeed
|
return objects.count == 1 && objects.first is WebFeed
|
||||||
|
|
Loading…
Reference in New Issue