Skip to content

Commit

Permalink
Fix a bunch of compile errors after bumping KF to 5.90
Browse files Browse the repository at this point in the history
  • Loading branch information
easyteacher committed May 3, 2022
1 parent f8cc633 commit 0ea4d4d
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion plugin/autotests/test_packagelistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void PackageListModelTest::testPackageListModelData()
QCOMPARE(idx.data(ImageRoles::ResolutionRole).toString(), QStringLiteral("1920x1080"));

QCOMPARE(idx.data(ImageRoles::PathRole).toUrl().toLocalFile(),
m_packagePath + QDir::separator() + "contents" + QDir::separator() + "images" + QDir::separator() + "1920x1080.jpg");
m_packagePath + QDir::separator() + QStringLiteral("contents") + QDir::separator() + QStringLiteral("images") + QDir::separator() + QStringLiteral("1920x1080.jpg"));
QCOMPARE(idx.data(ImageRoles::PackageNameRole).toString(), m_packagePath + QDir::separator());

QCOMPARE(idx.data(ImageRoles::RemovableRole).toBool(), false);
Expand Down
10 changes: 5 additions & 5 deletions plugin/autotests/test_slidefiltermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ void SlideFilterModelTest::initTestCase()
m_standardPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/wallpapers/");
QDir imageDir(m_standardPath);

QVERIFY(imageDir.mkpath(m_standardPath + "a/"));
QVERIFY(imageDir.mkpath(m_standardPath + "d/"));
QVERIFY(imageDir.mkpath(m_standardPath + QStringLiteral("a/")));
QVERIFY(imageDir.mkpath(m_standardPath + QStringLiteral("d/")));

QFile imageFile(m_wallpaperPath);

m_pathB = imageDir.absoluteFilePath("d/b.jpg");
m_pathB = imageDir.absoluteFilePath(QStringLiteral("d/b.jpg"));
QVERIFY(imageFile.copy(m_pathB));

// Explicitly wait 1s
QThread::sleep(1);

m_pathA = imageDir.absoluteFilePath("d/a.jpg");
m_pathA = imageDir.absoluteFilePath(QStringLiteral("d/a.jpg"));
QVERIFY(imageFile.copy(m_pathA));

QThread::sleep(1);

m_pathC = imageDir.absoluteFilePath("a/c.jpg");
m_pathC = imageDir.absoluteFilePath(QStringLiteral("a/c.jpg"));
QVERIFY(imageFile.copy(m_pathC));
}

Expand Down
18 changes: 9 additions & 9 deletions plugin/autotests/test_xmlfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,37 +51,37 @@ void XmlFinderTest::testXmlFinderCanFindImages()
QCOMPARE(paths.size(), 2);

QTRY_COMPARE(paths.at(0).name, QStringLiteral("Default Background (For test purpose, don't translate!)"));
QTRY_COMPARE(paths.at(0).filename, m_dataDir.absoluteFilePath("xml/.light.png"));
QTRY_COMPARE(paths.at(0).filename_dark, m_dataDir.absoluteFilePath("xml/.dark.png"));
QTRY_COMPARE(paths.at(0).filename, m_dataDir.absoluteFilePath(QStringLiteral("xml/.light.png")));
QTRY_COMPARE(paths.at(0).filename_dark, m_dataDir.absoluteFilePath(QStringLiteral("xml/.dark.png")));
QTRY_COMPARE(paths.at(0).author, QStringLiteral("KDE Contributor"));

QTRY_COMPARE(paths.at(1).name, QStringLiteral("Time of Day (For test purpose, don't translate!)"));
QTRY_COMPARE(paths.at(1).filename, m_dataDir.absoluteFilePath("xml/timeofday.xml"));
QTRY_COMPARE(paths.at(1).filename, m_dataDir.absoluteFilePath(QStringLiteral("xml/timeofday.xml")));
QTRY_COMPARE(paths.at(1).slideshow.starttime.date(), QDate(2022, 5, 24));
QTRY_COMPARE(paths.at(1).slideshow.starttime.time(), QTime(8, 0, 0));
QCOMPARE(paths.at(1).slideshow.data.size(), 4);

