[vlc-commits] macosx: remove information panel singleton
Felix Paul Kühne
git at videolan.org
Mon Jul 1 14:05:25 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon Jul 1 14:04:02 2019 +0200| [e5e2dc67d656ac781678f50f6f46ed23da7df5cb] | committer: Felix Paul Kühne
macosx: remove information panel singleton
This way, we can create infinite numbers of the panel to show information both for queued and playing files
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5e2dc67d656ac781678f50f6f46ed23da7df5cb
---
modules/gui/macosx/UI/MediaInfo.xib | 4 +-
modules/gui/macosx/main/VLCMain.h | 2 -
modules/gui/macosx/main/VLCMain.m | 10 ---
modules/gui/macosx/menus/VLCMainMenu.m | 4 +-
.../macosx/panels/VLCInformationWindowController.m | 82 ++++++++++++----------
.../macosx/windows/video/VLCVideoOutputProvider.m | 1 -
6 files changed, 49 insertions(+), 54 deletions(-)
diff --git a/modules/gui/macosx/UI/MediaInfo.xib b/modules/gui/macosx/UI/MediaInfo.xib
index a2e5c99fb7..f9b5da7f33 100644
--- a/modules/gui/macosx/UI/MediaInfo.xib
+++ b/modules/gui/macosx/UI/MediaInfo.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
diff --git a/modules/gui/macosx/main/VLCMain.h b/modules/gui/macosx/main/VLCMain.h
index b03d0767f4..0a9a7d2c66 100644
--- a/modules/gui/macosx/main/VLCMain.h
+++ b/modules/gui/macosx/main/VLCMain.h
@@ -44,7 +44,6 @@ extern NSString *VLCConfigurationChangedNotification;
* VLCMain interface
*****************************************************************************/
@class VLCExtensionsManager;
- at class VLCInformationWindowController;
@class VLCMainMenu;
@class VLCResumeDialogController;
@class VLCSimplePrefsController;
@@ -74,7 +73,6 @@ extern NSString *VLCConfigurationChangedNotification;
@property (readonly) VLCConvertAndSaveWindowController *convertAndSaveWindow;
@property (readonly) VLCCoreDialogProvider *coreDialogProvider;
@property (readonly) VLCExtensionsManager *extensionsManager;
- at property (readonly) VLCInformationWindowController *currentMediaInfoPanel;
@property (readonly) VLCLogWindowController *debugMsgPanel;
@property (readonly) VLCLibraryController *libraryController;
@property (readonly) VLCLibraryWindow *libraryWindow;
diff --git a/modules/gui/macosx/main/VLCMain.m b/modules/gui/macosx/main/VLCMain.m
index fb3e215462..e8c4497eed 100644
--- a/modules/gui/macosx/main/VLCMain.m
+++ b/modules/gui/macosx/main/VLCMain.m
@@ -59,7 +59,6 @@
#import "panels/dialogs/VLCCoreDialogProvider.h"
#import "panels/VLCAudioEffectsWindowController.h"
#import "panels/VLCBookmarksWindowController.h"
-#import "panels/VLCInformationWindowController.h"
#import "panels/VLCVideoEffectsWindowController.h"
#import "panels/VLCTrackSynchronizationWindowController.h"
@@ -115,7 +114,6 @@ NSString *VLCConfigurationChangedNotification = @"VLCConfigurationChangedNotific
VLCAudioEffectsWindowController *_audioEffectsPanel;
VLCVideoEffectsWindowController *_videoEffectsPanel;
VLCConvertAndSaveWindowController *_convertAndSaveWindow;
- VLCInformationWindowController *_currentMediaInfoPanel;
VLCLibraryWindowController *_libraryWindowController;
VLCClickerManager *_clickerManager;
@@ -452,14 +450,6 @@ static VLCMain *sharedInstance = nil;
return _videoEffectsPanel;
}
-- (VLCInformationWindowController *)currentMediaInfoPanel;
-{
- if (!_currentMediaInfoPanel)
- _currentMediaInfoPanel = [[VLCInformationWindowController alloc] init];
-
- return _currentMediaInfoPanel;
-}
-
- (VLCBookmarksWindowController *)bookmarks
{
if (!_bookmarks)
diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m
index e208db4929..a4142747e1 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.m
+++ b/modules/gui/macosx/menus/VLCMainMenu.m
@@ -1423,7 +1423,9 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
- (IBAction)showInformationPanel:(id)sender
{
- [[[VLCMain sharedInstance] currentMediaInfoPanel] toggleWindow:sender];
+ VLCInformationWindowController *informationController = [[VLCInformationWindowController alloc] init];
+ informationController.representedInputItem = _playlistController.currentlyPlayingInputItem;
+ [informationController toggleWindow:sender];
}
#pragma mark - playback state
diff --git a/modules/gui/macosx/panels/VLCInformationWindowController.m b/modules/gui/macosx/panels/VLCInformationWindowController.m
index 10f8d61f80..4019098f0d 100644
--- a/modules/gui/macosx/panels/VLCInformationWindowController.m
+++ b/modules/gui/macosx/panels/VLCInformationWindowController.m
@@ -102,6 +102,8 @@
} else {
[self initMediaPanelStats];
}
+
+ [self updateRepresentation];
}
- (void)initStrings
@@ -150,7 +152,7 @@
- (void)updateCocoaWindowLevel:(NSNotification *)aNotification
{
NSInteger windowLevel = [aNotification.userInfo[VLCWindowLevelKey] integerValue];
- if (self.isWindowLoaded && [self.window isVisible] && [self.window level] != windowLevel)
+ if ([self.window isVisible] && [self.window level] != windowLevel)
[self.window setLevel: windowLevel];
}
@@ -194,10 +196,47 @@
{
_representedInputItem = representedInputItem;
- [_saveMetaDataButton setEnabled: NO];
+ [self updateRepresentation];
+}
+
+- (void)updateStatistics:(NSNotification *)aNotification
+{
+ if (!_statisticsEnabled)
+ return;
+
+ if (![self.window isVisible])
+ return;
- if (!self.isWindowLoaded)
+ VLCInputStats *inputStats = aNotification.userInfo[VLCPlayerInputStats];
+ if (!inputStats) {
+ [self initMediaPanelStats];
return;
+ }
+
+ /* input */
+ [_readBytesTextField setStringValue: [NSString stringWithFormat:
+ @"%8.0f KiB", (float)(inputStats.inputReadBytes)/1024]];
+ [_inputBitrateTextField setStringValue: [NSString stringWithFormat:
+ @"%6.0f kb/s", (float)(inputStats.inputBitrate)*8000]];
+ [_demuxBytesTextField setStringValue: [NSString stringWithFormat:
+ @"%8.0f KiB", (float)(inputStats.demuxReadBytes)/1024]];
+ [_demuxBitrateTextField setStringValue: [NSString stringWithFormat:
+ @"%6.0f kb/s", (float)(inputStats.demuxBitrate)*8000]];
+
+ /* Video */
+ [_videoDecodedTextField setIntegerValue: inputStats.decodedVideo];
+ [_displayedTextField setIntegerValue: inputStats.displayedPictures];
+ [_lostFramesTextField setIntegerValue: inputStats.lostPictures];
+
+ /* Audio */
+ [_audioDecodedTextField setIntegerValue: inputStats.decodedAudio];
+ [_playedAudioBuffersTextField setIntegerValue: inputStats.playedAudioBuffers];
+ [_lostAudioBuffersTextField setIntegerValue: inputStats.lostAudioBuffers];
+}
+
+- (void)updateRepresentation
+{
+ [_saveMetaDataButton setEnabled: NO];
if (!_representedInputItem) {
/* Erase */
@@ -220,9 +259,11 @@
[_imageWell setImage: [NSImage imageNamed: @"noart.png"]];
} else {
if (!_representedInputItem.preparsed) {
+ NSLog(@"item wasn't preparsed");
[_representedInputItem preparseInputItem];
}
+ NSLog(@"%s: %@ - %@ - %@", __PRETTY_FUNCTION__, _representedInputItem.title, _representedInputItem.MRL, _uriTextField);
_uriTextField.stringValue = _representedInputItem.MRL;
_titleTextField.stringValue = _representedInputItem.title;
_authorTextField.stringValue = _representedInputItem.artist;
@@ -252,41 +293,6 @@
[self updateStreamsList];
}
-- (void)updateStatistics:(NSNotification *)aNotification
-{
- if (!self.isWindowLoaded || !_statisticsEnabled)
- return;
-
- if (![self.window isVisible])
- return;
-
- VLCInputStats *inputStats = aNotification.userInfo[VLCPlayerInputStats];
- if (!inputStats) {
- [self initMediaPanelStats];
- return;
- }
-
- /* input */
- [_readBytesTextField setStringValue: [NSString stringWithFormat:
- @"%8.0f KiB", (float)(inputStats.inputReadBytes)/1024]];
- [_inputBitrateTextField setStringValue: [NSString stringWithFormat:
- @"%6.0f kb/s", (float)(inputStats.inputBitrate)*8000]];
- [_demuxBytesTextField setStringValue: [NSString stringWithFormat:
- @"%8.0f KiB", (float)(inputStats.demuxReadBytes)/1024]];
- [_demuxBitrateTextField setStringValue: [NSString stringWithFormat:
- @"%6.0f kb/s", (float)(inputStats.demuxBitrate)*8000]];
-
- /* Video */
- [_videoDecodedTextField setIntegerValue: inputStats.decodedVideo];
- [_displayedTextField setIntegerValue: inputStats.displayedPictures];
- [_lostFramesTextField setIntegerValue: inputStats.lostPictures];
-
- /* Audio */
- [_audioDecodedTextField setIntegerValue: inputStats.decodedAudio];
- [_playedAudioBuffersTextField setIntegerValue: inputStats.playedAudioBuffers];
- [_lostAudioBuffersTextField setIntegerValue: inputStats.lostAudioBuffers];
-}
-
- (void)updateStreamsList
{
_rootCodecInformationItem = [[VLCCodecInformationTreeItem alloc] init];
diff --git a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
index 928928c58f..2d8a5b799e 100644
--- a/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
+++ b/modules/gui/macosx/windows/video/VLCVideoOutputProvider.m
@@ -39,7 +39,6 @@
#import "panels/dialogs/VLCResumeDialogController.h"
#import "panels/VLCVideoEffectsWindowController.h"
#import "panels/VLCAudioEffectsWindowController.h"
-#import "panels/VLCInformationWindowController.h"
#import "panels/VLCBookmarksWindowController.h"
#import "panels/VLCTrackSynchronizationWindowController.h"
More information about the vlc-commits
mailing list