Cockatrice
2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Toggle main menu visibility
Loading...
Searching...
No Matches
background_sources.h
Go to the documentation of this file.
1
6
7
#ifndef COCKATRICE_BACKGROUND_SOURCES_H
8
#define COCKATRICE_BACKGROUND_SOURCES_H
9
10
#include <QList>
11
#include <QObject>
12
#include <QSharedPointer>
13
#include <QString>
14
#include <QtGlobal>
15
#include <qtmetamacros.h>
16
17
class
BackgroundSources
18
{
19
Q_GADGET
20
public
:
21
enum
Type
22
{
23
Theme
,
24
RandomCardArt
,
25
DeckFileArt
26
};
27
Q_ENUM(
Type
)
28
29
struct
Entry
30
{
31
Type
type
;
32
const
char
*
id
;
// stable ID for settings
33
const
char
*
trKey
;
// key for translation
34
};
35
36
static
QList<Entry>
all
()
37
{
38
return
{{
Theme
,
"theme"
, QT_TR_NOOP(
"Theme"
)},
39
{
RandomCardArt
,
"random_card_art"
, QT_TR_NOOP(
"Art crop of random card"
)},
40
{
DeckFileArt
,
"deck_file_art"
, QT_TR_NOOP(
"Art crop of background.cod deck file"
)}};
41
}
42
43
static
QString
toId
(
Type
type
)
44
{
45
for
(
const
auto
&e :
all
()) {
46
if
(e.type ==
type
) {
47
return
e.id;
48
}
49
}
50
return
{};
51
}
52
53
static
Type
fromId
(
const
QString &
id
)
54
{
55
for
(
const
auto
&e :
all
()) {
56
if
(
id
== e.id) {
57
return
e.type;
58
}
59
}
60
return
Theme
;
// default
61
}
62
63
static
QString
toDisplay
(
Type
type
)
64
{
65
for
(
const
auto
&e :
all
()) {
66
if
(e.type ==
type
) {
67
return
QObject::tr(e.trKey);
68
}
69
}
70
return
{};
71
}
72
};
73
74
#endif
// COCKATRICE_BACKGROUND_SOURCES_H
BackgroundSources
Definition
background_sources.h:18
BackgroundSources::Type
Type
Definition
background_sources.h:22
BackgroundSources::Theme
@ Theme
Definition
background_sources.h:23
BackgroundSources::DeckFileArt
@ DeckFileArt
Definition
background_sources.h:25
BackgroundSources::RandomCardArt
@ RandomCardArt
Definition
background_sources.h:24
BackgroundSources::toDisplay
static QString toDisplay(Type type)
Definition
background_sources.h:63
BackgroundSources::all
static QList< Entry > all()
Definition
background_sources.h:36
BackgroundSources::toId
static QString toId(Type type)
Definition
background_sources.h:43
BackgroundSources::fromId
static Type fromId(const QString &id)
Definition
background_sources.h:53
QList
Definition
remote_connection_controller.h:20
type
EmailType type
Definition
smtpclient.cpp:30
BackgroundSources::Entry
Definition
background_sources.h:30
BackgroundSources::Entry::id
const char * id
Definition
background_sources.h:32
BackgroundSources::Entry::trKey
const char * trKey
Definition
background_sources.h:33
BackgroundSources::Entry::type
Type type
Definition
background_sources.h:31
cockatrice
src
interface
widgets
general
background_sources.h
Generated by
1.18.0