Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
bootQmlLinkage.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Twilight
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16
25
26#include <QString>
27#include <QQmlEngine>
28
29#include <pse-common/utility.h>
30
31#include "../bridge/bridge.h"
32#include "../bridge/settings.h"
33#include "../bridge/router.h"
34
38#include "../mvc/pokedexmodel.h"
42#include "../mvc/typesmodel.h"
48
52#include <pse-db/fontsdb.h>
55#include <pse-db/names.h>
57
65
79
92
97
108
109extern void bootQmlLinkage()
110{
111 // Explicitly register all pointer types used in Q_PROPERTY chains.
112 // In Qt6, qmlRegisterUncreatableType alone may not register T* with
113 // the meta-type system, causing QML property bindings to return undefined.
114 qRegisterMetaType<FileManagement*>("FileManagement*");
115 qRegisterMetaType<SaveFile*>("SaveFile*");
116 qRegisterMetaType<SaveFileExpanded*>("SaveFileExpanded*");
117 qRegisterMetaType<Player*>("Player*");
118 qRegisterMetaType<PlayerBasics*>("PlayerBasics*");
119 qRegisterMetaType<PlayerPokedex*>("PlayerPokedex*");
120 qRegisterMetaType<PlayerPokemon*>("PlayerPokemon*");
121 qRegisterMetaType<ItemStorageBox*>("ItemStorageBox*");
122 qRegisterMetaType<Rival*>("Rival*");
123 qRegisterMetaType<Storage*>("Storage*");
124 qRegisterMetaType<Area*>("Area*");
125 qRegisterMetaType<World*>("World*");
126 qRegisterMetaType<WorldOther*>("WorldOther*");
127 qRegisterMetaType<Daycare*>("Daycare*");
128 qRegisterMetaType<HallOfFame*>("HallOfFame*");
129 qRegisterMetaType<AreaMap*>("AreaMap*");
130 qRegisterMetaType<AreaGeneral*>("AreaGeneral*");
131
132 // Can't put this into a template because there would be no QML processing
133 // for hints so I have to duplicate the class name 3 times on each line
134 // EDIT: Apparently I literally can't have any help here, any sort of help
135 // doesn't work with Qt's Meta System. I have to verbatim spell everything out.
136 // No variables, functions, templates, none of that. It's straight up copying
137 // throughout
138
139 // Thanks Regex101 regex101.com
140 // Qt won't let me have any help from C++ but Regex101 allowed me to easily
141 // make all the duplicating without errors and time consuming
142
143 // Creatable Types
144 // Enums are allowed to be created by QML
145 qmlRegisterType<ContrastIds>("App.ContrastIds", 1, 0, "ContrastIds");
146 qmlRegisterType<PlayerDir>("App.PlayerDir", 1, 0, "PlayerDir");
147 qmlRegisterType<PokemonStats>("App.PokemonStats", 1, 0, "PokemonStats");
148 qmlRegisterType<PokemonNatures>("App.PokemonNatures", 1, 0, "PokemonNatures");
149 qmlRegisterType<PokemonRandom>("App.PokemonRandom", 1, 0, "PokemonRandom");
150 qmlRegisterType<SpriteMovementStatus>("App.SpriteMovementStatus", 1, 0, "SpriteMovementStatus");
151 qmlRegisterType<SpriteFacing>("App.SpriteFacing", 1, 0, "SpriteFacing");
152 qmlRegisterType<SpriteMobility>("App.SpriteMobility", 1, 0, "SpriteMobility");
153 qmlRegisterType<SpriteMovement>("App.SpriteMovement", 1, 0, "SpriteMovement");
154 qmlRegisterType<SpriteGrass>("App.SpriteGrass", 1, 0, "SpriteGrass");
155 qmlRegisterType<Badges>("App.Badges", 1, 0, "Badges");
156
157 // Uncreatable Types
158 qmlRegisterUncreatableType<Bridge>("App.Bridge", 1, 0, "Bridge", "Can't instantiate in QML");
159 qmlRegisterUncreatableType<Router>("App.Router", 1, 0, "Router", "Can't instantiate in QML");
160 qmlRegisterUncreatableType<Settings>("App.Settings", 1, 0, "Settings", "Can't instantiate in QML");
161
162 qmlRegisterUncreatableType<Utility>("App.Utility", 1, 0, "Utility", "Can't instantiate in QML");
163 qmlRegisterUncreatableType<ItemStorageModel>("App.ItemStorageModel", 1, 0, "ItemStorageModel", "Can't instantiate in QML");
164 qmlRegisterUncreatableType<ItemOverviewModel>("App.ItemOverviewModel", 1, 0, "ItemOverviewModel", "Can't instantiate in QML");
165 qmlRegisterUncreatableType<PokemonOverviewModel>("App.PokemonOverviewModel", 1, 0, "PokemonOverviewModel", "Can't instantiate in QML");
166 qmlRegisterUncreatableType<PokedexModel>("App.PokedexModel", 1, 0, "PokedexModel", "Can't instantiate in QML");
167 qmlRegisterUncreatableType<ItemMarketModel>("App.MarketModel", 1, 0, "MarketModel", "Can't instantiate in QML");
168 qmlRegisterUncreatableType<PokemonStorageModel>("App.PokemonStorageModel", 1, 0, "PokemonStorageModel", "Can't instantiate in QML");
169 qmlRegisterUncreatableType<PokemonBoxSelectModel>("App.PokemonBoxSelectModel", 1, 0, "PokemonBoxSelectModel", "Can't instantiate in QML");
170 qmlRegisterUncreatableType<TypesModel>("App.TypesModel", 1, 0, "TypesModel", "Can't instantiate in QML");
171 qmlRegisterUncreatableType<SpeciesSelectModel>("App.SpeciesSelectModel", 1, 0, "SpeciesSelectModel", "Can't instantiate in QML");
172 qmlRegisterUncreatableType<StatusSelectModel>("App.StatusSelectModel", 1, 0, "StatusSelectModel", "Can't instantiate in QML");
173 qmlRegisterUncreatableType<NatureSelectModel>("App.NatureSelectModel", 1, 0, "NatureSelectModel", "Can't instantiate in QML");
174 qmlRegisterUncreatableType<MoveSelectModel>("App.MoveSelectModel", 1, 0, "MoveSelectModel", "Can't instantiate in QML");
175 qmlRegisterUncreatableType<MapSelectModel>("App.MapSelectModel", 1, 0, "MapSelectModel", "Can't instantiate in QML");
176
177 qmlRegisterUncreatableType<ExamplesPlayer>("App.ExamplesPlayer", 1, 0, "ExamplesPlayer", "Can't instantiate in QML");
178 qmlRegisterUncreatableType<ExamplesPokemon>("App.ExamplesPokemon", 1, 0, "ExamplesPokemon", "Can't instantiate in QML");
179 qmlRegisterUncreatableType<ExamplesRival>("App.ExamplesRival", 1, 0, "ExamplesRival", "Can't instantiate in QML");
180 qmlRegisterUncreatableType<FontSearch>("App.FontSearch", 1, 0, "FontSearch", "Can't instantiate in QML");
181 qmlRegisterUncreatableType<FontsDB>("App.FontsDB", 1, 0, "FontsDB", "Can't instantiate in QML");
182 qmlRegisterUncreatableType<FontDBEntry>("App.FontDBEntry", 1, 0, "FontDBEntry", "Can't instantiate in QML");
183 qmlRegisterUncreatableType<NamesPlayer>("App.NamesDB", 1, 0, "NamesDB", "Can't instantiate in QML");
184 qmlRegisterUncreatableType<NamesPokemon>("App.NamesPokemonDB", 1, 0, "NamesPokemonDB", "Can't instantiate in QML");
185
186 qmlRegisterUncreatableType<FileManagement>("App.FileManagement", 1, 0, "FileManagement", "Can't instantiate in QML");
187 qmlRegisterUncreatableType<SaveFile>("App.SaveFile", 1, 0, "SaveFile", "Can't instantiate in QML");
188 qmlRegisterUncreatableType<Daycare>("App.Daycare", 1, 0, "Daycare", "Can't instantiate in QML");
189 qmlRegisterUncreatableType<HallOfFame>("App.HallOfFame", 1, 0, "HallOfFame", "Can't instantiate in QML");
190 qmlRegisterUncreatableType<Rival>("App.Rival", 1, 0, "Rival", "Can't instantiate in QML");
191 qmlRegisterUncreatableType<SaveFileExpanded>("App.SaveFileExpanded", 1, 0, "SaveFileExpanded", "Can't instantiate in QML");
192 qmlRegisterUncreatableType<Storage>("App.Storage", 1, 0, "Storage", "Can't instantiate in QML");
193
194 qmlRegisterUncreatableType<Area>("App.Area", 1, 0, "Area", "Can't instantiate in QML");
195 qmlRegisterUncreatableType<AreaAudio>("App.AreaAudio", 1, 0, "AreaAudio", "Can't instantiate in QML");
196 qmlRegisterUncreatableType<AreaGeneral>("App.AreaGeneral", 1, 0, "AreaGeneral", "Can't instantiate in QML");
197 qmlRegisterUncreatableType<AreaLoadedSprites>("App.AreaLoadedSprites", 1, 0, "AreaLoadedSprites", "Can't instantiate in QML");
198 qmlRegisterUncreatableType<AreaMap>("App.AreaMap", 1, 0, "AreaMap", "Can't instantiate in QML");
199 qmlRegisterUncreatableType<AreaNPC>("App.AreaNPC", 1, 0, "AreaNPC", "Can't instantiate in QML");
200 qmlRegisterUncreatableType<AreaPlayer>("App.AreaPlayer", 1, 0, "AreaPlayer", "Can't instantiate in QML");
201 qmlRegisterUncreatableType<AreaPokemonWild>("App.AreaPokemonWild", 1, 0, "AreaPokemonWild", "Can't instantiate in QML");
202 qmlRegisterUncreatableType<AreaPokemon>("App.AreaPokemon", 1, 0, "AreaPokemon", "Can't instantiate in QML");
203 qmlRegisterUncreatableType<AreaSign>("App.AreaSign", 1, 0, "AreaSign", "Can't instantiate in QML");
204 qmlRegisterUncreatableType<AreaSprites>("App.AreaSprites", 1, 0, "AreaSprites", "Can't instantiate in QML");
205 qmlRegisterUncreatableType<AreaTileset>("App.AreaTileset", 1, 0, "AreaTileset", "Can't instantiate in QML");
206 qmlRegisterUncreatableType<AreaWarps>("App.AreaWarps", 1, 0, "AreaWarps", "Can't instantiate in QML");
207
208 qmlRegisterUncreatableType<HoFPokemon>("App.HoFPokemon", 1, 0, "HoFPokemon", "Can't instantiate in QML");
209 qmlRegisterUncreatableType<HoFRecord>("App.HoFRecord", 1, 0, "HoFRecord", "Can't instantiate in QML");
210 qmlRegisterUncreatableType<Item>("App.Item", 1, 0, "Item", "Can't instantiate in QML");
211 qmlRegisterUncreatableType<ItemStorageBox>("App.ItemStorageBox", 1, 0, "ItemStorageBox", "Can't instantiate in QML");
212 qmlRegisterUncreatableType<MapConnData>("App.MapConnData", 1, 0, "MapConnData", "Can't instantiate in QML");
213 qmlRegisterUncreatableType<PokemonMove>("App.PokemonMove", 1, 0, "PokemonMove", "Can't instantiate in QML");
214 qmlRegisterUncreatableType<PokemonBox>("App.PokemonBox", 1, 0, "PokemonBox", "Can't instantiate in QML");
215 qmlRegisterUncreatableType<PokemonParty>("App.PokemonParty", 1, 0, "PokemonParty", "Can't instantiate in QML");
216 qmlRegisterUncreatableType<PokemonStorageBox>("App.PokemonStorageBox", 1, 0, "PokemonStorageBox", "Can't instantiate in QML");
217 qmlRegisterUncreatableType<PokemonStorageSet>("App.PokemonStorageSet", 1, 0, "PokemonStorageSet", "Can't instantiate in QML");
218 qmlRegisterUncreatableType<SignData>("App.SignData", 1, 0, "SignData", "Can't instantiate in QML");
219 qmlRegisterUncreatableType<SpriteData>("App.SpriteData", 1, 0, "SpriteData", "Can't instantiate in QML");
220 qmlRegisterUncreatableType<WarpData>("App.WarpData", 1, 0, "WarpData", "Can't instantiate in QML");
221
222 qmlRegisterUncreatableType<Player>("App.Player", 1, 0, "Player", "Can't instantiate in QML");
223 qmlRegisterUncreatableType<PlayerBasics>("App.PlayerBasics", 1, 0, "PlayerBasics", "Can't instantiate in QML");
224 qmlRegisterUncreatableType<PlayerPokedex>("App.PlayerPokedex", 1, 0, "PlayerPokedex", "Can't instantiate in QML");
225 qmlRegisterUncreatableType<PlayerPokemon>("App.PlayerPokemon", 1, 0, "PlayerPokemon", "Can't instantiate in QML");
226
227 qmlRegisterUncreatableType<World>("App.World", 1, 0, "World", "Can't instantiate in QML");
228 qmlRegisterUncreatableType<WorldCompleted>("App.WorldCompleted", 1, 0, "WorldCompleted", "Can't instantiate in QML");
229 qmlRegisterUncreatableType<WorldEvents>("App.WorldEvents", 1, 0, "WorldEvents", "Can't instantiate in QML");
230 qmlRegisterUncreatableType<Options>("App.Options", 1, 0, "Options", "Can't instantiate in QML");
231}
void bootQmlLinkage()