From 447d2aa4d1576d5aec1668344cd5fe611f3f4b05 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Sun, 3 Dec 2017 21:14:14 +0100 Subject: [PATCH] imported upstream version 0.12.0 --- AUTHORS | 2 +- CHANGELOG | 25 +++++++++++++++- CMakeLists.txt | 24 +++++++++++++--- cmake/lxqt-config.cmake.in | 12 ++++++++ configdialog/lxqtconfigdialog.cpp | 1 + lxqtapplication.cpp | 19 ++++++------ lxqtautostartentry.cpp | 9 +++--- lxqtgridlayout.cpp | 3 +- lxqthtmldelegate.cpp | 17 +++++++---- lxqtnotification.cpp | 3 +- lxqtplugininfo.cpp | 15 +++++----- lxqtpower/lxqtpower.cpp | 10 +++++-- lxqtpower/lxqtpower.h | 12 ++++++-- lxqtpower/lxqtpowerproviders.cpp | 48 ++++++++++++++++++++----------- lxqtpowermanager.cpp | 9 ++++-- lxqtprogramfinder.cpp | 6 ++-- lxqtrotatedwidget.cpp | 4 +-- lxqtscreensaver.cpp | 3 +- lxqtsettings.cpp | 3 +- lxqtsingleapplication.h | 4 +-- lxqttranslator.cpp | 8 +++--- 21 files changed, 166 insertions(+), 71 deletions(-) diff --git a/AUTHORS b/AUTHORS index fbb968f..5fec64d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,7 +4,7 @@ Upstream Authors: Copyright: Copyright (c) 2010-2012 Razor team - Copyright (c) 2012-2016 LXQt team + Copyright (c) 2012-2017 LXQt team License: LGPL-2.1+ and BSD-3-clause The full text of the LGPL-2.1+ licenses can be found in the 'COPYING' file. diff --git a/CHANGELOG b/CHANGELOG index c825c8a..a2e87a6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,30 @@ -liblxqt-0.11.1 / 2017-01-01 +liblxqt-0.12.0 / 2017-10-21 =========================== + * Bump minimum qtxdg version to 3.1.0 + * Don't export github templates + * Bump version and needed versions to the final values + * lxqtpower: Allow disabling of lxqt-session provider + * Drops Qt5Core_VERSION_STRING + * HtmlDelegate: Fix sizeHint() computation + * Add some comments about the meaning of versions + * Move LXQt version back to liblxqt + * Fixes (#118) + * lxqtapplication: Avoid wrong signal handling + * Removes unneeded semicolon in namespace definition + * Fix format conversions [-Wformat-pedantic] warnings + * Suppress compiler warnings about unused function parameters + * Removes extra semicolons in Qt's Q macros + * Translator: Prefer XDG_DATA_DIRS over compiled in path + * Help the compiler optimizing loops + * Use const variables where possible + * Update AUTHORS + +0.11.1 / 2017-01-01 +=================== + + * Release 0.11.1: Update changelog * Bump needed build tools version (#113) * build: Enable/disable WITH_XDG_DIRS_FALLBACK based on Qt version (#111) * Updates lxqt-build-tools required version diff --git a/CMakeLists.txt b/CMakeLists.txt index d421319..44eddc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,25 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) project(liblxqt) -set(QT_MINIMUM_VERSION "5.4.2") -set(QTXDG_MINIMUM_VERSION "2.0.0") -set(LXQTBT_MINIMUM_VERSION "0.3.1") +set(QT_MINIMUM_VERSION "5.5.0") +set(QTXDG_MINIMUM_VERSION "3.1.0") +set(LXQTBT_MINIMUM_VERSION "0.4.0") + +# Major LXQt Version, belong to all components +set(LXQT_MAJOR_VERSION 0) +# Minor LXQt Version, belong to all components +set(LXQT_MINOR_VERSION 12) +# +# Patch Version, belong *only* to the component +# LXQt is 0.11 - liblxqt is at patch version 1 +# The official LXQt version will follow liblxqt. +# +# In a perfect world all components would have the same major- and minor- and +# patch-version as liblxqt - in real life it will be fine if every component +# has it's own patch version within a major/minor life cyle. +# +set(LXQT_PATCH_VERSION 0) +set(LXQT_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_PATCH_VERSION}) include(CMakePackageConfigHelpers) include(GNUInstallDirs) # Standard directories for installation @@ -118,7 +134,7 @@ find_package(X11 REQUIRED QUIET) find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Widgets DBus X11Extras LinguistTools) find_package(Qt5Xdg ${QTXDG_MINIMUM_VERSION} REQUIRED) find_package(KF5WindowSystem REQUIRED QUIET) -message(STATUS "Building ${PROJECT_NAME} with Qt ${Qt5Core_VERSION_STRING}") +message(STATUS "Building ${PROJECT_NAME} with Qt ${Qt5Core_VERSION}") QT5_ADD_DBUS_INTERFACE(SRCS dbus/org.freedesktop.Notifications.xml diff --git a/cmake/lxqt-config.cmake.in b/cmake/lxqt-config.cmake.in index 227d789..5cb6dc5 100644 --- a/cmake/lxqt-config.cmake.in +++ b/cmake/lxqt-config.cmake.in @@ -17,6 +17,18 @@ find_dependency(KF5WindowSystem) find_dependency(lxqt-build-tools @LXQTBT_MINIMUM_VERSION@) include(LXQtConfigVars) + +# - Set version informations +set(LXQT_MAJOR_VERSION "@LXQT_MAJOR_VERSION@") +set(LXQT_MINOR_VERSION "@LXQT_MINOR_VERSION@") +set(LXQT_PATCH_VERSION "@LXQT_PATCH_VERSION@") +set(LXQT_VERSION "@LXQT_VERSION@") + +add_definitions("-DLXQT_MAJOR_VERSION=\"${LXQT_MAJOR_VERSION}\"") +add_definitions("-DLXQT_MINOR_VERSION=\"${LXQT_MINOR_VERSION}\"") +add_definitions("-DLXQT_PATCH_VERSION=\"${LXQT_PATCH_VERSION}\"") +add_definitions("-DLXQT_VERSION=\"${LXQT_VERSION}\"") + if (NOT TARGET @LXQT_LIBRARY_NAME@) if (POLICY CMP0024) cmake_policy(SET CMP0024 NEW) diff --git a/configdialog/lxqtconfigdialog.cpp b/configdialog/lxqtconfigdialog.cpp index 8eea57b..947a578 100644 --- a/configdialog/lxqtconfigdialog.cpp +++ b/configdialog/lxqtconfigdialog.cpp @@ -112,6 +112,7 @@ bool ConfigDialog::event(QEvent * event) void ConfigDialog::closeEvent(QCloseEvent* event) { + Q_UNUSED(event) emit save(); mSettings->sync(); } diff --git a/lxqtapplication.cpp b/lxqtapplication.cpp index 2c7c0a3..733db45 100644 --- a/lxqtapplication.cpp +++ b/lxqtapplication.cpp @@ -57,6 +57,7 @@ variable LXQT_DEBUG set */ void dbgMessageOutput(QtMsgType type, const QMessageLogContext &ctx, const QString & msgStr) { + Q_UNUSED(ctx) QByteArray msgBuf = msgStr.toUtf8(); const char* msg = msgBuf.constData(); QDir dir(XdgDirs::configHome().toUtf8() + QLatin1String("/lxqt")); @@ -84,12 +85,12 @@ void dbgMessageOutput(QtMsgType type, const QMessageLogContext &ctx, const QStri QByteArray dt = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz").toUtf8(); if (isatty(STDERR_FILENO)) - fprintf(stderr, "%s %s(%p) %s: %s%s\n", color, QAPP_NAME, qApp, typestr, msg, COLOR_RESET); + fprintf(stderr, "%s %s(%p) %s: %s%s\n", color, QAPP_NAME, static_cast(qApp), typestr, msg, COLOR_RESET); else - fprintf(stderr, "%s(%p) %s: %s\n", QAPP_NAME, qApp, typestr, msg); + fprintf(stderr, "%s(%p) %s: %s\n", QAPP_NAME, static_cast(qApp), typestr, msg); FILE *f = fopen(dir.absoluteFilePath("debug.log").toUtf8().constData(), "a+"); - fprintf(f, "%s %s(%p) %s: %s\n", dt.constData(), QAPP_NAME, qApp, typestr, msg); + fprintf(f, "%s %s(%p) %s: %s\n", dt.constData(), QAPP_NAME, static_cast(qApp), typestr, msg); fclose(f); if (type == QtFatalMsg) @@ -102,7 +103,7 @@ Application::Application(int &argc, char** argv) #ifdef DEBUG qInstallMessageHandler(dbgMessageOutput); #else - if (!qgetenv("LXQT_DEBUG").isNull()) + if (!qEnvironmentVariableIsSet("LXQT_DEBUG")) qInstallMessageHandler(dbgMessageOutput); #endif @@ -128,7 +129,7 @@ Application::Application(int &argc, char** argv, bool handleQuitSignals) void Application::updateTheme() { - QString styleSheetKey = QFileInfo(applicationFilePath()).fileName(); + const QString styleSheetKey = QFileInfo(applicationFilePath()).fileName(); setStyleSheet(lxqtTheme.qss(styleSheetKey)); emit themeChanged(); } @@ -140,14 +141,14 @@ namespace public: static void signalHandler(int signo) { - int ret = write(instance->mSignalSock[0], &signo, sizeof (int)); + const int ret = write(instance->mSignalSock[0], &signo, sizeof (int)); if (sizeof (int) != ret) qCritical() << QStringLiteral("unable to write into socketpair, %1").arg(strerror(errno)); } public: template - SignalHandler(Lambda signalEmitter) + SignalHandler(Application * app, Lambda signalEmitter) : mSignalSock{-1, -1} { if (0 != socketpair(AF_UNIX, SOCK_STREAM, 0, mSignalSock)) @@ -157,7 +158,7 @@ namespace } mNotifier.reset(new QSocketNotifier(mSignalSock[1], QSocketNotifier::Read)); - QObject::connect(mNotifier.data(), &QSocketNotifier::activated, [this, signalEmitter] { + QObject::connect(mNotifier.data(), &QSocketNotifier::activated, app, [this, signalEmitter] { int signo = 0; int ret = read(mSignalSock[1], &signo, sizeof (int)); if (sizeof (int) != ret) @@ -198,6 +199,6 @@ void Application::listenToUnixSignals(QList const & signoList) static QScopedPointer signal_notifier; if (SignalHandler::instance.isNull()) - SignalHandler::instance.reset(new SignalHandler{[this] (int signo) { emit unixSignal(signo); }}); + SignalHandler::instance.reset(new SignalHandler{this, [this] (int signo) { emit unixSignal(signo); }}); SignalHandler::instance->listenToSignals(signoList); } diff --git a/lxqtautostartentry.cpp b/lxqtautostartentry.cpp index f977a75..379f297 100644 --- a/lxqtautostartentry.cpp +++ b/lxqtautostartentry.cpp @@ -38,9 +38,10 @@ AutostartEntry::AutostartEntry() : AutostartEntry::AutostartEntry(const QString& name): mLocalState(StateNone), mSystem(false) { - foreach (const QString& dir, XdgDirs::autostartDirs()) + const QStringList& dirs = XdgDirs::autostartDirs(); + foreach (const QString& dir, dirs) { - QString path = QString("%1/%2").arg(dir, name); + const QString path = QString("%1/%2").arg(dir, name); if (QFile(path).exists()) { mSystemFile.load(path); @@ -49,7 +50,7 @@ AutostartEntry::AutostartEntry(const QString& name): } } - QString path = QString("%1/%2").arg(XdgDirs::autostartHome(), name); + const QString path = QString("%1/%2").arg(XdgDirs::autostartHome(), name); if (QFile(path).exists()) { mLocalFile.load(path); @@ -59,7 +60,7 @@ AutostartEntry::AutostartEntry(const QString& name): void AutostartEntry::setFile(const XdgDesktopFile& file) { - bool local = isLocal(); + const bool local = isLocal(); if (mSystem && local && file == mSystemFile) { removeLocal(); diff --git a/lxqtgridlayout.cpp b/lxqtgridlayout.cpp index 94861fc..739178e 100644 --- a/lxqtgridlayout.cpp +++ b/lxqtgridlayout.cpp @@ -131,7 +131,8 @@ void GridLayoutPrivate::updateCache() mCellMaxSize = QSize(0, 0); mVisibleCount = 0; - for (int i=0; iwidget() || item->widget()->isHidden()) diff --git a/lxqthtmldelegate.cpp b/lxqthtmldelegate.cpp index 5f1c694..9a5e7bf 100644 --- a/lxqthtmldelegate.cpp +++ b/lxqthtmldelegate.cpp @@ -65,7 +65,7 @@ void HtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, options.icon = QIcon(); // icon size - QSize iconSize = icon.actualSize(mIconSize); + const QSize iconSize = icon.actualSize(mIconSize); QRect iconRect = QRect(8, 8, iconSize.width(), iconSize.height()); if (is_right_to_left) { @@ -86,7 +86,7 @@ void HtmlDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, // shift text right to make icon visible painter->translate(iconRect.right() + 8, 0); } - QRect clip(0, 0, options.rect.width() - iconRect.width() - 8, options.rect.height()); + const QRect clip(0, 0, options.rect.width() - iconRect.width() - 8, options.rect.height()); painter->setClipRect(clip); // set text color to red for selected item @@ -112,11 +112,16 @@ QSize HtmlDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelInd QStyleOptionViewItem options = option; initStyleOption(&options, index); - QSize iconSize = options.icon.actualSize(mIconSize); - QRect iconRect = QRect(8, 8, iconSize.width(), iconSize.height()); + const QSize iconSize = options.icon.actualSize(mIconSize); + const QRect iconRect = QRect(8, 8, iconSize.width(), iconSize.height()); + const QSize optSize = options.rect.size(); QTextDocument doc; doc.setHtml(options.text); - doc.setTextWidth(options.rect.width() - iconRect.right() - 8); - return QSize(options.rect.width(), doc.size().height() + 8); + + if (optSize.width() > 0) + doc.setTextWidth(optSize.width() - iconRect.right() - 8); + doc.adjustSize(); + return QSize(0 < optSize.width() ? optSize.width() : iconRect.width() + 8 + qRound(doc.size().width()) + , qMax(qRound(doc.size().height()), iconSize.height()) + 8); } diff --git a/lxqtnotification.cpp b/lxqtnotification.cpp index d26f25f..1dc3935 100644 --- a/lxqtnotification.cpp +++ b/lxqtnotification.cpp @@ -158,7 +158,8 @@ void NotificationPrivate::setActions(QStringList actions, int defaultAction) { mActions.clear(); mDefaultAction = defaultAction; - for (int ix = 0; ix < actions.size(); ix++) + const int N = actions.size(); + for (int ix = 0; ix < N; ix++) { if (ix == defaultAction) mActions.append("default"); diff --git a/lxqtplugininfo.cpp b/lxqtplugininfo.cpp index 1f3ed78..c02888a 100644 --- a/lxqtplugininfo.cpp +++ b/lxqtplugininfo.cpp @@ -72,12 +72,11 @@ bool PluginInfo::isValid() const ************************************************/ QLibrary* PluginInfo::loadLibrary(const QString& libDir) const { - QString baseName, path; - QFileInfo fi = QFileInfo(fileName()); - path = fi.canonicalPath(); - baseName = value("X-LXQt-Library", fi.completeBaseName()).toString(); + const QFileInfo fi = QFileInfo(fileName()); + const QString path = fi.canonicalPath(); + const QString baseName = value("X-LXQt-Library", fi.completeBaseName()).toString(); - QString soPath = QDir(libDir).filePath(QString("lib%2.so").arg(baseName)); + const QString soPath = QDir(libDir).filePath(QString("lib%2.so").arg(baseName)); QLibrary* library = new QLibrary(soPath); if (!library->load()) @@ -87,7 +86,7 @@ QLibrary* PluginInfo::loadLibrary(const QString& libDir) const return 0; } - QString locale = QLocale::system().name(); + const QString locale = QLocale::system().name(); QTranslator* translator = new QTranslator(library); translator->load(QString("%1/%2/%2_%3.qm").arg(path, baseName, locale)); @@ -107,8 +106,8 @@ PluginInfoList PluginInfo::search(const QStringList& desktopFilesDirs, const QSt foreach (const QString &desktopFilesDir, desktopFilesDirs) { - QDir dir(desktopFilesDir); - QFileInfoList files = dir.entryInfoList(QStringList(nameFilter), QDir::Files | QDir::Readable); + const QDir dir(desktopFilesDir); + const QFileInfoList files = dir.entryInfoList(QStringList(nameFilter), QDir::Files | QDir::Readable); foreach (const QFileInfo &file, files) { if (processed.contains(file.fileName())) diff --git a/lxqtpower/lxqtpower.cpp b/lxqtpower/lxqtpower.cpp index 742793b..07cd19e 100644 --- a/lxqtpower/lxqtpower.cpp +++ b/lxqtpower/lxqtpower.cpp @@ -33,15 +33,21 @@ using namespace LXQt; -Power::Power(QObject *parent) : +Power::Power(bool useLxqtSessionProvider, QObject * parent /*= nullptr*/) : QObject(parent) { mProviders.append(new CustomProvider(this)); + if (useLxqtSessionProvider) + mProviders.append(new LXQtProvider(this)); mProviders.append(new SystemdProvider(this)); mProviders.append(new UPowerProvider(this)); mProviders.append(new ConsoleKitProvider(this)); mProviders.append(new LxSessionProvider(this)); - mProviders.append(new LXQtProvider(this)); +} + +Power::Power(QObject * parent /*= nullptr*/) + : Power(true, parent) +{ } diff --git a/lxqtpower/lxqtpower.h b/lxqtpower/lxqtpower.h index f738b46..98b021e 100644 --- a/lxqtpower/lxqtpower.h +++ b/lxqtpower/lxqtpower.h @@ -56,8 +56,16 @@ public: PowerSuspend /// Suspend the computer }; - /// Constructs a Power with parent. - explicit Power(QObject *parent = 0); + /*! + * Constructs the Power object. + * \param useLxqtSessionProvider indicates if the DBus methods + * provided by lxqt-session should be considered. This is useful to + * avoid recursion if the lxqt-session wants to provide some of the + * methods by itself with internal use of this object. + */ + explicit Power(bool useLxqtSessionProvider, QObject *parent = nullptr); + /// Constructs a Power with using the lxqt-session provider. + explicit Power(QObject *parent = nullptr); /// Destroys the object. virtual ~Power(); diff --git a/lxqtpower/lxqtpowerproviders.cpp b/lxqtpower/lxqtpowerproviders.cpp index 5379281..3907cc7 100644 --- a/lxqtpower/lxqtpowerproviders.cpp +++ b/lxqtpower/lxqtpowerproviders.cpp @@ -107,8 +107,8 @@ static bool dbusCall(const QString &service, // If the method no returns value, we believe that it was successful. return msg.arguments().isEmpty() || - msg.arguments().first().isNull() || - msg.arguments().first().toBool(); + msg.arguments().constFirst().isNull() || + msg.arguments().constFirst().toBool(); } /************************************************ @@ -156,10 +156,10 @@ static bool dbusCallSystemd(const QString &service, } // If the method no returns value, we believe that it was successful. - if (msg.arguments().isEmpty() || msg.arguments().first().isNull()) + if (msg.arguments().isEmpty() || msg.arguments().constFirst().isNull()) return true; - QString response = msg.arguments().first().toString(); + QString response = msg.arguments().constFirst().toString(); qDebug() << "systemd:" << method << "=" << response; return response == "yes" || response == "challenge"; } @@ -199,7 +199,7 @@ bool dbusGetProperty(const QString &service, } return !msg.arguments().isEmpty() && - msg.arguments().first().value().variant().toBool(); + msg.arguments().constFirst().value().variant().toBool(); } @@ -500,31 +500,45 @@ LXQtProvider::~LXQtProvider() bool LXQtProvider::canAction(Power::Action action) const { + QString command; switch (action) { case Power::PowerLogout: - // there can be case when razo-session does not run - return dbusCall(LXQT_SERVICE, LXQT_PATH, LXQT_SERVICE, - QDBusConnection::sessionBus(), "canLogout", - PowerProvider::DontCheckDBUS); + command = "canLogout"; + break; + case Power::PowerReboot: + command = "canReboot"; + break; + case Power::PowerShutdown: + command = "canPowerOff"; + break; default: return false; } + + // there can be case when lxqtsession-session does not run + return dbusCall(LXQT_SERVICE, LXQT_PATH, LXQT_SERVICE, + QDBusConnection::sessionBus(), command, + PowerProvider::DontCheckDBUS); } bool LXQtProvider::doAction(Power::Action action) { QString command; - switch (action) { - case Power::PowerLogout: - command = "logout"; - break; - - default: - return false; + case Power::PowerLogout: + command = "logout"; + break; + case Power::PowerReboot: + command = "reboot"; + break; + case Power::PowerShutdown: + command = "powerOff"; + break; + default: + return false; } return dbusCall(LXQT_SERVICE, @@ -594,12 +608,14 @@ HalProvider::~HalProvider() bool HalProvider::canAction(Power::Action action) const { + Q_UNUSED(action) return false; } bool HalProvider::doAction(Power::Action action) { + Q_UNUSED(action) return false; } diff --git a/lxqtpowermanager.cpp b/lxqtpowermanager.cpp index 4f14ff7..0258c64 100644 --- a/lxqtpowermanager.cpp +++ b/lxqtpowermanager.cpp @@ -41,14 +41,14 @@ namespace LXQt { class LXQT_API MessageBox: public QMessageBox { - Q_DECLARE_TR_FUNCTIONS(LXQt::MessageBox); + Q_DECLARE_TR_FUNCTIONS(LXQt::MessageBox) public: explicit MessageBox(QWidget *parent = 0): QMessageBox(parent) {} static QWidget *parentWidget() { - QWidgetList widgets = QApplication::topLevelWidgets(); + const QWidgetList widgets = QApplication::topLevelWidgets(); if (widgets.count()) return widgets.at(0); @@ -69,6 +69,8 @@ public: static void warning(const QString& title, const QString& text) { + Q_UNUSED(title) + Q_UNUSED(text) QMessageBox::warning(parentWidget(), tr("LXQt Power Manager Error"), tr("Hibernate failed.")); } @@ -76,7 +78,8 @@ public: protected: virtual void resizeEvent(QResizeEvent* event) { - QRect screen = QApplication::desktop()->screenGeometry(); + Q_UNUSED(event) + const QRect screen = QApplication::desktop()->screenGeometry(); move((screen.width() - this->width()) / 2, (screen.height() - this->height()) / 2); diff --git a/lxqtprogramfinder.cpp b/lxqtprogramfinder.cpp index 2d8f53c..0465aa3 100644 --- a/lxqtprogramfinder.cpp +++ b/lxqtprogramfinder.cpp @@ -31,17 +31,17 @@ using namespace LXQt; LXQT_API bool ProgramFinder::programExists(const QString& command) { - QString program = programName(command); + const QString program = programName(command); if (program[0] == QChar('/')) { QFileInfo fi(program); return fi.isExecutable() && fi.isFile(); } - QString path = qgetenv("PATH"); + const QString path = qgetenv("PATH"); foreach (const QString& dirName, path.split(":", QString::SkipEmptyParts)) { - QFileInfo fi(QDir(dirName), program); + const QFileInfo fi(QDir(dirName), program); if (fi.isExecutable() && fi.isFile()) return true; } diff --git a/lxqtrotatedwidget.cpp b/lxqtrotatedwidget.cpp index ec6f284..384eb84 100644 --- a/lxqtrotatedwidget.cpp +++ b/lxqtrotatedwidget.cpp @@ -90,7 +90,7 @@ void RotatedWidget::adjustContentSize() { mContent->adjustSize(); - QSize before = size(); + const QSize before = size(); adjustSize(); @@ -147,7 +147,7 @@ void RotatedWidget::paintEvent(QPaintEvent */*event*/) if (mOrigin == Qt::TopLeftCorner) return; - QSize sz = mContent->size(); + const QSize sz = mContent->size(); QPainter painter(this); diff --git a/lxqtscreensaver.cpp b/lxqtscreensaver.cpp index c38e46b..3907578 100644 --- a/lxqtscreensaver.cpp +++ b/lxqtscreensaver.cpp @@ -124,7 +124,7 @@ static bool GetIntArrayProperty(XID window, class ScreenSaverPrivate { - Q_DECLARE_TR_FUNCTIONS(LXQt::ScreenSaver); + Q_DECLARE_TR_FUNCTIONS(LXQt::ScreenSaver) Q_DECLARE_PUBLIC(ScreenSaver) ScreenSaver* const q_ptr; @@ -141,6 +141,7 @@ void ScreenSaverPrivate::_l_xdgProcess_finished(int err, QProcess::ExitStatus st { // http://portland.freedesktop.org/xdg-utils-1.1.0-rc1/scripts/xdg-screensaver + Q_UNUSED(status) Q_Q(ScreenSaver); if (err == 0) emit q->activated(); diff --git a/lxqtsettings.cpp b/lxqtsettings.cpp index b3d6989..7ef3506 100644 --- a/lxqtsettings.cpp +++ b/lxqtsettings.cpp @@ -80,7 +80,8 @@ public: if (dir.cd(mParent->organizationName()) && dir.exists(file_name)) { QSettings system_settings{dir.absoluteFilePath(file_name), QSettings::IniFormat}; - for (const QString & key : system_settings.allKeys()) + const QStringList keys = system_settings.allKeys(); + for (const QString & key : keys) { mParent->setValue(key, system_settings.value(key)); } diff --git a/lxqtsingleapplication.h b/lxqtsingleapplication.h index cc37a50..7ae80ee 100644 --- a/lxqtsingleapplication.h +++ b/lxqtsingleapplication.h @@ -77,7 +77,6 @@ namespace LXQt { class LXQT_API SingleApplication : public Application { Q_OBJECT - Q_ENUMS(StartOptions) public: /*! @@ -101,6 +100,7 @@ public: /** Don't exit if the connection to the D-Bus session bus fails.*/ NoExitOnDBusFailure }; + Q_ENUM(StartOptions) /*! * \brief Construct a LXQt SingleApplication object. @@ -153,6 +153,6 @@ private: #endif #define lxqtSingleApp (static_cast(qApp)) -}; // namespace LXQt +} // namespace LXQt #endif // LXQTSINGLEAPPLICATION_H diff --git a/lxqttranslator.cpp b/lxqttranslator.cpp index 4fc67c0..d022874 100644 --- a/lxqttranslator.cpp +++ b/lxqttranslator.cpp @@ -51,8 +51,8 @@ QStringList *getSearchPaths() if (searchPath == 0) { searchPath = new QStringList(); - *searchPath << QString(LXQT_SHARE_TRANSLATIONS_DIR); *searchPath << XdgDirs::dataDirs(QLatin1Char('/') % LXQT_RELATIVE_SHARE_TRANSLATIONS_DIR); + *searchPath << QString(LXQT_SHARE_TRANSLATIONS_DIR); searchPath->removeDuplicates(); } @@ -85,7 +85,7 @@ void Translator::setTranslationSearchPaths(const QStringList &paths) ************************************************/ bool translate(const QString &name, const QString &owner) { - QString locale = QLocale::system().name(); + const QString locale = QLocale::system().name(); QTranslator *appTranslator = new QTranslator(qApp); QStringList *paths = getSearchPaths(); @@ -132,7 +132,7 @@ bool translate(const QString &name, const QString &owner) ************************************************/ bool Translator::translateApplication(const QString &applicationName) { - QString locale = QLocale::system().name(); + const QString locale = QLocale::system().name(); QTranslator *qtTranslator = new QTranslator(qApp); if (qtTranslator->load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) @@ -170,7 +170,7 @@ bool Translator::translatePlugin(const QString &pluginName, const QString& type) { static QSet loadedPlugins; - QString fullName = type % QChar('/') % pluginName; + const QString fullName = type % QChar('/') % pluginName; if (loadedPlugins.contains(fullName)) return true;