LibrePCB Developers Documentation
padsignalmapeditorwidget.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_PADSIGNALMAPEDITORWIDGET_H
21#define LIBREPCB_EDITOR_PADSIGNALMAPEDITORWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
29
30#include <QtCore>
31#include <QtWidgets>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class Workspace;
39
40namespace editor {
41
42class DevicePadSignalMapModel;
43class SortFilterProxyModel;
44class UndoStack;
45
46/*******************************************************************************
47 * Class PadSignalMapEditorWidget
48 ******************************************************************************/
49
53class PadSignalMapEditorWidget final : public QWidget {
54 Q_OBJECT
55
56public:
57 // Constructors / Destructor
58 explicit PadSignalMapEditorWidget(QWidget* parent = nullptr) noexcept;
61
62 // General Methods
63 void setFrameStyle(int style) noexcept;
64 void setReadOnly(bool readOnly) noexcept;
65 void setReferences(UndoStack* undoStack, DevicePadSignalMap* map) noexcept;
66 void setPadList(const PackagePadList& list) noexcept;
67 void setSignalList(const ComponentSignalList& list) noexcept;
68
69 // Inherited Methods
70 bool eventFilter(QObject* watched, QEvent* event) noexcept override;
71
72 // Operator Overloadings
74 delete;
75
76signals:
77 void statusTipChanged(const QString& statusTip);
78
79protected:
80 void resizeEvent(QResizeEvent* e) noexcept override;
81 void keyPressEvent(QKeyEvent* e) noexcept override;
82
83private:
85 void updateToolButtonPosition() noexcept;
86 void updateButtonsVisibility() noexcept;
87 void toolButtonClicked() noexcept;
88 void resetAll() noexcept;
89 void autoConnect() noexcept;
90 void loadFromFile() noexcept;
91 void setInteractiveMode(bool enabled) noexcept;
92 void updateInteractiveList(QString filter) noexcept;
93 void commitInteractiveMode(const QListWidgetItem* listItem) noexcept;
94 QMap<Uuid, Uuid> getMap() const noexcept;
95 void setMap(const QString& cmdText, const QMap<Uuid, Uuid>& map);
96 bool hasAutoConnectablePads() const noexcept;
97 bool hasUnconnectedPadsAndUnusedSignals() const noexcept;
98 bool askForResetFirst() noexcept;
99
100private:
105 QScopedPointer<QTableView> mView;
106 QScopedPointer<QFrame> mInteractiveFrame;
107 QScopedPointer<QLabel> mInteractiveLabel1;
108 QScopedPointer<QLabel> mInteractiveLabel2;
109 QScopedPointer<QLineEdit> mInteractiveEdit;
110 QScopedPointer<QToolButton> mInteractiveAbortButton;
111 QScopedPointer<QListWidget> mInteractiveList;
112 QScopedPointer<QToolButton> mToolButton;
113 QScopedPointer<QPushButton> mAutoConnectButton;
114 QScopedPointer<QFrame> mButtonsVLine;
115 QScopedPointer<QPushButton> mInteractiveConnectButton;
116
121};
122
123/*******************************************************************************
124 * End of File
125 ******************************************************************************/
126
127} // namespace editor
128} // namespace librepcb
129
130#endif
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
The DevicePadSignalMapModel class.
Definition: devicepadsignalmapmodel.h:50
The PadSignalMapEditorWidget class.
Definition: padsignalmapeditorwidget.h:53
void autoConnect() noexcept
Definition: padsignalmapeditorwidget.cpp:393
void keyPressEvent(QKeyEvent *e) noexcept override
Definition: padsignalmapeditorwidget.cpp:304
QScopedPointer< QTableView > mView
Definition: padsignalmapeditorwidget.h:105
bool mReadOnly
Definition: padsignalmapeditorwidget.h:101
bool eventFilter(QObject *watched, QEvent *event) noexcept override
Definition: padsignalmapeditorwidget.cpp:259
void updateInteractiveList(QString filter) noexcept
Definition: padsignalmapeditorwidget.cpp:513
void setReferences(UndoStack *undoStack, DevicePadSignalMap *map) noexcept
Definition: padsignalmapeditorwidget.cpp:222
ComponentSignalList mSignals
Definition: padsignalmapeditorwidget.h:119
bool askForResetFirst() noexcept
Definition: padsignalmapeditorwidget.cpp:709
void setPadList(const PackagePadList &list) noexcept
Definition: padsignalmapeditorwidget.cpp:232
PadSignalMapEditorWidget(QWidget *parent=nullptr) noexcept
Definition: padsignalmapeditorwidget.cpp:48
QMap< Uuid, Uuid > getMap() const noexcept
Definition: padsignalmapeditorwidget.cpp:647
void setMap(const QString &cmdText, const QMap< Uuid, Uuid > &map)
Definition: padsignalmapeditorwidget.cpp:659
PadSignalMapEditorWidget(const PadSignalMapEditorWidget &other)=delete
~PadSignalMapEditorWidget() noexcept
Definition: padsignalmapeditorwidget.cpp:203
void setInteractiveMode(bool enabled) noexcept
Definition: padsignalmapeditorwidget.cpp:488
void setReadOnly(bool readOnly) noexcept
Definition: padsignalmapeditorwidget.cpp:214
QScopedPointer< QLabel > mInteractiveLabel1
Definition: padsignalmapeditorwidget.h:107
QScopedPointer< QListWidget > mInteractiveList
Definition: padsignalmapeditorwidget.h:111
QScopedPointer< QToolButton > mInteractiveAbortButton
Definition: padsignalmapeditorwidget.h:110
int mInteractiveModePadIndex
Definition: padsignalmapeditorwidget.h:102
DevicePadSignalMap * mPadSignalMap
Definition: padsignalmapeditorwidget.h:117
QScopedPointer< DevicePadSignalMapModel > mModel
Definition: padsignalmapeditorwidget.h:103
void statusTipChanged(const QString &statusTip)
QScopedPointer< QLabel > mInteractiveLabel2
Definition: padsignalmapeditorwidget.h:108
QScopedPointer< QToolButton > mToolButton
Definition: padsignalmapeditorwidget.h:112
void toolButtonClicked() noexcept
Definition: padsignalmapeditorwidget.cpp:358
PackagePadList mPads
Definition: padsignalmapeditorwidget.h:120
bool hasAutoConnectablePads() const noexcept
Definition: padsignalmapeditorwidget.cpp:678
void resetAll() noexcept
Definition: padsignalmapeditorwidget.cpp:383
void loadFromFile() noexcept
Definition: padsignalmapeditorwidget.cpp:420
void scheduleToolButtonPositionUpdate() noexcept
Definition: padsignalmapeditorwidget.cpp:332
void updateToolButtonPosition() noexcept
Definition: padsignalmapeditorwidget.cpp:338
bool hasUnconnectedPadsAndUnusedSignals() const noexcept
Definition: padsignalmapeditorwidget.cpp:693
QScopedPointer< QFrame > mButtonsVLine
Definition: padsignalmapeditorwidget.h:114
void updateButtonsVisibility() noexcept
Definition: padsignalmapeditorwidget.cpp:346
void commitInteractiveMode(const QListWidgetItem *listItem) noexcept
Definition: padsignalmapeditorwidget.cpp:595
QScopedPointer< QPushButton > mAutoConnectButton
Definition: padsignalmapeditorwidget.h:113
QScopedPointer< QFrame > mInteractiveFrame
Definition: padsignalmapeditorwidget.h:106
void setSignalList(const ComponentSignalList &list) noexcept
Definition: padsignalmapeditorwidget.cpp:247
void resizeEvent(QResizeEvent *e) noexcept override
Definition: padsignalmapeditorwidget.cpp:299
QScopedPointer< QLineEdit > mInteractiveEdit
Definition: padsignalmapeditorwidget.h:109
void setFrameStyle(int style) noexcept
Definition: padsignalmapeditorwidget.cpp:210
UndoStack * mUndoStack
Definition: padsignalmapeditorwidget.h:118
QScopedPointer< QPushButton > mInteractiveConnectButton
Definition: padsignalmapeditorwidget.h:115
QScopedPointer< SortFilterProxyModel > mProxy
Definition: padsignalmapeditorwidget.h:104
A QSortFilterProxyModel subclass to implement custom sort behavior.
Definition: sortfilterproxymodel.h:46
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:106
Definition: occmodel.cpp:77