[graphics/arianna] /: Use KirigamiAppDefaults for style and other initialization in main()

Arjen Hiemstra <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 3a7304527fb769086369a2242e25636cf1323aa7 by Arjen Hiemstra.
Committed on 30/07/2026 at 13:46.
Pushed by tfella into branch 'master'.

Use KirigamiAppDefaults for style and other initialization in main()

This reduces duplicate code as we now have a central function for it.

M  +1    -1    CMakeLists.txt
M  +1    -0    src/CMakeLists.txt
M  +2    -16   src/main.cpp

https://invent.kde.org/graphics/arianna/-/commit/3a7304527fb769086369a2242e25636cf1323aa7

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9079e8d..c8ce366 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,7 +54,7 @@ set_package_properties(KF6 PROPERTIES
     TYPE REQUIRED
     PURPOSE "Basic application components"
 )
-find_package(KF6KirigamiAddons 1.4.0 REQUIRED)
+find_package(KF6KirigamiAddons 1.12.0 REQUIRED)
 find_package(KF6QQC2DesktopStyle REQUIRED)
 
 find_package(Qt6 ${QT_MIN_VERSION} NO_MODULE COMPONENTS WebEngineQuick)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 75cd5ff..b2586fb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -123,6 +123,7 @@ target_link_libraries(arianna_static PUBLIC
     KF6::Crash
     KF6::ColorScheme
     KF6::I18nQml
+    KirigamiApp
 )
 
 target_link_libraries(arianna_static PUBLIC Qt::WebEngineQuick)
diff --git a/src/main.cpp b/src/main.cpp
index 2ca1b8a..cb3af5d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -22,6 +22,7 @@
 #include <KLocalizedString>
 #include <KWindowConfig>
 #include <KWindowSystem>
+#include <KirigamiAddons/App/KirigamiAppDefaults>
 #include <QStringLiteral>
 
 #include "arianna-version.h"
@@ -35,22 +36,8 @@ int main(int argc, char *argv[])
     QtWebEngineQuick::initialize();
 
     QApplication app(argc, argv);
-    // Default to org.kde.desktop style unless the user forces another style
-    if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
-        QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
-    }
-
-#ifdef Q_OS_WINDOWS
-    if (AttachConsole(ATTACH_PARENT_PROCESS)) {
-        freopen("CONOUT$", "w", stdout);
-        freopen("CONOUT$", "w", stderr);
-    }
 
-    QApplication::setStyle(QStringLiteral("breeze"));
-    auto font = app.font();
-    font.setPointSize(10);
-    app.setFont(font);
-#endif
+    KirigamiAppDefaults::apply(&app);
 
     KLocalizedString::setApplicationDomain(QByteArrayLiteral("arianna"));
 
@@ -67,7 +54,6 @@ int main(int argc, char *argv[])
     about.setBugAddress("https://bugs.kde.org/describecomponents.cgi?product=arianna");
 
     KAboutData::setApplicationData(about);
-    KCrash::initialize();
 
     QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("org.kde.arianna")));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.