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 
62 class RepositoryLibraryListWidgetItem final : public QWidget {
63  Q_OBJECT
64 
65 public:
66  // Constructors / Destructor
69  const RepositoryLibraryListWidgetItem& other) = delete;
71  const QJsonObject& obj) noexcept;
73 
74  // Getters
75  const tl::optional<Uuid>& getUuid() const noexcept { return mUuid; }
76  const QSet<Uuid>& getDependencies() const noexcept { return mDependencies; }
77  bool isChecked() const noexcept;
78 
79  // Setters
80  void setChecked(bool checked) noexcept;
81 
82  // General Methods
83  void startDownloadIfSelected() noexcept;
84 
85  // Operator Overloadings
87  const RepositoryLibraryListWidgetItem& rhs) = delete;
88 
89 signals:
90  void checkedChanged(bool checked);
91 
92 private: // Methods
93  void downloadFinished(bool success, const QString& errMsg) noexcept;
94  void iconReceived(const QByteArray& data) noexcept;
95  void updateInstalledStatus() noexcept;
96 
97 private: // Data
98  workspace::Workspace& mWorkspace;
99  QJsonObject mJsonObject;
100  tl::optional<Uuid> mUuid;
101  tl::optional<Version> mVersion;
106 };
107 
108 /*******************************************************************************
109  * End of File
110  ******************************************************************************/
111 
112 } // namespace manager
113 } // namespace library
114 } // namespace librepcb
115 
116 #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:99
void startDownloadIfSelected() noexcept
Definition: repositorylibrarylistwidgetitem.cpp:118
The Workspace class represents a workspace with all its data (library, projects, settings, ...)
Definition: workspace.h:65
~RepositoryLibraryListWidgetItem() noexcept
Definition: repositorylibrarylistwidgetitem.cpp:95
QScopedPointer< Ui::RepositoryLibraryListWidgetItem > mUi
Definition: repositorylibrarylistwidgetitem.h:104
tl::optional< Version > mVersion
Definition: repositorylibrarylistwidgetitem.h:101
QScopedPointer< LibraryDownload > mLibraryDownload
Definition: repositorylibrarylistwidgetitem.h:105
void updateInstalledStatus() noexcept
Definition: repositorylibrarylistwidgetitem.cpp:185
const tl::optional< Uuid > & getUuid() const noexcept
Definition: repositorylibrarylistwidgetitem.h:75
bool mIsRecommended
Definition: repositorylibrarylistwidgetitem.h:102
The RepositoryLibraryListWidgetItem class.
Definition: repositorylibrarylistwidgetitem.h:62
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:76
workspace::Workspace & mWorkspace
Definition: repositorylibrarylistwidgetitem.h:98
QSet< Uuid > mDependencies
Definition: repositorylibrarylistwidgetitem.h:103
The LibraryDownload class.
Definition: librarydownload.h:50
void setChecked(bool checked) noexcept
Definition: repositorylibrarylistwidgetitem.cpp:110
tl::optional< Uuid > mUuid
Definition: repositorylibrarylistwidgetitem.h:100
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