File confighandler.h#
FileList > src > utils > confighandler.h
Go to the source code of this file.
#include "src/widgets/capture/capturetoolbutton.h"
#include <QSettings>
#include <QStringList>
#include <QVariant>
#include <QVector>
Classes#
Type | Name |
---|---|
class | ConfigHandler |
Macros#
Type | Name |
---|---|
define | CONFIG_GETTER (KEY, TYPE) |
define | CONFIG_GETTER_SETTER (GETFUNC, SETFUNC, TYPE) |
define | CONFIG_GROUP_GENERAL "General" |
define | CONFIG_GROUP_SHORTCUTS "Shortcuts" |
define | CONFIG_SETTER (FUNC, KEY, TYPE) |
Macro Definition Documentation#
define CONFIG_GETTER#
#define CONFIG_GETTER (
KEY,
TYPE
) TYPE KEY() \
{ \
return value(QStringLiteral(#KEY)).value<TYPE>(); \
}
Declare and implement a getter for a config option. KEY
is the option key as it appears in the config file, TYPE
is the C++ type. At the same time KEY
is the name of the generated getter function.
define CONFIG_GETTER_SETTER#
#define CONFIG_GETTER_SETTER (
GETFUNC,
SETFUNC,
TYPE
) CONFIG_GETTER(GETFUNC, TYPE) \
CONFIG_SETTER(SETFUNC, GETFUNC, TYPE)
Combines the functionality of CONFIG_GETTER
and CONFIG_SETTER
. GETFUNC
is simultaneously the name of the getter function and the option key as it appears in the config file. SETFUNC
is the name of the setter function. TYPE
is the C++ type of the value.
define CONFIG_GROUP_GENERAL#
#define CONFIG_GROUP_GENERAL "General"
define CONFIG_GROUP_SHORTCUTS#
#define CONFIG_GROUP_SHORTCUTS "Shortcuts"
define CONFIG_SETTER#
#define CONFIG_SETTER (
FUNC,
KEY,
TYPE
) void FUNC(const TYPE& val) \
{ \
QString key = QStringLiteral(#KEY); \
/* Without this check, multiple `flameshot gui` instances running */ \
/* simultaneously would cause an endless loop of fileWatcher calls */ \
if (QVariant::fromValue(val) != value(key)) { \
setValue(key, QVariant::fromValue(val)); \
} \
}
Declare and implement a setter for a config option. FUNC
is the name of the generated function, KEY
is the option key as it appears in the config file and TYPE
is the C++ type.