LibrePCB Developers Documentation
Loading...
Searching...
No Matches
favoriteprojectsmodel.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_FAVORITEPROJECTSMODEL_H
21#define LIBREPCB_EDITOR_FAVORITEPROJECTSMODEL_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class Version;
36class Workspace;
37
38namespace editor {
39
40/*******************************************************************************
41 * Class FavoriteProjectsModel
42 ******************************************************************************/
43
47class FavoriteProjectsModel : public QAbstractListModel {
48 Q_OBJECT
49
50public:
51 // Constructors / Destructor
54 explicit FavoriteProjectsModel(const Workspace& workspace) noexcept;
55 ~FavoriteProjectsModel() noexcept;
56
57 // General Methods
58 bool isFavoriteProject(const FilePath& filepath) const noexcept;
59 void addFavoriteProject(const FilePath& filepath) noexcept;
60 void removeFavoriteProject(const FilePath& filepath) noexcept;
61 void updateVisibleProjects() noexcept;
62
63 // Operator Overloadings
64 FavoriteProjectsModel& operator=(const FavoriteProjectsModel& rhs) = delete;
65
66private:
67 void save() noexcept;
68 int rowCount(const QModelIndex& parent = QModelIndex()) const;
69 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
70
71 // Attributes
76};
77
78/*******************************************************************************
79 * End of File
80 ******************************************************************************/
81
82} // namespace editor
83} // namespace librepcb
84
85#endif
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 FavoriteProjectsModel class.
Definition favoriteprojectsmodel.h:47
QList< FilePath > mAllProjects
Definition favoriteprojectsmodel.h:74
~FavoriteProjectsModel() noexcept
Definition favoriteprojectsmodel.cpp:63
void addFavoriteProject(const FilePath &filepath) noexcept
Definition favoriteprojectsmodel.cpp:75
FilePath mFilePath
Definition favoriteprojectsmodel.h:73
void updateVisibleProjects() noexcept
Definition favoriteprojectsmodel.cpp:92
QList< FilePath > mVisibleProjects
Definition favoriteprojectsmodel.h:75
const Workspace & mWorkspace
Definition favoriteprojectsmodel.h:72
void removeFavoriteProject(const FilePath &filepath) noexcept
Definition favoriteprojectsmodel.cpp:84
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition favoriteprojectsmodel.cpp:124
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition favoriteprojectsmodel.cpp:131
bool isFavoriteProject(const FilePath &filepath) const noexcept
Definition favoriteprojectsmodel.cpp:70
void save() noexcept
Definition favoriteprojectsmodel.cpp:108
FavoriteProjectsModel(const FavoriteProjectsModel &other)=delete
Definition occmodel.cpp:76