[vlc-commits] macosx: add helper for sidebar icons on mojave

Felix Paul Kühne git at videolan.org
Wed Oct 31 20:40:32 CET 2018


vlc/vlc-3.0 | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue Oct  9 13:14:36 2018 +0200| [4d4670e1e7703f36e2eced60c409f65b4f46efb0] | committer: Felix Paul Kühne

macosx: add helper for sidebar icons on mojave

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

 modules/gui/macosx/VLCStringUtility.h |  1 +
 modules/gui/macosx/VLCStringUtility.m | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/modules/gui/macosx/VLCStringUtility.h b/modules/gui/macosx/VLCStringUtility.h
index e75666cc2c..4163d97c4b 100644
--- a/modules/gui/macosx/VLCStringUtility.h
+++ b/modules/gui/macosx/VLCStringUtility.h
@@ -57,6 +57,7 @@ unsigned int CocoaKeyToVLC(unichar i_key);
  * depending on the os version.
  */
 NSImage *imageFromRes(NSString *o_id);
+NSImage *sidebarImageFromRes(NSString *o_id, BOOL darkMode);
 
 @interface VLCStringUtility : NSObject
 
diff --git a/modules/gui/macosx/VLCStringUtility.m b/modules/gui/macosx/VLCStringUtility.m
index 2a083fa57c..2a5c676111 100644
--- a/modules/gui/macosx/VLCStringUtility.m
+++ b/modules/gui/macosx/VLCStringUtility.m
@@ -523,3 +523,20 @@ NSImage *imageFromRes(NSString *o_id)
 
     return [NSImage imageNamed:result];
 }
+
+NSImage *sidebarImageFromRes(NSString *o_id, BOOL darkMode)
+{
+    if (!OSX_MOJAVE_AND_HIGHER) {
+        return imageFromRes(o_id);
+    }
+
+    NSString *result = @"";
+    if (darkMode) {
+        result = [result stringByAppendingString:@"mv-dark-"];
+    } else {
+        result = [result stringByAppendingString:@"mv-"];
+    }
+    result = [result stringByAppendingString:o_id];
+
+    return [NSImage imageNamed:result];
+}



More information about the vlc-commits mailing list