LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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_EDITOR_ADDLIBRARYWIDGET_H
21#define LIBREPCB_EDITOR_ADDLIBRARYWIDGET_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29#include <QtWidgets>
30
31#include <memory>
32
33/*******************************************************************************
34 * Namespace / Forward Declarations
35 ******************************************************************************/
36namespace librepcb {
37
38class ApiEndpoint;
39class Workspace;
40
41namespace editor {
42
43class LibraryDownload;
44
45namespace Ui {
46class AddLibraryWidget;
47}
48
49/*******************************************************************************
50 * Class AddLibraryWidget
51 ******************************************************************************/
52
56class AddLibraryWidget final : public QWidget {
57 Q_OBJECT
58
59public:
60 // Constructors / Destructor
61 AddLibraryWidget() = delete;
62 AddLibraryWidget(const AddLibraryWidget& other) = delete;
63 explicit AddLibraryWidget(Workspace& ws) noexcept;
64 ~AddLibraryWidget() noexcept;
65
66 // General Methods
67 void updateOnlineLibraryList() noexcept;
68
69 // Operator Overloadings
70 AddLibraryWidget& operator=(const AddLibraryWidget& rhs) = delete;
71
72signals:
73 void libraryAdded(const FilePath& libDir);
74
75private: // Methods
76 void localLibraryNameLineEditTextChanged(QString name) noexcept;
77 void downloadZipUrlLineEditTextChanged(QString urlStr) noexcept;
78 void createLocalLibraryButtonClicked() noexcept;
80 void downloadZipFinished(bool success, const QString& errMsg) noexcept;
81 void onlineLibraryListReceived(const QJsonArray& libs) noexcept;
82 void errorWhileFetchingLibraryList(const QString& errorMsg) noexcept;
83 void clearOnlineLibraryList() noexcept;
84 void repoLibraryDownloadCheckedChanged(bool checked) noexcept;
86
87 static QString getTextOrPlaceholderFromQLineEdit(QLineEdit* edit,
88 bool isFilename) noexcept;
89
90private: // Data
92 QScopedPointer<Ui::AddLibraryWidget> mUi;
94 QList<std::shared_ptr<ApiEndpoint>> mApiEndpoints;
96};
97
98/*******************************************************************************
99 * End of File
100 ******************************************************************************/
101
102} // namespace editor
103} // namespace librepcb
104
105#endif
Access to a LibrePCB API endpoint.
Definition apiendpoint.h:42
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition workspace.h:54
The AddLibraryWidget class.
Definition addlibrarywidget.h:56
void downloadZippedLibraryButtonClicked() noexcept
Definition addlibrarywidget.cpp:309
void onlineLibraryListReceived(const QJsonArray &libs) noexcept
Definition addlibrarywidget.cpp:386
void repoLibraryDownloadCheckedChanged(bool checked) noexcept
Definition addlibrarywidget.cpp:427
void createLocalLibraryButtonClicked() noexcept
Definition addlibrarywidget.cpp:173
void downloadOnlineLibrariesButtonClicked() noexcept
Definition addlibrarywidget.cpp:475
AddLibraryWidget(const AddLibraryWidget &other)=delete
static QString getTextOrPlaceholderFromQLineEdit(QLineEdit *edit, bool isFilename) noexcept
Definition addlibrarywidget.cpp:493
void updateOnlineLibraryList() noexcept
Definition addlibrarywidget.cpp:119
QScopedPointer< Ui::AddLibraryWidget > mUi
Definition addlibrarywidget.h:92
void downloadZipFinished(bool success, const QString &errMsg) noexcept
Definition addlibrarywidget.cpp:365
bool mManualCheckStateForAllRemoteLibraries
Definition addlibrarywidget.h:95
Workspace & mWorkspace
Definition addlibrarywidget.h:91
void libraryAdded(const FilePath &libDir)
void errorWhileFetchingLibraryList(const QString &errorMsg) noexcept
Definition addlibrarywidget.cpp:408
QScopedPointer< LibraryDownload > mManualLibraryDownload
Definition addlibrarywidget.h:93
void clearOnlineLibraryList() noexcept
Definition addlibrarywidget.cpp:416
void localLibraryNameLineEditTextChanged(QString name) noexcept
Definition addlibrarywidget.cpp:146
~AddLibraryWidget() noexcept
Definition addlibrarywidget.cpp:111
void downloadZipUrlLineEditTextChanged(QString urlStr) noexcept
Definition addlibrarywidget.cpp:155
QList< std::shared_ptr< ApiEndpoint > > mApiEndpoints
Definition addlibrarywidget.h:94
The LibraryDownload class.
Definition librarydownload.h:48
Definition occmodel.cpp:76
Definition uuid.h:186