LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
addlibrarywidget.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_ADDLIBRARYWIDGET_H
21 #define LIBREPCB_WORKSPACE_ADDLIBRARYWIDGET_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 
29 #include <QtCore>
30 #include <QtWidgets>
31 
32 /*******************************************************************************
33  * Namespace / Forward Declarations
34  ******************************************************************************/
35 namespace librepcb {
36 
37 namespace workspace {
38 class Workspace;
39 }
40 
41 namespace library {
42 namespace manager {
43 
44 class LibraryDownload;
45 
46 namespace Ui {
47 class AddLibraryWidget;
48 }
49 
50 /*******************************************************************************
51  * Class AddLibraryWidget
52  ******************************************************************************/
53 
60 class AddLibraryWidget final : public QWidget {
61  Q_OBJECT
62 
63 public:
64  // Constructors / Destructor
65  AddLibraryWidget() noexcept;
66  AddLibraryWidget(const AddLibraryWidget& other) = delete;
67  explicit AddLibraryWidget(workspace::Workspace& ws) noexcept;
68  ~AddLibraryWidget() noexcept;
69 
70  // General Methods
71  void updateRepositoryLibraryList() noexcept;
72 
73  // Operator Overloadings
74  AddLibraryWidget& operator=(const AddLibraryWidget& rhs) = delete;
75 
76 signals:
77  void libraryAdded(const FilePath& libDir);
78 
79 private: // Methods
80  void localLibraryNameLineEditTextChanged(QString name) noexcept;
81  void downloadZipUrlLineEditTextChanged(QString urlStr) noexcept;
82  void createLocalLibraryButtonClicked() noexcept;
83  void downloadZippedLibraryButtonClicked() noexcept;
84  void downloadZipFinished(bool success, const QString& errMsg) noexcept;
85  void repositoryLibraryListReceived(const QJsonArray& libs) noexcept;
86  void errorWhileFetchingLibraryList(const QString& errorMsg) noexcept;
87  void clearRepositoryLibraryList() noexcept;
88  void repoLibraryDownloadCheckedChanged(bool checked) noexcept;
90 
91  static QString getTextOrPlaceholderFromQLineEdit(QLineEdit* edit,
92  bool isFilename) noexcept;
93 
94 private: // Data
96  QScopedPointer<Ui::AddLibraryWidget> mUi;
97  QScopedPointer<LibraryDownload> mManualLibraryDownload;
98  QList<QMetaObject::Connection> mLibraryDownloadConnections;
99 };
100 
101 /*******************************************************************************
102  * End of File
103  ******************************************************************************/
104 
105 } // namespace manager
106 } // namespace library
107 } // namespace librepcb
108 
109 #endif // LIBREPCB_WORKSPACE_ADDLIBRARYWIDGET_H
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:65
workspace::Workspace & mWorkspace
Definition: addlibrarywidget.h:95
QList< QMetaObject::Connection > mLibraryDownloadConnections
Definition: addlibrarywidget.h:98
void errorWhileFetchingLibraryList(const QString &errorMsg) noexcept
Definition: addlibrarywidget.cpp:363
void createLocalLibraryButtonClicked() noexcept
Definition: addlibrarywidget.cpp:141
void updateRepositoryLibraryList() noexcept
Definition: addlibrarywidget.cpp:94
void repoLibraryDownloadCheckedChanged(bool checked) noexcept
Definition: addlibrarywidget.cpp:384
void downloadZipFinished(bool success, const QString &errMsg) noexcept
Definition: addlibrarywidget.cpp:329
void localLibraryNameLineEditTextChanged(QString name) noexcept
Definition: addlibrarywidget.cpp:114
~AddLibraryWidget() noexcept
Definition: addlibrarywidget.cpp:86
static QString getTextOrPlaceholderFromQLineEdit(QLineEdit *edit, bool isFilename) noexcept
Definition: addlibrarywidget.cpp:450
void libraryAdded(const FilePath &libDir)
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:130
void clearRepositoryLibraryList() noexcept
Definition: addlibrarywidget.cpp:370
The AddLibraryWidget class.
Definition: addlibrarywidget.h:60
void downloadLibrariesFromRepositoryButtonClicked() noexcept
Definition: addlibrarywidget.cpp:432
QScopedPointer< Ui::AddLibraryWidget > mUi
Definition: addlibrarywidget.h:96
void downloadZippedLibraryButtonClicked() noexcept
Definition: addlibrarywidget.cpp:273
void repositoryLibraryListReceived(const QJsonArray &libs) noexcept
Definition: addlibrarywidget.cpp:350
AddLibraryWidget & operator=(const AddLibraryWidget &rhs)=delete
QScopedPointer< LibraryDownload > mManualLibraryDownload
Definition: addlibrarywidget.h:97
void downloadZipUrlLineEditTextChanged(QString urlStr) noexcept
Definition: addlibrarywidget.cpp:123