mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Options (Logo): renaming symbols
This commit is contained in:
+3
-2
@@ -32,7 +32,7 @@ static void initState(FFstate* state)
|
||||
|
||||
static void defaultConfig(void)
|
||||
{
|
||||
ffInitLogoOptions(&instance.config.logo);
|
||||
ffOptionsInitLogo(&instance.config.logo);
|
||||
ffOptionsInitGeneral(&instance.config.general);
|
||||
|
||||
ffStrbufInit(&instance.config.colorKeys);
|
||||
@@ -268,7 +268,8 @@ void ffFinish(void)
|
||||
|
||||
static void destroyConfig(void)
|
||||
{
|
||||
ffDestroyLogoOptions(&instance.config.logo);
|
||||
ffOptionsDestroyLogo(&instance.config.logo);
|
||||
ffOptionsDestroyGeneral(&instance.config.general);
|
||||
|
||||
ffStrbufDestroy(&instance.config.colorKeys);
|
||||
ffStrbufDestroy(&instance.config.colorTitle);
|
||||
|
||||
+3
-3
@@ -538,7 +538,7 @@ static void parseOption(FFdata* data, const char* key, const char* value)
|
||||
//Logo options//
|
||||
////////////////
|
||||
|
||||
else if(ffParseLogoCommandOptions(&instance.config.logo, key, value)) {}
|
||||
else if(ffOptionsParseLogoCommandLine(&instance.config.logo, key, value)) {}
|
||||
|
||||
///////////////////
|
||||
//Display options//
|
||||
@@ -793,7 +793,7 @@ static void run(FFdata* data)
|
||||
|
||||
if (
|
||||
error ||
|
||||
(error = ffParseLogoJsonConfig(&instance.config.logo, root)) ||
|
||||
(error = ffOptionsParseLogoJsonConfig(&instance.config.logo, root)) ||
|
||||
(error = ffOptionsParseGeneralJsonConfig(&instance.config.general, root)) ||
|
||||
(error = ffParseDisplayJsonConfig(&instance.config)) ||
|
||||
(error = ffParseLibraryJsonConfig(&instance.config)) ||
|
||||
@@ -830,7 +830,7 @@ static void run(FFdata* data)
|
||||
|
||||
static void migrateConfig(FFdata* data)
|
||||
{
|
||||
ffGenerateLogoJsonConfig(&instance.config.logo, instance.state.migrateConfigDoc);
|
||||
ffOptionsGenerateLogoJsonConfig(&instance.config.logo, instance.state.migrateConfigDoc);
|
||||
ffMigrateCommandOptionToJsonc(data);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ typedef enum FFTemperatureUnit
|
||||
|
||||
typedef struct FFconfig
|
||||
{
|
||||
FFLogoOptions logo;
|
||||
FFOptionsLogo logo;
|
||||
FFOptionsGeneral general;
|
||||
|
||||
//If one of those is empty, ffLogoPrint will set them
|
||||
|
||||
@@ -37,7 +37,7 @@ static FFstrbuf base64Encode(const FFstrbuf* in)
|
||||
|
||||
static bool printImageIterm(void)
|
||||
{
|
||||
const FFLogoOptions* options = &instance.config.logo;
|
||||
const FFOptionsLogo* options = &instance.config.logo;
|
||||
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
|
||||
if(!ffAppendFileBuffer(options->source.chars, &buf))
|
||||
{
|
||||
@@ -118,7 +118,7 @@ static bool printImageIterm(void)
|
||||
|
||||
static bool printImageKittyDirect(void)
|
||||
{
|
||||
const FFLogoOptions* options = &instance.config.logo;
|
||||
const FFOptionsLogo* options = &instance.config.logo;
|
||||
FF_STRBUF_AUTO_DESTROY base64 = base64Encode(&options->source);
|
||||
|
||||
if (!options->width || !options->height)
|
||||
@@ -296,7 +296,7 @@ static void writeCacheUint32(FFLogoRequestData* requestData, uint32_t value, con
|
||||
|
||||
static void printImagePixels(FFLogoRequestData* requestData, const FFstrbuf* result, const char* cacheFileName)
|
||||
{
|
||||
const FFLogoOptions* options = &instance.config.logo;
|
||||
const FFOptionsLogo* options = &instance.config.logo;
|
||||
//Calculate character dimensions
|
||||
instance.state.logoWidth = requestData->logoCharacterWidth + options->paddingLeft + options->paddingRight;
|
||||
instance.state.logoHeight = requestData->logoCharacterHeight + options->paddingTop - 1;
|
||||
|
||||
+9
-9
@@ -18,7 +18,7 @@ typedef enum FFLogoSize
|
||||
|
||||
static void ffLogoPrintCharsRaw(const char* data, size_t length)
|
||||
{
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
|
||||
|
||||
if (!options->width || !options->height)
|
||||
@@ -55,7 +55,7 @@ static void ffLogoPrintCharsRaw(const char* data, size_t length)
|
||||
|
||||
void ffLogoPrintChars(const char* data, bool doColorReplacement)
|
||||
{
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
|
||||
uint32_t currentlineLength = 0;
|
||||
|
||||
@@ -301,7 +301,7 @@ static void logoPrintStruct(const FFlogo* logo)
|
||||
{
|
||||
logoApplyColors(logo);
|
||||
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
|
||||
const char* const* colors = logo->colors;
|
||||
for(int i = 0; *colors != NULL && i < FASTFETCH_LOGO_MAX_COLORS; i++, colors++)
|
||||
@@ -344,7 +344,7 @@ static inline void logoPrintDetected(FFLogoSize size)
|
||||
|
||||
static bool logoPrintData(bool doColorReplacement)
|
||||
{
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
if(options->source.length == 0)
|
||||
return false;
|
||||
|
||||
@@ -355,7 +355,7 @@ static bool logoPrintData(bool doColorReplacement)
|
||||
|
||||
static void updateLogoPath(void)
|
||||
{
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
|
||||
if(ffPathExists(options->source.chars, FF_PATHTYPE_FILE))
|
||||
return;
|
||||
@@ -384,7 +384,7 @@ static void updateLogoPath(void)
|
||||
|
||||
static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
|
||||
{
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate();
|
||||
|
||||
@@ -417,7 +417,7 @@ static bool logoPrintImageIfExists(FFLogoType logo, bool printError)
|
||||
|
||||
static bool logoTryKnownType(void)
|
||||
{
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
|
||||
if(options->type == FF_LOGO_TYPE_NONE)
|
||||
{
|
||||
@@ -469,7 +469,7 @@ void ffLogoPrint(void)
|
||||
return;
|
||||
}
|
||||
|
||||
const FFLogoOptions* options = &instance.config.logo;
|
||||
const FFOptionsLogo* options = &instance.config.logo;
|
||||
|
||||
if (options->type == FF_LOGO_TYPE_NONE)
|
||||
{
|
||||
@@ -535,7 +535,7 @@ void ffLogoPrintRemaining(void)
|
||||
|
||||
void ffLogoBuiltinPrint(void)
|
||||
{
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
FFOptionsLogo* options = &instance.config.logo;
|
||||
|
||||
for(uint8_t ch = 0; ch < 26; ++ch)
|
||||
{
|
||||
|
||||
+7
-7
@@ -3,7 +3,7 @@
|
||||
#include "common/jsonconfig.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffInitLogoOptions(FFLogoOptions* options)
|
||||
void ffOptionsInitLogo(FFOptionsLogo* options)
|
||||
{
|
||||
ffStrbufInit(&options->source);
|
||||
options->type = FF_LOGO_TYPE_AUTO;
|
||||
@@ -26,7 +26,7 @@ void ffInitLogoOptions(FFLogoOptions* options)
|
||||
options->chafaDitherMode = UINT32_MAX;
|
||||
}
|
||||
|
||||
bool ffParseLogoCommandOptions(FFLogoOptions* options, const char* key, const char* value)
|
||||
bool ffOptionsParseLogoCommandLine(FFOptionsLogo* options, const char* key, const char* value)
|
||||
{
|
||||
if (strcasecmp(key, "-l") == 0)
|
||||
goto logoType;
|
||||
@@ -203,7 +203,7 @@ logoType:
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffDestroyLogoOptions(FFLogoOptions* options)
|
||||
void ffOptionsDestroyLogo(FFOptionsLogo* options)
|
||||
{
|
||||
ffStrbufDestroy(&options->source);
|
||||
ffStrbufDestroy(&options->chafaSymbols);
|
||||
@@ -211,7 +211,7 @@ void ffDestroyLogoOptions(FFLogoOptions* options)
|
||||
ffStrbufDestroy(&options->colors[i]);
|
||||
}
|
||||
|
||||
const char* ffParseLogoJsonConfig(FFLogoOptions* options, yyjson_val* root)
|
||||
const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* root)
|
||||
{
|
||||
yyjson_val* object = yyjson_obj_get(root, "logo");
|
||||
if (!object) return NULL;
|
||||
@@ -412,10 +412,10 @@ const char* ffParseLogoJsonConfig(FFLogoOptions* options, yyjson_val* root)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ffGenerateLogoJsonConfig(FFLogoOptions* options, yyjson_mut_doc* doc)
|
||||
void ffOptionsGenerateLogoJsonConfig(FFOptionsLogo* options, yyjson_mut_doc* doc)
|
||||
{
|
||||
__attribute__((__cleanup__(ffDestroyLogoOptions))) FFLogoOptions defaultOptions;
|
||||
ffInitLogoOptions(&defaultOptions);
|
||||
__attribute__((__cleanup__(ffOptionsDestroyLogo))) FFOptionsLogo defaultOptions;
|
||||
ffOptionsInitLogo(&defaultOptions);
|
||||
|
||||
yyjson_mut_val* obj = yyjson_mut_obj(doc);
|
||||
|
||||
|
||||
+7
-7
@@ -23,7 +23,7 @@ typedef enum FFLogoType
|
||||
FF_LOGO_TYPE_NONE, //--logo none
|
||||
} FFLogoType;
|
||||
|
||||
typedef struct FFLogoOptions
|
||||
typedef struct FFOptionsLogo
|
||||
{
|
||||
FFstrbuf source;
|
||||
FFLogoType type;
|
||||
@@ -43,10 +43,10 @@ typedef struct FFLogoOptions
|
||||
uint32_t chafaCanvasMode;
|
||||
uint32_t chafaColorSpace;
|
||||
uint32_t chafaDitherMode;
|
||||
} FFLogoOptions;
|
||||
} FFOptionsLogo;
|
||||
|
||||
void ffInitLogoOptions(FFLogoOptions* options);
|
||||
bool ffParseLogoCommandOptions(FFLogoOptions* options, const char* key, const char* value);
|
||||
void ffDestroyLogoOptions(FFLogoOptions* options);
|
||||
const char* ffParseLogoJsonConfig(FFLogoOptions* options, yyjson_val* root);
|
||||
void ffGenerateLogoJsonConfig(FFLogoOptions* options, yyjson_mut_doc* doc);
|
||||
void ffOptionsInitLogo(FFOptionsLogo* options);
|
||||
bool ffOptionsParseLogoCommandLine(FFOptionsLogo* options, const char* key, const char* value);
|
||||
void ffOptionsDestroyLogo(FFOptionsLogo* options);
|
||||
const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* root);
|
||||
void ffOptionsGenerateLogoJsonConfig(FFOptionsLogo* options, yyjson_mut_doc* doc);
|
||||
|
||||
Reference in New Issue
Block a user