[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: make use of `QStringBuilder` in `ControlbarProfileModel::save()`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Apr 18 09:27:26 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
d4bba3e9 by Fatih Uzunoglu at 2025-04-18T09:01:09+00:00
qt: make use of `QStringBuilder` in `ControlbarProfileModel::save()`
This was unfortunately forgotten in 04507065.
I used `%` instead of `+` even though defining `QT_USE_QSTRINGBUILDER`
(where we do) makes `+` behave like `%`, to explicitly request to
use `QStringBuilder` noting the amount of additions done.
- - - - -
30545194 by Fatih Uzunoglu at 2025-04-18T09:01:09+00:00
qt: switch to constexpr from preprocessor definitions in `controlbar_profile_model.cpp`
- - - - -
1 changed file:
- modules/gui/qt/dialogs/toolbar/controlbar_profile_model.cpp
Changes:
=====================================
modules/gui/qt/dialogs/toolbar/controlbar_profile_model.cpp
=====================================
@@ -25,14 +25,16 @@
#include "player/control_list_model.hpp"
#include "player/player_controlbar_model.hpp"
-#define SETTINGS_KEY_SELECTEDPROFILE "SelectedProfile"
-#define SETTINGS_ARRAYNAME_PROFILES "Profiles"
-#define SETTINGS_KEY_NAME "Name"
-#define SETTINGS_KEY_MODEL "Model"
+// NOTE: QSettings started to accept QAnyStringView with Qt 6.4,
+// so instead of a QString(Literal), use QLatin1String(View):
+constexpr QLatin1String SETTINGS_KEY_SELECTEDPROFILE {"SelectedProfile"};
+constexpr QLatin1String SETTINGS_ARRAYNAME_PROFILES {"Profiles"};
+constexpr QLatin1String SETTINGS_KEY_NAME {"Name"};
+constexpr QLatin1String SETTINGS_KEY_MODEL {"Model"};
-#define SETTINGS_CONTROL_SEPARATOR QChar(',')
-#define SETTINGS_CONFIGURATION_SEPARATOR QChar('|')
-#define SETTINGS_PROFILE_SEPARATOR QChar('$')
+constexpr QChar SETTINGS_CONTROL_SEPARATOR {','};
+constexpr QChar SETTINGS_CONFIGURATION_SEPARATOR {'|'};
+constexpr QChar SETTINGS_PROFILE_SEPARATOR {'$'};
decltype (ControlbarProfileModel::m_defaults)
ControlbarProfileModel::m_defaults =
@@ -726,16 +728,14 @@ void ControlbarProfileModel::save(bool clearDirty) const
return ret;
};
- {
- val += SETTINGS_PROFILE_SEPARATOR;
- val += QString::number(identifier);
- val += SETTINGS_CONFIGURATION_SEPARATOR;
- val += join(serializedModels[0]);
- val += SETTINGS_CONFIGURATION_SEPARATOR;
- val += join(serializedModels[1]);
- val += SETTINGS_CONFIGURATION_SEPARATOR;
- val += join(serializedModels[2]);
- }
+ val += SETTINGS_PROFILE_SEPARATOR %
+ QString::number(identifier) %
+ SETTINGS_CONFIGURATION_SEPARATOR %
+ join(serializedModels[0]) %
+ SETTINGS_CONFIGURATION_SEPARATOR %
+ join(serializedModels[1]) %
+ SETTINGS_CONFIGURATION_SEPARATOR %
+ join(serializedModels[2]);
}
if (clearDirty)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9785fcdc0b72043d8df84920d1c793a511b08036...30545194671b90b17c1f8fa61cd57ccc69964a43
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9785fcdc0b72043d8df84920d1c793a511b08036...30545194671b90b17c1f8fa61cd57ccc69964a43
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