Fri, 17 Jan 2014 16:43:29 +0200
- removed some pointless typedefs
623
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013, 2014 Santeri Piippo |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "moc_invokationDeferer.cpp" |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "invokationDeferer.h" |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "../misc.h" |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | static InvokationDeferer* g_invokationDeferer = new InvokationDeferer(); |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | // ============================================================================= |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | // |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | InvokationDeferer::InvokationDeferer (QObject* parent) : QObject (parent) |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | { |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | connect (this, SIGNAL (functionAdded()), this, SLOT (invokeFunctions()), |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | Qt::QueuedConnection); |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | } |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | // ============================================================================= |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | // |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | void InvokationDeferer::addFunctionCall (InvokationDeferer::FunctionType func) |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | { |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | m_funcs << func; |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | removeDuplicates (m_funcs); |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | emit functionAdded(); |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | } |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | // ============================================================================= |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | // |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | void InvokationDeferer::invokeFunctions() |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | { |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | for (FunctionType func : m_funcs) |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | (*func)(); |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | m_funcs.clear(); |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | } |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | // ============================================================================= |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | // |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | void invokeLater (InvokationDeferer::FunctionType func) |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | { |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | g_invokationDeferer->addFunctionCall (func); |
cd0cbf091b83
- forgot the invokation deferer files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | } |