LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
librarymanager.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_WORKSPACE_LIBRARYMANAGER_H
21 #define LIBREPCB_WORKSPACE_LIBRARYMANAGER_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
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 
42 class Library;
43 
44 namespace manager {
45 
46 class AddLibraryWidget;
47 class LibraryListWidgetItem;
48 
49 namespace Ui {
50 class LibraryManager;
51 }
52 
53 /*******************************************************************************
54  * Class LibraryManager
55  ******************************************************************************/
56 
63 class LibraryManager final : public QMainWindow {
64  Q_OBJECT
65 
66 public:
67  // Constructors / Destructor
68  LibraryManager() = delete;
69  LibraryManager(const LibraryManager& other) = delete;
70  LibraryManager(workspace::Workspace& ws, QWidget* parent = nullptr) noexcept;
71  ~LibraryManager() noexcept;
72 
73  // General Methods
74  void updateRepositoryLibraryList() noexcept;
75 
76  // Operator Overloadings
77  LibraryManager& operator=(const LibraryManager& rhs) = delete;
78 
79 private: // Methods
80  void closeEvent(QCloseEvent* event) noexcept override;
81  void clearLibraryList() noexcept;
82  void updateLibraryList() noexcept;
83  void currentListItemChanged(QListWidgetItem* current,
84  QListWidgetItem* previous) noexcept;
85  void libraryAddedSlot(const FilePath& libDir) noexcept;
86 
87  static bool widgetsLessThan(const LibraryListWidgetItem* a,
88  const LibraryListWidgetItem* b) noexcept;
89 
90 signals:
91  void openLibraryEditorTriggered(const FilePath& libDir);
92 
93 private: // Data
95  QScopedPointer<Ui::LibraryManager> mUi;
96  QScopedPointer<AddLibraryWidget> mAddLibraryWidget;
97  QWidget* mCurrentWidget;
99 };
100 
101 /*******************************************************************************
102  * End of File
103  ******************************************************************************/
104 
105 } // namespace manager
106 } // namespace library
107 } // namespace librepcb
108 
109 #endif // LIBREPCB_WORKSPACE_LIBRARYMANAGER_H
void libraryAddedSlot(const FilePath &libDir) noexcept
Definition: librarymanager.cpp:205
void clearLibraryList() noexcept
Definition: librarymanager.cpp:107
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:65
The LibraryManager class.
Definition: librarymanager.h:63
The LibraryListWidgetItem class.
Definition: librarylistwidgetitem.h:57
workspace::Workspace & mWorkspace
Definition: librarymanager.h:94
void openLibraryEditorTriggered(const FilePath &libDir)
LibraryManager & operator=(const LibraryManager &rhs)=delete
QWidget * mCurrentWidget
Definition: librarymanager.h:97
QScopedPointer< Ui::LibraryManager > mUi
Definition: librarymanager.h:95
FilePath mSelectedLibrary
Definition: librarymanager.h:98
void closeEvent(QCloseEvent *event) noexceptoverride
Definition: librarymanager.cpp:102
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
void updateLibraryList() noexcept
Definition: librarymanager.cpp:117
QScopedPointer< AddLibraryWidget > mAddLibraryWidget
Definition: librarymanager.h:96
~LibraryManager() noexcept
Definition: librarymanager.cpp:79
void currentListItemChanged(QListWidgetItem *current, QListWidgetItem *previous) noexcept
Definition: librarymanager.cpp:170
static bool widgetsLessThan(const LibraryListWidgetItem *a, const LibraryListWidgetItem *b) noexcept
Definition: librarymanager.cpp:217
void updateRepositoryLibraryList() noexcept
Definition: librarymanager.cpp:94