File indexing completed on 2024-05-12 04:06:27

0001 /*
0002     SPDX-FileCopyrightText: 2009 Stefan Majewsky <majewsky@gmx.net>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef PALAPELI_PUZZLESTRUCTS_H
0008 #define PALAPELI_PUZZLESTRUCTS_H
0009 
0010 #include <QMap>
0011 #include <QPair>
0012 #include <QImage>
0013 #include <QVariant>
0014 //NOTE: This header defines data structures for Palapeli::Puzzle. PuzzleMetadata contains a bunch of metadata, which is used in the Palapeli::Collection classes. PuzzleContents contains the constituents of the puzzle, and is used by the Palapeli::Scene. Both structures are separate, to allow Palapeli::Puzzle to load only the metadata if only they are needed. The PuzzleCreationContext structure contains some data which is generated during puzzle creation, but not loaded in the current Palapeli version. When writing a newly generated puzzle for the first time, they are also written into the file, to have them available if a newer Palapeli version decides to use them.
0015 
0016 namespace Palapeli
0017 {
0018     struct PuzzleMetadata
0019     {
0020         QString name, author, comment;
0021         int pieceCount;
0022         QImage image, thumbnail;
0023         bool modifyProtection;
0024 
0025         static const QSize ThumbnailBaseSize;
0026     };
0027 
0028     struct PuzzleContents
0029     {
0030         QSize imageSize;
0031         QMap<int, QImage> pieces;
0032         QMap<int, QPoint> pieceOffsets;
0033         QList<QPair<int, int> > relations;
0034     };
0035 
0036     struct PuzzleCreationContext : public Palapeli::PuzzleMetadata
0037     {
0038         QString slicer;
0039         QByteArray slicerMode;
0040         QMap<QByteArray, QVariant> slicerArgs;
0041     };
0042 }
0043 
0044 #endif // PALAPELI_PUZZLESTRUCTS_H