vlc | branch: master | David Fuhrmann <[email protected]> | Fri Apr 14 
12:27:27 2017 +0200| [e75e8fe0eda748794fd153fa7911e4fe67e9e885] | committer: 
David Fuhrmann

macosx: Revive error panel for error and warning messages

VLC needs a list of errors as multiple errors can occur at the
same time.
This revives the existing error panel from
e3f2ec3e00f68f6dad9ea5ab732b7397a1b9891f.

refs #17262

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

 .../package/macosx/VLC.xcodeproj/project.pbxproj   | 12 ++-
 modules/gui/macosx/Makefile.am                     |  3 +
 modules/gui/macosx/UI/ErrorPanel.xib               | 96 ++++++++++++++++++++++
 modules/gui/macosx/UI/MainMenu.xib                 | 11 ++-
 modules/gui/macosx/VLCCoreDialogProvider.h         |  4 +
 modules/gui/macosx/VLCCoreDialogProvider.m         | 13 ++-
 modules/gui/macosx/VLCErrorWindowController.h      | 40 +++++++++
 modules/gui/macosx/VLCErrorWindowController.m      | 96 ++++++++++++++++++++++
 modules/gui/macosx/VLCMainMenu.h                   |  3 +-
 modules/gui/macosx/VLCMainMenu.m                   |  7 ++
 po/POTFILES.in                                     |  2 +
 11 files changed, 275 insertions(+), 12 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj 
b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index a323e05167..23456d5f08 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -160,6 +160,7 @@
                1C3114281E508D1B00D4DD76 /* VLCFullScreenPanel.xib in Sources 
*/ = {isa = PBXBuildFile; fileRef = 6B8224181E4D2A9000833BE1 /* 
VLCFullScreenPanel.xib */; };
                1C3114291E508D1B00D4DD76 /* VLCRendererDialog.xib in Sources */ 
= {isa = PBXBuildFile; fileRef = 6B8224191E4D2A9000833BE1 /* 
VLCRendererDialog.xib */; };
                1C31142A1E508D1B00D4DD76 /* VLCStatusBarIconMainMenu.xib in 
Sources */ = {isa = PBXBuildFile; fileRef = 6B82241A1E4D2A9000833BE1 /* 
VLCStatusBarIconMainMenu.xib */; };
+               1CFE8D591EA0D42A00E94451 /* VLCErrorWindowController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = 1CFE8D581EA0D42A00E94451 /* 
VLCErrorWindowController.m */; };
                6B3BE42C1E6217CB008D098A /* VLCHUDImageButton.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 6B3BE42B1E6217CB008D098A /* VLCHUDImageButton.m 
*/; };
                6B3BE4321E621F24008D098A /* VLCHUDToggleButton.m in Sources */ 
= {isa = PBXBuildFile; fileRef = 6B3BE4311E621F24008D098A /* 
VLCHUDToggleButton.m */; };
                6B4D50901E79781F004479B5 /* VLCHotkeyChangeWindow.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = 6B4D508F1E79781F004479B5 /* 
VLCHotkeyChangeWindow.m */; };
@@ -186,6 +187,9 @@
                1CCB5F2F1A62A6A5004C3E90 /* Pseudo-VLC.app */ = {isa = 
PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; 
path = "Pseudo-VLC.app"; sourceTree = BUILT_PRODUCTS_DIR; };
                1CD366791B7A242E0054E39F /* VLCTimeSelectionPanelController.h 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.h; path = VLCTimeSelectionPanelController.h; sourceTree = 
"<group>"; };
                1CD3667A1B7A242E0054E39F /* VLCTimeSelectionPanelController.m 
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = VLCTimeSelectionPanelController.m; sourceTree = 
"<group>"; };
+               1CFE8D561EA0D3D300E94451 /* ErrorPanel.xib */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = 
ErrorPanel.xib; sourceTree = "<group>"; };
+               1CFE8D571EA0D42A00E94451 /* VLCErrorWindowController.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = VLCErrorWindowController.h; sourceTree = "<group>"; };
+               1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = VLCErrorWindowController.m; sourceTree = "<group>"; };
                5CCED71014C0D4A90057F8D1 /* VLCExtensionsDialogProvider.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = VLCExtensionsDialogProvider.h; sourceTree = "<group>"; };
                5CCED71114C0D4A90057F8D1 /* VLCExtensionsDialogProvider.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = VLCExtensionsDialogProvider.m; sourceTree = 
"<group>"; };
                5CCED71214C0D4A90057F8D1 /* VLCExtensionsManager.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
VLCExtensionsManager.h; sourceTree = "<group>"; };
@@ -938,6 +942,8 @@
                                1C67C8A71D58C0A40079E1C1 /* 
VLCAboutWindowController.m */,
                                1C67C8A31D58C0980079E1C1 /* 
VLCHelpWindowController.h */,
                                1C67C8A41D58C0980079E1C1 /* 
VLCHelpWindowController.m */,
+                               1CFE8D571EA0D42A00E94451 /* 
VLCErrorWindowController.h */,
+                               1CFE8D581EA0D42A00E94451 /* 
VLCErrorWindowController.m */,
                                7DF0435E1972E26A0022B534 /* VLCAddonListItem.h 
*/,
                                7DF0435F1972E26A0022B534 /* VLCAddonListItem.m 
*/,
                                7DB65D5218ABD6380053B874 /* 
VLCAddonsWindowController.h */,
@@ -1829,6 +1835,7 @@
                                6B8224031E4D2A9000833BE1 /* ConvertAndSave.xib 
*/,
                                6B8224041E4D2A9000833BE1 /* CoreDialogs.xib */,
                                6B8224051E4D2A9000833BE1 /* 
DetachedVideoWindow.xib */,
+                               1CFE8D561EA0D3D300E94451 /* ErrorPanel.xib */,
                                6B8224061E4D2A9000833BE1 /* FSPanel.xib */,
                                6B8224071E4D2A9000833BE1 /* Help.xib */,
                                6B8224081E4D2A9000833BE1 /* 
LogMessageWindow.xib */,
@@ -1886,7 +1893,7 @@
                                        };
                                };
                        };
