Commit dc7a2831 authored by David Fuhrmann's avatar David Fuhrmann

macosx: modernize CAS panel and code

parent b7167cb3
......@@ -24,106 +24,117 @@
#import <Cocoa/Cocoa.h>
#import "SharedDialogs.h"
@class VLCDropDisabledImageView;
@class VLCDragDropView;
@interface VLCConvertAndSave : NSObject
{
IBOutlet id _window;
IBOutlet id _ok_btn;
IBOutlet id _drop_lbl;
IBOutlet id _drop_image_view;
IBOutlet id _drop_btn;
IBOutlet id _drop_box;
IBOutlet id _profile_lbl;
IBOutlet id _profile_pop;
IBOutlet id _profile_btn;
IBOutlet id _destination_box;
IBOutlet id _destination_lbl;
IBOutlet id _destination_browse_btn;
IBOutlet id _destination_icon_view;
IBOutlet id _destination_filename_lbl;
IBOutlet id _destination_filename_stub_lbl;
IBOutlet id _destination_stream_btn;
IBOutlet id _destination_stream_lbl;
IBOutlet id _destination_itwantafile_btn;
IBOutlet id _destination_itwantastream_btn;
IBOutlet id _destination_itwantafile_view;
IBOutlet id _destination_itwantastream_view;
IBOutlet id _destination_cancel_btn;
IBOutlet id _dropin_view;
IBOutlet id _dropin_icon_view;
IBOutlet id _dropin_media_lbl;
IBOutlet id _customize_panel;
IBOutlet id _customize_ok_btn;
IBOutlet id _customize_cancel_btn;
IBOutlet id _customize_newProfile_btn;
IBOutlet id _customize_tabview;
IBOutlet id _customize_encap_matrix;
IBOutlet id _customize_vid_settings_box;
IBOutlet id _customize_vid_ckb;
IBOutlet id _customize_vid_keep_ckb;
IBOutlet id _customize_vid_codec_lbl;
IBOutlet id _customize_vid_codec_pop;
IBOutlet id _customize_vid_bitrate_lbl;
IBOutlet id _customize_vid_bitrate_fld;
IBOutlet id _customize_vid_framerate_lbl;
IBOutlet id _customize_vid_framerate_fld;
IBOutlet id _customize_vid_res_box;
IBOutlet id _customize_vid_res_lbl;
IBOutlet id _customize_vid_width_lbl;
IBOutlet id _customize_vid_width_fld;
IBOutlet id _customize_vid_height_lbl;
IBOutlet id _customize_vid_height_fld;
IBOutlet id _customize_vid_scale_lbl;
IBOutlet id _customize_vid_scale_pop;
IBOutlet id _customize_aud_settings_box;
IBOutlet id _customize_aud_ckb;
IBOutlet id _customize_aud_keep_ckb;
IBOutlet id _customize_aud_codec_lbl;
IBOutlet id _customize_aud_codec_pop;
IBOutlet id _customize_aud_bitrate_lbl;
IBOutlet id _customize_aud_bitrate_fld;
IBOutlet id _customize_aud_channels_lbl;
IBOutlet id _customize_aud_channels_fld;
IBOutlet id _customize_aud_samplerate_lbl;
IBOutlet id _customize_aud_samplerate_pop;
IBOutlet id _customize_subs_ckb;
IBOutlet id _customize_subs_pop;
IBOutlet id _customize_subs_overlay_ckb;
IBOutlet id _stream_panel;
IBOutlet id _stream_cancel_btn;
IBOutlet id _stream_ok_btn;
IBOutlet id _stream_destination_lbl;
IBOutlet id _stream_announcement_lbl;
IBOutlet id _stream_type_lbl;
IBOutlet id _stream_type_pop;
IBOutlet id _stream_address_lbl;
IBOutlet id _stream_address_fld;
IBOutlet id _stream_ttl_lbl;
IBOutlet id _stream_ttl_fld;
IBOutlet id _stream_ttl_stepper;
IBOutlet id _stream_port_lbl;
IBOutlet id _stream_port_fld;
IBOutlet id _stream_sap_ckb;
IBOutlet id _stream_channel_fld;
IBOutlet id _stream_sdp_matrix;
IBOutlet id _stream_sdp_fld;
IBOutlet id _stream_sdp_browsefile_btn;
}
// main panel
@property (weak) IBOutlet NSWindow *window;
@property (weak) IBOutlet VLCDragDropView *dropBox;
@property (weak) IBOutlet NSTextField *dropLabel;
@property (weak) IBOutlet VLCDropDisabledImageView *dropImage;
@property (weak) IBOutlet NSButton *dropButton;
@property (weak) IBOutlet NSTextField *profileLabel;
@property (weak) IBOutlet NSPopUpButton *profilePopup;
@property (weak) IBOutlet NSButton *customizeButton;
@property (weak) IBOutlet NSTextField *destinationLabel;
@property (weak) IBOutlet NSBox *destinationBox;
@property (weak) IBOutlet NSButton *destinationCancelBtn;
@property (weak) IBOutlet NSButton *destinationStreamButton;
@property (weak) IBOutlet NSButton *destinationFileButton;
@property (weak) IBOutlet NSButton *okButton;
@property (weak) IBOutlet NSView *dropinView;
@property (weak) IBOutlet VLCDropDisabledImageView *dropinIcon;
@property (weak) IBOutlet NSTextField *dropinMediaLabel;
@property (weak) IBOutlet NSView *fileDestinationView;
@property (weak) IBOutlet NSImageView *fileDestinationIcon;
@property (weak) IBOutlet NSTextField *fileDestinationFileName;
@property (weak) IBOutlet NSTextField *fileDestinationFileNameStub;
@property (weak) IBOutlet NSButton *fileDestinationBrowseButton;
@property (weak) IBOutlet NSView *streamDestinationView;
@property (weak) IBOutlet NSTextField *streamDestinationURLLabel;
@property (weak) IBOutlet NSButton *streamDestinationButton;
// customize panel
@property (weak) IBOutlet NSWindow *customizePanel;
@property (weak) IBOutlet NSButton *customizeNewProfileButton;
@property (weak) IBOutlet NSButton *customizeCancelButton;
@property (weak) IBOutlet NSButton *customizeOkButton;
@property (weak) IBOutlet NSTabView *customizeTabView;
@property (weak) IBOutlet NSMatrix *customizeEncapMatrix;
// customize panel: video
@property (weak) IBOutlet NSButton *customizeVidCheckbox;
@property (weak) IBOutlet NSButton *customizeVidKeepCheckbox;
@property (weak) IBOutlet NSBox *customizeVidSettingsBox;
@property (weak) IBOutlet NSTextField *customizeVidCodecLabel;
@property (weak) IBOutlet NSTextField *customizeVidBitrateLabel;
@property (weak) IBOutlet NSTextField *customizeVidFramerateLabel;
@property (weak) IBOutlet NSBox *customizeVidResolutionBox;
@property (weak) IBOutlet NSTextField *customizeVidWidthLabel;
@property (weak) IBOutlet NSTextField *customizeVidHeightLabel;
@property (weak) IBOutlet NSTextField *customizeVidScaleLabel;
@property (weak) IBOutlet NSTextField *customizeVidResLabel;
@property (weak) IBOutlet NSPopUpButton *customizeVidCodecPopup;
@property (weak) IBOutlet NSTextField *customizeVidBitrateField;
@property (weak) IBOutlet NSTextField *customizeVidFramerateField;
@property (weak) IBOutlet NSTextField *customizeVidWidthField;
@property (weak) IBOutlet NSTextField *customizeVidHeightField;
@property (weak) IBOutlet NSPopUpButton *customizeVidScalePopup;
// customize panel: audio
@property (weak) IBOutlet NSButton *customizeAudCheckbox;
@property (weak) IBOutlet NSButton *customizeAudKeepCheckbox;
@property (weak) IBOutlet NSBox *customizeAudSettingsBox;
@property (weak) IBOutlet NSTextField *customizeAudCodecLabel;
@property (weak) IBOutlet NSTextField *customizeAudBitrateLabel;
@property (weak) IBOutlet NSTextField *customizeAudChannelsLabel;
@property (weak) IBOutlet NSTextField *customizeAudSamplerateLabel;
@property (weak) IBOutlet NSPopUpButton *customizeAudCodecPopup;
@property (weak) IBOutlet NSTextField *customizeAudBitrateField;
@property (weak) IBOutlet NSTextField *customizeAudChannelsField;
@property (weak) IBOutlet NSPopUpButton *customizeAudSampleratePopup;
// customize panel: subs
@property (weak) IBOutlet NSButton *customizeSubsCheckbox;
@property (weak) IBOutlet NSButton *customizeSubsOverlayCheckbox;
@property (weak) IBOutlet NSPopUpButton *customizeSubsPopup;
// stream panel
@property (weak) IBOutlet NSWindow *streamPanel;
@property (weak) IBOutlet NSTextField *streamDestinationLabel;
@property (weak) IBOutlet NSTextField *streamTypeLabel;
@property (weak) IBOutlet NSTextField *streamAddressLabel;
@property (weak) IBOutlet NSPopUpButton *streamTypePopup;
@property (weak) IBOutlet NSTextField *streamAddressField;
@property (weak) IBOutlet NSTextField *streamTTLLabel;
@property (weak) IBOutlet NSTextField *streamTTLField;
@property (weak) IBOutlet NSStepper *streamTTLStepper;
@property (weak) IBOutlet NSTextField *streamPortLabel;
@property (weak) IBOutlet NSTextField *streamPortField;
@property (weak) IBOutlet NSTextField *streamAnnouncementLabel;
@property (weak) IBOutlet NSButton *streamSAPCheckbox;
@property (weak) IBOutlet NSTextField *streamChannelField;
@property (weak) IBOutlet NSMatrix *streamSDPMatrix;
@property (weak) IBOutlet NSButton *streamSDPFileBrowseButton;
@property (weak) IBOutlet NSTextField *streamSDPField;
@property (weak) IBOutlet NSButton *streamCancelButton;
@property (weak) IBOutlet NSButton *streamOkButton;
// other properties
@property (readwrite, nonatomic, retain) NSString * MRL;
@property (readwrite, nonatomic, retain) NSString * outputDestination;
@property (readwrite, retain) NSArray * profileNames;
@property (readwrite, retain) NSArray * profileValueList;
@property (readwrite, retain) NSMutableArray * currentProfile;
/* Bindings for field / stepper combis */
// Bindings for field / stepper combis
@property (nonatomic) int vidBitrate;
@property (nonatomic) int vidFramerate;
@property (nonatomic) int audBitrate;
......
......@@ -24,6 +24,8 @@
#import "ConvertAndSave.h"
#import "intf.h"
#import "playlist.h"
#import "misc.h"
#import <vlc_common.h>
#import <vlc_url.h>
......@@ -131,70 +133,73 @@
- (void)awakeFromNib
{
[_window setTitle: _NS("Convert & Stream")];
[_ok_btn setTitle: _NS("Go!")];
[_drop_lbl setStringValue: _NS("Drop media here")];
[_drop_btn setTitle: _NS("Open media...")];
[_profile_lbl setStringValue: _NS("Choose Profile")];
[_profile_btn setTitle: _NS("Customize...")];
[_destination_lbl setStringValue: _NS("Choose Destination")];
[_destination_filename_stub_lbl setStringValue: _NS("Choose an output location")];
[_destination_filename_lbl setHidden: YES];
[_destination_browse_btn setTitle:_NS("Browse...")];
[_destination_stream_btn setTitle:_NS("Setup Streaming...")];
[_destination_stream_lbl setStringValue:@"Select Streaming Method"];
[_destination_itwantafile_btn setTitle:_NS("Save as File")];
[_destination_itwantastream_btn setTitle:_NS("Stream")];
[_destination_cancel_btn setHidden:YES];
[_customize_ok_btn setTitle: _NS("Apply")];
[_customize_cancel_btn setTitle: _NS("Cancel")];
[_customize_newProfile_btn setTitle: _NS("Save as new Profile...")];
[[_customize_tabview tabViewItemAtIndex:0] setLabel: _NS("Encapsulation")];
[[_customize_tabview tabViewItemAtIndex:1] setLabel: _NS("Video codec")];
[[_customize_tabview tabViewItemAtIndex:2] setLabel: _NS("Audio codec")];
[[_customize_tabview tabViewItemAtIndex:3] setLabel: _NS("Subtitles")];
[_customize_tabview selectTabViewItemAtIndex: 0];
[_customize_vid_ckb setTitle: _NS("Video")];
[_customize_vid_keep_ckb setTitle: _NS("Keep original video track")];
[_customize_vid_codec_lbl setStringValue: _NS("Codec")];
[_customize_vid_bitrate_lbl setStringValue: _NS("Bitrate")];
[_customize_vid_framerate_lbl setStringValue: _NS("Frame rate")];
[_customize_vid_res_box setTitle: _NS("Resolution")];
[_customize_vid_res_lbl setStringValue: _NS("You just need to fill one of the three following parameters, VLC will autodetect the other using the original aspect ratio")];
[_customize_vid_width_lbl setStringValue: _NS("Width")];
[_customize_vid_height_lbl setStringValue: _NS("Height")];
[_customize_vid_scale_lbl setStringValue: _NS("Scale")];
[_customize_aud_ckb setTitle: _NS("Audio")];
[_customize_aud_keep_ckb setTitle: _NS("Keep original audio track")];
[_customize_aud_codec_lbl setStringValue: _NS("Codec")];
[_customize_aud_bitrate_lbl setStringValue: _NS("Bitrate")];
[_customize_aud_channels_lbl setStringValue: _NS("Channels")];
[_customize_aud_samplerate_lbl setStringValue: _NS("Samplerate")];
[_customize_subs_ckb setTitle: _NS("Subtitles")];
[_customize_subs_overlay_ckb setTitle: _NS("Overlay subtitles on the video")];
[_stream_ok_btn setTitle: _NS("Apply")];
[_stream_cancel_btn setTitle: _NS("Cancel")];
[_stream_destination_lbl setStringValue:_NS("Stream Destination")];
[_stream_announcement_lbl setStringValue:_NS("Stream Announcement")];
[_stream_type_lbl setStringValue:_NS("Type")];
[_stream_address_lbl setStringValue:_NS("Address")];
[_stream_ttl_lbl setStringValue:_NS("TTL")];
[_stream_ttl_fld setEnabled:NO];
[_stream_ttl_stepper setEnabled:NO];
[_stream_port_lbl setStringValue:_NS("Port")];
[_stream_sap_ckb setStringValue:_NS("SAP Announcement")];
[[_stream_sdp_matrix cellWithTag:0] setTitle:_NS("None")];
[[_stream_sdp_matrix cellWithTag:1] setTitle:_NS("HTTP Announcement")];
[[_stream_sdp_matrix cellWithTag:2] setTitle:_NS("RTSP Announcement")];
[[_stream_sdp_matrix cellWithTag:3] setTitle:_NS("Export SDP as file")];
[_stream_sap_ckb setState:NSOffState];
[_stream_sdp_matrix setEnabled:NO];
[_okButton setTitle: _NS("Go!")];
[_dropLabel setStringValue: _NS("Drop media here")];
[_dropButton setTitle: _NS("Open media...")];
[_profileLabel setStringValue: _NS("Choose Profile")];
[_customizeButton setTitle: _NS("Customize...")];
[_destinationLabel setStringValue: _NS("Choose Destination")];
[_fileDestinationFileNameStub setStringValue: _NS("Choose an output location")];
[_fileDestinationFileName setHidden: YES];
[_fileDestinationBrowseButton setTitle:_NS("Browse...")];
[_streamDestinationButton setTitle:_NS("Setup Streaming...")];
[_streamDestinationURLLabel setStringValue:@"Select Streaming Method"];
[_destinationFileButton setTitle:_NS("Save as File")];
[_destinationStreamButton setTitle:_NS("Stream")];
[_destinationCancelBtn setHidden:YES];
[_customizeOkButton setTitle: _NS("Apply")];
[_customizeCancelButton setTitle: _NS("Cancel")];
[_customizeNewProfileButton setTitle: _NS("Save as new Profile...")];
[[_customizeTabView tabViewItemAtIndex:0] setLabel: _NS("Encapsulation")];
[[_customizeTabView tabViewItemAtIndex:1] setLabel: _NS("Video codec")];
[[_customizeTabView tabViewItemAtIndex:2] setLabel: _NS("Audio codec")];
[[_customizeTabView tabViewItemAtIndex:3] setLabel: _NS("Subtitles")];
[_customizeTabView selectTabViewItemAtIndex: 0];
[_customizeVidCheckbox setTitle: _NS("Video")];
[_customizeVidKeepCheckbox setTitle: _NS("Keep original video track")];
[_customizeVidCodecLabel setStringValue: _NS("Codec")];
[_customizeVidBitrateLabel setStringValue: _NS("Bitrate")];
[_customizeVidFramerateLabel setStringValue: _NS("Frame rate")];
[_customizeVidResolutionBox setTitle: _NS("Resolution")];
[_customizeVidResLabel setStringValue: _NS("You just need to fill one of the three following parameters, VLC will autodetect the other using the original aspect ratio")];
[_customizeVidWidthLabel setStringValue: _NS("Width")];
[_customizeVidHeightLabel setStringValue: _NS("Height")];
[_customizeVidScaleLabel setStringValue: _NS("Scale")];
[_customizeAudCheckbox setTitle: _NS("Audio")];
[_customizeAudKeepCheckbox setTitle: _NS("Keep original audio track")];
[_customizeAudCodecLabel setStringValue: _NS("Codec")];
[_customizeAudBitrateLabel setStringValue: _NS("Bitrate")];
[_customizeAudChannelsLabel setStringValue: _NS("Channels")];
[_customizeAudSamplerateLabel setStringValue: _NS("Samplerate")];
[_customizeSubsCheckbox setTitle: _NS("Subtitles")];
[_customizeSubsOverlayCheckbox setTitle: _NS("Overlay subtitles on the video")];
[_streamOkButton setTitle: _NS("Apply")];
[_streamCancelButton setTitle: _NS("Cancel")];
[_streamDestinationLabel setStringValue:_NS("Stream Destination")];
[_streamAnnouncementLabel setStringValue:_NS("Stream Announcement")];
[_streamTypeLabel setStringValue:_NS("Type")];
[_streamAddressLabel setStringValue:_NS("Address")];
[_streamTTLLabel setStringValue:_NS("TTL")];
[_streamTTLStepper setEnabled:NO];
[_streamPortLabel setStringValue:_NS("Port")];
[_streamSAPCheckbox setStringValue:_NS("SAP Announcement")];
[[_streamSDPMatrix cellWithTag:0] setTitle:_NS("None")];
[[_streamSDPMatrix cellWithTag:1] setTitle:_NS("HTTP Announcement")];
[[_streamSDPMatrix cellWithTag:2] setTitle:_NS("RTSP Announcement")];
[[_streamSDPMatrix cellWithTag:3] setTitle:_NS("Export SDP as file")];
[_streamSAPCheckbox setState:NSOffState];
[_streamSDPMatrix setEnabled:NO];
/* there is no way to hide single cells, so replace the existing ones with empty cells.. */
id blankCell = [[NSCell alloc] init];
[blankCell setEnabled:NO];
[_customize_encap_matrix putCell:blankCell atRow:3 column:1];
[_customize_encap_matrix putCell:blankCell atRow:3 column:2];
[_customize_encap_matrix putCell:blankCell atRow:3 column:3];
[_customizeEncapMatrix putCell:blankCell atRow:3 column:1];
[_customizeEncapMatrix putCell:blankCell atRow:3 column:2];
[_customizeEncapMatrix putCell:blankCell atRow:3 column:3];
/* fetch profiles from defaults */
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
......@@ -215,36 +220,36 @@
[NSArray arrayWithObjects:@"dvbs", @"t140", nil],
nil];
[_customize_vid_codec_pop removeAllItems];
[_customize_vid_scale_pop removeAllItems];
[_customize_aud_codec_pop removeAllItems];
[_customize_aud_samplerate_pop removeAllItems];
[_customize_subs_pop removeAllItems];
[_customize_vid_codec_pop addItemsWithTitles:[_videoCodecs firstObject]];
[_customize_aud_codec_pop addItemsWithTitles:[_audioCodecs firstObject]];
[_customize_subs_pop addItemsWithTitles:[_subsCodecs firstObject]];
[_customize_aud_samplerate_pop addItemWithTitle:@"8000"];
[_customize_aud_samplerate_pop addItemWithTitle:@"11025"];
[_customize_aud_samplerate_pop addItemWithTitle:@"22050"];
[_customize_aud_samplerate_pop addItemWithTitle:@"44100"];
[_customize_aud_samplerate_pop addItemWithTitle:@"48000"];
[_customize_vid_scale_pop addItemWithTitle:@"1"];
[_customize_vid_scale_pop addItemWithTitle:@"0.25"];
[_customize_vid_scale_pop addItemWithTitle:@"0.5"];
[_customize_vid_scale_pop addItemWithTitle:@"0.75"];
[_customize_vid_scale_pop addItemWithTitle:@"1.25"];
[_customize_vid_scale_pop addItemWithTitle:@"1.5"];
[_customize_vid_scale_pop addItemWithTitle:@"1.75"];
[_customize_vid_scale_pop addItemWithTitle:@"2"];
[_ok_btn setEnabled: NO];
[_customizeVidCodecPopup removeAllItems];
[_customizeVidScalePopup removeAllItems];
[_customizeAudCodecPopup removeAllItems];
[_customizeAudSampleratePopup removeAllItems];
[_customizeSubsPopup removeAllItems];
[_customizeVidCodecPopup addItemsWithTitles:[_videoCodecs firstObject]];
[_customizeAudCodecPopup addItemsWithTitles:[_audioCodecs firstObject]];
[_customizeSubsPopup addItemsWithTitles:[_subsCodecs firstObject]];
[_customizeAudSampleratePopup addItemWithTitle:@"8000"];
[_customizeAudSampleratePopup addItemWithTitle:@"11025"];
[_customizeAudSampleratePopup addItemWithTitle:@"22050"];
[_customizeAudSampleratePopup addItemWithTitle:@"44100"];
[_customizeAudSampleratePopup addItemWithTitle:@"48000"];
[_customizeVidScalePopup addItemWithTitle:@"1"];
[_customizeVidScalePopup addItemWithTitle:@"0.25"];
[_customizeVidScalePopup addItemWithTitle:@"0.5"];
[_customizeVidScalePopup addItemWithTitle:@"0.75"];
[_customizeVidScalePopup addItemWithTitle:@"1.25"];
[_customizeVidScalePopup addItemWithTitle:@"1.5"];
[_customizeVidScalePopup addItemWithTitle:@"1.75"];
[_customizeVidScalePopup addItemWithTitle:@"2"];
[_okButton setEnabled: NO];
// setup drop view
[_drop_box enablePlaylistItems];
[_drop_box setDropHandler: self];
[_dropBox enablePlaylistItems];
[_dropBox setDropHandler: self];
[self resetCustomizationSheetBasedOnProfile:[self.profileValueList firstObject]];
}
......@@ -263,7 +268,7 @@
- (IBAction)finalizePanel:(id)sender
{
if (b_streaming) {
if ([[[_stream_type_pop selectedItem] title] isEqualToString:@"HTTP"]) {
if ([[[_streamTypePopup selectedItem] title] isEqualToString:@"HTTP"]) {
NSString *muxformat = [self.currentProfile firstObject];
if ([muxformat isEqualToString:@"wav"] || [muxformat isEqualToString:@"mov"] || [muxformat isEqualToString:@"mp4"] || [muxformat isEqualToString:@"mkv"]) {
NSBeginInformationalAlertSheet(_NS("Invalid container format for HTTP streaming"), _NS("OK"), @"", @"", _window,
......@@ -277,13 +282,13 @@
playlist_t * p_playlist = pl_Get(VLCIntf);
input_item_t *p_input = input_item_New([_MRL UTF8String], [[_dropin_media_lbl stringValue] UTF8String]);
input_item_t *p_input = input_item_New([_MRL UTF8String], [[_dropinMediaLabel stringValue] UTF8String]);
if (!p_input)
return;
input_item_AddOption(p_input, [[self composedOptions] UTF8String], VLC_INPUT_OPTION_TRUSTED);
if (b_streaming)
input_item_AddOption(p_input, [[NSString stringWithFormat:@"ttl=%@", [_stream_ttl_fld stringValue]] UTF8String], VLC_INPUT_OPTION_TRUSTED);
input_item_AddOption(p_input, [[NSString stringWithFormat:@"ttl=%@", [_streamTTLField stringValue]] UTF8String], VLC_INPUT_OPTION_TRUSTED);
int returnValue;
returnValue = playlist_AddInput(p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked);
......@@ -324,7 +329,7 @@
- (IBAction)switchProfile:(id)sender
{
NSUInteger index = [_profile_pop indexOfSelectedItem];
NSUInteger index = [_profilePopup indexOfSelectedItem];
// last index is "custom"
if (index <= ([self.profileValueList count] - 1))
[self resetCustomizationSheetBasedOnProfile:[self.profileValueList objectAtIndex:index]];
......@@ -332,15 +337,15 @@
- (IBAction)customizeProfile:(id)sender
{
[NSApp beginSheet:_customize_panel modalForWindow:_window modalDelegate:self didEndSelector:NULL contextInfo:nil];
[NSApp beginSheet:_customizePanel modalForWindow:_window modalDelegate:self didEndSelector:NULL contextInfo:nil];
}
- (IBAction)closeCustomizationSheet:(id)sender
{
[_customize_panel orderOut:sender];
[NSApp endSheet: _customize_panel];
[_customizePanel orderOut:sender];
[NSApp endSheet: _customizePanel];
if (sender == _customize_ok_btn)
if (sender == _customizeOkButton)
[self updateCurrentProfile];
}
......@@ -354,7 +359,7 @@
[panel setOKButtonLabel: _NS("Save")];
[panel setTarget:self];
[panel runModalForWindow:_customize_panel];
[panel runModalForWindow:_customizePanel];
}
- (IBAction)deleteProfileAction:(id)sender
......@@ -373,44 +378,44 @@
- (IBAction)iWantAFile:(id)sender
{
NSRect boxFrame = [_destination_box frame];
NSRect subViewFrame = [_destination_itwantafile_view frame];
NSRect boxFrame = [_destinationBox frame];
NSRect subViewFrame = [_fileDestinationView frame];
subViewFrame.origin.x = (boxFrame.size.width - subViewFrame.size.width) / 2;
subViewFrame.origin.y = ((boxFrame.size.height - subViewFrame.size.height) / 2) - 15.;
[_destination_itwantafile_view setFrame: subViewFrame];
[[_destination_itwantafile_btn animator] setHidden: YES];
[[_destination_itwantastream_btn animator] setHidden: YES];
[_destination_box performSelector:@selector(addSubview:) withObject:_destination_itwantafile_view afterDelay:0.2];
[[_destination_cancel_btn animator] setHidden:NO];
[_fileDestinationView setFrame: subViewFrame];
[[_destinationFileButton animator] setHidden: YES];
[[_destinationStreamButton animator] setHidden: YES];
[_destinationBox performSelector:@selector(addSubview:) withObject:_fileDestinationView afterDelay:0.2];
[[_destinationCancelBtn animator] setHidden:NO];
b_streaming = NO;
[_ok_btn setTitle:_NS("Save")];
[_okButton setTitle:_NS("Save")];
}
- (IBAction)iWantAStream:(id)sender
{
NSRect boxFrame = [_destination_box frame];
NSRect subViewFrame = [_destination_itwantastream_view frame];
NSRect boxFrame = [_destinationBox frame];
NSRect subViewFrame = [_streamDestinationView frame];
subViewFrame.origin.x = (boxFrame.size.width - subViewFrame.size.width) / 2;
subViewFrame.origin.y = ((boxFrame.size.height - subViewFrame.size.height) / 2) - 15.;
[_destination_itwantastream_view setFrame: subViewFrame];
[[_destination_itwantafile_btn animator] setHidden: YES];
[[_destination_itwantastream_btn animator] setHidden: YES];
[_destination_box performSelector:@selector(addSubview:) withObject:_destination_itwantastream_view afterDelay:0.2];
[[_destination_cancel_btn animator] setHidden:NO];
[_streamDestinationView setFrame: subViewFrame];
[[_destinationFileButton animator] setHidden: YES];
[[_destinationStreamButton animator] setHidden: YES];
[_destinationBox performSelector:@selector(addSubview:) withObject:_streamDestinationView afterDelay:0.2];
[[_destinationCancelBtn animator] setHidden:NO];
b_streaming = YES;
[_ok_btn setTitle:_NS("Stream")];
[_okButton setTitle:_NS("Stream")];
}
- (IBAction)cancelDestination:(id)sender
{
if ([_destination_itwantastream_view superview] != nil)
[_destination_itwantastream_view removeFromSuperview];
if ([_destination_itwantafile_view superview] != nil)
[_destination_itwantafile_view removeFromSuperview];
[_destination_cancel_btn setHidden:YES];
[[_destination_itwantafile_btn animator] setHidden: NO];
[[_destination_itwantastream_btn animator] setHidden: NO];
if ([_streamDestinationView superview] != nil)
[_streamDestinationView removeFromSuperview];
if ([_fileDestinationView superview] != nil)
[_fileDestinationView removeFromSuperview];
[_destinationCancelBtn setHidden:YES];
[[_destinationFileButton animator] setHidden: NO];
[[_destinationStreamButton animator] setHidden: NO];
b_streaming = NO;
}
......@@ -419,18 +424,18 @@
NSSavePanel * saveFilePanel = [NSSavePanel savePanel];
[saveFilePanel setCanSelectHiddenExtension: YES];
[saveFilePanel setCanCreateDirectories: YES];
if ([[_customize_encap_matrix selectedCell] tag] != RAW) // there is no clever guess for this
if ([[_customizeEncapMatrix selectedCell] tag] != RAW) // there is no clever guess for this
[saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:[self currentEncapsulationFormatAsFileExtension:YES]]];
[saveFilePanel beginSheetModalForWindow:_window completionHandler:^(NSInteger returnCode) {
if (returnCode == NSOKButton) {
[self setOutputDestination:[[saveFilePanel URL] path]];
[_destination_filename_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_outputDestination]];
[[_destination_filename_stub_lbl animator] setHidden: YES];
[[_destination_filename_lbl animator] setHidden: NO];
[_fileDestinationFileName setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_outputDestination]];
[[_fileDestinationFileNameStub animator] setHidden: YES];
[[_fileDestinationFileName animator] setHidden: NO];
} else {
[self setOutputDestination:@""];
[[_destination_filename_lbl animator] setHidden: YES];
[[_destination_filename_stub_lbl animator] setHidden: NO];
[[_fileDestinationFileName animator] setHidden: YES];
[[_fileDestinationFileNameStub animator] setHidden: NO];
}
[self updateOKButton];
}];
......@@ -438,83 +443,83 @@
- (IBAction)showStreamPanel:(id)sender
{
[NSApp beginSheet:_stream_panel modalForWindow:_window modalDelegate:self didEndSelector:NULL contextInfo:nil];
[NSApp beginSheet:_streamPanel modalForWindow:_window modalDelegate:self didEndSelector:NULL contextInfo:nil];
}
- (IBAction)closeStreamPanel:(id)sender
{
[_stream_panel orderOut:sender];
[NSApp endSheet: _stream_panel];
[_streamPanel orderOut:sender];
[NSApp endSheet: _streamPanel];
if (sender == _stream_cancel_btn)
if (sender == _streamCancelButton)
return;
/* provide a summary of the user selections */
NSMutableString * labelContent = [[NSMutableString alloc] initWithFormat:_NS("%@ stream to %@:%@"), [_stream_type_pop titleOfSelectedItem], [_stream_address_fld stringValue], [_stream_port_fld stringValue]];
NSMutableString * labelContent = [[NSMutableString alloc] initWithFormat:_NS("%@ stream to %@:%@"), [_streamTypePopup titleOfSelectedItem], [_streamAddressField stringValue], [_streamPortField stringValue]];
if ([_stream_type_pop indexOfSelectedItem] > 1)
[labelContent appendFormat:@" (\"%@\")", [_stream_channel_fld stringValue]];
if ([_streamTypePopup indexOfSelectedItem] > 1)
[labelContent appendFormat:@" (\"%@\")", [_streamChannelField stringValue]];
[_destination_stream_lbl setStringValue:labelContent];
[_streamDestinationURLLabel setStringValue:labelContent];
/* catch obvious errors */
if (![[_stream_address_fld stringValue] length] > 0) {
if (![[_streamAddressField stringValue] length] > 0) {
NSBeginInformationalAlertSheet(_NS("No Address given"),
_NS("OK"), @"", @"", _stream_panel, nil, nil, nil, nil,
_NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
@"%@", _NS("In order to stream, a valid destination address is required."));
return;
}
if ([_stream_sap_ckb state] && ![[_stream_channel_fld stringValue] length] > 0) {
if ([_streamSAPCheckbox state] && ![[_streamChannelField stringValue] length] > 0) {
NSBeginInformationalAlertSheet(_NS("No Channel Name given"),
_NS("OK"), @"", @"", _stream_panel, nil, nil, nil, nil,
_NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
@"%@", _NS("SAP stream announcement is enabled. However, no channel name is provided."));
return;
}
if ([_stream_sdp_matrix isEnabled] && [_stream_sdp_matrix selectedCell] != [_stream_sdp_matrix cellWithTag:0] && ![[_stream_sdp_fld stringValue] length] > 0) {
if ([_streamSDPMatrix isEnabled] && [_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0] && ![[_streamSDPField stringValue] length] > 0) {
NSBeginInformationalAlertSheet(_NS("No SDP URL given"),
_NS("OK"), @"", @"", _stream_panel, nil, nil, nil, nil,
_NS("OK"), @"", @"", _streamPanel, nil, nil, nil, nil,
@"%@", _NS("A SDP export is requested, but no URL is provided."));
return;
}
/* store destination for further reference and update UI */
[self setOutputDestination: [_stream_address_fld stringValue]];
[self setOutputDestination: [_streamAddressField stringValue]];
[self updateOKButton];
}
- (IBAction)streamTypeToggle:(id)sender
{
NSUInteger index = [_stream_type_pop indexOfSelectedItem];
NSUInteger index = [_streamTypePopup indexOfSelectedItem];
if (index <= 1) { // HTTP, MMSH
[_stream_ttl_fld setEnabled:NO];
[_stream_ttl_stepper setEnabled:NO];
[_stream_sap_ckb setEnabled:NO];
[_stream_sdp_matrix setEnabled:NO];
[_streamTTLField setEnabled:NO];
[_streamTTLStepper setEnabled:NO];
[_streamSAPCheckbox setEnabled:NO];
[_streamSDPMatrix setEnabled:NO];
} else if (index == 2) { // RTP
[_stream_ttl_fld setEnabled:YES];
[_stream_ttl_stepper setEnabled:YES];
[_stream_sap_ckb setEnabled:YES];
[_stream_sdp_matrix setEnabled:YES];
[_streamTTLField setEnabled:YES];
[_streamTTLStepper setEnabled:YES];
[_streamSAPCheckbox setEnabled:YES];
[_streamSDPMatrix setEnabled:YES];
} else { // UDP
[_stream_ttl_fld setEnabled:YES];
[_stream_ttl_stepper setEnabled:YES];
[_stream_sap_ckb setEnabled:YES];
[_stream_sdp_matrix setEnabled:NO];
[_streamTTLField setEnabled:YES];
[_streamTTLStepper setEnabled:YES];
[_streamSAPCheckbox setEnabled:YES];
[_streamSDPMatrix setEnabled:NO];
}
[self streamAnnouncementToggle:sender];
}
- (IBAction)streamAnnouncementToggle:(id)sender
{
[_stream_channel_fld setEnabled:[_stream_sap_ckb state] && [_stream_sap_ckb isEnabled]];
[_stream_sdp_fld setEnabled:[_stream_sdp_matrix isEnabled] && ([_stream_sdp_matrix selectedCell] != [_stream_sdp_matrix cellWithTag:0])];
[_streamChannelField setEnabled:[_streamSAPCheckbox state] && [_streamSAPCheckbox isEnabled]];
[_streamSDPField setEnabled:[_streamSDPMatrix isEnabled] && ([_streamSDPMatrix selectedCell] != [_streamSDPMatrix cellWithTag:0])];
if ([[_stream_sdp_matrix selectedCell] tag] == 3)
[_stream_sdp_browsefile_btn setEnabled: YES];