[vlc-commits] macosx/main: remove legacy playlist

Felix Paul Kühne git at videolan.org
Mon Mar 11 11:14:21 CET 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon Mar 11 09:52:36 2019 +0100| [e0c76187f2c0f7b9a48d32eb52a04836c84928a3] | committer: Felix Paul Kühne

macosx/main: remove legacy playlist

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e0c76187f2c0f7b9a48d32eb52a04836c84928a3
---

 modules/gui/macosx/main/VLCMain+OldPrefs.m         |  2 +-
 modules/gui/macosx/main/VLCMain.h                  |  3 +-
 modules/gui/macosx/main/VLCMain.m                  | 47 +++++++++-------------
 .../macosx/panels/VLCBookmarksWindowController.m   |  2 +-
 4 files changed, 21 insertions(+), 33 deletions(-)

diff --git a/modules/gui/macosx/main/VLCMain+OldPrefs.m b/modules/gui/macosx/main/VLCMain+OldPrefs.m
index 9066310d13..c84ab43cc8 100644
--- a/modules/gui/macosx/main/VLCMain+OldPrefs.m
+++ b/modules/gui/macosx/main/VLCMain+OldPrefs.m
@@ -88,7 +88,7 @@ static const int kCurrentPreferencesVersion = 4;
     } else if (version == 3) {
         /* version 4 (introduced in 3.0.0) adds RTL settings depending on stored language */
         [defaults setInteger:kCurrentPreferencesVersion forKey:kVLCPreferencesVersion];
-        BOOL hasUpdated = [VLCSimplePrefsController updateRightToLeftSettings];
+        [VLCSimplePrefsController updateRightToLeftSettings];
         [defaults synchronize];
 
         // In VLC 2.2.x, config for filters was fully controlled by audio and video effects panel.
diff --git a/modules/gui/macosx/main/VLCMain.h b/modules/gui/macosx/main/VLCMain.h
index 966485776e..861eaf5fd9 100644
--- a/modules/gui/macosx/main/VLCMain.h
+++ b/modules/gui/macosx/main/VLCMain.h
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * VLCMain.h: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2016 VLC authors and VideoLAN
+ * Copyright (C) 2002-2019 VLC authors and VideoLAN
  *
  * Authors: Derk-Jan Hartman <hartman at videolan dot org>
  *          Felix Paul Kühne <fkuehne at videolan dot org>
@@ -108,7 +108,6 @@ static NSString * VLCAppleRemoteSettingChangedNotification = @"VLCAppleRemoteSet
 
 - (VLCInformationWindowController *)currentMediaInfoPanel;
 
-
 - (VLCConvertAndSaveWindowController *)convertAndSaveWindow;
 
 - (void)setActiveVideoPlayback:(BOOL)b_value;
diff --git a/modules/gui/macosx/main/VLCMain.m b/modules/gui/macosx/main/VLCMain.m
index c43e62ff87..cea62580a3 100644
--- a/modules/gui/macosx/main/VLCMain.m
+++ b/modules/gui/macosx/main/VLCMain.m
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * VLCMain.m: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2016 VLC authors and VideoLAN
+ * Copyright (C) 2002-2019 VLC authors and VideoLAN
  *
  * Authors: Derk-Jan Hartman <hartman at videolan.org>
  *          Felix Paul Kühne <fkuehne at videolan dot org>
@@ -41,7 +41,6 @@
 #include <vlc_dialog.h>
 #include <vlc_url.h>
 #include <vlc_variables.h>
-#import <vlc_playlist_legacy.h>
 
 #import "coreinteraction/VLCCoreInteraction.h"
 #import "coreinteraction/VLCInputManager.h"
@@ -63,6 +62,8 @@
 #import "panels/VLCTrackSynchronizationWindowController.h"
 
 #import "playlist/VLCPlaylistController.h"
+#import "playlist/VLCPlayerController.h"
+#import "playlist/VLCPlaylistModel.h"
 
 #import "preferences/prefs.h"
 #import "preferences/VLCSimplePrefsController.h"
@@ -74,8 +75,6 @@
 #import "windows/VLCOpenInputMetadata.h"
 #import "windows/video/VLCVoutView.h"
 
-#import "extensions/helpers.h"
-
 #ifdef HAVE_SPARKLE
 #import <Sparkle/Sparkle.h>                 /* we're the update delegate */
 #endif
@@ -144,13 +143,12 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
 
             intf_thread_t * p_intf = getIntf();
             if (p_intf) {
-                playlist_t * p_playlist = pl_Get(p_intf);
-                BOOL b_fullscreen = var_GetBool(p_playlist, "fullscreen");
-                if (b_fullscreen)
-                    [[VLCMain sharedInstance] showFullscreenController];
+                VLCMain *mainInstance = [VLCMain sharedInstance];
+                if ([[[mainInstance playlistController] playerController] fullscreen])
+                    [mainInstance showFullscreenController];
 
                 else if (!strcmp(psz_variable, "intf-show"))
-                    [[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil];
+                    [[mainInstance mainWindow] makeKeyAndOrderFront:nil];
             }
 
         });
