Commit 4bb5a378 authored by Kevin Chromik's avatar Kevin Chromik Committed by Felix Paul Kühne

Gesture submenu added & ability to choose jump mode

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>

include new menu items in Root.plist
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 32d8351b
......@@ -56,16 +56,6 @@
<integer>3333</integer>
</array>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableGesturesToControlPlayback</string>
<key>Title</key>
<string>SETTINGS_GESTURES</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
......@@ -92,6 +82,32 @@
<real>2</real>
</array>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>SETTINGS_GESTURE_TITLE</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableGesturesToControlPlayback</string>
<key>Title</key>
<string>SETTINGS_GESTURES</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<false/>
<key>Key</key>
<string>EnableVariableJumpDuration</string>
<key>Title</key>
<string>SETTINGS_GESTURE_JUMP_DURATION</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
......
......@@ -46,16 +46,6 @@
<integer>3333</integer>
</array>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableGesturesToControlPlayback</string>
<key>Title</key>
<string>SETTINGS_GESTURES</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
......@@ -82,6 +72,32 @@
<real>2</real>
</array>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>SETTINGS_GESTURE_TITLE</string>
</dict>
<dict>
<key>DefaultValue</key>
<true/>
<key>Key</key>
<string>EnableGesturesToControlPlayback</string>
<key>Title</key>
<string>SETTINGS_GESTURES</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<false/>
<key>Key</key>
<string>EnableVariableJumpDuration</string>
<key>Title</key>
<string>SETTINGS_GESTURE_JUMP_DURATION</string>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
......
B/* A single strings file, whose title is specified in your preferences schema. The strings files provide the localized content to display to the user for each of your preferences. */
......
......@@ -58,7 +58,7 @@
else
skipLoopFilterDefaultValue = kVLCSettingSkipLoopFilterNonRef;
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : @(NO), kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue, kVLCSettingSkipLoopFilter : skipLoopFilterDefaultValue, kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue, kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue, kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue, kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaulValue, kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue, kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue, kVLCSettingPlaybackGestures : [NSNumber numberWithBool:YES], kVLCSettingFTPTextEncoding : kVLCSettingFTPTextEncodingDefaultValue, kVLCSettingWiFiSharingIPv6 : kVLCSettingWiFiSharingIPv6DefaultValue, kVLCSettingEqualizerProfile : kVLCSettingEqualizerProfileDefaultValue, kVLCSettingPlaybackForwardSkipLength: kVLCSettingPlaybackForwardSkipLengthDefaultValue, kVLCSettingPlaybackBackwardSkipLength: kVLCSettingPlaybackBackwardSkipLengthDefaultValue};
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : @(NO), kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue, kVLCSettingSkipLoopFilter : skipLoopFilterDefaultValue, kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue, kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue, kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue, kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaulValue, kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue, kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue, kVLCSettingPlaybackGestures : [NSNumber numberWithBool:YES], kVLCSettingFTPTextEncoding : kVLCSettingFTPTextEncodingDefaultValue, kVLCSettingWiFiSharingIPv6 : kVLCSettingWiFiSharingIPv6DefaultValue, kVLCSettingEqualizerProfile : kVLCSettingEqualizerProfileDefaultValue, kVLCSettingVariableJumpDuration : [NSNumber numberWithBool:NO], kVLCSettingPlaybackForwardSkipLength: kVLCSettingPlaybackForwardSkipLengthDefaultValue, kVLCSettingPlaybackBackwardSkipLength: kVLCSettingPlaybackBackwardSkipLengthDefaultValue};
[defaults registerDefaults:appDefaults];
}
......
......@@ -41,6 +41,7 @@
#define kVLCSettingNetworkCachingDefaultValue @(999)
#define kVLCSettingsDecrapifyTitles @"MLDecrapifyTitles"
#define kVLCSettingPlaybackGestures @"EnableGesturesToControlPlayback"
#define kVLCSettingVariableJumpDuration @"EnableVariableJumpDuration"
#define kVLCSettingFTPTextEncoding @"ftp-text-encoding"
#define kVLCSettingFTPTextEncodingDefaultValue @(5) // ISO Latin 1
#define kVLCSettingPlaybackSpeedDefaultValue @"playback-speed"
......
......@@ -42,6 +42,7 @@
NSArray *_menuItemsSectionOne;
NSArray *_menuItemsSectionTwo;
NSArray *_menuItemsSectionThree;
NSMutableSet *_hiddenSettingKeys;
UILabel *_uploadLocationLabel;
UIButton *_uploadButton;
......@@ -330,12 +331,18 @@
self.settingsViewController.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self.settingsController.viewController andSelector:@selector(dismiss:)];
}
_hiddenSettingKeys = [[NSMutableSet alloc] init];
self.settingsViewController.modalPresentationStyle = UIModalPresentationFormSheet;
self.settingsViewController.delegate = self.settingsController;
self.settingsViewController.showDoneButton = NO;
self.settingsViewController.showCreditsFooter = NO;
if (![[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingPlaybackGestures] boolValue])
[_hiddenSettingKeys addObject:@"EnableVariableJumpDuration"];
[self.settingsController.viewController setHiddenKeys:_hiddenSettingKeys];
viewController = self.settingsController.viewController;
} else if (itemIndex == 1)
viewController = [[VLCAboutViewController alloc] init];
} else {
......
......@@ -31,6 +31,8 @@
#import "VLCStatusLabel.h"
#define INPUT_RATE_DEFAULT 1000.
#define FORWARD_SWIPE_DURATION 30
#define BACKWARD_SWIPE_DURATION 10
#define TRACK_SELECTOR_TABLEVIEW_CELL @"track selector table view cell"
#define TRACK_SELECTOR_TABLEVIEW_SECTIONHEADER @"track selector table view section header"
......@@ -75,6 +77,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
BOOL _switchingTracksNotChapters;
BOOL _swipeGesturesEnabled;
BOOL _variableJumpDurationEnabled;
UIPinchGestureRecognizer *_pinchRecognizer;
VLCPanType _currentPanType;
UIPanGestureRecognizer *_panRecognizer;
......@@ -288,6 +291,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
_displayRemainingTime = [[defaults objectForKey:kVLCShowRemainingTime] boolValue];
_swipeGesturesEnabled = [[defaults objectForKey:kVLCSettingPlaybackGestures] boolValue];
_variableJumpDurationEnabled = [[defaults objectForKey:kVLCSettingVariableJumpDuration] boolValue];
_pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
_pinchRecognizer.delegate = self;
......@@ -521,6 +525,7 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.albumNameLabel.text = nil;
_swipeGesturesEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingPlaybackGestures] boolValue];
_variableJumpDurationEnabled = [[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingVariableJumpDuration] boolValue];
[self.navigationController setNavigationBarHidden:YES animated:YES];
......@@ -1890,25 +1895,26 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCente
return;
NSString * hudString = @" ";
int swipeDuration = (int)(_mediaDuration*0.001*0.05);
int swipeForwardDuration = (_variableJumpDurationEnabled) ? ((int)(_mediaDuration*0.001*0.05)) : FORWARD_SWIPE_DURATION;
int swipeBackwardDuration = (_variableJumpDurationEnabled) ? ((int)(_mediaDuration*0.001*0.05)) : BACKWARD_SWIPE_DURATION;
if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionRight) {
double timeRemainingDouble = (-_mediaPlayer.remainingTime.intValue*0.001);
int timeRemaining = timeRemainingDouble;
if (swipeDuration < timeRemaining) {
if (swipeDuration < 1)
swipeDuration = 1;
[_mediaPlayer jumpForward:swipeDuration];
hudString = [NSString stringWithFormat:@"⇒ %is", swipeDuration];
if (swipeForwardDuration < timeRemaining) {
if (swipeForwardDuration < 1)
swipeForwardDuration = 1;
[_mediaPlayer jumpForward:swipeForwardDuration];
hudString = [NSString stringWithFormat:@"⇒ %is", swipeForwardDuration];
} else {
[_mediaPlayer jumpForward:(timeRemaining - 5)];
hudString = [NSString stringWithFormat:@"⇒ %is",(timeRemaining - 5)];
}
}
else if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
[_mediaPlayer jumpBackward:swipeDuration];
hudString = [NSString stringWithFormat:@"⇐ %is",swipeDuration];
[_mediaPlayer jumpBackward:swipeBackwardDuration];
hudString = [NSString stringWithFormat:@"⇐ %is",swipeBackwardDuration];
}else if (swipeRecognizer.direction == UISwipeGestureRecognizerDirectionUp) {
[self backward:self];
}
......
......@@ -20,9 +20,7 @@
#import "PAPasscodeViewController.h"
@interface VLCSettingsController ()<PAPasscodeViewControllerDelegate, IASKSettingsDelegate>
{
}
@end
@implementation VLCSettingsController
......@@ -52,6 +50,10 @@
[self.viewController presentViewController:passcodeLockController animated:YES completion:nil];
}
}
if ([notification.object isEqual:kVLCSettingPlaybackGestures]) {
BOOL enabled = (BOOL)[[notification.userInfo objectForKey:@"EnableGesturesToControlPlayback"] intValue];
[self.viewController setHiddenKeys:enabled ? nil : [NSSet setWithObjects:@"EnableVariableJumpDuration", nil] animated:YES];
}
}
- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender
......
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