do not use nodiscard for slots (#147)

This commit is contained in:
Evgenii Alekseev 2021-01-08 10:43:37 +03:00
parent 6ec30b71d1
commit 0c443e9278
7 changed files with 15 additions and 197 deletions

View File

@ -1,12 +1,14 @@
FROM ubuntu:bionic
FROM ubuntu:focal
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
# toolchain
RUN apt-get install -y cmake extra-cmake-modules g++ git gettext
RUN apt-get install -yq cmake extra-cmake-modules g++ git gettext
# kf5 and qt5 libraries
RUN apt-get install -y libkf5i18n-dev libkf5notifications-dev libkf5service-dev \
libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev \
RUN apt-get install -yq libkf5i18n-dev libkf5notifications-dev libkf5service-dev \
libkf5windowsystem-dev libkf5plasma-dev qtbase5-dev qtdeclarative5-dev \
plasma-framework
# required by tests
RUN apt-get install -y xvfb
RUN apt-get install -yq xvfb

View File

@ -1,12 +0,0 @@
FROM multiarch/ubuntu-core:i386-bionic
RUN apt-get update
# toolchain
RUN apt-get install -y cmake extra-cmake-modules g++ git gettext
# kf5 and qt5 libraries
RUN apt-get install -y libkf5i18n-dev libkf5notifications-dev libkf5service-dev \
libkf5windowsystem-dev plasma-framework-dev qtbase5-dev qtdeclarative5-dev \
plasma-framework
# required by tests
RUN apt-get install -y xvfb

View File

@ -6,8 +6,8 @@ rm -rf build-ubuntu
mkdir build-ubuntu
# patches
git apply patches/qt5.6-qversionnumber.patch
git apply patches/qt5.5-qstringlist-and-qinfo.patch
#git apply patches/qt5.6-qversionnumber.patch
#git apply patches/qt5.5-qstringlist-and-qinfo.patch
# build
cd build-ubuntu

View File

@ -1,33 +0,0 @@
diff --git a/sources/awdebug.h b/sources/awdebug.h
index 8447c65..4eef49a 100644
--- a/sources/awdebug.h
+++ b/sources/awdebug.h
@@ -23,10 +23,15 @@
#include "version.h"
+#ifndef qCInfo
+#define qCInfo qCDebug
+#endif
+
+
namespace AWDebug
{
const char LOG_FORMAT[] = "[%{time "
- "process}][%{if-debug}DD%{endif}%{if-info}II%{endif}%"
+ "process}][%{if-debug}DD%{endif}%"
"{if-warning}WW%{endif}%{if-critical}CC%{endif}%{if-"
"fatal}FF%{endif}][%{category}][%{function}] "
"%{message}";
diff --git a/sources/awesome-widget/plugin/awkeysaggregator.h b/sources/awesome-widget/plugin/awkeysaggregator.h
index d6d5d1a..ee301df 100644
--- a/sources/awesome-widget/plugin/awkeysaggregator.h
+++ b/sources/awesome-widget/plugin/awkeysaggregator.h
@@ -21,6 +21,7 @@
#include <QHash>
#include <QObject>
+#include <QStringList>
class AWFormatterHelper;

View File

@ -1,139 +0,0 @@
diff --git a/sources/awesome-widget/plugin/awupdatehelper.cpp b/sources/awesome-widget/plugin/awupdatehelper.cpp
index f6b5338..b5a3163 100644
--- a/sources/awesome-widget/plugin/awupdatehelper.cpp
+++ b/sources/awesome-widget/plugin/awupdatehelper.cpp
@@ -35,7 +35,7 @@ AWUpdateHelper::AWUpdateHelper(QObject *_parent)
{
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
- m_foundVersion = QVersionNumber::fromString(VERSION);
+ m_foundVersion = VERSION;
m_genericConfig = QString("%1/awesomewidgets/general.ini")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation));
@@ -67,8 +67,7 @@ void AWUpdateHelper::checkUpdates(const bool _showAnyway)
bool AWUpdateHelper::checkVersion()
{
QSettings settings(m_genericConfig, QSettings::IniFormat);
- QVersionNumber version = QVersionNumber::fromString(
- settings.value("Version", QString(VERSION)).toString());
+ QString version = settings.value("Version", VERSION).toString();
// update version
settings.setValue("Version", QString(VERSION));
settings.sync();
@@ -91,12 +90,11 @@ bool AWUpdateHelper::checkVersion()
}
-void AWUpdateHelper::showInfo(const QVersionNumber &_version)
+void AWUpdateHelper::showInfo(const QString &_version)
{
qCDebug(LOG_AW) << "Version" << _version;
- QString text
- = i18n("You are using the actual version %1", _version.toString());
+ QString text = i18n("You are using the actual version %1", _version);
if (!QString(COMMIT_SHA).isEmpty())
text += QString(" (%1)").arg(QString(COMMIT_SHA));
return genMessageBox(i18n("No new version found"), text, QMessageBox::Ok)
@@ -104,7 +102,7 @@ void AWUpdateHelper::showInfo(const QVersionNumber &_version)
}
-void AWUpdateHelper::showUpdates(const QVersionNumber &_version)
+void AWUpdateHelper::showUpdates(const QString &_version)
{
qCDebug(LOG_AW) << "Version" << _version;
@@ -113,7 +111,7 @@ void AWUpdateHelper::showUpdates(const QVersionNumber &_version)
text += QString(COMMIT_SHA).isEmpty()
? "\n"
: QString(" (%1)\n").arg(QString(COMMIT_SHA));
- text += i18n("New version : %1", _version.toString()) + "\n\n";
+ text += i18n("New version : %1", _version) + "\n\n";
text += i18n("Click \"Ok\" to download");
genMessageBox(i18n("There are updates"), text,
@@ -130,8 +128,7 @@ void AWUpdateHelper::userReplyOnUpdates(QAbstractButton *_button)
switch (ret) {
case QMessageBox::AcceptRole:
- QDesktopServices::openUrl(QString(RELEASES)
- + m_foundVersion.toString());
+ QDesktopServices::openUrl(QString(RELEASES) + m_foundVersion);
break;
case QMessageBox::RejectRole:
default:
@@ -162,14 +159,23 @@ void AWUpdateHelper::versionReplyRecieved(QNetworkReply *_reply,
QVariantMap firstRelease = jsonDoc.toVariant().toList().first().toMap();
QString version = firstRelease["tag_name"].toString();
version.remove("V.");
- m_foundVersion = QVersionNumber::fromString(version);
+ m_foundVersion = version;
qCInfo(LOG_AW) << "Update found version to" << m_foundVersion;
- QVersionNumber oldVersion = QVersionNumber::fromString(VERSION);
- if (oldVersion < m_foundVersion)
- return showUpdates(m_foundVersion);
+ // FIXME: possible there is a better way to check versions
+ int old_major = QString(VERSION).split(QChar('.')).at(0).toInt();
+ int old_minor = QString(VERSION).split(QChar('.')).at(1).toInt();
+ int old_patch = QString(VERSION).split(QChar('.')).at(2).toInt();
+ int new_major = version.split(QChar('.')).at(0).toInt();
+ int new_minor = version.split(QChar('.')).at(1).toInt();
+ int new_patch = version.split(QChar('.')).at(2).toInt();
+ if ((old_major < new_major)
+ || ((old_major == new_major) && (old_minor < new_minor))
+ || ((old_major == new_major) && (old_minor == new_minor)
+ && (old_patch < new_patch)))
+ return showUpdates(version);
else if (_showAnyway)
- return showInfo(m_foundVersion);
+ return showInfo(version);
}
diff --git a/sources/awesome-widget/plugin/awupdatehelper.h b/sources/awesome-widget/plugin/awupdatehelper.h
index cfd26e7..b311be2 100644
--- a/sources/awesome-widget/plugin/awupdatehelper.h
+++ b/sources/awesome-widget/plugin/awupdatehelper.h
@@ -21,7 +21,6 @@
#include <QMessageBox>
#include <QObject>
-#include <QVersionNumber>
class QNetworkReply;
@@ -37,15 +36,15 @@ public:
bool checkVersion();
private slots:
- void showInfo(const QVersionNumber &_version);
- void showUpdates(const QVersionNumber &_version);
+ void showInfo(const QString &_version);
+ void showUpdates(const QString &_version);
void userReplyOnUpdates(QAbstractButton *_button);
void versionReplyRecieved(QNetworkReply *_reply, const bool _showAnyway);
private:
QMessageBox *genMessageBox(const QString &_title, const QString &_body,
const QMessageBox::StandardButtons _buttons);
- QVersionNumber m_foundVersion;
+ QString m_foundVersion;
QString m_genericConfig;
};
diff --git a/sources/libraries.cmake b/sources/libraries.cmake
index 6f171a6..004b39f 100644
--- a/sources/libraries.cmake
+++ b/sources/libraries.cmake
@@ -2,7 +2,7 @@
find_package(Gettext REQUIRED)
# main qt libraries
-find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core DBus Network Qml Test Widgets)
+find_package(Qt5 5.5.0 REQUIRED COMPONENTS Core DBus Network Qml Test Widgets)
add_definitions(
${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Network_DEFINITIONS}
${Qt5Qml_DEFINITIONS} ${Qt5Widgets_DEFINITIONS}

View File

@ -37,11 +37,11 @@ public:
public slots:
// get methods
[[nodiscard]] QStringList ActiveServices() const;
[[nodiscard]] QString Info(const QString &key) const;
[[nodiscard]] QStringList Keys(const QString &regexp) const;
[[nodiscard]] QString Value(const QString &key) const;
[[nodiscard]] qlonglong WhoAmI() const;
QStringList ActiveServices() const;
QString Info(const QString &key) const;
QStringList Keys(const QString &regexp) const;
QString Value(const QString &key) const;
qlonglong WhoAmI() const;
// set methods
void SetLogLevel(const QString &what, int level);
void SetLogLevel(const QString &what, const QString &level, bool enabled);

View File

@ -79,7 +79,7 @@ public slots:
virtual void readConfiguration();
virtual QVariantHash run() = 0;
virtual int showConfiguration(const QVariant &_args) = 0;
[[nodiscard]] virtual bool tryDelete() const;
virtual bool tryDelete() const;
virtual void writeConfiguration() const;
private slots: