2
2
* playlist.m: MacOS X interface module
3
3
*****************************************************************************
4
4
* Copyright (C) 2002-2014 VLC authors and VideoLAN
5
* $Id: a59298b9c23de6c8487fd6ad928129d3806460c4 $
5
* $Id: 2b652c6d886f71c2068c72f4e45a4f6a01ee218d $
7
7
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8
8
* Derk-Jan Hartman <hartman at videola/n dot org>
1508
- (void)updateAlertWindow:(NSTimer *)timer
1510
NSAlert *alert = [timer userInfo];
1512
--currentResumeTimeout;
1513
if (currentResumeTimeout <= 0) {
1514
[[alert window] close];
1518
NSString *buttonLabel = _NS("Restart playback");
1519
buttonLabel = [buttonLabel stringByAppendingFormat:@" (%d)", currentResumeTimeout];
1521
[[[alert buttons] objectAtIndex:2] setTitle:buttonLabel];
1524
1509
- (void)continuePlaybackWhereYouLeftOff:(input_thread_t *)p_input_thread
1526
1511
NSDictionary *recentlyPlayedFiles = [[NSUserDefaults standardUserDefaults] objectForKey:@"recentlyPlayedMedia"];
1556
1541
if (settingValue == 2) // never resume
1559
NSInteger returnValue = NSAlertErrorReturn;
1560
if (settingValue == 0) { // ask
1562
currentResumeTimeout = 6;
1563
NSString *o_restartButtonLabel = _NS("Restart playback");
1564
o_restartButtonLabel = [o_restartButtonLabel stringByAppendingFormat:@" (%d)", currentResumeTimeout];
1565
NSAlert *theAlert = [NSAlert alertWithMessageText:_NS("Continue playback?") defaultButton:_NS("Continue") alternateButton:o_restartButtonLabel otherButton:_NS("Always continue") informativeTextWithFormat:_NS("Playback of \"%@\" will continue at %@"), [NSString stringWithUTF8String:input_item_GetTitleFbName(p_item)], [[VLCStringUtility sharedInstance] stringForTime:lastPosition.intValue]];
1567
NSTimer *timer = [NSTimer timerWithTimeInterval:1
1569
selector:@selector(updateAlertWindow:)
1573
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSModalPanelRunLoopMode];
1575
returnValue = [theAlert runModal];
1578
// restart button was pressed or timeout happened
1579
if (returnValue == NSAlertAlternateReturn ||
1580
returnValue == NSRunAbortedResponse)
1544
CompletionBlock completionBlock = ^(enum ResumeResult result) {
1546
if (result == RESUME_RESTART)
1549
mtime_t lastPos = (mtime_t)lastPosition.intValue * 1000000;
1550
msg_Dbg(VLCIntf, "continuing playback at %lld", lastPos);
1551
var_SetTime(p_input_thread, "time", lastPos);
1553
if (result == RESUME_ALWAYS)
1554
config_PutInt(VLCIntf, "macosx-continue-playback", 1);
1557
if (settingValue == 1) { // always
1558
completionBlock(RESUME_NOW);
1584
mtime_t lastPos = (mtime_t)lastPosition.intValue * 1000000;
1585
msg_Dbg(VLCIntf, "continuing playback at %lld", lastPos);
1586
var_SetTime(p_input_thread, "time", lastPos);
1588
if (returnValue == NSAlertOtherReturn)
1589
config_PutInt(VLCIntf, "macosx-continue-playback", 1);
1562
[[[VLCMain sharedInstance] resumeDialog] showWindowWithItem:p_item
1563
withLastPosition:lastPosition.intValue
1564
completionBlock:completionBlock];
1592
1567
- (void)storePlaybackPositionForItem:(input_thread_t *)p_input_thread