[vlc-commits] macosx/library: display playback progress
Felix Paul Kühne
git at videolan.org
Thu May 2 22:56:24 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Thu May 2 22:55:49 2019 +0200| [9489908e343d77f9e2093e8f65007b6ef74162fd] | committer: Felix Paul Kühne
macosx/library: display playback progress
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9489908e343d77f9e2093e8f65007b6ef74162fd
---
modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib | 10 ++++++++++
modules/gui/macosx/library/VLCLibraryCollectionViewItem.h | 2 ++
modules/gui/macosx/library/VLCLibraryCollectionViewItem.m | 9 +++++++++
3 files changed, 21 insertions(+)
diff --git a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
index ae7468c34e..021f5b4cb8 100644
--- a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
+++ b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
@@ -13,6 +13,7 @@
<outlet property="mediaImageView" destination="2aB-sB-hfY" id="Sv0-G1-KNm"/>
<outlet property="mediaTitleTextField" destination="OBS-Eh-1mT" id="h1n-PU-IAx"/>
<outlet property="playInstantlyButton" destination="S3I-5Z-qgS" id="JlC-bE-i5Y"/>
+ <outlet property="progressIndicator" destination="dFt-oZ-h9P" id="JC6-gk-Mid"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
@@ -25,6 +26,12 @@
<customView translatesAutoresizingMaskIntoConstraints="NO" id="2aB-sB-hfY" customClass="VLCImageView">
<rect key="frame" x="0.0" y="46" width="256" height="168"/>
<subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="dFt-oZ-h9P" customClass="VLCLinearProgressIndicator">
+ <rect key="frame" x="0.0" y="0.0" width="256" height="10"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="10" id="lyQ-kl-gVk"/>
+ </constraints>
+ </customView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="S3I-5Z-qgS">
<rect key="frame" x="96" y="52" width="64" height="64"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="libraryPlay" imagePosition="only" alignment="center" inset="2" id="IHP-p1-d0R">
@@ -45,9 +52,12 @@
</textField>
</subviews>
<constraints>
+ <constraint firstAttribute="bottom" secondItem="dFt-oZ-h9P" secondAttribute="bottom" id="4q3-3S-7PA"/>
<constraint firstItem="S3I-5Z-qgS" firstAttribute="centerX" secondItem="2aB-sB-hfY" secondAttribute="centerX" id="Seo-tS-piW"/>
<constraint firstAttribute="height" constant="168" id="Vrp-AD-scC"/>
<constraint firstItem="S3I-5Z-qgS" firstAttribute="centerY" secondItem="2aB-sB-hfY" secondAttribute="centerY" id="ZWU-oW-OVa"/>
+ <constraint firstItem="dFt-oZ-h9P" firstAttribute="leading" secondItem="2aB-sB-hfY" secondAttribute="leading" id="gTe-sx-hdP"/>
+ <constraint firstAttribute="trailing" secondItem="dFt-oZ-h9P" secondAttribute="trailing" id="kBI-UU-vnc"/>
</constraints>
</customView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OBS-Eh-1mT">
diff --git a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.h b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
index b35d009f02..2880a0a5a8 100644
--- a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
+++ b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
@@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
extern NSString *VLCLibraryCellIdentifier;
@class VLCImageView;
+ at class VLCLinearProgressIndicator;
@class VLCMediaLibraryMediaItem;
@interface VLCLibraryCollectionViewItem : NSCollectionViewItem
@@ -37,6 +38,7 @@ extern NSString *VLCLibraryCellIdentifier;
@property (readwrite, assign) IBOutlet VLCImageView *mediaImageView;
@property (readwrite, assign) IBOutlet NSButton *playInstantlyButton;
@property (readwrite, assign) IBOutlet NSButton *addToPlaylistButton;
+ at property (readwrite, assign) IBOutlet VLCLinearProgressIndicator *progressIndicator;
@property (readwrite, assign, nonatomic) VLCMediaLibraryMediaItem *representedMediaItem;
diff --git a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
index 3a2b5dc9c3..ddf1b654b8 100644
--- a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
+++ b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
@@ -28,6 +28,7 @@
#import "library/VLCLibraryModel.h"
#import "library/VLCLibraryDataTypes.h"
#import "views/VLCImageView.h"
+#import "views/VLCLinearProgressIndicator.h"
#import "extensions/NSString+Helpers.h"
#import "extensions/NSFont+VLCAdditions.h"
#import "extensions/NSColor+VLCAdditions.h"
@@ -159,6 +160,14 @@ NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier";
} else {
_annotationTextField.hidden = YES;
}
+
+ CGFloat position = _representedMediaItem.lastPlaybackPosition;
+ if (position > .05 && position < .95) {
+ _progressIndicator.progress = position;
+ _progressIndicator.hidden = NO;
+ } else {
+ _progressIndicator.hidden = YES;
+ }
}
#pragma mark - actions
More information about the vlc-commits
mailing list