LibrePCB Developers Documentation
Loading...
Searching...
No Matches
apiendpointlistmodellegacy.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_APIENDPOINTLISTMODELLEGACY_H
21#define LIBREPCB_EDITOR_APIENDPOINTLISTMODELLEGACY_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34namespace editor {
35
36/*******************************************************************************
37 * Class ApiEndpointListModelLegacy
38 ******************************************************************************/
39
43class ApiEndpointListModelLegacy final : public QAbstractTableModel {
44 Q_OBJECT
45
46public:
55
56 // Constructors / Destructor
57 // ApiEndpointListModelLegacy() = delete;
59 explicit ApiEndpointListModelLegacy(QObject* parent = nullptr) noexcept;
61
62 // General Methods
63 void setValues(const QList<WorkspaceSettings::ApiEndpoint>& values) noexcept;
64 const QList<WorkspaceSettings::ApiEndpoint>& getValues() const noexcept {
65 return mValues;
66 }
67
68 // Slots
69 void add(const QPersistentModelIndex& itemIndex) noexcept;
70 void remove(const QPersistentModelIndex& itemIndex) noexcept;
71 void moveUp(const QPersistentModelIndex& itemIndex) noexcept;
72 void moveDown(const QPersistentModelIndex& itemIndex) noexcept;
73
74 // Inherited from QAbstractItemModel
75 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
76 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
77 QVariant data(const QModelIndex& index,
78 int role = Qt::DisplayRole) const override;
79 QVariant headerData(int section, Qt::Orientation orientation,
80 int role = Qt::DisplayRole) const override;
81 Qt::ItemFlags flags(const QModelIndex& index) const override;
82 bool setData(const QModelIndex& itemIndex, const QVariant& value,
83 int role = Qt::EditRole) override;
84
85 // Operator Overloadings
87 const ApiEndpointListModelLegacy& rhs) noexcept;
88
89private: // Data
90 QList<WorkspaceSettings::ApiEndpoint> mValues;
91 QUrl mNewUrl;
92};
93
94/*******************************************************************************
95 * End of File
96 ******************************************************************************/
97
98} // namespace editor
99} // namespace librepcb
100
101#endif
Access to a LibrePCB API endpoint.
Definition apiendpoint.h:45
Container for all workspace related settings.
Definition workspacesettings.h:60
The ApiEndpointListModelLegacy class.
Definition apiendpointlistmodellegacy.h:43
const QList< WorkspaceSettings::ApiEndpoint > & getValues() const noexcept
Definition apiendpointlistmodellegacy.h:64
QUrl mNewUrl
Definition apiendpointlistmodellegacy.h:91
bool setData(const QModelIndex &itemIndex, const QVariant &value, int role=Qt::EditRole) override
Definition apiendpointlistmodellegacy.cpp:265
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Definition apiendpointlistmodellegacy.cpp:222
ApiEndpointListModelLegacy & operator=(const ApiEndpointListModelLegacy &rhs) noexcept
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition apiendpointlistmodellegacy.cpp:125
ApiEndpointListModelLegacy(const ApiEndpointListModelLegacy &other)=delete
void moveDown(const QPersistentModelIndex &itemIndex) noexcept
Definition apiendpointlistmodellegacy.cpp:112
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition apiendpointlistmodellegacy.cpp:251
QList< WorkspaceSettings::ApiEndpoint > mValues
Definition apiendpointlistmodellegacy.h:90
void add(const QPersistentModelIndex &itemIndex) noexcept
Definition apiendpointlistmodellegacy.cpp:60
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition apiendpointlistmodellegacy.cpp:139
void moveUp(const QPersistentModelIndex &itemIndex) noexcept
Definition apiendpointlistmodellegacy.cpp:103
void remove(const QPersistentModelIndex &itemIndex) noexcept
Definition apiendpointlistmodellegacy.cpp:93
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition apiendpointlistmodellegacy.cpp:132
Column
Definition apiendpointlistmodellegacy.h:47
@ _COLUMN_COUNT
Definition apiendpointlistmodellegacy.h:53
@ COLUMN_URL
Definition apiendpointlistmodellegacy.h:48
@ COLUMN_PARTS
Definition apiendpointlistmodellegacy.h:50
@ COLUMN_ORDER
Definition apiendpointlistmodellegacy.h:51
@ COLUMN_LIBRARIES
Definition apiendpointlistmodellegacy.h:49
@ COLUMN_ACTIONS
Definition apiendpointlistmodellegacy.h:52
void setValues(const QList< WorkspaceSettings::ApiEndpoint > &values) noexcept
Definition apiendpointlistmodellegacy.cpp:49
Definition occmodel.cpp:77