Skip to content
Draft

Qxevent #1069

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Checks:
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-use-enum-class,
-hicpp-avoid-c-arrays,
-hicpp-avoid-goto,
-hicpp-braces-around-statements,
Expand Down
1 change: 1 addition & 0 deletions .github/actions/cmake/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ runs:
-B '${{github.workspace}}/build' \
-DCMAKE_BUILD_TYPE=Release \
-DQF_BUILD_QML_PLUGINS=ON \
-DQF_WITH_LIBSHV=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DUSE_QT6=${{ inputs.use_qt6 }} \
Expand Down
9 changes: 8 additions & 1 deletion .github/actions/run-linter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ runs:
modules: qtserialport qtmultimedia
additional_cmake_args: -DCMAKE_GLOBAL_AUTOGEN_TARGET=ON -DCMAKE_AUTOGEN_ORIGIN_DEPENDS=OFF

# https://bugs.launchpad.net/ubuntu/+source/clazy/+bug/2086665/comments/4
- name: Workaround for clazy
shell: bash
run: |
sudo apt-get remove gcc-14
sudo apt-get autoremove

# workaround for clang-tidy false positive
- uses: mjp41/workaround8649@c8550b715ccdc17f89c8d5c28d7a48eeff9c94a8
if: runner.os == 'Linux'
with:
os: ubuntu-latest
os: ubuntu-24.04

- name: Build autogenerated stuff
shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

jobs:
clang-tidy:
name: clang-tidy / Ubuntu 22.04
runs-on: ubuntu-22.04
name: clang-tidy / Ubuntu 24.04
runs-on: ubuntu-24.04
env:
CC: clang
CXX: clang++
Expand All @@ -26,8 +26,8 @@ jobs:
exclude_files_pattern: ^quickevent/app/quickevent/plugins/Receipts/src/thirdparty/qrcodegen\.cpp$

clazy:
name: clazy / Ubuntu 22.04
runs-on: ubuntu-22.04
name: clazy / Ubuntu 24.04
runs-on: ubuntu-24.04
env:
CC: clang
CXX: clang++
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "3rdparty/necrolog"]
path = 3rdparty/necrolog
url = https://github.com/fvacek/necrolog.git
[submodule "3rdparty/libshv"]
path = 3rdparty/libshv
url = https://github.com/silicon-heaven/libshv.git
1 change: 1 addition & 0 deletions 3rdparty/libshv
Submodule libshv added at f77c05
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.18.4)

set(QF_BUILD_QML_PLUGINS ON CACHE BOOL "Build with QML Plugins support")
set(QF_WITH_LIBSHV OFF CACHE BOOL "Build with libshv")

project(quickbox LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
Expand Down Expand Up @@ -34,6 +35,9 @@ endif (WIN32)
if (NOT TARGET libnecrolog)
add_subdirectory(3rdparty/necrolog)
endif()
if (QF_WITH_LIBSHV)
add_subdirectory(3rdparty/libshv)
endif()

set(USE_QT6 ON)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Gui Sql Qml Xml LinguistTools PrintSupport Svg SerialPort Multimedia Network)
Expand Down
1 change: 1 addition & 0 deletions libqf/libqfcore/include/qf/core/sql/qxrecchng.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../../../../src/sql/qxrecchng.h"
17 changes: 17 additions & 0 deletions libqf/libqfcore/src/sql/qxrecchng.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include "../core/coreglobal.h"

namespace qf::core::sql {

enum class QxRecOp { Insert, Update, Delete, };

struct QFCORE_DECL_EXPORT QxRecChng
{
QString table;
int64_t id;
QVariant record;
QxRecOp op;
};

}
4 changes: 3 additions & 1 deletion libqf/libqfcore/src/utils/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,8 @@ QVariant Table::sumValue(int field_ix) const
return ret;
}

static void setDomElementText(QDomDocument &owner_doc, QDomElement &el, const QString &str)
namespace {
void setDomElementText(QDomDocument &owner_doc, QDomElement &el, const QString &str)
{
QDomNode nd = el.firstChild();
QDomText el_txt = nd.toText();
Expand All @@ -1322,6 +1323,7 @@ static void setDomElementText(QDomDocument &owner_doc, QDomElement &el, const QS
el_txt.setData(str);
}
}
}

