Commit 5ea0904b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix some clazy warning

parent 10d3889b
...@@ -478,6 +478,7 @@ bool ExportManager::doSaveAs(QWidget *parentWindow, bool notify) ...@@ -478,6 +478,7 @@ bool ExportManager::doSaveAs(QWidget *parentWindow, bool notify)
// construct the supported mimetype list // construct the supported mimetype list
const auto mimeTypes = QImageWriter::supportedMimeTypes(); const auto mimeTypes = QImageWriter::supportedMimeTypes();
supportedFilters.reserve(mimeTypes.count());
for (const auto &mimeType : mimeTypes) { for (const auto &mimeType : mimeTypes) {
supportedFilters.append(QString::fromUtf8(mimeType).trimmed()); supportedFilters.append(QString::fromUtf8(mimeType).trimmed());
} }
......
...@@ -44,6 +44,7 @@ SaveOptionsPage::SaveOptionsPage(QWidget *parent) ...@@ -44,6 +44,7 @@ SaveOptionsPage::SaveOptionsPage(QWidget *parent)
m_ui->kcfg_defaultSaveImageFormat->addItems([&](){ m_ui->kcfg_defaultSaveImageFormat->addItems([&](){
QStringList items; QStringList items;
const auto formats = QImageWriter::supportedImageFormats(); const auto formats = QImageWriter::supportedImageFormats();
items.reserve(formats.count());
for (const auto &fmt : formats) { for (const auto &fmt : formats) {
items.append(QString::fromLocal8Bit(fmt).toUpper()); items.append(QString::fromLocal8Bit(fmt).toUpper());
} }
......
...@@ -211,8 +211,9 @@ void PlatformKWinWayland::doGrab(ShutterMode /* theShutterMode */, GrabMode theG ...@@ -211,8 +211,9 @@ void PlatformKWinWayland::doGrab(ShutterMode /* theShutterMode */, GrabMode theG
case GrabMode::PerScreenImageNative: case GrabMode::PerScreenImageNative:
{ {
QList<QScreen *> screens = QGuiApplication::screens(); const QList<QScreen *> screens = QGuiApplication::screens();
QStringList screenNames; QStringList screenNames;
screenNames.reserve(screens.count());
for (const auto screen : screens) { for (const auto screen : screens) {
screenNames << screen->name(); screenNames << screen->name();
} }
...@@ -255,9 +256,9 @@ void PlatformKWinWayland::startReadImage(int theReadPipe) ...@@ -255,9 +256,9 @@ void PlatformKWinWayland::startReadImage(int theReadPipe)
lWatcher->deleteLater(); lWatcher->deleteLater();
const QImage lImage = lWatcher->result(); const QImage lImage = lWatcher->result();
if (lImage.isNull()) { if (lImage.isNull()) {
newScreenshotFailed(); Q_EMIT newScreenshotFailed();
} else { } else {
newScreenshotTaken(QPixmap::fromImage(lImage)); Q_EMIT newScreenshotTaken(QPixmap::fromImage(lImage));
} }
} }
); );
...@@ -272,9 +273,9 @@ void PlatformKWinWayland::startReadImages(int theReadPipe) ...@@ -272,9 +273,9 @@ void PlatformKWinWayland::startReadImages(int theReadPipe)
lWatcher->deleteLater(); lWatcher->deleteLater();
auto result = lWatcher->result(); auto result = lWatcher->result();
if (result.isEmpty()) { if (result.isEmpty()) {
newScreenshotFailed(); Q_EMIT newScreenshotFailed();
} else { } else {
newScreensScreenshotTaken(result); Q_EMIT newScreensScreenshotTaken(result);
} }
} }
); );
...@@ -289,7 +290,7 @@ void PlatformKWinWayland::callDBus(const QString &theGrabMethod, int theWriteFil ...@@ -289,7 +290,7 @@ void PlatformKWinWayland::callDBus(const QString &theGrabMethod, int theWriteFil
checkDbusPendingCall(pcall); checkDbusPendingCall(pcall);
} }
void PlatformKWinWayland::checkDbusPendingCall(QDBusPendingCall pcall) void PlatformKWinWayland::checkDbusPendingCall(const QDBusPendingCall &pcall)
{ {
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this);
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, QObject::connect(watcher, &QDBusPendingCallWatcher::finished,
...@@ -297,7 +298,7 @@ void PlatformKWinWayland::checkDbusPendingCall(QDBusPendingCall pcall) ...@@ -297,7 +298,7 @@ void PlatformKWinWayland::checkDbusPendingCall(QDBusPendingCall pcall)
if (watcher->isError()) { if (watcher->isError()) {
const auto error = watcher->error(); const auto error = watcher->error();
qWarning() << "Error calling KWin DBus interface:" << error.name() << error.message(); qWarning() << "Error calling KWin DBus interface:" << error.name() << error.message();
newScreenshotFailed(); Q_EMIT newScreenshotFailed();
} }
watcher->deleteLater(); watcher->deleteLater();
}); });
......
...@@ -31,7 +31,7 @@ class PlatformKWinWayland final: public Platform ...@@ -31,7 +31,7 @@ class PlatformKWinWayland final: public Platform
void startReadImage(int theReadPipe); void startReadImage(int theReadPipe);
void startReadImages(int theReadPipe); void startReadImages(int theReadPipe);
void checkDbusPendingCall(QDBusPendingCall pcall); void checkDbusPendingCall(const QDBusPendingCall &pcall);
bool screenshotScreensAvailable() const; bool screenshotScreensAvailable() const;
......
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