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 
62  : public EditorWidgetBase,
64  Q_OBJECT
65 
66 public:
67  // Constructors / Destructor
68  ComponentEditorWidget() = delete;
69  ComponentEditorWidget(const ComponentEditorWidget& other) = delete;
70  ComponentEditorWidget(const Context& context, const FilePath& fp,
71  QWidget* parent = nullptr);
72  ~ComponentEditorWidget() noexcept;
73 
74  // Operator Overloadings
76 
77 public slots:
78  bool save() noexcept override;
79 
80 private: // Methods
81  void updateMetadata() noexcept;
82  QString commitMetadata() noexcept;
84  ComponentSymbolVariant& variant) noexcept override;
85  void memorizeComponentInterface() noexcept;
86  bool isInterfaceBroken() const noexcept override;
87  bool runChecks(LibraryElementCheckMessageList& msgs) const override;
88  template <typename MessageType>
89  void fixMsg(const MessageType& msg);
90  template <typename MessageType>
91  bool fixMsgHelper(std::shared_ptr<const LibraryElementCheckMessage> msg,
92  bool applyFix);
94  std::shared_ptr<const LibraryElementCheckMessage> msg,
95  bool applyFix) override;
96 
97 private: // Data
98  QScopedPointer<Ui::ComponentEditorWidget> mUi;
99  QScopedPointer<ComponentCategoryListEditorWidget> mCategoriesEditorWidget;
100  QSharedPointer<Component> mComponent;
101 
102  // broken interface detection
106 };
107 
108 /*******************************************************************************
109  * End of File
110  ******************************************************************************/
111 
112 } // namespace editor
113 } // namespace library
114 } // namespace librepcb
115 
116 #endif // LIBREPCB_LIBRARY_EDITOR_COMPONENTEDITORWIDGET_H
void updateMetadata() noexcept
Definition: componenteditorwidget.cpp:146
bool processCheckMessage(std::shared_ptr< const LibraryElementCheckMessage > msg, bool applyFix) override
Definition: componenteditorwidget.cpp:310
QVector< std::shared_ptr< const LibraryElementCheckMessage > > LibraryElementCheckMessageList
Definition: libraryelementcheckmessage.h:96
~ComponentEditorWidget() noexcept
Definition: componenteditorwidget.cpp:114
void memorizeComponentInterface() noexcept
Definition: componenteditorwidget.cpp:207
ComponentEditorWidget & operator=(const ComponentEditorWidget &rhs)=delete
bool fixMsgHelper(std::shared_ptr< const LibraryElementCheckMessage > msg, bool applyFix)
Definition: componenteditorwidget.cpp:299
bool save() noexceptoverride
Definition: componenteditorwidget.cpp:123
The ComponentEditorWidget class.
Definition: componenteditorwidget.h:61
QSet< Uuid > mOriginalSignalUuids
Definition: componenteditorwidget.h:104
QString commitMetadata() noexcept
Definition: componenteditorwidget.cpp:162
QSharedPointer< Component > mComponent
Definition: componenteditorwidget.h:100
QScopedPointer< Ui::ComponentEditorWidget > mUi
Definition: componenteditorwidget.h:98
The IF_ComponentSymbolVariantEditorProvider interface.
Definition: if_componentsymbolvarianteditorprovider.h:48
bool isInterfaceBroken() const noexceptoverride
Definition: componenteditorwidget.cpp:213
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
bool openComponentSymbolVariantEditor(ComponentSymbolVariant &variant) noexceptoverride
Definition: componenteditorwidget.cpp:200
bool mOriginalIsSchematicOnly
Definition: componenteditorwidget.h:103
QScopedPointer< ComponentCategoryListEditorWidget > mCategoriesEditorWidget
Definition: componenteditorwidget.h:99
The ComponentSymbolVariant class represents a symbol variant of a component.
Definition: componentsymbolvariant.h:58
bool runChecks(LibraryElementCheckMessageList &msgs) const override
Definition: componenteditorwidget.cpp:247
ComponentSymbolVariantList mOriginalSymbolVariants
Definition: componenteditorwidget.h:105
The EditorWidgetBase class.
Definition: editorwidgetbase.h:66