LibrePCB Developers Documentation
renamenetsegmentdialog.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_RENAMENETSEGMENTDIALOG_H
21 #define LIBREPCB_EDITOR_RENAMENETSEGMENTDIALOG_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include <QtCore>
27 #include <QtWidgets>
28 
29 /*******************************************************************************
30  * Namespace / Forward Declarations
31  ******************************************************************************/
32 namespace librepcb {
33 
34 class NetSignal;
35 class SI_NetSegment;
36 
37 namespace editor {
38 
39 class UndoStack;
40 
41 namespace Ui {
42 class RenameNetSegmentDialog;
43 }
44 
45 /*******************************************************************************
46  * Class RenameNetSegmentDialog
47  ******************************************************************************/
48 
52 class RenameNetSegmentDialog final : public QDialog {
53  Q_OBJECT
54 
55  enum class Action {
56  NONE,
57  INVALID_NAME,
58  RENAME_NETSIGNAL,
59  MERGE_NETSIGNALS,
60  MOVE_NETSEGMENT_TO_EXISTING_NET,
61  MOVE_NETSEGMENT_TO_NEW_NET,
62  };
63 
64 public:
65  // Constructors / Destructor
66  RenameNetSegmentDialog() = delete;
67  RenameNetSegmentDialog(const RenameNetSegmentDialog& other) = delete;
68  RenameNetSegmentDialog(UndoStack& undoStack, SI_NetSegment& segment,
69  QWidget* parent = nullptr) noexcept;
70  ~RenameNetSegmentDialog() noexcept;
71 
72  // General Methods
73  virtual void accept() noexcept override;
74 
75  // Operator Overloads
76  RenameNetSegmentDialog& operator=(const RenameNetSegmentDialog& rhs) = delete;
77 
78 private: // Methods
79  void updateAction() noexcept;
80 
81 private: // Data
84  QScopedPointer<Ui::RenameNetSegmentDialog> mUi;
86  QString mNewNetName;
88 };
89 
90 /*******************************************************************************
91  * End of File
92  ******************************************************************************/
93 
94 } // namespace editor
95 } // namespace librepcb
96 
97 #endif
QString mNewNetName
Definition: renamenetsegmentdialog.h:86
UndoStack & mUndoStack
Definition: renamenetsegmentdialog.h:82
Definition: occmodel.cpp:77
SI_NetSegment & mNetSegment
Definition: renamenetsegmentdialog.h:83
QScopedPointer< Ui::RenameNetSegmentDialog > mUi
Definition: renamenetsegmentdialog.h:84
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:106
NetSignal * mNewNetSignal
Definition: renamenetsegmentdialog.h:87
The RenameNetSegmentDialog class.
Definition: renamenetsegmentdialog.h:52
Action mAction
Definition: renamenetsegmentdialog.h:85
Action
Definition: renamenetsegmentdialog.h:55
The NetSignal class.
Definition: netsignal.h:50
The SI_NetSegment class.
Definition: si_netsegment.h:53