LibrePCB Developers Documentation
recentprojectsmodel.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_RECENTPROJECTSMODEL_H
21#define LIBREPCB_EDITOR_RECENTPROJECTSMODEL_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 RecentProjectsModel
42 ******************************************************************************/
43
47class RecentProjectsModel : public QAbstractListModel {
48 Q_OBJECT
49
50public:
51 // Constructors / Destructor
54 explicit RecentProjectsModel(const Workspace& workspace) noexcept;
55 ~RecentProjectsModel() noexcept;
56
57 // General Methods
58 void setLastRecentProject(const FilePath& filepath) noexcept;
59 void updateVisibleProjects() noexcept;
60
61 // Operator Overloadings
62 RecentProjectsModel& operator=(const RecentProjectsModel& rhs) = delete;
63
64private:
65 void save() noexcept;
66 int rowCount(const QModelIndex& parent = QModelIndex()) const;
67 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
68
69 // Attributes
74};
75
76/*******************************************************************************
77 * End of File
78 ******************************************************************************/
79
80} // namespace editor
81} // namespace librepcb
82
83#endif
This class represents absolute, well-formatted paths to files or directories.
Definition: filepath.h:129
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition: workspace.h:54
The RecentProjectsModel class.
Definition: recentprojectsmodel.h:47
QList< FilePath > mAllProjects
Definition: recentprojectsmodel.h:72
~RecentProjectsModel() noexcept
Definition: recentprojectsmodel.cpp:62
FilePath mFilePath
Definition: recentprojectsmodel.h:71
void updateVisibleProjects() noexcept
Definition: recentprojectsmodel.cpp:83
QList< FilePath > mVisibleProjects
Definition: recentprojectsmodel.h:73
const Workspace & mWorkspace
Definition: recentprojectsmodel.h:70
void setLastRecentProject(const FilePath &filepath) noexcept
Definition: recentprojectsmodel.cpp:69
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: recentprojectsmodel.cpp:116
RecentProjectsModel(const RecentProjectsModel &other)=delete
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: recentprojectsmodel.cpp:123
void save() noexcept
Definition: recentprojectsmodel.cpp:100
Definition: occmodel.cpp:77