Commit 6e4a0637 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use more QStringLiteral

parent c78a66ac
Pipeline #116594 passed with stage
in 5 minutes and 45 seconds
......@@ -74,8 +74,8 @@ QList<QAction *> SlideShowFileItemAction::actions(const KFileItemListProperties
connect(startSlideShowAction, &QAction::triggered, this, [=]() {
// gwenview -s %u
auto job = new KIO::CommandLauncherJob(QStringLiteral("gwenview"), QStringList("-s") << itemsForSlideShow);
job->setDesktopName("org.kde.gwenview");
auto job = new KIO::CommandLauncherJob(QStringLiteral("gwenview"), QStringList(QStringLiteral("-s")) << itemsForSlideShow);
job->setDesktopName(QStringLiteral("org.kde.gwenview"));
job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled));
job->start();
......
......@@ -179,7 +179,7 @@ Profile::Ptr Profile::loadFromExiv2Image(const Exiv2::Image* image)
QByteArray data;
data.resize(size);
it->copy(reinterpret_cast<Exiv2::byte*>(data.data()), Exiv2::invalidByteOrder);
hProfile = cmsOpenProfileFromMem(data, size);
hProfile = cmsOpenProfileFromMem(data.constData(), size);
if (hProfile) {
ptr = new Profile(hProfile);
......@@ -193,7 +193,7 @@ Profile::Ptr Profile::loadFromICC(const QByteArray &data)
int size = data.size();
if (size > 0) {
cmsHPROFILE hProfile = cmsOpenProfileFromMem(data, size);
cmsHPROFILE hProfile = cmsOpenProfileFromMem(data.constData(), size);
if (hProfile) {
ptr = new Profile(hProfile);
......
......@@ -114,13 +114,13 @@ struct VideoViewAdapterPrivate {
QObject::connect(mAudioOutput, &Phonon::AudioOutput::volumeChanged, q, &VideoViewAdapter::slotOutputVolumeChanged);
// Timestamps
mCurrentTime = new QLabel("--:--");
mCurrentTime = new QLabel(QStringLiteral("--:--"));
mCurrentTime->setAttribute(Qt::WA_TranslucentBackground);
mCurrentTime->setStyleSheet("QLabel { color : white; }");
mCurrentTime->setStyleSheet(QStringLiteral("QLabel { color : white; }"));
mCurrentTime->setAlignment(Qt::AlignCenter);
mRemainingTime = new QLabel("--:--");
mRemainingTime = new QLabel(QStringLiteral("--:--"));
mRemainingTime->setAttribute(Qt::WA_TranslucentBackground);
mRemainingTime->setStyleSheet("QLabel { color : white; }");
mRemainingTime->setStyleSheet(QStringLiteral("QLabel { color : white; }"));
mRemainingTime->setAlignment(Qt::AlignCenter);
QObject::connect(mMediaObject, &Phonon::MediaObject::stateChanged, q, &VideoViewAdapter::updateTimestamps);
QObject::connect(mMediaObject, &Phonon::MediaObject::tick, q, &VideoViewAdapter::updateTimestamps);
......@@ -365,25 +365,25 @@ void VideoViewAdapter::slotSeekSliderActionTriggered(int /*action*/)
void VideoViewAdapter::updateTimestamps()
{
QString currentTime("--:--");
QString remainingTime("--:--");
QString currentTime(QStringLiteral("--:--"));
QString remainingTime(QStringLiteral("--:--"));
switch (d->mMediaObject->state()) {
case Phonon::PlayingState:
case Phonon::BufferingState:
case Phonon::PausedState: {
qint64 current = d->mMediaObject->currentTime();
currentTime = QDateTime::fromSecsSinceEpoch(current / 1000).toUTC().toString("h:mm:ss");
if (currentTime.startsWith("0:")) {
currentTime = QDateTime::fromSecsSinceEpoch(current / 1000).toUTC().toString(QStringLiteral("h:mm:ss"));
if (currentTime.startsWith(QStringLiteral("0:"))) {
currentTime.remove(0, 2);
}
qint64 remaining = d->mMediaObject->remainingTime();
remainingTime = QDateTime::fromSecsSinceEpoch(remaining / 1000).toUTC().toString("h:mm:ss");
if (remainingTime.startsWith("0:")) {
remainingTime = QDateTime::fromSecsSinceEpoch(remaining / 1000).toUTC().toString(QStringLiteral("h:mm:ss"));
if (remainingTime.startsWith(QStringLiteral("0:"))) {
remainingTime.remove(0, 2);
}
remainingTime = "-" + remainingTime;
remainingTime = QStringLiteral("-") + remainingTime;
break;
}
......
......@@ -128,7 +128,7 @@ private:
#ifdef Q_OS_UNIX
// shorten home directory, but avoid showing a cryptic "~/"
if (text.length() > QDir::homePath().length() + 1) {
text.replace(QRegularExpression('^' + QDir::homePath()), QStringLiteral("~"));
text.replace(QRegularExpression(QLatin1Char('^') + QDir::homePath()), QStringLiteral("~"));
}
#endif
setText(text);
......
......@@ -105,7 +105,7 @@ void ResizeImageDialog::setOriginalSize(const QSize &size)
d->mHeightSpinBox->setValue(size.height());
}
void ResizeImageDialog::setCurrentImageUrl(QUrl imageUrl)
void ResizeImageDialog::setCurrentImageUrl(const QUrl &imageUrl)
{
mCurrentImageUrl = imageUrl;
......@@ -238,9 +238,11 @@ qint64 ResizeImageDialog::calculateEstimatedImageSize()
buffer.open(QIODevice::ReadWrite);
image = image.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (QString::compare(suffix, "jpg", Qt::CaseInsensitive) == 0 || QString::compare(suffix, "jpeg", Qt::CaseInsensitive) == 0
|| QString::compare(suffix, "avif", Qt::CaseInsensitive) == 0 || QString::compare(suffix, "heic", Qt::CaseInsensitive) == 0
|| QString::compare(suffix, "webp", Qt::CaseInsensitive) == 0) {
if (QString::compare(suffix, QStringLiteral("jpg"), Qt::CaseInsensitive) == 0
|| QString::compare(suffix, QStringLiteral("jpeg"), Qt::CaseInsensitive) == 0
|| QString::compare(suffix, QStringLiteral("avif"), Qt::CaseInsensitive) == 0
|| QString::compare(suffix, QStringLiteral("heic"), Qt::CaseInsensitive) == 0
|| QString::compare(suffix, QStringLiteral("webp"), Qt::CaseInsensitive) == 0) {
image.save(&buffer, suffix.toStdString().c_str(), GwenviewConfig::jPEGQuality());
} else {
image.save(&buffer, suffix.toStdString().c_str());
......
......@@ -42,7 +42,7 @@ public:
~ResizeImageDialog() override;
void setOriginalSize(const QSize &);
void setCurrentImageUrl(QUrl);
void setCurrentImageUrl(const QUrl &);
QSize size() const;
private Q_SLOTS:
......
......@@ -71,7 +71,7 @@ void ItemEditor::resizeToContents()
if (d->mCenter.isNull()) {
d->mCenter = geometry().center();
}
int textWidth = fontMetrics().boundingRect(" " + text() + " ").width();
int textWidth = fontMetrics().boundingRect(QStringLiteral(" ") + text() + QStringLiteral(" ")).width();
QRect rect = geometry();
rect.setWidth(textWidth);
rect.moveCenter(d->mCenter);
......
......@@ -74,7 +74,7 @@ public:
protected:
bool eventFilter(QObject *, QEvent *) override;
signals:
Q_SIGNALS:
void PanTriggered(const QPointF &);
void swipeLeftTriggered();
void swipeRightTriggered();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment