Remove silencing -Wclazy-qt6-deprecated-api-fixes to workaround clazy bugs

This commit is contained in:
Jonas Kvinge
2021-06-25 18:19:37 +02:00
parent df31b5d59f
commit 8287efd51f
18 changed files with 61 additions and 63 deletions

View File

@@ -208,17 +208,17 @@ void Mpris2::EmitNotification(const QString &name, const QVariant &val, const QS
void Mpris2::EmitNotification(const QString &name) {
QVariant value;
if (name == "PlaybackStatus") value = PlaybackStatus(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "LoopStatus") value = LoopStatus(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "Shuffle") value = Shuffle(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "Metadata") value = Metadata(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "Volume") value = Volume(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "Position") value = Position(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "CanPlay") value = CanPlay(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "CanPause") value = CanPause(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "CanSeek") value = CanSeek(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "CanGoNext") value = CanGoNext(); // clazy:exclude=qt6-deprecated-api-fixes
else if (name == "CanGoPrevious") value = CanGoPrevious(); // clazy:exclude=qt6-deprecated-api-fixes
if (name == "PlaybackStatus") value = PlaybackStatus();
else if (name == "LoopStatus") value = LoopStatus();
else if (name == "Shuffle") value = Shuffle();
else if (name == "Metadata") value = Metadata();
else if (name == "Volume") value = Volume();
else if (name == "Position") value = Position();
else if (name == "CanPlay") value = CanPlay();
else if (name == "CanPause") value = CanPause();
else if (name == "CanSeek") value = CanSeek();
else if (name == "CanGoNext") value = CanGoNext();
else if (name == "CanGoPrevious") value = CanGoPrevious();
if (value.isValid()) EmitNotification(name, value);

View File

@@ -32,27 +32,27 @@
namespace mpris {
inline void AddMetadata(const QString &key, const QString &metadata, QVariantMap *map) {
if (!metadata.isEmpty()) (*map)[key] = metadata; // clazy:exclude=qt6-deprecated-api-fixes
if (!metadata.isEmpty()) (*map)[key] = metadata;
}
inline void AddMetadataAsList(const QString &key, const QString &metadata, QVariantMap *map) {
if (!metadata.isEmpty()) (*map)[key] = QStringList() << metadata; // clazy:exclude=qt6-deprecated-api-fixes
if (!metadata.isEmpty()) (*map)[key] = QStringList() << metadata;
}
inline void AddMetadata(const QString &key, int metadata, QVariantMap *map) {
if (metadata > 0) (*map)[key] = metadata; // clazy:exclude=qt6-deprecated-api-fixes
if (metadata > 0) (*map)[key] = metadata;
}
inline void AddMetadata(const QString &key, qint64 metadata, QVariantMap *map) {
if (metadata > 0) (*map)[key] = metadata; // clazy:exclude=qt6-deprecated-api-fixes
if (metadata > 0) (*map)[key] = metadata;
}
inline void AddMetadata(const QString &key, double metadata, QVariantMap *map) {
if (metadata != 0.0) (*map)[key] = metadata; // clazy:exclude=qt6-deprecated-api-fixes
if (metadata != 0.0) (*map)[key] = metadata;
}
inline void AddMetadata(const QString &key, const QDateTime &metadata, QVariantMap *map) {
if (metadata.isValid()) (*map)[key] = metadata; // clazy:exclude=qt6-deprecated-api-fixes
if (metadata.isValid()) (*map)[key] = metadata;
}
inline QString AsMPRISDateTimeType(const qint64 time) {

View File

@@ -384,25 +384,23 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
command = command.split("/").last();
}
// Three is no QProcess::startDetachedCommand function in Qt 6, so ignore the Clazy Qt 6 deprecated API fixes for QProcess::startDetached().
if (command.isEmpty() || command == "exo-open") {
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}
else if (command.startsWith("nautilus")) {
proc.startDetached(command, QStringList() << command_params << "--select" << url.toLocalFile()); // clazy:exclude=qt6-deprecated-api-fixes
proc.startDetached(command, QStringList() << command_params << "--select" << url.toLocalFile());
}
else if (command.startsWith("dolphin") || command.startsWith("konqueror") || command.startsWith("kfmclient")) {
proc.startDetached(command, QStringList() << command_params << "--select" << "--new-window" << url.toLocalFile()); // clazy:exclude=qt6-deprecated-api-fixes
proc.startDetached(command, QStringList() << command_params << "--select" << "--new-window" << url.toLocalFile());
}
else if (command.startsWith("caja")) {
proc.startDetached(command, QStringList() << command_params << "--no-desktop" << path); // clazy:exclude=qt6-deprecated-api-fixes
proc.startDetached(command, QStringList() << command_params << "--no-desktop" << path);
}
else if (command.startsWith("pcmanfm") || command.startsWith("thunar")) {
proc.startDetached(command, QStringList() << command_params << path); // clazy:exclude=qt6-deprecated-api-fixes
proc.startDetached(command, QStringList() << command_params << path);
}
else {
proc.startDetached(command, QStringList() << command_params << url.toLocalFile()); // clazy:exclude=qt6-deprecated-api-fixes
proc.startDetached(command, QStringList() << command_params << url.toLocalFile());
}
}