[vlc-commits] [Git][videolan/vlc][3.0.x] 11 commits: qt: remove unused meta_to_mlmeta()
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Dec 20 06:00:31 UTC 2024
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
9705833b by Steve Lhomme at 2024-12-18T14:55:54+01:00
qt: remove unused meta_to_mlmeta()
- - - - -
949a27e2 by Steve Lhomme at 2024-12-18T14:55:54+01:00
qt: fix IN_ITEM_ROLE documentation
- - - - -
dc1e422e by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: remove deprecated QPainter::HighQualityAntialiasing usage
It's deprecated in Qt 5.15 [^1], since 5.14 [^2], and removed in Qt 6.
The commit log of [^2] even mentions its deprecated for all Qt5 but was not
marked as such yet.
[^1] https://doc.qt.io/qt-5/qpainter.html#RenderHint-enum
[^2] https://github.com/qt/qtbase/commit/1e4e006c3f6e8cbd0092fe882bc23a2280352a91
- - - - -
30d83704 by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: avoid using obsolete QSysInfo::windowsVersion() to check for Windows 10
It's deprecated [^1] and there is no replacement suggested in the doc.
We can use the safe way we use in VLC 4.
We could also not check the OS version at all since it's dynamically loaded
and the call returns an error on Windows 7 and earlier [^2].
[^1] https://doc.qt.io/qt-5/qsysinfo-obsolete.html#windowsVersion
[^2] https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute#return-value
- - - - -
4e5956b7 by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: fix bitfield added values set in QVariant
It's checked with actions[i]->data().toInt() anyway.
The code was removed in 4.0 with e1c82853965d44b4390af78d9184bd0b60ccc3fb
but was never fixed.
- - - - -
66d78681 by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: fix UTF-8 string usage
Similar to bbb9f6a07adfd20c544d29198ea2fec601bf3e62.
- - - - -
edc257c5 by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: add missing QActionGroup include
To be able to use rendererGroup.
- - - - -
15677901 by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: use QLayout::setContentsMargins() instead of QLayout::setMargin()
Similar to ed986711c159499b873157d4e5d4a53026d94719.
It's deprecated in Qt 5.15 [^1], since 5.13 [^2], and removed in Qt 6.
[^1] https://doc.qt.io/qt-5/qlayout-obsolete.html#setMargin
[^2] https://github.com/qt/qtbase/commit/d6d33f0b80dd85043c71f71a3ed5485d6014e6c4
- - - - -
1482690d by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: use QString::setNum() rather than QString::sprintf()
It's deprecated and one of the replacement suggested in the doc [^1].
QString::asprint() might be the more logical choice, but it's also not recommended [^2].
[^1] https://doc.qt.io/qt-5/qstring-obsolete.html#sprintf
[^2] https://doc.qt.io/qt-5/qstring.html#asprintf
- - - - -
3f51b02e by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: use QString::arg() rather than QString::sprintf()
It's deprecated and one of the replacement suggested in the doc [^1].
QString::asprint() might be the more logical choice, but it's also not recommended [^2].
[^1] https://doc.qt.io/qt-5/qstring-obsolete.html#sprintf
[^2] https://doc.qt.io/qt-5/qstring.html#asprintf
- - - - -
55138b57 by Steve Lhomme at 2024-12-18T14:55:55+01:00
qt: use std::sort instead of deprecated qSort()
Similar to c49140dcff3a2ba2729cec8756c7f78b198d50c9.
- - - - -
18 changed files:
- modules/gui/qt/actions_manager.cpp
- modules/gui/qt/components/controller.cpp
- modules/gui/qt/components/controller_widget.cpp
- modules/gui/qt/components/playlist/playlist.cpp
- modules/gui/qt/components/playlist/playlist_model.cpp
- modules/gui/qt/components/playlist/selector.hpp
- modules/gui/qt/components/playlist/sorting.h
- modules/gui/qt/components/playlist/standardpanel.cpp
- modules/gui/qt/components/playlist/views.cpp
- modules/gui/qt/components/preferences_widgets.cpp
- modules/gui/qt/dialogs/bookmarks.cpp
- modules/gui/qt/dialogs/external.cpp
- modules/gui/qt/dialogs/preferences.cpp
- modules/gui/qt/dialogs/toolbar.cpp
- modules/gui/qt/main_interface.cpp
- modules/gui/qt/menus.cpp
- modules/gui/qt/util/qvlcframe.hpp
- modules/gui/qt/util/timetooltip.cpp
Changes:
=====================================
modules/gui/qt/actions_manager.cpp
=====================================
@@ -38,6 +38,8 @@
#include "components/extended_panels.hpp"
#include "menus.hpp"
+#include <QActionGroup>
+
ActionsManager::ActionsManager( intf_thread_t * _p_i )
: p_intf( _p_i )
, m_scanning( false )
=====================================
modules/gui/qt/components/controller.cpp
=====================================
@@ -536,12 +536,12 @@ QFrame *AbstractController::discFrame()
QFrame *discFrame = new QFrame( this );
QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
- discLayout->setSpacing( 0 ); discLayout->setMargin( 0 );
+ discLayout->setSpacing( 0 ); discLayout->setContentsMargins( 0, 0, 0, 0 );
QFrame *chapFrame = new QFrame( discFrame );
QHBoxLayout *chapLayout = new QHBoxLayout( chapFrame );
- chapLayout->setSpacing( 0 ); chapLayout->setMargin( 0 );
+ chapLayout->setSpacing( 0 ); chapLayout->setContentsMargins( 0, 0, 0, 0 );
QToolButton *prevSectionButton = new QToolButton( chapFrame );
setupButton( prevSectionButton );
@@ -560,7 +560,7 @@ QFrame *AbstractController::discFrame()
QFrame *menuFrame = new QFrame( discFrame );
QHBoxLayout *menuLayout = new QHBoxLayout( menuFrame );
- menuLayout->setSpacing( 0 ); menuLayout->setMargin( 0 );
+ menuLayout->setSpacing( 0 ); menuLayout->setContentsMargins( 0, 0, 0, 0 );
QToolButton *menuButton = new QToolButton( menuFrame );
setupButton( menuButton );
@@ -594,7 +594,7 @@ QFrame *AbstractController::telexFrame()
**/
QFrame *telexFrame = new QFrame( this );
QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
- telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
+ telexLayout->setSpacing( 0 ); telexLayout->setContentsMargins( 0, 0, 0, 0 );
CONNECT( THEMIM->getIM(), teletextPossible( bool ),
telexFrame, setVisible( bool ) );
@@ -720,14 +720,14 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
controlLayout->setContentsMargins( 3, 1, 0, 1 );
controlLayout->setSpacing( 0 );
QHBoxLayout *controlLayout1 = new QHBoxLayout;
- controlLayout1->setSpacing( 0 ); controlLayout1->setMargin( 0 );
+ controlLayout1->setSpacing( 0 ); controlLayout1->setContentsMargins( 0, 0, 0, 0 );
QString line1 = getSettings()->value( "MainWindow/MainToolbar1", MAIN_TB1_DEFAULT )
.toString();
parseAndCreate( line1, controlLayout1 );
QHBoxLayout *controlLayout2 = new QHBoxLayout;
- controlLayout2->setSpacing( 0 ); controlLayout2->setMargin( 0 );
+ controlLayout2->setSpacing( 0 ); controlLayout2->setContentsMargins( 0, 0, 0, 0 );
QString line2 = getSettings()->value( "MainWindow/MainToolbar2", MAIN_TB2_DEFAULT )
.toString();
parseAndCreate( line2, controlLayout2 );
@@ -760,7 +760,7 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
{
RTL_UNAFFECTED_WIDGET
controlLayout = new QHBoxLayout( this );
- controlLayout->setMargin( 0 );
+ controlLayout->setContentsMargins( 0, 0, 0, 0 );
controlLayout->setSpacing( 0 );
#ifdef DEBUG_LAYOUT
setStyleSheet( "background: orange ");
@@ -777,7 +777,7 @@ InputControlsWidget::InputControlsWidget( intf_thread_t *_p_i, QWidget *_parent
{
RTL_UNAFFECTED_WIDGET
controlLayout = new QHBoxLayout( this );
- controlLayout->setMargin( 0 );
+ controlLayout->setContentsMargins( 0, 0, 0, 0 );
controlLayout->setSpacing( 0 );
#ifdef DEBUG_LAYOUT
setStyleSheet( "background: green ");
=====================================
modules/gui/qt/components/controller_widget.cpp
=====================================
@@ -49,7 +49,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
{
/* We need a layout for this widget */
QHBoxLayout *layout = new QHBoxLayout( this );
- layout->setSpacing( 0 ); layout->setMargin( 0 );
+ layout->setSpacing( 0 ); layout->setContentsMargins( 0, 0, 0, 0 );
/* We need a Label for the pix */
volMuteLabel = new QLabel;
=====================================
modules/gui/qt/components/playlist/playlist.cpp
=====================================
@@ -53,7 +53,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
setContentsMargins( 0, 3, 0, 3 );
QGridLayout *layout = new QGridLayout( this );
- layout->setMargin( 0 ); layout->setSpacing( 0 );
+ layout->setContentsMargins( 0, 0, 0, 0 ); layout->setSpacing( 0 );
/*******************
* Left *
=====================================
modules/gui/qt/components/playlist/playlist_model.cpp
=====================================
@@ -126,7 +126,7 @@ QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
list.append(index);
}
- qSort(list.begin(), list.end(), modelIndexLessThen);
+ std::sort(list.begin(), list.end(), modelIndexLessThen);
AbstractPLItem *item = NULL;
foreach( const QModelIndex &index, list ) {
=====================================
modules/gui/qt/components/playlist/selector.hpp
=====================================
@@ -58,7 +58,7 @@ enum {
LONGNAME_ROLE, //QString
PL_ITEM_ROLE, //playlist_item_t*
PL_ITEM_ID_ROLE, //playlist_item_t->i_id
- IN_ITEM_ROLE, //input_item_t->i_id
+ IN_ITEM_ROLE, //input_item_t*
SPECIAL_ROLE, //SpecialData
CAP_SEARCH_ROLE,
SD_CATEGORY_ROLE,
=====================================
modules/gui/qt/components/playlist/sorting.h
=====================================
@@ -136,26 +136,4 @@ static inline int i_column_sorting( uint32_t i_column )
}
}
-/* Return the media library query select type */
-static inline ml_select_e meta_to_mlmeta( uint32_t i_column )
-{
- switch( i_column )
- {
- case COLUMN_NUMBER: return ML_ID;
- case COLUMN_TITLE: return ML_TITLE;
- case COLUMN_DURATION: return ML_DURATION;
- case COLUMN_ARTIST: return ML_ARTIST;
- case COLUMN_GENRE: return ML_GENRE;
- case COLUMN_ALBUM: return ML_ALBUM;
- case COLUMN_TRACK_NUMBER: return ML_TRACK_NUMBER;
- case COLUMN_DESCRIPTION: return ML_EXTRA;
- case COLUMN_URI: return ML_URI;
- case COLUMN_RATING: return ML_VOTE;
- case COLUMN_COVER: return ML_COVER;
- case COLUMN_DISC_NUMBER: return ML_DISC_NUMBER;
- case COLUMN_DATE: return ML_YEAR;
- default: abort();
- }
-}
-
#endif
=====================================
modules/gui/qt/components/playlist/standardpanel.cpp
=====================================
@@ -89,7 +89,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
p_selector( _p_selector )
{
viewStack = new QStackedLayout( this );
- viewStack->setSpacing( 0 ); viewStack->setMargin( 0 );
+ viewStack->setSpacing( 0 ); viewStack->setContentsMargins( 0, 0, 0, 0 );
setMinimumWidth( 300 );
iconView = NULL;
=====================================
modules/gui/qt/components/playlist/views.cpp
=====================================
@@ -477,7 +477,7 @@ void PlTreeView::keyPressEvent( QKeyEvent *event )
PicFlowView::PicFlowView( QAbstractItemModel *p_model, QWidget *parent ) : QAbstractItemView( parent )
{
QHBoxLayout *layout = new QHBoxLayout( this );
- layout->setMargin( 0 );
+ layout->setContentsMargins( 0, 0, 0, 0 );
picFlow = new PictureFlow( this, p_model );
picFlow->setContextMenuPolicy( Qt::CustomContextMenu );
connect( picFlow, SIGNAL(customContextMenuRequested( const QPoint & )),
=====================================
modules/gui/qt/components/preferences_widgets.cpp
=====================================
@@ -1230,7 +1230,7 @@ void KeySelectorControl::finish()
treeItem->setText( HOTKEY_COL, keys );
treeItem->setToolTip( HOTKEY_COL, qtr("Double click to change.\nDelete key to remove.") );
treeItem->setToolTip( GLOBAL_HOTKEY_COL, qtr("Double click to change.\nDelete key to remove.") );
- treeItem->setData( HOTKEY_COL, Qt::UserRole, QVariant( p_config_item->value.psz ) );
+ treeItem->setData( HOTKEY_COL, Qt::UserRole, QVariant( qfu( p_config_item->value.psz ) ) );
table->addTopLevelItem( treeItem );
continue;
}
=====================================
modules/gui/qt/dialogs/bookmarks.cpp
=====================================
@@ -146,7 +146,7 @@ void BookmarksDialog::update()
QStringList row;
row << QString( qfu( pp_bookmarks[i]->psz_name ) );
row << qfu("-");
- row << QString().sprintf( "%02u:%02u:%06.3f", hours, minutes, seconds );
+ row << QString( "%1:%2:%3" ).arg( hours, 2, 10, QChar('0')).arg( minutes, 2, 10, QChar('0')).arg(seconds, 10, 'f', 3, QChar('0'));
QTreeWidgetItem *item = new QTreeWidgetItem( bookmarksList, row );
item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable |
@@ -186,7 +186,7 @@ void BookmarksDialog::del()
b_ignore_updates = true;
/* Sort needed to make sure that selected elements are deleted in descending
order, otherwise the indexes might change and wrong bookmarks are deleted. */
- qSort( selected.begin(), selected.end() );
+ std::sort( selected.begin(), selected.end() );
QModelIndexList::Iterator it = selected.end();
for( --it; it != selected.begin(); it-- )
{
=====================================
modules/gui/qt/dialogs/external.cpp
=====================================
@@ -190,7 +190,7 @@ void DialogHandler::displayLogin(vlc_dialog_id *p_id, const QString &title,
dialog->setWindowTitle (title);
dialog->setWindowRole ("vlc-login");
dialog->setModal(true);
- layout->setMargin (2);
+ layout->setContentsMargins( 2, 2, 2, 2 );
/* Username and password fields */
QWidget *panel = new QWidget (dialog);
=====================================
modules/gui/qt/dialogs/preferences.cpp
=====================================
@@ -126,7 +126,7 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
setLayout( main_layout );
/* Margins */
- simple_tree_panel->layout()->setMargin( 1 );
+ simple_tree_panel->layout()->setContentsMargins( 1, 1, 1, 1 );
simple_panels_stack->layout()->setContentsMargins( 6, 0, 0, 3 );
for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
=====================================
modules/gui/qt/dialogs/toolbar.cpp
=====================================
@@ -497,7 +497,7 @@ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
QWidget *discFrame = new QWidget( this );
//discFrame->setLineWidth( 1 );
QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
- discLayout->setSpacing( 0 ); discLayout->setMargin( 0 );
+ discLayout->setSpacing( 0 ); discLayout->setContentsMargins( 0, 0, 0, 0 );
QToolButton *prevSectionButton = new QToolButton( discFrame );
prevSectionButton->setIcon( QIcon( ":/toolbar/dvd_prev.svg" ) );
@@ -522,7 +522,7 @@ WidgetListing::WidgetListing( intf_thread_t *p_intf, QWidget *_parent )
{
QWidget *telexFrame = new QWidget( this );
QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
- telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
+ telexLayout->setSpacing( 0 ); telexLayout->setContentsMargins( 0, 0, 0, 0 );
QToolButton *telexOn = new QToolButton( telexFrame );
telexOn->setIcon( QIcon( ":/toolbar/tv.svg" ) );
@@ -638,7 +638,7 @@ DroppingController::DroppingController( intf_thread_t *_p_intf,
setAcceptDrops( true );
controlLayout = new QHBoxLayout( this );
controlLayout->setSpacing( 5 );
- controlLayout->setMargin( 0 );
+ controlLayout->setContentsMargins( 0, 0, 0, 0 );
setFrameShape( QFrame::StyledPanel );
setFrameShadow( QFrame::Raised );
setMinimumHeight( 20 );
=====================================
modules/gui/qt/main_interface.cpp
=====================================
@@ -364,7 +364,7 @@ void MainInterface::createResumePanel( QWidget *w )
resumePanel = new QWidget( w );
resumePanel->hide();
QHBoxLayout *resumePanelLayout = new QHBoxLayout( resumePanel );
- resumePanelLayout->setSpacing( 0 ); resumePanelLayout->setMargin( 0 );
+ resumePanelLayout->setSpacing( 0 ); resumePanelLayout->setContentsMargins( 0, 0, 0, 0 );
QLabel *continuePixmapLabel = new QLabel();
continuePixmapLabel->setPixmap( ImageHelper::loadSvgToPixmap( ":/menu/help.svg" , fontMetrics().height(), fontMetrics().height()) );
@@ -458,7 +458,7 @@ void MainInterface::createMainWidget( QSettings *creationSettings )
setCentralWidget( main );
mainLayout = new QVBoxLayout( main );
main->setContentsMargins( 0, 0, 0, 0 );
- mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 );
+ mainLayout->setSpacing( 0 ); mainLayout->setContentsMargins( 0, 0, 0, 0 );
createResumePanel( main );
/* */
=====================================
modules/gui/qt/menus.cpp
=====================================
@@ -846,20 +846,20 @@ void VLCMenuBar::PopupMenuPlaylistEntries( QMenu *menu,
action = addMIMStaticEntry( p_intf, menu, qtr( "Pre&vious" ),
":/toolbar/previous_b.svg", SLOT( prev() ), true );
action->setEnabled( !bPlaylistEmpty );
- action->setData( ACTION_NO_CLEANUP + ACTION_DELETE_ON_REBUILD );
+ action->setData( static_cast<int>(ACTION_NO_CLEANUP | ACTION_DELETE_ON_REBUILD) );
CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
action = addMIMStaticEntry( p_intf, menu, qtr( "Ne&xt" ),
":/toolbar/next_b.svg", SLOT( next() ), true );
action->setEnabled( !bPlaylistEmpty );
- action->setData( ACTION_NO_CLEANUP + ACTION_DELETE_ON_REBUILD );
+ action->setData( static_cast<int>(ACTION_NO_CLEANUP | ACTION_DELETE_ON_REBUILD) );
CONNECT( THEMIM, playlistNotEmpty(bool), action, setEnabled(bool) );
action = menu->addAction( qtr( "Record" ), THEAM, SLOT( record() ) );
action->setIcon( QIcon( ":/toolbar/record.svg" ) );
if( !p_input )
action->setEnabled( false );
- action->setData( ACTION_NO_CLEANUP + ACTION_DELETE_ON_REBUILD );
+ action->setData( static_cast<int>(ACTION_NO_CLEANUP | ACTION_DELETE_ON_REBUILD) );
menu->addSeparator();
}
@@ -1438,7 +1438,7 @@ int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
case VLC_VAR_FLOAT:
var_Get( p_object, psz_var, &val );
if( CURTEXT ) menutext = qfue( CURTEXT );
- else menutext.sprintf( "%.2f", CURVAL.f_float );
+ else menutext.setNum(CURVAL.f_float, 'f', 2);
CreateAndConnect( submenu, psz_var, menutext, "", RADIO_OR_COMMAND,
p_object, CURVAL, i_type,
CURVAL.f_float == val.f_float );
=====================================
modules/gui/qt/util/qvlcframe.hpp
=====================================
@@ -38,13 +38,13 @@
#ifdef _WIN32
#include <QLibrary>
- #include <QSysInfo>
#include <dwmapi.h>
inline bool setImmersiveDarkModeAttribute(HWND hwnd, bool enable) {
typedef HRESULT(WINAPI *DwmSetWindowAttributeFunc)(HWND, DWORD, LPCVOID, DWORD);
static const auto dwmSetWindowAttributeFunc = []() -> DwmSetWindowAttributeFunc {
- if (QSysInfo::windowsVersion() < QSysInfo::WinVersion::WV_WINDOWS10)
+ HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
+ if (GetProcAddress(hKernel32, "GetSystemCpuSetInformation") == NULL)
return nullptr;
QLibrary dwmapidll("dwmapi");
=====================================
modules/gui/qt/util/timetooltip.cpp
=====================================
@@ -142,7 +142,7 @@ void TimeTooltip::show()
void TimeTooltip::paintEvent( QPaintEvent * )
{
QPainter p( this );
- p.setRenderHints( QPainter::HighQualityAntialiasing | QPainter::TextAntialiasing );
+ p.setRenderHints( QPainter::TextAntialiasing );
p.setPen( Qt::black );
p.setBrush( qApp->palette().base() );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3b46a77768f40878e7eb9b1e3c449c294f6d2276...55138b57794e500f2dacfc185fca243576f9dd40
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3b46a77768f40878e7eb9b1e3c449c294f6d2276...55138b57794e500f2dacfc185fca243576f9dd40
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