wiRedPanda
Home
About
Download
Try out
API Docs
wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
ElementMetadata.h
Go to the documentation of this file.
1
// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
7
8
#pragma once
9
10
#include <functional>
11
12
#include <QMap>
13
#include <QString>
14
#include <QStringList>
15
16
#include "
App/Core/Enums.h
"
17
27
struct
ElementMetadata
{
28
ElementType
type
= ElementType::Unknown;
29
ElementGroup
group
= ElementGroup::Unknown;
30
31
// --- Display properties ---
32
33
std::function<QString()>
pixmapPath
;
34
const
char
*
titleText
=
nullptr
;
35
const
char
*
translatedName
=
nullptr
;
36
const
char
*
trContext
=
nullptr
;
37
38
// --- Port configuration ---
39
40
quint64
minInputSize
= 0;
41
quint64
maxInputSize
= 0;
42
quint64
minOutputSize
= 0;
43
quint64
maxOutputSize
= 0;
44
45
// --- Appearance configuration ---
46
47
QStringList
defaultAppearances
;
48
QStringList
alternativeAppearances
;
49
50
// --- Feature flags ---
51
52
bool
canChangeAppearance
=
false
;
53
bool
hasColors
=
false
;
54
bool
hasAudio
=
false
;
55
bool
hasAudioBox
=
false
;
56
bool
hasTrigger
=
false
;
57
bool
hasFrequency
=
false
;
58
bool
hasDelay
=
false
;
59
bool
hasLabel
=
false
;
60
bool
hasTruthTable
=
false
;
61
bool
hasVolume
=
false
;
62
bool
rotatesGraphic
=
true
;
63
};
64
72
class
ElementMetadataRegistry
73
{
74
public
:
76
static
const
ElementMetadata
&
metadata
(
ElementType
type);
78
static
void
registerMetadata
(
const
ElementMetadata
&meta);
80
static
bool
hasMetadata
(
ElementType
type);
81
82
private
:
84
static
QMap<ElementType, ElementMetadata> ®istry();
85
};
Enums.h
Central enumeration types for element types, groups, and signal status.
ElementType
Enums::ElementType ElementType
Definition
Enums.h:107
ElementGroup
Enums::ElementGroup ElementGroup
Definition
Enums.h:108
ElementMetadataRegistry
Global registry of ElementMetadata, one entry per ElementType.
Definition
ElementMetadata.h:73
ElementMetadataRegistry::hasMetadata
static bool hasMetadata(ElementType type)
Returns true if metadata has been registered for type.
Definition
ElementMetadata.cpp:36
ElementMetadataRegistry::registerMetadata
static void registerMetadata(const ElementMetadata &meta)
Registers meta in the global map (called once per element type at startup).
Definition
ElementMetadata.cpp:20
ElementMetadataRegistry::metadata
static const ElementMetadata & metadata(ElementType type)
Returns the metadata for type. Asserts if type is not registered.
Definition
ElementMetadata.cpp:25
ElementMetadata
Compile-time-registered properties for one element type.
Definition
ElementMetadata.h:27
ElementMetadata::maxInputSize
quint64 maxInputSize
Maximum number of input ports.
Definition
ElementMetadata.h:41
ElementMetadata::rotatesGraphic
bool rotatesGraphic
True if rotating/flipping re-orients the graphic itself; false keeps the icon fixed and only repositi...
Definition
ElementMetadata.h:62
ElementMetadata::hasLabel
bool hasLabel
True if the element supports a user-editable label.
Definition
ElementMetadata.h:59
ElementMetadata::group
ElementGroup group
UI palette group this element belongs to.
Definition
ElementMetadata.h:29
ElementMetadata::hasAudioBox
bool hasAudioBox
True if the element shows an audio selection box.
Definition
ElementMetadata.h:55
ElementMetadata::maxOutputSize
quint64 maxOutputSize
Maximum number of output ports.
Definition
ElementMetadata.h:43
ElementMetadata::hasFrequency
bool hasFrequency
True if the element exposes a configurable clock frequency.
Definition
ElementMetadata.h:57
ElementMetadata::defaultAppearances
QStringList defaultAppearances
Built-in appearance resource paths.
Definition
ElementMetadata.h:47
ElementMetadata::hasAudio
bool hasAudio
True if the element supports audio output.
Definition
ElementMetadata.h:54
ElementMetadata::alternativeAppearances
QStringList alternativeAppearances
User-selectable alternative appearance paths.
Definition
ElementMetadata.h:48
ElementMetadata::hasColors
bool hasColors
True if the element supports color selection.
Definition
ElementMetadata.h:53
ElementMetadata::hasDelay
bool hasDelay
True if the element exposes a configurable clock phase delay.
Definition
ElementMetadata.h:58
ElementMetadata::trContext
const char * trContext
Translation context string for QCoreApplication::translate().
Definition
ElementMetadata.h:36
ElementMetadata::hasVolume
bool hasVolume
True if the element supports volume control.
Definition
ElementMetadata.h:61
ElementMetadata::minInputSize
quint64 minInputSize
Minimum number of input ports.
Definition
ElementMetadata.h:40
ElementMetadata::translatedName
const char * translatedName
Untranslated element name used for tooltips (QT_TRANSLATE_NOOP).
Definition
ElementMetadata.h:35
ElementMetadata::type
ElementType type
Unique element type identifier.
Definition
ElementMetadata.h:28
ElementMetadata::minOutputSize
quint64 minOutputSize
Minimum number of output ports.
Definition
ElementMetadata.h:42
ElementMetadata::canChangeAppearance
bool canChangeAppearance
True if the user can choose a custom appearance.
Definition
ElementMetadata.h:52
ElementMetadata::pixmapPath
std::function< QString()> pixmapPath
Callable returning the default pixmap resource path (lazily evaluated).
Definition
ElementMetadata.h:33
ElementMetadata::hasTrigger
bool hasTrigger
True if the element supports a keyboard trigger shortcut.
Definition
ElementMetadata.h:56
ElementMetadata::hasTruthTable
bool hasTruthTable
True if the element has an editable truth table.
Definition
ElementMetadata.h:60
ElementMetadata::titleText
const char * titleText
Untranslated title shown in the element palette (QT_TRANSLATE_NOOP).
Definition
ElementMetadata.h:34
App
Element
ElementMetadata.h
Generated by
1.16.1