Compare commits

...

6 commits

Author SHA1 Message Date
Roman Telezhynskyi 6d04cd32a7 Sonar warnings. 2024-02-17 16:46:59 +02:00
Roman Telezhynskyi 3192b0cafa Appveyor updated list of pre-installed software. 2024-02-17 16:08:33 +02:00
Roman Telezhynskyi 6c0a8f0b64 Sonar warnings. 2024-02-17 11:49:41 +02:00
Roman Telezhynskyi f353b02530 Since C++20 we no longer need operator!=. 2024-02-17 11:41:47 +02:00
Roman Telezhynskyi be5b6d5b1f Refactoring. 2024-02-17 11:24:26 +02:00
Roman Telezhynskyi bd89d3509b Change cache path. 2024-02-17 09:12:15 +02:00
13 changed files with 96 additions and 84 deletions

View file

@ -107,53 +107,53 @@ environment:
# DEPLOY: true
# RUN_TESTS: true
- job_name: MacOS_10_15_Qt_5_15 (qbs, multibundle)
- job_name: MacOS_12_Qt_5_15 (qbs, multibundle)
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
COMPILER: clang
QT: Qt/5.15/clang_64
QT_VERSION: Qt5_15
BUILD_SYSTEM: "qbs"
ARCH: x64
XCODE_VERSION: 14.1
XCODE_VERSION: 14.2
TARGET_PLATFORM: "macOS_10.13+"
MACOS_DEPLOYMENT_TARGET: 10.13
MULTI_BUNDLE: true
DEPLOY: true
- job_name: MacOS_10_15_Qt_5_15 (qbs, singlebundle)
- job_name: MacOS_12_Qt_5_15 (qbs, singlebundle)
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
COMPILER: clang
QT: Qt/5.15/clang_64
QT_VERSION: Qt5_15
BUILD_SYSTEM: "qbs"
ARCH: x64
XCODE_VERSION: 14.1
XCODE_VERSION: 14.2
TARGET_PLATFORM: "macOS_10.13+"
MACOS_DEPLOYMENT_TARGET: 10.13
MULTI_BUNDLE: false
DEPLOY: true
- job_name: MacOS_12_Qt_6_4 (multibundle)
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
- job_name: MacOS_14_Qt_6_6 (multibundle)
APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma
COMPILER: clang
QT: Qt/6.4/macos
QT: Qt/6.6/macos
QT_VERSION: Qt6
BUILD_SYSTEM: "qbs"
ARCH: x64
XCODE_VERSION: 14.1
XCODE_VERSION: 15.2
TARGET_PLATFORM: "macOS_11+"
MACOS_DEPLOYMENT_TARGET: 11.0
MULTI_BUNDLE: true
DEPLOY: true
- job_name: MacOS_12_Qt_6_4 (singlebundle)
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
- job_name: MacOS_14_Qt_6_6 (singlebundle)
APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma
COMPILER: clang
QT: Qt/6.4/macos
QT: Qt/6.6/macos
QT_VERSION: Qt6
BUILD_SYSTEM: "qbs"
ARCH: x64
XCODE_VERSION: 14.1
XCODE_VERSION: 15.2
TARGET_PLATFORM: "macOS_11+"
MACOS_DEPLOYMENT_TARGET: 11.0
MULTI_BUNDLE: false
@ -538,7 +538,7 @@ for:
cache:
#- /Users/appveyor/.conan/data -> conanfile.py
- /Users/appveyor/brew_cache_dir
- $HOME/brew_cache_dir
init:
- find /Applications -maxdepth 1 -type d -name 'Xcode*.app'
@ -598,7 +598,7 @@ for:
cache_tag=usr_local # this can be modified to rebuild deps
cdir=$HOME/cache_dir
cdir=$HOME/brew_cache_dir
cache_tar=$cdir/$cache_tag.tar
cache=$cache_tar.xz
@ -721,7 +721,7 @@ for:
cache:
#- /Users/appveyor/.conan/data -> conanfile.py
- /Users/appveyor/brew_cache_dir
- $HOME/brew_cache_dir
init:
- find /Applications -maxdepth 1 -type d -name 'Xcode*.app'
@ -782,7 +782,7 @@ for:
cache_tag=usr_local # this can be modified to rebuild deps
cdir=$HOME/cache_dir
cdir=$HOME/brew_cache_dir
cache_tar=$cdir/$cache_tag.tar
cache=$cache_tar.xz

View file

