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_PROJECT_EDITOR_RENAMENETSEGMENTDIALOG_H
21 #define LIBREPCB_PROJECT_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 UndoStack;
35 
36 namespace project {
37 
38 class NetSignal;
39 class SI_NetSegment;
40 
41 namespace editor {
42 
43 namespace Ui {
44 class RenameNetSegmentDialog;
45 }
46 
47 /*******************************************************************************
48  * Class RenameNetSegmentDialog
49  ******************************************************************************/
50 
54 class RenameNetSegmentDialog final : public QDialog {
55  Q_OBJECT
56 
57  enum class Action {
58  NONE,
59  INVALID_NAME,
60  RENAME_NETSIGNAL,
61  MERGE_NETSIGNALS,
62  MOVE_NETSEGMENT_TO_EXISTING_NET,
63  MOVE_NETSEGMENT_TO_NEW_NET,
64  };
65 
66 public:
67  // Constructors / Destructor
68  RenameNetSegmentDialog() = delete;
69  RenameNetSegmentDialog(const RenameNetSegmentDialog& other) = delete;
70  RenameNetSegmentDialog(UndoStack& undoStack, SI_NetSegment& segment,
71  QWidget* parent = nullptr) noexcept;
72  ~RenameNetSegmentDialog() noexcept;
73 
74  // General Methods
75  virtual void accept() noexcept override;
76 
77  // Operator Overloads
78  RenameNetSegmentDialog& operator=(const RenameNetSegmentDialog& rhs) = delete;
79 
80 private: // Methods
81  void updateAction() noexcept;
82 
83 private: // Data
86  QScopedPointer<Ui::RenameNetSegmentDialog> mUi;
88  QString mNewNetName;
90 };
91 
92 /*******************************************************************************
93  * End of File
94  ******************************************************************************/
95 
96 } // namespace editor
97 } // namespace project
98 } // namespace librepcb
99 
100 #endif // LIBREPCB_PROJECT_EDITOR_RENAMENETSEGMENTDIALOG_H
Action
Definition: renamenetsegmentdialog.h:57
Definition: mainwindow.h:10
Definition: airwiresbuilder.cpp:32
QString mNewNetName
Definition: renamenetsegmentdialog.h:88
The RenameNetSegmentDialog class.
Definition: renamenetsegmentdialog.h:54
The UndoStack class holds UndoCommand objects and provides undo/redo commands.
Definition: undostack.h:107
UndoStack & mUndoStack
Definition: renamenetsegmentdialog.h:84
NetSignal * mNewNetSignal
Definition: renamenetsegmentdialog.h:89
The SI_NetSegment class.
Definition: si_netsegment.h:55
Action mAction
Definition: renamenetsegmentdialog.h:87
QScopedPointer< Ui::RenameNetSegmentDialog > mUi
Definition: renamenetsegmentdialog.h:86
The NetSignal class.
Definition: netsignal.h:56
SI_NetSegment & mNetSegment
Definition: renamenetsegmentdialog.h:85