From 400f7a6c23508dee3878747346454826cb0df33a Mon Sep 17 00:00:00 2001 From: Toast Date: Sun, 27 Apr 2025 23:42:20 +0200 Subject: [PATCH] Add basic code --- CMakeLists.txt | 28 ++++++++++++++++++++++++++++ src/CMakeLists.txt | 13 +++++++++++++ src/Main.qml | 17 +++++++++++++++++ src/main.cpp | 35 +++++++++++++++++++++++++++++++++++ xyz.toast003.leek.desktop | 8 ++++++++ 5 files changed, 101 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/Main.qml create mode 100644 src/main.cpp create mode 100644 xyz.toast003.leek.desktop diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8308371 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.20) +project(leek) + +find_package(ECM 6.0.0 REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + +set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) + +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDECompilerSettings NO_POLICY_SCOPE) +include(ECMFindQmlModule) +include(ECMQmlModule) + +find_package(Qt6 REQUIRED COMPONENTS Core Quick Gui QuickControls2 Widgets) + +find_package(KF6 REQUIRED COMPONENTS Kirigami I18n CoreAddons QQC2DesktopStyle + IconThemes) + +# Don't mark this as required, since qml module finding is broken on NixOS +ecm_find_qmlmodule(org.kde.kirigami) + +add_subdirectory(src) + +install(PROGRAMS xyz.toast003.leek.desktop DESTINATION ${KDE_INSTALL_APPDIR}) + +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES + FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..01ca4c0 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,13 @@ +add_executable(leek) + +ecm_add_qml_module(leek URI xyz.toast003.leek) + +target_sources(leek PRIVATE main.cpp) + +ecm_target_qml_sources(leek SOURCES Main.qml) + +target_link_libraries(leek PRIVATE Qt6::Quick Qt6::Qml Qt6::Gui + Qt6::QuickControls2 Qt6::Widgets) +target_link_libraries(leek PRIVATE KF6::I18n KF6::CoreAddons KF6::IconThemes) + +install(TARGETS leek ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/Main.qml b/src/Main.qml new file mode 100644 index 0000000..c0492bd --- /dev/null +++ b/src/Main.qml @@ -0,0 +1,17 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls as Controls +import org.kde.kirigami as Kirigami + +Kirigami.ApplicationWindow { + id: root + title: "Leek" + + pageStack.initialPage: Kirigami.Page { + Controls.Label { + anchors.centerIn: parent + text: "Hello world" + } + } +} + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..3448dda --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + KIconTheme::initTheme(); + QApplication app(argc, argv); + KLocalizedString::setApplicationDomain("leek"); + QApplication::setOrganizationName(QStringLiteral("Toast")); + QApplication::setOrganizationDomain(QStringLiteral("toast003.xyz")); + QApplication::setApplicationName(QStringLiteral("Leek")); + QApplication::setDesktopFileName(QStringLiteral("xyz.toast003.leek")); + + QApplication::setStyle(QStringLiteral("breeze")); + if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) { + QQuickStyle::setStyle(QStringLiteral("org.kde.desktop")); + } + + QQmlApplicationEngine engine; + + engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); + engine.loadFromModule("xyz.toast003.leek", "Main"); + + if (engine.rootObjects().isEmpty()) { + return -1; + } + + return app.exec(); +} diff --git a/xyz.toast003.leek.desktop b/xyz.toast003.leek.desktop new file mode 100644 index 0000000..7b78b7f --- /dev/null +++ b/xyz.toast003.leek.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Leek +Type=Application +Exec=leek +Categories=Game;Utility;KDE;Qt +Keywords=diva;mod,manager;hatsune;miku +Icon=steam_icon_1761390 +Comment=Project Diva Mega Mix+ mod manager built with KDE technologies