[vlc-commits] macosx: add detached audio playback window

Felix Paul Kühne git at videolan.org
Wed Oct 30 16:17:37 CET 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue Oct 29 09:30:56 2019 +0100| [c3da5bdfc9aec5a08bb7714bf8af1c59a184f35d] | committer: Felix Paul Kühne

macosx: add detached audio playback window

This implements #2886.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c3da5bdfc9aec5a08bb7714bf8af1c59a184f35d
---

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |   8 +
 modules/gui/macosx/Makefile.am                     |   3 +
 modules/gui/macosx/UI/VLCDetachedAudioWindow.xib   | 175 +++++++++++++++++++++
 modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib |  34 ++--
 modules/gui/macosx/menus/VLCStatusBarIcon.h        |   1 +
 modules/gui/macosx/menus/VLCStatusBarIcon.m        |  14 ++
 .../gui/macosx/windows/VLCDetachedAudioWindow.h    |  40 +++++
 .../gui/macosx/windows/VLCDetachedAudioWindow.m    |  89 +++++++++++
 po/POTFILES.in                                     |   2 +
 9 files changed, 352 insertions(+), 14 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 2a3dcdcb9d..e437332b11 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -175,6 +175,7 @@
 		7DFBDCBE226CED7200B700A5 /* VLCMediaSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DFBDCBD226CED7200B700A5 /* VLCMediaSource.m */; };
 		7DFBDCC1226DC16200B700A5 /* VLCInputItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DFBDCC0226DC16200B700A5 /* VLCInputItem.m */; };
 		7DFBDCC4226E445500B700A5 /* VLCMediaSourceBaseDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DFBDCC3226E445500B700A5 /* VLCMediaSourceBaseDataSource.m */; };
+		7DFFF90123682D4800C8B0C9 /* VLCDetachedAudioWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DFFF90023682D4800C8B0C9 /* VLCDetachedAudioWindow.m */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -600,6 +601,9 @@
 		7DFBDCC0226DC16200B700A5 /* VLCInputItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCInputItem.m; sourceTree = "<group>"; };
 		7DFBDCC2226E445500B700A5 /* VLCMediaSourceBaseDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMediaSourceBaseDataSource.h; sourceTree = "<group>"; };
 		7DFBDCC3226E445500B700A5 /* VLCMediaSourceBaseDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMediaSourceBaseDataSource.m; sourceTree = "<group>"; };
+		7DFFF8FE23682CE400C8B0C9 /* VLCDetachedAudioWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VLCDetachedAudioWindow.xib; sourceTree = "<group>"; };
+		7DFFF8FF23682D4800C8B0C9 /* VLCDetachedAudioWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCDetachedAudioWindow.h; sourceTree = "<group>"; };
+		7DFFF90023682D4800C8B0C9 /* VLCDetachedAudioWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCDetachedAudioWindow.m; sourceTree = "<group>"; };
 		8E49720006417F6800370C9F /* VLCInformationWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCInformationWindowController.h; sourceTree = "<group>"; };
 		8E49720106417F6800370C9F /* VLCInformationWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCInformationWindowController.m; sourceTree = "<group>"; };
 		8E55FB7F0459B0FD00FB3317 /* VLCOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCOutput.h; sourceTree = "<group>"; };
@@ -892,6 +896,8 @@
 				7DC21A7322049A6600F98A02 /* VLCOpenInputMetadata.m */,
 				8ED6C28103E2EB1C0059A3A7 /* VLCOpenWindowController.h */,
 				8ED6C28203E2EB1C0059A3A7 /* VLCOpenWindowController.m */,
+				7DFFF8FF23682D4800C8B0C9 /* VLCDetachedAudioWindow.h */,
+				7DFFF90023682D4800C8B0C9 /* VLCDetachedAudioWindow.m */,
 			);
 			path = windows;
 			sourceTree = "<group>";
@@ -1569,6 +1575,7 @@
 				6B8224131E4D2A9000833BE1 /* StreamOutput.xib */,
 				6B8224151E4D2A9000833BE1 /* TextfieldPanel.xib */,
 				6B8224161E4D2A9000833BE1 /* TimeSelectionPanel.xib */,
