Implemented censored names preference
Added case sensitivity preference Integer tags are not clearable anymore
This commit is contained in:
committed by
Kim Wittenburg
parent
e2bdcd21e5
commit
257a7811d6
@@ -8,6 +8,15 @@
|
||||
|
||||
import Cocoa
|
||||
|
||||
/// Internal class to be used in IB to bind to the shared preferences.
|
||||
@objc internal class PreferencesSingleton: NSObject {
|
||||
|
||||
internal dynamic var sharedPreferences: Preferences {
|
||||
return Preferences.sharedPreferences
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// A custom interface for the `NSUserDefaults`. It is recommended to use this
|
||||
/// class insted of accessing the user defaults directly to prevent errors due
|
||||
/// to misspelled strings.
|
||||
@@ -17,7 +26,7 @@ import Cocoa
|
||||
|
||||
// MARK: Types
|
||||
|
||||
private struct UserDefaultsConstants {
|
||||
internal struct UserDefaultsConstants {
|
||||
|
||||
static let saveArtworkKey = "Save Artwork"
|
||||
|
||||
@@ -29,6 +38,8 @@ import Cocoa
|
||||
|
||||
static let useCensoredNamesKey = "Use Censored Names"
|
||||
|
||||
static let caseSensitive = "Case Sensitive"
|
||||
|
||||
static let tagSavingBehaviorsKey = "Tag Saving Behaviors"
|
||||
}
|
||||
|
||||
@@ -58,7 +69,8 @@ import Cocoa
|
||||
UserDefaultsConstants.saveArtworkKey: false,
|
||||
UserDefaultsConstants.keepSearchResultsKey: false,
|
||||
UserDefaultsConstants.removeSavedAlbumsKey: false,
|
||||
UserDefaultsConstants.useCensoredNamesKey: false
|
||||
UserDefaultsConstants.useCensoredNamesKey: false,
|
||||
UserDefaultsConstants.caseSensitive: true
|
||||
])
|
||||
if NSUserDefaults.standardUserDefaults().dictionaryForKey(UserDefaultsConstants.tagSavingBehaviorsKey) == nil {
|
||||
var savingBehaviors: [Track.Tag: TagSavingBehavior] = [:]
|
||||
@@ -122,6 +134,16 @@ import Cocoa
|
||||
}
|
||||
}
|
||||
|
||||
/// If `true` TagTunes ignores cases when comparing track titles and albums.
|
||||
public dynamic var caseSensitive: Bool {
|
||||
set {
|
||||
NSUserDefaults.standardUserDefaults().setBool(newValue, forKey: UserDefaultsConstants.caseSensitive)
|
||||
}
|
||||
get {
|
||||
return NSUserDefaults.standardUserDefaults().boolForKey(UserDefaultsConstants.caseSensitive)
|
||||
}
|
||||
}
|
||||
|
||||
/// The ways different tags are saved (or not saved).
|
||||
public var tagSavingBehaviors: [Track.Tag: TagSavingBehavior] {
|
||||
set {
|
||||
|
||||
Reference in New Issue
Block a user