qt: add url context menu

This commit is contained in:
Pierre Lamot 2020-09-23 17:14:46 +02:00
parent 6d486da387
commit 6fdc97a92b
3 changed files with 21 additions and 0 deletions

View File

@ -184,6 +184,7 @@ void MainUI::registerQMLTypes()
qmlRegisterType<ArtistContextMenu>( "org.videolan.medialib", 0, 1, "ArtistContextMenu" );
qmlRegisterType<GenreContextMenu>( "org.videolan.medialib", 0, 1, "GenreContextMenu" );
qmlRegisterType<AlbumTrackContextMenu>( "org.videolan.medialib", 0, 1, "AlbumTrackContextMenu" );
qmlRegisterType<URLContextMenu>( "org.videolan.medialib", 0, 1, "URLContextMenu" );
qmlRegisterType<VideoContextMenu>( "org.videolan.medialib", 0, 1, "VideoContextMenu" );
}

View File

@ -24,6 +24,7 @@
#include "medialibrary/mlartistmodel.hpp"
#include "medialibrary/mlgenremodel.hpp"
#include "medialibrary/mlalbumtrackmodel.hpp"
#include "medialibrary/mlurlmodel.hpp"
#include "network/networkmediamodel.hpp"
#include "playlist/playlist_controller.hpp"
#include "playlist/playlist_model.hpp"
@ -158,6 +159,16 @@ void AlbumTrackContextMenu::popup(const QModelIndexList &selected, QPoint pos, Q
BaseMedialibMenu::popup(m_model, MLAlbumTrackModel::TRACK_ID, selected, pos, options);
}
URLContextMenu::URLContextMenu(QObject* parent)
: BaseMedialibMenu(parent)
{}
void URLContextMenu::popup(const QModelIndexList &selected, QPoint pos, QVariantMap options)
{
BaseMedialibMenu::popup(m_model, MLUrlModel::URL_ID, selected, pos, options);
}
VideoContextMenu::VideoContextMenu(QObject* parent)
: QObject(parent)
{}

View File

@ -30,6 +30,7 @@ class MLAlbumModel;
class MLGenreModel;
class MLArtistModel;
class MLAlbumTrackModel;
class MLUrlModel;
class MLVideoModel;
class NetworkMediaModel;
class QmlMainContext;
@ -126,6 +127,14 @@ public slots:
void popup(const QModelIndexList& selected, QPoint pos, QVariantMap options = {});
};
class URLContextMenu : public BaseMedialibMenu {
Q_OBJECT
SIMPLE_MENU_PROPERTY(MLUrlModel*, model, nullptr)
public:
URLContextMenu(QObject* parent = nullptr);
public slots:
void popup(const QModelIndexList& selected, QPoint pos, QVariantMap options = {});
};
class VideoContextMenu : public QObject {
Q_OBJECT