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 
57 class AddLibraryWidget final : public QWidget {
58  Q_OBJECT
59 
60 public:
61  // Constructors / Destructor
62  AddLibraryWidget() noexcept;
63  AddLibraryWidget(const AddLibraryWidget& other) = delete;
64  explicit AddLibraryWidget(workspace::Workspace& ws) noexcept;
65  ~AddLibraryWidget() noexcept;
66 
67  // General Methods
68  void updateRepositoryLibraryList() noexcept;
69 
70  // Operator Overloadings
71  AddLibraryWidget& operator=(const AddLibraryWidget& rhs) = delete;
72 
73 signals:
74  void libraryAdded(const FilePath& libDir);
75 
76 private: // Methods
77  void localLibraryNameLineEditTextChanged(QString name) noexcept;
78  void downloadZipUrlLineEditTextChanged(QString urlStr) noexcept;
79  void createLocalLibraryButtonClicked() noexcept;
80  void downloadZippedLibraryButtonClicked() noexcept;
81  void downloadZipFinished(bool success, const QString& errMsg) noexcept;
82  void repositoryLibraryListReceived(const QJsonArray& libs) noexcept;
83  void errorWhileFetchingLibraryList(const QString& errorMsg) noexcept;
84  void clearRepositoryLibraryList() noexcept;
85  void repoLibraryDownloadCheckedChanged(bool checked) noexcept;
87 
88  static QString getTextOrPlaceholderFromQLineEdit(QLineEdit* edit,
89  bool isFilename) noexcept;
90 
91 private: // Data
93  QScopedPointer<Ui::AddLibraryWidget> mUi;
94  QScopedPointer<LibraryDownload> mManualLibraryDownload;
95  QList<QMetaObject::Connection> mLibraryDownloadConnections;
96 };
97 
98 /*******************************************************************************
99  * End of File
100  ******************************************************************************/
101 
102 } // namespace manager
103 } // namespace library
104 } // namespace librepcb
105 
106 #endif // LIBREPCB_WORKSPACE_ADDLIBRARYWIDGET_H
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:62
workspace::Workspace & mWorkspace
Definition: addlibrarywidget.h:92
QList< QMetaObject::Connection > mLibraryDownloadConnections
Definition: addlibrarywidget.h:95
void errorWhileFetchingLibraryList(const QString &errorMsg) noexcept
Definition: addlibrarywidget.cpp:371
void createLocalLibraryButtonClicked() noexcept
Definition: addlibrarywidget.cpp:142
void updateRepositoryLibraryList() noexcept
Definition: addlibrarywidget.cpp:95
void repoLibraryDownloadCheckedChanged(bool checked) noexcept
Definition: addlibrarywidget.cpp:392
void downloadZipFinished(bool success, const QString &errMsg) noexcept
Definition: addlibrarywidget.cpp:334
void localLibraryNameLineEditTextChanged(QString name) noexcept
Definition: addlibrarywidget.cpp:115
~AddLibraryWidget() noexcept
Definition: addlibrarywidget.cpp:87
static QString getTextOrPlaceholderFromQLineEdit(QLineEdit *edit, bool isFilename) noexcept
Definition: addlibrarywidget.cpp:458
void libraryAdded(const FilePath &libDir)
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:127
void clearRepositoryLibraryList() noexcept
Definition: addlibrarywidget.cpp:378
The AddLibraryWidget class.
Definition: addlibrarywidget.h:57
void downloadLibrariesFromRepositoryButtonClicked() noexcept
Definition: addlibrarywidget.cpp:440
QScopedPointer< Ui::AddLibraryWidget > mUi
Definition: addlibrarywidget.h:93
void downloadZippedLibraryButtonClicked() noexcept
Definition: addlibrarywidget.cpp:278
void repositoryLibraryListReceived(const QJsonArray &libs) noexcept
Definition: addlibrarywidget.cpp:355
AddLibraryWidget & operator=(const AddLibraryWidget &rhs)=delete
QScopedPointer< LibraryDownload > mManualLibraryDownload
Definition: addlibrarywidget.h:94
void downloadZipUrlLineEditTextChanged(QString urlStr) noexcept
Definition: addlibrarywidget.cpp:124