[vlc-commits] [Git][videolan/vlc][master] 6 commits: macosx: Use native icons for buttons in help window
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Mar 10 16:53:20 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
b0e30666 by Claudio Cambra at 2025-03-10T16:03:19+00:00
macosx: Use native icons for buttons in help window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
fe910489 by Claudio Cambra at 2025-03-10T16:03:19+00:00
macosx: Use modern properties for IBOutlets in help window controller
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2db7436c by Claudio Cambra at 2025-03-10T16:03:19+00:00
macosx: Use modern dot notation syntax for help window controller implementation
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
a2b236fc by Claudio Cambra at 2025-03-10T16:03:19+00:00
macosx: Present progress indicator when loading pages in the help window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
736d7ae2 by Claudio Cambra at 2025-03-10T16:03:19+00:00
macosx: Redesign bottom bar in help window as a visual effect view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
fv
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
d01eace0 by Claudio Cambra at 2025-03-10T16:03:19+00:00
macosx: Replace deprecated WebView with WKWebView in Help window
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3 changed files:
- modules/gui/macosx/UI/Help.xib
- modules/gui/macosx/windows/VLCHelpWindowController.h
- modules/gui/macosx/windows/VLCHelpWindowController.m
Changes:
=====================================
modules/gui/macosx/UI/Help.xib
=====================================
@@ -3,7 +3,6 @@
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
- <plugIn identifier="com.apple.WebKitIBPlugin" version="14113"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -11,8 +10,9 @@
<connections>
<outlet property="backButton" destination="2257" id="c2X-ol-C9I"/>
<outlet property="forwardButton" destination="2258" id="iEY-oD-cv3"/>
- <outlet property="helpWebView" destination="2241" id="cMX-Wb-U2g"/>
<outlet property="homeButton" destination="2256" id="sWB-6l-roa"/>
+ <outlet property="progressIndicator" destination="d97-0g-MPE" id="abc-ol-def"/>
+ <outlet property="visualEffectView" destination="FtB-z3-gSh" id="1234"/>
<outlet property="window" destination="2239" id="2342"/>
</connections>
</customObject>
@@ -28,59 +28,71 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="400"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <webView translatesAutoresizingMaskIntoConstraints="NO" id="2241">
- <rect key="frame" x="0.0" y="40" width="480" height="360"/>
- <webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12" plugInsEnabled="NO" javaEnabled="NO" javaScriptEnabled="NO" javaScriptCanOpenWindowsAutomatically="NO" loadsImagesAutomatically="NO" allowsAnimatedImages="NO" allowsAnimatedImageLooping="NO">
- <nil key="identifier"/>
- </webPreferences>
- <connections>
- <outlet property="frameLoadDelegate" destination="-2" id="2340"/>
- </connections>
- </webView>
- <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2256">
- <rect key="frame" x="20" y="8" width="27" height="25"/>
- <buttonCell key="cell" type="roundTextured" title="⌂" bezelStyle="texturedRounded" alignment="center" borderStyle="border" inset="2" id="2275">
- <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
- <font key="font" metaFont="systemBold" size="20"/>
- </buttonCell>
- <connections>
- <action selector="helpGoHome:" target="-2" id="2338"/>
- </connections>
- </button>
- <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2257">
- <rect key="frame" x="55" y="8" width="30" height="25"/>
- <buttonCell key="cell" type="roundTextured" title="←" bezelStyle="texturedRounded" alignment="center" borderStyle="border" inset="2" id="2276">
- <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
- <font key="font" metaFont="systemBold" size="18"/>
- </buttonCell>
- <connections>
- <action selector="goBack:" target="2241" id="2267"/>
- </connections>
- </button>
- <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2258">
- <rect key="frame" x="93" y="8" width="30" height="25"/>
- <buttonCell key="cell" type="roundTextured" title="→" bezelStyle="texturedRounded" alignment="center" borderStyle="border" inset="2" id="2277">
- <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
- <font key="font" metaFont="systemBold" size="18"/>
- </buttonCell>
- <connections>
- <action selector="goForward:" target="2241" id="2266"/>
- </connections>
- </button>
+ <visualEffectView blendingMode="behindWindow" material="titlebar" state="followsWindowActiveState" translatesAutoresizingMaskIntoConstraints="NO" id="FtB-z3-gSh">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="40"/>
+ <subviews>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2256">
+ <rect key="frame" x="9" y="8" width="31" height="23"/>
+ <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="house" catalog="system" imagePosition="overlaps" alignment="center" borderStyle="border" inset="2" id="2275">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="helpGoHome:" target="-2" id="2338"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2257">
+ <rect key="frame" x="43" y="8" width="22" height="23"/>
+ <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="chevron.left" catalog="system" imagePosition="only" alignment="center" borderStyle="border" inset="2" id="2276">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="helpGoBack:" target="-2" id="Jpt-6K-wje"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2258">
+ <rect key="frame" x="68" y="8" width="22" height="23"/>
+ <buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="chevron.right" catalog="system" imagePosition="only" alignment="center" borderStyle="border" inset="2" id="2277">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="helpGoForward:" target="-2" id="olV-gO-PNO"/>
+ </connections>
+ </button>
+ <progressIndicator wantsLayer="YES" maxValue="100" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="d97-0g-MPE">
+ <rect key="frame" x="454" y="10" width="16" height="20"/>
+ </progressIndicator>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="bottom" secondItem="2258" secondAttribute="bottom" constant="10" id="FaY-hq-qr1"/>
+ <constraint firstItem="2256" firstAttribute="top" secondItem="FtB-z3-gSh" secondAttribute="top" constant="10" id="Hoe-j8-9a3"/>
+ <constraint firstItem="2257" firstAttribute="leading" secondItem="2256" secondAttribute="trailing" constant="5" id="Kcg-D1-gaL"/>
+ <constraint firstItem="2257" firstAttribute="top" secondItem="FtB-z3-gSh" secondAttribute="top" constant="10" id="LxE-Q8-gUz"/>
+ <constraint firstAttribute="bottom" secondItem="d97-0g-MPE" secondAttribute="bottom" constant="10" id="QwV-el-tJ7"/>
+ <constraint firstItem="d97-0g-MPE" firstAttribute="top" secondItem="FtB-z3-gSh" secondAttribute="top" constant="10" id="RZ2-3B-lrf"/>
+ <constraint firstAttribute="bottom" secondItem="2256" secondAttribute="bottom" constant="10" id="UD7-Co-ctx"/>
+ <constraint firstAttribute="trailing" secondItem="d97-0g-MPE" secondAttribute="trailing" constant="10" id="gWB-OK-EUY"/>
+ <constraint firstAttribute="bottom" secondItem="2257" secondAttribute="bottom" constant="10" id="ld4-Qs-QKq"/>
+ <constraint firstItem="2258" firstAttribute="leading" secondItem="2257" secondAttribute="trailing" constant="5" id="ocS-aj-xnD"/>
+ <constraint firstAttribute="height" constant="40" id="ohq-yT-YZR"/>
+ <constraint firstItem="2258" firstAttribute="top" secondItem="FtB-z3-gSh" secondAttribute="top" constant="10" id="wNK-tJ-Ti3"/>
+ <constraint firstItem="2256" firstAttribute="leading" secondItem="FtB-z3-gSh" secondAttribute="leading" constant="10" id="ypi-IG-Txn"/>
+ </constraints>
+ </visualEffectView>
</subviews>
<constraints>
- <constraint firstItem="2257" firstAttribute="leading" secondItem="2256" secondAttribute="trailing" constant="8" id="6Va-Ur-0gs"/>
- <constraint firstItem="2241" firstAttribute="top" secondItem="2240" secondAttribute="top" id="7J6-p5-r45"/>
- <constraint firstAttribute="trailing" secondItem="2241" secondAttribute="trailing" id="CYF-2C-pXI"/>
- <constraint firstItem="2258" firstAttribute="leading" secondItem="2257" secondAttribute="trailing" constant="8" id="JGE-np-3B3"/>
- <constraint firstItem="2241" firstAttribute="leading" secondItem="2240" secondAttribute="leading" id="XlN-01-Yyk"/>
- <constraint firstItem="2256" firstAttribute="leading" secondItem="2240" secondAttribute="leading" constant="20" id="YuN-8j-3ks"/>
- <constraint firstAttribute="bottom" secondItem="2256" secondAttribute="bottom" constant="10" id="ZKn-0H-1ii"/>
- <constraint firstAttribute="bottom" secondItem="2241" secondAttribute="bottom" constant="40" id="qEX-nC-QiS"/>
- <constraint firstItem="2256" firstAttribute="centerY" secondItem="2257" secondAttribute="centerY" id="vba-6f-BZO"/>
- <constraint firstItem="2257" firstAttribute="centerY" secondItem="2258" secondAttribute="centerY" id="xIG-Tk-diy"/>
+ <constraint firstItem="FtB-z3-gSh" firstAttribute="leading" secondItem="2240" secondAttribute="leading" id="2QX-pH-XaP"/>
+ <constraint firstAttribute="trailing" secondItem="FtB-z3-gSh" secondAttribute="trailing" id="6pc-cs-Zwy"/>
+ <constraint firstAttribute="bottom" secondItem="FtB-z3-gSh" secondAttribute="bottom" id="XNK-O0-XXZ"/>
</constraints>
</view>
</window>
</objects>
+ <resources>
+ <image name="chevron.left" catalog="system" width="10" height="14"/>
+ <image name="chevron.right" catalog="system" width="10" height="14"/>
+ <image name="house" catalog="system" width="19" height="16"/>
+ </resources>
</document>
=====================================
modules/gui/macosx/windows/VLCHelpWindowController.h
=====================================
@@ -23,15 +23,18 @@
#import <WebKit/WebKit.h>
- at interface VLCHelpWindowController : NSWindowController
-{
- IBOutlet WebView *helpWebView;
- IBOutlet id backButton;
- IBOutlet id forwardButton;
- IBOutlet id homeButton;
-}
+ at interface VLCHelpWindowController : NSWindowController<WKNavigationDelegate>
+
+ at property (readonly) WKWebView *helpWebView;
+ at property (readwrite, weak) IBOutlet NSButton *backButton;
+ at property (readwrite, weak) IBOutlet NSButton *forwardButton;
+ at property (readwrite, weak) IBOutlet NSButton *homeButton;
+ at property (readwrite, weak) IBOutlet NSProgressIndicator *progressIndicator;
+ at property (readwrite, weak) IBOutlet NSVisualEffectView *visualEffectView;
- (IBAction)helpGoHome:(id)sender;
+- (IBAction)helpGoBack:(id)sender;
+- (IBAction)helpGoForward:(id)sender;
- (void)showHelp;
@end
=====================================
modules/gui/macosx/windows/VLCHelpWindowController.m
=====================================
@@ -37,21 +37,31 @@
{
self = [super initWithWindowNibName:@"Help"];
if (self) {
- [self setWindowFrameAutosaveName:@"help"];
+ self.windowFrameAutosaveName = @"help";
}
-
return self;
}
- (void)windowDidLoad
{
+ self.window.title = _NS("VLC media player Help");
if (@available(macOS 10.12, *)) {
self.window.tabbingMode = NSWindowTabbingModeDisallowed;
}
- [[self window] setTitle:_NS("VLC media player Help")];
- [forwardButton setToolTip:_NS("Next")];
- [backButton setToolTip:_NS("Previous")];
- [homeButton setToolTip:_NS("Index")];
+
+ _helpWebView = [[WKWebView alloc] initWithFrame:self.window.contentView.bounds];
+ self.helpWebView.navigationDelegate = self;
+ self.helpWebView.translatesAutoresizingMaskIntoConstraints = NO;
+ [self.window.contentView addSubview:self.helpWebView positioned:NSWindowBelow relativeTo:self.visualEffectView];
+
+ [self.helpWebView.topAnchor constraintEqualToAnchor:self.window.contentView.topAnchor].active = YES;
+ [self.helpWebView.bottomAnchor constraintEqualToAnchor:self.visualEffectView.topAnchor].active = YES;
+ [self.helpWebView.leadingAnchor constraintEqualToAnchor:self.window.contentView.leadingAnchor].active = YES;
+ [self.helpWebView.trailingAnchor constraintEqualToAnchor:self.window.contentView.trailingAnchor].active = YES;
+
+ self.forwardButton.toolTip = _NS("Next");
+ self.backButton.toolTip = _NS("Previous");
+ self.homeButton.toolTip = _NS("Index");
}
- (void)showHelp
@@ -62,19 +72,35 @@
- (IBAction)helpGoHome:(id)sender
{
- NSString *htmlWithStyle = [NSString
- stringWithFormat:@"<style>body { font-family: -apple-system, Helvetica Neue; }</style>%@",
- NSTR(I_LONGHELP)];
+ NSString * const style = @"<style>body { font-family: -apple-system, Helvetica Neue; }</style>";
+ NSString * const htmlWithStyle = [style stringByAppendingString:NSTR(I_LONGHELP)];
+ NSURL * const baseURL = [NSURL URLWithString:@"https://videolan.org"];
+ [self.helpWebView loadHTMLString:htmlWithStyle baseURL:baseURL];
+}
- [[helpWebView mainFrame] loadHTMLString:htmlWithStyle
- baseURL:[NSURL URLWithString:@"https://videolan.org"]];
+- (IBAction)helpGoBack:(id)sender
+{
+ [self.helpWebView goBack];
}
-- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+- (IBAction)helpGoForward:(id)sender
+{
+ [self.helpWebView goForward];
+}
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
{
/* Update back/forward button states whenever a new page is loaded */
- [forwardButton setEnabled:[helpWebView canGoForward]];
- [backButton setEnabled:[helpWebView canGoBack]];
+ self.forwardButton.enabled = webView.canGoForward;
+ self.backButton.enabled = webView.canGoBack;
+ self.progressIndicator.hidden = YES;
+ [self.progressIndicator stopAnimation:nil];
+}
+
+- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation
+{
+ self.progressIndicator.hidden = NO;
+ [self.progressIndicator startAnimation:nil];
}
@end
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d24015a21dd089ffd78bf6606be7c8e827e7a333...d01eace0064cf11965ead478c8fccda73b768e82
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d24015a21dd089ffd78bf6606be7c8e827e7a333...d01eace0064cf11965ead478c8fccda73b768e82
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list