* move message_log_widget to game

* move files

* update headers

* fix cmakelists

* oracle fixes

* split implementation out to cpp

* fix recursive import

* fix main file

* format
This commit is contained in:
ebbit1q 2025-09-20 14:35:52 +02:00 committed by GitHub
parent f484c98152
commit 17dcaf9afa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
337 changed files with 728 additions and 721 deletions

View file

@ -0,0 +1,62 @@
#ifndef COCKATRICE_BACKGROUND_SOURCES_H
#define COCKATRICE_BACKGROUND_SOURCES_H
#include <QList>
#include <QObject>
#include <QString>
class BackgroundSources
{
Q_GADGET
public:
enum Type
{
Theme,
RandomCardArt,
DeckFileArt
};
Q_ENUM(Type)
struct Entry
{
Type type;
const char *id; // stable ID for settings
const char *trKey; // key for translation
};
static QList<Entry> all()
{
return {{Theme, "theme", QT_TR_NOOP("Theme")},
{RandomCardArt, "random_card_art", QT_TR_NOOP("Art crop of random card")},
{DeckFileArt, "deck_file_art", QT_TR_NOOP("Art crop of background.cod deck file")}};
}
static QString toId(Type type)
{
for (const auto &e : all()) {
if (e.type == type)
return e.id;
}
return {};
}
static Type fromId(const QString &id)
{
for (const auto &e : all()) {
if (id == e.id)
return e.type;
}
return Theme; // default
}
static QString toDisplay(Type type)
{
for (const auto &e : all()) {
if (e.type == type)
return QObject::tr(e.trKey);
}
return {};
}
};
#endif // COCKATRICE_BACKGROUND_SOURCES_H