feat(macos): added last known location (#6610)

* feat(macos): added last known location

* fix data file label and reveal data button positions

* code review: code style

---------

Co-authored-by: BogdanArdelean <bogdan.ardelean@ymail.com>
This commit is contained in:
Cœur
2024-04-01 16:53:48 +02:00
committed by GitHub
parent fb79a2d399
commit cdbc8574a7
4 changed files with 89 additions and 33 deletions

View File

@@ -16,6 +16,8 @@
@property(nonatomic) IBOutlet NSTextField* fHashField;
@property(nonatomic) IBOutlet NSTextField* fSecureField;
@property(nonatomic) IBOutlet NSTextField* fDataLocationField;
@property(nonatomic) IBOutlet NSTextField* fLastDataLocationField;
@property(nonatomic) IBOutlet NSTextField* fLastDataLabel;
@property(nonatomic) IBOutlet NSTextField* fCreatorField;
@property(nonatomic) IBOutlet NSTextField* fDateCreatedField;
@@ -60,10 +62,17 @@
Torrent* torrent = self.fTorrents[0];
NSString* location = torrent.dataLocation;
NSString* lastKnownDataLocation = torrent.lastKnownDataLocation;
self.fDataLocationField.stringValue = location ? location.stringByAbbreviatingWithTildeInPath : @"";
self.fDataLocationField.toolTip = location ? location : @"";
self.fRevealDataButton.hidden = !location;
self.fLastDataLabel.hidden = location ? YES : NO;
self.fLastDataLocationField.hidden = location ? YES : NO;
self.fLastDataLocationField.stringValue = location ? @"" : lastKnownDataLocation.stringByAbbreviatingWithTildeInPath;
self.fLastDataLocationField.toolTip = location ? @"" : lastKnownDataLocation;
self.fRevealDataButton.hidden = location ? NO : YES;
}
- (void)revealDataFile:(id)sender
@@ -83,6 +92,9 @@
- (void)setupInfo
{
self.fLastDataLabel.hidden = YES;
self.fLastDataLocationField.hidden = YES;
if (self.fTorrents.count == 1)
{
Torrent* torrent = self.fTorrents[0];