LibrePCB Developers Documentation
packagecategoryeditorwidget.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_PACKAGECATEGORYEDITORWIDGET_H
21#define LIBREPCB_EDITOR_PACKAGECATEGORYEDITORWIDGET_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.hpp>
35
36/*******************************************************************************
37 * Namespace / Forward Declarations
38 ******************************************************************************/
39namespace librepcb {
40
41class PackageCategory;
42
43namespace editor {
44
45namespace Ui {
46class PackageCategoryEditorWidget;
47}
48
49/*******************************************************************************
50 * Class PackageCategoryEditorWidget
51 ******************************************************************************/
52
57 Q_OBJECT
58
59public:
60 // Constructors / Destructor
63 delete;
64 PackageCategoryEditorWidget(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 PackageCategoryEditorWidget& 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
96 QScopedPointer<Ui::PackageCategoryEditorWidget> mUi;
97 std::unique_ptr<PackageCategory> mCategory;
98 tl::optional<Uuid> mParentUuid;
99};
100
101/*******************************************************************************
102 * End of File
103 ******************************************************************************/
104
105} // namespace editor
106} // namespace librepcb
107
108#endif
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
The PackageCategory class.
Definition: packagecategory.h:44
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The EditorWidgetBase class.
Definition: editorwidgetbase.h:62
Feature
Definition: editorwidgetbase.h:96
The PackageCategoryEditorWidget class.
Definition: packagecategoryeditorwidget.h:56
std::unique_ptr< PackageCategory > mCategory
Definition: packagecategoryeditorwidget.h:97
bool save() noexcept override
Definition: packagecategoryeditorwidget.cpp:111
void updateMetadata() noexcept
Definition: packagecategoryeditorwidget.cpp:138
~PackageCategoryEditorWidget() noexcept
Definition: packagecategoryeditorwidget.cpp:93
void btnChooseParentCategoryClicked() noexcept
Definition: packagecategoryeditorwidget.cpp:227
void ruleCheckApproveRequested(std::shared_ptr< const RuleCheckMessage > msg, bool approve) noexcept override
Definition: packagecategoryeditorwidget.cpp:221
PackageCategoryEditorWidget(const PackageCategoryEditorWidget &other)=delete
void updateCategoryLabel() noexcept
Definition: packagecategoryeditorwidget.cpp:241
void btnResetParentCategoryClicked() noexcept
Definition: packagecategoryeditorwidget.cpp:236
tl::optional< Uuid > mParentUuid
Definition: packagecategoryeditorwidget.h:98
QString commitMetadata() noexcept
Definition: packagecategoryeditorwidget.cpp:152
bool fixMsgHelper(std::shared_ptr< const RuleCheckMessage > msg, bool applyFix)
Definition: packagecategoryeditorwidget.cpp:203
bool isInterfaceBroken() const noexcept override
Definition: packagecategoryeditorwidget.h:81
QScopedPointer< Ui::PackageCategoryEditorWidget > mUi
Definition: packagecategoryeditorwidget.h:96
QSet< Feature > getAvailableFeatures() const noexcept override
Definition: packagecategoryeditorwidget.cpp:101
bool runChecks(RuleCheckMessageList &msgs) const override
Definition: packagecategoryeditorwidget.cpp:183
bool processRuleCheckMessage(std::shared_ptr< const RuleCheckMessage > msg, bool applyFix) override
Definition: packagecategoryeditorwidget.cpp:214
Definition: occmodel.cpp:77
QVector< std::shared_ptr< const RuleCheckMessage > > RuleCheckMessageList
Definition: rulecheckmessage.h:104
Definition: uuid.h:183
Definition: editorwidgetbase.h:68