+				7DFFF8FE23682CE400C8B0C9 /* VLCDetachedAudioWindow.xib */,
 			);
 			name = XIBs;
 			path = ../../../modules/gui/macosx/UI;
@@ -1667,6 +1674,7 @@
 				7D2554C522C8E8B500F2D9C2 /* VLCMediaSourceDeviceCollectionViewItem.m in Sources */,
 				1CCC88F52078A3D500E5626F /* SyncTracks.xib in Sources */,
 				1CCC88F62078A3D500E5626F /* VLCInformationWindow.xib in Sources */,
+				7DFFF90123682D4800C8B0C9 /* VLCDetachedAudioWindow.m in Sources */,
 				7D66D4392200C5B80040D04A /* VLCVideoFilterHelper.m in Sources */,
 				7D445D812202524000263D34 /* VLCPlaylistController.m in Sources */,
 				7DFBDCBE226CED7200B700A5 /* VLCMediaSource.m in Sources */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 83f23d9337..665d20ce3d 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -213,6 +213,8 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/views/VLCWrappableTextField.m \
 	gui/macosx/windows/VLCAboutWindowController.h \
 	gui/macosx/windows/VLCAboutWindowController.m \
+	gui/macosx/windows/VLCDetachedAudioWindow.h \
+	gui/macosx/windows/VLCDetachedAudioWindow.m \
 	gui/macosx/windows/VLCErrorWindowController.h \
 	gui/macosx/windows/VLCErrorWindowController.m \
 	gui/macosx/windows/VLCHelpWindowController.h \
@@ -272,6 +274,7 @@ libmacosx_plugin_la_XIB_SOURCES = \
 	gui/macosx/UI/LogMessageWindow.xib \
 	gui/macosx/UI/MainMenu.xib \
 	gui/macosx/UI/VLCCustomCropARPanel.xib \
+	gui/macosx/UI/VLCDetachedAudioWindow.xib \
 	gui/macosx/UI/VLCLibraryAlbumTableCellView.xib \
 	gui/macosx/UI/VLCLibraryWindow.xib \
 	gui/macosx/UI/VLCLibraryTableCellView.xib \
