Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
creditdbentry.h
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#pragma once
17#include <QObject>
18#include <QQmlEngine>
19#include <QString>
20#include <QJsonValue>
21
22#include "../db_autoport.h"
23
42struct DB_AUTOPORT CreditDBEntry : public QObject {
43 Q_OBJECT
44 Q_PROPERTY(QString getSection READ getSection CONSTANT)
45 Q_PROPERTY(QString getName READ getName CONSTANT)
46 Q_PROPERTY(QString getUrl READ getUrl CONSTANT)
47 Q_PROPERTY(QString getNote READ getNote CONSTANT)
48 Q_PROPERTY(QString getLicense READ getLicense CONSTANT)
49 Q_PROPERTY(QString getMandated READ getMandated CONSTANT)
50
51public:
52 QString getSection() const;
53 QString getName() const;
54 QString getUrl() const;
55 QString getNote() const;
56 QString getLicense() const;
57 QString getMandated() const;
58
59public slots:
60 void qmlProtect(const QQmlEngine* const engine) const;
61
62protected:
64 CreditDBEntry(QJsonValue& data);
65 CreditDBEntry(QString section);
66
67 static void process(QJsonObject& data);
68 void qmlRegister() const;
69
70 QString section = "";
71 QString name = "";
72 QString url = "";
73 QString note = "";
74 QString license = "";
75 QString mandated = "";
76
77 friend class CreditsDB;
78};
Import/export macro for the db library, plus the central list of DB entry pointer types declared opaq...
#define DB_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
Definition db_autoport.h:37
static void process(QJsonObject &data)
Parse JSON and append entries to CreditsDB's store.
QString getName() const
QString url
Backing field (read via getUrl()).
QString getUrl() const
QString name
Backing field (read via getName()).
QString license
Backing field (read via getLicense()).
QString note
Backing field (read via getNote()).
QString getNote() const
void qmlRegister() const
Register this entry type with QML.
QString mandated
Backing field (read via getMandated()).
QString section
Backing field (read via getSection()).
QString getMandated() const
CreditDBEntry()
Empty entry (protected – built by the DB).
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership (anti-GC).
friend class CreditsDB
The owning DB constructs/populates these entries.
QString getSection() const
< Credits section heading.
QString getLicense() const