LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compsymbvarpinsignalmapeditorwidget.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_COMPSYMBVARPINSIGNALMAPEDITORWIDGET_H
21 #define LIBREPCB_LIBRARY_EDITOR_COMPSYMBVARPINSIGNALMAPEDITORWIDGET_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 
29 #include <QtCore>
30 #include <QtWidgets>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 namespace workspace {
38 class Workspace;
39 }
40 
41 namespace library {
42 
43 class Symbol;
44 class ComponentSymbolVariant;
45 
46 namespace editor {
47 
48 /*******************************************************************************
49  * Class CompSymbVarPinSignalMapEditorWidget
50  ******************************************************************************/
51 
58 class CompSymbVarPinSignalMapEditorWidget final : public QWidget {
59  Q_OBJECT
60 
61 private: // Types
62  enum Column {
68  };
69 
70 public:
71  // Constructors / Destructor
73  QWidget* parent = nullptr) noexcept;
75  const CompSymbVarPinSignalMapEditorWidget& other) = delete;
77 
78  // General Methods
79  void setVariant(const workspace::Workspace& ws,
80  const ComponentSignalList& sigs,
81  ComponentSymbolVariant& variant) noexcept;
83 
84  // Operator Overloadings
86  const CompSymbVarPinSignalMapEditorWidget& rhs) = delete;
87 
88 signals:
89  void edited();
90 
91 private: // Slots
92  void currentCellChanged(int currentRow, int currentColumn, int previousRow,
93  int previousColumn) noexcept;
94  void componentSignalChanged(int index) noexcept;
95  void displayTypeChanged(const CmpSigPinDisplayType& dt) noexcept;
96  void btnAutoAssignSignalsClicked() noexcept;
97 
98 private: // Methods
99  void updateTable(tl::optional<Uuid> selItem = tl::nullopt,
100  tl::optional<Uuid> selPin = tl::nullopt) noexcept;
101  void setTableRowContent(int row, const ComponentSymbolVariantItem& item,
102  const ComponentPinSignalMapItem& map, int itemNumber,
103  const Symbol* symbol) noexcept;
104  void setComponentSignal(const Uuid& item, const Uuid& pin,
105  const tl::optional<Uuid>& signal) noexcept;
106  void setDisplayType(const Uuid& item, const Uuid& pin,
107  const CmpSigPinDisplayType& dt) noexcept;
108  int getRowOfTableCellWidget(QObject* obj) const noexcept;
109  tl::optional<Uuid> getItemUuidOfRow(int row) const noexcept;
110  tl::optional<Uuid> getPinUuidOfRow(int row) const noexcept;
111  int getTotalPinCount() const noexcept;
112  const QStringList& getLocaleOrder() const noexcept;
113 
114 private: // Data
115  QTableWidget* mTable;
116  const workspace::Workspace* mWorkspace;
119  tl::optional<Uuid> mSelectedItem;
120  tl::optional<Uuid> mSelectedPin;
121 };
122 
123 /*******************************************************************************
124  * End of File
125  ******************************************************************************/
126 
127 } // namespace editor
128 } // namespace library
129 } // namespace librepcb
130 
131 #endif // LIBREPCB_LIBRARY_EDITOR_COMPSYMBVARPINSIGNALMAPEDITORWIDGET_H
void setComponentSignal(const Uuid &item, const Uuid &pin, const tl::optional< Uuid > &signal) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:291
void componentSignalChanged(int index) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:124
int getTotalPinCount() const noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:334
The CompSymbVarPinSignalMapEditorWidget class.
Definition: compsymbvarpinsignalmapeditorwidget.h:58
void setVariant(const workspace::Workspace &ws, const ComponentSignalList &sigs, ComponentSymbolVariant &variant) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:99
The CmpSigPinDisplayType clas.
Definition: cmpsigpindisplaytype.h:46
QTableWidget * mTable
Definition: compsymbvarpinsignalmapeditorwidget.h:115
Definition: compsymbvarpinsignalmapeditorwidget.h:63
Column
Definition: compsymbvarpinsignalmapeditorwidget.h:62
tl::optional< Uuid > mSelectedPin
Definition: compsymbvarpinsignalmapeditorwidget.h:120
void currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:114
void displayTypeChanged(const CmpSigPinDisplayType &dt) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:138
tl::optional< Uuid > getItemUuidOfRow(int row) const noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:320
const ComponentSignalList * mSignalList
Definition: compsymbvarpinsignalmapeditorwidget.h:117
tl::optional< Uuid > mSelectedItem
Definition: compsymbvarpinsignalmapeditorwidget.h:119
CompSymbVarPinSignalMapEditorWidget(QWidget *parent=nullptr) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:48
CompSymbVarPinSignalMapEditorWidget & operator=(const CompSymbVarPinSignalMapEditorWidget &rhs)=delete
The Symbol class represents the part of a component which is added to schematics. ...
Definition: symbol.h:57
const QStringList & getLocaleOrder() const noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:342
const workspace::Workspace * mWorkspace
Definition: compsymbvarpinsignalmapeditorwidget.h:116
Definition: compsymbvarpinsignalmapeditorwidget.h:67
The ComponentPinSignalMapItem class maps a symbol pin to a component signal.
Definition: componentpinsignalmap.h:55
int getRowOfTableCellWidget(QObject *obj) const noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:311
void setDisplayType(const Uuid &item, const Uuid &pin, const CmpSigPinDisplayType &dt) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:301
void updateTable(tl::optional< Uuid > selItem=tl::nullopt, tl::optional< Uuid > selPin=tl::nullopt) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:177
The ComponentSymbolVariant class represents a symbol variant of a component.
Definition: componentsymbolvariant.h:58
tl::optional< Uuid > getPinUuidOfRow(int row) const noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:327
ComponentSymbolVariant * mSymbolVariant
Definition: compsymbvarpinsignalmapeditorwidget.h:118
void updateVariant() noexcept
Definition: compsymbvarpinsignalmapeditorwidget.h:82
void btnAutoAssignSignalsClicked() noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:149
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The ComponentSymbolVariantItem class represents one symbol of a component symbol variant.
Definition: componentsymbolvariantitem.h:61
void setTableRowContent(int row, const ComponentSymbolVariantItem &item, const ComponentPinSignalMapItem &map, int itemNumber, const Symbol *symbol) noexcept
Definition: compsymbvarpinsignalmapeditorwidget.cpp:226
Definition: compsymbvarpinsignalmapeditorwidget.h:65
Definition: compsymbvarpinsignalmapeditorwidget.h:64