diff --git a/modules/gui/macosx/UI/VLCDetachedAudioWindow.xib b/modules/gui/macosx/UI/VLCDetachedAudioWindow.xib
new file mode 100644
index 0000000000..33bc611e3d
--- /dev/null
+++ b/modules/gui/macosx/UI/VLCDetachedAudioWindow.xib
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15400" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15400"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="NSWindowController">
+            <connections>
+                <outlet property="window" destination="2" id="62"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="VLC media player" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="detachedaudiowindow" animationBehavior="default" id="2" userLabel="Detached Audio Window" customClass="VLCDetachedAudioWindow">
+            <windowStyleMask key="styleMask" closable="YES" resizable="YES" fullSizeContentView="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" topStrut="YES"/>
+            <rect key="contentRect" x="91" y="467" width="239" height="239"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
+            <value key="minSize" type="size" width="239" height="239"/>
+            <view key="contentView" id="4" customClass="VLCTrackingView">
+                <rect key="frame" x="0.0" y="0.0" width="239" height="239"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="63" customClass="VLCImageView">
+                        <rect key="frame" x="0.0" y="0.0" width="239" height="239"/>
+                        <constraints>
+                            <constraint firstAttribute="width" secondItem="63" secondAttribute="height" multiplier="1:1" id="RxG-T1-BEQ"/>
+                        </constraints>
+                    </customView>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="5" customClass="VLCBottomBarView">
+                        <rect key="frame" x="0.0" y="0.0" width="239" height="65"/>
+                        <subviews>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="65" customClass="VLCDragDropView">
+                                <rect key="frame" x="0.0" y="0.0" width="239" height="65"/>
+                                <subviews>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="Vae-cT-EEI" userLabel="Play controls group">
+                                        <rect key="frame" x="77" y="10" width="85" height="23"/>
+                                        <subviews>
+                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="11">
+                                                <rect key="frame" x="0.0" y="0.0" width="29" height="23"/>
+                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="backward-3btns" imagePosition="only" alignment="center" alternateImage="backward-3btns-pressed" continuous="YES" enabled="NO" id="14">
+                                                    <behavior key="behavior" lightByContents="YES"/>
+                                                    <font key="font" metaFont="label"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="bwd:" target="3" id="56"/>
+                                                </connections>
+                                            </button>
+                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="10">
+                                                <rect key="frame" x="29" y="0.0" width="27" height="23"/>
+                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="play" imagePosition="only" alignment="center" alternateImage="play-pressed" id="15">
+                                                    <behavior key="behavior" lightByContents="YES"/>
+                                                    <font key="font" metaFont="titleBar" size="12"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="play:" target="3" id="39"/>
+                                                </connections>
+                                            </button>
+                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="12">
+                                                <rect key="frame" x="56" y="0.0" width="29" height="23"/>
+                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="forward-3btns" imagePosition="only" alignment="center" alternateImage="forward-3btns-pressed" continuous="YES" enabled="NO" id="13">
+                                                    <behavior key="behavior" lightByContents="YES"/>
+                                                    <font key="font" metaFont="label"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="fwd:" target="3" id="51"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="11" firstAttribute="top" secondItem="Vae-cT-EEI" secondAttribute="top" id="11i-jS-o5W"/>
+                                            <constraint firstItem="10" firstAttribute="left" secondItem="11" secondAttribute="right" id="496-Ip-nTd"/>
+                                            <constraint firstItem="10" firstAttribute="top" secondItem="Vae-cT-EEI" secondAttribute="top" id="9Kr-xx-Ssf"/>
+                                            <constraint firstAttribute="right" secondItem="12" secondAttribute="right" id="KOc-oW-4iH"/>
+                                            <constraint firstAttribute="height" constant="23" id="bN7-k9-7Iy"/>
+                                            <constraint firstAttribute="bottom" secondItem="11" secondAttribute="bottom" id="fFe-7J-ver"/>
+                                            <constraint firstItem="12" firstAttribute="top" secondItem="Vae-cT-EEI" secondAttribute="top" id="gwB-yN-SK0"/>
+                                            <constraint firstAttribute="bottom" secondItem="12" secondAttribute="bottom" id="l2h-EI-MAG"/>
+                                            <constraint firstItem="12" firstAttribute="left" secondItem="10" secondAttribute="right" id="mOu-KM-Uo8"/>
+                                            <constraint firstItem="11" firstAttribute="left" secondItem="Vae-cT-EEI" secondAttribute="left" id="rI6-bN-oCM"/>
+                                            <constraint firstAttribute="bottom" secondItem="10" secondAttribute="bottom" id="yGM-Jx-9fD"/>
+                                        </constraints>
+                                    </customView>
+                                    <slider hidden="YES" horizontalHuggingPriority="200" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="20" customClass="VLCSlider">
+                                        <rect key="frame" x="10" y="42" width="172" height="16"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="14" id="MYp-CS-yPe"/>
+                                        </constraints>
+                                        <sliderCell key="cell" controlSize="small" continuous="YES" state="on" alignment="left" maxValue="1" doubleValue="0.32600000000000001" tickMarkPosition="above" sliderType="linear" id="23" customClass="VLCSliderCell">
+                                            <font key="font" size="12" name="Helvetica"/>
+                                        </sliderCell>
+                                        <connections>
+                                            <action selector="timeSliderAction:" target="3" id="46"/>
+                                        </connections>
+                                    </slider>
+                                    <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9" customClass="VLCTimeField">
+                                        <rect key="frame" x="185" y="44" width="46" height="13"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="42" id="EvZ-Sy-m25"/>
+                                            <constraint firstAttribute="height" constant="13" id="LYT-Sd-Gf6"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" alignment="center" title="00:00" id="16">
+                                            <font key="font" metaFont="label"/>
+                                            <color key="textColor" white="0.25" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="20" firstAttribute="leading" secondItem="65" secondAttribute="leading" constant="10" id="KrJ-x3-HIr"/>
+                                    <constraint firstItem="Vae-cT-EEI" firstAttribute="centerX" secondItem="65" secondAttribute="centerX" id="Rf0-0E-Wiz"/>
+                                    <constraint firstItem="9" firstAttribute="centerY" secondItem="20" secondAttribute="centerY" id="SW9-5i-MQL"/>
+                                    <constraint firstAttribute="bottom" secondItem="Vae-cT-EEI" secondAttribute="bottom" constant="10" id="T6V-Vf-TOT"/>
+                                    <constraint firstItem="9" firstAttribute="leading" secondItem="20" secondAttribute="trailing" constant="5" id="gyE-0N-u6t"/>
+                                    <constraint firstAttribute="trailing" secondItem="9" secondAttribute="trailing" constant="10" id="p5i-nM-pBs"/>
+                                    <constraint firstItem="Vae-cT-EEI" firstAttribute="top" secondItem="20" secondAttribute="bottom" constant="10" id="pfB-W2-CWB"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="trailing" secondItem="65" secondAttribute="trailing" id="1uG-1s-rI0"/>
+                            <constraint firstItem="65" firstAttribute="leading" secondItem="5" secondAttribute="leading" id="84j-is-ZZ4"/>
+                            <constraint firstAttribute="bottom" secondItem="65" secondAttribute="bottom" id="WrS-PS-vpi"/>
+                            <constraint firstItem="65" firstAttribute="top" secondItem="5" secondAttribute="top" id="ecn-UJ-dvK"/>
+                            <constraint firstAttribute="height" constant="65" id="z2X-5w-wme"/>
+                        </constraints>
+                    </customView>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="5" firstAttribute="leading" secondItem="4" secondAttribute="leading" id="9Ml-c7-Mey"/>
+                    <constraint firstItem="63" firstAttribute="top" secondItem="4" secondAttribute="top" id="SR5-da-lz7">
+                        <attributedString key="userComments">
+                            <fragment content="Optional constraint if no titlebar">
+                                <attributes>
+                                    <font key="NSFont" metaFont="smallSystem"/>
+                                    <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
+                                </attributes>
+                            </fragment>
+                        </attributedString>
+                    </constraint>
+                    <constraint firstAttribute="bottom" secondItem="63" secondAttribute="bottom" priority="750" id="Xml-gb-MF1"/>
+                    <constraint firstItem="63" firstAttribute="leading" secondItem="4" secondAttribute="leading" id="b8K-0j-YLT"/>
+                    <constraint firstAttribute="trailing" secondItem="63" secondAttribute="trailing" id="b8X-Kc-BfD"/>
+                    <constraint firstAttribute="trailing" secondItem="5" secondAttribute="trailing" id="jZw-zr-cck"/>
+                    <constraint firstAttribute="bottom" secondItem="5" secondAttribute="bottom" id="mhi-VL-aFb"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="bottomBarView" destination="5" id="xZs-ha-Bmg"/>
+                <outlet property="controlsBar" destination="3" id="69"/>
+                <outlet property="imageView" destination="63" id="xYd-xT-wUa"/>
+            </connections>
+            <point key="canvasLocation" x="138.5" y="146.5"/>
+        </window>
+        <customObject id="3" userLabel="Detached Window Controls Bar" customClass="VLCControlsBarCommon">
+            <connections>
+                <outlet property="backwardButton" destination="11" id="aQU-S3-4ZI"/>
+                <outlet property="dropView" destination="65" id="9kL-XQ-Akn"/>
+                <outlet property="forwardButton" destination="12" id="f7L-YR-p1H"/>
+                <outlet property="playButton" destination="10" id="Gsq-tx-qf3"/>
+                <outlet property="timeField" destination="9" id="uzI-2c-bs3"/>
+                <outlet property="timeSlider" destination="20" id="AFS-sq-vuw"/>
+            </connections>
+        </customObject>
+    </objects>
+    <resources>
+        <image name="backward-3btns" width="29" height="23"/>
+        <image name="backward-3btns-pressed" width="29" height="23"/>
+        <image name="forward-3btns" width="29" height="23"/>
+        <image name="forward-3btns-pressed" width="29" height="23"/>
+        <image name="play" width="27" height="23"/>
+        <image name="play-pressed" width="27" height="23"/>
+    </resources>
+</document>
diff --git a/modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib b/modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib
index 06057a3346..a6d873977a 100755
--- a/modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib
+++ b/modules/gui/macosx/UI/VLCStatusBarIconMainMenu.xib
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15400" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15400"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -57,6 +57,12 @@
                         <action selector="statusBarIconShowMainWindow:" target="-2" id="s0T-6f-d13"/>
                     </connections>
                 </menuItem>