@ -83,10 +83,11 @@ auto StrToGrainlineType(const QString &string) -> GrainlineType
return type;
}
#if __cplusplus < 202002L
//---------------------------------------------------------------------------------------------------------------------
auto VPTransformationOrigon::operator==(const VPTransformationOrigon &origin) const -> bool
{
return this->origin == origin.origin && custom == origin.custom;
return origin == origin.origin && custom == origin.custom;
}
//---------------------------------------------------------------------------------------------------------------------
@ -94,3 +95,4 @@ auto VPTransformationOrigon::operator!=(const VPTransformationOrigon &origin) co
{
return !VPTransformationOrigon::operator==(origin);
}
#endif

View file

@ -55,11 +55,15 @@ auto StrToGrainlineType(const QString &string) -> GrainlineType;
struct VPTransformationOrigon
{
QPointF origin{}; // NOLINT(misc-non-private-member-variables-in-classes)
bool custom{false}; // NOLINT(misc-non-private-member-variables-in-classes)
QPointF origin{}; // NOLINT(misc-non-private-member-variables-in-classes)
bool custom{false}; // NOLINT(misc-non-private-member-variables-in-classes)
#if __cplusplus >= 202002L
auto operator==(const VPTransformationOrigon &origin) const -> bool = default;
#else
auto operator==(const VPTransformationOrigon &origin) const -> bool;
auto operator!=(const VPTransformationOrigon &origin) const -> bool;
#endif
};
#endif // LAYOUTDEF_H

View file

@ -56,6 +56,11 @@
#include "../vmisc/compatibility.h"
#endif
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
#include <vcsRepoState.h>
#define BUILD_REVISION VCS_REPO_STATE_REVISION
#endif
using namespace Qt::Literals::StringLiterals;
QT_WARNING_PUSH
@ -66,11 +71,6 @@ Q_LOGGING_CATEGORY(pApp, "p.application") // NOLINT
QT_WARNING_POP
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
#include <vcsRepoState.h>
#define BUILD_REVISION VCS_REPO_STATE_REVISION
#endif
//---------------------------------------------------------------------------------------------------------------------
inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context,
const QString &msg) // NOLINT(readability-function-cognitive-complexity)

View file

