// SPDX-FileCopyrightText: 2026 Matvey Shcherbinin // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL #pragma once #include "koutnetsettings.h" #include #include #include namespace koutnet { // The style the application opens with when the setting is blank. A free // function because main() has to pick the style before any QObject exists, and // the settings page has to read back the same answer later. QString defaultStyleName(); // The Qt Quick Controls style the interface is built out of. // // Unlike the font and the icon theme, this one cannot be changed under a // running window: Qt reads the style once, as the first controls are made, and // a style set after that is a style that does not appear. So setting it here // only writes the setting down, and startup reads it back before the QML // module is loaded on the next launch. The settings page says as much next to // the control rather than pretending the change is live. class StyleSelector : public QObject { Q_OBJECT Q_PROPERTY(QString style READ style WRITE setStyle NOTIFY styleChanged) public: explicit StyleSelector(KOutNetSettings *settings, QObject *parent = nullptr); QString style() const; void setStyle(const QString &style); // What the running window was built out of, so the page can tell whether a // picked style has taken effect yet or is waiting for the next launch. Q_INVOKABLE QString runningStyle() const; Q_INVOKABLE QStringList availableStyles() const; Q_SIGNALS: void styleChanged(); private: KOutNetSettings *m_settings; // The imports directory is fixed for the life of the process; the settings // page asks for the list on every open. mutable QStringList m_styles; mutable bool m_stylesCached = false; }; } // namespace koutnet