Add a Save As location preference (#145)
Add a General preferences option controlling where the Save As panel opens: the last used folder (default), the same folder as the imported file, or a custom folder chosen by the user.
This commit is contained in:
1 parent
151530d6ab
commit
c8fb950854
5 files changed
+172
-4
No files matched your search
+27
-1
@@ -70,6 +70,16 @@ struct StoredCodable<T: Codable> : Registable {
|
||||
}
|
||||
}
|
||||
|
||||
/// The folder the Save As… panel opens at.
|
||||
enum SaveAsLocation: Int {
|
||||
/// The last folder used, the standard AppKit behaviour.
|
||||
case lastUsed = 0
|
||||
/// The folder holding the file the tracks were imported from.
|
||||
case sameAsFile = 1
|
||||
/// A folder picked by the user.
|
||||
case custom = 2
|
||||
}
|
||||
|
||||
enum Prefs {
|
||||
|
||||
static func register() {
|
||||
@@ -78,7 +88,7 @@ enum Prefs {
|
||||
_audioBitrate, _audioDRC, _audioConvertAC3, _audioKeepAC3, _audioConvertDts,
|
||||
_audioDtsOptions, _subtitleConvertBitmap, _ratingsCountry, _chaptersPreviewPosition,
|
||||
_chaptersPreviewTrack, _mp464bitOffset, _mp464bitTimes, _mp4SaveAsOptimize, _forceHvc1,
|
||||
_logFormat])
|
||||
_logFormat, _saveAsLocationValue])
|
||||
}
|
||||
|
||||
@Stored(key: "NSApplicationCrashOnException", defaultValue: true)
|
||||
@@ -161,6 +171,22 @@ enum Prefs {
|
||||
|
||||
@Stored(key: "SBLogFormat", defaultValue: 0)
|
||||
static var logFormat: Int // 0 = Time Only, 1 = Date and Time
|
||||
|
||||
@Stored(key: "SBSaveAsLocationMode", defaultValue: 0)
|
||||
private static var saveAsLocationValue: Int
|
||||
|
||||
static var saveAsLocation: SaveAsLocation {
|
||||
get { SaveAsLocation(rawValue: saveAsLocationValue) ?? .lastUsed }
|
||||
set { saveAsLocationValue = newValue.rawValue }
|
||||
}
|
||||
|
||||
private static let saveAsCustomLocationKey = "SBSaveAsCustomLocation"
|
||||
|
||||
/// The folder used when saveAsLocation is set to custom.
|
||||
static var saveAsCustomLocation: URL? {
|
||||
get { ud.url(forKey: saveAsCustomLocationKey) }
|
||||
set { ud.set(newValue, forKey: saveAsCustomLocationKey) }
|
||||
}
|
||||
}
|
||||
|
||||
enum MetadataPrefs {
|
||||
|
||||
Reference in new issue
Block a user