Disable automatic conversions from 8-bit strings

This commit is contained in:
Jonas Kvinge
2024-04-11 02:56:01 +02:00
parent 58944993b8
commit 0c6872b352
310 changed files with 2501 additions and 2332 deletions

View File

@@ -22,6 +22,7 @@
#include "core/application.h"
#include "core/player.h"
#include "core/song.h"
#include "core/settings.h"
#include "engine/enginebase.h"
#include "settings/moodbarsettingspage.h"
#include "playlist/playlistmanager.h"
@@ -44,7 +45,7 @@ MoodbarController::MoodbarController(Application *app, QObject *parent)
void MoodbarController::ReloadSettings() {
QSettings s;
Settings s;
s.beginGroup(MoodbarSettingsPage::kSettingsGroup);
enabled_ = s.value("enabled", false).toBool();
s.endGroup();

View File

@@ -32,6 +32,7 @@
#include <QRect>
#include "core/application.h"
#include "core/settings.h"
#include "playlist/playlist.h"
#include "playlist/playlistview.h"
#include "playlist/playlistfilter.h"
@@ -59,7 +60,7 @@ MoodbarItemDelegate::MoodbarItemDelegate(Application *app, PlaylistView *view, Q
void MoodbarItemDelegate::ReloadSettings() {
QSettings s;
Settings s;
s.beginGroup(MoodbarSettingsPage::kSettingsGroup);
enabled_ = s.value("enabled", false).toBool();
const MoodbarRenderer::MoodbarStyle new_style = static_cast<MoodbarRenderer::MoodbarStyle>(s.value("style", static_cast<int>(MoodbarRenderer::MoodbarStyle::Normal)).toInt());

View File

@@ -40,6 +40,7 @@
#include "core/logging.h"
#include "core/scoped_ptr.h"
#include "core/application.h"
#include "core/settings.h"
#include "moodbarpipeline.h"
@@ -58,7 +59,7 @@ MoodbarLoader::MoodbarLoader(Application *app, QObject *parent)
kMaxActiveRequests(qMax(1, QThread::idealThreadCount() / 2)),
save_(false) {
cache_->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/moodbar");
cache_->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/moodbar"));
cache_->setMaximumCacheSize(60 * 1024 * 1024); // 60MB - enough for 20,000 moodbars
QObject::connect(app, &Application::SettingsChanged, this, &MoodbarLoader::ReloadSettings);
@@ -73,7 +74,7 @@ MoodbarLoader::~MoodbarLoader() {
void MoodbarLoader::ReloadSettings() {
QSettings s;
Settings s;
s.beginGroup(MoodbarSettingsPage::kSettingsGroup);
save_ = s.value("save", false).toBool();
s.endGroup();
@@ -86,15 +87,15 @@ QStringList MoodbarLoader::MoodFilenames(const QString &song_filename) {
const QFileInfo file_info(song_filename);
const QString dir_path(file_info.dir().path());
const QString mood_filename = file_info.completeBaseName() + ".mood";
const QString mood_filename = file_info.completeBaseName() + QStringLiteral(".mood");
return QStringList() << dir_path + "/." + mood_filename << dir_path + "/" + mood_filename;
return QStringList() << dir_path + QStringLiteral("/.") + mood_filename << dir_path + QLatin1Char('/') + mood_filename;
}
QUrl MoodbarLoader::CacheUrlEntry(const QString &filename) {
return QUrl(QUrl::toPercentEncoding(filename));
return QUrl(QString::fromLatin1(QUrl::toPercentEncoding(filename)));
}

View File

@@ -71,7 +71,7 @@ GstElement *MoodbarPipeline::CreateElement(const QString &factory_name) {
QByteArray MoodbarPipeline::ToGstUrl(const QUrl &url) {
if (url.isLocalFile() && !url.host().isEmpty()) {
QString str = "file:////" + url.host() + url.path();
QString str = QStringLiteral("file:////") + url.host() + url.path();
return str.toUtf8();
}

View File

@@ -37,6 +37,7 @@
#include <QContextMenuEvent>
#include "core/application.h"
#include "core/settings.h"
#include "moodbarproxystyle.h"
#include "moodbarrenderer.h"
@@ -74,7 +75,7 @@ MoodbarProxyStyle::MoodbarProxyStyle(Application *app, QSlider *slider, QObject*
void MoodbarProxyStyle::ReloadSettings() {
QSettings s;
Settings s;
s.beginGroup(MoodbarSettingsPage::kSettingsGroup);
// Get the enabled/disabled setting, and start the timelines if there's a change.
enabled_ = s.value("show", false).toBool();
@@ -107,7 +108,7 @@ void MoodbarProxyStyle::SetMoodbarEnabled(const bool enabled) {
enabled_ = enabled;
// Save the enabled setting.
QSettings s;
Settings s;
s.beginGroup(MoodbarSettingsPage::kSettingsGroup);
s.setValue("show", enabled);
s.endGroup();
@@ -286,7 +287,7 @@ QRect MoodbarProxyStyle::subControlRect(ComplexControl cc, const QStyleOptionCom
case SC_SliderGroove:
return opt->rect.adjusted(kMarginSize, kMarginSize, -kMarginSize, -kMarginSize);
case SC_SliderHandle: {
case SC_SliderHandle:{
const QStyleOptionSlider *slider_opt = qstyleoption_cast<const QStyleOptionSlider*>(opt);
int x_offset = 0;
@@ -403,7 +404,7 @@ void MoodbarProxyStyle::ShowContextMenu(const QPoint pos) {
void MoodbarProxyStyle::ChangeStyle(QAction *action) {
QSettings s;
Settings s;
s.beginGroup(MoodbarSettingsPage::kSettingsGroup);
s.setValue("style", action->data().toInt());
s.endGroup();

View File

@@ -50,7 +50,7 @@ ColorVector MoodbarRenderer::Colors(const QByteArray &data, const MoodbarStyle s
properties = StyleProperties(samples / 360 * 3, 0, 359, 100, 100);
break;
case MoodbarStyle::SystemPalette:
default: {
default:{
const QColor highlight_color(palette.color(QPalette::Active, QPalette::Highlight));
properties.threshold_ = samples / 360 * 3;