LibrePCB Developers Documentation
Loading...
Searching...
No Matches
organizationpcbdesignrulesmodel.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_ORGANIZATIONPCBDESIGNRULESMODEL_H
21#define LIBREPCB_EDITOR_ORGANIZATIONPCBDESIGNRULESMODEL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "appwindow.h"
27
29
30#include <QtCore>
31
32#include <functional>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class Organization;
40
41namespace editor {
42
43class UndoStack;
44
45/*******************************************************************************
46 * Class OrganizationPcbDesignRulesModel
47 ******************************************************************************/
48
53 : public QObject,
54 public slint::Model<ui::OrganizationPcbDesignRulesData> {
55 Q_OBJECT
56
57public:
58 // Constructors / Destructor
59 // OrganizationPcbDesignRulesModel() = delete;
61 const OrganizationPcbDesignRulesModel& other) = delete;
62 explicit OrganizationPcbDesignRulesModel(QObject* parent = nullptr) noexcept;
64
65 // General Methods
66 void setReferences(
67 Organization* organization, UndoStack* stack,
68 std::function<void(OrganizationPcbDesignRules&)> editCallback) noexcept;
69 void addItem() noexcept;
70
71 // Implementations
72 std::size_t row_count() const override;
73 std::optional<ui::OrganizationPcbDesignRulesData> row_data(
74 std::size_t i) const override;
75 void set_row_data(
76 std::size_t i,
77 const ui::OrganizationPcbDesignRulesData& data) noexcept override;
78
79 // Operator Overloadings
81 const OrganizationPcbDesignRulesModel& rhs) = delete;
82
83private:
84 void refresh() noexcept;
85 void trigger(int index, const Uuid& uuid,
86 ui::OrganizationPcbDesignRulesAction a) noexcept;
87 void setList(const QVector<OrganizationPcbDesignRules>& list);
88 QString askForName(const QString& defaultValue) const;
89
90private:
94};
95
96/*******************************************************************************
97 * End of File
98 ******************************************************************************/
99
100} // namespace editor
101} // namespace librepcb
102
103#endif
The Organization class represents a PCB manufacturer, assembly house etc.
Definition organization.h:47
The OrganizationPcbDesignRules class.
Definition organizationpcbdesignrules.h:43
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
The OrganizationPcbDesignRulesModel class.
Definition organizationpcbdesignrulesmodel.h:54
QString askForName(const QString &defaultValue) const
Definition organizationpcbdesignrulesmodel.cpp:198
std::function< void(OrganizationPcbDesignRules &)> mEditCallback
Definition organizationpcbdesignrulesmodel.h:93
void trigger(int index, const Uuid &uuid, ui::OrganizationPcbDesignRulesAction a) noexcept
Definition organizationpcbdesignrulesmodel.cpp:150
void addItem() noexcept
Definition organizationpcbdesignrulesmodel.cpp:80
void refresh() noexcept
Definition organizationpcbdesignrulesmodel.cpp:146
void setReferences(Organization *organization, UndoStack *stack, std::function< void(OrganizationPcbDesignRules &)> editCallback) noexcept
Definition organizationpcbdesignrulesmodel.cpp:56
std::size_t row_count() const override
Definition organizationpcbdesignrulesmodel.cpp:101
OrganizationPcbDesignRulesModel(const OrganizationPcbDesignRulesModel &other)=delete
QPointer< UndoStack > mUndoStack
Definition organizationpcbdesignrulesmodel.h:92
void setList(const QVector< OrganizationPcbDesignRules > &list)
Definition organizationpcbdesignrulesmodel.cpp:190
void set_row_data(std::size_t i, const ui::OrganizationPcbDesignRulesData &data) noexcept override
Definition organizationpcbdesignrulesmodel.cpp:122
QPointer< Organization > mOrganization
Definition organizationpcbdesignrulesmodel.h:91
std::optional< ui::OrganizationPcbDesignRulesData > row_data(std::size_t i) const override
Definition organizationpcbdesignrulesmodel.cpp:106
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition undostack.h:106
Definition occmodel.cpp:77
Definition uuid.h:186