const auto &static1 = paths.at(1).slideshow.data.at(0);
QTRY_COMPARE(static1.dataType, 0);
QTRY_COMPARE(static1.duration, 36000);
QTRY_COMPARE(static1.file, m_dataDir.absoluteFilePath("xml/.light.png"));
QTRY_COMPARE(static1.file, m_dataDir.absoluteFilePath(QStringLiteral("xml/.light.png")));

const auto &dynamic1 = paths.at(1).slideshow.data.at(1);
QTRY_COMPARE(dynamic1.dataType, 1);
QTRY_COMPARE(dynamic1.duration, 7200);
QTRY_COMPARE(dynamic1.from, m_dataDir.absoluteFilePath("xml/.light.png"));
QTRY_COMPARE(dynamic1.to, m_dataDir.absoluteFilePath("xml/.dark.png"));
QTRY_COMPARE(dynamic1.from, m_dataDir.absoluteFilePath(QStringLiteral("xml/.light.png")));
QTRY_COMPARE(dynamic1.to, m_dataDir.absoluteFilePath(QStringLiteral("xml/.dark.png")));

const auto &static2 = paths.at(1).slideshow.data.at(2);
QTRY_COMPARE(static2.dataType, 0);
QTRY_COMPARE(static2.duration, 36000);
QTRY_COMPARE(static2.file, m_dataDir.absoluteFilePath("xml/.dark.png"));
QTRY_COMPARE(static2.file, m_dataDir.absoluteFilePath(QStringLiteral("xml/.dark.png")));

const auto &dynamic2 = paths.at(1).slideshow.data.at(3);
QTRY_COMPARE(dynamic2.dataType, 1);
QTRY_COMPARE(dynamic2.duration, 7200);
QTRY_COMPARE(dynamic2.from, m_dataDir.absoluteFilePath("xml/.dark.png"));
QTRY_COMPARE(dynamic2.to, m_dataDir.absoluteFilePath("xml/.light.png"));
QTRY_COMPARE(dynamic2.from, m_dataDir.absoluteFilePath(QStringLiteral("xml/.dark.png")));
QTRY_COMPARE(dynamic2.to, m_dataDir.absoluteFilePath(QStringLiteral("xml/.light.png")));
}

void XmlFinderTest::testXmlFinderFindPreferredImage()
Expand Down
2 changes: 1 addition & 1 deletion plugin/finder/distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ float distance(const QSize &size, const QSize &desired)

