Commit d276418d authored by Goran Dokic's avatar Goran Dokic Committed by Felix Paul Kühne

macosx: add status bar menu

Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent e08420e5
...@@ -160,6 +160,7 @@ EXTRA_DIST += \ ...@@ -160,6 +160,7 @@ EXTRA_DIST += \
extras/package/macosx/Resources/English.lproj/TextfieldPanel.xib \ extras/package/macosx/Resources/English.lproj/TextfieldPanel.xib \
extras/package/macosx/Resources/English.lproj/TimeSelectionPanel.xib \ extras/package/macosx/Resources/English.lproj/TimeSelectionPanel.xib \
extras/package/macosx/Resources/English.lproj/VideoEffects.xib \ extras/package/macosx/Resources/English.lproj/VideoEffects.xib \
extras/package/macosx/Resources/English.lproj/VLCStatusBarIconMainMenu.xib \
extras/package/macosx/Resources/fspanel/fs_background.png \ extras/package/macosx/Resources/fspanel/fs_background.png \
extras/package/macosx/Resources/fspanel/fs_background@2x.png \ extras/package/macosx/Resources/fspanel/fs_background@2x.png \
extras/package/macosx/Resources/fspanel/fs_exit_fullscreen.png \ extras/package/macosx/Resources/fspanel/fs_exit_fullscreen.png \
...@@ -855,6 +856,14 @@ EXTRA_DIST += \ ...@@ -855,6 +856,14 @@ EXTRA_DIST += \
extras/package/macosx/Resources/sidebar-icons_yosemite/ys-sidebar-playlist@2x.png \ extras/package/macosx/Resources/sidebar-icons_yosemite/ys-sidebar-playlist@2x.png \
extras/package/macosx/Resources/sidebar-icons_yosemite/ys-sidebar-podcast.png \ extras/package/macosx/Resources/sidebar-icons_yosemite/ys-sidebar-podcast.png \
extras/package/macosx/Resources/sidebar-icons_yosemite/ys-sidebar-podcast@2x.png \ extras/package/macosx/Resources/sidebar-icons_yosemite/ys-sidebar-podcast@2x.png \
extras/package/macosx/Resources/vlcmenubaricon/pauseIcon.png \
extras/package/macosx/Resources/vlcmenubaricon/pauseIcon@2x.png \
extras/package/macosx/Resources/vlcmenubaricon/playIcon.png \
extras/package/macosx/Resources/vlcmenubaricon/playIcon@2x.png \
extras/package/macosx/Resources/vlcmenubaricon/statusBarIcon.png \
extras/package/macosx/Resources/vlcmenubaricon/statusBarIcon@2x.png \
extras/package/macosx/Resources/vlcmenubaricon/stopIcon.png \
extras/package/macosx/Resources/vlcmenubaricon/stopIcon@2x.png \
extras/package/macosx/Resources/vlc.scriptSuite \ extras/package/macosx/Resources/vlc.scriptSuite \
extras/package/macosx/Resources/vlc.scriptTerminology \ extras/package/macosx/Resources/vlc.scriptTerminology \
extras/package/macosx/ub.sh \ extras/package/macosx/ub.sh \
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1509" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCStatusBarIcon">
<connections>
<outlet property="vlcStatusBarIconMenu" destination="534" id="O0F-8Q-FgA"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="420" customClass="NSFontManager"/>
<menu id="534" userLabel="vlcStatusBarIconMenu">
<items>
<menuItem title="Show Main WIndow" toolTip="Restore main window" id="08C-TA-yqu">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="restoreMainWindow:" target="-2" id="2Uq-Pa-toi"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="t2X-zn-Z4x"/>
<menuItem title="Play" tag="74747" toolTip="Start/Pause playback" id="9kC-yJ-Gy5">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="statusBarIconTogglePlayPause:" target="-2" id="py3-sd-ST2"/>
</connections>
</menuItem>
<menuItem title="Stop" tag="83838" toolTip="Stop playback" id="4Sh-MJ-bSf">
<connections>
<action selector="statusBarIconStop:" target="-2" id="unT-d5-vlC"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="b5S-aL-b79"/>
<menuItem title="Next" toolTip="Next track in playlist" id="GhQ-VQ-jtu">
<connections>
<action selector="statusBarIconNext:" target="-2" id="VZh-xB-5IC"/>
</connections>
</menuItem>
<menuItem title="Previous" toolTip="Previous track in playlist" id="iHu-rd-8KL">
<connections>
<action selector="statusBarIconPrevious:" target="-2" id="rNU-Dq-Sot"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="Dn5-wA-WfF"/>
<menuItem title="Random" tag="63636" toolTip="Randomize play order" id="lPi-EL-hoN">
<connections>
<action selector="statusBarIconToggleRandom:" target="-2" id="DyP-Hd-KHG"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="p96-c8-lBM"/>
<menuItem title="Quit" toolTip="Quit VLC" id="539">
<connections>
<action selector="quitAction:" target="-2" id="OJL-0Y-e8i"/>
</connections>
</menuItem>
</items>
<point key="canvasLocation" x="328.5" y="267.5"/>
</menu>
</objects>
</document>
...@@ -74,5 +74,6 @@ libmacosx_plugin_la_SOURCES = \ ...@@ -74,5 +74,6 @@ libmacosx_plugin_la_SOURCES = \
VLCTimeSelectionPanelController.h VLCTimeSelectionPanelController.m \ VLCTimeSelectionPanelController.h VLCTimeSelectionPanelController.m \
VLCUIWidgets.h VLCUIWidgets.m \ VLCUIWidgets.h VLCUIWidgets.m \
VLCScrollingClipView.h VLCScrollingClipView.m \ VLCScrollingClipView.h VLCScrollingClipView.m \
VLCStatusBarIcon.h VLCStatusBarIcon.m \
VLCVoutWindowController.h VLCVoutWindowController.m \ VLCVoutWindowController.h VLCVoutWindowController.m \
Windows.h Windows.m Windows.h Windows.m
/*****************************************************************************
* VLCStatusBarIcon.h: Mac OS X module for vlc
*****************************************************************************
* Copyright (C) 2001-2016 VLC authors and VideoLAN
* $Id$
*
* Authors: Goran Dokic <vlc at 8hz 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 <cocoa/cocoa.h>
@interface VLCStatusBarIcon : NSObject <NSMenuDelegate>
{
NSMenuItem *_vlcStatusBarMenuItem;
NSString *_nameToDisplay;
NSString *_timeToDisplay;
NSString *_durationToDisplay;
NSString *_urlToDisplay;
NSImage *_menuImagePlay;
NSImage *_menuImagePause;
NSImage *_menuImageStop;
}
@property NSStatusItem *statusItem;
@property NSTimer *dataRefreshUpdateTimer;
@property (readwrite, strong) IBOutlet NSMenu *vlcStatusBarIconMenu;
// get data from VLC and update the little status menu
- (void) updateMenuItemRandom;
- (void) updateMenuItemPlayPause;
- (void) setDataUpdateTimer:(float) interval;
- (IBAction) updateMenuItemContent:(id)sender;
- (IBAction) restoreMainWindow:(id)sender;
- (IBAction) statusBarIconTogglePlayPause:(id)sender;
- (IBAction) statusBarIconStop:(id)sender;
- (IBAction) statusBarIconNext:(id)sender;
- (IBAction) statusBarIconPrevious:(id)sender;
- (IBAction) statusBarIconToggleRandom:(id)sender;
@end
This diff is collapsed.
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#import "misc.h" #import "misc.h"
#import "MainWindow.h" #import "MainWindow.h"
#import "VLCVoutWindowController.h" #import "VLCVoutWindowController.h"
#import "VLCStatusBarIcon.h"
#import "StringUtility.h" #import "StringUtility.h"
/***************************************************************************** /*****************************************************************************
...@@ -72,6 +73,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -72,6 +73,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
@class VLCConvertAndSave; @class VLCConvertAndSave;
@class ExtensionsManager; @class ExtensionsManager;
@class VLCInfo; @class VLCInfo;
@class VLCStatusBarIcon;
@interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate> @interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
...@@ -93,6 +95,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -93,6 +95,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (ResumeDialogController *)resumeDialog; - (ResumeDialogController *)resumeDialog;
- (VLCInputManager *)inputManager; - (VLCInputManager *)inputManager;
- (ExtensionsManager *)extensionsManager; - (ExtensionsManager *)extensionsManager;
- (VLCStatusBarIcon *)statusBarIcon;
- (VLCDebugMessageVisualizer *)debugMsgPanel; - (VLCDebugMessageVisualizer *)debugMsgPanel;
......
...@@ -95,6 +95,11 @@ int OpenIntf (vlc_object_t *p_this) ...@@ -95,6 +95,11 @@ int OpenIntf (vlc_object_t *p_this)
[VLCMain sharedInstance]; [VLCMain sharedInstance];
[NSBundle loadNibNamed:@"MainMenu" owner:[[VLCMain sharedInstance] mainMenu]]; [NSBundle loadNibNamed:@"MainMenu" owner:[[VLCMain sharedInstance] mainMenu]];
// if statusbar enabled in preferences
if (config_GetInt(p_intf, "macosx-statusicon"))
{
[NSBundle loadNibNamed:@"VLCStatusBarIconMainMenu" owner:[[VLCMain sharedInstance] statusBarIcon]];
}
[[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil]; [[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil];
msg_Dbg(p_intf, "Finished loading macosx interface"); msg_Dbg(p_intf, "Finished loading macosx interface");
...@@ -173,6 +178,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -173,6 +178,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
VLCInputManager *_input_manager; VLCInputManager *_input_manager;
VLCPlaylist *_playlist; VLCPlaylist *_playlist;
VLCDebugMessageVisualizer *_messagePanelController; VLCDebugMessageVisualizer *_messagePanelController;
VLCStatusBarIcon *_statusBarIcon;
VLCTrackSynchronization *_trackSyncPanel; VLCTrackSynchronization *_trackSyncPanel;
VLCAudioEffects *_audioEffectsPanel; VLCAudioEffects *_audioEffectsPanel;
VLCVideoEffects *_videoEffectsPanel; VLCVideoEffects *_videoEffectsPanel;
...@@ -226,6 +232,12 @@ static VLCMain *sharedInstance = nil; ...@@ -226,6 +232,12 @@ static VLCMain *sharedInstance = nil;
_coredialogs = [[VLCCoreDialogProvider alloc] init]; _coredialogs = [[VLCCoreDialogProvider alloc] init];
_mainmenu = [[VLCMainMenu alloc] init]; _mainmenu = [[VLCMainMenu alloc] init];
// if statusbar enabled in preferences
if (config_GetInt(p_intf, "macosx-statusicon")) {
_statusBarIcon = [[VLCStatusBarIcon alloc] init];
}
_voutController = [[VLCVoutWindowController alloc] init]; _voutController = [[VLCVoutWindowController alloc] init];
_playlist = [[VLCPlaylist alloc] init]; _playlist = [[VLCPlaylist alloc] init];
...@@ -507,6 +519,11 @@ static VLCMain *sharedInstance = nil; ...@@ -507,6 +519,11 @@ static VLCMain *sharedInstance = nil;
return _mainmenu; return _mainmenu;
} }
- (VLCStatusBarIcon *)statusBarIcon
{
return _statusBarIcon;
}
- (VLCMainWindow *)mainWindow - (VLCMainWindow *)mainWindow
{ {
return (VLCMainWindow *)[_mainWindowController window]; return (VLCMainWindow *)[_mainWindowController window];
......
...@@ -79,6 +79,9 @@ void WindowClose (vout_window_t *); ...@@ -79,6 +79,9 @@ void WindowClose (vout_window_t *);
#define USE_APPLE_REMOTE_VOLUME_TEXT N_("Control system volume with the Apple Remote") #define USE_APPLE_REMOTE_VOLUME_TEXT N_("Control system volume with the Apple Remote")
#define USE_APPLE_REMOTE_VOLUME_LONGTEXT N_("By default, VLC will control its own volume with the Apple Remote. However, you can choose to control the global system volume instead.") #define USE_APPLE_REMOTE_VOLUME_LONGTEXT N_("By default, VLC will control its own volume with the Apple Remote. However, you can choose to control the global system volume instead.")
#define DISPLAY_STATUS_ICONMENU_TEXT N_("Display VLC status menu icon")
#define DISPLAY_STATUS_ICONMENU_LONGTEXT N_("By default, VLC will show the statusbar icon menu. However, you can choose to disable it (restart required).")
#define USE_APPLE_REMOTE_PREVNEXT_TEXT N_("Control playlist items with the Apple Remote") #define USE_APPLE_REMOTE_PREVNEXT_TEXT N_("Control playlist items with the Apple Remote")
#define USE_APPLE_REMOTE_PREVNEXT_LONGTEXT N_("By default, VLC will allow you to switch to the next or previous item with the Apple Remote. You can disable this behavior with this option.") #define USE_APPLE_REMOTE_PREVNEXT_LONGTEXT N_("By default, VLC will allow you to switch to the next or previous item with the Apple Remote. You can disable this behavior with this option.")
...@@ -156,6 +159,7 @@ vlc_module_begin() ...@@ -156,6 +159,7 @@ vlc_module_begin()
set_section(N_("Appearance"), 0) set_section(N_("Appearance"), 0)
add_bool("macosx-interfacestyle", false, INTERFACE_STYLE_TEXT, INTERFACE_STYLE_LONGTEXT, false) add_bool("macosx-interfacestyle", false, INTERFACE_STYLE_TEXT, INTERFACE_STYLE_LONGTEXT, false)
add_bool("macosx-nativefullscreenmode", false, NATIVE_FULLSCREEN_MODE_ON_LION_TEXT, NATIVE_FULLSCREEN_MODE_ON_LION_LONGTEXT, false) add_bool("macosx-nativefullscreenmode", false, NATIVE_FULLSCREEN_MODE_ON_LION_TEXT, NATIVE_FULLSCREEN_MODE_ON_LION_LONGTEXT, false)
add_bool("macosx-statusicon", true, DISPLAY_STATUS_ICONMENU_TEXT, DISPLAY_STATUS_ICONMENU_LONGTEXT, false)
add_bool("macosx-icon-change", true, ICONCHANGE_TEXT, ICONCHANGE_LONGTEXT, true) add_bool("macosx-icon-change", true, ICONCHANGE_TEXT, ICONCHANGE_LONGTEXT, true)
add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false) add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false)
add_bool("macosx-show-playmode-buttons", false, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false) add_bool("macosx-show-playmode-buttons", false, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false)
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
@property (readwrite, weak) IBOutlet NSButton *intf_appleremoteCheckbox; @property (readwrite, weak) IBOutlet NSButton *intf_appleremoteCheckbox;
@property (readwrite, weak) IBOutlet NSButton *intf_mediakeysCheckbox; @property (readwrite, weak) IBOutlet NSButton *intf_mediakeysCheckbox;
@property (readwrite, weak) IBOutlet NSButton *intf_appleremote_sysvolCheckbox; @property (readwrite, weak) IBOutlet NSButton *intf_appleremote_sysvolCheckbox;
@property (readwrite, weak) IBOutlet NSButton *intf_statusIconCheckbox;
// intf pane - behaviour box // intf pane - behaviour box
@property (readwrite, weak) IBOutlet NSBox *intf_playbackBehaviourBox; @property (readwrite, weak) IBOutlet NSBox *intf_playbackBehaviourBox;
......
...@@ -373,6 +373,7 @@ create_toolbar_item(NSString *itemIdent, NSString *name, NSString *desc, NSStrin ...@@ -373,6 +373,7 @@ create_toolbar_item(NSString *itemIdent, NSString *name, NSString *desc, NSStrin
[_intf_appleremoteCheckbox setTitle: _NS("Control playback with the Apple Remote")]; [_intf_appleremoteCheckbox setTitle: _NS("Control playback with the Apple Remote")];
[_intf_mediakeysCheckbox setTitle: _NS("Control playback with media keys")]; [_intf_mediakeysCheckbox setTitle: _NS("Control playback with media keys")];
[_intf_appleremote_sysvolCheckbox setTitle: _NS("Control system volume with the Apple Remote")]; [_intf_appleremote_sysvolCheckbox setTitle: _NS("Control system volume with the Apple Remote")];
[_intf_statusIconCheckbox setTitle: _NS("Display VLC status menu icon")];
[_intf_playbackBehaviourBox setTitle:_NS("Playback behaviour")]; [_intf_playbackBehaviourBox setTitle:_NS("Playback behaviour")];
[_intf_enableNotificationsCheckbox setTitle: _NS("Enable notifications on playlist item change")]; [_intf_enableNotificationsCheckbox setTitle: _NS("Enable notifications on playlist item change")];
...@@ -577,6 +578,7 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam ...@@ -577,6 +578,7 @@ static inline char * __config_GetLabel(vlc_object_t *p_this, const char *psz_nam
[self setupButton:_intf_continueplaybackPopup forIntList: "macosx-continue-playback"]; [self setupButton:_intf_continueplaybackPopup forIntList: "macosx-continue-playback"];
[self setupButton:_intf_appleremoteCheckbox forBoolValue: "macosx-appleremote"]; [self setupButton:_intf_appleremoteCheckbox forBoolValue: "macosx-appleremote"];
[self setupButton:_intf_appleremote_sysvolCheckbox forBoolValue: "macosx-appleremote-sysvol"]; [self setupButton:_intf_appleremote_sysvolCheckbox forBoolValue: "macosx-appleremote-sysvol"];
[self setupButton:_intf_statusIconCheckbox forBoolValue: "macosx-statusicon"];
[self setupButton:_intf_mediakeysCheckbox forBoolValue: "macosx-mediakeys"]; [self setupButton:_intf_mediakeysCheckbox forBoolValue: "macosx-mediakeys"];
[self setupButton:_video_nativeFullscreenCheckbox forBoolValue: "macosx-nativefullscreenmode"]; [self setupButton:_video_nativeFullscreenCheckbox forBoolValue: "macosx-nativefullscreenmode"];
...@@ -918,9 +920,9 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha ...@@ -918,9 +920,9 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
config_PutInt(p_intf, "metadata-network-access", [_intf_artCheckbox state]); config_PutInt(p_intf, "metadata-network-access", [_intf_artCheckbox state]);
config_PutInt(p_intf, "macosx-appleremote", [_intf_appleremoteCheckbox state]); config_PutInt(p_intf, "macosx-appleremote", [_intf_appleremoteCheckbox state]);
config_PutInt(p_intf, "macosx-appleremote-sysvol", [_intf_appleremote_sysvolCheckbox state]); config_PutInt(p_intf, "macosx-appleremote-sysvol", [_intf_appleremote_sysvolCheckbox state]);
config_PutInt(p_intf, "macosx-statusicon", [_intf_statusIconCheckbox state]);
config_PutInt(p_intf, "macosx-mediakeys", [_intf_mediakeysCheckbox state]); config_PutInt(p_intf, "macosx-mediakeys", [_intf_mediakeysCheckbox state]);
config_PutInt(p_intf, "macosx-interfacestyle", [_intf_style_darkButtonCell state]); config_PutInt(p_intf, "macosx-interfacestyle", [_intf_style_darkButtonCell state]);
......
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