LibrePCB Developers Documentation
Loading...
Searching...
No Matches
componenteditorwidget.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_EDITOR_COMPONENTEDITORWIDGET_H
21#define LIBREPCB_EDITOR_COMPONENTEDITORWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../cat/categorylisteditorwidget.h"
27#include "../editorwidgetbase.h"
29
31
32#include <QtCore>
33#include <QtWidgets>
34
35#include <memory>
36
37/*******************************************************************************
38 * Namespace / Forward Declarations
39 ******************************************************************************/
40namespace librepcb {
41
42class Component;
43
44namespace editor {
45
46class ComponentSymbolVariantEditDialog;
47
48namespace Ui {
49class ComponentEditorWidget;
50}
51
52/*******************************************************************************
53 * Class ComponentEditorWidget
54 ******************************************************************************/
55
60 : public EditorWidgetBase,
62 Q_OBJECT
63
64public:
65 // Constructors / Destructor
68 ComponentEditorWidget(const Context& context, const FilePath& fp,
69 QWidget* parent = nullptr);
70 ~ComponentEditorWidget() noexcept;
71
72 // Getters
73 QSet<Feature> getAvailableFeatures() const noexcept override;
74
75 // Operator Overloadings
76 ComponentEditorWidget& operator=(const ComponentEditorWidget& rhs) = delete;
77
78public slots:
79 bool save() noexcept override;
80
81private: // Methods
82 void updateMetadata() noexcept;
83 QString commitMetadata() noexcept;
85 std::shared_ptr<ComponentSymbolVariant> variant) noexcept override;
86 void memorizeComponentInterface() noexcept;
87 bool isInterfaceBroken() const noexcept override;
88 bool runChecks(RuleCheckMessageList& msgs) const override;
89 template <typename MessageType>
90 void fixMsg(const MessageType& msg);
91 template <typename MessageType>
92 bool fixMsgHelper(std::shared_ptr<const RuleCheckMessage> msg, bool applyFix);
93 bool processRuleCheckMessage(std::shared_ptr<const RuleCheckMessage> msg,
94 bool applyFix) override;
95 void ruleCheckApproveRequested(std::shared_ptr<const RuleCheckMessage> msg,
96 bool approve) noexcept override;
97
98private: // Data
99 QScopedPointer<Ui::ComponentEditorWidget> mUi;
102
103 // broken interface detection
107};
108
109/*******************************************************************************
110 * End of File
111 ******************************************************************************/
112
113} // namespace editor
114} // namespace librepcb
115
116#endif
The Component class represents a "generic" device in the library.
Definition component.h:73
The ComponentSymbolVariant class represents a symbol variant of a component.
Definition componentsymbolvariant.h:53
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The RuleCheckMessage class.
Definition rulecheckmessage.h:45
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The CategoryListEditorWidget class.
Definition categorylisteditorwidget.h:54
The ComponentEditorWidget class.
Definition componenteditorwidget.h:61
bool save() noexcept override
Definition componenteditorwidget.cpp:167
ComponentEditorWidget(const ComponentEditorWidget &other)=delete
void updateMetadata() noexcept
Definition componenteditorwidget.cpp:195
void ruleCheckApproveRequested(std::shared_ptr< const RuleCheckMessage > msg, bool approve) noexcept override
Definition componenteditorwidget.cpp:422
QScopedPointer< CategoryListEditorWidget > mCategoriesEditorWidget
Definition componenteditorwidget.h:100
bool openComponentSymbolVariantEditor(std::shared_ptr< ComponentSymbolVariant > variant) noexcept override
Definition componenteditorwidget.cpp:274
QSet< Uuid > mOriginalSignalUuids
Definition componenteditorwidget.h:105
std::shared_ptr< Component > mComponent
Definition componenteditorwidget.h:101
ComponentSymbolVariantList mOriginalSymbolVariants
Definition componenteditorwidget.h:106
void fixMsg(const MessageType &msg)
bool mOriginalIsSchematicOnly
Definition componenteditorwidget.h:104
QString commitMetadata() noexcept
Definition componenteditorwidget.cpp:217
bool fixMsgHelper(std::shared_ptr< const RuleCheckMessage > msg, bool applyFix)
Definition componenteditorwidget.cpp:397
bool isInterfaceBroken() const noexcept override
Definition componenteditorwidget.cpp:288
QSet< Feature > getAvailableFeatures() const noexcept override
Definition componenteditorwidget.cpp:156
QScopedPointer< Ui::ComponentEditorWidget > mUi
Definition componenteditorwidget.h:99
bool runChecks(RuleCheckMessageList &msgs) const override
Definition componenteditorwidget.cpp:322
~ComponentEditorWidget() noexcept
Definition componenteditorwidget.cpp:146
void memorizeComponentInterface() noexcept
Definition componenteditorwidget.cpp:282
bool processRuleCheckMessage(std::shared_ptr< const RuleCheckMessage > msg, bool applyFix) override
Definition componenteditorwidget.cpp:408
The EditorWidgetBase class.
Definition editorwidgetbase.h:61
Feature
Definition editorwidgetbase.h:95
The IF_ComponentSymbolVariantEditorProvider interface.
Definition if_componentsymbolvarianteditorprovider.h:46
Definition occmodel.cpp:76
QVector< std::shared_ptr< const RuleCheckMessage > > RuleCheckMessageList
Definition rulecheckmessage.h:104
Definition uuid.h:186
Definition editorwidgetbase.h:67