[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: keep the module name as a QString
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Feb 7 09:57:43 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
e063d116 by Steve Lhomme at 2025-02-07T09:43:02+00:00
qt: keep the module name as a QString
So we don't have to release it manually.
This should be backported as Qt5 with QT_USE_QSTRINGBUILDER
doesn't like the + in onUpdate().
For some reason Qt6 is OK with that.
- - - - -
65b9fe62 by Steve Lhomme at 2025-02-07T09:43:02+00:00
qt: use QString::fromWCharArray() to translate widows WCHAR strings
No need to translate to UTF-8 first (which is also not used as such later).
- - - - -
3 changed files:
- modules/gui/qt/dialogs/open/open_panels.cpp
- modules/gui/qt/dialogs/preferences/preferences_widgets.cpp
- modules/gui/qt/dialogs/preferences/preferences_widgets.hpp
Changes:
=====================================
modules/gui/qt/dialogs/open/open_panels.cpp
=====================================
@@ -42,9 +42,6 @@
#include <vlc_modules.h>
#include <vlc_plugin.h>
#include <vlc_url.h>
-#ifdef _WIN32
- #include <vlc_charset.h> /* FromWide for Win32 */
-#endif
#include <QFileDialog>
#include <QDialogButtonBox>
@@ -403,16 +400,14 @@ void DiscOpenPanel::onFocus()
wchar_t psz_name[512] = L"";
GetVolumeInformationW( drive, psz_name, 511, NULL, NULL, NULL, NULL, 0 );
- char *psz_drive = FromWide( drive );
+ QString psz_drive = QString::fromWCharArray( drive );
QString displayName = psz_drive;
- char *psz_title = FromWide( psz_name );
- if( !EMPTY_STR(psz_title)) {
+ QString psz_title = QString::fromWCharArray( psz_name );
+ if( !psz_title.isEmpty()) {
displayName = displayName + " - " + psz_title;
}
- ui.deviceCombo->addItem( displayName, qfu(psz_drive) );
- free( psz_drive );
- free( psz_title );
+ ui.deviceCombo->addItem( displayName, psz_drive );
}
/* go to next drive */
=====================================
modules/gui/qt/dialogs/preferences/preferences_widgets.cpp
=====================================
@@ -732,8 +732,6 @@ void ModuleListConfigControl::insertInto( QBoxLayout *l, int index )
ModuleListConfigControl::~ModuleListConfigControl()
{
- foreach ( checkBoxListItem *it, modules )
- free( it->psz_module );
qDeleteAll( modules );
modules.clear();
}
@@ -756,10 +754,10 @@ void ModuleListConfigControl::checkbox_lists( QString label, QString help, const
cb->setToolTip( formatTooltip( help ) );
cbl->checkBox = cb;
- cbl->psz_module = strdup( psz_module );
+ cbl->psz_module = qfu( psz_module );
modules.append( cbl );
- if( p_item->value.psz && strstr( p_item->value.psz, cbl->psz_module ) )
+ if( p_item->value.psz && strstr( p_item->value.psz, psz_module ) )
cbl->checkBox->setChecked( true );
}
=====================================
modules/gui/qt/dialogs/preferences/preferences_widgets.hpp
=====================================
@@ -363,7 +363,7 @@ private:
struct checkBoxListItem {
QCheckBox *checkBox;
- char *psz_module;
+ QString psz_module;
};
class ModuleListConfigControl : public VStringConfigControl
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/898e706c58c9f4ad31833bd20a8d6171a43c5f69...65b9fe623a57a0368ac2a620410b6f037c7a0c48
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/898e706c58c9f4ad31833bd20a8d6171a43c5f69...65b9fe623a57a0368ac2a620410b6f037c7a0c48
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