QDomElement Table::toHtmlElement(QDomDocument &owner_doc, const QString & col_names, TextExportOptions opts) const
{
Expand Down
2 changes: 1 addition & 1 deletion libqf/libqfgui/src/framework/datadialogwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class QFGUI_DECL_EXPORT DataDialogWidget : public DialogWidget

qf::gui::model::DataDocument* dataDocument(bool throw_exc = qf::core::Exception::Throw);

Q_SLOT virtual bool load(const QVariant &id = QVariant(), int mode = qf::gui::model::DataDocument::ModeEdit);
virtual bool load(const QVariant &id = QVariant(), int mode = qf::gui::model::DataDocument::ModeEdit);

bool acceptDialogDone(int result) Q_DECL_OVERRIDE;

Expand Down
15 changes: 5 additions & 10 deletions libqf/libqfgui/src/framework/dialogwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,21 @@

using namespace qf::gui::framework;

DialogWidget::DialogWidget(QWidget *parent) :
Super(parent), IPersistentSettings(this)
DialogWidget::DialogWidget(QWidget *parent)
: Super(parent)
, IPersistentSettings(this)
{
}

DialogWidget::~DialogWidget()
= default;
DialogWidget::~DialogWidget() = default;

bool DialogWidget::acceptDialogDone(int result)
{
qfLogFuncFrame();
Q_UNUSED(result);
return true;
}
/*
QVariant DialogWidget::acceptDialogDone_qml(const QVariant &result)
{
return acceptDialogDone(result.toBool());
}
*/

void DialogWidget::settleDownInDialog_qml(const QVariant &dlg)
{
auto *o = dlg.value<QObject*>();
Expand Down
2 changes: 1 addition & 1 deletion libqf/libqfgui/src/framework/dialogwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class QFGUI_DECL_EXPORT DialogWidget : public Frame, public IPersistentSettings
typedef Frame Super;
public:
explicit DialogWidget(QWidget *parent = nullptr);
~DialogWidget() Q_DECL_OVERRIDE;
~DialogWidget() override;

QF_PROPERTY_IMPL(QString, t, T, itle)
QF_PROPERTY_IMPL(QString, i, I, conSource)
Expand Down
30 changes: 14 additions & 16 deletions libqf/libqfgui/src/framework/ipersistentsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <QMetaMethod>
#include <QString>

using namespace qf::gui::framework;
namespace qf::gui::framework {

IPersistentSettings::IPersistentSettings(QObject *controlled_object) :
m_controlledObject(controlled_object)
Expand Down Expand Up @@ -39,7 +39,8 @@ QString IPersistentSettings::persistentSettingsPath()
return m_persistentSettingsPath;
}

static void callMethodRecursively(QObject *obj, const char *method_name)
namespace {
void callMethodRecursively(QObject *obj, const char *method_name)
{
if(!obj)
return;
Expand All @@ -48,7 +49,7 @@ static void callMethodRecursively(QObject *obj, const char *method_name)
QMetaMethod mm = obj->metaObject()->method(ix);
mm.invoke(obj);
}
Q_FOREACH(auto *o, obj->children()) {
for (auto *o : obj->children()) {
//static int level = 0;
//level++;
//QString indent = QString(level, ' ');
Expand All @@ -57,6 +58,7 @@ static void callMethodRecursively(QObject *obj, const char *method_name)
//level--;
}
}
}

void IPersistentSettings::loadPersistentSettingsRecursively()
{
Expand Down Expand Up @@ -103,28 +105,24 @@ QString IPersistentSettings::rawPersistentSettingsPath()
QString persistent_id = persistentSettingsId();
QStringList raw_path;
if(!persistent_id.isEmpty()) {
for(QObject *obj=m_controlledObject->parent(); obj!=nullptr; obj=obj->parent()) {
for(QObject* obj = m_controlledObject->parent(); obj != nullptr; obj = obj->parent()) {
auto *ps = dynamic_cast<IPersistentSettings*>(obj);
if(ps) {
QString pp = ps->rawPersistentSettingsPath();
if(!pp.isEmpty())
if(!pp.isEmpty()) {
raw_path.insert(0, pp);
//qfWarning() << "reading property 'persistentSettingsId' error" << obj << "casted to IPersistentSettings" << ps;
//qfWarning() << "\tcorrect value should be:" << parent_id;
}
break;
}
QVariant vid = obj->property("persistentSettingsId");
QString parent_id = vid.toString();
if(!parent_id.isEmpty()) {
raw_path.insert(0, parent_id);
}

// reading property using QQmlProperty is crashing my app Qt 5.3.1 commit a83826dad0f62d7a96f5a6093240e4c8f7f2e06e
//QQmlProperty p(obj, "persistentSettingsId");
//QVariant v2 = p.read();
QVariant vid = obj->property("persistentSettingsId");
QString parent_id = vid.toString();
if(!parent_id.isEmpty()) {
raw_path.insert(0, parent_id);
}
}
raw_path.append(persistent_id);
}
return raw_path.join('/');
}

}
6 changes: 2 additions & 4 deletions libqf/libqfgui/src/framework/ipersistentsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

class QObject;

namespace qf {
namespace gui {
namespace framework {
namespace qf::gui::framework {

class QFGUI_DECL_EXPORT IPersistentSettings
{
Expand Down Expand Up @@ -38,6 +36,6 @@ class QFGUI_DECL_EXPORT IPersistentSettings
QString m_persistentSettingsPath;
};

}}}
}

#endif
8 changes: 3 additions & 5 deletions libqf/libqfgui/src/model/sqldatadocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#include "datadocument.h"
#include "sqltablemodel.h"

namespace qf {
namespace gui {
namespace model {
namespace qf::gui::model {

class QFGUI_DECL_EXPORT SqlDataDocument : public DataDocument
{
Expand All @@ -21,7 +19,7 @@ class QFGUI_DECL_EXPORT SqlDataDocument : public DataDocument
qf::core::sql::QueryBuilder queryBuilder();
void setQueryBuilder(const qf::core::sql::QueryBuilder &qb);
protected:
SqlTableModel* createModel(QObject *parent) Q_DECL_OVERRIDE;
SqlTableModel* createModel(QObject *parent) override;

///! load model persistent storage via model
bool loadData() Q_DECL_OVERRIDE;
Expand All @@ -35,5 +33,5 @@ class QFGUI_DECL_EXPORT SqlDataDocument : public DataDocument
*/
};

}}}
}

Loading
Loading