Sun, 29 Jan 2017 15:05:14 +0200
Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
The LDObject::destroy method is also now gone. The model decides when objects are destroyed and calls the destructor directly. The end result removes a lot of cruft and adds structure to LDObject relations.
Notes:
- Inlining does not currently work (nothing simply gets inlined in)
- More work is required to ensure that each object actually goes into a model
957
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
1072 | 3 | * Copyright (C) 2013 - 2017 Teemu Piippo |
957
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <QDialog> |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | class OpenProgressDialog : public QDialog |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | { |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | Q_OBJECT |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | public: |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | OpenProgressDialog (QWidget* parent = nullptr, Qt::WindowFlags f = 0); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | virtual ~OpenProgressDialog(); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | int progress() const { return m_progress; } |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | int numLines() const { return m_numLines; } |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | void setNumLines (int value); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | public slots: |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | void setProgress (int progress); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | private: |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | class Ui_OpenProgressUI& ui; |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | int m_progress; |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | int m_numLines; |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | void updateValues(); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | }; |