LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_LIBRARY_EDITOR_COMPONENTEDITORWIDGET_H
21 #define LIBREPCB_LIBRARY_EDITOR_COMPONENTEDITORWIDGET_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../common/categorylisteditorwidget.h"
27 #include "../common/editorwidgetbase.h"
29 
31 
32 #include <QtCore>
33 #include <QtWidgets>
34 
35 /*******************************************************************************
36  * Namespace / Forward Declarations
37  ******************************************************************************/
38 namespace librepcb {
39 namespace library {
40 
41 class Component;
42 
43 namespace editor {
44 
45 class ComponentSymbolVariantEditDialog;
46 
47 namespace Ui {
49 }
50 
51 /*******************************************************************************
52  * Class ComponentEditorWidget
53  ******************************************************************************/
54 
59  : public EditorWidgetBase,
61  Q_OBJECT
62 
63 public:
64  // Constructors / Destructor
65  ComponentEditorWidget() = delete;
66  ComponentEditorWidget(const ComponentEditorWidget& other) = delete;
67  ComponentEditorWidget(const Context& context, const FilePath& fp,
68  QWidget* parent = nullptr);
69  ~ComponentEditorWidget() noexcept;
70 
71  // Operator Overloadings
73 
74 public slots:
75  bool save() noexcept override;
76 
77 private: // Methods
78  void updateMetadata() noexcept;
79  QString commitMetadata() noexcept;
81  ComponentSymbolVariant& variant) noexcept override;
82  void memorizeComponentInterface() noexcept;
83  bool isInterfaceBroken() const noexcept override;
84  bool runChecks(LibraryElementCheckMessageList& msgs) const override;
85  template <typename MessageType>
86  void fixMsg(const MessageType& msg);
87  template <typename MessageType>
88  bool fixMsgHelper(std::shared_ptr<const LibraryElementCheckMessage> msg,
89  bool applyFix);
91  std::shared_ptr<const LibraryElementCheckMessage> msg,
92  bool applyFix) override;
93 
94 private: // Data
95  QScopedPointer<Ui::ComponentEditorWidget> mUi;
96  QScopedPointer<ComponentCategoryListEditorWidget> mCategoriesEditorWidget;
97  QSharedPointer<Component> mComponent;
98 
99  // broken interface detection
103 };
104 
105 /*******************************************************************************
106  * End of File
107  ******************************************************************************/
108 
109 } // namespace editor
110 } // namespace library
111 } // namespace librepcb
112 
113 #endif // LIBREPCB_LIBRARY_EDITOR_COMPONENTEDITORWIDGET_H
void updateMetadata() noexcept
Definition: componenteditorwidget.cpp:151
bool processCheckMessage(std::shared_ptr< const LibraryElementCheckMessage > msg, bool applyFix) override
Definition: componenteditorwidget.cpp:317
QVector< std::shared_ptr< const LibraryElementCheckMessage > > LibraryElementCheckMessageList
Definition: libraryelementcheckmessage.h:96
~ComponentEditorWidget() noexcept
Definition: componenteditorwidget.cpp:117
void memorizeComponentInterface() noexcept
Definition: componenteditorwidget.cpp:210
ComponentEditorWidget & operator=(const ComponentEditorWidget &rhs)=delete
bool fixMsgHelper(std::shared_ptr< const LibraryElementCheckMessage > msg, bool applyFix)
Definition: componenteditorwidget.cpp:306
bool save() noexceptoverride
Definition: componenteditorwidget.cpp:127
The ComponentEditorWidget class.
Definition: componenteditorwidget.h:58
QSet< Uuid > mOriginalSignalUuids
Definition: componenteditorwidget.h:101
QString commitMetadata() noexcept
Definition: componenteditorwidget.cpp:166
QSharedPointer< Component > mComponent
Definition: componenteditorwidget.h:97
QScopedPointer< Ui::ComponentEditorWidget > mUi
Definition: componenteditorwidget.h:95
The IF_ComponentSymbolVariantEditorProvider interface.
Definition: if_componentsymbolvarianteditorprovider.h:45
bool isInterfaceBroken() const noexceptoverride
Definition: componenteditorwidget.cpp:216
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
bool openComponentSymbolVariantEditor(ComponentSymbolVariant &variant) noexceptoverride
Definition: componenteditorwidget.cpp:203
bool mOriginalIsSchematicOnly
Definition: componenteditorwidget.h:100
QScopedPointer< ComponentCategoryListEditorWidget > mCategoriesEditorWidget
Definition: componenteditorwidget.h:96
The ComponentSymbolVariant class represents a symbol variant of a component.
Definition: componentsymbolvariant.h:58
bool runChecks(LibraryElementCheckMessageList &msgs) const override
Definition: componenteditorwidget.cpp:250
ComponentSymbolVariantList mOriginalSymbolVariants
Definition: componenteditorwidget.h:102
The EditorWidgetBase class.
Definition: editorwidgetbase.h:62