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