Skip to content

Commit

Permalink
Removed all awakeFromNib() overrides (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Jan 18, 2025
1 parent 57018d9 commit cf5ed2d
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 43 deletions.
1 change: 1 addition & 0 deletions GUI/Dialogs/Captures/ScreenshotDialog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class ScreenshotDialog: DialogController {
override func dialogDidShow() {

super.dialogDidShow()

now = Date()
updateLabels()

Expand Down
4 changes: 0 additions & 4 deletions GUI/Dialogs/Captures/SnapshotDialog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ class SnapshotDialog: DialogController {

// Remembers the auto-snapshot setting
var takeSnapshots = false

override func windowWillLoad() {

}

override func dialogDidShow() {

Expand Down
19 changes: 4 additions & 15 deletions GUI/Dialogs/Configuration/ConfigurationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -344,25 +344,14 @@ class ConfigurationController: DialogController {
firstTab = tab
showAsSheet()
}

override func awakeFromNib() {

debug(.lifetime)

super.awakeFromNib()
awakeVideoPrefsFromNib()
refreshRomSelector()
}

override func windowDidLoad() {

debug(.lifetime)
super.windowDidLoad()
}

override func dialogWillShow() {

super.dialogWillShow()

initVideoTab()
refreshRomSelector()

if firstTab != "" { prefTabView?.selectTabViewItem(withIdentifier: firstTab) }
refresh()
}
Expand Down
7 changes: 5 additions & 2 deletions GUI/Dialogs/Configuration/RomDropView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ class DropView: NSImageView {

var oldImage: NSImage?

override func awakeFromNib() {
override init(frame frameRect: NSRect) { super.init(frame: frameRect); commonInit() }
required init?(coder: NSCoder) { super.init(coder: coder); commonInit() }

func commonInit() {

registerForDraggedTypes([NSPasteboard.PasteboardType.fileURL])
}

func acceptDragSource(url: URL) -> Bool { return false }

override func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation {
Expand Down
2 changes: 1 addition & 1 deletion GUI/Dialogs/Configuration/VideoConf.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

extension ConfigurationController {

func awakeVideoPrefsFromNib() {
func initVideoTab() {

// Check for available enhancers
let enhancers = parent.renderer.ressourceManager.enhancerGallery
Expand Down
11 changes: 6 additions & 5 deletions GUI/Dialogs/Inspector/EventTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@
class EventTableView: NSTableView {

@IBOutlet weak var inspector: Inspector!
var amiga: EmulatorProxy!

var slotInfo = [EventSlotInfo?](repeating: nil, count: EventSlot.COUNT.rawValue)

override func awakeFromNib() {
override init(frame frameRect: NSRect) { super.init(frame: frameRect); commonInit() }
required init?(coder: NSCoder) { super.init(coder: coder); commonInit() }

func commonInit() {

amiga = inspector.emu
delegate = self
dataSource = self
target = self
}

private func cache() {
for row in 0 ..< EventSlot.COUNT.rawValue {
slotInfo[row] = amiga.agnus.cachedSlotInfo(row)
slotInfo[row] = inspector.emu.agnus.cachedSlotInfo(row)
}
}

Expand Down
3 changes: 3 additions & 0 deletions GUI/Dialogs/Inspector/Inspector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,8 @@ class Inspector: DialogController {

override func dialogWillShow() {

super.dialogWillShow()

// Hide the panel selector
panel.tabPosition = .none

Expand All @@ -694,6 +696,7 @@ class Inspector: DialogController {

override func dialogDidShow() {

super.dialogDidShow()
refresh(full: true)
}

Expand Down
9 changes: 3 additions & 6 deletions GUI/Dialogs/Media/DiskExporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,14 @@ class DiskExporter: DialogController {
if vol != nil { addItem("Folder", tag: Format.vol) }
}

override public func awakeFromNib() {
override func dialogWillShow() {

super.awakeFromNib()
super.dialogWillShow()

updatePartitionPopup()
updateFormatPopup()
update()
}

override func windowDidLoad() {

}

func update() {

Expand Down
4 changes: 2 additions & 2 deletions GUI/Dialogs/Media/FloppyCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class FloppyCreator: DialogController {
super.showAsSheet()
}

override public func awakeFromNib() {
override func dialogWillShow() {

super.awakeFromNib()
super.dialogWillShow()

let type = emu.get(.DRIVE_TYPE, drive: nr)
switch FloppyDriveType(rawValue: type) {
Expand Down
4 changes: 2 additions & 2 deletions GUI/Dialogs/Media/HardDiskConfigurator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ class HardDiskConfigurator: DialogController {
super.showAsSheet()
}

override public func awakeFromNib() {
override func dialogWillShow() {

super.awakeFromNib()
super.dialogWillShow()

cylinderStepper.maxValue = .greatestFiniteMagnitude
headStepper.maxValue = .greatestFiniteMagnitude
Expand Down
4 changes: 2 additions & 2 deletions GUI/Dialogs/Media/HardDiskCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ class HardDiskCreator: DialogController {
super.showAsSheet()
}

override public func awakeFromNib() {
override func dialogWillShow() {

super.awakeFromNib()
super.dialogWillShow()

// Configure elements
cylinderStepper.maxValue = .greatestFiniteMagnitude
Expand Down
4 changes: 2 additions & 2 deletions GUI/Dialogs/Media/PartitionSelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class PartitionSelector: DialogController {
super.showAsSheet(completionHandler: completionHandler)
}

override public func awakeFromNib() {
override func dialogWillShow() {

super.awakeFromNib()
super.dialogWillShow()

partitionPopup.removeAllItems()

Expand Down
4 changes: 2 additions & 2 deletions GUI/Dialogs/Preferences/PreferencesController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ class PreferencesController: DialogController {
showAsSheet()
}

override func awakeFromNib() {
override func dialogWillShow() {

super.awakeFromNib()
super.dialogWillShow()

if let id = firstTab { tabView?.selectTabViewItem(withIdentifier: id) }
refresh()
Expand Down

0 comments on commit cf5ed2d

Please sign in to comment.