Skip to content

Commit dfef541

Browse files
committed
Work on setting panels
1 parent 23d34a7 commit dfef541

File tree

4 files changed

+1533
-1361
lines changed

4 files changed

+1533
-1361
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
// -----------------------------------------------------------------------------
2+
// This file is part of vAmiga
3+
//
4+
// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
5+
// Licensed under the GNU General Public License v3
6+
//
7+
// See https://www.gnu.org for license information
8+
// -----------------------------------------------------------------------------
9+
10+
class CapturesSettingsViewController: SettingsViewController {
11+
12+
// Snapshots
13+
@IBOutlet weak var snapshotCompressor: NSPopUpButton!
14+
@IBOutlet weak var autoSnapshots: NSButton!
15+
@IBOutlet weak var snapshotInterval: NSTextField!
16+
@IBOutlet weak var snapshotStorage: NSTextField!
17+
18+
// Screenshots
19+
@IBOutlet weak var screenshotFormatPopup: NSPopUpButton!
20+
@IBOutlet weak var screenshotSourcePopup: NSPopUpButton!
21+
@IBOutlet weak var screenshotCutoutPopup: NSPopUpButton!
22+
@IBOutlet weak var screenshotCutoutText: NSTextField!
23+
@IBOutlet weak var screenshotWidth: NSTextField!
24+
@IBOutlet weak var screenshotWidthText: NSTextField!
25+
@IBOutlet weak var screenshotHeight: NSTextField!
26+
@IBOutlet weak var screenshotHeightText: NSTextField!
27+
28+
override func viewDidLoad() {
29+
30+
print("CapturesSettingsViewController::viewDidLoad")
31+
}
32+
33+
//
34+
// Refresh
35+
//
36+
37+
override func refresh() {
38+
39+
/*
40+
// Snapshots
41+
snapshotStorage.integerValue = pref.snapshotStorage
42+
autoSnapshots.state = pref.autoSnapshots ? .on : .off
43+
snapshotInterval.integerValue = pref.snapshotInterval
44+
snapshotInterval.isEnabled = pref.autoSnapshots
45+
46+
// Fullscreen
47+
aspectRatioButton.state = pref.keepAspectRatio ? .on : .off
48+
exitOnEscButton.state = pref.exitOnEsc ? .on : .off
49+
50+
// Miscellaneous
51+
ejectWithoutAskingButton.state = pref.ejectWithoutAsking ? .on : .off
52+
detachWithoutAskingButton.state = pref.detachWithoutAsking ? .on : .off
53+
closeWithoutAskingButton.state = pref.closeWithoutAsking ? .on : .off
54+
pauseInBackground.state = pref.pauseInBackground ? .on : .off
55+
56+
// Screenshots
57+
let framebuffer = pref.screenshotSource == .framebuffer
58+
let custom = pref.screenshotCutout == .custom
59+
screenshotFormatPopup.selectItem(withTag: pref.screenshotFormatIntValue)
60+
screenshotSourcePopup.selectItem(withTag: pref.screenshotSourceIntValue)
61+
screenshotCutoutPopup.selectItem(withTag: pref.screenshotCutoutIntValue)
62+
screenshotCutoutPopup.isHidden = framebuffer
63+
screenshotCutoutText.isHidden = framebuffer
64+
screenshotWidth.integerValue = pref.screenshotWidth
65+
screenshotWidth.isHidden = !custom || framebuffer
66+
screenshotWidthText.isHidden = !custom || framebuffer
67+
screenshotHeight.integerValue = pref.screenshotHeight
68+
screenshotHeight.isHidden = !custom || framebuffer
69+
screenshotHeightText.isHidden = !custom || framebuffer
70+
*/
71+
}
72+
73+
//
74+
// Action methods
75+
//
76+
77+
@IBAction func snapshotStorageAction(_ sender: NSTextField!) {
78+
79+
if sender.integerValue > 0 {
80+
pref.snapshotStorage = sender.integerValue
81+
}
82+
refresh()
83+
}
84+
85+
@IBAction func autoSnapshotAction(_ sender: NSButton!) {
86+
87+
pref.autoSnapshots = sender.state == .on
88+
refresh()
89+
}
90+
91+
@IBAction func snapshotIntervalAction(_ sender: NSTextField!) {
92+
93+
print("snapshotIntervalAction: \(sender.integerValue)")
94+
if sender.integerValue > 0 {
95+
pref.snapshotInterval = sender.integerValue
96+
}
97+
refresh()
98+
}
99+
100+
@IBAction func screenshotSourceAction(_ sender: NSPopUpButton!) {
101+
102+
pref.screenshotSourceIntValue = sender.selectedTag()
103+
refresh()
104+
}
105+
106+
@IBAction func screenshotFormatAction(_ sender: NSPopUpButton!) {
107+
108+
pref.screenshotFormatIntValue = sender.selectedTag()
109+
refresh()
110+
}
111+
112+
@IBAction func screenshotCutoutAction(_ sender: NSPopUpButton!) {
113+
114+
pref.screenshotCutoutIntValue = sender.selectedTag()
115+
refresh()
116+
}
117+
118+
@IBAction func screenshotWidthAction(_ sender: NSTextField!) {
119+
120+
pref.aspectX = sender.integerValue
121+
refresh()
122+
}
123+
124+
@IBAction func screenshotHeightAction(_ sender: NSTextField!) {
125+
126+
pref.aspectY = sender.integerValue
127+
refresh()
128+
}
129+
130+
@IBAction func retroVisorAction(_ sender: Any!) {
131+
132+
if let url = URL(string: "https://dirkwhoffmann.github.io/RetroVisor/") {
133+
NSWorkspace.shared.open(url)
134+
}
135+
}
136+
137+
override func preset(tag: Int) {
138+
139+
print("preset(tag: \(tag))")
140+
141+
// Revert to standard settings
142+
EmulatorProxy.defaults.removeGeneralUserDefaults()
143+
144+
// Apply the new settings
145+
pref.applyGeneralUserDefaults()
146+
}
147+
148+
override func save() {
149+
150+
pref.saveGeneralUserDefaults()
151+
}
152+
}

GUI/Dialogs/Settings/ViewControllers/GeneralSettings.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
class GeneralSettingsViewController: SettingsViewController {
1111

12-
// Workspaces
13-
@IBOutlet weak var compressWorkspaces: NSButton!
14-
1512
// Fullscreen
1613
@IBOutlet weak var aspectRatioButton: NSButton!
1714
@IBOutlet weak var exitOnEscButton: NSButton!

0 commit comments

Comments
 (0)