@@ -115,7 +115,7 @@ struct GameRelease {
115115 {7 , " 1998-12-31" },
116116 {8 , " 1999-06-04" },
117117 {9 , " 2000-03-00" },
118- {10 , " 1999-12" },
118+ {10 , " 1999-12-00 " },
119119 };
120120};
121121
@@ -218,7 +218,7 @@ struct ZipData {
218218 * @param release date of file release.
219219 */
220220 inline void setRelease (const QString& release) {
221- m_release = m_release ;
221+ m_release = release ;
222222 }
223223
224224 QString m_fileName; // /< The archive file name.
@@ -231,120 +231,97 @@ struct ZipData {
231231};
232232
233233/* *
234- * @struct OriginalGameData
235- * @brief Represents a Tomb Raider Game Entry Card Info.
234+ * @struct ListItemData
235+ * @brief Represents a Tomb Raider Level Entry Card Info.
236236 *
237- * This struct is designed to store a Game data record.
238- * Each record contains basic game data and a cover image displayed as a card in the application.
237+ * This struct is designed to store a single TRLE (Tomb Raider Level Editor) level record.
238+ * Each record contains metadata and a cover image displayed as a card in the application.
239+ * The struct includes properties to facilitate searching, filtering, and sorting.
239240 */
240- struct OriginalGameData {
241+ struct ListItemData {
241242 /* *
242- * @brief Default constructor for `OriginalGameData `.
243+ * @brief Default constructor for `ListItemData `.
243244 *
244- * Initializes an empty instance of `OriginalGameData `.
245+ * Initializes an empty instance of `ListItemData `.
245246 */
246- OriginalGameData () {}
247+ ListItemData () {
248+ m_game_id = 0 ;
249+ m_trle_id = 0 ;
250+ m_type = 0 ;
251+ m_class = 0 ;
252+ m_difficulty = 0 ;
253+ m_duration = 0 ;
254+ m_installed = false ;
255+ }
247256
248- /* *
249- * @brief Parameterized constructor for `OriginalGameData`.
250- *
251- * This constructor initializes a `OriginalGameData` object with game metadata.
252- *
253- * @param id The numeric game database ID.
254- * @param title The TRLE title. Expected to contain a single name.
255- * @param shortBody some short game info text.
256- * @param type The TRLE type, represented by a numeric ID.
257- * @param releaseDate The release date in the format "YYYY-MM-DD" (e.g., "2000-01-01").
258- * @param m_cover The cover image as a `m_cover`.
259- */
260- OriginalGameData (
261- qint64 id, const QString& title, const QString& shortBody,
262- qint64 type, const QString& releaseDate, const QPixmap& cover) :
263- m_game_id (id), m_title(title), m_shortBody(shortBody), m_type(type),
264- m_releaseDate (releaseDate) {
265- // Define target dimensions and maintain aspect ratio
266- QSize targetSize (640 , 480 );
267- QSize newSize = cover.size ().scaled (targetSize, Qt::KeepAspectRatio);
268257
269- // Scale the pixmap
270- QPixmap scaledPixmap = cover.scaled (
271- newSize,
272- Qt::KeepAspectRatio,
273- Qt::SmoothTransformation);
258+ void setGameId (const qint64 id) {
259+ m_game_id = id;
260+ }
274261
275- // Create a centered pixmap with a transparent background
276- QPixmap centeredPixmap (targetSize);
277- // Ensure a transparent background
278- centeredPixmap.fill (Qt::transparent);
262+ void setLid (const qint64 id) {
263+ m_trle_id = id;
264+ }
279265
280- // Calculate offsets for centering the scaled image
281- qint64 xOffset = (targetSize. width () - newSize. width ()) / 2 ;
282- qint64 yOffset = (targetSize. height () - newSize. height ()) / 2 ;
266+ void setTitle ( const QString& title) {
267+ m_title = title ;
268+ }
283269
284- // Draw the scaled image onto the centered pixmap
285- QPainter painter (¢eredPixmap);
286- painter.setRenderHint (QPainter::Antialiasing, true );
287- painter.setRenderHint (QPainter::SmoothPixmapTransform, true );
288- painter.drawPixmap (xOffset, yOffset, scaledPixmap);
289- painter.end ();
270+ void setAuthors (const QStringList& authors) {
271+ m_authors = authors;
272+ }
290273
291- // Store the resulting pixmap in m_picture
292- m_cover = centeredPixmap ;
274+ void setShortBody ( const QString& shortBody) {
275+ m_shortBody = shortBody ;
293276 }
294277
295- // Data members
296- qint64 m_game_id; // /< The Game id.
297- QString m_title; // /< The Game title.
298- QString m_shortBody; // /< The Game info text.
299- qint64 m_type; // /< ID of the type of game.
300- QString m_releaseDate; // /< The release date in "YYYY-MM-DD" format.
301- QPixmap m_cover; // /< The Game cover image.
302- };
278+ void setType (const qint64 type) {
279+ m_type = type;
280+ }
303281
304- /* *
305- * @struct ListItemData
306- * @brief Represents a Tomb Raider Level Entry Card Info.
307- *
308- * This struct is designed to store a single TRLE (Tomb Raider Level Editor) level record.
309- * Each record contains metadata and a cover image displayed as a card in the application.
310- * The struct includes properties to facilitate searching, filtering, and sorting.
311- */
312- struct ListItemData {
313- /* *
314- * @brief Default constructor for `ListItemData`.
315- *
316- * Initializes an empty instance of `ListItemData`.
317- */
318- ListItemData () {}
282+ void setClass (const qint64 _class) {
283+ m_class = _class;
284+ }
319285
320- /* *
321- * @brief Parameterized constructor for `ListItemData`.
322- *
323- * This constructor initializes a `ListItemData` object with metadata.
324- *
325- * @param id The TRLE numeric level ID.
326- * @param title The TRLE title. Expected to contain a single name.
327- * @param author The TRLE author(s). Can be a single name or multiple names.
328- * @param type The TRLE type, represented by a numeric ID.
329- * @param classInput The TRLE class, represented by a numeric ID.
330- * @param releaseDate The release date in the format "YYYY-MM-DD" (e.g., "2000-01-01").
331- * @param difficulty The TRLE difficulty, represented by a numeric ID.
332- * @param duration The TRLE duration, represented by a numeric ID.
333- * @param m_cover The cover image as a `m_cover`.
334- */
335- ListItemData (
336- qint64 id, const QString& title, const QStringList& authors,
337- qint64 type, qint64 classInput, const QString& releaseDate,
338- qint64 difficulty, qint64 duration) :
339- m_trle_id (id), m_title(title), m_authors(authors), m_type(type),
340- m_class (classInput), m_releaseDate(releaseDate),
341- m_difficulty (difficulty), m_duration(duration) {}
342-
343- void addPicture (const QByteArray& imageData) {
286+ void setDifficulty (const qint64 difficulty) {
287+ m_difficulty = difficulty;
288+ }
289+
290+ void setDuration (const qint64 duration) {
291+ m_duration = duration;
292+ }
293+
294+ void setReleaseDate (const QString& releaseDate) {
295+ m_releaseDate = releaseDate;
296+ }
297+
298+ void setPicture (const QByteArray& imageData) {
344299 // Load the image from the byte array
345300 QPixmap pixmap;
346301 pixmap.loadFromData (imageData, " WEBP" );
347302
303+ centerPixmap (pixmap);
304+ }
305+
306+ void setPicture (const QPixmap& pixmap) {
307+ centerPixmap (pixmap);
308+ }
309+ // Data members
310+ qint64 m_game_id; // /< The Game id.
311+ qint64 m_trle_id; // /< The TRLE level id.
312+ QString m_shortBody; // /< The Game info text.
313+ QString m_title; // /< The TRLE level title.
314+ QStringList m_authors; // /< The TRLE author(s), as a string list.
315+ qint64 m_type; // /< ID of the type of level.
316+ qint64 m_class; // /< ID of the class of the level.
317+ QString m_releaseDate; // /< The release date in "YYYY-MM-DD" format.
318+ qint64 m_difficulty; // /< ID of the difficulty of the level.
319+ qint64 m_duration; // /< ID of the estimated duration of the level.
320+ QPixmap m_cover; // /< The TRLE cover image.
321+ bool m_installed;
322+
323+ private:
324+ void centerPixmap (QPixmap pixmap) {
348325 // Define target dimensions and maintain aspect ratio
349326 QSize targetSize (640 , 480 );
350327 QSize newSize = pixmap.size ().scaled (targetSize, Qt::KeepAspectRatio);
@@ -374,16 +351,6 @@ struct ListItemData {
374351 // Store the resulting pixmap in m_picture
375352 m_cover = centeredPixmap;
376353 }
377- // Data members
378- qint64 m_trle_id; // /< The TRLE level id.
379- QString m_title; // /< The TRLE level title.
380- QStringList m_authors; // /< The TRLE author(s), as a string list.
381- qint64 m_type; // /< ID of the type of level.
382- qint64 m_class; // /< ID of the class of the level.
383- QString m_releaseDate; // /< The release date in "YYYY-MM-DD" format.
384- qint64 m_difficulty; // /< ID of the difficulty of the level.
385- qint64 m_duration; // /< ID of the estimated duration of the level.
386- QPixmap m_cover; // /< The TRLE cover image.
387354};
388355
389356/* *
0 commit comments