Debian Codegraph @

src/core/sysmodelqmlitem.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #pragma once
5
6 #include "exportable.h"
7 #include "iprofile.h"
8 #include "isysmodelui.h"
9 #include "qmlitem.h"
10 #include <QObject>
11 #include <memory>
12 #include <string>
13 #include <string_view>
14 #include <unordered_map>
15
16 class IQMLComponentFactory;
17 class QQmlApplicationEngine;
18
19 class SysModelQMLItem
20 : public QMLItem
21 , public ISysModelUI
22 {
23 Q_OBJECT
24
25 public:
26 static constexpr std::string_view ParentObjectName{"PROFILE_SYS_MODEL"};
27
28 void activate(bool active) override;
29
30 std::optional<std::reference_wrapper<Importable::Importer>>
31 provideImporter(Item const &i) override;
32 std::optional<std::reference_wrapper<Exportable::Exporter>>
33 provideExporter(Item const &i) override;
34
35 bool provideActive() const override;
36 IProfile::Info const &provideInfo() const override;
37
38 void takeActive(bool active) override;
39 void takeInfo(IProfile::Info const &info) override;
40
41 std::unique_ptr<Exportable::Exporter>
42 initializer(IQMLComponentFactory const &qmlComponentFactory,
43 QQmlApplicationEngine &qmlEngine) override;
44
45 private:
46 class Initializer;
47
48 std::unordered_map<std::string, QMLItem *> components_;
49
50 IProfile::Info profileInfo_;
51 bool profileActive_;
52
53 static bool register_();
54 static bool const registered_;
55 };