Commit 343baae5 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: implemented the Video category of the SimplePrefs panel. vout module...

macosx: implemented the Video category of the SimplePrefs panel. vout module and display device selectors are left as an exercise for the reader.
parent 429e624c
...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>-145 -8 505 518 0 0 1280 778 </string> <string>113 117 505 518 0 0 1280 778 </string>
<key>IBEditorPositions</key> <key>IBEditorPositions</key>
<dict> <dict>
<key>2311</key> <key>2311</key>
<string>345 417 590 241 0 0 1280 778 </string> <string>345 406 590 264 0 0 1280 778 </string>
<key>2330</key> <key>2330</key>
<string>345 266 590 502 0 0 1280 778 </string> <string>450 263 590 502 0 0 1280 778 </string>
<key>2440</key> <key>2440</key>
<string>179 151 586 376 0 0 1280 778 </string> <string>345 343 590 389 0 0 1280 778 </string>
</dict> </dict>
<key>IBFramework Version</key> <key>IBFramework Version</key>
<string>446.1</string> <string>446.1</string>
...@@ -34,9 +34,10 @@ ...@@ -34,9 +34,10 @@
</array> </array>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>2330</integer>
<integer>2265</integer>
<integer>2311</integer> <integer>2311</integer>
<integer>2440</integer>
<integer>2265</integer>
<integer>2330</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>8S2167</string> <string>8S2167</string>
......
...@@ -393,6 +393,7 @@ static VLCTreeItem *o_root_item = nil; ...@@ -393,6 +393,7 @@ static VLCTreeItem *o_root_item = nil;
p_item = module_GetConfig( p_module, &confsize ); p_item = module_GetConfig( p_module, &confsize );
if( !p_item ) continue; if( !p_item ) continue;
if( !p_item->i_type ) break;
int i_category = -1; int i_category = -1;
int i_subcategory = -1; int i_subcategory = -1;
int i_options = 0; int i_options = 0;
......
...@@ -50,14 +50,17 @@ ...@@ -50,14 +50,17 @@
IBOutlet id o_audio_vol_fld; IBOutlet id o_audio_vol_fld;
IBOutlet id o_audio_vol_sld; IBOutlet id o_audio_vol_sld;
IBOutlet id o_audio_vol_txt; IBOutlet id o_audio_vol_txt;
IBOutlet id o_intf_art_pop; IBOutlet id o_intf_art_pop;
IBOutlet id o_intf_art_txt; IBOutlet id o_intf_art_txt;
IBOutlet id o_intf_embedded_ckb;
IBOutlet id o_intf_fspanel_ckb; IBOutlet id o_intf_fspanel_ckb;
IBOutlet id o_intf_lang_pop; IBOutlet id o_intf_lang_pop;
IBOutlet id o_intf_lang_txt; IBOutlet id o_intf_lang_txt;
IBOutlet id o_intf_meta_ckb; IBOutlet id o_intf_meta_ckb;
IBOutlet id o_intf_network_box; IBOutlet id o_intf_network_box;
IBOutlet id o_intf_view; IBOutlet id o_intf_view;
IBOutlet id o_sprefs_basic_box; IBOutlet id o_sprefs_basic_box;
IBOutlet id o_sprefs_basicFull_matrix; IBOutlet id o_sprefs_basicFull_matrix;
IBOutlet id o_sprefs_cancel_btn; IBOutlet id o_sprefs_cancel_btn;
...@@ -66,16 +69,40 @@ ...@@ -66,16 +69,40 @@
IBOutlet id o_sprefs_save_btn; IBOutlet id o_sprefs_save_btn;
IBOutlet id o_sprefs_win; IBOutlet id o_sprefs_win;
IBOutlet id o_video_black_ckb;
IBOutlet id o_video_device_pop;
IBOutlet id o_video_device_txt;
IBOutlet id o_video_display_box;
IBOutlet id o_video_enable_ckb;
IBOutlet id o_video_fullscreen_ckb;
IBOutlet id o_video_onTop_ckb;
IBOutlet id o_video_output_pop;
IBOutlet id o_video_output_txt;
IBOutlet id o_video_skipFrames_ckb;
IBOutlet id o_video_snap_box;
IBOutlet id o_video_snap_folder_btn;
IBOutlet id o_video_snap_folder_fld;
IBOutlet id o_video_snap_folder_txt;
IBOutlet id o_video_snap_format_pop;
IBOutlet id o_video_snap_format_txt;
IBOutlet id o_video_snap_prefix_fld;
IBOutlet id o_video_snap_prefix_txt;
IBOutlet id o_video_snap_seqnum_ckb;
IBOutlet id o_video_view;
BOOL b_audioSettingChanged; BOOL b_audioSettingChanged;
BOOL b_intfSettingChanged; BOOL b_intfSettingChanged;
BOOL b_videoSettingChanged;
id o_currentlyShownCategoryView; id o_currentlyShownCategoryView;
NSToolbar *o_sprefs_toolbar; NSToolbar *o_sprefs_toolbar;
NSOpenPanel *o_selectFolderPanel;
intf_thread_t *p_intf; intf_thread_t *p_intf;
} }
+ (VLCSimplePrefs *)sharedInstance; + (VLCSimplePrefs *)sharedInstance;
/* toolbar */
- (NSToolbarItem *) toolbar: (NSToolbar *)o_toolbar - (NSToolbarItem *) toolbar: (NSToolbar *)o_toolbar
itemForItemIdentifier: (NSString *)o_itemIdent itemForItemIdentifier: (NSString *)o_itemIdent
willBeInsertedIntoToolbar: (BOOL)b_willBeInserted; willBeInsertedIntoToolbar: (BOOL)b_willBeInserted;
...@@ -102,6 +129,8 @@ ...@@ -102,6 +129,8 @@
- (void)showAudioSettings; - (void)showAudioSettings;
/* video */ /* video */
- (IBAction)videoSettingChanged:(id)sender;
- (void)showVideoSettings;
/* subtitles */ /* subtitles */
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
static NSString* VLCSPrefsToolbarIdentifier = @"Our Simple Preferences Toolbar Identifier"; static NSString* VLCSPrefsToolbarIdentifier = @"Our Simple Preferences Toolbar Identifier";
static NSString* VLCIntfSettingToolbarIdentifier = @"Intf Settings Item Identifier"; static NSString* VLCIntfSettingToolbarIdentifier = @"Intf Settings Item Identifier";
static NSString* VLCAudioSettingToolbarIdentifier = @"Audio Settings Item Identifier"; static NSString* VLCAudioSettingToolbarIdentifier = @"Audio Settings Item Identifier";
static NSString* VLCVideoSettingToolbarIdentifier = @"Video Settings Item Identifier";
@implementation VLCSimplePrefs @implementation VLCSimplePrefs
...@@ -111,35 +112,50 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -111,35 +112,50 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
[o_toolbarItem setEnabled: YES]; [o_toolbarItem setEnabled: YES];
[o_toolbarItem setAutovalidates: YES]; [o_toolbarItem setAutovalidates: YES];
} }
else if( [o_itemIdent isEqual: VLCVideoSettingToolbarIdentifier] )
{
o_toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: o_itemIdent] autorelease];
[o_toolbarItem setLabel: _NS("Video")];
[o_toolbarItem setPaletteLabel: _NS("General Video settings")];
[o_toolbarItem setToolTip: _NS("General Video settings")];
[o_toolbarItem setImage: [NSImage imageNamed: @"spref_cone_Video_64"]];
[o_toolbarItem setTarget: self];
[o_toolbarItem setAction: @selector(showVideoSettings)];
[o_toolbarItem setEnabled: YES];
[o_toolbarItem setAutovalidates: YES];
}
return o_toolbarItem; return o_toolbarItem;
} }
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar - (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar
{ {
return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil]; return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
} }
- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar - (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
{ {
return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil]; return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier, NSToolbarFlexibleSpaceItemIdentifier, nil];
} }
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar - (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{ {
return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, nil]; return [NSArray arrayWithObjects: VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier, nil];
} }
- (void)initStrings - (void)initStrings
{ {
[o_sprefs_reset_btn setEnabled: NO];
msg_Warn( p_intf, "localisation of the simple preferences not implemented!" ); msg_Warn( p_intf, "localisation of the simple preferences not implemented!" );
} }
- (void)resetControls - (void)resetControls
{ {
module_config_t *p_item; module_config_t *p_item;
int i, y; int i, y = 0;
char *psz_tmp; char *psz_tmp;
/********************** /**********************
...@@ -164,6 +180,7 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -164,6 +180,7 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
[o_intf_meta_ckb setState: config_GetInt( p_intf, "fetch-meta" )]; [o_intf_meta_ckb setState: config_GetInt( p_intf, "fetch-meta" )];
[o_intf_fspanel_ckb setState: config_GetInt( p_intf, "macosx-fspanel" )]; [o_intf_fspanel_ckb setState: config_GetInt( p_intf, "macosx-fspanel" )];
[o_intf_embedded_ckb setState: config_GetInt( p_intf, "embeded-video" )];
/****************** /******************
...@@ -209,6 +226,27 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -209,6 +226,27 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
/****************** /******************
* video settings * * video settings *
******************/ ******************/
[o_video_enable_ckb setState: config_GetInt( p_intf, "video" )];
[o_video_fullscreen_ckb setState: config_GetInt( p_intf, "fullscreen" )];
[o_video_onTop_ckb setState: config_GetInt( p_intf, "video-on-top" )];
[o_video_skipFrames_ckb setState: config_GetInt( p_intf, "skip-frames" )];
[o_video_black_ckb setState: config_GetInt( p_intf, "macosx-black" )];
msg_Warn( p_intf, "vout module and display device selectors not implemented!" );
if( config_GetPsz( p_intf, "snapshot-path" ) != NULL )
[o_video_snap_folder_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "snapshot-path" )]];
[o_video_snap_prefix_fld setStringValue: [NSString stringWithUTF8String: config_GetPsz( p_intf, "snapshot-prefix" )]];
[o_video_snap_seqnum_ckb setState: config_GetInt( p_intf, "snapshot-sequential" )];
[o_video_snap_format_pop removeAllItems];
p_item = config_FindConfig( VLC_OBJECT(p_intf), "snapshot-format" );
for( i = 0; p_item->ppsz_list[i] != nil; i++ )
{
[o_video_snap_format_pop addItemWithTitle: [NSString stringWithUTF8String: p_item->ppsz_list[i]]];
if( p_item->value.psz && !strcmp( p_item->value.psz, p_item->ppsz_list[i] ) )
y = i;
}
[o_video_snap_format_pop selectItemAtIndex: y];
/******************* /*******************
* codecs settings * * codecs settings *
...@@ -296,13 +334,17 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -296,13 +334,17 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
config_PutInt( p_intf, "fetch-meta", [o_intf_meta_ckb state] ); config_PutInt( p_intf, "fetch-meta", [o_intf_meta_ckb state] );
config_PutInt( p_intf, "macosx-fspanel", [o_intf_fspanel_ckb state] ); config_PutInt( p_intf, "macosx-fspanel", [o_intf_fspanel_ckb state] );
config_PutInt( p_intf, "video-embeded", [o_intf_embedded_ckb state] );
/* okay, let's save our changes to vlcrc */ /* okay, let's save our changes to vlcrc */
i = config_SaveConfigFile( p_intf, "main" ); i = config_SaveConfigFile( p_intf, "main" );
i = config_SaveConfigFile( p_intf, "macosx" ); i = config_SaveConfigFile( p_intf, "macosx" );
if( i != 0 ) if( i != 0 )
msg_Err( p_intf, "An error occured while saving the Audio settings using SimplePrefs" ); {
msg_Err( p_intf, "An error occured while saving the Interface settings using SimplePrefs" );
i = 0;
}
b_intfSettingChanged = NO; b_intfSettingChanged = NO;
} }
...@@ -345,6 +387,9 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -345,6 +387,9 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
msg_Warn( p_intf, "visualizer not implemented!" ); msg_Warn( p_intf, "visualizer not implemented!" );
/* Last.FM is optional */
if( module_Exists( p_intf, "audioscrobbler" ) )
{
if( [o_audio_last_ckb state] == NSOnState ) if( [o_audio_last_ckb state] == NSOnState )
config_AddIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ); config_AddIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
else else
...@@ -352,6 +397,7 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -352,6 +397,7 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
config_PutPsz( p_intf, "lastfm-username", [[o_audio_lastuser_fld stringValue] UTF8String] ); config_PutPsz( p_intf, "lastfm-username", [[o_audio_lastuser_fld stringValue] UTF8String] );
config_PutPsz( p_intf, "lastfm-password", [[o_audio_lastuser_fld stringValue] UTF8String] ); config_PutPsz( p_intf, "lastfm-password", [[o_audio_lastuser_fld stringValue] UTF8String] );
}
/* okay, let's save our changes to vlcrc */ /* okay, let's save our changes to vlcrc */
i = config_SaveConfigFile( p_intf, "main" ); i = config_SaveConfigFile( p_intf, "main" );
...@@ -359,14 +405,47 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -359,14 +405,47 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
i = i + config_SaveConfigFile( p_intf, "volnorm" ); i = i + config_SaveConfigFile( p_intf, "volnorm" );
if( i != 0 ) if( i != 0 )
{
msg_Err( p_intf, "An error occured while saving the Audio settings using SimplePrefs" ); msg_Err( p_intf, "An error occured while saving the Audio settings using SimplePrefs" );
i = 0;
}
b_audioSettingChanged = NO; b_audioSettingChanged = NO;
} }
/******************
* video settings *
******************/
if( b_videoSettingChanged )
{
config_PutInt( p_intf, "video", [o_video_enable_ckb state] );
config_PutInt( p_intf, "fullscreen", [o_video_fullscreen_ckb state] );
config_PutInt( p_intf, "video-on-top", [o_video_onTop_ckb state] );
config_PutInt( p_intf, "skip-frames", [o_video_skipFrames_ckb state] );
config_PutInt( p_intf, "macosx-black", [o_video_black_ckb state] );
msg_Warn( p_intf, "vout module and display device selectors not implemented!" );
config_PutPsz( p_intf, "snapshot-path", [[o_video_snap_folder_fld stringValue] UTF8String] );
config_PutPsz( p_intf, "snapshot-prefix", [[o_video_snap_prefix_fld stringValue] UTF8String] );
config_PutInt( p_intf, "snapshot-sequential", [o_video_snap_seqnum_ckb state] );
if( [o_video_snap_format_pop indexOfSelectedItem] >= 0 )
config_PutPsz( p_intf, "snapshot-format", [[[o_video_snap_format_pop selectedItem] title] UTF8String] );
i = config_SaveConfigFile( p_intf, "main" );
i = i + config_SaveConfigFile( p_intf, "macosx" );
if( i != 0 )
{
msg_Err( p_intf, "An error occured while saving the Video settings using SimplePrefs" );
i = 0;
}
b_videoSettingChanged = NO;
}
} }
- (void)showSettingsForCategory: (id)o_new_category_view - (void)showSettingsForCategory: (id)o_new_category_view
{ {
msg_Dbg( p_intf, "switching to another category" );
NSRect o_win_rect, o_view_rect, o_old_view_rect; NSRect o_win_rect, o_view_rect, o_old_view_rect;
o_win_rect = [o_sprefs_win frame]; o_win_rect = [o_sprefs_win frame];
o_view_rect = [o_new_category_view frame]; o_view_rect = [o_new_category_view frame];
...@@ -427,4 +506,42 @@ static VLCSimplePrefs *_o_sharedInstance = nil; ...@@ -427,4 +506,42 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
msg_Dbg( p_intf, "showing audio settings" ); msg_Dbg( p_intf, "showing audio settings" );
[self showSettingsForCategory: o_audio_view]; [self showSettingsForCategory: o_audio_view];
} }
- (IBAction)videoSettingChanged:(id)sender
{
if( sender == o_video_snap_folder_btn )
{
o_selectFolderPanel = [[NSOpenPanel alloc] init];
[o_selectFolderPanel setCanChooseDirectories: YES];
[o_selectFolderPanel setCanChooseFiles: NO];
[o_selectFolderPanel setResolvesAliases: YES];
[o_selectFolderPanel setAllowsMultipleSelection: NO];
[o_selectFolderPanel setMessage: _NS("Choose the Folder to save your video snapshots to.")];
[o_selectFolderPanel setCanCreateDirectories: YES];
[o_selectFolderPanel setPrompt: _NS("Choose")];
[o_selectFolderPanel beginSheetForDirectory: nil file: nil modalForWindow: o_sprefs_win
modalDelegate: self
didEndSelector: @selector(savePanelDidEnd:returnCode:contextInfo:)
contextInfo: nil];
}
else
b_videoSettingChanged = YES;
}
- (void)savePanelDidEnd:(NSOpenPanel * )panel returnCode: (int)returnCode contextInfo: (void *)contextInfo
{
if( returnCode == NSOKButton )
{
[o_video_snap_folder_fld setStringValue: [o_selectFolderPanel filename]];
b_videoSettingChanged = YES;
}
[o_selectFolderPanel release];
}
- (void)showVideoSettings
{
msg_Dbg( p_intf, "showing video settings" );
[self showSettingsForCategory: o_video_view];
}
@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