[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: mark `getInput()` as const in PlayerController

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jul 20 14:54:11 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
58af8673 by Fatih Uzunoglu at 2024-07-20T14:33:51+00:00
qt: mark `getInput()` as const in PlayerController

- - - - -
24e20d20 by Fatih Uzunoglu at 2024-07-20T14:33:51+00:00
qt: rename property `isPlaying` to `isStarted` in PlayerController

- - - - -
53667ffe by Fatih Uzunoglu at 2024-07-20T14:33:51+00:00
qml: use `Player.isStarted` instead of `Player.playingState` in MiniPlayer.qml

- - - - -


8 changed files:

- modules/gui/qt/maininterface/qml/MainInterface.qml
- modules/gui/qt/player/player_controller.cpp
- modules/gui/qt/player/player_controller.hpp
- modules/gui/qt/player/qml/MiniPlayer.qml
- modules/gui/qt/player/qml/controlbarcontrols/InfoButton.qml
- modules/gui/qt/player/qml/controlbarcontrols/RecordButton.qml
- modules/gui/qt/player/qml/controlbarcontrols/SnapshotButton.qml
- modules/gui/qt/player/qml/controlbarcontrols/StopButton.qml


Changes:

=====================================
modules/gui/qt/maininterface/qml/MainInterface.qml
=====================================
@@ -239,7 +239,7 @@ Item {
 
                 if (urls.length > 0) {
                     /* D&D of a subtitles file, add it on the fly */
-                    if (Player.isPlaying && urls.length == 1) {
+                    if (Player.isStarted && urls.length == 1) {
                         if (Player.associateSubtitleFile(urls[0])) {
                             drop.accept()
                             return


=====================================
modules/gui/qt/player/player_controller.cpp
=====================================
@@ -1162,20 +1162,25 @@ vlc_player_t * PlayerController::getPlayer() const
     return d->m_player;
 }
 
-input_item_t *PlayerController::getInput()
+input_item_t *PlayerController::getInput() const
 {
-    Q_D(PlayerController);
+    Q_D(const PlayerController);
     vlc_player_locker locker{ d->m_player };
     return vlc_player_GetCurrentMedia( d->m_player );
 }
 
-bool PlayerController::hasInput() const
+bool PlayerController::isStarted() const
 {
     Q_D(const PlayerController);
     vlc_player_locker locker{ d->m_player };
     return vlc_player_IsStarted( d->m_player );
 }
 
+bool PlayerController::hasInput() const
+{
+    return getInput();
+}
+
 void PlayerController::reverse()
 {
     Q_D(PlayerController);


=====================================
modules/gui/qt/player/player_controller.hpp
=====================================
@@ -106,7 +106,7 @@ public:
 
     //playback
     Q_PROPERTY(PlayingState playingState READ getPlayingState NOTIFY playingStateChanged FINAL)
-    Q_PROPERTY(bool isPlaying READ hasInput NOTIFY inputChanged FINAL)
+    Q_PROPERTY(bool isStarted READ isStarted NOTIFY playingStateChanged FINAL)
     Q_PROPERTY(QString name READ getName NOTIFY nameChanged FINAL)
     Q_PROPERTY(float buffering READ getBuffering  NOTIFY bufferingChanged FINAL)
     Q_PROPERTY(float rate READ getRate WRITE setRate NOTIFY rateChanged FINAL)
@@ -257,7 +257,7 @@ public:
 public:
     vlc_player_t * getPlayer() const;
 
-    input_item_t *getInput();
+    input_item_t *getInput() const;
 
     SharedVOutThread getVout();
     VOutThreadList getVouts() const;
@@ -274,6 +274,7 @@ public:
 public slots:
     //playback
     PlayingState getPlayingState() const;
+    bool isStarted() const;
     bool hasInput() const;
     QString getName() const;
     float getBuffering() const;


=====================================
modules/gui/qt/player/qml/MiniPlayer.qml
=====================================
@@ -28,8 +28,8 @@ ControlBar {
 
     anchors.bottomMargin: (state === "outViewport") ? -_delayedImplicitHeight : 0
 
-    state: (Player.playingState === Player.PLAYING_STATE_STOPPED) ? "outViewport"
-                                                                  : "inViewport"
+    state: Player.isStarted ? "inViewport"
+                            : "outViewport"
 
     textPosition: (MainCtx.pinVideoControls) ? ControlBar.TimeTextPosition.LeftRightSlider
                                              : ControlBar.TimeTextPosition.Hide


=====================================
modules/gui/qt/player/qml/controlbarcontrols/InfoButton.qml
=====================================
@@ -25,7 +25,7 @@ import "qrc:///style/"
 
 Widgets.IconToolButton {
     id: infoBtn
-    enabled: Player.isPlaying
+    enabled: Player.isStarted
     text: VLCIcons.info
     onClicked: DialogsProvider.mediaInfoDialog()
     description: qsTr("Information")


=====================================
modules/gui/qt/player/qml/controlbarcontrols/RecordButton.qml
=====================================
@@ -27,7 +27,7 @@ import "qrc:///style/"
 Widgets.IconToolButton {
     id: control
 
-    enabled: !paintOnly && Player.isPlaying
+    enabled: !paintOnly && Player.isStarted
 
     color: "#FFFF0000" //red means recording
     text: VLCIcons.record


=====================================
modules/gui/qt/player/qml/controlbarcontrols/SnapshotButton.qml
=====================================
@@ -25,7 +25,7 @@ import "qrc:///style/"
 
 Widgets.IconToolButton {
     id: snapshotBtn
-    enabled: Player.isPlaying
+    enabled: Player.isStarted
     text: VLCIcons.snapshot
     onClicked: Player.snapshot()
     description: qsTr("Snapshot")


=====================================
modules/gui/qt/player/qml/controlbarcontrols/StopButton.qml
=====================================
@@ -25,7 +25,7 @@ import "qrc:///style/"
 
 Widgets.IconToolButton {
     id: stopBtn
-    enabled: Player.isPlaying
+    enabled: Player.isStarted
     text: VLCIcons.stop
     onClicked: MainPlaylistController.stop()
     description: qsTr("Stop")



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e349f5d1f14736e35f53bc76dcbe5a808d7e9c97...53667ffe16991f44e38bef96156c1df47d2ec4c5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e349f5d1f14736e35f53bc76dcbe5a808d7e9c97...53667ffe16991f44e38bef96156c1df47d2ec4c5
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