Page MenuHomePhorge

D132.1732488803.diff
No OneTemporary

Size
8 KB
Referenced Files
None
Subscribers
None

D132.1732488803.diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,11 +21,13 @@
endif()
set(QT_MAJOR_VERSION ${kazv_KF_QT_MAJOR_VERSION})
set(KF_MAJOR_VERSION ${kazv_KF_QT_MAJOR_VERSION})
+set(QT_MIN_VERSION 6.5.0)
+set(KF_MIN_VERSION 6.0.0)
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
-
+set(KDE_SKIP_NULLPTR_WARNINGS_SETTINGS ON)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
@@ -35,7 +37,13 @@
include(ECMAddTests)
include(ECMQtDeclareLoggingCategory)
include(ECMDeprecationSettings)
-
+include(ECMQmlModule)
+remove_definitions(
+ -DQT_NO_CAST_TO_ASCII
+ -DQT_NO_CAST_FROM_ASCII
+ -DQT_NO_URL_CAST_FROM_STRING
+ -DQT_NO_CAST_FROM_BYTEARRAY
+)
ecm_set_disabled_deprecation_versions(
QT 5.15.14
KF 5.116.0
@@ -46,7 +54,9 @@
Core Gui Qml QuickControls2 Svg Concurrent Widgets
Multimedia Test Network QuickTest
)
-find_package(KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami Config KIO Notifications KirigamiAddons)
+qt6_policy(SET QTP0001 NEW)
+find_package(KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami Config KIO Notifications)
+find_package(KF6KirigamiAddons)
find_package(Threads REQUIRED)
find_package(nlohmann_json REQUIRED)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,7 +7,7 @@
configure_file(kazv-platform.hpp.in kazv-platform.hpp)
configure_file(kazv-defs.hpp.in kazv-defs.hpp)
-set(kazvprivlib_SRCS
+set(kazvqmlmodule_SRCS
qt-job-handler.cpp
qt-job.cpp
${CMAKE_CURRENT_BINARY_DIR}/kazv-version.cpp
@@ -49,22 +49,23 @@
upload-job-model.cpp
kazv-markdown.cpp
- shortcuts/shortcut-util.cpp
-
- register-types.cpp
-
kazv-clipboard.cpp
)
-ecm_qt_declare_logging_category(kazvprivlib_SRCS
+ecm_qt_declare_logging_category(kazvqmlmodule_SRCS
HEADER kazv-log.hpp
IDENTIFIER kazvLog
CATEGORY_NAME moe.kazv.mxc.kazv
)
-add_library(kazvprivlib STATIC ${kazvprivlib_SRCS})
+qt_add_qml_module(kazvqmlmodule
+ STATIC
+ URI moe.kazv.mxc.kazv
+ VERSION 0.0
+ SOURCES ${kazvqmlmodule_SRCS}
+)
-target_link_libraries(kazvprivlib PUBLIC
+target_link_libraries(kazvqmlmodule PUBLIC
libkazv::kazvall
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::Network
@@ -81,8 +82,37 @@
${CMARK_TARGET_NAME}
)
-target_include_directories(kazvprivlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
-target_include_directories(kazvprivlib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/device-mgmt)
+target_include_directories(kazvqmlmodule PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
+target_include_directories(kazvqmlmodule PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/device-mgmt)
+
+qt_add_qml_module(kazvshortcutsqmlmodule
+ STATIC
+ URI moe.kazv.mxc.kazvshortcuts
+ VERSION 0.0
+ SOURCES
+ shortcuts/shortcut-util.cpp
+)
+
+target_link_libraries(kazvshortcutsqmlmodule PUBLIC
+ libkazv::kazvall
+ Qt${QT_MAJOR_VERSION}::Core
+ Qt${QT_MAJOR_VERSION}::Gui
+ Qt${QT_MAJOR_VERSION}::Qml
+)
+
+target_include_directories(kazvshortcutsqmlmodule
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/shortcuts
+)
+
+add_library(kazvprivlib INTERFACE)
+target_link_libraries(kazvprivlib
+ INTERFACE
+ kazvqmlmodule
+ kazvqmlmoduleplugin
+ kazvshortcutsqmlmodule
+ kazvshortcutsqmlmoduleplugin
+)
set(kazv_SRCS
main.cpp
diff --git a/src/main.cpp b/src/main.cpp
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,7 +16,6 @@
#include <QCommandLineParser>
#include <QQuickStyle>
-#include "register-types.hpp"
#include "meta-types.hpp"
#include "kazv-platform.hpp"
#include "kazv-path-config.hpp"
@@ -49,8 +48,6 @@
iconThemeToSet = parser.value(iconThemeOption);
}
- registerKazvQmlTypes();
-
KazvMetaTypeRegistration registration;
Q_UNUSED(registration);
diff --git a/src/register-types.hpp b/src/register-types.hpp
deleted file mode 100644
--- a/src/register-types.hpp
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * This file is part of kazv.
- * SPDX-FileCopyrightText: 2021-2023 tusooa <tusooa@kazv.moe>
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-#pragma once
-#include <kazv-defs.hpp>
-
-void registerKazvQmlTypes();
diff --git a/src/register-types.cpp b/src/register-types.cpp
deleted file mode 100644
--- a/src/register-types.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of kazv.
- * SPDX-FileCopyrightText: 2021-2024 tusooa <tusooa@kazv.moe>
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-#include <kazv-defs.hpp>
-
-#include <QtQml>
-
-#include "matrix-sdk.hpp"
-#include "matrix-room-list.hpp"
-#include "matrix-room.hpp"
-#include "matrix-room-timeline.hpp"
-#include "matrix-room-member.hpp"
-#include "matrix-room-member-list-model.hpp"
-#include "matrix-event-reader.hpp"
-#include "matrix-event-reader-list-model.hpp"
-#include "matrix-event.hpp"
-#include "l10n-provider.hpp"
-#include "kazv-config.hpp"
-#include "kazv-io-manager.hpp"
-#include "shortcuts/shortcut-util.hpp"
-#include "kazv-io-job.hpp"
-#include "device-mgmt/matrix-device-list.hpp"
-#include "device-mgmt/matrix-device.hpp"
-#include "matrix-promise.hpp"
-#include "kazv-util.hpp"
-#include "matrix-sticker.hpp"
-#include "matrix-sticker-pack.hpp"
-#include "matrix-sticker-pack-list.hpp"
-#include "matrix-user-given-attrs-map.hpp"
-#include "kazv-clipboard.hpp"
-
-void registerKazvQmlTypes()
-{
- qmlRegisterType<MatrixSdk>("moe.kazv.mxc.kazv", 0, 0, "MatrixSdk");
- qmlRegisterType<L10nProvider>("moe.kazv.mxc.kazv", 0, 0, "L10nProvider");
- qmlRegisterType<KazvConfig>("moe.kazv.mxc.kazv", 0, 0, "KazvConfig");
- qmlRegisterType<KazvIOBaseJob>("moe.kazv.mxc.kazv", 0, 0, "KazvIOBaseJob");
- qmlRegisterType<KazvIOManager>("moe.kazv.mxc.kazv", 0, 0, "KazvIOManager");
- qmlRegisterType<UploadJobModel>("moe.kazv.mxc.kazv", 0, 0, "UploadJobModel");
- qmlRegisterUncreatableType<MatrixRoomList>("moe.kazv.mxc.kazv", 0, 0, "MatrixRoomList", "");
- qmlRegisterUncreatableType<MatrixRoom>("moe.kazv.mxc.kazv", 0, 0, "MatrixRoom", "");
- qmlRegisterUncreatableType<MatrixRoomMember>("moe.kazv.mxc.kazv", 0, 0, "MatrixRoomMember", "");
- qmlRegisterUncreatableType<MatrixRoomMemberListModel>("moe.kazv.mxc.kazv", 0, 0, "MatrixRoomMemberListModel", "");
- qmlRegisterUncreatableType<MatrixRoomTimeline>("moe.kazv.mxc.kazv", 0, 0, "MatrixRoomTimeline", "");
- qmlRegisterUncreatableType<MatrixEvent>("moe.kazv.mxc.kazv", 0, 0, "MatrixEvent", "");
- qmlRegisterUncreatableType<MatrixEventReader>("moe.kazv.mxc.kazv", 0, 0, "MatrixEventReader", "");
- qmlRegisterUncreatableType<MatrixEventReaderListModel>("moe.kazv.mxc.kazv", 0, 0, "MatrixEventReaderListModel", "");
- qmlRegisterUncreatableType<MatrixDeviceList>("moe.kazv.mxc.kazv", 0, 0, "MatrixDeviceList", "");
- qmlRegisterUncreatableType<MatrixDevice>("moe.kazv.mxc.kazv", 0, 0, "MatrixDevice", "");
- qmlRegisterUncreatableType<MatrixPromise>("moe.kazv.mxc.kazv", 0, 0, "MatrixPromise", "");
- qmlRegisterUncreatableType<MatrixSticker>("moe.kazv.mxc.kazv", 0, 0, "MatrixSticker", "");
- qmlRegisterUncreatableType<MatrixStickerPack>("moe.kazv.mxc.kazv", 0, 0, "MatrixStickerPack", "");
- qmlRegisterUncreatableType<MatrixStickerPackList>("moe.kazv.mxc.kazv", 0, 0, "MatrixStickerPackList", "");
- qmlRegisterUncreatableType<MatrixUserGivenAttrsMap>("moe.kazv.mxc.kazv", 0, 0, "MatrixUserGivenAttrsMap", "");
-#if KAZV_KF_QT_MAJOR_VERSION == 5
- qmlRegisterSingletonInstance<KazvUtil>("moe.kazv.mxc.kazv", 0, 0, "KazvUtil", new KazvUtil());
- qmlRegisterSingletonInstance<ShortcutUtil>("moe.kazv.mxc.kazvshortcuts", 0, 0, "ShortcutUtil", new ShortcutUtil());
- qmlRegisterSingletonInstance<KazvClipboard>("moe.kazv.mxc.kazv", 0, 0, "KazvClipboard", new KazvClipboard());
-#else
- qmlRegisterSingletonInstance("moe.kazv.mxc.kazv", 0, 0, "KazvUtil", new KazvUtil());
- qmlRegisterSingletonInstance("moe.kazv.mxc.kazvshortcuts", 0, 0, "ShortcutUtil", new ShortcutUtil());
- qmlRegisterSingletonInstance("moe.kazv.mxc.kazv", 0, 0, "KazvClipboard", new KazvClipboard());
-#endif
-}
diff --git a/src/tests/quick-test.cpp b/src/tests/quick-test.cpp
--- a/src/tests/quick-test.cpp
+++ b/src/tests/quick-test.cpp
@@ -9,8 +9,6 @@
#include <QQmlEngine>
#include <QQmlContext>
-#include "register-types.hpp"
-
class Setup : public QObject
{
Q_OBJECT
@@ -18,10 +16,9 @@
public:
Setup() {}
-public slots:
- void qmlEngineAvailable(QQmlEngine *engine)
+public Q_SLOTS:
+ void qmlEngineAvailable(QQmlEngine *)
{
- registerKazvQmlTypes();
}
};

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 2:53 PM (13 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39879
Default Alt Text
D132.1732488803.diff (8 KB)

Event Timeline