Disable automatic conversions from 8-bit strings
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
|
||||
#include "fancytabwidget.h"
|
||||
#include "core/stylehelper.h"
|
||||
#include "core/settings.h"
|
||||
#include "settings/appearancesettingspage.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
@@ -480,11 +481,11 @@ FancyTabWidget::~FancyTabWidget() {
|
||||
|
||||
void FancyTabWidget::Load(const QString &kSettingsGroup) {
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
QMultiMap <int, TabData*> tabs;
|
||||
for (TabData *tab : std::as_const(tabs_)) {
|
||||
int idx = s.value("tab_" + tab->name(), tab->index()).toInt();
|
||||
int idx = s.value(QStringLiteral("tab_") + tab->name(), tab->index()).toInt();
|
||||
while (tabs.contains(idx)) { ++idx; }
|
||||
tabs.insert(idx, tab);
|
||||
}
|
||||
@@ -505,14 +506,14 @@ int FancyTabWidget::insertTab(const int idx, QWidget *page, const QIcon &icon, c
|
||||
|
||||
void FancyTabWidget::SaveSettings(const QString &kSettingsGroup) {
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
s.setValue("tab_mode", static_cast<int>(mode_));
|
||||
s.setValue("current_tab", currentIndex());
|
||||
|
||||
for (TabData *tab : std::as_const(tabs_)) {
|
||||
QString k = "tab_" + tab->name();
|
||||
QString k = QStringLiteral("tab_") + tab->name();
|
||||
int idx = QTabWidget::indexOf(tab->page());
|
||||
if (idx < 0) {
|
||||
if (s.contains(k)) s.remove(k);
|
||||
@@ -528,7 +529,7 @@ void FancyTabWidget::SaveSettings(const QString &kSettingsGroup) {
|
||||
|
||||
void FancyTabWidget::ReloadSettings() {
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
||||
bg_color_system_ = s.value(AppearanceSettingsPage::kTabBarSystemColor, false).toBool();
|
||||
bg_gradient_ = s.value(AppearanceSettingsPage::kTabBarGradient, true).toBool();
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "core/filesystemmusicstorage.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "core/mimedata.h"
|
||||
#include "core/settings.h"
|
||||
#include "dialogs/deleteconfirmationdialog.h"
|
||||
#include "fileview.h"
|
||||
#include "fileviewlist.h"
|
||||
@@ -93,8 +94,8 @@ FileView::FileView(QWidget *parent)
|
||||
QObject::connect(ui_->list, &FileViewList::Delete, this, &FileView::Delete);
|
||||
QObject::connect(ui_->list, &FileViewList::EditTags, this, &FileView::EditTags);
|
||||
|
||||
QString filter(FileView::kFileFilter);
|
||||
filter_list_ << filter.split(QStringLiteral(" "));
|
||||
QString filter = QLatin1String(FileView::kFileFilter);
|
||||
filter_list_ << filter.split(QLatin1Char(' '));
|
||||
|
||||
ReloadSettings();
|
||||
|
||||
@@ -106,7 +107,7 @@ FileView::~FileView() {
|
||||
|
||||
void FileView::ReloadSettings() {
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
||||
int iconsize = s.value(AppearanceSettingsPage::kIconSizeLeftPanelButtons, 22).toInt();
|
||||
s.endGroup();
|
||||
|
||||
@@ -194,7 +194,7 @@ void FileViewList::mousePressEvent(QMouseEvent *e) {
|
||||
emit Forward();
|
||||
break;
|
||||
// enqueue to playlist with middleClick
|
||||
case Qt::MiddleButton: {
|
||||
case Qt::MiddleButton:{
|
||||
QListView::mousePressEvent(e);
|
||||
|
||||
// we need to update the menu selection
|
||||
|
||||
@@ -229,7 +229,7 @@ QString FreeSpaceBar::TextForSize(const QString &prefix, const quint64 size) {
|
||||
ret = QStringLiteral("0 MB");
|
||||
}
|
||||
|
||||
if (!prefix.isEmpty()) ret.prepend(prefix + " ");
|
||||
if (!prefix.isEmpty()) ret.prepend(prefix + QLatin1Char(' '));
|
||||
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ class SpinBox : public QSpinBox, public ExtendedEditor {
|
||||
|
||||
QVariant value() const override { return QSpinBox::value(); }
|
||||
void set_value(const QVariant &value) override { QSpinBox::setValue(value.toInt()); }
|
||||
bool is_empty() const override { return text().isEmpty() || text() == "0"; }
|
||||
bool is_empty() const override { return text().isEmpty() || text() == QStringLiteral("0"); }
|
||||
|
||||
public slots:
|
||||
void set_focus() override { QSpinBox::setFocus(); }
|
||||
@@ -214,7 +214,7 @@ class CheckBox : public QCheckBox, public ExtendedEditor {
|
||||
// ExtendedEditor
|
||||
void set_enabled(bool enabled) override { QCheckBox::setEnabled(enabled); }
|
||||
|
||||
bool is_empty() const override { return text().isEmpty() || text() == "0"; }
|
||||
bool is_empty() const override { return text().isEmpty() || text() == QStringLiteral("0"); }
|
||||
QVariant value() const override { return QCheckBox::isChecked(); }
|
||||
void set_value(const QVariant &value) override { QCheckBox::setCheckState(value.toBool() ? Qt::Checked : Qt::Unchecked); }
|
||||
void set_partially() override { QCheckBox::setCheckState(Qt::PartiallyChecked); }
|
||||
|
||||
@@ -79,8 +79,8 @@ void LoginStateWidget::SetLoggedIn(const State state, const QString &account_nam
|
||||
ui_->signed_out->setVisible(state != State::LoggedIn);
|
||||
ui_->busy->setVisible(state == State::LoginInProgress);
|
||||
|
||||
if (account_name.isEmpty()) ui_->signed_in_label->setText("<b>" + tr("You are signed in.") + "</b>");
|
||||
else ui_->signed_in_label->setText(tr("You are signed in as %1.").arg("<b>" + account_name + "</b>"));
|
||||
if (account_name.isEmpty()) ui_->signed_in_label->setText(QStringLiteral("<b>") + tr("You are signed in.") + QStringLiteral("</b>"));
|
||||
else ui_->signed_in_label->setText(tr("You are signed in as %1.").arg(QStringLiteral("<b>") + account_name + QStringLiteral("</b>")));
|
||||
|
||||
for (QWidget *widget : credential_groups_) {
|
||||
widget->setVisible(state != State::LoggedIn);
|
||||
@@ -151,7 +151,7 @@ void LoginStateWidget::SetExpires(const QDate expires) {
|
||||
|
||||
if (expires.isValid()) {
|
||||
const QString expires_text = QLocale().toString(expires, QLocale::LongFormat);
|
||||
ui_->expires_label->setText(tr("Expires on %1").arg("<b>" + expires_text + "</b>"));
|
||||
ui_->expires_label->setText(tr("Expires on %1").arg(QStringLiteral("<b>") + expires_text + QStringLiteral("</b>")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <QtEvents>
|
||||
|
||||
#include "core/application.h"
|
||||
#include "core/settings.h"
|
||||
#include "utilities/imageutils.h"
|
||||
#include "covermanager/albumcoverchoicecontroller.h"
|
||||
#include "playingwidget.h"
|
||||
@@ -87,7 +88,7 @@ PlayingWidget::PlayingWidget(QWidget *parent)
|
||||
SetHeight(0);
|
||||
|
||||
// Load settings
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
mode_ = static_cast<Mode>(s.value("mode", static_cast<int>(Mode::LargeSongDetails)).toInt());
|
||||
fit_width_ = s.value("fit_cover_width", false).toBool();
|
||||
@@ -139,7 +140,7 @@ void PlayingWidget::Init(Application *app, AlbumCoverChoiceController *album_cov
|
||||
|
||||
above_statusbar_action_ = menu_->addAction(tr("Show above status bar"));
|
||||
above_statusbar_action_->setCheckable(true);
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
above_statusbar_action_->setChecked(s.value("above_status_bar", false).toBool());
|
||||
s.endGroup();
|
||||
@@ -229,7 +230,7 @@ void PlayingWidget::SetMode(const Mode mode) {
|
||||
UpdateDetailsText();
|
||||
update();
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("mode", static_cast<int>(mode_));
|
||||
s.endGroup();
|
||||
@@ -242,7 +243,7 @@ void PlayingWidget::FitCoverWidth(const bool fit) {
|
||||
UpdateHeight();
|
||||
update();
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("fit_cover_width", fit_width_);
|
||||
s.endGroup();
|
||||
@@ -251,7 +252,7 @@ void PlayingWidget::FitCoverWidth(const bool fit) {
|
||||
|
||||
void PlayingWidget::ShowAboveStatusBar(const bool above) {
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("above_status_bar", above);
|
||||
s.endGroup();
|
||||
@@ -547,7 +548,7 @@ void PlayingWidget::SearchCoverInProgress() {
|
||||
downloading_covers_ = true;
|
||||
|
||||
// Show a spinner animation
|
||||
spinner_animation_ = make_unique<QMovie>(":/pictures/spinner.gif", QByteArray(), this);
|
||||
spinner_animation_ = make_unique<QMovie>(QStringLiteral(":/pictures/spinner.gif"), QByteArray(), this);
|
||||
QObject::connect(&*spinner_animation_, &QMovie::updated, this, &PlayingWidget::Update);
|
||||
spinner_animation_->start();
|
||||
update();
|
||||
|
||||
@@ -130,24 +130,20 @@ public:
|
||||
if ([firstResponder isKindOfClass:[NSText class]] && reinterpret_cast<NSSearchField*>([reinterpret_cast<NSText*>(firstResponder) delegate]) == self) {
|
||||
|
||||
if ([event type] == NSEventTypeKeyDown && [event modifierFlags] & NSEventModifierFlagCommand) {
|
||||
QString keyString = toQString([event characters]);
|
||||
if (keyString == "a") // Cmd+a
|
||||
{
|
||||
const QString keyString = toQString([event characters]);
|
||||
if (keyString == QStringLiteral("a")) { // Cmd+a
|
||||
[self performSelector:@selector(selectText:)];
|
||||
return YES;
|
||||
}
|
||||
else if (keyString == "c") // Cmd+c
|
||||
{
|
||||
else if (keyString == QStringLiteral("c")) { // Cmd+c
|
||||
[[self currentEditor] copy: nil];
|
||||
return YES;
|
||||
}
|
||||
else if (keyString == "v") // Cmd+v
|
||||
{
|
||||
else if (keyString == QStringLiteral("v")) { // Cmd+v
|
||||
[[self currentEditor] paste: nil];
|
||||
return YES;
|
||||
}
|
||||
else if (keyString == "x") // Cmd+x
|
||||
{
|
||||
else if (keyString == QStringLiteral("x")) { // Cmd+x
|
||||
[[self currentEditor] cut: nil];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -29,16 +29,13 @@
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
|
||||
const int RatingPainter::kStarCount;
|
||||
const int RatingPainter::kStarSize;
|
||||
|
||||
RatingPainter::RatingPainter() {
|
||||
|
||||
// Load the base pixmaps
|
||||
QIcon star_on(":/pictures/star-on.png");
|
||||
QIcon star_on(QStringLiteral(":/pictures/star-on.png"));
|
||||
QList<QSize> star_on_sizes = star_on.availableSizes();
|
||||
QPixmap on(star_on.pixmap(star_on_sizes.last()));
|
||||
QIcon star_off(":/pictures/star-off.png");
|
||||
QIcon star_off(QStringLiteral(":/pictures/star-off.png"));
|
||||
QList<QSize> star_off_sizes = star_off.availableSizes();
|
||||
QPixmap off(star_off.pixmap(star_off_sizes.last()));
|
||||
|
||||
|
||||
@@ -30,8 +30,9 @@ class RatingPainter {
|
||||
public:
|
||||
RatingPainter();
|
||||
|
||||
static const int kStarCount = 5;
|
||||
static const int kStarSize = 16;
|
||||
static constexpr int kStarCount = 5;
|
||||
static constexpr int kStarSize = 16;
|
||||
|
||||
static QRect Contents(const QRect rect);
|
||||
static float RatingForPos(const QPoint pos, const QRect rect);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QSettings>
|
||||
#include <QEvent>
|
||||
|
||||
#include "core/settings.h"
|
||||
#include "utilities/timeutils.h"
|
||||
#include "utilities/timeconstants.h"
|
||||
#include "trackslider.h"
|
||||
@@ -57,7 +58,7 @@ TrackSlider::TrackSlider(QWidget *parent)
|
||||
UpdateLabelWidth();
|
||||
|
||||
// Load settings
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
show_remaining_time_ = s.value("show_remaining_time").toBool();
|
||||
s.endGroup();
|
||||
@@ -142,7 +143,7 @@ void TrackSlider::UpdateTimes(const int elapsed) {
|
||||
ui_->elapsed->setText(Utilities::PrettyTime(elapsed));
|
||||
// Update normally if showing remaining time
|
||||
if (show_remaining_time_) {
|
||||
ui_->remaining->setText("-" + Utilities::PrettyTime(static_cast<int>(ui_->slider->maximum() / kMsecPerSec) - elapsed));
|
||||
ui_->remaining->setText(QLatin1Char('-') + Utilities::PrettyTime(static_cast<int>(ui_->slider->maximum() / kMsecPerSec) - elapsed));
|
||||
}
|
||||
else {
|
||||
// Check if slider maximum value is changed before updating
|
||||
@@ -214,7 +215,7 @@ void TrackSlider::ToggleTimeDisplay() {
|
||||
UpdateTimes(static_cast<int>(ui_->slider->value() / kMsecPerSec));
|
||||
|
||||
// Save this setting
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("show_remaining_time", show_remaining_time_);
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ void VolumeSlider::paintEvent(QPaintEvent*) {
|
||||
vol_font.setPixelSize(9);
|
||||
p.setFont(vol_font);
|
||||
const QRect rect(0, 0, 34, 15);
|
||||
p.drawText(rect, Qt::AlignRight | Qt::AlignVCenter, QString::number(value()) + '%');
|
||||
p.drawText(rect, Qt::AlignRight | Qt::AlignVCenter, QString::number(value()) + QLatin1Char('%'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user