From a8498fbde2938c6bff0ed89bd2b4410e27fb64a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= Date: Wed, 15 Jul 2015 19:14:46 +0200 Subject: [PATCH] macosx/playlistinfo: remove object instance from xib file and set it up the proper way --- .../Resources/English.lproj/MediaInfo.xib | 1188 +++++++++-------- modules/gui/macosx/playlistinfo.h | 127 +- modules/gui/macosx/playlistinfo.m | 279 ++-- 3 files changed, 798 insertions(+), 796 deletions(-) diff --git a/extras/package/macosx/Resources/English.lproj/MediaInfo.xib b/extras/package/macosx/Resources/English.lproj/MediaInfo.xib index 344c9a4a5c55..e601c8faf3cc 100644 --- a/extras/package/macosx/Resources/English.lproj/MediaInfo.xib +++ b/extras/package/macosx/Resources/English.lproj/MediaInfo.xib @@ -2,13 +2,13 @@ 1060 - 14B25 - 6254 - 1343.16 - 755.00 + 14E46 + 7706 + 1348.17 + 758.70 com.apple.InterfaceBuilder.CocoaPlugin - 6254 + 7706 NSBox @@ -37,7 +37,7 @@ - NSObject + VLCInfo FirstResponder @@ -45,9 +45,6 @@ NSApplication - - VLCInfo - 8215 2 @@ -64,6 +61,9 @@ 268 + + public.item + {{-28, -11}, {562, 482}} @@ -78,6 +78,7 @@ 268 + {{37, 396}, {468, 19}} @@ -142,7 +143,7 @@ 268 {{37, 18}, {468, 19}} - + YES -2073034687 @@ -819,7 +820,7 @@ -2147483392 {{1, 420}, {501, 15}} - + NO _doScroller: @@ -1535,7 +1536,7 @@ {{135, 15}, {89, 14}} - + YES 68157504 @@ -1611,6 +1612,7 @@ 0 YES YES + @@ -1619,8 +1621,9 @@ {506, 476} + - {{0, 0}, {1680, 1050}} + {{0, 0}, {2560, 1417}} {10000000000000, 10000000000000} mediainfo YES @@ -1630,611 +1633,603 @@ - o_info_window - + infoPanel + - 232 + 651 - o_image_well - - - - 345 - - - - saveMetaData: - - + authorLabel + + - 416 + 652 - o_saveMetaData_btn - - - - 417 - - - - metaFieldChanged: - - + authorTextField + + - 447 + 653 - o_title_txt - - + dateTextField + + - 448 + 655 - o_title_lbl - - + dateLabel + + - 449 + 656 - o_author_txt - - + copyrightLabel + + - 450 + 658 - o_author_lbl - - - - 451 - - - - metaFieldChanged: - - - - 452 - - - - metaFieldChanged: - - + copyrightTextField + + - 453 + 659 - o_collection_lbl - - + encodedbyLabel + + - 454 + 660 - o_collection_txt - - + encodedbyTextField + + - 455 + 661 - o_date_txt - - + genreLabel + + - 456 + 662 - o_date_lbl - - + genreTextField + + - 457 + 663 - o_seqNum_txt - - + imageWell + + - 458 + 664 - o_seqNum_lbl - - - - 459 - - - - metaFieldChanged: - - + languageLabel + + - 460 + 665 - - metaFieldChanged: - + + languageTextField + - 470 + 666 - o_genre_txt - - + nowPlayingLabel + + - 471 + 667 - o_genre_lbl - - + nowPlayingTextField + + - 472 + 668 - o_language_txt - - + publisherLabel + + - 473 + 669 - o_language_lbl - - - - 474 - - - - metaFieldChanged: - - - - 475 - - - - metaFieldChanged: - - - - 480 - - - - metaFieldChanged: - + publisherTextField + - 485 + 670 - - metaFieldChanged: - - + + saveMetaDataButton + + - 490 + 671 - o_publisher_lbl - - + seqNumLabel + + - 491 + 672 - o_publisher_txt - - + seqNumTextField + + - 492 + 673 - o_nowPlaying_lbl - - + tabView + + - 493 + 674 - o_nowPlaying_txt - - + titleLabel + + - 494 + 675 - o_copyright_lbl - - + titleTextField + + - 495 + 676 - o_copyright_txt - - + uriLabel + + - 496 + 677 - - metaFieldChanged: - - + + uriTextField + + - 501 + 678 - o_description_lbl - + descriptionLabel + - 502 + 679 - o_description_txt - + descriptionTextField + - 503 - - - - metaFieldChanged: - - - - 508 + 680 - o_uri_txt - - + collectionLabel + + - 514 + 681 - o_uri_lbl - - + collectionTextField + + - 515 + 682 - o_outline_view - + outlineView + - 525 + 683 - o_audio_decoded_lbl - + audioDecodedLabel + - 609 + 684 - o_audio_decoded_txt - + audioDecodedTextField + - 610 + 685 + + + + audioLabel + + + + 686 - o_demux_bytes_lbl - + demuxBytesLabel + - 611 + 687 - o_demux_bytes_txt - + demuxBytesTextField + - 612 + 688 - o_demux_bitrate_lbl - - + inputBitrateLabel + + - 613 + 689 - o_displayed_lbl - - + inputBitrateTextField + + - 615 + 690 - o_displayed_txt - - + inputLabel + + - 616 + 691 - o_input_bitrate_lbl - - + lostAudioBuffersLabel + + - 619 + 692 - o_input_bitrate_txt - - + demuxBitrateLabel + + - 620 + 693 - o_lost_abuffers_lbl - - + demuxBitrateTextField + + - 621 + 694 - o_lost_abuffers_txt - + lostAudioBuffersTextField + - 622 + 695 - o_lost_frames_lbl - + lostFramesLabel + - 623 + 696 - o_lost_frames_txt - + lostFramesTextField + - 624 + 697 - o_played_abuffers_lbl - + playedAudioBuffersLabel + - 625 + 698 - o_played_abuffers_txt - + playedAudioBuffersTextField + - 626 + 699 - o_read_bytes_lbl - + readBytesLabel + - 627 + 700 - o_read_bytes_txt - + readBytesTextField + - 628 + 701 - o_sent_bitrate_lbl - + sentBitrateLabel + - 629 + 702 - o_sent_bitrate_txt - + sentBitrateTextField + - 630 + 703 - o_sent_bytes_lbl - + sentBytesLabel + - 631 + 704 - o_sent_bytes_txt - + sentBytesTextField + - 632 + 705 - o_sent_packets_lbl - + sentPacketsLabel + - 633 + 706 - o_sent_packets_txt - + sentPacketsTextField + - 634 + 707 - o_video_decoded_lbl - - + soutLabel + + - 635 + 708 - o_video_decoded_txt - + video_decodedTextField + - 636 + 710 - o_tab_view - - + videoLabel + + - 637 + 711 - o_sout_lbl - - + displayedLabel + + - 638 + 712 - o_video_lbl - - + displayedTextField + + - 639 + 713 - - o_input_lbl - - + + saveMetaData: + + - 640 + 714 - - o_audio_lbl - - + + metaFieldChanged: + + - 641 + 715 - - o_demux_bitrate_txt - - + + metaFieldChanged: + + - 646 + 716 - - o_encodedby_lbl - - + + metaFieldChanged: + + - 647 + 717 - - o_encodedby_txt - - + + metaFieldChanged: + + - 648 + 718 - - delegate - - + + metaFieldChanged: + + + + 719 + + + + metaFieldChanged: + + + + 720 + + + + metaFieldChanged: + + + + 721 + + + + metaFieldChanged: + + - 528 + 722 + + + + metaFieldChanged: + + + + 723 + + + + metaFieldChanged: + + + + 724 + + + + metaFieldChanged: + + + + 725 + + + + metaFieldChanged: + + + + 726 - dataSource - - + videoDecodedLabel + + - 526 + 727 - delegate - - + videoDecodedTextField + + - 527 + 728 @@ -2263,12 +2258,6 @@ Application - - 1 - - - VLCInfo - 2 @@ -3247,7 +3236,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{357, 196}, {506, 476}} com.apple.InterfaceBuilder.CocoaPlugin @@ -4390,7 +4378,7 @@ - 648 + 728 @@ -4417,312 +4405,312 @@ - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSPanel + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSOutlineView + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSButton + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTextField + NSTabView + NSTextField + NSTextField + NSTextField + NSTextField + id + id + NSTextField - - o_audio_decoded_lbl - id + + audioDecodedLabel + NSTextField - - o_audio_decoded_txt - id + + audioDecodedTextField + NSTextField - - o_audio_lbl - id + + audioLabel + NSTextField - - o_author_lbl - id + + authorLabel + NSTextField - - o_author_txt - id + + authorTextField + NSTextField - - o_collection_lbl - id + + collectionLabel + NSTextField - - o_collection_txt - id + + collectionTextField + NSTextField - - o_copyright_lbl - id + + copyrightLabel + NSTextField - - o_copyright_txt - id + + copyrightTextField + NSTextField - - o_date_lbl - id + + dateLabel + NSTextField - - o_date_txt - id + + dateTextField + NSTextField - - o_demux_bitrate_lbl - id + + demuxBitrateLabel + NSTextField - - o_demux_bitrate_txt - id + + demuxBitrateTextField + NSTextField - - o_demux_bytes_lbl - id + + demuxBytesLabel + NSTextField - - o_demux_bytes_txt - id + + demuxBytesTextField + NSTextField - - o_description_lbl - id + + descriptionLabel + NSTextField - - o_description_txt - id + + descriptionTextField + NSTextField - - o_displayed_lbl - id + + displayedLabel + NSTextField - - o_displayed_txt - id + + displayedTextField + NSTextField - - o_encodedby_lbl - id + + encodedbyLabel + NSTextField - - o_encodedby_txt - id + + encodedbyTextField + NSTextField - - o_genre_lbl - id + + genreLabel + NSTextField - - o_genre_txt - id + + genreTextField + NSTextField - - o_image_well - id + + imageWell + NSTextField - - o_info_window - id + + infoPanel + NSPanel - - o_input_bitrate_lbl - id + + inputBitrateLabel + NSTextField - - o_input_bitrate_txt - id + + inputBitrateTextField + NSTextField - - o_input_lbl - id + + inputLabel + NSTextField - - o_language_lbl - id + + languageLabel + NSTextField - - o_language_txt - id + + languageTextField + NSTextField - - o_lost_abuffers_lbl - id + + lostAudioBuffersLabel + NSTextField - - o_lost_abuffers_txt - id + + lostAudioBuffersTextField + NSTextField - - o_lost_frames_lbl - id + + lostFramesLabel + NSTextField - - o_lost_frames_txt - id + + lostFramesTextField + NSTextField - - o_nowPlaying_lbl - id + + nowPlayingLabel + NSTextField - - o_nowPlaying_txt - id + + nowPlayingTextField + NSTextField - - o_outline_view - id + + outlineView + NSOutlineView - - o_played_abuffers_lbl - id + + playedAudioBuffersLabel + NSTextField - - o_played_abuffers_txt - id + + playedAudioBuffersTextField + NSTextField - - o_publisher_lbl - id + + publisherLabel + NSTextField - - o_publisher_txt - id + + publisherTextField + NSTextField - - o_read_bytes_lbl - id + + readBytesLabel + NSTextField - - o_read_bytes_txt - id + + readBytesTextField + NSTextField - - o_saveMetaData_btn - id + + saveMetaDataButton + NSButton - - o_sent_bitrate_lbl - id + + sentBitrateLabel + NSTextField - - o_sent_bitrate_txt - id + + sentBitrateTextField + NSTextField - - o_sent_bytes_lbl - id + + sentBytesLabel + NSTextField - - o_sent_bytes_txt - id + + sentBytesTextField + NSTextField - - o_sent_packets_lbl - id + + sentPacketsLabel + NSTextField - - o_sent_packets_txt - id + + sentPacketsTextField + NSTextField - - o_seqNum_lbl - id + + seqNumLabel + NSTextField - - o_seqNum_txt - id + + seqNumTextField + NSTextField - - o_sout_lbl - id + + soutLabel + NSTextField - - o_tab_view - id + + tabView + NSTabView - - o_title_lbl - id + + titleLabel + NSTextField - - o_title_txt - id + + titleTextField + NSTextField - - o_uri_lbl - id + + uriLabel + NSTextField - - o_uri_txt - id + + uriTextField + NSTextField - - o_video_decoded_lbl + + videoDecodedLabel id - - o_video_decoded_txt + + videoDecodedTextField id - - o_video_lbl - id + + videoLabel + NSTextField @@ -4830,6 +4818,14 @@ AppKit.framework/Headers/NSMenu.h + + NSOutlineView + NSTableView + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + NSPanel NSWindow @@ -4846,6 +4842,14 @@ AppKit.framework/Headers/NSResponder.h + + NSTabView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSTabView.h + + NSTableColumn NSObject @@ -4854,6 +4858,14 @@ AppKit.framework/Headers/NSTableColumn.h + + NSTableView + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + NSTextField NSControl diff --git a/modules/gui/macosx/playlistinfo.h b/modules/gui/macosx/playlistinfo.h index f717f6426efd..6511a5fdf5aa 100644 --- a/modules/gui/macosx/playlistinfo.h +++ b/modules/gui/macosx/playlistinfo.h @@ -29,73 +29,72 @@ @class VLCInfoTreeItem; @interface VLCInfo : NSObject -{ - IBOutlet id o_info_window; - IBOutlet id o_uri_lbl; - IBOutlet id o_title_lbl; - IBOutlet id o_author_lbl; - IBOutlet id o_uri_txt; - IBOutlet id o_title_txt; - IBOutlet id o_author_txt; - IBOutlet id o_outline_view; - IBOutlet id o_tab_view; +@property (readonly) input_item_t *item; - IBOutlet id o_collection_lbl; - IBOutlet id o_collection_txt; - IBOutlet id o_copyright_lbl; - IBOutlet id o_copyright_txt; - IBOutlet id o_date_lbl; - IBOutlet id o_date_txt; - IBOutlet id o_description_lbl; - IBOutlet id o_description_txt; - IBOutlet id o_encodedby_lbl; - IBOutlet id o_encodedby_txt; - IBOutlet id o_genre_lbl; - IBOutlet id o_genre_txt; - IBOutlet id o_language_lbl; - IBOutlet id o_language_txt; - IBOutlet id o_nowPlaying_lbl; - IBOutlet id o_nowPlaying_txt; - IBOutlet id o_publisher_lbl; - IBOutlet id o_publisher_txt; - IBOutlet id o_seqNum_lbl; - IBOutlet id o_seqNum_txt; - IBOutlet id o_image_well; - IBOutlet id o_saveMetaData_btn; +@property (readwrite, weak) IBOutlet NSPanel *infoPanel; +@property (readwrite, weak) IBOutlet NSOutlineView *outlineView; +@property (readwrite, weak) IBOutlet NSTabView *tabView; - IBOutlet id o_audio_lbl; - IBOutlet id o_audio_decoded_lbl; - IBOutlet id o_audio_decoded_txt; - IBOutlet id o_demux_bitrate_lbl; - IBOutlet id o_demux_bitrate_txt; - IBOutlet id o_demux_bytes_lbl; - IBOutlet id o_demux_bytes_txt; - IBOutlet id o_displayed_lbl; - IBOutlet id o_displayed_txt; - IBOutlet id o_input_bitrate_lbl; - IBOutlet id o_input_bitrate_txt; - IBOutlet id o_input_lbl; - IBOutlet id o_lost_abuffers_lbl; - IBOutlet id o_lost_abuffers_txt; - IBOutlet id o_lost_frames_lbl; - IBOutlet id o_lost_frames_txt; - IBOutlet id o_played_abuffers_lbl; - IBOutlet id o_played_abuffers_txt; - IBOutlet id o_read_bytes_lbl; - IBOutlet id o_read_bytes_txt; - IBOutlet id o_sent_bitrate_lbl; - IBOutlet id o_sent_bitrate_txt; - IBOutlet id o_sent_bytes_lbl; - IBOutlet id o_sent_bytes_txt; - IBOutlet id o_sent_packets_lbl; - IBOutlet id o_sent_packets_txt; - IBOutlet id o_sout_lbl; - IBOutlet id o_video_lbl; - IBOutlet id o_video_decoded_lbl; - IBOutlet id o_video_decoded_txt; -} -@property (readonly) input_item_t *item; +@property (readwrite, weak) IBOutlet NSTextField *uriLabel; +@property (readwrite, weak) IBOutlet NSTextField *titleLabel; +@property (readwrite, weak) IBOutlet NSTextField *authorLabel; +@property (readwrite, weak) IBOutlet NSTextField *uriTextField; +@property (readwrite, weak) IBOutlet NSTextField *titleTextField; +@property (readwrite, weak) IBOutlet NSTextField *authorTextField; +@property (readwrite, weak) IBOutlet NSTextField *collectionLabel; +@property (readwrite, weak) IBOutlet NSTextField *collectionTextField; +@property (readwrite, weak) IBOutlet NSTextField *copyrightLabel; +@property (readwrite, weak) IBOutlet NSTextField *copyrightTextField; +@property (readwrite, weak) IBOutlet NSTextField *dateLabel; +@property (readwrite, weak) IBOutlet NSTextField *dateTextField; +@property (readwrite, weak) IBOutlet NSTextField *descriptionLabel; +@property (readwrite, weak) IBOutlet NSTextField *descriptionTextField; +@property (readwrite, weak) IBOutlet NSTextField *encodedbyLabel; +@property (readwrite, weak) IBOutlet NSTextField *encodedbyTextField; +@property (readwrite, weak) IBOutlet NSTextField *genreLabel; +@property (readwrite, weak) IBOutlet NSTextField *genreTextField; +@property (readwrite, weak) IBOutlet NSTextField *languageLabel; +@property (readwrite, weak) IBOutlet NSTextField *languageTextField; +@property (readwrite, weak) IBOutlet NSTextField *nowPlayingLabel; +@property (readwrite, weak) IBOutlet NSTextField *nowPlayingTextField; +@property (readwrite, weak) IBOutlet NSTextField *publisherLabel; +@property (readwrite, weak) IBOutlet NSTextField *publisherTextField; +@property (readwrite, weak) IBOutlet NSTextField *seqNumLabel; +@property (readwrite, weak) IBOutlet NSTextField *seqNumTextField; +@property (readwrite, weak) IBOutlet NSImageView *imageWell; +@property (readwrite, weak) IBOutlet NSButton *saveMetaDataButton; + +@property (readwrite, weak) IBOutlet NSTextField *audioLabel; +@property (readwrite, weak) IBOutlet NSTextField *audioDecodedLabel; +@property (readwrite, weak) IBOutlet NSTextField *audioDecodedTextField; +@property (readwrite, weak) IBOutlet NSTextField *demuxBitrateLabel; +@property (readwrite, weak) IBOutlet NSTextField *demuxBitrateTextField; +@property (readwrite, weak) IBOutlet NSTextField *demuxBytesLabel; +@property (readwrite, weak) IBOutlet NSTextField *demuxBytesTextField; +@property (readwrite, weak) IBOutlet NSTextField *displayedLabel; +@property (readwrite, weak) IBOutlet NSTextField *displayedTextField; +@property (readwrite, weak) IBOutlet NSTextField *inputBitrateLabel; +@property (readwrite, weak) IBOutlet NSTextField *inputBitrateTextField; +@property (readwrite, weak) IBOutlet NSTextField *inputLabel; +@property (readwrite, weak) IBOutlet NSTextField *lostAudioBuffersLabel; +@property (readwrite, weak) IBOutlet NSTextField *lostAudioBuffersTextField; +@property (readwrite, weak) IBOutlet NSTextField *lostFramesLabel; +@property (readwrite, weak) IBOutlet NSTextField *lostFramesTextField; +@property (readwrite, weak) IBOutlet NSTextField *playedAudioBuffersLabel; +@property (readwrite, weak) IBOutlet NSTextField *playedAudioBuffersTextField; +@property (readwrite, weak) IBOutlet NSTextField *readBytesLabel; +@property (readwrite, weak) IBOutlet NSTextField *readBytesTextField; +@property (readwrite, weak) IBOutlet NSTextField *sentBitrateLabel; +@property (readwrite, weak) IBOutlet NSTextField *sentBitrateTextField; +@property (readwrite, weak) IBOutlet NSTextField *sentBytesLabel; +@property (readwrite, weak) IBOutlet NSTextField *sentBytesTextField; +@property (readwrite, weak) IBOutlet NSTextField *sentPacketsLabel; +@property (readwrite, weak) IBOutlet NSTextField *sentPacketsTextField; +@property (readwrite, weak) IBOutlet NSTextField *soutLabel; +@property (readwrite, weak) IBOutlet NSTextField *videoLabel; +@property (readwrite, weak) IBOutlet NSTextField *videoDecodedLabel; +@property (readwrite, weak) IBOutlet NSTextField *videoDecodedTextField; - (void)updateCocoaWindowLevel:(NSInteger)i_level; - (void)initPanel; diff --git a/modules/gui/macosx/playlistinfo.m b/modules/gui/macosx/playlistinfo.m index b3eb8d292560..8da48fafbec8 100644 --- a/modules/gui/macosx/playlistinfo.m +++ b/modules/gui/macosx/playlistinfo.m @@ -1,5 +1,5 @@ /***************************************************************************** - r playlistinfo.m: MacOS X interface module + * playlistinfo.m: MacOS X interface module ***************************************************************************** * Copyright (C) 2002-2015 VLC authors and VideoLAN * $Id$ @@ -20,11 +20,7 @@ * 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. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ + ******************************************************************************/ #import "CompatibilityFixes.h" #import "intf.h" @@ -32,16 +28,13 @@ #import "playlist.h" #import -/***************************************************************************** - * VLCPlaylistInfo Implementation - *****************************************************************************/ - -@interface VLCInfo () +@interface VLCInfo () { VLCInfoTreeItem *rootItem; input_item_t *p_item; + BOOL b_nibLoaded; BOOL b_awakeFromNib; BOOL b_stats; } @@ -49,85 +42,79 @@ @interface VLCInfo () @implementation VLCInfo -static VLCInfo *_o_sharedInstance = nil; - + (VLCInfo *)sharedInstance { - return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init]; -} - -- (id)init -{ - if (!_o_sharedInstance) { - _o_sharedInstance = [super init]; + static VLCInfo *sharedInstance = nil; + static dispatch_once_t pred; - if (_o_sharedInstance != nil) { - p_item = NULL; - [self updatePanelWithItem: NULL]; - rootItem = [[VLCInfoTreeItem alloc] init]; - } - } + dispatch_once(&pred, ^{ + sharedInstance = [VLCInfo new]; + }); - return _o_sharedInstance; + return sharedInstance; } - (void)awakeFromNib { - [o_info_window setExcludedFromWindowsMenu: YES]; + [_infoPanel setExcludedFromWindowsMenu: YES]; if (!OSX_SNOW_LEOPARD) - [o_info_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary]; + [_infoPanel setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary]; + + [_infoPanel setTitle: _NS("Media Information")]; - [o_info_window setTitle: _NS("Media Information")]; - [o_uri_lbl setStringValue: _NS("Location")]; - [o_title_lbl setStringValue: _NS("Title")]; - [o_author_lbl setStringValue: _NS("Artist")]; - [o_saveMetaData_btn setStringValue: _NS("Save Metadata")]; + _outlineView.dataSource = self; + _outlineView.delegate = self; - [[o_tab_view tabViewItemAtIndex: 0] setLabel: _NS("General")]; - [[o_tab_view tabViewItemAtIndex: 1] setLabel: _NS("Codec Details")]; - [[o_tab_view tabViewItemAtIndex: 2] setLabel: _NS("Statistics")]; - [o_tab_view selectTabViewItemAtIndex: 0]; + [_uriLabel setStringValue: _NS("Location")]; + [_titleLabel setStringValue: _NS("Title")]; + [_authorLabel setStringValue: _NS("Artist")]; + [_saveMetaDataButton setStringValue: _NS("Save Metadata")]; + + [[_tabView tabViewItemAtIndex: 0] setLabel: _NS("General")]; + [[_tabView tabViewItemAtIndex: 1] setLabel: _NS("Codec Details")]; + [[_tabView tabViewItemAtIndex: 2] setLabel: _NS("Statistics")]; + [_tabView selectTabViewItemAtIndex: 0]; /* constants defined in vlc_meta.h */ - [o_genre_lbl setStringValue: _NS(VLC_META_GENRE)]; - [o_copyright_lbl setStringValue: _NS(VLC_META_COPYRIGHT)]; - [o_collection_lbl setStringValue: _NS(VLC_META_ALBUM)]; - [o_seqNum_lbl setStringValue: _NS(VLC_META_TRACK_NUMBER)]; - [o_description_lbl setStringValue: _NS(VLC_META_DESCRIPTION)]; - [o_date_lbl setStringValue: _NS(VLC_META_DATE)]; - [o_language_lbl setStringValue: _NS(VLC_META_LANGUAGE)]; - [o_nowPlaying_lbl setStringValue: _NS(VLC_META_NOW_PLAYING)]; - [o_publisher_lbl setStringValue: _NS(VLC_META_PUBLISHER)]; - [o_encodedby_lbl setStringValue: _NS(VLC_META_ENCODED_BY)]; + [_genreLabel setStringValue: _NS(VLC_META_GENRE)]; + [_copyrightLabel setStringValue: _NS(VLC_META_COPYRIGHT)]; + [_collectionLabel setStringValue: _NS(VLC_META_ALBUM)]; + [_seqNumLabel setStringValue: _NS(VLC_META_TRACK_NUMBER)]; + [_descriptionLabel setStringValue: _NS(VLC_META_DESCRIPTION)]; + [_dateLabel setStringValue: _NS(VLC_META_DATE)]; + [_languageLabel setStringValue: _NS(VLC_META_LANGUAGE)]; + [_nowPlayingLabel setStringValue: _NS(VLC_META_NOW_PLAYING)]; + [_publisherLabel setStringValue: _NS(VLC_META_PUBLISHER)]; + [_encodedbyLabel setStringValue: _NS(VLC_META_ENCODED_BY)]; /* statistics */ - [o_input_lbl setStringValue: _NS("Input")]; - [o_read_bytes_lbl setStringValue: _NS("Read at media")]; - [o_input_bitrate_lbl setStringValue: _NS("Input bitrate")]; - [o_demux_bytes_lbl setStringValue: _NS("Demuxed")]; - [o_demux_bitrate_lbl setStringValue: _NS("Stream bitrate")]; + [_inputLabel setStringValue: _NS("Input")]; + [_readBytesLabel setStringValue: _NS("Read at media")]; + [_inputBitrateLabel setStringValue: _NS("Input bitrate")]; + [_demuxBytesLabel setStringValue: _NS("Demuxed")]; + [_demuxBitrateLabel setStringValue: _NS("Stream bitrate")]; - [o_video_lbl setStringValue: _NS("Video")]; - [o_video_decoded_lbl setStringValue: _NS("Decoded blocks")]; - [o_displayed_lbl setStringValue: _NS("Displayed frames")]; - [o_lost_frames_lbl setStringValue: _NS("Lost frames")]; + [_videoLabel setStringValue: _NS("Video")]; + [_videoDecodedLabel setStringValue: _NS("Decoded blocks")]; + [_displayedLabel setStringValue: _NS("Displayed frames")]; + [_lostFramesLabel setStringValue: _NS("Lost frames")]; - [o_sout_lbl setStringValue: _NS("Streaming")]; - [o_sent_packets_lbl setStringValue: _NS("Sent packets")]; - [o_sent_bytes_lbl setStringValue: _NS("Sent bytes")]; - [o_sent_bitrate_lbl setStringValue: _NS("Send rate")]; + [_soutLabel setStringValue: _NS("Streaming")]; + [_sentPacketsLabel setStringValue: _NS("Sent packets")]; + [_sentBytesLabel setStringValue: _NS("Sent bytes")]; + [_sentBitrateLabel setStringValue: _NS("Send rate")]; - [o_audio_lbl setStringValue: _NS("Audio")]; - [o_audio_decoded_lbl setStringValue: _NS("Decoded blocks")]; - [o_played_abuffers_lbl setStringValue: _NS("Played buffers")]; - [o_lost_abuffers_lbl setStringValue: _NS("Lost buffers")]; + [_audioLabel setStringValue: _NS("Audio")]; + [_audioDecodedLabel setStringValue: _NS("Decoded blocks")]; + [_playedAudioBuffersLabel setStringValue: _NS("Played buffers")]; + [_lostAudioBuffersLabel setStringValue: _NS("Lost buffers")]; - [o_info_window setInitialFirstResponder: o_uri_txt]; + [_infoPanel setInitialFirstResponder: _uriLabel]; b_awakeFromNib = YES; /* We may be awoken from nib way after initialisation - * Update ourselves */ + *Update ourselves */ [self updatePanelWithItem:p_item]; } @@ -140,48 +127,50 @@ - (void)dealloc - (void)updateCocoaWindowLevel:(NSInteger)i_level { - if (o_info_window && [o_info_window isVisible] && [o_info_window level] != i_level) - [o_info_window setLevel: i_level]; + if (_infoPanel && [_infoPanel isVisible] && [_infoPanel level] != i_level) + [_infoPanel setLevel: i_level]; } - (void)initPanel { + if (!b_nibLoaded) + b_nibLoaded = [NSBundle loadNibNamed:@"MediaInfo" owner: self]; + b_stats = var_InheritBool(VLCIntf, "stats"); if (!b_stats) { - if ([o_tab_view numberOfTabViewItems] > 2) - [o_tab_view removeTabViewItem: [o_tab_view tabViewItemAtIndex: 2]]; + if ([_tabView numberOfTabViewItems] > 2) + [_tabView removeTabViewItem: [_tabView tabViewItemAtIndex: 2]]; } else [self initMediaPanelStats]; NSInteger i_level = [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]; - [o_info_window setLevel: i_level]; - [o_info_window makeKeyAndOrderFront:nil]; + [_infoPanel setLevel: i_level]; + [_infoPanel makeKeyAndOrderFront:nil]; } - (void)initMediaPanelStats { //Initializing Input Variables - [o_read_bytes_txt setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]]; - [o_input_bitrate_txt setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]]; - [o_demux_bytes_txt setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]]; - [o_demux_bitrate_txt setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]]; + [_readBytesTextField setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]]; + [_inputBitrateTextField setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]]; + [_demuxBytesTextField setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]]; + [_demuxBitrateTextField setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]]; //Initializing Video Variables - [o_video_decoded_txt setIntValue:0]; - [o_displayed_txt setIntValue:0]; - [o_lost_frames_txt setIntValue:0]; + [_videoDecodedTextField setIntValue:0]; + [_displayedTextField setIntValue:0]; + [_lostFramesTextField setIntValue:0]; //Initializing Output Variables - [o_sent_packets_txt setIntValue: 0]; - [o_sent_bytes_txt setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]]; - [o_sent_bitrate_txt setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]]; + [_sentPacketsTextField setIntValue: 0]; + [_sentBytesTextField setStringValue: [NSString stringWithFormat:_NS("%.1f KiB"), (float)0]]; + [_sentBitrateTextField setStringValue: [NSString stringWithFormat:@"%6.0f kb/s", (float)0]]; //Initializing Audio Variables - [o_audio_decoded_txt setIntValue:0]; - [o_played_abuffers_txt setIntValue: 0]; - [o_lost_abuffers_txt setIntValue: 0]; - + [_audioDecodedTextField setIntValue:0]; + [_playedAudioBuffersTextField setIntValue: 0]; + [_lostAudioBuffersTextField setIntValue: 0]; } - (void)updateMetadata @@ -195,17 +184,21 @@ - (void)updateMetadata - (void)updatePanelWithItem:(input_item_t *)_p_item; { @autoreleasepool { + rootItem = [[VLCInfoTreeItem alloc] init]; + if (_p_item != p_item) { - if (p_item) vlc_gc_decref(p_item); - [o_saveMetaData_btn setEnabled: NO]; - if (_p_item) vlc_gc_incref(_p_item); + if (p_item) + vlc_gc_decref(p_item); + [_saveMetaDataButton setEnabled: NO]; + if (_p_item) + vlc_gc_incref(_p_item); p_item = _p_item; } if (!p_item) { /* Erase */ #define SET( foo ) \ - [self setMeta: "" forLabel: o_##foo##_txt]; + [self setMeta: "" forLabel: _##foo##TextField]; SET( uri ); SET( title ); SET( author ); @@ -220,26 +213,26 @@ - (void)updatePanelWithItem:(input_item_t *)_p_item; SET( description ); SET( encodedby ); #undef SET - [o_image_well setImage: [NSImage imageNamed: @"noart.png"]]; + [_imageWell setImage: [NSImage imageNamed: @"noart.png"]]; } else { if (!input_item_IsPreparsed(p_item)) libvlc_MetaRequest(VLCIntf->p_libvlc, p_item, META_REQUEST_OPTION_NONE); /* fill uri info */ - char * psz_url = decode_URI(input_item_GetURI(p_item)); - [o_uri_txt setStringValue: [NSString stringWithUTF8String:psz_url ? psz_url : ""]]; + char *psz_url = decode_URI(input_item_GetURI(p_item)); + [_uriTextField setStringValue: [NSString stringWithUTF8String:psz_url ? psz_url : ""]]; free(psz_url); /* fill title info */ - char * psz_title = input_item_GetTitle(p_item); + char *psz_title = input_item_GetTitle(p_item); if (!psz_title) psz_title = input_item_GetName(p_item); - [o_title_txt setStringValue: [NSString stringWithUTF8String:psz_title ? : ""]]; + [_titleTextField setStringValue: [NSString stringWithUTF8String:psz_title ? : ""]]; free(psz_title); #define SET( foo, bar ) \ char *psz_##foo = input_item_Get##bar ( p_item ); \ - [self setMeta: psz_##foo forLabel: o_##foo##_txt]; \ + [self setMeta: psz_##foo forLabel: _##foo##TextField]; \ FREENULL( psz_##foo ); /* fill the other fields */ @@ -258,22 +251,22 @@ - (void)updatePanelWithItem:(input_item_t *)_p_item; #undef SET char *psz_meta; - NSImage *o_image; + NSImage *image; psz_meta = input_item_GetArtURL(p_item); /* FIXME Can also be attachment:// */ if (psz_meta && strncmp(psz_meta, "attachment://", 13)) - o_image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString:[NSString stringWithUTF8String:psz_meta]]]; + image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString:[NSString stringWithUTF8String:psz_meta]]]; else - o_image = [NSImage imageNamed: @"noart.png"]; - [o_image_well setImage: o_image]; + image = [NSImage imageNamed: @"noart.png"]; + [_imageWell setImage: image]; FREENULL(psz_meta); } /* reload the advanced table */ [rootItem refresh]; - [o_outline_view reloadData]; - [o_outline_view expandItem:nil expandChildren:YES]; + [_outlineView reloadData]; + [_outlineView expandItem:nil expandChildren:YES]; /* update the stats once to display p_item change faster */ [self updateStatistics]; @@ -293,7 +286,7 @@ - (void)updateStatistics if (!b_awakeFromNib || !b_stats) return; - if ([o_info_window isVisible]) { + if ([_infoPanel isVisible]) { if (!p_item || !p_item->p_stats) { [self initMediaPanelStats]; return; @@ -302,31 +295,31 @@ - (void)updateStatistics vlc_mutex_lock(&p_item->p_stats->lock); /* input */ - [o_read_bytes_txt setStringValue: [NSString stringWithFormat: + [_readBytesTextField setStringValue: [NSString stringWithFormat: @"%8.0f KiB", (float)(p_item->p_stats->i_read_bytes)/1024]]; - [o_input_bitrate_txt setStringValue: [NSString stringWithFormat: + [_inputBitrateTextField setStringValue: [NSString stringWithFormat: @"%6.0f kb/s", (float)(p_item->p_stats->f_input_bitrate)*8000]]; - [o_demux_bytes_txt setStringValue: [NSString stringWithFormat: + [_demuxBytesTextField setStringValue: [NSString stringWithFormat: @"%8.0f KiB", (float)(p_item->p_stats->i_demux_read_bytes)/1024]]; - [o_demux_bitrate_txt setStringValue: [NSString stringWithFormat: + [_demuxBitrateTextField setStringValue: [NSString stringWithFormat: @"%6.0f kb/s", (float)(p_item->p_stats->f_demux_bitrate)*8000]]; /* Video */ - [o_video_decoded_txt setIntValue: p_item->p_stats->i_decoded_video]; - [o_displayed_txt setIntValue: p_item->p_stats->i_displayed_pictures]; - [o_lost_frames_txt setIntValue: p_item->p_stats->i_lost_pictures]; + [_videoDecodedTextField setIntValue: p_item->p_stats->i_decoded_video]; + [_displayedTextField setIntValue: p_item->p_stats->i_displayed_pictures]; + [_lostFramesTextField setIntValue: p_item->p_stats->i_lost_pictures]; /* Sout */ - [o_sent_packets_txt setIntValue: p_item->p_stats->i_sent_packets]; - [o_sent_bytes_txt setStringValue: [NSString stringWithFormat: @"%8.0f KiB", + [_sentPacketsTextField setIntValue: p_item->p_stats->i_sent_packets]; + [_sentBytesTextField setStringValue: [NSString stringWithFormat: @"%8.0f KiB", (float)(p_item->p_stats->i_sent_bytes)/1024]]; - [o_sent_bitrate_txt setStringValue: [NSString stringWithFormat: + [_sentBitrateTextField setStringValue: [NSString stringWithFormat: @"%6.0f kb/s", (float)(p_item->p_stats->f_send_bitrate*8)*1000]]; /* Audio */ - [o_audio_decoded_txt setIntValue: p_item->p_stats->i_decoded_audio]; - [o_played_abuffers_txt setIntValue: p_item->p_stats->i_played_abuffers]; - [o_lost_abuffers_txt setIntValue: p_item->p_stats->i_lost_abuffers]; + [_audioDecodedTextField setIntValue: p_item->p_stats->i_decoded_audio]; + [_playedAudioBuffersTextField setIntValue: p_item->p_stats->i_played_abuffers]; + [_lostAudioBuffersTextField setIntValue: p_item->p_stats->i_lost_abuffers]; vlc_mutex_unlock(&p_item->p_stats->lock); } @@ -334,7 +327,7 @@ - (void)updateStatistics - (IBAction)metaFieldChanged:(id)sender { - [o_saveMetaData_btn setEnabled: YES]; + [_saveMetaDataButton setEnabled: YES]; } - (IBAction)saveMetaData:(id)sender @@ -342,28 +335,28 @@ - (IBAction)saveMetaData:(id)sender if (!p_item) goto error; - #define utf8( o_blub ) \ - [[o_blub stringValue] UTF8String] - - input_item_SetName( p_item, utf8( o_title_txt ) ); - input_item_SetTitle( p_item, utf8( o_title_txt ) ); - input_item_SetArtist( p_item, utf8( o_author_txt ) ); - input_item_SetAlbum( p_item, utf8( o_collection_txt ) ); - input_item_SetGenre( p_item, utf8( o_genre_txt ) ); - input_item_SetTrackNum( p_item, utf8( o_seqNum_txt ) ); - input_item_SetDate( p_item, utf8( o_date_txt ) ); - input_item_SetCopyright( p_item, utf8( o_copyright_txt ) ); - input_item_SetPublisher( p_item, utf8( o_publisher_txt ) ); - input_item_SetDescription( p_item, utf8( o_description_txt ) ); - input_item_SetLanguage( p_item, utf8( o_language_txt ) ); - - playlist_t * p_playlist = pl_Get(VLCIntf); + #define utf8( _blub ) \ + [[_blub stringValue] UTF8String] + + input_item_SetName( p_item, utf8( _titleTextField ) ); + input_item_SetTitle( p_item, utf8( _titleTextField ) ); + input_item_SetArtist( p_item, utf8( _authorTextField ) ); + input_item_SetAlbum( p_item, utf8( _collectionTextField ) ); + input_item_SetGenre( p_item, utf8( _genreTextField ) ); + input_item_SetTrackNum( p_item, utf8( _seqNumTextField ) ); + input_item_SetDate( p_item, utf8( _dateTextField ) ); + input_item_SetCopyright( p_item, utf8( _copyrightTextField ) ); + input_item_SetPublisher( p_item, utf8( _publisherTextField ) ); + input_item_SetDescription( p_item, utf8( _descriptionTextField ) ); + input_item_SetLanguage( p_item, utf8( _languageTextField ) ); + + playlist_t *p_playlist = pl_Get(VLCIntf); input_item_WriteMeta(VLC_OBJECT(p_playlist), p_item); var_SetBool(p_playlist, "intf-change", true); [self updatePanelWithItem: p_item]; - [o_saveMetaData_btn setEnabled: NO]; + [_saveMetaDataButton setEnabled: NO]; return; error: @@ -374,7 +367,7 @@ - (IBAction)saveMetaData:(id)sender - (IBAction)downloadCoverArt:(id)sender { - playlist_t * p_playlist = pl_Get(VLCIntf); + playlist_t *p_playlist = pl_Get(VLCIntf); if (p_item) libvlc_ArtRequest(VLCIntf->p_libvlc, p_item, META_REQUEST_OPTION_NONE); } @@ -388,11 +381,9 @@ - (input_item_t *)item @implementation VLCInfo (NSMenuValidation) -- (BOOL)validateMenuItem:(NSMenuItem *)o_mi +- (BOOL)validateMenuItem:(NSMenuItem *)mi { - BOOL bEnabled = TRUE; - - if ([[o_mi title] isEqualToString: _NS("Information")]) { + if ([[mi title] isEqualToString: _NS("Information")]) { return ![[[VLCMain sharedInstance] playlist] isSelectionEmpty]; } @@ -430,7 +421,7 @@ - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTabl @interface VLCInfoTreeItem () { int i_object_id; - input_item_t * p_item; + input_item_t *p_item; VLCInfoTreeItem *_parent; NSMutableArray *_children; BOOL _isALeafNode; @@ -452,7 +443,7 @@ - (id)initWithName:(NSString *)item_name _value = [item_value copy]; i_object_id = i_id; _parent = parent_item; - p_item = [(VLCInfo *)[[VLCMain sharedInstance] info] item]; + p_item = [[VLCInfo sharedInstance] item]; } return self; } @@ -469,7 +460,7 @@ - (void)dealloc } /* Creates and returns the array of children - * Loads children incrementally */ + *Loads children incrementally */ - (void)_updateChildren { if (!p_item) @@ -499,7 +490,7 @@ - (void)_updateChildren } else if (_parent->i_object_id == -1) { vlc_mutex_lock(&p_item->lock); - info_category_t * cat = p_item->pp_categories[i_object_id]; + info_category_t *cat = p_item->pp_categories[i_object_id]; for (int i = 0 ; i < cat->i_infos ; i++) { NSString *name; NSString *value;