LibrePCB Developers Documentation
Loading...
Searching...
No Matches
componentcategoryeditorwidget.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_COMPONENTCATEGORYEDITORWIDGET_H
21#define LIBREPCB_EDITOR_COMPONENTCATEGORYEDITORWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../editorwidgetbase.h"
27
29
30#include <QtCore>
31#include <QtWidgets>
32
33#include <memory>
34#include <optional>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class ComponentCategory;
42
43namespace editor {
44
45namespace Ui {
46class ComponentCategoryEditorWidget;
47}
48
49/*******************************************************************************
50 * Class ComponentCategoryEditorWidget
51 ******************************************************************************/
52
57 Q_OBJECT
58
59public:
60 // Constructors / Destructor
63 delete;
64 ComponentCategoryEditorWidget(const Context& context, const FilePath& fp,
65 QWidget* parent = nullptr);
67
68 // Getters
69 QSet<Feature> getAvailableFeatures() const noexcept override;
70
71 // Operator Overloadings
73 const ComponentCategoryEditorWidget& rhs) = delete;
74
75public slots:
76 bool save() noexcept override;
77
78private: // Methods
79 void updateMetadata() noexcept;
80 QString commitMetadata() noexcept;
81 bool isInterfaceBroken() const noexcept override { return false; }
82 bool runChecks(RuleCheckMessageList& msgs) const override;
83 template <typename MessageType>
84 void fixMsg(const MessageType& msg);
85 template <typename MessageType>
86 bool fixMsgHelper(std::shared_ptr<const RuleCheckMessage> msg, bool applyFix);
87 bool processRuleCheckMessage(std::shared_ptr<const RuleCheckMessage> msg,
88 bool applyFix) override;
89 void ruleCheckApproveRequested(std::shared_ptr<const RuleCheckMessage> msg,
90 bool approve) noexcept override;
91 void btnChooseParentCategoryClicked() noexcept;
92 void btnResetParentCategoryClicked() noexcept;
93 void updateCategoryLabel() noexcept;
94
95private: // Data
98 std::optional<Uuid> mParentUuid;
99};
100
101/*******************************************************************************
102 * End of File
103 ******************************************************************************/
104
105} // namespace editor
106} // namespace librepcb
107
108#endif
The ComponentCategory class.
Definition componentcategory.h:44
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The ComponentCategoryEditorWidget class.
Definition componentcategoryeditorwidget.h:56
bool save() noexcept override
Definition componentcategoryeditorwidget.cpp:111
void updateMetadata() noexcept
Definition componentcategoryeditorwidget.cpp:138
void btnChooseParentCategoryClicked() noexcept
Definition componentcategoryeditorwidget.cpp:228
std::unique_ptr< ComponentCategory > mCategory
Definition componentcategoryeditorwidget.h:97
void ruleCheckApproveRequested(std::shared_ptr< const RuleCheckMessage > msg, bool approve) noexcept override
Definition componentcategoryeditorwidget.cpp:222
ComponentCategoryEditorWidget(const ComponentCategoryEditorWidget &other)=delete
void updateCategoryLabel() noexcept
Definition componentcategoryeditorwidget.cpp:242
QScopedPointer< Ui::ComponentCategoryEditorWidget > mUi
Definition componentcategoryeditorwidget.h:96
void btnResetParentCategoryClicked() noexcept
Definition componentcategoryeditorwidget.cpp:237
~ComponentCategoryEditorWidget() noexcept
Definition componentcategoryeditorwidget.cpp:93
std::optional< Uuid > mParentUuid
Definition componentcategoryeditorwidget.h:98
QString commitMetadata() noexcept
Definition componentcategoryeditorwidget.cpp:152
bool fixMsgHelper(std::shared_ptr< const RuleCheckMessage > msg, bool applyFix)
Definition componentcategoryeditorwidget.cpp:204
bool isInterfaceBroken() const noexcept override
Definition componentcategoryeditorwidget.h:81
QSet< Feature > getAvailableFeatures() const noexcept override
Definition componentcategoryeditorwidget.cpp:101
bool runChecks(RuleCheckMessageList &msgs) const override
Definition componentcategoryeditorwidget.cpp:183
bool processRuleCheckMessage(std::shared_ptr< const RuleCheckMessage > msg, bool applyFix) override
Definition componentcategoryeditorwidget.cpp:215
The EditorWidgetBase class.
Definition editorwidgetbase.h:61
Feature
Definition editorwidgetbase.h:95
Definition occmodel.cpp:76
QVector< std::shared_ptr< const RuleCheckMessage > > RuleCheckMessageList
Definition rulecheckmessage.h:104
Definition uuid.h:186
Definition editorwidgetbase.h:67