[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: add url manipulation functions in MainCtx

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Mon Jul 1 13:22:44 UTC 2024



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
41482cbe by Prince Gupta at 2024-07-01T12:49:28+00:00
qt: add url manipulation functions in MainCtx

- - - - -
2ced1495 by Prince Gupta at 2024-07-01T12:49:28+00:00
qt: add link based color in palette

- - - - -
e5d8a48c by Prince Gupta at 2024-07-01T12:49:28+00:00
qml: add option to open location of media in Video expand panel

- - - - -


4 changed files:

- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/maininterface/mainctx.hpp
- modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
- modules/gui/qt/style/systempalette.cpp


Changes:

=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -30,6 +30,7 @@
 
 #include "mainctx.hpp"
 #include "mainctx_submodels.hpp"
+#include "medialibrary/mlhelper.hpp"
 
 #include "compositor.hpp"
 #include "util/renderer_manager.hpp"
@@ -51,7 +52,6 @@
 
 #include "dialogs/toolbar/controlbar_profile_model.hpp"
 
-
 #include <QKeyEvent>
 
 #include <QUrl>
@@ -533,6 +533,27 @@ WorkerThreadSet* MainCtx::workersThreads() const
     return m_workersThreads.get();
 }
 
+QUrl MainCtx::folderMRL(const QString &fileMRL) const
+{
+    return folderMRL(QUrl::fromUserInput(fileMRL));
+}
+
+QUrl MainCtx::folderMRL(const QUrl &fileMRL) const
+{
+    if (fileMRL.isLocalFile())
+    {
+        const QString f = fileMRL.toLocalFile();
+        return QUrl::fromLocalFile(QFileInfo(f).absoluteDir().absolutePath());
+    }
+
+    return {};
+}
+
+QString MainCtx::displayMRL(const QUrl &mrl) const
+{
+    return urlToDisplayString(mrl);
+}
+
 void MainCtx::setMediaLibraryVisible( bool visible )
 {
     if (m_mediaLibraryVisible == visible)


=====================================
modules/gui/qt/maininterface/mainctx.hpp
=====================================
@@ -280,6 +280,11 @@ public:
 
     WorkerThreadSet *workersThreads() const;
 
+    Q_INVOKABLE QUrl folderMRL(const QString &fileMRL) const;
+    Q_INVOKABLE QUrl folderMRL(const QUrl &fileMRL) const;
+
+    Q_INVOKABLE QString displayMRL(const QUrl &mrl) const;
+
 protected:
     /* Systray */
     void createSystray();


=====================================
modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
=====================================
@@ -204,12 +204,29 @@ FocusScope {
                 }
 
                 Widgets.MenuCaption {
-                    text: "<b>" + qsTr("Path:") + "</b> " + root.model.display_mrl
+
+                    readonly property string folderMRL: MainCtx.folderMRL(root.model?.mrl ?? "")
+
+                    text: {
+                        if (!!folderMRL)
+                            return "<b>%1</b> <a href='%2'>%3</a>"
+                                        .arg(qsTr("Folder:"))
+                                        .arg(folderMRL)
+                                        .arg(MainCtx.displayMRL(folderMRL))
+
+                        return "<b>" + qsTr("Path:") + "</b> " + root.model.display_mrl
+                    }
+
+                    linkColor: theme.fg.link
                     color: theme.fg.secondary
                     topPadding: VLCStyle.margin_xsmall
                     bottomPadding: VLCStyle.margin_large
                     width: parent.width
                     textFormat: Text.StyledText
+
+                    onLinkActivated: function (link) {
+                        Qt.openUrlExternally(link)
+                    }
                 }
 
                 Widgets.ButtonExt {


=====================================
modules/gui/qt/style/systempalette.cpp
=====================================
@@ -476,6 +476,7 @@ void SystemPalette::makeLightPalette()
         setColor(CS, C::Decoration, C::Shadow, C::Normal, setColorAlpha(Qt::black, 0.22));
 
         setColor(CS, C::Decoration, C::Accent, C::Normal, orange800);
+        setColor(CS, C::Fg, C::Link, C::Normal, orange800 /* accent */);
     }
 
     //window banner & miniplayer
@@ -673,6 +674,7 @@ void SystemPalette::makeDarkPalette()
         setColor(CS, C::Decoration, C::Separator, C::Normal, darkGrey800);
 
         setColor(CS, C::Decoration, C::Accent, C::Normal, orange500);
+        setColor(CS, C::Fg, C::Link, C::Normal, orange500);
     }
 
     //window banner & miniplayer



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1a26d96f75b9308c3eb67a002cc08ac4fd6db0b9...e5d8a48c66d4a422dfb7713555275409830d2a1e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1a26d96f75b9308c3eb67a002cc08ac4fd6db0b9...e5d8a48c66d4a422dfb7713555275409830d2a1e
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