QSize resSize(const QString &str)
{
const int index = str.indexOf('x');
const int index = str.indexOf(QLatin1Char('x'));

if (index != -1) {
return QSize(QStringView(str).left(index).toInt(), QStringView(str).mid(index + 1).toInt());
Expand Down
2 changes: 1 addition & 1 deletion plugin/finder/imagefinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void ImageFinder::run()
} else {
const QString name = wp.fileName();

if (name.startsWith('.')) {
if (name.startsWith(QLatin1Char('.'))) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/finder/packagefinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void PackageFinder::run()
for (const QFileInfo &wp : files) {
const QString folderPath = findSymlinkTarget(wp);

if (wp.fileName().startsWith('.')) {
if (wp.fileName().startsWith(QLatin1Char('.'))) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/finder/suffixcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ QStringList suffixes()
const auto supportedMimeTypes = QImageReader::supportedMimeTypes();

for (const QByteArray &mimeType : supportedMimeTypes) {
QMimeType mime(db.mimeTypeForName(mimeType));
QMimeType mime(db.mimeTypeForName(QString::fromLatin1(mimeType)));
const QStringList globPatterns = mime.globPatterns();

for (const QString &pattern : globPatterns) {
Expand Down
4 changes: 2 additions & 2 deletions plugin/finder/xmlfinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void XmlFinder::run()
} else {
const QString name = wp.fileName();

if (name.startsWith('.')) {
if (name.startsWith(QLatin1Char('.'))) {
continue;
}

Expand Down Expand Up @@ -273,7 +273,7 @@ SlideshowData XmlFinder::parseSlideshowXml(const QString &path, const QSize &tar
if (xml.name() == QStringLiteral("duration")) {
sdata.duration = xml.readElementText().toDouble();
} else if (xml.name() == QStringLiteral("file")) {
const QStringList results = xml.readElementText(QXmlStreamReader::IncludeChildElements).simplified().split(' ');
const QStringList results = xml.readElementText(QXmlStreamReader::IncludeChildElements).simplified().split(QLatin1Char(' '));

if (results.size() == 1) {
sdata.file = results.at(0);
Expand Down
10 changes: 6 additions & 4 deletions plugin/imagebackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ void ImageBackend::startSlideshow()

void ImageBackend::backgroundsFound()
{
disconnect(m_slideshowModel, &SlideModel::done, this, 0);
disconnect(m_slideshowModel, &SlideModel::done, this, nullptr);

// setSourceModel must be called after the model is loaded
m_slideFilterModel->setSourceModel(m_slideshowModel);
Expand Down Expand Up @@ -506,12 +506,14 @@ void ImageBackend::showFileDialog()

QMimeDatabase db;
QStringList imageGlobPatterns;
foreach (const QByteArray &mimeType, QImageReader::supportedMimeTypes()) {
QMimeType mime(db.mimeTypeForName(mimeType));
const auto supportedMimeTypes = QImageReader::supportedMimeTypes();

for (const QByteArray &mimeType : supportedMimeTypes) {
QMimeType mime(db.mimeTypeForName(QString::fromLatin1(mimeType)));
imageGlobPatterns << mime.globPatterns();
}

m_dialog = new QFileDialog(nullptr, i18n("Open Image"), path, i18n("Image Files") + " (" + imageGlobPatterns.join(' ') + ')');
m_dialog = new QFileDialog(nullptr, i18n("Open Image"), path, i18n("Image Files") + QStringLiteral(" (") + imageGlobPatterns.join(QLatin1Char(' ')) + QLatin1Char(')'));
// i18n people, this isn't a "word puzzle". there is a specific string format for QFileDialog::setNameFilters

m_dialog->setFileMode(QFileDialog::ExistingFiles);
Expand Down
2 changes: 1 addition & 1 deletion plugin/imageplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ void ImagePlugin::registerTypes(const char *uri)

qmlRegisterType<ImageBackend>(uri, 2, 0, "ImageBackend");
qmlRegisterAnonymousType<QAbstractItemModel>("QAbstractItemModel", 1);
qmlRegisterUncreatableType<SortingMode>(uri, 2, 0, "SortingMode", "error: only enums");
qmlRegisterUncreatableType<SortingMode>(uri, 2, 0, "SortingMode", QStringLiteral("error: only enums"));
}
2 changes: 1 addition & 1 deletion plugin/provider/packageimageprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ AsyncPackageImageResponse::AsyncPackageImageResponse(const QString &path, const
void AsyncPackageImageResponse::slotHandleDone(const QImage &image)
{
m_image = image;
emit finished();
Q_EMIT finished();
}

QQuickTextureFactory *AsyncPackageImageResponse::textureFactory() const
Expand Down
2 changes: 1 addition & 1 deletion plugin/provider/xmlimageprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ AsyncXmlImageResponse::AsyncXmlImageResponse(const QString &path, const QSize &r
void AsyncXmlImageResponse::slotHandleDone(const QImage &image)
{
m_image = image;
emit finished();
Q_EMIT finished();
}

QQuickTextureFactory *AsyncXmlImageResponse::textureFactory() const
Expand Down
2 changes: 1 addition & 1 deletion plugin/slidefiltermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SlideFilterModel : public QSortFilterProxyModel
{
Q_OBJECT

Q_PROPERTY(bool usedInConfig MEMBER m_usedInConfig NOTIFY usedInConfigChanged);
Q_PROPERTY(bool usedInConfig MEMBER m_usedInConfig NOTIFY usedInConfigChanged)

public:
explicit SlideFilterModel(QObject *parent);
Expand Down
4 changes: 2 additions & 2 deletions plugin/slidemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void SlideModel::setSlidePaths(const QStringList &slidePaths)
removeSourceModel(k);
} else {
// Abort loading
disconnect(k, 0, this, 0);
disconnect(k, nullptr, this, nullptr);
}
k->deleteLater();
}
Expand Down Expand Up @@ -153,7 +153,7 @@ void SlideModel::slotSourceModelLoadingChanged()
return;
}

disconnect(m, &ImageProxyModel::loadingChanged, this, 0);
disconnect(m, &ImageProxyModel::loadingChanged, this, nullptr);

connect(this, &SlideModel::targetSizeChanged, m, &ImageProxyModel::targetSizeChanged);

Expand Down

0 comments on commit 0ea4d4d

Please sign in to comment.