[vlc-devel] [RFC 27/82] qt: provide the main playist and player controler in qt context
Pierre Lamot
pierre at videolabs.io
Fri Feb 1 14:01:31 CET 2019
---
modules/gui/qt/qt.cpp | 33 +++++++++++++--------------------
modules/gui/qt/qt.hpp | 20 +++++++++++++-------
2 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index 1999c6a54a..2536278b0e 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -45,7 +45,8 @@ extern "C" char **environ;
#include "qt.hpp"
-#include "input_manager.hpp" /* THEMIM destruction */
+#include "components/player_controler.hpp" /* THEMIM destruction */
+#include "components/playlist/playlist_controler.hpp" /* THEMPL creation */
#include "dialogs_provider.hpp" /* THEDP creation */
#ifdef _WIN32
# include "main_interface_win32.hpp"
@@ -57,10 +58,9 @@ extern "C" char **environ;
#include "dialogs/help.hpp" /* Launch Update */
#include "recents.hpp" /* Recents Item destruction */
#include "util/qvlcapp.hpp" /* QVLCApplication definition */
-#include "components/playlist/playlist_model.hpp" /* for ~PLModel() */
#include <QVector>
-#include "components/playlist_new/playlist_item.hpp"
+#include "components/playlist/playlist_item.hpp"
#include <vlc_plugin.h>
#include <vlc_vout_window.h>
@@ -439,7 +439,6 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
intf_sys_t *p_sys = p_intf->p_sys = new intf_sys_t;
p_sys->b_isDialogProvider = isDialogProvider;
p_sys->p_mi = NULL;
- p_sys->pl_model = NULL;
/* set up the playlist to work on */
if( isDialogProvider )
@@ -489,13 +488,6 @@ static void Close( vlc_object_t *p_this )
intf_thread_t *p_intf = (intf_thread_t *)p_this;
intf_sys_t *p_sys = p_intf->p_sys;
- if( !p_sys->b_isDialogProvider )
- {
- playlist_t *pl = THEPL;
-
- playlist_Deactivate (pl); /* release window provider if needed */
- }
-
/* And quit */
msg_Dbg( p_this, "requesting exit..." );
QVLCApp::triggerQuit();
@@ -591,8 +583,8 @@ static void *Thread( void *obj )
/* Initialize the Dialog Provider and the Main Input Manager */
DialogsProvider::getInstance( p_intf );
- MainInputManager* mim = MainInputManager::getInstance( p_intf );
- mim->probeCurrentInput();
+ p_sys->p_mainPlayerControler = new PlayerControler(p_intf);
+ p_sys->p_mainPlaylistControler = new vlc::playlist::PlaylistControlerModel(p_intf->p_sys->p_playlist);
#ifdef UPDATE_CHECK
/* Checking for VLC updates */
@@ -661,7 +653,10 @@ static void *Thread( void *obj )
#ifdef Q_OS_MAC
/* We took over main thread, register and start here */
if( !p_sys->b_isDialogProvider )
- playlist_Play( THEPL );
+ {
+ vlc_playlist_locker pllock{ THEPL };
+ vlc_playlist_Start( THEPL );
+ }
#endif
/* Last settings */
@@ -716,12 +711,10 @@ static void *Thread( void *obj )
else
getSettings()->remove( "filedialog-path" );
- /* */
- delete p_sys->pl_model;
-
- /* Destroy the MainInputManager */
- MainInputManager::killInstance();
-
+ /* Destroy the main playlist controler */
+ delete p_sys->p_mainPlaylistControler;
+ /* Destroy the main InputManager */
+ delete p_sys->p_mainPlayerControler;
/* Delete the configuration. Application has to be deleted after that. */
delete p_sys->mainSettings;
diff --git a/modules/gui/qt/qt.hpp b/modules/gui/qt/qt.hpp
index c32a6ba5c8..07aeaa6dbd 100644
--- a/modules/gui/qt/qt.hpp
+++ b/modules/gui/qt/qt.hpp
@@ -51,10 +51,8 @@
#define HAS_QT510 ( QT_VERSION >= 0x051000 )
enum {
- DialogEventTypeOffset = 0,
- IMEventTypeOffset = 100,
- PLEventTypeOffset = 200,
- MsgEventTypeOffset = 300,
+ IMEventTypeOffset = 0,
+ MsgEventTypeOffset = 100
};
enum{
@@ -63,6 +61,12 @@ enum{
NOTIFICATION_ALWAYS = 2,
};
+namespace vlc {
+namespace playlist {
+class PlaylistControlerModel;
+}
+}
+class PlayerControler;
struct intf_sys_t
{
vlc_thread_t thread;
@@ -70,7 +74,6 @@ struct intf_sys_t
class QVLCApp *p_app; /* Main Qt Application */
class MainInterface *p_mi; /* Main Interface, NULL if DialogProvider Mode */
class QSettings *mainSettings; /* Qt State settings not messing main VLC ones */
- class PLModel *pl_model;
QUrl filepath; /* Last path used in dialogs */
@@ -78,6 +81,9 @@ struct intf_sys_t
bool b_isDialogProvider; /* Qt mode or Skins mode */
vlc_playlist_t *p_playlist; /* playlist */
vlc_player_t *p_player; /* player */
+
+ vlc::playlist::PlaylistControlerModel* p_mainPlaylistControler;
+ PlayerControler* p_mainPlayerControler;
#ifdef _WIN32
bool disable_volume_keys;
#endif
@@ -131,8 +137,8 @@ struct vlc_player_locker {
};
#define THEDP DialogsProvider::getInstance()
-#define THEMIM MainInputManager::getInstance( p_intf )
-#define THEAM ActionsManager::getInstance( p_intf )
+#define THEMIM p_intf->p_sys->p_mainPlayerControler
+#define THEMPL p_intf->p_sys->p_mainPlaylistControler
#define qfu( i ) QString::fromUtf8( i )
#define qfue( i ) QString::fromUtf8( i ).replace( "&", "&&" ) /* for actions/buttons */
--
2.19.1
More information about the vlc-devel
mailing list