[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: use attached screen instead of MainCtx's screen in Player.qml

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Aug 31 13:35:38 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
72627ec1 by Fatih Uzunoglu at 2024-08-31T12:42:21+00:00
qml: use attached screen instead of MainCtx's screen in Player.qml

- - - - -
dfbf888d by Fatih Uzunoglu at 2024-08-31T12:42:21+00:00
qml: use attached screen instead of MainCtx's screen in ScaledImage.qml

- - - - -
09a6f725 by Fatih Uzunoglu at 2024-08-31T12:42:21+00:00
qml: use attached screen instead of MainCtx's screen in ArtistTopBanner.qml

- - - - -
cdadf978 by Fatih Uzunoglu at 2024-08-31T12:42:21+00:00
qt: get rid of property `screen` in MainCtx

- - - - -


5 changed files:

- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/maininterface/mainctx.hpp
- modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
- modules/gui/qt/player/qml/Player.qml
- modules/gui/qt/widgets/qml/ScaledImage.qml


Changes:

=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -191,14 +191,6 @@ MainCtx::MainCtx(qt_intf_t *_p_intf)
     /* VideoWidget connects for asynchronous calls */
     connect( this, &MainCtx::askToQuit, THEDP, &DialogsProvider::quit, Qt::QueuedConnection  );
 
-    QMetaObject::invokeMethod(this, [this]()
-    {
-        // *** HACKY ***
-        assert(p_intf->p_compositor->interfaceMainWindow());
-        connect(p_intf->p_compositor->interfaceMainWindow(), &QWindow::screenChanged,
-                this, &MainCtx::screenChanged);
-    }, Qt::QueuedConnection);
-
     /** END of CONNECTS**/
 
 


=====================================
modules/gui/qt/maininterface/mainctx.hpp
=====================================
@@ -59,7 +59,6 @@ class QVBoxLayout;
 class QStackedLayout;
 class QMenu;
 class QSize;
-class QScreen;
 class QTimer;
 class QSystemTrayIcon;
 class StandardPLPanel;
@@ -122,7 +121,6 @@ class MainCtx : public QObject
     Q_PROPERTY(bool hasAcrylicSurface READ hasAcrylicSurface NOTIFY hasAcrylicSurfaceChanged FINAL)
     Q_PROPERTY(bool smoothScroll READ smoothScroll NOTIFY smoothScrollChanged FINAL)
     Q_PROPERTY(QWindow* intfMainWindow READ intfMainWindow CONSTANT FINAL)
-    Q_PROPERTY(QScreen* screen READ screen NOTIFY screenChanged)
     Q_PROPERTY(bool useGlobalShortcuts READ getUseGlobalShortcuts WRITE setUseGlobalShortcuts NOTIFY useGlobalShortcutsChanged FINAL)
     Q_PROPERTY(int maxVolume READ maxVolume NOTIFY maxVolumeChanged FINAL)
     Q_PROPERTY(float safeArea READ safeArea NOTIFY safeAreaChanged FINAL)
@@ -223,7 +221,6 @@ public:
     inline void setDialogFilePath(const QUrl& filepath ){ m_dialogFilepath = filepath; }
     inline bool hasAcrylicSurface() const { return m_hasAcrylicSurface; }
     inline void reloadFromSettings() { loadFromSettingsImpl(true); }
-    inline QScreen* screen() const { return intfMainWindow()->screen(); }
     inline bool getUseGlobalShortcuts() const { return m_useGlobalShortcuts; }
     void setUseGlobalShortcuts(bool useGlobalShortcuts );
     inline int maxVolume() const { return m_maxVolume; }
@@ -450,8 +447,6 @@ signals:
 
     void preferHotkeysChanged();
 
-    void screenChanged();
-
     void useGlobalShortcutsChanged( bool );
 
     void maxVolumeChanged();


=====================================
modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
=====================================
@@ -18,6 +18,7 @@
 import QtQuick
 import QtQuick.Controls
 import QtQuick.Layouts
+import QtQuick.Window
 import QtQml.Models
 import Qt5Compat.GraphicalEffects
 
@@ -59,7 +60,7 @@ FocusScope {
 
         asynchronous: true
         source: artist.cover || VLCStyle.noArtArtist
-        sourceSize: artist.cover ? Qt.size(MainCtx.screen ? Helpers.alignUp(MainCtx.screen.availableGeometry.width, 32) : 1024, 0)
+        sourceSize: artist.cover ? Qt.size(Helpers.alignUp(Screen.desktopAvailableWidth, 32), 0)
                                  : undefined
         mipmap: !!artist.cover
         fillMode: artist.cover ? Image.PreserveAspectCrop : Image.Tile


=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -406,12 +406,8 @@ FocusScope {
 
                     //source aspect ratio
                     readonly property real sar: paintedWidth / paintedHeight
-                    readonly property int maximumWidth: MainCtx.screen
-                                                          ? Helpers.alignUp((MainCtx.screen.availableGeometry.width / coverItem.sizeConstant), 32)
-                                                          : 1024
-                    readonly property int maximumHeight: MainCtx.screen
-                                                          ? Helpers.alignUp((MainCtx.screen.availableGeometry.height / coverItem.sizeConstant), 32)
-                                                          : 1024
+                    readonly property int maximumWidth: Helpers.alignUp((Screen.desktopAvailableWidth / coverItem.sizeConstant), 32)
+                    readonly property int maximumHeight: Helpers.alignUp((Screen.desktopAvailableHeight / coverItem.sizeConstant), 32)
 
                     readonly property int maximumSize: Math.min(maximumWidth, maximumHeight)
 


=====================================
modules/gui/qt/widgets/qml/ScaledImage.qml
=====================================
@@ -19,13 +19,14 @@
  *****************************************************************************/
 
 import QtQuick
+import QtQuick.Window
 
 import VLC.MainInterface
 
 Image {
     id: root
-    sourceSize: Qt.size(width * MainCtx.screen.devicePixelRatio
-                    , height * MainCtx.screen.devicePixelRatio)
+    sourceSize: Qt.size(width * Screen.devicePixelRatio,
+                        height * Screen.devicePixelRatio)
 
     property bool disableSmoothWhenIntegerUpscaling: false
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/83ec7818d3bd893f7373a6522e822b3834f58f64...cdadf978c0c09b5f5078668ec4c95a12beb00a74

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/83ec7818d3bd893f7373a6522e822b3834f58f64...cdadf978c0c09b5f5078668ec4c95a12beb00a74
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