LibrePCB Developers Documentation
Loading...
Searching...
No Matches
organizationtab.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_ORGANIZATIONTAB_H
21#define LIBREPCB_EDITOR_ORGANIZATIONTAB_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../libraryeditortab.h"
27
32
33#include <QtCore>
34
35/*******************************************************************************
36 * Namespace / Forward Declarations
37 ******************************************************************************/
38namespace librepcb {
39
40class Organization;
41class Project;
42
43namespace editor {
44
45class CmdOrganizationEdit;
46class OrganizationPcbDesignRulesModel;
47
48/*******************************************************************************
49 * Class OrganizationTab
50 ******************************************************************************/
51
55class OrganizationTab final : public LibraryEditorTab {
56 Q_OBJECT
57
58public:
59 // Signals
61
62 // Types
63 enum class Mode { Open, New, Duplicate };
64
65 // Constructors / Destructor
66 OrganizationTab() = delete;
67 OrganizationTab(const OrganizationTab& other) = delete;
68 explicit OrganizationTab(LibraryEditor& editor,
69 std::unique_ptr<Organization> cat, Mode mode,
70 QObject* parent = nullptr) noexcept;
71 ~OrganizationTab() noexcept;
72
73 // General Methods
74 FilePath getDirectoryPath() const noexcept override;
75 ui::TabData getUiData() const noexcept override;
76 ui::OrganizationTabData getDerivedUiData() const noexcept;
77 void setDerivedUiData(const ui::OrganizationTabData& data) noexcept;
78 void trigger(ui::TabAction a) noexcept override;
79 bool requestClose() noexcept override;
80
81 // Operator Overloadings
82 OrganizationTab& operator=(const OrganizationTab& rhs) = delete;
83
84protected:
85 std::optional<std::pair<RuleCheckMessageList, QSet<SExpression>>>
86 runChecksImpl() override;
87 bool autoFixImpl(const std::shared_ptr<const RuleCheckMessage>& msg,
88 bool checkOnly) override;
89 template <typename MessageType>
90 bool autoFixHelper(const std::shared_ptr<const RuleCheckMessage>& msg,
91 bool checkOnly);
92 template <typename MessageType>
93 bool autoFix(const MessageType& msg);
94 void messageApprovalChanged(const SExpression& approval,
95 bool approved) noexcept override;
96 void notifyDerivedUiDataChanged() noexcept override;
97
98private:
99 bool isWritable() const noexcept;
100 void refreshUiData() noexcept;
101 void commitUiData() noexcept;
102 bool save() noexcept;
104 const OutputJobList& jobs,
105 void (CmdOrganizationEdit::*setter)(const OutputJobList& jobs)) noexcept;
107
108private:
109 // References
111
112 // Library metadata to be applied
113 QByteArray mLogo;
114 slint::SharedString mName;
115 slint::SharedString mNameError;
117 slint::SharedString mDescription;
118 slint::SharedString mKeywords;
119 slint::SharedString mAuthor;
120 slint::SharedString mVersion;
121 slint::SharedString mVersionError;
124 slint::SharedString mUrl;
125 slint::SharedString mUrlError;
128
129 // Cached
130 std::unique_ptr<Project> mTmpProject;
131};
132
133/*******************************************************************************
134 * End of File
135 ******************************************************************************/
136
137} // namespace editor
138} // namespace librepcb
139
140#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The Organization class represents a PCB manufacturer, assembly house etc.
Definition organization.h:47
The Project class represents a whole (opened) project with all its content.
Definition project.h:71
The RuleCheckMessage class.
Definition rulecheckmessage.h:45
The SExpression class.
Definition sexpression.h:69
The Signal class is used to emit signals on non-QObject derived classes.
Definition signalslot.h:65
The Version class represents a version number in the format "1.42.7".
Definition version.h:58
The CmdOrganizationEdit class.
Definition cmdorganizationedit.h:49
The LibraryEditor class.
Definition libraryeditor.h:56
Specialized base class for all library editor tabs.
Definition libraryeditortab.h:55
The OrganizationPcbDesignRulesModel class.
Definition organizationpcbdesignrulesmodel.h:54
The OrganizationTab class.
Definition organizationtab.h:55
slint::SharedString mVersionError
Definition organizationtab.h:121
bool requestClose() noexcept override
Request to close the tab.
Definition organizationtab.cpp:283
std::optional< std::pair< RuleCheckMessageList, QSet< SExpression > > > runChecksImpl() override
Definition organizationtab.cpp:311
bool save() noexcept
Definition organizationtab.cpp:430
std::unique_ptr< Organization > mOrganization
Definition organizationtab.h:110
slint::SharedString mName
Definition organizationtab.h:114
QByteArray mLogo
Definition organizationtab.h:113
slint::SharedString mDescription
Definition organizationtab.h:117
Mode
Definition organizationtab.h:63
int mPriority
Definition organizationtab.h:126
slint::SharedString mVersion
Definition organizationtab.h:120
OrganizationTab(const OrganizationTab &other)=delete
bool mDeprecated
Definition organizationtab.h:123
ui::OrganizationTabData getDerivedUiData() const noexcept
Definition organizationtab.cpp:158
void execOutputJobsDialog(const OutputJobList &jobs, void(CmdOrganizationEdit::*setter)(const OutputJobList &jobs)) noexcept
Definition organizationtab.cpp:464
void messageApprovalChanged(const SExpression &approval, bool approved) noexcept override
Definition organizationtab.cpp:338
bool autoFixImpl(const std::shared_ptr< const RuleCheckMessage > &msg, bool checkOnly) override
Definition organizationtab.cpp:316
FilePath getDirectoryPath() const noexcept override
Definition organizationtab.cpp:132
bool autoFixHelper(const std::shared_ptr< const RuleCheckMessage > &msg, bool checkOnly)
Definition organizationtab.cpp:324
Version mVersionParsed
Definition organizationtab.h:122
void commitUiData() noexcept
Definition organizationtab.cpp:399
bool autoFix(const MessageType &msg)
Signal< OrganizationTab > onDerivedUiDataChanged
Definition organizationtab.h:60
slint::SharedString mNameError
Definition organizationtab.h:115
slint::SharedString mKeywords
Definition organizationtab.h:118
void setDerivedUiData(const ui::OrganizationTabData &data) noexcept
Definition organizationtab.cpp:189
void trigger(ui::TabAction a) noexcept override
Definition organizationtab.cpp:211
Project & getTmpProject()
Definition organizationtab.cpp:483
void notifyDerivedUiDataChanged() noexcept override
Definition organizationtab.cpp:348
slint::SharedString mUrl
Definition organizationtab.h:124
ElementName mNameParsed
Definition organizationtab.h:116
slint::SharedString mAuthor
Definition organizationtab.h:119
bool isWritable() const noexcept
Definition organizationtab.cpp:375
ui::TabData getUiData() const noexcept override
Definition organizationtab.cpp:136
slint::SharedString mUrlError
Definition organizationtab.h:125
std::shared_ptr< OrganizationPcbDesignRulesModel > mPcbDesignRules
Definition organizationtab.h:127
std::unique_ptr< Project > mTmpProject
Definition organizationtab.h:130
void refreshUiData() noexcept
Definition organizationtab.cpp:379
Definition occmodel.cpp:77
QVector< std::shared_ptr< const RuleCheckMessage > > RuleCheckMessageList
Definition rulecheckmessage.h:104
type_safe::constrained_type< QString, ElementNameConstraint, ElementNameVerifier > ElementName
Definition elementname.h:84
Definition uuid.h:186