Port to ecm_add_qml_module

This commit is contained in:
Nicolas Fella 2023-12-23 21:13:07 +01:00
parent 27afd0eb9a
commit 69a1d5ec6b
8 changed files with 35 additions and 36 deletions

View file

@ -1,5 +1,3 @@
qt_add_resources(kdeconnect_SRCS resources.qrc)
qt_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc) qt_add_resources(kdeconnect_custom_icons_SRCS ${CMAKE_SOURCE_DIR}/icons/custom_icons.qrc)
ecm_setup_version(${PROJECT_VERSION} ecm_setup_version(${PROJECT_VERSION}
@ -29,7 +27,26 @@ add_executable(kdeconnect-app
${kdeconnect_SRCS} ${kdeconnect_SRCS}
${kdeconnect_custom_icons_SRCS} ${kdeconnect_custom_icons_SRCS}
) )
target_link_libraries(kdeconnect-app Qt::Quick Qt::QuickControls2 Qt::Widgets KF${QT_MAJOR_VERSION}::CoreAddons KF${QT_MAJOR_VERSION}::I18n KF${QT_MAJOR_VERSION}::KCMUtils)
ecm_add_qml_module(kdeconnect-app URI org.kde.kdeconnect.app)
ecm_target_qml_sources(kdeconnect-app SOURCES
qml/Main.qml
qml/mpris.qml
qml/mousepad.qml
qml/presentationRemote.qml
qml/PluginItem.qml
qml/DevicePage.qml
qml/FindDevicesPage.qml
qml/runcommand.qml
qml/volume.qml
qml/MprisSlider.qml
qml/PluginSettings.qml
qml/PluginInfoPage.qml
qml/Settings.qml
)
target_link_libraries(kdeconnect-app PRIVATE Qt::Quick Qt::QuickControls2 Qt::Widgets KF${QT_MAJOR_VERSION}::CoreAddons KF${QT_MAJOR_VERSION}::I18n KF${QT_MAJOR_VERSION}::KCMUtils)
install(TARGETS kdeconnect-app ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS kdeconnect-app ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(PROGRAMS org.kde.kdeconnect.app.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(PROGRAMS org.kde.kdeconnect.app.desktop DESTINATION ${KDE_INSTALL_APPDIR})

View file

@ -73,7 +73,7 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); engine.loadFromModule("org.kde.kdeconnect.app", "Main");
return app.exec(); return app.exec();
} }

View file

@ -1,18 +0,0 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file alias="qml/main.qml">qml/main.qml</file>
<file>qml/mpris.qml</file>
<file>qml/mousepad.qml</file>
<file>qml/presentationRemote.qml</file>
<file>qml/PluginItem.qml</file>
<file alias="qml/DevicePage.qml">qml/DevicePage.qml</file>
<file alias="qml/FindDevicesPage.qml">qml/FindDevicesPage.qml</file>
<file alias="qml/runcommand.qml">qml/runcommand.qml</file>
<file>qml/volume.qml</file>
<file>qml/MprisSlider.qml</file>
<file>qml/PluginSettings.qml</file>
<file alias="qml/PluginInfoPage.qml">qml/PluginInfoPage.qml</file>
<file>qml/Settings.qml</file>
</qresource>
</RCC>

View file

@ -38,13 +38,24 @@ add_executable(kdeconnect-sms
conversationlistmodel.cpp conversationlistmodel.cpp
conversationmodel.cpp conversationmodel.cpp
conversationssortfilterproxymodel.cpp conversationssortfilterproxymodel.cpp
resources.qrc
thumbnailsprovider.cpp thumbnailsprovider.cpp
attachmentinfo.cpp attachmentinfo.cpp
${kdeconnect_custom_icons_SRCS} ${kdeconnect_custom_icons_SRCS}
) )
target_link_libraries(kdeconnect-sms ecm_add_qml_module(kdeconnect-sms URI org.kde.kdeconnect.sms)
ecm_target_qml_sources(kdeconnect-sms SOURCES
qml/Main.qml
qml/ConversationList.qml
qml/ConversationDisplay.qml
qml/ChatMessage.qml
qml/MessageAttachments.qml
qml/AttachmentViewer.qml
qml/SendingArea.qml
)
target_link_libraries(kdeconnect-sms PRIVATE
kdeconnectsmshelper kdeconnectsmshelper
kdeconnectinterfaces kdeconnectinterfaces
kdeconnectversion kdeconnectversion

View file

@ -108,7 +108,7 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.addImageProvider(QStringLiteral("thumbnailsProvider"), new ThumbnailsProvider); engine.addImageProvider(QStringLiteral("thumbnailsProvider"), new ThumbnailsProvider);
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); engine.loadFromModule("org.kde.kdeconnect.sms", "Main");
return app.exec(); return app.exec();
} }

View file

@ -1,11 +0,0 @@
<RCC>
<qresource prefix="/">
<file>qml/main.qml</file>
<file>qml/ConversationList.qml</file>
<file>qml/ConversationDisplay.qml</file>
<file>qml/ChatMessage.qml</file>
<file>qml/MessageAttachments.qml</file>
<file>qml/AttachmentViewer.qml</file>
<file>qml/SendingArea.qml</file>
</qresource>
</RCC>