Commit 58a23fb8 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: store counting mode of the time field (default is to count up)

Fixes #3078
parent df7cc617
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
BOOL b_dark_interface; BOOL b_dark_interface;
BOOL b_video_playback_enabled; BOOL b_video_playback_enabled;
BOOL b_time_remaining;
int i_lastShownVolume; int i_lastShownVolume;
BOOL b_mute; BOOL b_mute;
input_state_e cachedInputState; input_state_e cachedInputState;
...@@ -94,7 +93,6 @@ ...@@ -94,7 +93,6 @@
- (IBAction)repeat:(id)sender; - (IBAction)repeat:(id)sender;
- (IBAction)shuffle:(id)sender; - (IBAction)shuffle:(id)sender;
- (IBAction)timeSliderAction:(id)sender; - (IBAction)timeSliderAction:(id)sender;
- (IBAction)timeFieldWasClicked:(id)sender;
- (IBAction)volumeAction:(id)sender; - (IBAction)volumeAction:(id)sender;
- (IBAction)effects:(id)sender; - (IBAction)effects:(id)sender;
- (IBAction)fullscreen:(id)sender; - (IBAction)fullscreen:(id)sender;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#import "CoreInteraction.h" #import "CoreInteraction.h"
#import "AudioEffects.h" #import "AudioEffects.h"
#import "MainMenu.h" #import "MainMenu.h"
#import "misc.h"
#import "controls.h" // TODO: remove me #import "controls.h" // TODO: remove me
#import <vlc_playlist.h> #import <vlc_playlist.h>
#import <vlc_aout_intf.h> #import <vlc_aout_intf.h>
...@@ -415,7 +416,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -415,7 +416,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
var_Get( p_input, "time", &time ); var_Get( p_input, "time", &time );
mtime_t dur = input_item_GetDuration( input_GetItem( p_input ) ); mtime_t dur = input_item_GetDuration( input_GetItem( p_input ) );
if( b_time_remaining && dur != -1 ) if( [o_time_fld timeRemaining] && dur != -1 )
{ {
o_time = [NSString stringWithFormat: @"-%s", secstotimestr( psz_time, ((dur - time.i_time) / 1000000) )]; o_time = [NSString stringWithFormat: @"-%s", secstotimestr( psz_time, ((dur - time.i_time) / 1000000) )];
} }
...@@ -429,12 +430,6 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -429,12 +430,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self drawFancyGradientEffectForTimeSlider]; [self drawFancyGradientEffectForTimeSlider];
} }
- (IBAction)timeFieldWasClicked:(id)sender
{
b_time_remaining = !b_time_remaining;
NSLog( @"b_time_remaining %i", b_time_remaining );
}
- (IBAction)volumeAction:(id)sender - (IBAction)volumeAction:(id)sender
{ {
if (sender == o_volume_sld) if (sender == o_volume_sld)
...@@ -477,7 +472,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -477,7 +472,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
var_Get( p_input, "time", &time ); var_Get( p_input, "time", &time );
mtime_t dur = input_item_GetDuration( input_GetItem( p_input ) ); mtime_t dur = input_item_GetDuration( input_GetItem( p_input ) );
if( b_time_remaining && dur != -1 ) if( [o_time_fld timeRemaining] && dur != -1 )
{ {
o_time = [NSString stringWithFormat: @"-%s", secstotimestr( psz_time, ((dur - time.i_time) / 1000000))]; o_time = [NSString stringWithFormat: @"-%s", secstotimestr( psz_time, ((dur - time.i_time) / 1000000))];
} }
...@@ -485,6 +480,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -485,6 +480,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
o_time = [NSString stringWithUTF8String: secstotimestr( psz_time, (time.i_time / 1000000) )]; o_time = [NSString stringWithUTF8String: secstotimestr( psz_time, (time.i_time / 1000000) )];
[o_time_fld setStringValue: o_time]; [o_time_fld setStringValue: o_time];
[o_time_fld setNeedsDisplay:YES];
// [[[[VLCMain sharedInstance] controls] fspanel] setStreamPos: f_updated andTime: o_time]; // [[[[VLCMain sharedInstance] controls] fspanel] setStreamPos: f_updated andTime: o_time];
} }
else else
......
...@@ -146,4 +146,5 @@ ...@@ -146,4 +146,5 @@
@interface VLCTimeField : NSTextField @interface VLCTimeField : NSTextField
{ {
} }
- (BOOL)timeRemaining;
@end @end
...@@ -658,11 +658,28 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -658,11 +658,28 @@ void _drawFrameInRect(NSRect frameRect)
*****************************************************************************/ *****************************************************************************/
@implementation VLCTimeField @implementation VLCTimeField
+ (void)initialize{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"DisplayTimeAsTimeRemaining"];
[defaults registerDefaults:appDefaults];
}
- (void)mouseDown: (NSEvent *)ourEvent - (void)mouseDown: (NSEvent *)ourEvent
{ {
if( [ourEvent clickCount] > 1 ) if( [ourEvent clickCount] > 1 )
[[[VLCMain sharedInstance] controls] goToSpecificTime: nil]; [[[VLCMain sharedInstance] controls] goToSpecificTime: nil];
else else
[[VLCMainWindow sharedInstance] timeFieldWasClicked: self]; {
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayTimeAsTimeRemaining"])
[[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"DisplayTimeAsTimeRemaining"];
else
[[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"DisplayTimeAsTimeRemaining"];
}
}
- (BOOL)timeRemaining
{
return [[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayTimeAsTimeRemaining"];
} }
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment