SILICON
Loading...
Searching...
No Matches
graphicalMemory.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <core/memory.hpp>
22
23namespace SILICON::project {
24class DocumentStore;
25}
26
27namespace SILICON::ui {
28
30 Q_OBJECT
31public:
32 explicit GraphicalROM(QGraphicsItem* parent = nullptr);
33 ~GraphicalROM() override;
34
35 int type() const override { return SiliconTypes::ROM_COMPONENT; }
36
37 void setComponent(const SILICON::core::Component_ptr& component) override;
38 void applyProperty(std::string_view key,
39 const SILICON::core::PropertyValue& value) override;
41
42protected:
43 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
44
45private:
47 std::uint64_t documentListenerId = 0;
48
52 [[nodiscard]] std::shared_ptr<const std::string>
53 resolveBinaryContents(std::string_view slug) const;
54 [[nodiscard]] std::string currentSlug() const;
55};
56
57} // namespace SILICON::ui
GraphicalLogicComponent(ItemCategory category, const Component_ptr &component, QGraphicsItem *shape, QGraphicsItem *parent, bool scanShape=false)
const SILICON::project::DocumentStore * documents
GraphicalROM(QGraphicsItem *parent=nullptr)
void applyProperty(std::string_view key, const SILICON::core::PropertyValue &value) override
Applies a component property while notifying Qt about possible geometry changes.
int type() const override
void setDocumentStore(const SILICON::project::DocumentStore *documents)
std::shared_ptr< const std::string > resolveBinaryContents(std::string_view slug) const
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
void setComponent(const SILICON::core::Component_ptr &component) override
Sets the associated logical component.
std::string currentSlug() const
std::shared_ptr< Component > Component_ptr
std::variant< int, bool, std::string, BusValue > PropertyValue
Variant type for component properties.
@ ROM_COMPONENT
Definition enums.hpp:109