| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "core/qmlitem.h" |
| 7 | #include "pmautoprofilepart.h" |
| 8 | #include <QObject> |
| 9 | |
| 10 | namespace AMD { |
| 11 | |
| 12 | class PMAutoQMLItem |
| 13 | : public QMLItem |
| 14 | , public AMD::PMAutoProfilePart::Importer |
| 15 | , public AMD::PMAutoProfilePart::Exporter |
| 16 | { |
| 17 | Q_OBJECT |
| 18 | |
| 19 | public: |
| 20 | explicit PMAutoQMLItem() noexcept; |
| 21 | |
| 22 | void activate(bool active) override; |
| 23 | |
| 24 | std::optional<std::reference_wrapper<Importable::Importer>> |
| 25 | provideImporter(Item const &i) override; |
| 26 | std::optional<std::reference_wrapper<Exportable::Exporter>> |
| 27 | provideExporter(Item const &i) override; |
| 28 | |
| 29 | bool provideActive() const override; |
| 30 | |
| 31 | void takeActive(bool active) override; |
| 32 | |
| 33 | std::unique_ptr<Exportable::Exporter> |
| 34 | initializer(IQMLComponentFactory const &qmlComponentFactory, |
| 35 | QQmlApplicationEngine &qmlEngine) override; |
| 36 | |
| 37 | private: |
| 38 | class Initializer; |
| 39 | |
| 40 | bool active_; |
| 41 | |
| 42 | static bool register_(); |
| 43 | static bool const registered_; |
| 44 | |
| 45 | static char const *const trStrings[]; |
| 46 | }; |
| 47 | |
| 48 | } // namespace AMD |