@@ -245,16 +243,16 @@ static VLCMain *sharedInstance = nil;
         _mainWindowController = [[NSWindowController alloc] initWithWindowNibName:@"MainWindow"];
         _libraryWindowController = [[VLCLibraryWindowController alloc] initWithLibraryWindow];
 
-        var_AddCallback(pl_Get(p_intf), "intf-toggle-fscontrol", ShowController, (__bridge void *)self);
-        var_AddCallback(pl_Get(p_intf), "intf-show", ShowController, (__bridge void *)self);
+        // FIXME: those variables will live on the current libvlc instance now. Depends on a future patch
+        var_AddCallback(p_intf, "intf-toggle-fscontrol", ShowController, (__bridge void *)self);
+        var_AddCallback(p_intf, "intf-show", ShowController, (__bridge void *)self);
 
         // Load them here already to apply stored profiles
         _videoEffectsPanel = [[VLCVideoEffectsWindowController alloc] init];
         _audioEffectsPanel = [[VLCAudioEffectsWindowController alloc] init];
 
-        playlist_t *p_playlist = pl_Get(p_intf);
         if ([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen)
-            var_SetBool(p_playlist, "fullscreen", YES);
+            [_playlistController.playerController setFullscreen:YES];
 
         _nativeFullscreenMode = var_InheritBool(p_intf, "macosx-nativefullscreenmode");
 
@@ -312,13 +310,11 @@ static VLCMain *sharedInstance = nil;
     [[self mainWindow] updateVolumeSlider];
 
     // respect playlist-autostart
-    // note that PLAYLIST_PLAY will not stop any playback if already started
-    playlist_t * p_playlist = pl_Get(getIntf());
-    PL_LOCK;
-    BOOL kidsAround = p_playlist->p_playing->i_children != 0;
-    if (kidsAround && var_GetBool(p_playlist, "playlist-autostart"))
-        playlist_Control(p_playlist, PLAYLIST_PLAY, true);
-    PL_UNLOCK;
+    if (var_GetBool(p_intf, "playlist-autostart")) {
+        if ([_playlistController.playlistModel numberOfPlaylistItems] > 0) {
+            [_playlistController startPlaylist];
+        }
+    }
 }
 
 #pragma mark -
@@ -341,19 +337,12 @@ static VLCMain *sharedInstance = nil;
     if (notification == nil)
         [[NSNotificationCenter defaultCenter] postNotificationName: NSApplicationWillTerminateNotification object: nil];
 
-    playlist_t * p_playlist = pl_Get(p_intf);
-
     /* save current video and audio profiles */
     [[self videoEffectsPanel] saveCurrentProfileAtTerminate];
     [[self audioEffectsPanel] saveCurrentProfileAtTerminate];
 
-    /* Save some interface state in configuration, at module quit */
-    config_PutInt("random", var_GetBool(p_playlist, "random"));
-    config_PutInt("loop", var_GetBool(p_playlist, "loop"));
-    config_PutInt("repeat", var_GetBool(p_playlist, "repeat"));
-
-    var_DelCallback(pl_Get(p_intf), "intf-toggle-fscontrol", ShowController, (__bridge void *)self);
-    var_DelCallback(pl_Get(p_intf), "intf-show", ShowController, (__bridge void *)self);
+    var_DelCallback(p_intf, "intf-toggle-fscontrol", ShowController, (__bridge void *)self);
+    var_DelCallback(p_intf, "intf-show", ShowController, (__bridge void *)self);
 
     [[NSNotificationCenter defaultCenter] removeObserver: self];
 
diff --git a/modules/gui/macosx/panels/VLCBookmarksWindowController.m b/modules/gui/macosx/panels/VLCBookmarksWindowController.m
index f4ad7c786c..a3cbdecfe4 100644
--- a/modules/gui/macosx/panels/VLCBookmarksWindowController.m
+++ b/modules/gui/macosx/panels/VLCBookmarksWindowController.m
@@ -129,7 +129,7 @@
     seekpoint_t bookmark;
 
     if (!input_Control(p_input, INPUT_GET_BOOKMARK, &bookmark)) {
-        bookmark.psz_name = _("Untitled");
+        bookmark.psz_name = (char *)_("Untitled");
         input_Control(p_input, INPUT_ADD_BOOKMARK, &bookmark);
     }
 



More information about the vlc-commits mailing list