Added Option to automatically remove saved items.
This commit is contained in:
committed by
Kim Wittenburg
parent
8d4fba8d8a
commit
e0261f7353
@@ -20,4 +20,5 @@ Version 1.2
|
||||
|
||||
Added:
|
||||
+ Option for displayed number of search results
|
||||
+ Option to change the iTunes Store used to get tags
|
||||
+ Option to change the iTunes Store used to get tags
|
||||
+ Option to remove saved items
|
||||
@@ -760,11 +760,11 @@ CA
|
||||
<objects>
|
||||
<viewController title="General" id="tzd-4a-CRb" customClass="GeneralPreferencesViewController" customModule="TagTunes" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" id="pOc-Vr-IET" customClass="PreferenceView" customModule="AppKitPlus">
|
||||
<rect key="frame" x="0.0" y="0.0" width="450" height="315"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="450" height="407"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="kl3-n8-T9b">
|
||||
<rect key="frame" x="18" y="279" width="188" height="18"/>
|
||||
<rect key="frame" x="18" y="371" width="188" height="18"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="check" title="Automatically Save Artwork" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="q2l-4t-mL0">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -776,7 +776,7 @@ CA
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1fj-p7-sMs">
|
||||
<rect key="frame" x="339" y="245" width="97" height="32"/>
|
||||
<rect key="frame" x="339" y="337" width="97" height="32"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Choose…" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="A5S-ps-EYW">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
@@ -787,7 +787,7 @@ CA
|
||||
</connections>
|
||||
</button>
|
||||
<pathControl horizontalHuggingPriority="249" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pT8-NA-x3W">
|
||||
<rect key="frame" x="20" y="251" width="317" height="22"/>
|
||||
<rect key="frame" x="20" y="343" width="317" height="22"/>
|
||||
<animations/>
|
||||
<pathCell key="cell" selectable="YES" alignment="left" id="Sgq-Mk-WnH">
|
||||
<font key="font" metaFont="system"/>
|
||||
@@ -802,7 +802,7 @@ CA
|
||||
</connections>
|
||||
</pathControl>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="iE4-HP-hS8">
|
||||
<rect key="frame" x="18" y="227" width="160" height="18"/>
|
||||
<rect key="frame" x="18" y="319" width="160" height="18"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="check" title="Overwrite existing files" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="WQN-Bj-me1">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -813,7 +813,7 @@ CA
|
||||
</connections>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="MSr-08-ucR">
|
||||
<rect key="frame" x="18" y="207" width="147" height="18"/>
|
||||
<rect key="frame" x="18" y="299" width="147" height="18"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="check" title="Keep Search Results" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="uED-ee-Oc7">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -824,7 +824,7 @@ CA
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QNf-Uy-bMT">
|
||||
<rect key="frame" x="30" y="187" width="338" height="14"/>
|
||||
<rect key="frame" x="30" y="279" width="338" height="14"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" title="If checked the search results are not hidden if a result is added." id="Lnf-PQ-PX4">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
@@ -833,7 +833,7 @@ CA
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="HT2-V6-Vrs">
|
||||
<rect key="frame" x="18" y="68" width="184" height="18"/>
|
||||
<rect key="frame" x="18" y="160" width="184" height="18"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="check" title="Use low resolution artwork" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="pp5-kZ-w5f">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -844,7 +844,7 @@ CA
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ODz-LZ-Acs">
|
||||
<rect key="frame" x="30" y="20" width="402" height="42"/>
|
||||
<rect key="frame" x="30" y="112" width="402" height="42"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="NMm-Jw-bon">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
@@ -854,7 +854,7 @@ CA
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dA4-F6-y0G">
|
||||
<rect key="frame" x="227" y="154" width="19" height="27"/>
|
||||
<rect key="frame" x="227" y="246" width="19" height="27"/>
|
||||
<animations/>
|
||||
<stepperCell key="cell" continuous="YES" alignment="left" minValue="1" maxValue="200" doubleValue="1" id="qF2-IP-GuD"/>
|
||||
<connections>
|
||||
@@ -862,7 +862,7 @@ CA
|
||||
</connections>
|
||||
</stepper>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tZ6-50-jBC">
|
||||
<rect key="frame" x="18" y="160" width="98" height="17"/>
|
||||
<rect key="frame" x="18" y="252" width="98" height="17"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Search Results:" id="aTC-x8-iNw">
|
||||
<font key="font" metaFont="system"/>
|
||||
@@ -871,7 +871,7 @@ CA
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Fxp-Bf-M0J">
|
||||
<rect key="frame" x="122" y="157" width="100" height="22"/>
|
||||
<rect key="frame" x="122" y="249" width="100" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="100" id="Slg-G8-db4"/>
|
||||
</constraints>
|
||||
@@ -890,7 +890,7 @@ CA
|
||||
</connections>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QpH-uA-EUO">
|
||||
<rect key="frame" x="18" y="131" width="84" height="17"/>
|
||||
<rect key="frame" x="18" y="223" width="84" height="17"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="iTunes Store:" id="M6p-MI-JS7">
|
||||
<font key="font" metaFont="system"/>
|
||||
@@ -899,7 +899,7 @@ CA
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="k1x-7X-WP5">
|
||||
<rect key="frame" x="106" y="125" width="105" height="26"/>
|
||||
<rect key="frame" x="106" y="217" width="105" height="26"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="FjM-26-Vzy"/>
|
||||
</constraints>
|
||||
@@ -921,7 +921,7 @@ CA
|
||||
</connections>
|
||||
</popUpButton>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gzG-qy-YYr">
|
||||
<rect key="frame" x="30" y="92" width="402" height="28"/>
|
||||
<rect key="frame" x="30" y="184" width="402" height="28"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="xMj-9f-8N6">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
@@ -930,6 +930,38 @@ CA
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="R6h-LJ-31t">
|
||||
<rect key="frame" x="18" y="88" width="146" height="18"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="check" title="Remove saved items" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="heo-fa-eoL">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="aSx-iH-PLA" name="value" keyPath="sharedPreferences.removeSavedItems" id="4jF-Yd-im9"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="3Fb-Bt-hfa">
|
||||
<rect key="frame" x="30" y="68" width="190" height="18"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="check" title="Don't remove saved albums" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="yih-Me-SPj">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="aSx-iH-PLA" name="value" keyPath="sharedPreferences.keepSavedAlbums" id="F8U-8C-mw6"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DN6-b7-q61">
|
||||
<rect key="frame" x="30" y="20" width="402" height="42"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="xtk-Fn-FCa">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<string key="title">If selected all tracks, previously added from iTunes, are removed from the list, when they are saved. If you only want tracks to be removed, you can set albums to not be removed.</string>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="ODz-LZ-Acs" firstAttribute="leading" secondItem="HT2-V6-Vrs" secondAttribute="leading" constant="12" id="43G-D5-Hml"/>
|
||||
@@ -941,6 +973,8 @@ CA
|
||||
<constraint firstItem="1fj-p7-sMs" firstAttribute="leading" secondItem="pT8-NA-x3W" secondAttribute="trailing" constant="8" symbolic="YES" id="EBN-ov-eyz"/>
|
||||
<constraint firstItem="gzG-qy-YYr" firstAttribute="top" secondItem="k1x-7X-WP5" secondAttribute="bottom" constant="8" symbolic="YES" id="Hxs-tl-t1n"/>
|
||||
<constraint firstItem="MSr-08-ucR" firstAttribute="top" secondItem="iE4-HP-hS8" secondAttribute="bottom" constant="6" symbolic="YES" id="JSO-qU-fYO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="DN6-b7-q61" secondAttribute="trailing" constant="20" symbolic="YES" id="Lxq-Xg-woJ"/>
|
||||
<constraint firstItem="R6h-LJ-31t" firstAttribute="top" secondItem="ODz-LZ-Acs" secondAttribute="bottom" constant="8" symbolic="YES" id="MMS-bf-INe"/>
|
||||
<constraint firstItem="k1x-7X-WP5" firstAttribute="baseline" secondItem="QpH-uA-EUO" secondAttribute="baseline" id="RFw-e1-Vzx"/>
|
||||
<constraint firstItem="pT8-NA-x3W" firstAttribute="leading" secondItem="kl3-n8-T9b" secondAttribute="leading" id="RTj-aH-O8R"/>
|
||||
<constraint firstItem="HT2-V6-Vrs" firstAttribute="leading" secondItem="kl3-n8-T9b" secondAttribute="leading" id="S3T-h3-Fog"/>
|
||||
@@ -949,6 +983,10 @@ CA
|
||||
<constraint firstItem="Fxp-Bf-M0J" firstAttribute="top" secondItem="QNf-Uy-bMT" secondAttribute="bottom" constant="8" symbolic="YES" id="UB0-QM-dXg"/>
|
||||
<constraint firstItem="QNf-Uy-bMT" firstAttribute="top" secondItem="MSr-08-ucR" secondAttribute="bottom" constant="8" symbolic="YES" id="VWX-7I-Z3L"/>
|
||||
<constraint firstItem="Fxp-Bf-M0J" firstAttribute="baseline" secondItem="tZ6-50-jBC" secondAttribute="baseline" id="VXj-Af-rHF"/>
|
||||
<constraint firstItem="3Fb-Bt-hfa" firstAttribute="leading" secondItem="R6h-LJ-31t" secondAttribute="leading" constant="12" id="WiK-JE-DIe"/>
|
||||
<constraint firstItem="3Fb-Bt-hfa" firstAttribute="top" secondItem="R6h-LJ-31t" secondAttribute="bottom" constant="6" symbolic="YES" id="YhC-fK-uD4"/>
|
||||
<constraint firstItem="R6h-LJ-31t" firstAttribute="leading" secondItem="kl3-n8-T9b" secondAttribute="leading" id="a4y-1P-siP"/>
|
||||
<constraint firstItem="DN6-b7-q61" firstAttribute="top" secondItem="3Fb-Bt-hfa" secondAttribute="bottom" constant="8" symbolic="YES" id="aPu-pP-7Df"/>
|
||||
<constraint firstItem="Fxp-Bf-M0J" firstAttribute="leading" secondItem="tZ6-50-jBC" secondAttribute="trailing" constant="8" symbolic="YES" id="btn-6X-YVa"/>
|
||||
<constraint firstAttribute="trailing" secondItem="1fj-p7-sMs" secondAttribute="trailing" constant="20" symbolic="YES" id="ePv-QH-p9T"/>
|
||||
<constraint firstItem="gzG-qy-YYr" firstAttribute="leading" secondItem="QpH-uA-EUO" secondAttribute="leading" constant="12" id="f6O-eW-sug"/>
|
||||
@@ -958,6 +996,7 @@ CA
|
||||
<constraint firstItem="iE4-HP-hS8" firstAttribute="leading" secondItem="kl3-n8-T9b" secondAttribute="leading" id="mFQ-g8-Z2O"/>
|
||||
<constraint firstItem="k1x-7X-WP5" firstAttribute="leading" secondItem="QpH-uA-EUO" secondAttribute="trailing" constant="8" symbolic="YES" id="mV0-kX-iRw"/>
|
||||
<constraint firstItem="kl3-n8-T9b" firstAttribute="top" secondItem="pOc-Vr-IET" secondAttribute="top" constant="20" symbolic="YES" id="mW3-jS-00k"/>
|
||||
<constraint firstItem="DN6-b7-q61" firstAttribute="leading" secondItem="3Fb-Bt-hfa" secondAttribute="leading" id="mcF-ga-CeX"/>
|
||||
<constraint firstItem="ODz-LZ-Acs" firstAttribute="top" secondItem="HT2-V6-Vrs" secondAttribute="bottom" constant="8" symbolic="YES" id="nwg-Wk-kB9"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gzG-qy-YYr" secondAttribute="trailing" constant="20" symbolic="YES" id="olE-ik-03R"/>
|
||||
<constraint firstItem="MSr-08-ucR" firstAttribute="leading" secondItem="kl3-n8-T9b" secondAttribute="leading" id="pIO-CH-97G"/>
|
||||
@@ -969,7 +1008,7 @@ CA
|
||||
<real key="value" value="450"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="height">
|
||||
<real key="value" value="315"/>
|
||||
<real key="value" value="407"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
@@ -981,7 +1020,7 @@ CA
|
||||
<customObject id="RtZ-4O-Pgk" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
<customObject id="aSx-iH-PLA" userLabel="Preferences" customClass="PreferencesSingleton" customModule="TagTunes" customModuleProvider="target"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-1031" y="1144.5"/>
|
||||
<point key="canvasLocation" x="-1031" y="1190.5"/>
|
||||
</scene>
|
||||
<!--Tags-->
|
||||
<scene sceneID="oNy-iK-NsG">
|
||||
|
||||
@@ -350,6 +350,28 @@ internal class MainViewController: NSViewController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_sync(dispatch_get_main_queue()) {
|
||||
if Preferences.sharedPreferences.removeSavedItems {
|
||||
for item in items {
|
||||
if let album = item as? Album {
|
||||
for track in album.tracks {
|
||||
track.associatedTracks.removeAll()
|
||||
}
|
||||
if !Preferences.sharedPreferences.keepSavedAlbums {
|
||||
self.albumCollection.removeAlbum(album)
|
||||
}
|
||||
} else if let track = item as? Track {
|
||||
track.associatedTracks.removeAll()
|
||||
} else if let track = item as? iTunesTrack {
|
||||
if let parentTrack = self.parentForTrack(track) {
|
||||
parentTrack.associatedTracks.removeElement(track)
|
||||
}
|
||||
}
|
||||
}
|
||||
self.outlineView.reloadData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func numberOfTracksInItems(items: [AnyObject]) -> Int {
|
||||
|
||||
@@ -40,10 +40,12 @@ import Cocoa
|
||||
|
||||
static let iTunesStoreKey = "iTunes Store"
|
||||
|
||||
static let removeSavedAlbumsKey = "Remove Saved Albums"
|
||||
|
||||
static let useLowResolutionArtworkKey = "Use Low Resolution Artwork"
|
||||
|
||||
static let removeSavedItemsKey = "Remove Saved Items"
|
||||
|
||||
static let keepSavedAlbumsKey = "Keep Saved Albums"
|
||||
|
||||
static let useCensoredNamesKey = "Use Censored Names"
|
||||
|
||||
static let caseSensitiveKey = "Case Sensitive"
|
||||
@@ -82,8 +84,9 @@ import Cocoa
|
||||
UserDefaultsConstants.keepSearchResultsKey: false,
|
||||
UserDefaultsConstants.numberOfSearchResultsKey: 10,
|
||||
UserDefaultsConstants.iTunesStoreKey: NSLocale.currentLocale().objectForKey(NSLocaleCountryCode)!,
|
||||
UserDefaultsConstants.removeSavedAlbumsKey: false,
|
||||
UserDefaultsConstants.useLowResolutionArtworkKey: false,
|
||||
UserDefaultsConstants.removeSavedItemsKey: false,
|
||||
UserDefaultsConstants.keepSavedAlbumsKey: false,
|
||||
UserDefaultsConstants.useCensoredNamesKey: false,
|
||||
UserDefaultsConstants.caseSensitiveKey: true,
|
||||
UserDefaultsConstants.clearArtworksKey: false
|
||||
@@ -176,6 +179,27 @@ import Cocoa
|
||||
}
|
||||
}
|
||||
|
||||
/// If `true` all saved items are removed from the list after saving.
|
||||
public dynamic var removeSavedItems: Bool {
|
||||
set {
|
||||
NSUserDefaults.standardUserDefaults().setBool(newValue, forKey: UserDefaultsConstants.removeSavedItemsKey)
|
||||
}
|
||||
get {
|
||||
return NSUserDefaults.standardUserDefaults().boolForKey(UserDefaultsConstants.removeSavedItemsKey)
|
||||
}
|
||||
}
|
||||
|
||||
/// If `true` and `removeSavedItems` is also `true` albums are not removed on
|
||||
/// saving.
|
||||
public dynamic var keepSavedAlbums: Bool {
|
||||
set {
|
||||
NSUserDefaults.standardUserDefaults().setBool(newValue, forKey: UserDefaultsConstants.keepSavedAlbumsKey)
|
||||
}
|
||||
get {
|
||||
return NSUserDefaults.standardUserDefaults().boolForKey(UserDefaultsConstants.keepSavedAlbumsKey)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Tag Preferences
|
||||
|
||||
/// If `true` TagTunes displays and saves censored names instead of the
|
||||
|
||||
Reference in New Issue
Block a user