diff --git a/CMakeLists.txt b/CMakeLists.txt index a893c2e..64c7928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,60 +1,62 @@ project(index) cmake_minimum_required(VERSION 3.0) find_package(ECM 1.7.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH}) -option(IS_APPIMAGE_PACKAGE "If set to true then the icons and styled is packaged as well") +option(MAUIKIT_STYLE "If set to true then the icons and styled is packaged as well") + +option(IS_APPIMAGE_PACKAGE "If set to true then the KF5 libraries are linked") find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Qml Quick Sql Svg QuickControls2 Widgets) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(ECMInstallIcons) include(FeatureSummary) include(ECMAddAppIcon) find_package(MauiKit REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(index src/index_assets.qrc src/main.cpp src/index.cpp src/qml.qrc ) -if(IS_APPIMAGE_PACKAGE) - target_compile_definitions(index PUBLIC APPIMAGE_PACKAGE) +if(MAUIKIT_STYLE) + target_compile_definitions(index PUBLIC MAUIKIT_STYLE) endif() find_package(KF5 ${KF5_VERSION} REQUIRED COMPONENTS I18n Notifications Config KIO Service Attica SyntaxHighlighting) if (ANDROID) find_package(Qt5 REQUIRED COMPONENTS AndroidExtras WebView) target_link_libraries(index Qt5::AndroidExtras) kde_source_files_enable_exceptions(index src/index.cpp) else() find_package(Qt5 REQUIRED COMPONENTS WebEngine) if(IS_APPIMAGE_PACKAGE) target_link_libraries(index KF5::KIOWidgets KF5::KIOFileWidgets KF5::ConfigCore KF5::Notifications KF5::KIOCore KF5::KIOWidgets KF5::I18n KF5::Service KF5::Attica KF5::SyntaxHighlighting) endif() endif() target_link_libraries(index MauiKit Qt5::Sql Qt5::Quick Qt5::Qml Qt5::Widgets Qt5::Svg) install(TARGETS index ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES org.kde.index.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) #TODO: port to ecm_install_icons() install(FILES src/assets/index.svg DESTINATION ${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps) # install(FILES org.kde.index.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/main.cpp b/src/main.cpp index 72b7fd7..4101e61 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,90 +1,90 @@ #include #include #include #include #include #include "index.h" #include "inx.h" -#ifdef APPIMAGE_PACKAGE +#if defined APPIMAGE_PACKAGE || defined MAUIKIT_STYLE #include #endif #ifdef Q_OS_ANDROID #include #include #include "mauiandroid.h" #else #include #endif #ifdef STATIC_KIRIGAMI #include "3rdparty/kirigami/src/kirigamiplugin.h" #endif #ifdef STATIC_MAUIKIT #include "3rdparty/mauikit/src/mauikit.h" #endif Q_DECL_EXPORT int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #ifdef Q_OS_ANDROID - QGuiApplication app(argc, argv); - if (!MAUIAndroid::checkRunTimePermissions()) - return -1; + QGuiApplication app(argc, argv); + if (!MAUIAndroid::checkRunTimePermissions()) + return -1; #else - QApplication app(argc, argv); + QApplication app(argc, argv); #endif -#ifdef APPIMAGE_PACKAGE - MauiKit::getInstance().initResources(); +#ifdef MAUIKIT_STYLE + MauiKit::getInstance().initResources(); #endif - app.setApplicationName(INX::appName); - app.setApplicationVersion(INX::version); - app.setApplicationDisplayName(INX::displayName); - app.setOrganizationName(INX::orgName); - app.setOrganizationDomain(INX::orgDomain); - app.setWindowIcon(QIcon(":/index.png")); + app.setApplicationName(INX::appName); + app.setApplicationVersion(INX::version); + app.setApplicationDisplayName(INX::displayName); + app.setOrganizationName(INX::orgName); + app.setOrganizationDomain(INX::orgDomain); + app.setWindowIcon(QIcon(":/index.png")); - QCommandLineParser parser; - parser.setApplicationDescription(INX::description); - const QCommandLineOption versionOption = parser.addVersionOption(); - parser.addOption(versionOption); - parser.process(app); + QCommandLineParser parser; + parser.setApplicationDescription(INX::description); + const QCommandLineOption versionOption = parser.addVersionOption(); + parser.addOption(versionOption); + parser.process(app); - const QStringList args = parser.positionalArguments(); - QStringList paths; + const QStringList args = parser.positionalArguments(); + QStringList paths; - if(!args.isEmpty()) - paths = args; + if(!args.isEmpty()) + paths = args; #ifdef STATIC_KIRIGAMI - KirigamiPlugin::getInstance().registerTypes(); + KirigamiPlugin::getInstance().registerTypes(); #endif #ifdef STATIC_MAUIKIT - MauiKit::getInstance().registerTypes(); + MauiKit::getInstance().registerTypes(); #endif - Index index; - QQmlApplicationEngine engine; - const QUrl url(QStringLiteral("qrc:/main.qml")); - QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, - &app, [url, paths, &index](QObject *obj, const QUrl &objUrl) - { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); + Index index; + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url, paths, &index](QObject *obj, const QUrl &objUrl) + { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); - if(!paths.isEmpty()) - index.openPaths(paths); + if(!paths.isEmpty()) + index.openPaths(paths); - }, Qt::QueuedConnection); + }, Qt::QueuedConnection); - const auto context = engine.rootContext(); - context->setContextProperty("inx", &index); - engine.load(url); - return app.exec(); + const auto context = engine.rootContext(); + context->setContextProperty("inx", &index); + engine.load(url); + return app.exec(); }