+                <menuItem title="Show Audio Player" id="7yT-ex-xl5">
+                    <modifierMask key="keyEquivalentModifierMask"/>
+                    <connections>
+                        <action selector="statusBarIconShowMiniAudioPlayer:" target="-2" id="wXR-JP-3xI"/>
+                    </connections>
+                </menuItem>
                 <menuItem title="Quit" id="539">
                     <modifierMask key="keyEquivalentModifierMask"/>
                     <connections>
@@ -79,8 +85,8 @@
                     </constraints>
                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="VLC" id="7Ns-2s-EgU"/>
                 </imageView>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Byt-pH-60l">
-                    <rect key="frame" x="74" y="42" width="167" height="17"/>
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="749" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Byt-pH-60l">
+                    <rect key="frame" x="74" y="40" width="167" height="19"/>
                     <textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" title="The Fox (What Does the Fox Say?) to this very very" usesSingleLineMode="YES" id="Fo7-qA-sCC">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -88,7 +94,7 @@
                     </textFieldCell>
                 </textField>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="FnZ-Gr-BKf">
-                    <rect key="frame" x="74" y="27" width="167" height="17"/>
+                    <rect key="frame" x="74" y="26" width="167" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="by Ylvis" usesSingleLineMode="YES" id="TWt-2V-iGT">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -96,7 +102,7 @@
                     </textFieldCell>
                 </textField>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="SKt-XT-Vki">
