Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
  • abdsaber000/vlc
  • falbrechtskirchinger/vlc
  • b.sullender/vlc
  • hulxv/vlc
  • zyad-ayad/vlc
408 results
Show changes
Commits on Source (8)
Showing
with 189 additions and 167 deletions
......@@ -20,6 +20,7 @@
#include "util/color_scheme_model.hpp"
#include "maininterface/mainctx.hpp"
#include "dialogs/toolbar/controlbar_profile_model.hpp"
#include "medialibrary/medialib.hpp"
#include <QPushButton>
#include <QButtonGroup>
......@@ -28,6 +29,7 @@
#include <vlc_common.h>
#include <vlc_configuration.h>
#include <vlc_url.h>
#include <vlc_cxx_helpers.hpp>
FirstRunWizard::FirstRunWizard( qt_intf_t *_p_intf, QWidget *parent)
: QWizard( parent )
......
......@@ -21,7 +21,9 @@
#include "menus/menus.hpp"
#include <QSystemTrayIcon>
#include "playlist/playlist_controller.hpp"
#include "player/player_controller.hpp"
#include "dialogs/dialogs_provider.hpp"
#include "widgets/native/qvlcframe.hpp"
using namespace vlc::playlist;
......
......@@ -456,11 +456,11 @@ decltype (ControlbarProfileModel::m_defaults)
};
ControlbarProfileModel::ControlbarProfileModel(qt_intf_t *p_intf, QObject *parent)
ControlbarProfileModel::ControlbarProfileModel(QSettings* settings, QObject *parent)
: QAbstractListModel(parent),
m_intf(p_intf)
m_settings(settings)
{
assert(m_intf);
assert(m_settings);
connect(this, &QAbstractListModel::rowsInserted, this, &ControlbarProfileModel::countChanged);
connect(this, &QAbstractListModel::rowsRemoved, this, &ControlbarProfileModel::countChanged);
......@@ -693,25 +693,18 @@ ControlbarProfile* ControlbarProfileModel::currentModel() const
void ControlbarProfileModel::save(bool clearDirty) const
{
assert(m_intf);
assert(m_intf->mainSettings);
if (!m_intf || !m_intf || !m_intf->mainSettings)
return;
const auto settings = m_intf->mainSettings;
const auto groupName = metaObject()->className();
settings->beginGroup(groupName);
settings->remove(""); // clear the group before save
m_settings->beginGroup(groupName);
m_settings->remove(""); // clear the group before save
settings->setValue(SETTINGS_KEY_SELECTEDPROFILE, selectedProfile());
m_settings->setValue(SETTINGS_KEY_SELECTEDPROFILE, selectedProfile());
settings->beginWriteArray(SETTINGS_ARRAYNAME_PROFILES);
m_settings->beginWriteArray(SETTINGS_ARRAYNAME_PROFILES);
for (int i = 0; i < m_profiles.size(); ++i)
{
settings->setArrayIndex(i);
m_settings->setArrayIndex(i);
const auto& ptrModelMap = m_profiles.at(i)->m_models;
......@@ -748,33 +741,26 @@ void ControlbarProfileModel::save(bool clearDirty) const
if (clearDirty)
m_profiles.at(i)->resetDirty();
settings->setValue(SETTINGS_KEY_NAME, m_profiles.at(i)->name());
settings->setValue(SETTINGS_KEY_MODEL, val);
m_settings->setValue(SETTINGS_KEY_NAME, m_profiles.at(i)->name());
m_settings->setValue(SETTINGS_KEY_MODEL, val);
}
settings->endArray();
settings->endGroup();
m_settings->endArray();
m_settings->endGroup();
}
bool ControlbarProfileModel::reload()
{
assert(m_intf);
assert(m_intf->mainSettings);
if (!m_intf || !m_intf || !m_intf->mainSettings)
return false;
const auto settings = m_intf->mainSettings;
const auto groupName = metaObject()->className();
settings->beginGroup(groupName);
m_settings->beginGroup(groupName);
const int size = settings->beginReadArray(SETTINGS_ARRAYNAME_PROFILES);
const int size = m_settings->beginReadArray(SETTINGS_ARRAYNAME_PROFILES);
if (size <= 0)
{
settings->endArray();
settings->endGroup();
m_settings->endArray();
m_settings->endGroup();
return false;
}
......@@ -784,9 +770,9 @@ bool ControlbarProfileModel::reload()
decltype (m_profiles) profiles;
for (int i = 0; i < size; ++i)
{
settings->setArrayIndex(i);
m_settings->setArrayIndex(i);
const QString modelValue = settings->value(SETTINGS_KEY_MODEL).toString();
const QString modelValue = m_settings->value(SETTINGS_KEY_MODEL).toString();
if (modelValue.isEmpty())
continue;
......@@ -796,7 +782,7 @@ bool ControlbarProfileModel::reload()
continue;
const auto ptrNewProfile = new ControlbarProfile(this);
ptrNewProfile->setName(settings->value(SETTINGS_KEY_NAME).toString());
ptrNewProfile->setName(m_settings->value(SETTINGS_KEY_NAME).toString());
for (auto j : val)
{
......@@ -841,7 +827,7 @@ bool ControlbarProfileModel::reload()
profiles.append(ptrNewProfile);
}
settings->endArray();
m_settings->endArray();
m_selectedProfile = -1;
std::for_each(m_profiles.begin(), m_profiles.end(), [](auto i) { delete i; });
......@@ -851,14 +837,14 @@ bool ControlbarProfileModel::reload()
endResetModel();
bool ok = false;
int index = settings->value(SETTINGS_KEY_SELECTEDPROFILE).toInt(&ok);
int index = m_settings->value(SETTINGS_KEY_SELECTEDPROFILE).toInt(&ok);
if (ok)
setSelectedProfile(index);
else
setSelectedProfile(0);
settings->endGroup();
m_settings->endGroup();
return true;
}
......
......@@ -19,10 +19,11 @@
#define CONTROLBARPROFILEMODEL_H
#include <QAbstractListModel>
#include <QSettings>
#include <array>
#include "controlbar_profile.hpp"
#include "qt.hpp"
class ControlbarProfileModel : public QAbstractListModel
{
......@@ -34,7 +35,7 @@ class ControlbarProfileModel : public QAbstractListModel
Q_PROPERTY(int count READ rowCount NOTIFY countChanged FINAL)
public:
explicit ControlbarProfileModel(qt_intf_t *p_intf, QObject *parent = nullptr);
explicit ControlbarProfileModel(QSettings* settings, QObject *parent = nullptr);
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
......@@ -123,7 +124,7 @@ private:
QString generateUniqueName(const QString& name);
protected:
qt_intf_t *m_intf = nullptr;
QSettings* m_settings = nullptr;
};
#endif // CONTROLBARPROFILEMODEL_H
......@@ -33,6 +33,7 @@
#include <QWindow>
#include <QScreen>
#include <QLibrary>
#include <QSettings>
#include <versionhelpers.h>
#include "compositor_dcomp.hpp"
......
......@@ -21,6 +21,7 @@
#include "compositor_dummy.hpp"
#include "videosurface.hpp"
#include "video_window_handler.hpp"
#include <QWidget>
#include <QAbstractNativeEventFilter>
#include <memory>
......
......@@ -21,6 +21,7 @@
# include "config.h"
#endif
#include <vlc_window.h>
#include <vlc_cxx_helpers.hpp>
#include "compositor_x11.hpp"
#include "compositor_x11_renderwindow.hpp"
......
......@@ -22,6 +22,7 @@
#include <playlist/playlist_controller.hpp>
#include "util/keyhelper.hpp"
#include "dialogs/systray/systray.hpp"
#include "widgets/native/qvlcframe.hpp"
#include <QScreen>
#include <QQmlProperty>
#include <cmath>
......
......@@ -40,9 +40,12 @@
#include "widgets/native/customwidgets.hpp" // qtEventToVLCKey, QVLCStackedWidget
#include "util/qt_dirs.hpp" // toNativeSeparators
#include "util/color_scheme_model.hpp"
#include "widgets/native/interface_widgets.hpp" // bgWidget, videoWidget
#include "playlist/playlist_controller.hpp"
#include "player/player_controller.hpp"
#include "dialogs/dialogs_provider.hpp"
#include "dialogs/systray/systray.hpp"
......@@ -157,11 +160,11 @@ MainCtx::MainCtx(qt_intf_t *_p_intf)
vlc_medialibrary_t* ml = vlc_ml_instance_get( p_intf );
b_hasMedialibrary = (ml != NULL);
if (b_hasMedialibrary) {
m_medialib = new MediaLib(p_intf);
m_medialib = new MediaLib(p_intf, p_intf->p_mainPlaylistController);
}
/* Controlbar Profile Model Creation */
m_controlbarProfileModel = new ControlbarProfileModel(p_intf, this);
m_controlbarProfileModel = new ControlbarProfileModel(p_intf->mainSettings, this);
m_dialogFilepath = getSettings()->value( "filedialog-path", QVLCUserDir( VLC_HOME_DIR ) ).toString();
......@@ -291,7 +294,7 @@ MainCtx::~MainCtx()
var_DelCallback( libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
if (m_medialib)
m_medialib->destroy();
delete m_medialib;
p_intf->p_mi = NULL;
}
......
......@@ -26,26 +26,18 @@
#include "qt.hpp"
#include "widgets/native/qvlcframe.hpp"
#include "player/player_controller.hpp"
#include "util/color_scheme_model.hpp"
#include "medialibrary/medialib.hpp"
#include <playlist/playlist_common.hpp>
#include <QtQuick/QQuickView>
#include <QApplication>
#ifdef _WIN32
# include <shobjidl.h>
#endif
#include <atomic>
#include <QQuickItem>
Q_MOC_INCLUDE( "dialogs/toolbar/controlbar_profile_model.hpp" )
Q_MOC_INCLUDE( "util/csdbuttonmodel.hpp" )
Q_MOC_INCLUDE( "playlist/playlist_controller.hpp" )
Q_MOC_INCLUDE( "maininterface/mainctx_submodels.hpp" )
Q_MOC_INCLUDE( "maininterface/videosurface.hpp" )
Q_MOC_INCLUDE( "medialibrary/medialib.hpp" )
Q_MOC_INCLUDE( "player/player_controller.hpp" )
Q_MOC_INCLUDE( "util/color_scheme_model.hpp" )
#ifdef UPDATE_CHECK
Q_MOC_INCLUDE( "dialogs/help/help.hpp" )
#endif
......@@ -72,6 +64,9 @@ class SearchCtx;
class SortCtx;
class WorkerThreadSet;
class VLCSystray;
class MediaLib;
class ColorSchemeModel;
class VLCVarChoiceModel;
#ifdef UPDATE_CHECK
class UpdateModel;
#endif
......@@ -146,7 +141,7 @@ class MainCtx : public QObject
Q_PROPERTY(bool preferHotkeys READ preferHotkeys WRITE setPreferHotkeys NOTIFY preferHotkeysChanged FINAL)
//Property for Activating bgCone in player view
Q_PROPERTY(bool bgCone READ isbgCone WRITE setbgCone NOTIFY bgConeToggled FINAL)
Q_PROPERTY(bool bgCone READ isbgCone WRITE setbgCone NOTIFY bgConeToggled FINAL)
Q_PROPERTY(bool windowSuportExtendedFrame READ windowSuportExtendedFrame NOTIFY windowSuportExtendedFrameChanged)
Q_PROPERTY(unsigned windowExtendedMargin READ windowExtendedMargin WRITE setWindowExtendedMargin NOTIFY windowExtendedMarginChanged)
Q_PROPERTY(SearchCtx* search MEMBER m_search CONSTANT FINAL)
......@@ -242,7 +237,7 @@ public:
inline OsType getOSName() const {return m_osName;}
inline int getOSVersion() const {return m_osVersion;}
inline bool isbgCone() const {return m_bgCone; }
inline bool windowSuportExtendedFrame() const { return m_windowSuportExtendedFrame; }
inline unsigned windowExtendedMargin() const { return m_windowExtendedMargin; }
......@@ -413,7 +408,7 @@ public slots:
void setPinVideoControls( bool );
void setPinOpacity( float );
void setbgCone(bool);
void updateIntfScaleFactor();
void onWindowVisibilityChanged(QWindow::Visibility);
......
......@@ -28,7 +28,6 @@
#include "mainctx_win32.hpp"
#include "maininterface/compositor.hpp"
#include "player/player_controller.hpp"
#include "playlist/playlist_controller.hpp"
#include "dialogs/dialogs_provider.hpp"
#include "widgets/native/interface_widgets.hpp"
......
......@@ -25,11 +25,13 @@
#define MAIN_INTERFACE_WIN32_HPP
#include "maininterface/mainctx.hpp"
#include "player/player_controller.hpp"
#include "interface_window_handler.hpp"
#include <QAbstractNativeEventFilter>
#include <wrl/client.h>
#include <objbase.h>
#include <shobjidl.h>
class WinTaskbarWidget : public QObject, public QAbstractNativeEventFilter
{
......
......@@ -80,8 +80,6 @@ using namespace vlc::playlist;
namespace {
const QString MLCUSTOMCOVER_PROVIDERID = "mlcustomcover";
template<class T>
class SingletonRegisterHelper
{
......@@ -163,10 +161,7 @@ bool MainUI::setup(QQmlEngine* engine)
if (m_mainCtx->hasMediaLibrary())
{
auto customCover = new MLCustomCover(MLCUSTOMCOVER_PROVIDERID, m_mainCtx->getMediaLibrary());
m_mainCtx->getMediaLibrary()->setCustomCover(customCover);
engine->addImageProvider(MLCUSTOMCOVER_PROVIDERID, customCover);
engine->addImageProvider(MLCustomCover::providerId, new MLCustomCover(m_mainCtx->getMediaLibrary()));
}
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
......
......@@ -149,10 +149,12 @@ Item {
Connections {
target: MainPlaylistController
function onPlaylistInitialized() {
_playlistReady = true
if (_interfaceReady)
function onInitializedChanged() {
console.assert(MainPlaylistController.initialized)
if (root._interfaceReady && !root._playlistReady) {
root._playlistReady = true
setInitialView()
}
}
}
......@@ -186,9 +188,11 @@ Item {
}
Component.onCompleted: {
_interfaceReady = true;
if (_playlistReady)
root._interfaceReady = true
if (!root._playlistReady && MainPlaylistController.initialized) {
root._playlistReady = true
setInitialView()
}
}
DropArea {
......
......@@ -23,9 +23,10 @@
#include <utility>
MediaLib::MediaLib(qt_intf_t *_intf, QObject *_parent)
MediaLib::MediaLib(qt_intf_t *_intf, vlc::playlist::PlaylistController* playlistController, QObject *_parent)
: QObject( _parent )
, m_intf( _intf )
, m_playlistController(playlistController)
, m_ml( vlc_ml_instance_get( _intf ) )
, m_event_cb( nullptr, [this](vlc_ml_event_callback_t* cb ) {
vlc_ml_event_unregister_callback( m_ml, cb );
......@@ -33,42 +34,12 @@ MediaLib::MediaLib(qt_intf_t *_intf, QObject *_parent)
{
m_event_cb.reset( vlc_ml_event_register_callback( m_ml, MediaLib::onMediaLibraryEvent,
this ) );
/* https://xkcd.com/221/ */
m_mlThreadPool.setMaxThreadCount(4);
m_runner = new MLThreadRunner(m_ml);
}
MediaLib::~MediaLib()
{
assert(m_objectTasks.empty());
assert(m_runningTasks.empty());
}
void MediaLib::destroy()
{
m_shuttingDown = true;
//try to cancel as many tasks as possible
for (auto taskIt = m_objectTasks.begin(); taskIt != m_objectTasks.end(); /**/)
{
const QObject* object = taskIt.key();
quint64 key = taskIt.value();
auto task = m_runningTasks.value(key, nullptr);
if (m_mlThreadPool.tryTake(task))
{
delete task;
m_runningTasks.remove(key);
taskIt = m_objectTasks.erase(taskIt);
if (m_objectTasks.count(object) == 0)
disconnect(object, &QObject::destroyed, this, &MediaLib::runOnMLThreadTargetDestroyed);
}
else
++taskIt;
}
if (m_runningTasks.empty())
{
deleteLater();
}
m_runner->destroy();
}
static void convertMLItemToPlaylistMedias(vlc_medialibrary_t* ml, const MLItemId & itemId, const QStringList &options, QVector<vlc::playlist::Media>& medias)
......@@ -138,14 +109,14 @@ void MediaLib::addToPlaylist(const QString& mrl, const QStringList &options)
{
QVector<vlc::playlist::Media> medias;
convertQStringToPlaylistMedias(mrl, options, medias);
m_intf->p_mainPlaylistController->append(medias, false);
m_playlistController->append(medias, false);
}
void MediaLib::addToPlaylist(const QUrl& mrl, const QStringList &options)
{
QVector<vlc::playlist::Media> medias;
convertQUrlToPlaylistMedias(mrl, options, medias);
m_intf->p_mainPlaylistController->append(medias, false);
m_playlistController->append(medias, false);
}
// A specific item has been asked to be added to the playlist
......@@ -163,7 +134,7 @@ void MediaLib::addToPlaylist(const MLItemId & itemId, const QStringList &options
//UI thread
[this](quint64, Context& ctx){
if (!ctx.medias.empty())
m_intf->p_mainPlaylistController->append(ctx.medias, false);
m_playlistController->append(ctx.medias, false);
});
}
......@@ -182,7 +153,7 @@ void MediaLib::addToPlaylist(const QVariantList& itemIdList, const QStringList &
//UI thread
[this](quint64, Context& ctx){
if (!ctx.medias.empty())
m_intf->p_mainPlaylistController->append(ctx.medias, false);
m_playlistController->append(ctx.medias, false);
});
}
......@@ -203,7 +174,7 @@ void MediaLib::addAndPlay(const MLItemId & itemId, const QStringList &options )
//UI thread
[this](quint64, Context& ctx){
if (!ctx.medias.empty())
m_intf->p_mainPlaylistController->append(ctx.medias, true);
m_playlistController->append(ctx.medias, true);
});
......@@ -212,13 +183,13 @@ void MediaLib::addAndPlay(const MLItemId & itemId, const QStringList &options )
void MediaLib::addAndPlay(const QString& mrl, const QStringList &options)
{
vlc::playlist::Media media{ mrl, mrl, options };
m_intf->p_mainPlaylistController->append( QVector<vlc::playlist::Media>{media}, true );
m_playlistController->append( QVector<vlc::playlist::Media>{media}, true );
}
void MediaLib::addAndPlay(const QUrl& mrl, const QStringList &options)
{
vlc::playlist::Media media{ mrl.toString(QUrl::FullyEncoded), mrl.fileName(), options };
m_intf->p_mainPlaylistController->append( QVector<vlc::playlist::Media>{media}, true );
m_playlistController->append( QVector<vlc::playlist::Media>{media}, true );
}
......@@ -237,7 +208,7 @@ void MediaLib::addAndPlay(const QVariantList& itemIdList, const QStringList &opt
//UI thread
[this](quint64, Context& ctx){
if (!ctx.medias.empty())
m_intf->p_mainPlaylistController->append(ctx.medias, true);
m_playlistController->append(ctx.medias, true);
});
}
......@@ -257,7 +228,7 @@ void MediaLib::insertIntoPlaylist(const size_t index, const QVariantList &itemId
[this, index]
(quint64, Context& ctx) {
if (!ctx.medias.isEmpty())
m_intf->p_mainPlaylistController->insert( index, ctx.medias );
m_playlistController->insert( index, ctx.medias );
});
}
......@@ -433,13 +404,54 @@ void MediaLib::onMediaLibraryEvent( void* data, const vlc_ml_event_t* event )
}
}
MLThreadRunner::MLThreadRunner(vlc_medialibrary_t* ml)
: m_ml(ml)
{
m_mlThreadPool.setMaxThreadCount(4);
}
MLThreadRunner::~MLThreadRunner()
{
assert(m_objectTasks.empty());
assert(m_runningTasks.empty());
}
void MLThreadRunner::destroy()
{
m_shuttingDown = true;
//try to cancel as many tasks as possible
for (auto taskIt = m_objectTasks.begin(); taskIt != m_objectTasks.end(); /**/)
{
const QObject* object = taskIt.key();
quint64 key = taskIt.value();
auto task = m_runningTasks.value(key, nullptr);
if (m_mlThreadPool.tryTake(task))
{
delete task;
m_runningTasks.remove(key);
taskIt = m_objectTasks.erase(taskIt);
if (m_objectTasks.count(object) == 0)
disconnect(object, &QObject::destroyed, this, &MLThreadRunner::runOnMLThreadTargetDestroyed);
}
else
++taskIt;
}
if (m_runningTasks.empty())
{
deleteLater();
}
}
quint64 MediaLib::runOnMLThread(const QObject* obj,
std::function< void(vlc_medialibrary_t* ml)> mlCb,
std::function< void()> uiCb,
const char* queue)
{
struct NoCtx{};
return runOnMLThread<NoCtx>(obj,
return m_runner->runOnMLThread<NoCtx>(obj,
[mlCb](vlc_medialibrary_t* ml, NoCtx&){
mlCb(ml);
},
......@@ -454,7 +466,7 @@ quint64 MediaLib::runOnMLThread(const QObject* obj,
std::function< void(quint64)> uiCb, const char* queue)
{
struct NoCtx{};
return runOnMLThread<NoCtx>(obj,
return m_runner->runOnMLThread<NoCtx>(obj,
[mlCb](vlc_medialibrary_t* ml, NoCtx&){
mlCb(ml);
},
......@@ -469,7 +481,7 @@ quint64 MediaLib::runOnMLThread(const QObject* obj,
const char* queue)
{
struct NoCtx{};
return runOnMLThread<NoCtx>(obj,
return m_runner->runOnMLThread<NoCtx>(obj,
[mlCb](vlc_medialibrary_t* ml, NoCtx&){
mlCb(ml);
},
......@@ -478,8 +490,12 @@ quint64 MediaLib::runOnMLThread(const QObject* obj,
queue);
}
void MediaLib::cancelMLTask(const QObject* object, quint64 taskId)
{
m_runner->cancelMLTask(object, taskId);
}
void MLThreadRunner::cancelMLTask(const QObject* object, quint64 taskId)
{
assert(taskId != 0);
......@@ -493,10 +509,10 @@ void MediaLib::cancelMLTask(const QObject* object, quint64 taskId)
m_runningTasks.remove(taskId);
m_objectTasks.remove(object, taskId);
if (m_objectTasks.count(object) == 0)
disconnect(object, &QObject::destroyed, this, &MediaLib::runOnMLThreadTargetDestroyed);
disconnect(object, &QObject::destroyed, this, &MLThreadRunner::runOnMLThreadTargetDestroyed);
}
void MediaLib::runOnMLThreadDone(RunOnMLThreadBaseRunner* runner, quint64 target, const QObject* object, int status)
void MLThreadRunner::runOnMLThreadDone(RunOnMLThreadBaseRunner* runner, quint64 target, const QObject* object, int status)
{
if (m_shuttingDown)
{
......@@ -505,7 +521,7 @@ void MediaLib::runOnMLThreadDone(RunOnMLThreadBaseRunner* runner, quint64 target
m_runningTasks.remove(target);
m_objectTasks.remove(object, target);
if (m_objectTasks.count(object) == 0)
disconnect(object, &QObject::destroyed, this, &MediaLib::runOnMLThreadTargetDestroyed);
disconnect(object, &QObject::destroyed, this, &MLThreadRunner::runOnMLThreadTargetDestroyed);
}
if (m_runningTasks.empty())
deleteLater();
......@@ -517,12 +533,12 @@ void MediaLib::runOnMLThreadDone(RunOnMLThreadBaseRunner* runner, quint64 target
m_runningTasks.remove(target);
m_objectTasks.remove(object, target);
if (m_objectTasks.count(object) == 0)
disconnect(object, &QObject::destroyed, this, &MediaLib::runOnMLThreadTargetDestroyed);
disconnect(object, &QObject::destroyed, this, &MLThreadRunner::runOnMLThreadTargetDestroyed);
}
runner->deleteLater();
}
void MediaLib::runOnMLThreadTargetDestroyed(QObject * object)
void MLThreadRunner::runOnMLThreadTargetDestroyed(QObject * object)
{
if (m_objectTasks.contains(object))
{
......@@ -539,13 +555,3 @@ void MediaLib::runOnMLThreadTargetDestroyed(QObject * object)
//no need to disconnect QObject::destroyed, as object is currently being destroyed
}
}
MLCustomCover *MediaLib::customCover() const
{
return m_customCover;
}
void MediaLib::setCustomCover(MLCustomCover *newCustomCover)
{
m_customCover = newCustomCover;
}
......@@ -27,9 +27,6 @@
#include "mlthreadpool.hpp"
#include "mlqmltypes.hpp"
class MLCustomCover;
namespace vlc {
namespace playlist {
class Media;
......@@ -38,6 +35,7 @@ class Media;
struct vlc_medialibrary_t;
class MLThreadRunner;
class RunOnMLThreadBaseRunner;
class MediaLib : public QObject
......@@ -50,15 +48,9 @@ public:
Q_PROPERTY(QString discoveryEntryPoint READ discoveryEntryPoint NOTIFY discoveryEntryPointChanged FINAL)
Q_PROPERTY(bool idle READ idle NOTIFY idleChanged FINAL)
enum MLTaskStatus {
ML_TASK_STATUS_SUCCEED,
ML_TASK_STATUS_CANCELED
};
public:
MediaLib(qt_intf_t* _intf, QObject* _parent = nullptr );
void destroy();
MediaLib(qt_intf_t* _intf, vlc::playlist::PlaylistController* playlistController, QObject* _parent = nullptr );
~MediaLib();
Q_INVOKABLE void addToPlaylist(const MLItemId &itemId, const QStringList &options = {});
Q_INVOKABLE void addToPlaylist(const QString& mrl, const QStringList &options = {});
......@@ -177,9 +169,6 @@ public:
*/
void cancelMLTask(const QObject* object, quint64 taskId);
MLCustomCover *customCover() const;
void setCustomCover(MLCustomCover *newCustomCover);
signals:
void discoveryStarted();
void discoveryCompleted();
......@@ -189,17 +178,11 @@ signals:
void idleChanged();
private:
//use the destroy function
~MediaLib();
static void onMediaLibraryEvent( void* data, const vlc_ml_event_t* event );
private slots:
void runOnMLThreadDone(RunOnMLThreadBaseRunner* runner, quint64 target, const QObject* object, int status);
void runOnMLThreadTargetDestroyed(QObject * object);
private:
qt_intf_t* m_intf;
MLCustomCover *m_customCover {};
vlc::playlist::PlaylistController* m_playlistController = nullptr;
bool m_idle = false;
bool m_discoveryPending = false;
......@@ -209,16 +192,46 @@ private:
/* Medialibrary */
vlc_medialibrary_t* m_ml;
std::unique_ptr<vlc_ml_event_callback_t, std::function<void(vlc_ml_event_callback_t*)>> m_event_cb;
MLThreadRunner* m_runner = nullptr;
QMap<QVector<MLItemId>, QVector<QJSValue>> m_inputItemQuery;
};
class MLThreadRunner : public QObject
{
Q_OBJECT
public:
enum MLTaskStatus {
ML_TASK_STATUS_SUCCEED,
ML_TASK_STATUS_CANCELED
};
MLThreadRunner(vlc_medialibrary_t* ml);
~MLThreadRunner();
void destroy();
void cancelMLTask(const QObject* object, quint64 taskId);
template<typename Ctx>
quint64 runOnMLThread(const QObject* obj,
std::function<void (vlc_medialibrary_t*, Ctx&)> mlFun,
std::function<void (quint64 taskId, Ctx&)> uiFun,
const char* queue);
private:
vlc_medialibrary_t* m_ml = nullptr;
MLThreadPool m_mlThreadPool;
/* run on ml thread properties */
bool m_shuttingDown = false;
quint64 m_taskId = 1;
QMap<quint64, RunOnMLThreadBaseRunner*> m_runningTasks;
QMultiMap<const QObject*, quint64> m_objectTasks;
QMap<QVector<MLItemId>, QVector<QJSValue>> m_inputItemQuery;
private slots:
void runOnMLThreadDone(RunOnMLThreadBaseRunner* runner, quint64 target, const QObject* object, int status);
void runOnMLThreadTargetDestroyed(QObject * object);
};
class RunOnMLThreadBaseRunner : public QObject, public QRunnable
......@@ -256,11 +269,11 @@ public:
{
if (m_canceled)
{
emit done(this, m_taskId, m_obj, MediaLib::ML_TASK_STATUS_CANCELED);
emit done(this, m_taskId, m_obj, MLThreadRunner::ML_TASK_STATUS_CANCELED);
return;
}
m_mlFun(m_ml, m_ctx);
emit done(this, m_taskId, m_obj, MediaLib::ML_TASK_STATUS_SUCCEED);
emit done(this, m_taskId, m_obj, MLThreadRunner::ML_TASK_STATUS_SUCCEED);
}
//called from UI thread
......@@ -284,7 +297,7 @@ private:
};
template<typename Ctx>
quint64 MediaLib::runOnMLThread(const QObject* obj,
quint64 MLThreadRunner::runOnMLThread(const QObject* obj,
std::function<void (vlc_medialibrary_t*, Ctx&)> mlFun,
std::function<void (quint64 taskId, Ctx&)> uiFun,
const char* queue)
......@@ -294,10 +307,19 @@ quint64 MediaLib::runOnMLThread(const QObject* obj,
auto taskId = m_taskId++;
auto runnable = new RunOnMLThreadRunner<Ctx>(taskId, obj, mlFun, uiFun, m_ml);
connect(runnable, &RunOnMLThreadBaseRunner::done, this, &MediaLib::runOnMLThreadDone);
connect(obj, &QObject::destroyed, this, &MediaLib::runOnMLThreadTargetDestroyed);
connect(runnable, &RunOnMLThreadBaseRunner::done, this, &MLThreadRunner::runOnMLThreadDone);
connect(obj, &QObject::destroyed, this, &MLThreadRunner::runOnMLThreadTargetDestroyed);
m_runningTasks.insert(taskId, runnable);
m_objectTasks.insert(obj, taskId);
m_mlThreadPool.start(runnable, queue);
return taskId;
}
template<typename Ctx>
quint64 MediaLib::runOnMLThread(const QObject* obj,
std::function<void (vlc_medialibrary_t*, Ctx&)> mlFun,
std::function<void (quint64 taskId, Ctx&)> uiFun,
const char* queue)
{
return m_runner->runOnMLThread<Ctx>(obj, mlFun, uiFun, queue);
}
......@@ -281,18 +281,17 @@ private:
};
MLCustomCover::MLCustomCover(const QString &providerId, MediaLib *ml)
: m_providerId {providerId}
, m_ml {ml}
MLCustomCover::MLCustomCover(MediaLib *ml)
: m_ml {ml}
{
}
QString MLCustomCover::get(const MLItemId &parentId, const QSize &size, const QString &defaultCover
QString MLCustomCover::url(const MLItemId &parentId, const QSize &size, const QString &defaultCover
, const int countX, const int countY, const int blur, const bool split_duplicate)
{
QUrl url;
url.setScheme(QStringLiteral("image"));
url.setHost(m_providerId);
url.setHost(MLCustomCover::providerId);
url.setQuery(toQuery({parentId, size, countX, countY, blur, split_duplicate, defaultCover}));
return url.toString();
}
......
......@@ -31,9 +31,11 @@ class MediaLib;
class MLCustomCover : public QQuickAsyncImageProvider
{
public:
MLCustomCover(const QString &providerId, MediaLib *ml);
MLCustomCover(MediaLib *ml);
QString get(const MLItemId &parentId
inline static const char* providerId = "mlcustomcover";
static QString url(const MLItemId &parentId
, const QSize &size
, const QString &defaultCover
, const int countX = 2
......@@ -44,7 +46,6 @@ public:
QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize);
private:
const QString m_providerId;
MediaLib *m_ml = nullptr;
};
......
......@@ -19,7 +19,7 @@
*****************************************************************************/
#include "mlfolder.hpp"
#include "medialibrary/medialib.hpp"
#include "util/vlctick.hpp"
// Ctor / dtor
......
......@@ -17,6 +17,7 @@
*****************************************************************************/
#include "mlfoldersmodel.hpp"
#include "medialibrary/medialib.hpp"
#include <cassert>
static const char* const ML_FOLDER_ADD_QUEUE = "ML_FOLDER_ADD_QUEUE";
......