-                       buildConfigurationList = C2F2A6EA09588F1B00018C74 /* 
Build configuration list for PBXProject "VLC" */;
+                       buildConfigurationList = C2F2A6EA09588F1B00018C74 /* 
Build configuration list for PBXProject "vlc" */;
                        compatibilityVersion = "Xcode 3.2";
                        developmentRegion = English;
                        hasScannedForEncodings = 1;
@@ -1943,6 +1950,7 @@
                                1C31142A1E508D1B00D4DD76 /* 
VLCStatusBarIconMainMenu.xib in Sources */,
                                1C3114021E508C8800D4DD76 /* AppleRemote.h in 
Sources */,
                                1C3114031E508C8800D4DD76 /* AppleRemote.m in 
Sources */,
+                               1CFE8D591EA0D42A00E94451 /* 
VLCErrorWindowController.m in Sources */,
                                1C3114041E508C8800D4DD76 /* SideBarItem.h in 
Sources */,
                                1C3114051E508C8800D4DD76 /* SideBarItem.m in 
Sources */,
                                6B4D50961E7A7D16004479B5 /* 
NSSound+VLCAdditions.m in Sources */,
@@ -2229,7 +2237,7 @@
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Default;
                };
-               C2F2A6EA09588F1B00018C74 /* Build configuration list for 
PBXProject "VLC" */ = {
+               C2F2A6EA09588F1B00018C74 /* Build configuration list for 
PBXProject "vlc" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                                C2F2A6EB09588F1B00018C74 /* Development */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 7e4f74a661..e73345e100 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -32,6 +32,7 @@ libmacosx_plugin_la_SOURCES = \
        VLCMainWindowControlsBar.m VLCMainWindowControlsBar.h \
        VLCConvertAndSaveWindowController.h VLCConvertAndSaveWindowController.m 
\
        VLCCoreInteraction.h VLCCoreInteraction.m \
+       VLCErrorWindowController.h VLCErrorWindowController.m \
        VLCExtensionsDialogProvider.h VLCExtensionsDialogProvider.m \
        VLCExtensionsManager.h VLCExtensionsManager.m \
        VLCHelpWindowController.h VLCHelpWindowController.m \
@@ -106,6 +107,7 @@ nobase_libmacosx_plugin_la_DATA = \
        UI/ConvertAndSave.nib \
        UI/CoreDialogs.nib \
        UI/DetachedVideoWindow.nib \
+       UI/ErrorPanel.nib \
        UI/FSPanel.nib \
        UI/Help.nib \
        UI/LogMessageWindow.nib \
@@ -136,6 +138,7 @@ libmacosx_plugin_la_SOURCES += \
        UI/ConvertAndSave.xib \
        UI/CoreDialogs.xib \
        UI/DetachedVideoWindow.xib \
+       UI/ErrorPanel.xib \
        UI/FSPanel.xib \
        UI/Help.xib \
        UI/LogMessageWindow.xib \
diff --git a/modules/gui/macosx/UI/ErrorPanel.xib 
b/modules/gui/macosx/UI/ErrorPanel.xib
new file mode 100644
index 0000000000..9a33498e3f
--- /dev/null
+++ b/modules/gui/macosx/UI/ErrorPanel.xib
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" 
toolsVersion="10117" systemVersion="15G1421" targetRuntime="MacOSX.Cocoa" 
propertyAccessControl="none">
+    <dependencies>
+        <deployment version="1060" identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" 
version="10117"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" 
customClass="VLCErrorWindowController">
+            <connections>
+                <outlet property="o_cleanup_button" destination="11" id="13"/>
+                <outlet property="o_error_table" destination="8" id="12"/>
+                <outlet property="window" destination="5" id="75"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" 
customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application"/>
+        <window title="Errors and Warnings" 
allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" 
hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" 
frameAutosaveName="ErrorsAndWarnings" animationBehavior="default" id="5" 
userLabel="Non-Blocking errors" customClass="NSPanel">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" 
miniaturizable="YES" resizable="YES" utility="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" 
rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="304" y="373" width="397" height="209"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
+            <value key="minSize" type="size" width="260" height="120"/>
+            <view key="contentView" id="6">
+                <rect key="frame" x="0.0" y="0.0" width="397" height="209"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <scrollView autohidesScrollers="YES" 
horizontalLineScroll="47" horizontalPageScroll="10" verticalLineScroll="47" 
verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="7">
+                        <rect key="frame" x="0.0" y="39" width="398" 
height="170"/>
+                        <autoresizingMask key="autoresizingMask" 
widthSizable="YES" heightSizable="YES"/>
+                        <clipView key="contentView" id="vJx-40-Cca">
+                            <rect key="frame" x="1" y="1" width="396" 
height="168"/>
+                            <autoresizingMask key="autoresizingMask" 
widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <tableView verticalHuggingPriority="750" 
allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" 
alternatingRowBackgroundColors="YES" columnReordering="NO" 
multipleSelection="NO" autosaveColumns="NO" rowHeight="45" id="8">
+                                    <rect key="frame" x="0.0" y="0.0" 
width="396" height="168"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                    <size key="intercellSpacing" width="3" 
height="2"/>
+                                    <color key="backgroundColor" 
name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="gridColor" name="gridColor" 
catalog="System" colorSpace="catalog"/>
+                                    <tableColumns>
+                                        <tableColumn identifier="icon" 
editable="NO" width="45" minWidth="32" maxWidth="1000" id="9">
+                                            <tableHeaderCell key="headerCell" 
lineBreakMode="truncatingTail" borderStyle="border" alignment="center" 
title="icons">
+                                                <font key="font" 
metaFont="smallSystem"/>
+                                                <color key="textColor" 
name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" 
white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
+                                            </tableHeaderCell>
+                                            <imageCell key="dataCell" 
refusesFirstResponder="YES" alignment="left" animates="YES" 
imageScaling="proportionallyDown" id="18"/>
+                                            <tableColumnResizingMask 
key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                        </tableColumn>
+                                        <tableColumn identifier="error_msg" 
width="344.99560000000002" minWidth="39.995609999999999" maxWidth="1000" 
id="10">
+                                            <tableHeaderCell key="headerCell" 
lineBreakMode="truncatingTail" borderStyle="border" alignment="left" 
title="errors">
+                                                <font key="font" 
metaFont="smallSystem"/>
+                                                <color key="textColor" 
name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" 
white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
+                                            </tableHeaderCell>
+                                            <textFieldCell key="dataCell" 
selectable="YES" editable="YES" alignment="left" id="23">
+                                                <font key="font" 
metaFont="smallSystem"/>
+                                                <color key="textColor" 
name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" 
name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            </textFieldCell>
+                                            <tableColumnResizingMask 
key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                        </tableColumn>
+                                    </tableColumns>
+                                    <connections>
+                                        <outlet property="dataSource" 
destination="-2" id="16"/>
+                                        <outlet property="delegate" 
destination="-2" id="17"/>
+                                    </connections>
+                                </tableView>
+                            </subviews>
+                            <color key="backgroundColor" 
name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </clipView>
+                        <scroller key="horizontalScroller" hidden="YES" 
verticalHuggingPriority="750" horizontal="YES" id="74">
+                            <rect key="frame" x="1" y="-30" width="381" 
height="15"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                        </scroller>
+                        <scroller key="verticalScroller" hidden="YES" 
verticalHuggingPriority="750" horizontal="NO" id="73">
+                            <rect key="frame" x="-30" y="1" width="15" 
height="168"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                        </scroller>
+                    </scrollView>
+                    <button verticalHuggingPriority="750" id="11">
+                        <rect key="frame" x="15" y="7" width="94" height="28"/>
+                        <autoresizingMask key="autoresizingMask" 
flexibleMaxX="YES" flexibleMaxY="YES"/>
+                        <buttonCell key="cell" type="push" title="Clean up" 
bezelStyle="rounded" alignment="center" controlSize="small" 
borderStyle="border" inset="2" id="71">
+                            <behavior key="behavior" pushIn="YES" 
lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="smallSystem"/>
+                        </buttonCell>
+                        <connections>
+                            <action selector="cleanupTable:" target="-2" 
id="15"/>
+                        </connections>
+                    </button>
+                </subviews>
+            </view>
+        </window>
+    </objects>
+</document>
diff --git a/modules/gui/macosx/UI/MainMenu.xib 
b/modules/gui/macosx/UI/MainMenu.xib
index bca91fd878..3bcfccf979 100644
--- a/modules/gui/macosx/UI/MainMenu.xib
+++ b/modules/gui/macosx/UI/MainMenu.xib
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" 
toolsVersion="11542" systemVersion="15G1108" targetRuntime="MacOSX.Cocoa" 
propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" 
toolsVersion="10117" systemVersion="15G1421" targetRuntime="MacOSX.Cocoa" 
propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment identifier="macosx"/>
         <development version="7000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" 
version="11542"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" 
version="10117"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" 
customClass="VLCMainMenu">
@@ -50,6 +50,7 @@
                 <outlet property="donation" destination="2298" 
id="ZzJ-yC-jOi"/>
                 <outlet property="double_window" destination="1171" 
id="DIg-sW-WS6"/>
                 <outlet property="editMenu" destination="205" id="6Mt-eK-QAx"/>
+                <outlet property="errorsAndWarnings" destination="n1B-wa-XGR" 
id="gNg-1z-gua"/>
                 <outlet property="extensions" destination="4942" 
id="qSU-2W-Chy"/>
                 <outlet property="extensionsMenu" destination="4943" 
id="IAw-5Z-Wvo"/>
                 <outlet property="fileMenu" destination="81" id="lbA-s5-6qj"/>
@@ -776,6 +777,12 @@
                             <menuItem isSeparatorItem="YES" id="2394">
                                 <modifierMask key="keyEquivalentModifierMask" 
command="YES"/>
                             </menuItem>
+                            <menuItem title="Errors and Warnings" 
keyEquivalent="m" id="n1B-wa-XGR">
+                                <modifierMask key="keyEquivalentModifierMask" 
option="YES" command="YES"/>
+                                <connections>
+                                    <action selector="showErrorsAndWarnings:" 
target="-2" id="4xx-kx-Wxo"/>
+                                </connections>
+                            </menuItem>
                             <menuItem title="Messages..." keyEquivalent="M" 
id="1003">
                                 <connections>
                                     <action selector="showMessagesPanel:" 
target="-2" id="Suq-dt-QZE"/>
diff --git a/modules/gui/macosx/VLCCoreDialogProvider.h 
b/modules/gui/macosx/VLCCoreDialogProvider.h
index d074c087fb..211b4eee21 100644
--- a/modules/gui/macosx/VLCCoreDialogProvider.h
+++ b/modules/gui/macosx/VLCCoreDialogProvider.h
@@ -30,6 +30,8 @@
  * VLCCoreDialogProvider interface
  *****************************************************************************/
 
+@class VLCErrorWindowController;
+
 @interface VLCCoreDialogProvider : NSObject
 {
     /* authentication dialog */
@@ -52,6 +54,8 @@
     IBOutlet NSWindow *progressWindow;
 }
 
+@property (readonly) VLCErrorWindowController* errorPanel;
+
 @property (atomic,readwrite) BOOL progressCancelled;
 
 - (IBAction)authenticationDialogAction:(id)sender;
diff --git a/modules/gui/macosx/VLCCoreDialogProvider.m 
b/modules/gui/macosx/VLCCoreDialogProvider.m
index 49cbfe4a9d..1ed2fa68b3 100644
--- a/modules/gui/macosx/VLCCoreDialogProvider.m
+++ b/modules/gui/macosx/VLCCoreDialogProvider.m
@@ -26,6 +26,8 @@
 #import "VLCCoreDialogProvider.h"
 #import "misc.h"
 
+#import "VLCErrorWindowController.h"
+
 /* for the icon in our custom error panel */
 #import <ApplicationServices/ApplicationServices.h>
 
@@ -153,6 +155,8 @@ static void updateProgressCallback(void *p_data,
         msg_Dbg(getIntf(), "Register dialog provider");
         [NSBundle loadNibNamed:@"CoreDialogs" owner: self];
 
+        _errorPanel = [[VLCErrorWindowController alloc] init];
+
         intf_thread_t *p_intf = getIntf();
         /* subscribe to various interactive dialogues */
 
@@ -194,13 +198,8 @@ static void updateProgressCallback(void *p_data,
 
 - (void)displayError:(NSArray *)dialogData
 {
-    NSAlert *alert = [NSAlert alertWithMessageText:[dialogData objectAtIndex:0]
-                                     defaultButton:_NS("OK")
-                                   alternateButton:nil
-                                       otherButton:nil
-                         informativeTextWithFormat:@"%@", [dialogData 
objectAtIndex:1]];
-    [alert setAlertStyle:NSCriticalAlertStyle];
-    [alert runModal];
+    [_errorPanel showWindow:nil];
+    [_errorPanel addError:[dialogData objectAtIndex:0] withMsg:[dialogData 
objectAtIndex:1]];
 }
 
 - (void)displayLoginDialog:(NSArray *)dialogData
diff --git a/modules/gui/macosx/VLCErrorWindowController.h 
b/modules/gui/macosx/VLCErrorWindowController.h
new file mode 100644
index 0000000000..d01a5456cb
--- /dev/null
+++ b/modules/gui/macosx/VLCErrorWindowController.h
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * HelpWindowController.h
+ *****************************************************************************
+ * Copyright (C) 2017 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Derk-Jan Hartman <[email protected]>
+ *          Felix Paul Kühne <fkuehne -at- videolan.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>
+
+@interface VLCErrorWindowController : NSWindowController
+{
+    IBOutlet id o_cleanup_button;
+    IBOutlet id o_error_table;
+
+    NSMutableArray *o_errors;
+    NSMutableArray *o_icons;
+}
+
+- (IBAction)cleanupTable:(id)sender;
+
+-(void)addError:(NSString *)o_error withMsg:(NSString *)o_msg;
+
+@end
diff --git a/modules/gui/macosx/VLCErrorWindowController.m 
b/modules/gui/macosx/VLCErrorWindowController.m
new file mode 100644
index 0000000000..4bbf9abca5
--- /dev/null
+++ b/modules/gui/macosx/VLCErrorWindowController.m
@@ -0,0 +1,96 @@
+/*****************************************************************************
+ * HelpWindowController.m
+ *****************************************************************************
+ * Copyright (C) 2017 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Derk-Jan Hartman <[email protected]>
+ *          Felix Paul Kühne <fkuehne -at- videolan.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 "VLCErrorWindowController.h"
+
+#import "VLCStringUtility.h"
+
+@implementation VLCErrorWindowController
+
+- (id)init
+{
+    self = [super initWithWindowNibName:@"ErrorPanel"];
+    if (self) {
+        /* init data sources */
+        o_errors = [[NSMutableArray alloc] init];
+        o_icons = [[NSMutableArray alloc] init];
+    }
+
+    return self;
+}
+
+- (void)windowDidLoad
+{
+    /* init strings */
+    [[self window] setTitle: _NS("Errors and Warnings")];
+    [o_cleanup_button setTitle: _NS("Clean up")];
+}
+
+-(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg
+{
+    /* format our string as desired */
+    NSMutableAttributedString * ourError;
+    ourError = [[NSMutableAttributedString alloc] initWithString:
+                [NSString stringWithFormat:@"%@\n%@", o_error, o_msg]
+                                                      attributes:
+                [NSDictionary dictionaryWithObject: [NSFont 
systemFontOfSize:11] forKey: NSFontAttributeName]];
+    [ourError
+     addAttribute: NSFontAttributeName
+     value: [NSFont boldSystemFontOfSize:11]
+     range: NSMakeRange(0, [o_error length])];
+    [o_errors addObject: ourError];
+
+    [o_icons addObject: [[NSWorkspace sharedWorkspace] 
iconForFileType:NSFileTypeForHFSTypeCode(kAlertStopIcon)]];
+
+    [o_error_table reloadData];
+}
+
+-(IBAction)cleanupTable:(id)sender
+{
+    [o_errors removeAllObjects];
+    [o_icons removeAllObjects];
+    [o_error_table reloadData];
+}
+
+/*----------------------------------------------------------------------------
+ * data source methods
+ *---------------------------------------------------------------------------*/
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)theDataTable
+{
+    return [o_errors count];
+}
+
+- (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn:
+(NSTableColumn *)theTableColumn row: (NSInteger)row
+{
+    if ([[theTableColumn identifier] isEqualToString: @"error_msg"])
+        return [o_errors objectAtIndex:row];
+
+    if ([[theTableColumn identifier] isEqualToString: @"icon"])
+        return [o_icons objectAtIndex:row];
+
+    return @"";
+}
+
+@end
diff --git a/modules/gui/macosx/VLCMainMenu.h b/modules/gui/macosx/VLCMainMenu.h
index 167412bc1b..36a69dd14f 100644
--- a/modules/gui/macosx/VLCMainMenu.h
+++ b/modules/gui/macosx/VLCMainMenu.h
@@ -172,6 +172,7 @@
 @property (readwrite, weak) IBOutlet NSMenuItem *bookmarks;
 @property (readwrite, weak) IBOutlet NSMenuItem *playlist;
 @property (readwrite, weak) IBOutlet NSMenuItem *info;
+@property (readwrite, weak) IBOutlet NSMenuItem *errorsAndWarnings;
 @property (readwrite, weak) IBOutlet NSMenuItem *messages;
 @property (readwrite, weak) IBOutlet NSMenuItem *bring_atf;
 
@@ -182,7 +183,6 @@
 @property (readwrite, weak) IBOutlet NSMenuItem *website;
 @property (readwrite, weak) IBOutlet NSMenuItem *donation;
 @property (readwrite, weak) IBOutlet NSMenuItem *forum;
-@property (readwrite, weak) IBOutlet NSMenuItem *errorsAndWarnings;
 
 /* dock menu */
 @property (readwrite, weak) IBOutlet NSMenuItem *dockMenuplay;
@@ -278,6 +278,7 @@
 - (IBAction)openWebsite:(id)sender;
 - (IBAction)openForum:(id)sender;
 - (IBAction)openDonate:(id)sender;
+- (IBAction)showErrorsAndWarnings:(id)sender;
 - (IBAction)showMessagesPanel:(id)showMessagesPanel;
 - (IBAction)showMainWindow:(id)sender;
 - (IBAction)showPlaylist:(id)sender;
diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index 7264ed73b9..e0281d47e1 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -31,6 +31,7 @@
 #import "VLCAboutWindowController.h"
 #import "VLCOpenWindowController.h"
 #import "VLCAudioEffectsWindowController.h"
+#import "VLCErrorWindowController.h"
 #import "VLCTrackSynchronizationWindowController.h"
 #import "VLCHelpWindowController.h"
 #import "VLCVideoEffectsWindowController.h"
@@ -39,6 +40,7 @@
 #import "VLCPlaylist.h"
 #import "VLCPlaylistInfo.h"
 #import "VLCVoutView.h"
+#import "VLCCoreDialogProvider.h"
 #import "VLCCoreInteraction.h"
 #import "VLCMainWindow.h"
 #import "VLCMainWindowControlsBar.h"
@@ -1207,6 +1209,11 @@
     [_addonsController showWindow:self];
 }
 
+- (IBAction)showErrorsAndWarnings:(id)sender
+{
+    [[[[VLCMain sharedInstance] coreDialogProvider] errorPanel] 
showWindow:self];
+}
+
 - (IBAction)showMessagesPanel:(id)showMessagesPanel
 {
     [[[VLCMain sharedInstance] debugMsgPanel] showWindow:self];
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0281098f86..a07b215bb1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -543,6 +543,8 @@ modules/gui/macosx/VLCCoreDialogProvider.h
 modules/gui/macosx/VLCCoreDialogProvider.m
 modules/gui/macosx/VLCCoreInteraction.h
 modules/gui/macosx/VLCCoreInteraction.m
+modules/gui/macosx/VLCErrorWindowController.h
+modules/gui/macosx/VLCErrorWindowController.m
 modules/gui/macosx/VLCExtensionsDialogProvider.h
 modules/gui/macosx/VLCExtensionsDialogProvider.m
 modules/gui/macosx/VLCExtensionsManager.h

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to