-                    <rect key="frame" x="74" y="12" width="167" height="17"/>
+                    <rect key="frame" x="74" y="12" width="167" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="on “The Fox”" usesSingleLineMode="YES" id="IKI-Pl-Iji">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
@@ -122,11 +128,11 @@
             <point key="canvasLocation" x="370.5" y="-52"/>
         </customView>
         <customView id="v97-Ct-Yqs">
-            <rect key="frame" x="0.0" y="0.0" width="251" height="45"/>
+            <rect key="frame" x="0.0" y="1" width="251" height="44"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rih-mA-gAq">
-                    <rect key="frame" x="103" y="-153" width="4" height="15"/>
+                    <rect key="frame" x="103" y="-154" width="4" height="15"/>
                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                     <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" alignment="center" transparent="YES" imageScaling="proportionallyDown" inset="2" id="RbD-Js-cLU">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -137,7 +143,7 @@
                     </connections>
                 </button>
                 <button translatesAutoresizingMaskIntoConstraints="NO" id="p8X-zU-PwN" customClass="VLCImageButton">
-                    <rect key="frame" x="85" y="20" width="24" height="24"/>
+                    <rect key="frame" x="85" y="19" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="5IV-1l-2UV"/>
                         <constraint firstAttribute="width" secondItem="p8X-zU-PwN" secondAttribute="height" multiplier="1:1" id="lkX-DA-UeD"/>
@@ -151,7 +157,7 @@
                     </connections>
                 </button>
                 <button translatesAutoresizingMaskIntoConstraints="NO" id="lvI-lN-t4O" customClass="VLCImageButton">
-                    <rect key="frame" x="114" y="20" width="24" height="24"/>
+                    <rect key="frame" x="114" y="19" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="24" id="VH7-ja-clp"/>
                         <constraint firstAttribute="width" secondItem="lvI-lN-t4O" secondAttribute="height" multiplier="1:1" id="kzq-fw-PfK"/>
@@ -168,7 +174,7 @@
                     </connections>
                 </button>
                 <button translatesAutoresizingMaskIntoConstraints="NO" id="NHj-Vf-SPF" customClass="VLCImageButton">
