SILICON
Toggle main menu visibility
Loading...
Searching...
No Matches
componentCatalogOverlay.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 <string>
21
#include <vector>
22
23
#include <QStringList>
24
#include <QWidget>
25
26
#include <
ui/lifetime.hpp
>
27
28
#include <
core/component.hpp
>
29
#include <
core/serialization/component_registry.hpp
>
30
31
namespace
SILICON::project
{
32
class
DocumentStore
;
33
}
34
namespace
SILICON::core
{
35
class
CircuitResolver
;
36
}
37
38
class
QLineEdit;
39
class
QTableWidget;
40
41
namespace
SILICON::ui
{
42
using namespace
SILICON::core;
43
44
class
DiagramScene
;
45
46
class
ComponentCatalogOverlay
:
public
QWidget {
47
public
:
48
struct
CatalogRow
{
49
std::string
guiType
;
50
ComponentRegistry::ComponentMetadata
metadata
;
51
PropertyMap
initialProperties
;
52
};
53
54
explicit
ComponentCatalogOverlay
(
DiagramScene
* scene,
55
const
SILICON::project::DocumentStore
&
documents
,
56
const
CircuitResolver
*
resolver
,
57
QWidget* parent =
nullptr
);
58
59
void
open
();
60
void
dismiss
();
61
62
protected
:
63
void
keyPressEvent
(QKeyEvent* event)
override
;
64
65
private
:
66
void
rebuildRows
();
67
void
addCategoryRow
(
ComponentRegistry::ComponentCategory
category);
68
void
addComponentRow
(
const
CatalogRow
& rowData);
69
void
activateRow
(
int
row);
70
void
selectFirstComponentRow
();
71
void
resizeCatalogColumns
();
72
[[nodiscard]]
static
QStringList
searchableFields
(
const
CatalogRow
& rowData);
73
74
DiagramScene
*
diagramScene
=
nullptr
;
75
const
SILICON::project::DocumentStore
&
documents
;
76
const
CircuitResolver
*
resolver
;
77
QLineEdit*
searchInput
=
nullptr
;
78
QTableWidget*
table
=
nullptr
;
79
std::vector<CatalogRow>
catalogRows
;
80
CallbackScope
callbacks
;
81
};
82
83
}
// namespace SILICON::ui
SILICON::core::CircuitResolver
Definition
circuitDocument.hpp:52
SILICON::core::ComponentRegistry::ComponentCategory
SILICON::core::ComponentCategory ComponentCategory
Definition
component_registry.hpp:38
SILICON::core::ComponentRegistry::ComponentMetadata
SILICON::core::ComponentMetadata ComponentMetadata
Definition
component_registry.hpp:39
SILICON::project::DocumentStore
Definition
projectDocument.hpp:137
SILICON::ui::CallbackScope
Definition
lifetime.hpp:34
SILICON::ui::ComponentCatalogOverlay::table
QTableWidget * table
Definition
componentCatalogOverlay.hpp:78
SILICON::ui::ComponentCatalogOverlay::ComponentCatalogOverlay
ComponentCatalogOverlay(DiagramScene *scene, const SILICON::project::DocumentStore &documents, const CircuitResolver *resolver, QWidget *parent=nullptr)
Definition
componentCatalogOverlay.cpp:144
SILICON::ui::ComponentCatalogOverlay::searchableFields
static QStringList searchableFields(const CatalogRow &rowData)
Definition
componentCatalogOverlay.cpp:409
SILICON::ui::ComponentCatalogOverlay::addComponentRow
void addComponentRow(const CatalogRow &rowData)
Definition
componentCatalogOverlay.cpp:321
SILICON::ui::ComponentCatalogOverlay::callbacks
CallbackScope callbacks
Definition
componentCatalogOverlay.hpp:80
SILICON::ui::ComponentCatalogOverlay::activateRow
void activateRow(int row)
Definition
componentCatalogOverlay.cpp:349
SILICON::ui::ComponentCatalogOverlay::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Definition
componentCatalogOverlay.cpp:219
SILICON::ui::ComponentCatalogOverlay::addCategoryRow
void addCategoryRow(ComponentRegistry::ComponentCategory category)
Definition
componentCatalogOverlay.cpp:305
SILICON::ui::ComponentCatalogOverlay::documents
const SILICON::project::DocumentStore & documents
Definition
componentCatalogOverlay.hpp:75
SILICON::ui::ComponentCatalogOverlay::searchInput
QLineEdit * searchInput
Definition
componentCatalogOverlay.hpp:77
SILICON::ui::ComponentCatalogOverlay::dismiss
void dismiss()
Definition
componentCatalogOverlay.cpp:230
SILICON::ui::ComponentCatalogOverlay::resolver
const CircuitResolver * resolver
Definition
componentCatalogOverlay.hpp:76
SILICON::ui::ComponentCatalogOverlay::selectFirstComponentRow
void selectFirstComponentRow()
Definition
componentCatalogOverlay.cpp:377
SILICON::ui::ComponentCatalogOverlay::open
void open()
Definition
componentCatalogOverlay.cpp:205
SILICON::ui::ComponentCatalogOverlay::catalogRows
std::vector< CatalogRow > catalogRows
Definition
componentCatalogOverlay.hpp:79
SILICON::ui::ComponentCatalogOverlay::resizeCatalogColumns
void resizeCatalogColumns()
Definition
componentCatalogOverlay.cpp:388
SILICON::ui::ComponentCatalogOverlay::diagramScene
DiagramScene * diagramScene
Definition
componentCatalogOverlay.hpp:74
SILICON::ui::ComponentCatalogOverlay::rebuildRows
void rebuildRows()
Definition
componentCatalogOverlay.cpp:251
SILICON::ui::DiagramScene
Graphics scene for the circuit diagram editor.
Definition
diagramScene.hpp:118
component.hpp
component_registry.hpp
lifetime.hpp
SILICON::core
Definition
activeKeyGuard.hpp:28
SILICON::core::PropertyMap
std::unordered_map< std::string, PropertyValue, TransparentStringHash, TransparentStringEqual > PropertyMap
Map from property names to their values.
Definition
component.hpp:145
SILICON::project
Definition
circuitDependencyGraph.cpp:30
SILICON::ui
Definition
actionGroups.hpp:14
SILICON::ui::ComponentCatalogOverlay::CatalogRow
Definition
componentCatalogOverlay.hpp:48
SILICON::ui::ComponentCatalogOverlay::CatalogRow::metadata
ComponentRegistry::ComponentMetadata metadata
Definition
componentCatalogOverlay.hpp:50
SILICON::ui::ComponentCatalogOverlay::CatalogRow::guiType
std::string guiType
Definition
componentCatalogOverlay.hpp:49
SILICON::ui::ComponentCatalogOverlay::CatalogRow::initialProperties
PropertyMap initialProperties
Definition
componentCatalogOverlay.hpp:51
src
ui
circuit
editor
componentCatalogOverlay.hpp
Generated by
1.17.0