Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
db62975c
Commit
db62975c
authored
Jul 21, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: split main interface class
parent
6916c8d1
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1161 additions
and
1006 deletions
+1161
-1006
extras/package/macosx/vlc.xcodeproj/project.pbxproj
extras/package/macosx/vlc.xcodeproj/project.pbxproj
+6
-0
modules/gui/macosx/AppleRemote.m
modules/gui/macosx/AppleRemote.m
+28
-24
modules/gui/macosx/ControlsBar.m
modules/gui/macosx/ControlsBar.m
+2
-1
modules/gui/macosx/CoreInteraction.h
modules/gui/macosx/CoreInteraction.h
+6
-1
modules/gui/macosx/CoreInteraction.m
modules/gui/macosx/CoreInteraction.m
+363
-1
modules/gui/macosx/InputManager.h
modules/gui/macosx/InputManager.h
+1
-1
modules/gui/macosx/InputManager.m
modules/gui/macosx/InputManager.m
+10
-8
modules/gui/macosx/MainWindow.m
modules/gui/macosx/MainWindow.m
+2
-2
modules/gui/macosx/Makefile.am
modules/gui/macosx/Makefile.am
+2
-0
modules/gui/macosx/VLCVoutWindowController.h
modules/gui/macosx/VLCVoutWindowController.h
+4
-0
modules/gui/macosx/VLCVoutWindowController.m
modules/gui/macosx/VLCVoutWindowController.m
+177
-4
modules/gui/macosx/coredialogs.m
modules/gui/macosx/coredialogs.m
+84
-4
modules/gui/macosx/helpers.h
modules/gui/macosx/helpers.h
+71
-0
modules/gui/macosx/intf-prefs.h
modules/gui/macosx/intf-prefs.h
+31
-0
modules/gui/macosx/intf-prefs.m
modules/gui/macosx/intf-prefs.m
+118
-0
modules/gui/macosx/intf.h
modules/gui/macosx/intf.h
+21
-29
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+77
-929
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.h
+2
-0
modules/gui/macosx/playlist.m
modules/gui/macosx/playlist.m
+153
-0
modules/gui/macosx/simple_prefs.m
modules/gui/macosx/simple_prefs.m
+3
-2
No files found.
extras/package/macosx/vlc.xcodeproj/project.pbxproj
View file @
db62975c
...
...
@@ -1240,6 +1240,9 @@
7D3F652718805297005776C4
/* BWQuincyManager.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
BWQuincyManager.m
;
path
=
../../../modules/gui/macosx/BWQuincyManager.m
;
sourceTree
=
SOURCE_ROOT
;
};
7D3F652818805297005776C4
/* BWQuincyUI.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
BWQuincyUI.h
;
path
=
../../../modules/gui/macosx/BWQuincyUI.h
;
sourceTree
=
SOURCE_ROOT
;
};
7D3F652918805297005776C4
/* BWQuincyUI.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
BWQuincyUI.m
;
path
=
../../../modules/gui/macosx/BWQuincyUI.m
;
sourceTree
=
SOURCE_ROOT
;
};
7D871D371B5E6844000B56C0
/* intf-prefs.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
"intf-prefs.h"
;
path
=
"../../../modules/gui/macosx/intf-prefs.h"
;
sourceTree
=
"<group>"
;
};
7D871D381B5E6844000B56C0
/* intf-prefs.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
"intf-prefs.m"
;
path
=
"../../../modules/gui/macosx/intf-prefs.m"
;
sourceTree
=
"<group>"
;
};
7D871D391B5E684D000B56C0
/* helpers.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
helpers.h
;
path
=
../../../modules/gui/macosx/helpers.h
;
sourceTree
=
"<group>"
;
};
7D8BB0B318302AC000FAE9B7
/* DebugMessageVisualizer.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
DebugMessageVisualizer.h
;
path
=
../../../modules/gui/macosx/DebugMessageVisualizer.h
;
sourceTree
=
SOURCE_ROOT
;
};
7D8BB0B418302AC000FAE9B7
/* DebugMessageVisualizer.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
DebugMessageVisualizer.m
;
path
=
../../../modules/gui/macosx/DebugMessageVisualizer.m
;
sourceTree
=
SOURCE_ROOT
;
};
7D8BB0B61830311300FAE9B7
/* English */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.xib
;
name
=
English
;
path
=
Resources/English.lproj/DebugMessageVisualizer.xib
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1810,6 +1813,7 @@
08FB77AFFE84173DC02AAC07
/* Classes */
=
{
isa
=
PBXGroup
;
children
=
(
7D871D391B5E684D000B56C0
/* helpers.h */
,
8EE1AF9F044465080059A3A7
/* about.h */
,
8EE1AFA0044465080059A3A7
/* about.m */
,
7DF0435E1972E26A0022B534
/* AddonListDataSource.h */
,
...
...
@@ -1845,6 +1849,8 @@
2AEF857709A5FEC900130822
/* fspanel.m */
,
8ED6C27C03E2EB1C0059A3A7
/* intf.h */
,
8ED6C27D03E2EB1C0059A3A7
/* intf.m */
,
7D871D371B5E6844000B56C0
/* intf-prefs.h */
,
7D871D381B5E6844000B56C0
/* intf-prefs.m */
,
7DF812ED1B555A340052293C
/* InputManager.h */
,
7DF812EE1B555A340052293C
/* InputManager.m */
,
7DF812EF1B555C8E0052293C
/* KeyboardBacklight.h */
,
...
...
modules/gui/macosx/AppleRemote.m
View file @
db62975c
...
...
@@ -80,6 +80,8 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
-
(
id
)
init
{
self
=
[
super
init
];
if
(
self
)
{
_openInExclusiveMode
=
YES
;
queue
=
NULL
;
hidDeviceInterface
=
NULL
;
...
...
@@ -104,6 +106,8 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
/* defaults */
_simulatesPlusMinusHold
=
YES
;
_maximumClickCountTimeDifference
=
DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE
;
}
return
self
;
}
-
(
void
)
dealloc
{
...
...
modules/gui/macosx/ControlsBar.m
View file @
db62975c
...
...
@@ -27,6 +27,7 @@
#import "CoreInteraction.h"
#import "MainMenu.h"
#import "fspanel.h"
#import "playlist.h"
#import "CompatibilityFixes.h"
/*****************************************************************************
...
...
@@ -632,7 +633,7 @@ frame.origin.x = f_width + frame.origin.x; \
if
(
!
config_GetInt
(
VLCIntf
,
"macosx-show-effects-button"
))
[
self
removeEffectsButton
:
YES
];
[[
VLCMain
sharedInstance
]
playbackModeUpdated
];
[[
[
VLCMain
sharedInstance
]
playlist
]
playbackModeUpdated
];
}
...
...
modules/gui/macosx/CoreInteraction.h
View file @
db62975c
/*****************************************************************************
* CoreInteraction.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2011-201
4
Felix Paul Kühne
* Copyright (C) 2011-201
5
Felix Paul Kühne
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
...
...
@@ -66,6 +66,8 @@
-
(
void
)
volumeUp
;
-
(
void
)
volumeDown
;
-
(
void
)
toggleMute
;
-
(
void
)
startListeningWithAppleRemote
;
-
(
void
)
stopListeningWithAppleRemote
;
-
(
void
)
addSubtitlesToCurrentInput
:(
NSArray
*
)
paths
;
-
(
BOOL
)
performDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
;
...
...
@@ -80,4 +82,7 @@
-
(
void
)
setVideoFilterProperty
:
(
const
char
*
)
psz_name
forFilter
:
(
const
char
*
)
psz_filter
string
:
(
const
char
*
)
psz_value
;
-
(
void
)
setVideoFilterProperty
:
(
const
char
*
)
psz_name
forFilter
:
(
const
char
*
)
psz_filter
boolean
:
(
BOOL
)
b_value
;
-
(
void
)
updateCurrentlyUsedHotkeys
;
-
(
BOOL
)
hasDefinedShortcutKey
:(
NSEvent
*
)
o_event
force
:(
BOOL
)
b_force
;
@end
modules/gui/macosx/CoreInteraction.m
View file @
db62975c
This diff is collapsed.
Click to expand it.
modules/gui/macosx/InputManager.h
View file @
db62975c
...
...
@@ -29,7 +29,7 @@
@class
VLCMain
;
@interface
InputManager
:
NSObject
@interface
VLC
InputManager
:
NSObject
-
(
id
)
initWithMain
:(
VLCMain
*
)
o_mainObj
;
...
...
modules/gui/macosx/InputManager.m
View file @
db62975c
...
...
@@ -41,7 +41,7 @@ static int InputThreadChanged(vlc_object_t *p_this, const char *psz_var,
vlc_value_t
oldval
,
vlc_value_t
new_val
,
void
*
param
)
{
@autoreleasepool
{
InputManager
*
inputManager
=
(
__bridge
InputManager
*
)
param
;
VLCInputManager
*
inputManager
=
(
__bridge
VLC
InputManager
*
)
param
;
[
inputManager
performSelectorOnMainThread
:
@selector
(
inputThreadChanged
)
withObject
:
nil
waitUntilDone
:
NO
];
}
...
...
@@ -53,7 +53,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
vlc_value_t
oldval
,
vlc_value_t
new_val
,
void
*
param
)
{
@autoreleasepool
{
InputManager
*
inputManager
=
(
__bridge
InputManager
*
)
param
;
VLCInputManager
*
inputManager
=
(
__bridge
VLC
InputManager
*
)
param
;
switch
(
new_val
.
i_int
)
{
case
INPUT_EVENT_STATE
:
...
...
@@ -131,9 +131,8 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
#pragma mark -
#pragma mark InputManager implementation
@interface
InputManager
()
@interface
VLC
InputManager
()
{
intf_thread_t
*
p_intf
;
VLCMain
*
o_main
;
input_thread_t
*
p_current_input
;
...
...
@@ -150,13 +149,12 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
}
@end
@implementation
InputManager
@implementation
VLC
InputManager
-
(
id
)
initWithMain
:(
VLCMain
*
)
o_mainObj
{
self
=
[
super
init
];
if
(
self
)
{
p_intf
=
VLCIntf
;
o_main
=
o_mainObj
;
var_AddCallback
(
pl_Get
(
VLCIntf
),
"input-current"
,
InputThreadChanged
,
(
__bridge
void
*
)
self
);
...
...
@@ -168,6 +166,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
-
(
void
)
dealloc
{
intf_thread_t
*
p_intf
=
VLCIntf
;
if
(
p_current_input
)
{
/* continue playback where you left off */
[[
o_main
playlist
]
storePlaybackPositionForItem
:
p_current_input
];
...
...
@@ -177,7 +176,8 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
p_current_input
=
NULL
;
}
var_DelCallback
(
pl_Get
(
VLCIntf
),
"input-current"
,
InputThreadChanged
,
(
__bridge
void
*
)
self
);
if
(
p_intf
)
var_DelCallback
(
p_intf
,
"input-current"
,
InputThreadChanged
,
(
__bridge
void
*
)
self
);
dispatch_release
(
informInputChangedQueue
);
}
...
...
@@ -230,7 +230,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
* The serial queue ensures that changed inputs are propagated in the same order as they arrive.
*/
dispatch_async
(
informInputChangedQueue
,
^
{
[[
ExtensionsManager
getInstance
:
p_i
ntf
]
inputChanged
:
p_input_changed
];
[[
ExtensionsManager
getInstance
:
VLCI
ntf
]
inputChanged
:
p_input_changed
];
if
(
p_input_changed
)
vlc_object_release
(
p_input_changed
);
});
...
...
@@ -239,6 +239,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
-
(
void
)
playbackStatusUpdated
{
intf_thread_t
*
p_intf
=
VLCIntf
;
int
state
=
-
1
;
if
(
p_current_input
)
{
state
=
var_GetInteger
(
p_current_input
,
"state"
);
...
...
@@ -363,6 +364,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
-
(
void
)
resumeItunesPlayback
:(
id
)
sender
{
intf_thread_t
*
p_intf
=
VLCIntf
;
if
(
var_InheritInteger
(
p_intf
,
"macosx-control-itunes"
)
>
1
)
{
if
(
b_has_itunes_paused
)
{
iTunesApplication
*
iTunesApp
=
(
iTunesApplication
*
)
[
SBApplication
applicationWithBundleIdentifier
:
@"com.apple.iTunes"
];
...
...
modules/gui/macosx/MainWindow.m
View file @
db62975c
...
...
@@ -100,7 +100,7 @@ static VLCMainWindow *sharedInstance = nil;
defer:
flag
];
});
[[
VLCMain
sharedInstance
]
updateTogglePlaylistState
];
[[
[
VLCMain
sharedInstance
]
playlist
]
updateTogglePlaylistState
];
return
sharedInstance
;
}
...
...
@@ -146,7 +146,7 @@ static VLCMainWindow *sharedInstance = nil;
else
b_force
=
YES
;
return
[[
VLC
Mai
n
sharedInstance
]
hasDefinedShortcutKey
:
o_event
force
:
b_force
]
||
return
[[
VLC
CoreInteractio
n
sharedInstance
]
hasDefinedShortcutKey
:
o_event
force
:
b_force
]
||
[(
VLCControls
*
)[[
VLCMain
sharedInstance
]
controls
]
keyEvent
:
o_event
];
}
...
...
modules/gui/macosx/Makefile.am
View file @
db62975c
...
...
@@ -18,6 +18,7 @@ EXTRA_LTLIBRARIES = libmacosx_plugin.la
gui_LTLIBRARIES
=
$(LTLIBmacosx)
libmacosx_plugin_la_SOURCES
=
\
helpers.h
\
about.h about.m
\
AddonListDataSource.h AddonListDataSource.m
\
AddonsWindowController.h AddonsWindowController.m
\
...
...
@@ -38,6 +39,7 @@ libmacosx_plugin_la_SOURCES = \
ExtensionsManager.h ExtensionsManager.m
\
eyetv.h eyetv.m
\
fspanel.h fspanel.m
\
intf-prefs.h intf-prefs.m
\
intf.h intf.m
\
InputManager.h InputManager.m
\
iTunes.h
\
...
...
modules/gui/macosx/VLCVoutWindowController.h
View file @
db62975c
...
...
@@ -32,6 +32,10 @@
@interface
VLCVoutWindowController
:
NSObject
+
(
VLCVoutWindowController
*
)
sharedInstance
;
@property
(
readonly
,
atomic
)
NSLock
*
lock
;
@property
(
readonly
,
nonatomic
)
NSInteger
currentStatusWindowLevel
;
-
(
VLCVoutView
*
)
setupVoutForWindow
:(
vout_window_t
*
)
p_wnd
withProposedVideoViewPosition
:(
NSRect
)
videoViewPosition
;
...
...
modules/gui/macosx/VLCVoutWindowController.m
View file @
db62975c
...
...
@@ -22,6 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vlc_vout_display.h>
#import "CompatibilityFixes.h"
#import "VLCVoutWindowController.h"
#import "intf.h"
...
...
@@ -36,6 +38,162 @@
#import "ResumeDialogController.h"
#import "playlist.h"
static
atomic_bool
b_intf_starting
=
ATOMIC_VAR_INIT
(
false
);
static
int
WindowControl
(
vout_window_t
*
,
int
i_query
,
va_list
);
int
WindowOpen
(
vout_window_t
*
p_wnd
,
const
vout_window_cfg_t
*
cfg
)
{
@autoreleasepool
{
if
(
cfg
->
type
!=
VOUT_WINDOW_TYPE_INVALID
&&
cfg
->
type
!=
VOUT_WINDOW_TYPE_NSOBJECT
)
return
VLC_EGENERIC
;
msg_Dbg
(
p_wnd
,
"Opening video window"
);
if
(
!
atomic_load
(
&
b_intf_starting
))
{
msg_Err
(
p_wnd
,
"Cannot create vout as Mac OS X interface was not found"
);
return
VLC_EGENERIC
;
}
NSRect
proposedVideoViewPosition
=
NSMakeRect
(
cfg
->
x
,
cfg
->
y
,
cfg
->
width
,
cfg
->
height
);
VLCVoutWindowController
*
voutController
=
[[
VLCMain
sharedInstance
]
voutController
];
if
(
!
voutController
)
{
return
VLC_EGENERIC
;
}
[
voutController
.
lock
lock
];
SEL
sel
=
@selector
(
setupVoutForWindow
:
withProposedVideoViewPosition
:
);
NSInvocation
*
inv
=
[
NSInvocation
invocationWithMethodSignature
:[
voutController
methodSignatureForSelector
:
sel
]];
[
inv
setTarget
:
voutController
];
[
inv
setSelector
:
sel
];
[
inv
setArgument
:
&
p_wnd
atIndex
:
2
];
// starting at 2!
[
inv
setArgument
:
&
proposedVideoViewPosition
atIndex
:
3
];
[
inv
performSelectorOnMainThread
:
@selector
(
invoke
)
withObject
:
nil
waitUntilDone:
YES
];
VLCVoutView
*
videoView
=
nil
;
[
inv
getReturnValue
:
&
videoView
];
// this method is not supposed to fail
assert
(
videoView
!=
nil
);
msg_Dbg
(
VLCIntf
,
"returning videoview with proposed position x=%i, y=%i, width=%i, height=%i"
,
cfg
->
x
,
cfg
->
y
,
cfg
->
width
,
cfg
->
height
);
p_wnd
->
handle
.
nsobject
=
(
void
*
)
CFBridgingRetain
(
videoView
);
[
voutController
.
lock
unlock
];
p_wnd
->
type
=
VOUT_WINDOW_TYPE_NSOBJECT
;
p_wnd
->
control
=
WindowControl
;
return
VLC_SUCCESS
;
}
}
static
int
WindowControl
(
vout_window_t
*
p_wnd
,
int
i_query
,
va_list
args
)
{
@autoreleasepool
{
VLCVoutWindowController
*
voutController
=
[[
VLCMain
sharedInstance
]
voutController
];
if
(
!
voutController
)
{
return
VLC_EGENERIC
;
}
[
voutController
.
lock
lock
];
switch
(
i_query
)
{
case
VOUT_WINDOW_SET_STATE
:
{
unsigned
i_state
=
va_arg
(
args
,
unsigned
);
if
(
i_state
&
VOUT_WINDOW_STATE_BELOW
)
{
msg_Dbg
(
p_wnd
,
"Ignore change to VOUT_WINDOW_STATE_BELOW"
);
goto
out
;
}
NSInteger
i_cooca_level
=
NSNormalWindowLevel
;
if
(
i_state
&
VOUT_WINDOW_STATE_ABOVE
)
i_cooca_level
=
NSStatusWindowLevel
;
SEL
sel
=
@selector
(
setWindowLevel
:
forWindow
:
);
NSInvocation
*
inv
=
[
NSInvocation
invocationWithMethodSignature
:[
voutController
methodSignatureForSelector
:
sel
]];
[
inv
setTarget
:
voutController
];
[
inv
setSelector
:
sel
];
[
inv
setArgument
:
&
i_cooca_level
atIndex
:
2
];
// starting at 2!
[
inv
setArgument
:
&
p_wnd
atIndex
:
3
];
[
inv
performSelectorOnMainThread
:
@selector
(
invoke
)
withObject
:
nil
waitUntilDone:
NO
];
break
;
}
case
VOUT_WINDOW_SET_SIZE
:
{
unsigned
int
i_width
=
va_arg
(
args
,
unsigned
int
);
unsigned
int
i_height
=
va_arg
(
args
,
unsigned
int
);
NSSize
newSize
=
NSMakeSize
(
i_width
,
i_height
);
SEL
sel
=
@selector
(
setNativeVideoSize
:
forWindow
:
);
NSInvocation
*
inv
=
[
NSInvocation
invocationWithMethodSignature
:[
voutController
methodSignatureForSelector
:
sel
]];
[
inv
setTarget
:
voutController
];
[
inv
setSelector
:
sel
];
[
inv
setArgument
:
&
newSize
atIndex
:
2
];
// starting at 2!
[
inv
setArgument
:
&
p_wnd
atIndex
:
3
];
[
inv
performSelectorOnMainThread
:
@selector
(
invoke
)
withObject
:
nil
waitUntilDone:
NO
];
break
;
}
case
VOUT_WINDOW_SET_FULLSCREEN
:
{
if
(
var_InheritBool
(
VLCIntf
,
"video-wallpaper"
))
{
msg_Dbg
(
p_wnd
,
"Ignore fullscreen event as video-wallpaper is on"
);
goto
out
;
}
int
i_full
=
va_arg
(
args
,
int
);
BOOL
b_animation
=
YES
;
SEL
sel
=
@selector
(
setFullscreen
:
forWindow
:
withAnimation
:
);
NSInvocation
*
inv
=
[
NSInvocation
invocationWithMethodSignature
:[
voutController
methodSignatureForSelector
:
sel
]];
[
inv
setTarget
:
voutController
];
[
inv
setSelector
:
sel
];
[
inv
setArgument
:
&
i_full
atIndex
:
2
];
// starting at 2!
[
inv
setArgument
:
&
p_wnd
atIndex
:
3
];
[
inv
setArgument
:
&
b_animation
atIndex
:
4
];
[
inv
performSelectorOnMainThread
:
@selector
(
invoke
)
withObject
:
nil
waitUntilDone:
NO
];
break
;
}
default:
{
msg_Warn
(
p_wnd
,
"unsupported control query"
);
[
voutController
.
lock
unlock
];
return
VLC_EGENERIC
;
}
}
out:
[
voutController
.
lock
unlock
];
return
VLC_SUCCESS
;
}
}
void
WindowClose
(
vout_window_t
*
p_wnd
)
{
@autoreleasepool
{
VLCVoutWindowController
*
voutController
=
[[
VLCMain
sharedInstance
]
voutController
];
if
(
!
voutController
)
{
return
;
}
[
voutController
.
lock
lock
];
[
voutController
performSelectorOnMainThread
:
@selector
(
removeVoutforDisplay
:)
withObject
:
[
NSValue
valueWithPointer
:
p_wnd
]
waitUntilDone
:
NO
];
[
voutController
.
lock
unlock
];
}
}
@interface
VLCVoutWindowController
()
{
NSMutableDictionary
*
o_vout_dict
;
...
...
@@ -53,13 +211,28 @@
@implementation
VLCVoutWindowController
+
(
VLCVoutWindowController
*
)
sharedInstance
{
static
VLCVoutWindowController
*
sharedInstance
=
nil
;
static
dispatch_once_t
pred
;
dispatch_once
(
&
pred
,
^
{
sharedInstance
=
[
VLCVoutWindowController
new
];
});
return
sharedInstance
;
}
-
(
id
)
init
{
self
=
[
super
init
];
if
(
self
)
{
atomic_store
(
&
b_intf_starting
,
true
);
o_vout_dict
=
[[
NSMutableDictionary
alloc
]
init
];
o_keyboard_backlight
=
[[
KeyboardBacklight
alloc
]
init
];
i_currentWindowLevel
=
NSNormalWindowLevel
;
_currentStatusWindowLevel
=
NSFloatingWindowLevel
;
}
return
self
;
}
...
...
modules/gui/macosx/coredialogs.m
View file @
db62975c
/*****************************************************************************
* coredialogs.m: Mac OS X Core Dialogs
*****************************************************************************
* Copyright (C) 2005-201
2
VLC authors and VideoLAN
* Copyright (C) 2005-201
5
VLC authors and VideoLAN
* $Id$
*
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
...
...
@@ -29,9 +29,56 @@
/* for the icon in our custom error panel */
#import <ApplicationServices/ApplicationServices.h>
/*****************************************************************************
* VLCCoreDialogProvider implementation
*****************************************************************************/
static
void
updateProgressPanel
(
void
*
,
const
char
*
,
float
);
static
bool
checkProgressPanel
(
void
*
);
static
void
destroyProgressPanel
(
void
*
);
static
int
DialogCallback
(
vlc_object_t
*
p_this
,
const
char
*
type
,
vlc_value_t
previous
,
vlc_value_t
value
,
void
*
data
)
{
@autoreleasepool
{
if
([[
NSString
stringWithUTF8String
:
type
]
isEqualToString
:
@"dialog-progress-bar"
])
{
/* the progress panel needs to update itself and therefore wants special treatment within this context */
dialog_progress_bar_t
*
p_dialog
=
(
dialog_progress_bar_t
*
)
value
.
p_address
;
p_dialog
->
pf_update
=
updateProgressPanel
;
p_dialog
->
pf_check
=
checkProgressPanel
;
p_dialog
->
pf_destroy
=
destroyProgressPanel
;
p_dialog
->
p_sys
=
VLCIntf
->
p_libvlc
;
}
NSValue
*
o_value
=
[
NSValue
valueWithPointer
:
value
.
p_address
];
[[
VLCCoreDialogProvider
sharedInstance
]
performEventWithObject
:
o_value
ofType
:
type
];
return
VLC_SUCCESS
;
}
}
void
updateProgressPanel
(
void
*
priv
,
const
char
*
text
,
float
value
)
{
@autoreleasepool
{
NSString
*
o_txt
=
toNSStr
(
text
);
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[[
VLCCoreDialogProvider
sharedInstance
]
updateProgressPanelWithText
:
o_txt
andNumber
:
(
double
)(
value
*
1000
.)];
});
}
}
void
destroyProgressPanel
(
void
*
priv
)
{
@autoreleasepool
{
if
([[
NSApplication
sharedApplication
]
isRunning
])
[[
VLCCoreDialogProvider
sharedInstance
]
performSelectorOnMainThread
:
@selector
(
destroyProgressPanel
)
withObject
:
nil
waitUntilDone
:
YES
];
}
}
bool
checkProgressPanel
(
void
*
priv
)
{
@autoreleasepool
{
return
[[
VLCCoreDialogProvider
sharedInstance
]
progressCancelled
];
}
}
@interface
VLCCoreDialogProvider
()
{
ErrorWindowController
*
o_error_panel
;
...
...
@@ -52,6 +99,39 @@
return
sharedInstance
;
}
-
(
instancetype
)
init
{
self
=
[
super
init
];
if
(
self
)
{
intf_thread_t
*
p_intf
=
VLCIntf
;
/* subscribe to various interactive dialogues */
var_Create
(
p_intf
,
"dialog-error"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"dialog-error"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
var_Create
(
p_intf
,
"dialog-critical"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"dialog-critical"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
var_Create
(
p_intf
,
"dialog-login"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"dialog-login"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
var_Create
(
p_intf
,
"dialog-question"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"dialog-question"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
var_Create
(
p_intf
,
"dialog-progress-bar"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
p_intf
,
"dialog-progress-bar"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
dialog_Register
(
p_intf
);
}
return
self
;
}
-
(
void
)
dealloc
{
intf_thread_t
*
p_intf
=
VLCIntf
;
dialog_Unregister
(
p_intf
);
var_DelCallback
(
p_intf
,
"dialog-error"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_intf
,
"dialog-critical"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_intf
,
"dialog-login"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_intf
,
"dialog-question"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_intf
,
"dialog-progress-bar"
,
DialogCallback
,
(
__bridge
void
*
)
self
);
}
-
(
void
)
awakeFromNib
{
_progressCancelled
=
NO
;
...
...
modules/gui/macosx/helpers.h
0 → 100644
View file @
db62975c
/*****************************************************************************
* helpers.h
*****************************************************************************
* Copyright (C) 2009-2015 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan org>
* Felix Paul Kühne <fkuehne at videolan dot org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "intf.h"
#import "VideoView.h"
static
inline
input_thread_t
*
getInput
(
void
)
{
intf_thread_t
*
p_intf
=
VLCIntf
;
if
(
!
p_intf
)
return
NULL
;
return
pl_CurrentInput
(
p_intf
);
}
static
inline
vout_thread_t
*
getVout
(
void
)
{
input_thread_t
*
p_input
=
getInput
();
if
(
!
p_input
)
return
NULL
;
vout_thread_t
*
p_vout
=
input_GetVout
(
p_input
);
vlc_object_release
(
p_input
);
return
p_vout
;
}
static
inline
vout_thread_t
*
getVoutForActiveWindow
(
void
)
{
vout_thread_t
*
p_vout
=
nil
;
id
currentWindow
=
[
NSApp
keyWindow
];
if
([
currentWindow
respondsToSelector
:
@
selector
(
videoView
)])
{
VLCVoutView
*
videoView
=
[
currentWindow
videoView
];
if
(
videoView
)
{
p_vout
=
[
videoView
voutThread
];
}
}
if
(
!
p_vout
)
p_vout
=
getVout
();
return
p_vout
;
}
static
inline
audio_output_t
*
getAout
(
void
)
{
intf_thread_t
*
p_intf
=
VLCIntf
;
if
(
!
p_intf
)
return
NULL
;
return
playlist_GetAout
(
pl_Get
(
p_intf
));
}
modules/gui/macosx/intf-prefs.h
0 → 100644
View file @
db62975c
/*****************************************************************************
* intf-prefs.h
*****************************************************************************
* Copyright (C) 2001-2015 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "intf.h"
@interface
VLCMain
(
OldPrefs
)
-
(
void
)
private_resetAndReinitializeUserDefaults
;
-
(
void
)
removeOldPreferences
;
@end
modules/gui/macosx/intf-prefs.m
0 → 100644
View file @
db62975c
/*****************************************************************************
* intf-prefs.m
*****************************************************************************
* Copyright (C) 2001-2015 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan org>
* Felix Paul Kühne <fkuehne at videolan dot org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "intf-prefs.h"
#import "CoreInteraction.h"
@implementation
VLCMain
(
OldPrefs
)
static
NSString
*
kVLCPreferencesVersion
=
@"VLCPreferencesVersion"
;
static
const
int
kCurrentPreferencesVersion
=
3
;
+
(
void
)
initialize
{
NSDictionary
*
appDefaults
=
[
NSDictionary
dictionaryWithObject
:[
NSNumber
numberWithInt
:
kCurrentPreferencesVersion
]
forKey:
kVLCPreferencesVersion
];
[[
NSUserDefaults
standardUserDefaults
]
registerDefaults
:
appDefaults
];
}
-
(
void
)
private_resetAndReinitializeUserDefaults
{
// note that [NSUserDefaults resetStandardUserDefaults] will NOT correctly reset to the defaults
NSString
*
appDomain
=
[[
NSBundle
mainBundle
]
bundleIdentifier
];
[[
NSUserDefaults
standardUserDefaults
]
removePersistentDomainForName
:
appDomain
];
// set correct version to avoid question about outdated config
[[
NSUserDefaults
standardUserDefaults
]
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
[[
NSUserDefaults
standardUserDefaults
]
synchronize
];
}
-
(
void
)
removeOldPreferences
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
int
version
=
[
defaults
integerForKey
:
kVLCPreferencesVersion
];
/*
* Store version explicitely in file, for ease of debugging.
* Otherwise, the value will be just defined at app startup,
* as initialized above.
*/
[
defaults
setInteger
:
version
forKey
:
kVLCPreferencesVersion
];
if
(
version
>=
kCurrentPreferencesVersion
)
return
;
if
(
version
==
1
)
{
[
defaults
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
[
defaults
synchronize
];
if
(
!
[[
VLCCoreInteraction
sharedInstance
]
fixPreferences
])
return
;
else
config_SaveConfigFile
(
VLCIntf
);
// we need to do manually, since we won't quit libvlc cleanly
}
else
if
(
version
==
2
)
{
/* version 2 (used by VLC 2.0.x and early versions of 2.1) can lead to exceptions within 2.1 or later
* so we reset the OS X specific prefs here - in practice, no user will notice */
[
self
resetAndReinitializeUserDefaults
];
}
else
{
NSArray
*
libraries
=
NSSearchPathForDirectoriesInDomains
(
NSLibraryDirectory
,
NSUserDomainMask
,
YES
);
if
(
!
libraries
||
[
libraries
count
]
==
0
)
return
;
NSString
*
preferences
=
[[
libraries
firstObject
]
stringByAppendingPathComponent
:
@"Preferences"
];
int
res
=
NSRunInformationalAlertPanel
(
_NS
(
"Remove old preferences?"
),
_NS
(
"We just found an older version of VLC's preferences files."
),
_NS
(
"Move To Trash and Relaunch VLC"
),
_NS
(
"Ignore"
),
nil
,
nil
);
if
(
res
!=
NSOKButton
)
{
[
defaults
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
return
;
}
// Do NOT add the current plist file here as this would conflict with caching.
// Instead, just reset below.
NSArray
*
ourPreferences
=
[
NSArray
arrayWithObjects
:
@"org.videolan.vlc"
,
@"VLC"
,
nil
];
/* Move the file to trash one by one. Using above array the method would stop after first file
not found. */
for
(
NSString
*
file
in
ourPreferences
)
{
[[
NSWorkspace
sharedWorkspace
]
performFileOperation
:
NSWorkspaceRecycleOperation
source
:
preferences
destination
:
@""
files
:
[
NSArray
arrayWithObject
:
file
]
tag
:
nil
];
}
[
self
resetAndReinitializeUserDefaults
];
}
/* Relaunch now */
const
char
*
path
=
[[[
NSBundle
mainBundle
]
executablePath
]
UTF8String
];
/* For some reason we need to fork(), not just execl(), which reports a ENOTSUP then. */
if
(
fork
()
!=
0
)
{
exit
(
0
);
}
execl
(
path
,
path
,
NULL
);
}
@end
\ No newline at end of file
modules/gui/macosx/intf.h
View file @
db62975c
/*****************************************************************************
* intf.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-201
4
VLC authors and VideoLAN
* Copyright (C) 2002-201
5
VLC authors and VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org>
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
* Felix Paul Kühne <fkuehne at videolan dot org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
* Pierre d'Herbemont <pdherbemont # videolan org>
...
...
@@ -36,9 +35,9 @@
#import <vlc_aout.h>
#import <vlc_input.h>
#import <vlc_vout_window.h>
#import <vlc_atomic.h>
#import <Cocoa/Cocoa.h>
#import "SPMediaKeyTap.h"
/* for the media key support */
#import "misc.h"
#import "MainWindow.h"
#import "VLCVoutWindowController.h"
...
...
@@ -49,12 +48,6 @@
*****************************************************************************/
#define VLCIntf [[VLCMain sharedInstance] intf]
// You need to release those objects after use
input_thread_t
*
getInput
(
void
);
vout_thread_t
*
getVout
(
void
);
vout_thread_t
*
getVoutForActiveWindow
(
void
);
audio_output_t
*
getAout
(
void
);
static
NSString
*
VLCInputChangedNotification
=
@"VLCInputChangedNotification"
;
/*****************************************************************************
...
...
@@ -65,8 +58,14 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
@class
VLCControls
;
@class
VLCMainMenu
;
@class
VLCPlaylist
;
@class
InputManager
;
@class
VLC
InputManager
;
@class
ResumeDialogController
;
@class
VLCSimplePrefs
;
@class
VLCPrefs
;
@class
VLCCoreDialogProvider
;
@class
VLCEyeTVController
;
@class
VLCBookmarks
;
@class
VLCOpen
;
@interface
VLCMain
:
NSObject
<
NSWindowDelegate
,
NSApplicationDelegate
>
{
...
...
@@ -86,32 +85,23 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
-
(
VLCMainMenu
*
)
mainMenu
;
-
(
VLCMainWindow
*
)
mainWindow
;
-
(
id
)
controls
;
-
(
id
)
bookmarks
;
-
(
id
)
open
;
-
(
id
)
simplePreferences
;
-
(
id
)
preferences
;
-
(
VLCControls
*
)
controls
;
-
(
VLCBookmarks
*
)
bookmarks
;
-
(
VLCOpen
*
)
open
;
-
(
VLCSimplePrefs
*
)
simplePreferences
;
-
(
VLCPrefs
*
)
preferences
;
-
(
VLCPlaylist
*
)
playlist
;
-
(
id
)
coreDialogProvider
;
-
(
VLCCoreDialogProvider
*
)
coreDialogProvider
;
-
(
ResumeDialogController
*
)
resumeDialog
;
-
(
id
)
eyeTVController
;
-
(
id
)
appleRemoteControll
er
;
-
(
VLCEyeTVController
*
)
eyeTVController
;
-
(
VLCInputManager
*
)
inputManag
er
;
-
(
void
)
setActiveVideoPlayback
:(
BOOL
)
b_value
;
-
(
BOOL
)
activeVideoPlayback
;
-
(
void
)
applicationWillTerminate
:(
NSNotification
*
)
notification
;
-
(
void
)
updateCurrentlyUsedHotkeys
;
-
(
BOOL
)
hasDefinedShortcutKey
:(
NSEvent
*
)
o_event
force
:(
BOOL
)
b_force
;
-
(
void
)
resetAndReinitializeUserDefaults
;
-
(
void
)
plItemUpdated
;
-
(
void
)
playbackModeUpdated
;
-
(
void
)
showFullscreenController
;
-
(
void
)
updateTogglePlaylistState
;
-
(
void
)
mediaKeyTap
:(
SPMediaKeyTap
*
)
keyTap
receivedMediaKeyEvent
:(
NSEvent
*
)
event
;
-
(
void
)
resetAndReinitializeUserDefaults
;
-
(
BOOL
)
isTerminating
;
@end
...
...
@@ -124,3 +114,5 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
@interface
VLCApplication
:
NSApplication
@end
#import "helpers.h"
modules/gui/macosx/intf.m
View file @
db62975c
This diff is collapsed.
Click to expand it.
modules/gui/macosx/playlist.h
View file @
db62975c
...
...
@@ -75,6 +75,8 @@
-
(
IBAction
)
searchItem
:(
id
)
sender
;
-
(
void
)
playlistUpdated
;
-
(
void
)
playbackModeUpdated
;
-
(
void
)
updateTogglePlaylistState
;
-
(
void
)
outlineViewSelectionDidChange
:(
NSNotification
*
)
notification
;
-
(
void
)
sortNode
:(
int
)
i_mode
;
...
...
modules/gui/macosx/playlist.m
View file @
db62975c
...
...
@@ -50,6 +50,7 @@
#import "open.h"
#import "MainMenu.h"
#import "CoreInteraction.h"
#import "ControlsBar.h"
#import "ResumeDialogController.h"
...
...
@@ -57,6 +58,61 @@
#import <vlc_interface.h>
#include <vlc_url.h>
static
int
PLItemUpdated
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
new_val
,
void
*
param
)
{
@autoreleasepool
{
[[[
VLCMain
sharedInstance
]
playlist
]
performSelectorOnMainThread
:
@selector
(
plItemUpdated
)
withObject
:
nil
waitUntilDone
:
NO
];
return
VLC_SUCCESS
;
}
}
static
int
PLItemAppended
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
new_val
,
void
*
param
)
{
@autoreleasepool
{
playlist_add_t
*
p_add
=
new_val
.
p_address
;
NSArray
*
o_val
=
[
NSArray
arrayWithObjects
:[
NSNumber
numberWithInt
:
p_add
->
i_node
],
[
NSNumber
numberWithInt
:
p_add
->
i_item
],
nil
];
[[[
VLCMain
sharedInstance
]
playlist
]
performSelectorOnMainThread
:
@selector
(
plItemAppended
:)
withObject
:
o_val
waitUntilDone
:
NO
];
return
VLC_SUCCESS
;
}
}
static
int
PLItemRemoved
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
new_val
,
void
*
param
)
{
@autoreleasepool
{
NSNumber
*
o_val
=
[
NSNumber
numberWithInt
:
new_val
.
i_int
];
[[[
VLCMain
sharedInstance
]
playlist
]
performSelectorOnMainThread
:
@selector
(
plItemRemoved
:)
withObject
:
o_val
waitUntilDone
:
NO
];
return
VLC_SUCCESS
;
}
}
static
int
PlaybackModeUpdated
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
new_val
,
void
*
param
)
{
@autoreleasepool
{
[[[
VLCMain
sharedInstance
]
playlist
]
performSelectorOnMainThread
:
@selector
(
playbackModeUpdated
)
withObject
:
nil
waitUntilDone
:
NO
];
return
VLC_SUCCESS
;
}
}
static
int
VolumeUpdated
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
new_val
,
void
*
param
)
{
@autoreleasepool
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[[[
VLCMain
sharedInstance
]
mainWindow
]
updateVolumeSlider
];
});
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
* VLCPlaylistView implementation
*****************************************************************************/
...
...
@@ -179,6 +235,36 @@
[
defaults
registerDefaults
:
appDefaults
];
}
-
(
instancetype
)
init
{
self
=
[
super
init
];
if
(
self
)
{
playlist_t
*
p_playlist
=
pl_Get
(
VLCIntf
);
var_AddCallback
(
p_playlist
,
"item-change"
,
PLItemUpdated
,
(
__bridge
void
*
)
self
);
var_AddCallback
(
p_playlist
,
"playlist-item-append"
,
PLItemAppended
,
(
__bridge
void
*
)
self
);
var_AddCallback
(
p_playlist
,
"playlist-item-deleted"
,
PLItemRemoved
,
(
__bridge
void
*
)
self
);
var_AddCallback
(
p_playlist
,
"random"
,
PlaybackModeUpdated
,
(
__bridge
void
*
)
self
);
var_AddCallback
(
p_playlist
,
"repeat"
,
PlaybackModeUpdated
,
(
__bridge
void
*
)
self
);
var_AddCallback
(
p_playlist
,
"loop"
,
PlaybackModeUpdated
,
(
__bridge
void
*
)
self
);
var_AddCallback
(
p_playlist
,
"volume"
,
VolumeUpdated
,
(
__bridge
void
*
)
self
);
var_AddCallback
(
p_playlist
,
"mute"
,
VolumeUpdated
,
(
__bridge
void
*
)
self
);
}
return
self
;
}
-
(
void
)
dealloc
{
playlist_t
*
p_playlist
=
pl_Get
(
VLCIntf
);
var_DelCallback
(
p_playlist
,
"item-change"
,
PLItemUpdated
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_playlist
,
"playlist-item-append"
,
PLItemAppended
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_playlist
,
"playlist-item-deleted"
,
PLItemRemoved
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_playlist
,
"random"
,
PlaybackModeUpdated
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_playlist
,
"repeat"
,
PlaybackModeUpdated
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_playlist
,
"loop"
,
PlaybackModeUpdated
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_playlist
,
"volume"
,
VolumeUpdated
,
(
__bridge
void
*
)
self
);
var_DelCallback
(
p_playlist
,
"mute"
,
VolumeUpdated
,
(
__bridge
void
*
)
self
);
}
-
(
PLModel
*
)
model
{
return
o_model
;
...
...
@@ -284,6 +370,73 @@
[
o_outline_view
reloadData
];
}
-
(
void
)
plItemAppended
:(
NSArray
*
)
o_val
{
int
i_node
=
[[
o_val
firstObject
]
intValue
];
int
i_item
=
[[
o_val
objectAtIndex
:
1
]
intValue
];
[[
self
model
]
addItem
:
i_item
withParentNode
:
i_node
];
// update badge in sidebar
[[[
VLCMain
sharedInstance
]
mainWindow
]
updateWindow
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"VLCMediaKeySupportSettingChanged"
object:
nil
userInfo:
nil
];
}
-
(
void
)
plItemRemoved
:(
NSNumber
*
)
o_val
{
int
i_item
=
[
o_val
intValue
];
[[
self
model
]
removeItem
:
i_item
];
[
self
deletionCompleted
];
// update badge in sidebar
[[[
VLCMain
sharedInstance
]
mainWindow
]
updateWindow
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"VLCMediaKeySupportSettingChanged"
object:
nil
userInfo:
nil
];
}
-
(
void
)
plItemUpdated
{
VLCMain
*
instance
=
[
VLCMain
sharedInstance
];
[[
instance
mainWindow
]
updateName
];
[[
VLCInfo
sharedInstance
]
updateMetadata
];
}
-
(
void
)
playbackModeUpdated
{
playlist_t
*
p_playlist
=
pl_Get
(
VLCIntf
);
bool
loop
=
var_GetBool
(
p_playlist
,
"loop"
);
bool
repeat
=
var_GetBool
(
p_playlist
,
"repeat"
);
VLCMainWindowControlsBar
*
controlsBar
=
(
VLCMainWindowControlsBar
*
)[[[
VLCMain
sharedInstance
]
mainWindow
]
controlsBar
];
VLCMainMenu
*
mainMenu
=
[[
VLCMain
sharedInstance
]
mainMenu
];
if
(
repeat
)
{
[
controlsBar
setRepeatOne
];
[
mainMenu
setRepeatOne
];
}
else
if
(
loop
)
{
[
controlsBar
setRepeatAll
];
[
mainMenu
setRepeatAll
];
}
else
{
[
controlsBar
setRepeatOff
];
[
mainMenu
setRepeatOff
];
}
[
controlsBar
setShuffle
];
[
mainMenu
setShuffle
];
}
-
(
void
)
updateTogglePlaylistState
{
[
self
outlineViewSelectionDidChange
:
NULL
];
}
-
(
void
)
outlineViewSelectionDidChange
:(
NSNotification
*
)
notification
{
// // FIXME: unsafe
...
...
modules/gui/macosx/simple_prefs.m
View file @
db62975c
...
...
@@ -35,6 +35,7 @@
#import <vlc_config_cat.h>
#import "misc.h"
#import "intf.h"
#import "intf-prefs.h"
#import "AppleRemote.h"
#import "CoreInteraction.h"
...
...
@@ -948,9 +949,9 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
/* activate stuff without restart */
if
([
_intf_appleremoteCheckbox
state
]
==
YES
)
[[
[
VLCMain
sharedInstance
]
appleRemoteController
]
startListening
:
[
VLCMain
sharedInstance
]
];
[[
VLCCoreInteraction
sharedInstance
]
startListeningWithAppleRemote
];
else
[[
[
VLCMain
sharedInstance
]
appleRemoteController
]
stopListening
:
[
VLCMain
sharedInstance
]
];
[[
VLCCoreInteraction
sharedInstance
]
stopListeningWithAppleRemote
];
_intfSettingChanged
=
NO
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment