[multimedia/audiotube] /: Use KirigamiAppDefaults for handling default style
Arjen Hiemstra <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit a44da0c27a0c79e4366f667f3ecc305ee64816b8 by Arjen Hiemstra.
Committed on 30/07/2026 at 10:24.
Pushed by tfella into branch 'master'.
Use KirigamiAppDefaults for handling default style
We now have a function for this in KirigamiAddons, which removes the
need for a custom class to handle this and reduces code duplication.
M +1 -1 CMakeLists.txt
M +1 -0 src/CMakeLists.txt
M +2 -40 src/main.cpp
https://invent.kde.org/multimedia/audiotube/-/commit/a44da0c27a0c79e4366f667f3ecc305ee64816b8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a78b2af3..65788b82 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,7 +47,7 @@ set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 REQUIRED)
find_package(Ytdlp REQUIRED RUNTIME)
find_package(YTMusicAPI 1.10.2 REQUIRED RUNTIME)
-find_package(KF6KirigamiAddons 0.11.0 REQUIRED)
+find_package(KF6KirigamiAddons 1.12.0 REQUIRED)
find_package(FutureSQL6 REQUIRED)
find_package(QCoro6 0.10.0 REQUIRED COMPONENTS Core)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index da5744e9..f433eb90 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -118,6 +118,7 @@ target_link_libraries(audiotube PRIVATE
QCoro6::Core
qt-mpris
ytm
+ KirigamiApp
)
target_compile_definitions(audiotube PRIVATE
diff --git a/src/main.cpp b/src/main.cpp
index f8be49a1..b38cb9b3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,6 +17,7 @@
#include <KIconTheme>
#include <KLocalizedContext>
#include <KLocalizedString>
+#include <KirigamiAddons/App/KirigamiAppDefaults>
#include <ThreadedDatabase>
@@ -24,47 +25,10 @@
using namespace Qt::StringLiterals;
-class StyleFallback
-{
-public:
- StyleFallback()
- {
- if (QGuiApplication::instance()) {
- qFatal("StyleFallback must be created before Q(Gui)Application");
- }
-
- KIconTheme::initTheme();
-
- m_initialQuickControlsStyle = QQuickStyle::name();
- }
-
- void setup(QGuiApplication *app)
- {
- Q_ASSERT(app); // Force people to run this at the right time
-
- // Check if the platformtheme or user set up a style for us
- if (m_initialQuickControlsStyle != QQuickStyle::name()
- || !qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
- return;
- }
-
- qWarning() << "Detected that the platform did not set up a style, using defaults";
-
- // platformtheme did not handle QtQuick styling, set everything to fallback values
- QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
- QApplication::setStyle(QStyleFactory::create(QStringLiteral("Breeze")));
- QIcon::setThemeName(QStringLiteral("breeze"));
- }
-
-private:
- QString m_initialQuickControlsStyle;
-};
-
Q_DECL_EXPORT int main(int argc, char *argv[])
{
- StyleFallback fallback;
QApplication app(argc, argv);
- fallback.setup(&app);
+ KirigamiAppDefaults::apply(&app);
// WORKAROUND: Force QtMultimedia gstreamer backend
/*
@@ -106,8 +70,6 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("org.kde.audiotube")));
- KCrash::initialize();
-
QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));