[Clipboard] Add textual data to clipboard on copy
The copy action now includes formatted text of the selected entries when copying, in addition to the supported file and URL types. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
4c95c943ef
commit
72c4dddf18
|
@ -20,6 +20,7 @@
|
||||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingStatus;
|
+ (NSSet *_Nonnull)keyPathsForValuesAffectingStatus;
|
||||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingStatusMessage;
|
+ (NSSet *_Nonnull)keyPathsForValuesAffectingStatusMessage;
|
||||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingSpam;
|
+ (NSSet *_Nonnull)keyPathsForValuesAffectingSpam;
|
||||||
|
+ (NSSet *_Nonnull)keyPathsForValuesAffectingIndexedSpam;
|
||||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingAlbumArt;
|
+ (NSSet *_Nonnull)keyPathsForValuesAffectingAlbumArt;
|
||||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingTrackText;
|
+ (NSSet *_Nonnull)keyPathsForValuesAffectingTrackText;
|
||||||
+ (NSSet *_Nonnull)keyPathsForValuesAffectingLengthText;
|
+ (NSSet *_Nonnull)keyPathsForValuesAffectingLengthText;
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
@property(nonatomic, readonly) NSString *_Nonnull filename;
|
@property(nonatomic, readonly) NSString *_Nonnull filename;
|
||||||
|
|
||||||
@property(nonatomic, readonly) NSString *_Nonnull spam;
|
@property(nonatomic, readonly) NSString *_Nonnull spam;
|
||||||
|
@property(nonatomic, readonly) NSString *_Nonnull indexedSpam;
|
||||||
|
|
||||||
@property(nonatomic, readonly) NSString *_Nonnull positionText;
|
@property(nonatomic, readonly) NSString *_Nonnull positionText;
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,10 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
|
||||||
return [NSSet setWithObjects:@"albumartist", @"artist", @"rawTitle", @"album", @"track", @"disc", @"totalFrames", @"currentPosition", @"bitrate", nil];
|
return [NSSet setWithObjects:@"albumartist", @"artist", @"rawTitle", @"album", @"track", @"disc", @"totalFrames", @"currentPosition", @"bitrate", nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (NSSet *)keyPathsForValuesAffectingIndexedSpam {
|
||||||
|
return [NSSet setWithObjects:@"albumartist", @"artist", @"rawTitle", @"album", @"track", @"disc", @"totalFrames", @"currentPosition", @"bitrate", @"index", nil];
|
||||||
|
}
|
||||||
|
|
||||||
+ (NSSet *)keyPathsForValuesAffectingTrackText {
|
+ (NSSet *)keyPathsForValuesAffectingTrackText {
|
||||||
return [NSSet setWithObjects:@"track", @"disc", nil];
|
return [NSSet setWithObjects:@"track", @"disc", nil];
|
||||||
}
|
}
|
||||||
|
@ -121,6 +125,11 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@dynamic indexedSpam;
|
||||||
|
- (NSString *)indexedSpam {
|
||||||
|
return [NSString stringWithFormat:@"%llu. %@", self.index, self.spam];
|
||||||
|
}
|
||||||
|
|
||||||
@dynamic spam;
|
@dynamic spam;
|
||||||
- (NSString *)spam {
|
- (NSString *)spam {
|
||||||
BOOL hasBitrate = (self.bitrate != 0);
|
BOOL hasBitrate = (self.bitrate != 0);
|
||||||
|
|
|
@ -220,10 +220,15 @@
|
||||||
NSUInteger capacity = [entries count];
|
NSUInteger capacity = [entries count];
|
||||||
NSMutableArray *selectedURLs = [NSMutableArray arrayWithCapacity:capacity];
|
NSMutableArray *selectedURLs = [NSMutableArray arrayWithCapacity:capacity];
|
||||||
|
|
||||||
|
NSMutableArray *fileSpams = [NSMutableArray array];
|
||||||
|
|
||||||
for(PlaylistEntry *pe in entries) {
|
for(PlaylistEntry *pe in entries) {
|
||||||
[selectedURLs addObject:pe.url];
|
[selectedURLs addObject:pe.url];
|
||||||
|
[fileSpams addObject:pe.indexedSpam];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[pboard writeObjects:@[[fileSpams componentsJoinedByString:@"\n"]]];
|
||||||
|
|
||||||
NSError *error;
|
NSError *error;
|
||||||
NSData *data;
|
NSData *data;
|
||||||
if(@available(macOS 10.13, *)) {
|
if(@available(macOS 10.13, *)) {
|
||||||
|
|
Loading…
Reference in New Issue