[vlc-commits] [Git][videolan/vlc][master] 4 commits: qt/MainCtx: add screen property
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Sun Feb 6 14:38:51 UTC 2022
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
c5075f22 by Prince Gupta at 2022-02-06T14:21:17+00:00
qt/MainCtx: add screen property
- - - - -
72b7512f by Prince Gupta at 2022-02-06T14:21:17+00:00
qml: implement Widgets.ScaledImage
- - - - -
20f6c140 by Prince Gupta at 2022-02-06T14:21:17+00:00
qml: use ScaledImage for delegate images
- - - - -
6180c91f by Prince Gupta at 2022-02-06T14:21:17+00:00
qml: use ScaledImage in DragItem
- - - - -
10 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/maininterface/mainctx.hpp
- modules/gui/qt/maininterface/mainui.cpp
- modules/gui/qt/network/qml/NetworkCustomCover.qml
- modules/gui/qt/network/qml/NetworkThumbnailItem.qml
- modules/gui/qt/playlist/qml/PlaylistDelegate.qml
- modules/gui/qt/vlc.qrc
- modules/gui/qt/widgets/qml/DragItem.qml
- + modules/gui/qt/widgets/qml/ScaledImage.qml
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -902,6 +902,7 @@ libqt_plugin_la_QML = \
gui/qt/widgets/qml/NavigableRow.qml \
gui/qt/widgets/qml/PlayCover.qml \
gui/qt/widgets/qml/RoundButton.qml \
+ gui/qt/widgets/qml/ScaledImage.qml \
gui/qt/widgets/qml/ScanProgressBar.qml \
gui/qt/widgets/qml/ScrollingText.qml \
gui/qt/widgets/qml/SearchBox.qml \
=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -177,6 +177,14 @@ MainCtx::MainCtx(qt_intf_t *_p_intf)
connect(this, &MainCtx::interfaceFullScreenChanged, this, &MainCtx::useClientSideDecorationChanged);
+ 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
=====================================
@@ -175,6 +175,7 @@ class MainCtx : public QObject
Q_PROPERTY(vlc::playlist::PlaylistControllerModel* mainPlaylistController READ getMainPlaylistController CONSTANT 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)
// This Property only works if hasAcrylicSurface is set
Q_PROPERTY(bool acrylicActive READ acrylicActive WRITE setAcrylicActive NOTIFY acrylicActiveChanged FINAL)
@@ -253,6 +254,7 @@ 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(); }
bool hasEmbededVideo() const;
VideoSurfaceProvider* getVideoSurfaceProvider() const;
@@ -425,6 +427,8 @@ signals:
void preferHotkeysChanged();
+ void screenChanged();
+
private:
void loadPrefs(bool callSignals);
void loadFromSettingsImpl(bool callSignals);
=====================================
modules/gui/qt/maininterface/mainui.cpp
=====================================
@@ -55,6 +55,7 @@
#include "videosurface.hpp"
+#include <QScreen>
#include <QQuickWindow>
#include <QQmlContext>
#include <QQmlFileSelector>
@@ -212,6 +213,7 @@ void MainUI::registerQMLTypes()
qmlRegisterUncreatableType<QAbstractItemModel>(uri, versionMajor, versionMinor, "QtAbstractItemModel", "");
qmlRegisterUncreatableType<QWindow>(uri, versionMajor, versionMinor, "QtWindow", "");
+ qmlRegisterUncreatableType<QScreen>(uri, versionMajor, versionMinor, "QtScreen", "");
qRegisterMetaType<VLCTick>();
qmlRegisterUncreatableType<VLCTick>(uri, versionMajor, versionMinor, "VLCTick", "");
=====================================
modules/gui/qt/network/qml/NetworkCustomCover.qml
=====================================
@@ -28,7 +28,7 @@ Item {
property var networkModel
property alias iconSize: custom_cover.width
- Image {
+ Widgets.ScaledImage {
id: custom_cover
anchors.centerIn: parent
=====================================
modules/gui/qt/network/qml/NetworkThumbnailItem.qml
=====================================
@@ -73,7 +73,7 @@ Item {
}
}
- Image {
+ Widgets.ScaledImage {
id: artwork
x: (width - paintedWidth) / 2
=====================================
modules/gui/qt/playlist/qml/PlaylistDelegate.qml
=====================================
@@ -131,7 +131,7 @@ T.Control {
spread: 0.1
}
- Image {
+ Widgets.ScaledImage {
id: artwork
anchors.fill: parent
=====================================
modules/gui/qt/vlc.qrc
=====================================
@@ -265,6 +265,7 @@
<file alias="GridShadows.qml">widgets/qml/GridShadows.qml</file>
<file alias="ToolTipExt.qml">widgets/qml/ToolTipExt.qml</file>
<file alias="MLDragItem.qml">widgets/qml/MLDragItem.qml</file>
+ <file alias="ScaledImage.qml">widgets/qml/ScaledImage.qml</file>
</qresource>
<qresource prefix="/network">
<file alias="AddressbarButton.qml">network/qml/AddressbarButton.qml</file>
=====================================
modules/gui/qt/widgets/qml/DragItem.qml
=====================================
@@ -347,7 +347,7 @@ Item {
Component {
id: artworkLoader
- Image {
+ ScaledImage {
fillMode: Image.PreserveAspectCrop
width: coverSize
height: coverSize
=====================================
modules/gui/qt/widgets/qml/ScaledImage.qml
=====================================
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * Copyright (C) 2022 VLC authors and VideoLAN
+ *
+ * Authors: Prince Gupta <guptaprince8832 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+import QtQuick 2.11
+
+import org.videolan.vlc 0.1
+
+Image {
+ sourceSize: Qt.size(width * MainCtx.screen.devicePixelRatio
+ , height * MainCtx.screen.devicePixelRatio)
+}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3c9c32ab3bd0258aa55bd353609c96846ce21373...6180c91f528964fec600d21e29af2f422b136623
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3c9c32ab3bd0258aa55bd353609c96846ce21373...6180c91f528964fec600d21e29af2f422b136623
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list