LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
repositorylibrarylistwidgetitem.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_REPOSITORYLIBRARYLISTWIDGETITEM_H
21 #define LIBREPCB_WORKSPACE_REPOSITORYLIBRARYLISTWIDGETITEM_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
28 #include <librepcb/common/uuid.h>
30 
31 #include <QtCore>
32 #include <QtWidgets>
33 
34 /*******************************************************************************
35  * Namespace / Forward Declarations
36  ******************************************************************************/
37 namespace librepcb {
38 
39 namespace workspace {
40 class Workspace;
41 }
42 
43 namespace library {
44 namespace manager {
45 
46 class LibraryDownload;
47 
48 namespace Ui {
49 class RepositoryLibraryListWidgetItem;
50 }
51 
52 /*******************************************************************************
53  * Class RepositoryLibraryListWidgetItem
54  ******************************************************************************/
55 
59 class RepositoryLibraryListWidgetItem final : public QWidget {
60  Q_OBJECT
61 
62 public:
63  // Constructors / Destructor
66  const RepositoryLibraryListWidgetItem& other) = delete;
68  const QJsonObject& obj) noexcept;
70 
71  // Getters
72  const tl::optional<Uuid>& getUuid() const noexcept { return mUuid; }
73  const QSet<Uuid>& getDependencies() const noexcept { return mDependencies; }
74  bool isChecked() const noexcept;
75 
76  // Setters
77  void setChecked(bool checked) noexcept;
78 
79  // General Methods
80  void startDownloadIfSelected() noexcept;
81 
82  // Operator Overloadings
84  const RepositoryLibraryListWidgetItem& rhs) = delete;
85 
86 signals:
87  void checkedChanged(bool checked);
88 
89 private: // Methods
90  void downloadFinished(bool success, const QString& errMsg) noexcept;
91  void iconReceived(const QByteArray& data) noexcept;
92  void updateInstalledStatus() noexcept;
93 
94 private: // Data
95  workspace::Workspace& mWorkspace;
96  QJsonObject mJsonObject;
97  tl::optional<Uuid> mUuid;
98  tl::optional<Version> mVersion;
103 };
104 
105 /*******************************************************************************
106  * End of File
107  ******************************************************************************/
108 
109 } // namespace manager
110 } // namespace library
111 } // namespace librepcb
112 
113 #endif // LIBREPCB_WORKSPACE_REPOSITORYLIBRARYLISTWIDGETITEM_H
The Version class represents a version number in the format "1.42.7".
Definition: version.h:60
QJsonObject mJsonObject
Definition: repositorylibrarylistwidgetitem.h:96
void startDownloadIfSelected() noexcept
Definition: repositorylibrarylistwidgetitem.cpp:118
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:62
~RepositoryLibraryListWidgetItem() noexcept
Definition: repositorylibrarylistwidgetitem.cpp:95
QScopedPointer< Ui::RepositoryLibraryListWidgetItem > mUi
Definition: repositorylibrarylistwidgetitem.h:101
tl::optional< Version > mVersion
Definition: repositorylibrarylistwidgetitem.h:98
QScopedPointer< LibraryDownload > mLibraryDownload
Definition: repositorylibrarylistwidgetitem.h:102
void updateInstalledStatus() noexcept
Definition: repositorylibrarylistwidgetitem.cpp:185
const tl::optional< Uuid > & getUuid() const noexcept
Definition: repositorylibrarylistwidgetitem.h:72
bool mIsRecommended
Definition: repositorylibrarylistwidgetitem.h:99
The RepositoryLibraryListWidgetItem class.
Definition: repositorylibrarylistwidgetitem.h:59
void iconReceived(const QByteArray &data) noexcept
Definition: repositorylibrarylistwidgetitem.cpp:178
void downloadFinished(bool success, const QString &errMsg) noexcept
Definition: repositorylibrarylistwidgetitem.cpp:157
const QSet< Uuid > & getDependencies() const noexcept
Definition: repositorylibrarylistwidgetitem.h:73
workspace::Workspace & mWorkspace
Definition: repositorylibrarylistwidgetitem.h:95
QSet< Uuid > mDependencies
Definition: repositorylibrarylistwidgetitem.h:100
The LibraryDownload class.
Definition: librarydownload.h:47
void setChecked(bool checked) noexcept
Definition: repositorylibrarylistwidgetitem.cpp:110
tl::optional< Uuid > mUuid
Definition: repositorylibrarylistwidgetitem.h:97
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
bool isChecked() const noexcept
Definition: repositorylibrarylistwidgetitem.cpp:102