src/librariesmodel.h

Sun, 01 Apr 2018 11:39:07 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 01 Apr 2018 11:39:07 +0300
changeset 1367
0aab8d972cf6
parent 1326
69a90bd2dba2
permissions
-rw-r--r--

fixed some problems

1326
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
1 /*
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
2 * LDForge: LDraw parts authoring CAD
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
3 * Copyright (C) 2013 - 2018 Teemu Piippo
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
4 *
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
5 * This program is free software: you can redistribute it and/or modify
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
6 * it under the terms of the GNU General Public License as published by
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
8 * (at your option) any later version.
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
9 *
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
10 * This program is distributed in the hope that it will be useful,
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
13 * GNU General Public License for more details.
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
14 *
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
15 * You should have received a copy of the GNU General Public License
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
17 */
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1308
diff changeset
18
1308
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 #pragma once
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 #include <QAbstractTableModel>
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 #include "main.h"
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 class LibrariesModel : public QAbstractTableModel
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 {
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 public:
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 enum Column { RoleColumn, PathColumn };
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 LibrariesModel(Libraries& libraries, QObject* parent);
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 QVariant data(const QModelIndex& index, int role) const override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 int rowCount(const QModelIndex& parent = {}) const override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 int columnCount(const QModelIndex& parent = {}) const override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 bool setData(const QModelIndex& index, const QVariant& value, int role) override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 Qt::ItemFlags flags(const QModelIndex& index) const override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 bool moveRows(
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 const QModelIndex&,
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37 int sourceRow,
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38 int count,
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 const QModelIndex&,
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40 int destinationRow
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41 ) override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42 bool removeRows(int row, int count, const QModelIndex&) override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 bool insertRows(int startRow, int count, const QModelIndex&) override;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45 private:
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46 Libraries& libraries;
dcc8c02530c2 Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
47 };

mercurial