[vlc-commits] [Git][videolan/vlc][master] 6 commits: qt: use ComPtr for the ITaskbarList3
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Jul 2 13:37:28 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
0c6d0037 by Steve Lhomme at 2024-07-02T12:38:47+00:00
qt: use ComPtr for the ITaskbarList3
We already build Qt with LIBCOM/LIBCOMCXXFLAGS.
- - - - -
80e6558e by Steve Lhomme at 2024-07-02T12:38:47+00:00
qt: use __uuidof to get the UUID of an object class
It doesn't require an exported UUID from a library.
- - - - -
33f19d15 by Steve Lhomme at 2024-07-02T12:38:47+00:00
qt: remove local declaration
It was added in mingw-w64 v3: 4f432250f7c9df4f021ac78eb9c33342e8bb34e9
- - - - -
d88c1bda by Steve Lhomme at 2024-07-02T12:38:47+00:00
qt: use ComPtr for the IApplicationAssociationRegistrationUI
We already build Qt with LIBCOM/LIBCOMCXXFLAGS.
- - - - -
c62932fb by Steve Lhomme at 2024-07-02T12:38:47+00:00
qt: fix unused warning
- - - - -
5e0a14e6 by Steve Lhomme at 2024-07-02T12:38:47+00:00
access/dshow: use IID_PPV_ARGS to get object instances
We already build the module with LIBCOM/LIBCOMCXXFLAGS.
- - - - -
4 changed files:
- modules/access/dshow/dshow.cpp
- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- modules/gui/qt/maininterface/mainctx_win32.cpp
- modules/gui/qt/maininterface/mainctx_win32.hpp
Changes:
=====================================
modules/access/dshow/dshow.cpp
=====================================
@@ -317,11 +317,11 @@ static void CreateDirectShowGraph( access_sys_t *p_sys )
/* Create directshow filter graph */
if( SUCCEEDED( CoCreateInstance( CLSID_FilterGraph, 0, CLSCTX_INPROC,
- __uuidof(p_sys->p_graph.Get()), &p_sys->p_graph ) ) )
+ IID_PPV_ARGS( &p_sys->p_graph ) ) ) )
{
/* Create directshow capture graph builder if available */
if( SUCCEEDED( CoCreateInstance( CLSID_CaptureGraphBuilder2, 0,
- CLSCTX_INPROC, __uuidof(p_sys->p_capture_graph_builder2.Get()), &p_sys->p_capture_graph_builder2 ) ) )
+ CLSCTX_INPROC, IID_PPV_ARGS( &p_sys->p_capture_graph_builder2 ) ) ) )
{
p_sys->p_capture_graph_builder2->
SetFiltergraph(static_cast<IGraphBuilder *>(p_sys->p_graph.Get()) );
@@ -1186,7 +1186,7 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
ComPtr<ICreateDevEnum> p_dev_enum;
hr = CoCreateInstance( CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
- __uuidof(p_dev_enum.Get()), &p_dev_enum );
+ IID_PPV_ARGS( &p_dev_enum ) );
if( FAILED(hr) )
{
msg_Err( p_this, "failed to create the device enumerator (0x%lX)", hr);
@@ -1944,14 +1944,14 @@ static int AppendAudioEnabledVDevs( vlc_object_t *p_this, std::list<std::string>
ComPtr<IGraphBuilder> p_gbuilder;
ComPtr<ICaptureGraphBuilder2> p_cgbuilder;
- if( FAILED( CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, __uuidof(p_graph.Get()), &p_graph ) ) )
+ if( FAILED( CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS( &p_graph ) ) ) )
return VLC_EGENERIC;
if( FAILED( p_graph.As( &p_gbuilder ) ) )
return VLC_EGENERIC;
if( FAILED( CoCreateInstance( CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC_SERVER,
- __uuidof(p_cgbuilder.Get()), &p_cgbuilder ) ) )
+ IID_PPV_ARGS( &p_cgbuilder ) ) ) )
return VLC_EGENERIC;
if( FAILED( p_cgbuilder->SetFiltergraph( p_gbuilder.Get() ) ) )
=====================================
modules/gui/qt/dialogs/preferences/simple_preferences.cpp
=====================================
@@ -65,6 +65,9 @@
#include <cassert>
#include <math.h>
+#ifdef _WIN32
+#include <wrl/client.h>
+#endif
#define ICON_HEIGHT 48
#define ICON_WIDTH 48
@@ -191,6 +194,7 @@ static int getDefaultAudioVolume(const char *aout)
namespace
{
+#if !defined( _WIN32)
void fillStylesCombo( QComboBox *stylesCombo, const QString &initialStyle)
{
stylesCombo->addItem( qtr("System's default") );
@@ -200,6 +204,7 @@ namespace
if ( stylesCombo->currentIndex() < 0 )
stylesCombo->setCurrentIndex( 0 ); /* default */
}
+#endif
QString getQStyleKey(const QComboBox *stylesCombo, const QString &defaultStyleName)
{
@@ -1418,17 +1423,6 @@ bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
return b_temp;
}
-#if !defined(__IApplicationAssociationRegistrationUI_INTERFACE_DEFINED__)
-#define __IApplicationAssociationRegistrationUI_INTERFACE_DEFINED__
- const GUID IID_IApplicationAssociationRegistrationUI = {0x1f76a169,0xf994,0x40ac, {0x8f,0xc8,0x09,0x59,0xe8,0x87,0x47,0x10}};
- extern const GUID CLSID_ApplicationAssociationRegistrationUI;
- interface IApplicationAssociationRegistrationUI : public IUnknown
- {
- virtual HRESULT STDMETHODCALLTYPE LaunchAdvancedAssociationUI(
- LPCWSTR pszAppRegName) = 0;
- };
-#endif /* __IApplicationAssociationRegistrationUI_INTERFACE_DEFINED__ */
-
void SPrefsPanel::assoDialog()
{
HRESULT hr;
@@ -1436,18 +1430,14 @@ void SPrefsPanel::assoDialog()
hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE );
if( SUCCEEDED(hr) )
{
- void *p;
-
- hr = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI,
- NULL, CLSCTX_INPROC_SERVER,
- IID_IApplicationAssociationRegistrationUI, &p);
- if( SUCCEEDED(hr) )
{
- IApplicationAssociationRegistrationUI *p_regui =
- (IApplicationAssociationRegistrationUI *)p;
+ Microsoft::WRL::ComPtr<IApplicationAssociationRegistrationUI> p_regui;
- hr = p_regui->LaunchAdvancedAssociationUI(L"VLC" );
- p_regui->Release();
+ hr = CoCreateInstance(__uuidof(ApplicationAssociationRegistrationUI),
+ NULL, CLSCTX_INPROC_SERVER,
+ IID_PPV_ARGS(&p_regui));
+ if( SUCCEEDED(hr) )
+ p_regui->LaunchAdvancedAssociationUI(L"VLC" );
}
CoUninitialize();
}
=====================================
modules/gui/qt/maininterface/mainctx_win32.cpp
=====================================
@@ -554,8 +554,7 @@ WinTaskbarWidget::~WinTaskbarWidget()
{
if( himl )
ImageList_Destroy( himl );
- if(p_taskbl)
- p_taskbl->Release();
+ p_taskbl.Reset();
}
Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0);
@@ -572,7 +571,6 @@ void WinTaskbarWidget::createTaskBarButtons()
/*Here is the code for the taskbar thumb buttons
FIXME:We need pretty buttons in 16x16 px that are handled correctly by masks in Qt
*/
- p_taskbl = NULL;
himl = NULL;
auto winId = WinId(m_window);
@@ -589,16 +587,14 @@ void WinTaskbarWidget::createTaskBarButtons()
return;
}
- void *pv;
- HRESULT hr = CoCreateInstance( CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER,
- IID_ITaskbarList3, &pv);
+ HRESULT hr = CoCreateInstance( __uuidof(TaskbarList), NULL, CLSCTX_INPROC_SERVER,
+ IID_PPV_ARGS(p_taskbl.ReleaseAndGetAddressOf()));
if( FAILED(hr) )
{
m_comHolder.reset();
return;
}
- p_taskbl = (ITaskbarList3 *)pv;
p_taskbl->HrInit();
int iconX = GetSystemMetrics(SM_CXSMICON);
@@ -607,8 +603,7 @@ void WinTaskbarWidget::createTaskBarButtons()
4 /*cInitial*/, 0 /*cGrow*/);
if( himl == NULL )
{
- p_taskbl->Release();
- p_taskbl = NULL;
+ p_taskbl.Reset();
m_comHolder.reset();
return;
}
=====================================
modules/gui/qt/maininterface/mainctx_win32.hpp
=====================================
@@ -27,6 +27,7 @@
#include "maininterface/mainctx.hpp"
#include "interface_window_handler.hpp"
#include <QAbstractNativeEventFilter>
+#include <wrl/client.h>
#include <objbase.h>
@@ -49,7 +50,7 @@ private slots:
private:
qt_intf_t* p_intf = nullptr;
HIMAGELIST himl = nullptr;
- ITaskbarList3 *p_taskbl = nullptr;
+ Microsoft::WRL::ComPtr<ITaskbarList3> p_taskbl;
UINT taskbar_wmsg = 0;
QWindow* m_window = nullptr;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ea5fb3c2b5ab51632c46103d99cf5c50377d13df...5e0a14e6e785bc66a61f3677f8d7b6b5f879dd69
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ea5fb3c2b5ab51632c46103d99cf5c50377d13df...5e0a14e6e785bc66a61f3677f8d7b6b5f879dd69
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