@ -39,7 +39,7 @@ class QGraphicsScene;
class VCommonSettings;
class QPainter;
class VPTileFactory : QObject
class VPTileFactory : public QObject
{
Q_OBJECT // NOLINT

View file

@ -28,12 +28,11 @@
#ifndef UTILS_H
#define UTILS_H
#include <QtGlobal>
#include <QtCore/qcontainerfwd.h>
#include <QtGlobal>
class QMimeType;
class QString;
class QMimeType;
class QByteArray;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

View file

@ -340,11 +340,11 @@ void VLayoutConverter::ConvertPiecesToV0_1_5()
}
}
auto StringToPath = [](const QString &path) -> QVector<QPointF>
auto StringToPath = [](const QString &path)
{
auto StringToPoint = [](const QString &point) -> QPointF
{
QStringList coordinates = point.split(coordintatesSep);
QStringList const coordinates = point.split(coordintatesSep);
if (coordinates.count() == 2)
{
return {coordinates.at(0).toDouble(), coordinates.at(1).toDouble()};
@ -359,7 +359,7 @@ void VLayoutConverter::ConvertPiecesToV0_1_5()
return p;
}
QStringList points = path.split(pointsSep);
QStringList const points = path.split(pointsSep);
p.reserve(points.size());
for (const auto &point : points)
{
@ -372,9 +372,9 @@ void VLayoutConverter::ConvertPiecesToV0_1_5()
const QVector<QPointF> path = StringToPath(node.text());
if (not path.isEmpty())
{
auto LineToString = [](const QLineF &line) -> QString
auto LineToString = [](const QLineF &line)
{
auto PointToString = [](const QPointF &p) -> QString
auto PointToString = [](const QPointF &p)
{ return NumberToString(p.x()) + coordintatesSep + NumberToString(p.y()); };
return PointToString(line.p1()) + groupSep + PointToString(line.p2());

View file

@ -101,7 +101,7 @@ inline auto operator""_s(const char16_t *str, size_t size)Q_DECL_NOEXCEPT->QStri
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class C> inline auto ConvertToList(const C<T> &container) -> QList<T>
{
return QList<T>(container.begin(), container.end());
return QList<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
@ -113,25 +113,25 @@ template <typename T, template <typename> class C> inline auto ConvertToStringLi
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class C> inline auto ConvertToSet(const C<T> &container) -> QSet<T>
{
return QSet<T>(container.begin(), container.end());
return QSet<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, typename C> inline auto ConvertToSet(const C &container) -> QSet<T>
{
return QSet<T>(container.begin(), container.end());
return QSet<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, template <typename> class C> inline auto ConvertToVector(const C<T> &container) -> QVector<T>
{
return QVector<T>(container.begin(), container.end());
return QVector<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> inline auto ConvertToVector(const QSet<T> &container) -> QVector<T>
{
return QVector<T>(container.begin(), container.end());
return QVector<T>(std::begin(container), std::end(container));
}
//---------------------------------------------------------------------------------------------------------------------
@ -159,7 +159,7 @@ inline auto Reverse(const C<T> &container) -> C<T>
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T, typename std::enable_if<std::is_same<T, QStringList>::value, T>::type * = nullptr>
template <typename T, std::enable_if_t<std::is_same_v<T, QStringList>, T> * = nullptr>
inline auto Reverse(const T &container) -> T
{
return Reverse<QString, QList>(container);

View file

@ -6,20 +6,19 @@
#ifndef THREAD_DISPATCHER_H
#define THREAD_DISPATCHER_H
#include <QThread>
#include <QMetaObject>
#include <QThread>
#include <QCoreApplication>
#include <QMetaObject>
#include <QObject>
#include <functional>
#include <QThread>
#include <cassert>
#include <functional>
#include <utility>
typedef std::function<void()> voidBlock;
using voidBlock = std::function<void()>;
class WorkerClass : public QObject
{
Q_OBJECT // NOLINT
Q_OBJECT // NOLINT
public:
explicit WorkerClass(QThread *thread)
@ -28,43 +27,43 @@ public:
connect(QThread::currentThread(), &QThread::finished, this, &WorkerClass::deleteLater);
}
public slots:
void DoWork(voidBlock block)
void DoWork(const voidBlock &block)
{
block();
deleteLater();
}
};
Q_DECL_UNUSED static inline void q_dispatch_async(QThread* thread, voidBlock block);
static inline void q_dispatch_async(QThread* thread, voidBlock block)
Q_DECL_UNUSED static inline void q_dispatch_async(QThread *thread, const voidBlock &block);
static inline void q_dispatch_async(QThread *thread, const voidBlock &block)
{
qRegisterMetaType<voidBlock>("voidBlock");
qRegisterMetaType<voidBlock>("voidBlock");
WorkerClass *worker = new WorkerClass(thread);
QMetaObject::invokeMethod(worker, "DoWork", Qt::QueuedConnection, Q_ARG(voidBlock, block));
auto *worker = new WorkerClass(thread);
QMetaObject::invokeMethod(worker, "DoWork", Qt::QueuedConnection, Q_ARG(voidBlock, block));
}
Q_DECL_UNUSED static inline void q_dispatch_async_main(voidBlock block);
static inline void q_dispatch_async_main(voidBlock block)
Q_DECL_UNUSED static inline void q_dispatch_async_main(const voidBlock &block);
static inline void q_dispatch_async_main(const voidBlock &block)
{
QThread *mainThread = QCoreApplication::instance()->thread();
q_dispatch_async(mainThread, block);
QThread *mainThread = QCoreApplication::instance()->thread();
q_dispatch_async(mainThread, block);
}
typedef std::function<void(QtMsgType, const QMessageLogContext &, const QString &)> msgHandlerBlock;
using msgHandlerBlock = std::function<void(QtMsgType, const QMessageLogContext &, const QString &)>;
class MsgHandlerWorkerClass : public QObject
{
Q_OBJECT // NOLINT
Q_OBJECT // NOLINT
public:
MsgHandlerWorkerClass(QThread *thread, QtMsgType type, const QMessageLogContext &context, const QString &msg)
: m_type(type),
m_msg(msg),
m_line(context.line),
m_file(context.file),
m_function(context.function),
m_category(context.category)
MsgHandlerWorkerClass(QThread *thread, QtMsgType type, const QMessageLogContext &context, QString msg)
: m_type(type),
m_msg(std::move(msg)),
m_line(context.line),
m_file(context.file),
m_function(context.function),
m_category(context.category)
{
#ifndef V_NO_ASSERT
assert(context.version == 2);
@ -73,12 +72,15 @@ public:
connect(QThread::currentThread(), &QThread::finished, this, &WorkerClass::deleteLater);
}
public slots:
void DoWork(msgHandlerBlock block)
void DoWork(const msgHandlerBlock &block)
{
block(m_type, QMessageLogContext(qUtf8Printable(m_file), m_line, qUtf8Printable(m_function),
qUtf8Printable(m_category)), m_msg);
block(
m_type,
QMessageLogContext(qUtf8Printable(m_file), m_line, qUtf8Printable(m_function), qUtf8Printable(m_category)),
m_msg);
deleteLater();
}
private:
QtMsgType m_type;
QString m_msg;
@ -90,21 +92,21 @@ private:
QString m_category;
};
Q_DECL_UNUSED static inline void q_dispatch_async(QThread* thread, msgHandlerBlock block, QtMsgType type,
Q_DECL_UNUSED static inline void q_dispatch_async(QThread *thread, const msgHandlerBlock &block, QtMsgType type,
const QMessageLogContext &context, const QString &msg);
static inline void q_dispatch_async(QThread* thread, msgHandlerBlock block, QtMsgType type,
static inline void q_dispatch_async(QThread *thread, const msgHandlerBlock &block, QtMsgType type,
const QMessageLogContext &context, const QString &msg)
{
qRegisterMetaType<msgHandlerBlock>("msgHandlerBlock");
qRegisterMetaType<msgHandlerBlock>("msgHandlerBlock");
MsgHandlerWorkerClass *worker = new MsgHandlerWorkerClass(thread, type, context, msg);
QMetaObject::invokeMethod(worker, "DoWork", Qt::QueuedConnection, Q_ARG(msgHandlerBlock, block));
auto *worker = new MsgHandlerWorkerClass(thread, type, context, msg);
QMetaObject::invokeMethod(worker, "DoWork", Qt::QueuedConnection, Q_ARG(msgHandlerBlock, block));
}
Q_DECL_UNUSED static inline void q_dispatch_async_main(msgHandlerBlock block, QtMsgType type,
Q_DECL_UNUSED static inline void q_dispatch_async_main(const msgHandlerBlock &block, QtMsgType type,
const QMessageLogContext &context, const QString &msg);
static inline void q_dispatch_async_main(msgHandlerBlock block, QtMsgType type, const QMessageLogContext &context,
const QString &msg)
static inline void q_dispatch_async_main(const msgHandlerBlock &block, QtMsgType type,
const QMessageLogContext &context, const QString &msg)
{
QThread *mainThread = QCoreApplication::instance()->thread();
q_dispatch_async(mainThread, block, type, context, msg);

View file

@ -35,7 +35,7 @@ class VTranslator : public QTranslator
Q_OBJECT // NOLINT
public:
VTranslator(QObject *parent = nullptr);
explicit VTranslator(QObject *parent = nullptr);
auto translate(const char *context, const char *sourceText, const char *disambiguation = nullptr, int n = -1) const
-> QString override;

View file

@ -87,11 +87,13 @@ auto VFormula::operator==(const VFormula &formula) const -> bool
d->error == formula.error() && VFuzzyComparePossibleNulls(d->dValue, formula.getDoubleValue());
}
#if __cplusplus < 202002L
//---------------------------------------------------------------------------------------------------------------------
auto VFormula::operator!=(const VFormula &formula) const -> bool
{
return !VFormula::operator==(formula);
}
#endif
//---------------------------------------------------------------------------------------------------------------------
auto VFormula::GetFormula(FormulaType type) const -> QString

View file

@ -59,7 +59,10 @@ public:
~VFormula();
auto operator==(const VFormula &formula) const -> bool;
#if __cplusplus < 202002L
auto operator!=(const VFormula &formula) const -> bool;
#endif
auto GetFormula(FormulaType type = FormulaType::ToUser) const -> QString;
void SetFormula(const QString &value, FormulaType type = FormulaType::FromSystem);

View file

@ -78,16 +78,16 @@ void VPE::VPropertyFormWidget::build()
{
// Clear the old content, delete old widgets
d_ptr->EditorWidgets.clear();
if (layout())
if (layout() != nullptr)
{
QLayoutItem *child;
while (layout()->count() > 0 && (child = layout()->takeAt(0)) != nullptr)
while (layout()->count() > 0)
{
if (child->widget())
QLayoutItem *child = layout()->takeAt(0);
if (child != nullptr)
{
delete child->widget();
delete child;
}
delete child;
}
delete layout();
}
@ -98,7 +98,7 @@ void VPE::VPropertyFormWidget::build()
return; //... only if there are properties
}
QFormLayout *tmpFormLayout = new QFormLayout(this);
auto *tmpFormLayout = new QFormLayout(this);
tmpFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
setLayout(tmpFormLayout);
@ -116,10 +116,10 @@ void VPE::VPropertyFormWidget::build()
if (tmpProperty->propertyType() == Property::Complex)
{
buildEditor(tmpProperty, tmpFormLayout, Property::Complex);
QWidget *group = new QWidget(this);
auto *group = new QWidget(this);
tmpFormLayout->addRow(group);
QFormLayout *subFormLayout = new QFormLayout(group);
auto *subFormLayout = new QFormLayout(group);
subFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
QMargins margins = subFormLayout->contentsMargins();
margins.setTop(0);