-                    <rect key="frame" x="142" y="20" width="24" height="24"/>
+                    <rect key="frame" x="142" y="19" width="24" height="24"/>
                     <constraints>
                         <constraint firstAttribute="width" secondItem="NHj-Vf-SPF" secondAttribute="height" multiplier="1:1" id="WY1-gG-mtJ"/>
                         <constraint firstAttribute="height" constant="24" id="YJ5-t2-qjF"/>
@@ -196,7 +202,7 @@
                     </connections>
                 </button>
                 <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="z3X-aG-Veg">
-                    <rect key="frame" x="88" y="1" width="33" height="17"/>
+                    <rect key="frame" x="88" y="1" width="33" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="right" title="--:--" usesSingleLineMode="YES" id="CLT-p2-bxf">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -204,7 +210,7 @@
                     </textFieldCell>
                 </textField>
                 <textField horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="za4-8d-tZy">
-                    <rect key="frame" x="119" y="1" width="13" height="17"/>
+                    <rect key="frame" x="119" y="1" width="13" height="16"/>
                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="center" title="/" usesSingleLineMode="YES" id="y3P-oA-eTa">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -212,7 +218,7 @@
                     </textFieldCell>
                 </textField>
                 <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wXO-2p-mxK">
-                    <rect key="frame" x="126" y="1" width="33" height="17"/>
+                    <rect key="frame" x="126" y="1" width="33" height="16"/>
                     <textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" title="--:--" usesSingleLineMode="YES" id="vF8-Z8-vhW">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
diff --git a/modules/gui/macosx/menus/VLCStatusBarIcon.h b/modules/gui/macosx/menus/VLCStatusBarIcon.h
index 10aed3365b..a143e4d035 100644
--- a/modules/gui/macosx/menus/VLCStatusBarIcon.h
+++ b/modules/gui/macosx/menus/VLCStatusBarIcon.h
@@ -36,5 +36,6 @@
 - (IBAction)statusBarIconNext:(id)sender;
 - (IBAction)statusBarIconPrevious:(id)sender;
 - (IBAction)statusBarIconToggleRandom:(id)sender;
+- (IBAction)statusBarIconShowMiniAudioPlayer:(id)sender;
 
 @end
diff --git a/modules/gui/macosx/menus/VLCStatusBarIcon.m b/modules/gui/macosx/menus/VLCStatusBarIcon.m
index 834e1d220c..63b61ad430 100644
--- a/modules/gui/macosx/menus/VLCStatusBarIcon.m
+++ b/modules/gui/macosx/menus/VLCStatusBarIcon.m
@@ -28,6 +28,7 @@
 #import "playlist/VLCPlaylistController.h"
 #import "playlist/VLCPlayerController.h"
 #import "library/VLCInputItem.h"
+#import "windows/VLCDetachedAudioWindow.h"
 
 @interface VLCStatusBarIcon ()
 {
@@ -55,6 +56,8 @@
 
     BOOL _showTimeElapsed;
     NSString *_currentPlaybackUrl;
+
+    VLCDetachedAudioWindow *_detachedAudioWindow;
 }
 @end
 
@@ -493,4 +496,15 @@
     [[NSApplication sharedApplication] terminate:nil];
 }
 
+- (IBAction)statusBarIconShowMiniAudioPlayer:(id)sender
+{
+    if (!_detachedAudioWindow) {
+        NSWindowController *windowController = [[NSWindowController alloc] initWithWindowNibName:@"VLCDetachedAudioWindow"];
+        [windowController loadWindow];
+        _detachedAudioWindow = (VLCDetachedAudioWindow *)[windowController window];
+    }
+
+    [_detachedAudioWindow makeKeyAndOrderFront:sender];
+}
+
 @end
