mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 11:35:38 -04:00
[rpcli] rpcli.cpp: Colorize output in ExtractImages().
NOTE: Using Yellow for cases where an animated icon is requested but libpng doesn't support APNG. Add "is" to the "APNG is not supported" line.
This commit is contained in:
parent
b347c4fad6
commit
1dc3609bc7
@ -10178,7 +10178,7 @@ msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -10197,7 +10197,7 @@ msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -10192,7 +10192,7 @@ msgstr "Extracción de iconos animados en '{:s}'"
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr "No es compatible con APNG. Sólo se extrae el primer fotograma."
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -10109,7 +10109,7 @@ msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -10187,7 +10187,7 @@ msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -10219,7 +10219,7 @@ msgstr "Extração de ícone animado em '{:s}'"
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr "Incompatível com APNG. Somente primeiro quadro extraído."
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -10144,7 +10144,7 @@ msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -10257,7 +10257,7 @@ msgstr "Извлекаем анимированную иконку в '{:s}'"
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr "Нет поддержки APNG — только первый кард будет извлечён"
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -10168,7 +10168,7 @@ msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:200
|
||||
msgctxt "rpcli"
|
||||
msgid "APNG not supported, extracting only the first frame"
|
||||
msgid "APNG is not supported, extracting only the first frame"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/rpcli/rpcli.cpp:219
|
||||
|
@ -177,26 +177,33 @@ static void ExtractImages(const RomData *romData, const vector<ExtractParam> &ex
|
||||
|
||||
if (image && image->isValid()) {
|
||||
found = true;
|
||||
ConsoleSetTextColor(&ci_stderr, 6, true); // cyan
|
||||
ConsolePrint(&ci_stderr, "-- ");
|
||||
if (likely(!isMipmap)) {
|
||||
// tr: {0:s} == image type name, {1:s} == output filename
|
||||
ConsolePrint(&ci_stderr,
|
||||
fmt::format(FRUN(C_("rpcli", "Extracting {0:s} into '{1:s}'")),
|
||||
RomData::getImageTypeName(imageType),
|
||||
T2U8c(p.filename)), true);
|
||||
T2U8c(p.filename)));
|
||||
} else {
|
||||
// tr: {0:d} == mipmap level, {1:s} == output filename
|
||||
ConsolePrint(&ci_stderr,
|
||||
fmt::format(FRUN(C_("rpcli", "Extracting mipmap level {0:d} into '{1:s}'")),
|
||||
p.mipmapLevel, T2U8c(p.filename)), true);
|
||||
p.mipmapLevel, T2U8c(p.filename)));
|
||||
}
|
||||
ConsoleResetTextColor(&ci_stderr);
|
||||
ConsolePrintNewline(&ci_stderr);
|
||||
fflush(stderr);
|
||||
|
||||
int errcode = RpPng::save(p.filename, image);
|
||||
if (errcode != 0) {
|
||||
// tr: {0:s} == filename, {1:s} == error message
|
||||
ConsoleSetTextColor(&ci_stderr, 1, true); // red
|
||||
ConsolePrint(&ci_stderr,
|
||||
fmt::format(FRUN(C_("rpcli", "Couldn't create file '{0:s}': {1:s}")),
|
||||
T2U8c(p.filename), strerror(-errcode)), true);
|
||||
T2U8c(p.filename), strerror(-errcode)));
|
||||
ConsoleResetTextColor(&ci_stderr);
|
||||
ConsolePrintNewline(&ci_stderr);
|
||||
} else {
|
||||
ConsolePrint(&ci_stderr, " ");
|
||||
ConsolePrint(&ci_stderr, C_("rpcli", "Done"), true);
|
||||
@ -208,25 +215,35 @@ static void ExtractImages(const RomData *romData, const vector<ExtractParam> &ex
|
||||
auto iconAnimData = romData->iconAnimData();
|
||||
if (iconAnimData && iconAnimData->count != 0 && iconAnimData->seq_count != 0) {
|
||||
found = true;
|
||||
ConsoleSetTextColor(&ci_stderr, 6, true); // cyan
|
||||
ConsolePrint(&ci_stderr, "-- ");
|
||||
ConsolePrint(&ci_stderr,
|
||||
fmt::format(FRUN(C_("rpcli", "Extracting animated icon into '{:s}'")),
|
||||
T2U8c(p.filename)), true);
|
||||
T2U8c(p.filename)));
|
||||
ConsoleResetTextColor(&ci_stderr);
|
||||
ConsolePrintNewline(&ci_stderr);
|
||||
fflush(stderr);
|
||||
|
||||
int errcode = RpPng::save(p.filename, iconAnimData);
|
||||
if (errcode == -ENOTSUP) {
|
||||
ConsoleSetTextColor(&ci_stderr, 3, true); // yellow
|
||||
ConsolePrint(&ci_stderr, " ");
|
||||
ConsolePrint(&ci_stderr,
|
||||
C_("rpcli", "APNG not supported, extracting only the first frame"), true);
|
||||
C_("rpcli", "APNG is not supported, extracting only the first frame"));
|
||||
ConsoleResetTextColor(&ci_stderr);
|
||||
ConsolePrintNewline(&ci_stderr);
|
||||
fflush(stderr);
|
||||
// falling back to outputting the first frame
|
||||
errcode = RpPng::save(p.filename, iconAnimData->frames[iconAnimData->seq_index[0]]);
|
||||
}
|
||||
if (errcode != 0) {
|
||||
ConsoleSetTextColor(&ci_stderr, 1, true); // red
|
||||
ConsolePrint(&ci_stderr, " ");
|
||||
ConsolePrint(&ci_stderr,
|
||||
fmt::format(FRUN(C_("rpcli", "Couldn't create file '{0:s}': {1:s}")),
|
||||
T2U8c(p.filename), strerror(-errcode)), true);
|
||||
T2U8c(p.filename), strerror(-errcode)));
|
||||
ConsoleResetTextColor(&ci_stderr);
|
||||
ConsolePrintNewline(&ci_stderr);
|
||||
} else {
|
||||
ConsolePrint(&ci_stderr, " ");
|
||||
ConsolePrint(&ci_stderr, C_("rpcli", "Done"), true);
|
||||
@ -237,22 +254,23 @@ static void ExtractImages(const RomData *romData, const vector<ExtractParam> &ex
|
||||
|
||||
if (!found) {
|
||||
// TODO: Return an error code?
|
||||
ConsoleSetTextColor(&ci_stderr, 1, true); // red
|
||||
ConsolePrint(&ci_stderr, "-- ");
|
||||
if (p.imageType == -1) {
|
||||
ConsolePrint(&ci_stderr, "-- ");
|
||||
ConsolePrint(&ci_stderr, C_("rpcli", "Animated icon not found"), true);
|
||||
ConsolePrint(&ci_stderr, C_("rpcli", "Animated icon not found"));
|
||||
} else if (p.mipmapLevel >= 0) {
|
||||
ConsolePrint(&ci_stderr, "-- ");
|
||||
ConsolePrint(&ci_stderr,
|
||||
fmt::format(FRUN(C_("rpcli", "Mipmap level {:d} not found")), p.mipmapLevel), true);
|
||||
fmt::format(FRUN(C_("rpcli", "Mipmap level {:d} not found")), p.mipmapLevel));
|
||||
} else {
|
||||
const RomData::ImageType imageType =
|
||||
static_cast<RomData::ImageType>(p.imageType);
|
||||
ConsolePrint(&ci_stderr, "-- ");
|
||||
ConsolePrint(&ci_stderr,
|
||||
fmt::format(FRUN(C_("rpcli", "Image '{:s}' not found")),
|
||||
RomData::getImageTypeName(imageType)), true);
|
||||
RomData::getImageTypeName(imageType)));
|
||||
}
|
||||
cerr.flush();
|
||||
ConsoleResetTextColor(&ci_stderr);
|
||||
ConsolePrintNewline(&ci_stderr);
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -352,6 +370,7 @@ static void DoFile(const TCHAR *filename, bool json, const vector<ExtractParam>
|
||||
fflush(stdout);
|
||||
// TODO: Error checking.
|
||||
win32_console_print_ansi_color(oss.str().c_str());
|
||||
fflush(stdout);
|
||||
} else
|
||||
#endif /* _WIN32 */
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user