LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
librarylisteditorwidget.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_LIBRARYLISTEDITORWIDGET_H
21 #define LIBREPCB_LIBRARY_EDITOR_LIBRARYLISTEDITORWIDGET_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include <librepcb/common/uuid.h>
27 
28 #include <QtCore>
29 #include <QtWidgets>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 namespace workspace {
37 class Workspace;
38 }
39 
40 namespace library {
41 namespace editor {
42 
43 namespace Ui {
44 class LibraryListEditorWidget;
45 }
46 
47 /*******************************************************************************
48  * Class LibraryListEditorWidget
49  ******************************************************************************/
50 
54 class LibraryListEditorWidget final : public QWidget {
55  Q_OBJECT
56 
57 public:
58  // Constructors / Destructor
59  LibraryListEditorWidget() = delete;
61  QWidget* parent = nullptr) noexcept;
62  LibraryListEditorWidget(const LibraryListEditorWidget& other) = delete;
63  ~LibraryListEditorWidget() noexcept;
64 
65  // Getters
66  const QSet<Uuid>& getUuids() const noexcept { return mUuids; }
67 
68  // Setters
69  void setUuids(const QSet<Uuid>& uuids) noexcept;
70 
71  // Operator Overloadings
73  delete;
74 
75 private:
76  void btnAddClicked() noexcept;
77  void btnRemoveClicked() noexcept;
78  void addItem(const Uuid& library) noexcept;
79 
80 signals:
81  void edited();
82  void libraryAdded(const Uuid& lib);
83  void libraryRemoved(const Uuid& lib);
84 
85 protected: // Data
86  const workspace::Workspace& mWorkspace;
87  QScopedPointer<Ui::LibraryListEditorWidget> mUi;
88  QSet<Uuid> mUuids;
89  QHash<Uuid, QString> mLibNames;
90 };
91 
92 /*******************************************************************************
93  * End of File
94  ******************************************************************************/
95 
96 } // namespace editor
97 } // namespace library
98 } // namespace librepcb
99 
100 #endif // LIBREPCB_LIBRARY_EDITOR_LIBRARYLISTEDITORWIDGET_H
LibraryListEditorWidget & operator=(const LibraryListEditorWidget &rhs)=delete
const workspace::Workspace & mWorkspace
Definition: librarylisteditorwidget.h:86
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:62
void addItem(const Uuid &library) noexcept
Definition: librarylisteditorwidget.cpp:128
const QSet< Uuid > & getUuids() const noexcept
Definition: librarylisteditorwidget.h:66
QSet< Uuid > mUuids
Definition: librarylisteditorwidget.h:88
The LibraryListEditorWidget class.
Definition: librarylisteditorwidget.h:54
void btnAddClicked() noexcept
Definition: librarylisteditorwidget.cpp:94
void btnRemoveClicked() noexcept
Definition: librarylisteditorwidget.cpp:113
QHash< Uuid, QString > mLibNames
Definition: librarylisteditorwidget.h:89
QScopedPointer< Ui::LibraryListEditorWidget > mUi
Definition: librarylisteditorwidget.h:87
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
void setUuids(const QSet< Uuid > &uuids) noexcept
Definition: librarylisteditorwidget.cpp:84
~LibraryListEditorWidget() noexcept
Definition: librarylisteditorwidget.cpp:77