diff --git a/modules/gui/macosx/windows/VLCDetachedAudioWindow.h b/modules/gui/macosx/windows/VLCDetachedAudioWindow.h
new file mode 100644
index 0000000000..938b5710f9
--- /dev/null
+++ b/modules/gui/macosx/windows/VLCDetachedAudioWindow.h
@@ -0,0 +1,40 @@
+/*****************************************************************************
+* VLCDetachedAudioWindow.h: macOS user interface
+*****************************************************************************
+* Copyright (C) 2019 VLC authors and VideoLAN
+*
+* Author: Felix Paul Kühne <fkuehne at videolan dot org>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+*****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+#import "windows/video/VLCWindow.h"
+
+ at class VLCControlsBarCommon;
+ at class VLCImageView;
+ at class VLCBottomBarView;
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCDetachedAudioWindow : VLCWindow
+
+ at property (nonatomic, weak) IBOutlet VLCImageView *imageView;
+ at property (nonatomic, weak) IBOutlet VLCControlsBarCommon *controlsBar;
+ at property (nonatomic, weak) IBOutlet VLCBottomBarView *bottomBarView;
+
+ at end
+
+NS_ASSUME_NONNULL_END
diff --git a/modules/gui/macosx/windows/VLCDetachedAudioWindow.m b/modules/gui/macosx/windows/VLCDetachedAudioWindow.m
new file mode 100644
index 0000000000..616af24e36
--- /dev/null
+++ b/modules/gui/macosx/windows/VLCDetachedAudioWindow.m
@@ -0,0 +1,89 @@
+/*****************************************************************************
+* VLCDetachedAudioWindow.m: macOS user interface
+*****************************************************************************
+* Copyright (C) 2019 VLC authors and VideoLAN
+*
+* Author: Felix Paul Kühne <fkuehne at videolan dot org>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+*****************************************************************************/
+
+#import "extensions/NSString+Helpers.h"
+#import "main/VLCMain.h"
+#import "windows/mainwindow/VLCControlsBarCommon.h"
+#import "playlist/VLCPlaylistController.h"
+#import "playlist/VLCPlayerController.h"
+#import "library/VLCInputItem.h"
+#import "views/VLCImageView.h"
+#import "views/VLCTrackingView.h"
+#import "views/VLCBottomBarView.h"
+
+#import "VLCDetachedAudioWindow.h"
+
+ at interface VLCDetachedAudioWindow()
+{
+    VLCPlayerController *_playerController;
+}
+ at end
+
+ at implementation VLCDetachedAudioWindow
+
+- (void)awakeFromNib
+{
+    self.title = @"";
+
+    _playerController = [[[VLCMain sharedInstance] playlistController] playerController];
+    VLCTrackingView *trackingView = self.contentView;
+    trackingView.viewToHide = self.bottomBarView;
+    self.bottomBarView.hidden = YES;
+
+    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
+    [notificationCenter addObserver:self selector:@selector(inputItemChanged:) name:VLCPlayerCurrentMediaItemChanged object:nil];
+
+    [self inputItemChanged:nil];
+}
+
+- (void)dealloc
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+- (void)inputItemChanged:(NSNotification *)aNotification
+{
+    VLCInputItem *currentInput = _playerController.currentMedia;
+    if (currentInput) {
+        [self.imageView setImageURL:currentInput.artworkURL placeholderImage:[NSImage imageNamed:@"noart.png"]];
+    } else {
+        [self.imageView setImage:[NSImage imageNamed:@"noart.png"]];
+    }
+
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+    return YES;
+}
+
+- (BOOL)canBecomeMainWindow
+{
+    return YES;
+}
+
+- (BOOL)isMovableByWindowBackground
+{
+    return YES;
+}
+
+ at end
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2cab60813f..156bfd4837 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -618,6 +618,8 @@ modules/gui/macosx/views/VLCWrappableTextField.h
 modules/gui/macosx/views/VLCWrappableTextField.m
 modules/gui/macosx/windows/VLCAboutWindowController.h
 modules/gui/macosx/windows/VLCAboutWindowController.m
+modules/gui/macosx/windows/VLCDetachedAudioWindow.h
+modules/gui/macosx/windows/VLCDetachedAudioWindow.m
 modules/gui/macosx/windows/VLCErrorWindowController.h
 modules/gui/macosx/windows/VLCErrorWindowController.m
 modules/gui/macosx/windows/VLCHelpWindowController.h



More information about the vlc-commits mailing list