Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
- This file was copied from src/datatypes/datatypes.cpp.
Show All 9 Lines | 1 | /* | |||
---|---|---|---|---|---|
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | 12 | License for more details. | ||
13 | 13 | | |||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #include "organization.h" | 18 | #include "init.h" | ||
19 | #include "person.h" | | |||
20 | #include "place.h" | | |||
21 | 19 | | |||
22 | #include <QCoreApplication> | 20 | #include "datatypes/organization.h" | ||
21 | #include "datatypes/person.h" | ||||
22 | #include "datatypes/place.h" | ||||
23 | | ||||
24 | #include <QDebug> | ||||
lepagevalleeemmanuel: unused? | |||||
25 | #include <QDir> | ||||
23 | #include <QMetaType> | 26 | #include <QMetaType> | ||
24 | 27 | | |||
25 | using namespace KItinerary; | 28 | using namespace KItinerary; | ||
26 | 29 | | |||
27 | struct StartupFunction { | 30 | bool doInit(); | ||
28 | StartupFunction() | 31 | | ||
32 | static bool runOnce = []() { return doInit(); }(); | ||||
33 | | ||||
34 | bool doInit() // must be outside of a namespace for Q_INIT_RESOURCE | ||||
apol: This function should be static too. | |||||
29 | { | 35 | { | ||
30 | // add types here that are not covered by moc's auto-registration | 36 | Q_INIT_RESOURCE(extractors); | ||
37 | | ||||
31 | qRegisterMetaType<Airline>(); | 38 | qRegisterMetaType<Airline>(); | ||
32 | qRegisterMetaType<Airport>(); | 39 | qRegisterMetaType<Airport>(); | ||
33 | qRegisterMetaType<Person>(); | 40 | qRegisterMetaType<Person>(); | ||
34 | qRegisterMetaType<Organization>(); | 41 | qRegisterMetaType<Organization>(); | ||
35 | qRegisterMetaType<TouristAttraction>(); | 42 | qRegisterMetaType<TouristAttraction>(); | ||
36 | qRegisterMetaType<TrainStation>(); | 43 | qRegisterMetaType<TrainStation>(); | ||
44 | | ||||
45 | return true; | ||||
37 | } | 46 | } | ||
38 | }; | | |||
39 | 47 | | |||
40 | StartupFunction runOnce; | 48 | void KItinerary::init() | ||
49 | { | ||||
50 | if (runOnce) { | ||||
51 | return; | ||||
52 | } | ||||
53 | runOnce = doInit(); | ||||
54 | } |
unused?