[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: don't allow PrefsDialog to open multiple times in DialogsProvider

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Apr 4 17:01:08 UTC 2022



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


Commits:
35a4f486 by Fatih Uzunoglu at 2022-04-04T15:33:32+00:00
qt: don't allow PrefsDialog to open multiple times in DialogsProvider

allowing PrefsDialog to be opened multiple time causes massive freezing

- - - - -
3035fa4e by Fatih Uzunoglu at 2022-04-04T15:33:32+00:00
qml: fix asynchronous handling of synchronous calls in shortcuts

- - - - -


2 changed files:

- modules/gui/qt/dialogs/dialogs_provider.cpp
- modules/gui/qt/menus/qml/GlobalShortcuts.qml


Changes:

=====================================
modules/gui/qt/dialogs/dialogs_provider.cpp
=====================================
@@ -62,6 +62,7 @@
 #include <QFileDialog>
 #include <QUrl>
 #include <QInputDialog>
+#include <QPointer>
 
 #define I_OP_DIR_WINTITLE I_DIR_OR_FOLDER( N_("Open Directory"), \
                                            N_("Open Folder") )
@@ -248,9 +249,18 @@ const QEvent::Type DialogEvent::DialogEvent_Type =
 
 void DialogsProvider::prefsDialog()
 {
-    PrefsDialog *p = new PrefsDialog( nullptr, p_intf );
-    p->setAttribute(Qt::WA_DeleteOnClose);
-    p->toggleVisible();
+    static QPointer<PrefsDialog> p;
+
+    if (Q_LIKELY(!p))
+    {
+        p = new PrefsDialog( nullptr, p_intf );
+        p->setAttribute(Qt::WA_DeleteOnClose);
+        p->open();
+    }
+    else
+    {
+        p->reject();
+    }
 }
 
 void DialogsProvider::firstRunDialog()


=====================================
modules/gui/qt/menus/qml/GlobalShortcuts.qml
=====================================
@@ -21,14 +21,14 @@ import QtQuick 2.11
 import org.videolan.vlc 0.1
 
 Item {
-    Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+O"; onActivated: DialogsProvider.simpleOpenDialog(); }
+    Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+O"; onActivated: { enabled = false; DialogsProvider.simpleOpenDialog(); enabled = true } }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+Shift+O"; onActivated: DialogsProvider.openFileDialog(); }
-    Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+F"; onActivated: DialogsProvider.PLOpenDir(); }
+    Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+F"; onActivated: { enabled = false; DialogsProvider.PLOpenDir(); enabled = true; } }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+D"; onActivated: DialogsProvider.openDiscDialog(); }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+N"; onActivated: DialogsProvider.openNetDialog(); }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+C"; onActivated: DialogsProvider.openCaptureDialog(); }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+V"; onActivated: DialogsProvider.openUrlDialog(); }
-    Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+Y"; onActivated: DialogsProvider.savePlayingToPlaylist(); }
+    Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+Y"; onActivated: { enabled = false; DialogsProvider.savePlayingToPlaylist(); enabled = true; } }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+R"; onActivated: DialogsProvider.openAndTranscodingDialogs(); }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+S"; onActivated: DialogsProvider.openAndStreamingDialogs(); }
     Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+Q"; onActivated: DialogsProvider.quit(); }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/db1abbe0311fb62a11feef9a57080d14357e0cf9...3035fa4ea2fad12d697c92d3cc6114a42b2d1ec3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/db1abbe0311fb62a11feef9a57080d14357e0cf9...3035fa4ea2fad12d697c92d3cc6114a42b2d1ec3
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