From 477f7f1d7de4c3e7746ca446f55aedee558ecbb6 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 26 Mar 2024 13:45:26 +0800 Subject: [PATCH] - enhancement: Info contents from stderr are logged into "Tools Output" panel, add problem case name info to the log. --- NEWS.md | 1 + RedPandaIDE/compiler/ojproblemcasesrunner.cpp | 2 +- RedPandaIDE/compiler/ojproblemcasesrunner.h | 4 +++ RedPandaIDE/translations/RedPandaIDE_pt_BR.ts | 35 +++++++++++-------- RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 27 ++++++++------ RedPandaIDE/translations/RedPandaIDE_zh_TW.ts | 35 +++++++++++-------- 6 files changed, 62 insertions(+), 42 deletions(-) diff --git a/NEWS.md b/NEWS.md index f83606ce..c3f0c740 100644 --- a/NEWS.md +++ b/NEWS.md @@ -91,6 +91,7 @@ Red Panda C++ Version 2.27 - enhancement: Auto define macro "_DEBUG" for "Debug" compiler set(like visual studio). - enhancement: Suggest macro names after "#ifdef"/"#ifndef". + - enhancement: Info contents from stderr are logged into "Tools Output" panel, add problem case name info to the log. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/compiler/ojproblemcasesrunner.cpp b/RedPandaIDE/compiler/ojproblemcasesrunner.cpp index 3dc7c58e..245c697c 100644 --- a/RedPandaIDE/compiler/ojproblemcasesrunner.cpp +++ b/RedPandaIDE/compiler/ojproblemcasesrunner.cpp @@ -84,7 +84,7 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase) env.insert("PATH",path); process.setProcessEnvironment(env); if (pSettings->executor().redirectStderrToToolLog()) { - emit logStderrOutput("\n"); + emit logStderrOutput("\n"+tr("--- stderr from %1 ---").arg(problemCase->name)+"\n"); } else { process.setProcessChannelMode(QProcess::MergedChannels); process.setReadChannel(QProcess::StandardOutput); diff --git a/RedPandaIDE/compiler/ojproblemcasesrunner.h b/RedPandaIDE/compiler/ojproblemcasesrunner.h index bc443388..c1e14b93 100644 --- a/RedPandaIDE/compiler/ojproblemcasesrunner.h +++ b/RedPandaIDE/compiler/ojproblemcasesrunner.h @@ -49,6 +49,9 @@ public: void setMemoryLimit(size_t limit); + bool includeOutputFromStderr() const; + void setIncludeOutputFromStderr(bool newIncludeOutputFromStderr); + signals: void caseStarted(const QString &caseId, int current, int total); void caseFinished(const QString &caseId, int current, int total); @@ -68,6 +71,7 @@ private: int mOutputRefreshTime; int mExecTimeout; size_t mMemoryLimit; + bool mIncludeOutputFromStderr; }; #endif // OJPROBLEMCASESRUNNER_H diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index 6fcee7db..98d5eca5 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -1382,7 +1382,7 @@ - + @@ -1390,7 +1390,7 @@ Erro - + Save As Salvar como @@ -1400,7 +1400,7 @@ Arquivo %1 já aberto! - + The text to be copied exceeds count limit! O texto a ser copiado excede o limite do contador! @@ -1432,7 +1432,7 @@ Ctrl+clik para mais informações - + astyle not found astyle não encontrado @@ -1457,13 +1457,13 @@ Apenas leitura - + Error Load File Erro ao carregar arquivo - + hex: %1 @@ -2907,18 +2907,18 @@ - + Can't delete the old executable file "%1". Impossível remover o antigo arquivo executável "%1". - + Can't find the compiler for file %1 Impossível encontrar o compilador para o arquivo %1 - + The Compiler '%1' doesn't exists! O compilador '%1' é inexistente! @@ -2942,7 +2942,7 @@ - + Checking single file... @@ -2952,7 +2952,7 @@ - + Command: %1 Comando: %1 @@ -7345,7 +7345,12 @@ - + + --- stderr from %1 --- + + + + Memory limit exceeded! @@ -7674,7 +7679,7 @@ - Arquivo de recursos: %1 - + Compiling project changes... Compilando alterações em projeto ... @@ -8374,7 +8379,7 @@ - + Can't open file '%1' for read. @@ -9676,7 +9681,7 @@ Impossível abrir '%1' para gravar! - + Compiling project changes... Compilando alterações em projeto ... diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index 82394379..5621a1db 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -1596,7 +1596,7 @@ p, li { white-space: pre-wrap; } - + @@ -1608,7 +1608,7 @@ p, li { white-space: pre-wrap; } 无法写入文件"%1" - + Error Load File 载入文件错误 @@ -1648,7 +1648,7 @@ p, li { white-space: pre-wrap; } 文件%1已经被打开! - + The text to be copied exceeds count limit! 要复制的内容超过了行数限制! @@ -1694,7 +1694,7 @@ p, li { white-space: pre-wrap; } 未找到符号'%1'! - + astyle not found 找不到astyle程序 @@ -3222,13 +3222,13 @@ p, li { white-space: pre-wrap; } - + Can't delete the old executable file "%1". 无法删除旧的可执行文件"%1". - + GNU Assembler GNU汇编 @@ -3239,7 +3239,7 @@ p, li { white-space: pre-wrap; } 找不到适合文件%1的编译器 - + The Compiler '%1' doesn't exists! 编译器程序"%1"不存在! @@ -7930,7 +7930,12 @@ p, li { white-space: pre-wrap; } 案例运行超时 - + + --- stderr from %1 --- + --- 来自“%1”的stderr --- + + + Time limit exceeded! 运行时间超限! @@ -8312,7 +8317,7 @@ p, li { white-space: pre-wrap; } - 资源文件: %1 - + Compiling project changes... 正在编译项目修改... @@ -9234,7 +9239,7 @@ p, li { white-space: pre-wrap; } 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? @@ -10421,7 +10426,7 @@ p, li { white-space: pre-wrap; } 无法写入文件'%1'! - + Compiling project changes... 正在编译项目修改... diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 382f3c6e..d6e5c091 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -1227,7 +1227,7 @@ - + @@ -1235,7 +1235,7 @@ - + Save As @@ -1245,7 +1245,7 @@ - + The text to be copied exceeds count limit! @@ -1277,7 +1277,7 @@ - + astyle not found @@ -1302,13 +1302,13 @@ - + Error Load File - + hex: %1 @@ -2716,18 +2716,18 @@ - + Can't delete the old executable file "%1". - + Can't find the compiler for file %1 - + The Compiler '%1' doesn't exists! @@ -2747,7 +2747,7 @@ - + Checking single file... @@ -2757,7 +2757,7 @@ - + Command: %1 @@ -7030,7 +7030,12 @@ - + + --- stderr from %1 --- + + + + Memory limit exceeded! @@ -7335,7 +7340,7 @@ - + Compiling project changes... @@ -8002,7 +8007,7 @@ - + Can't open file '%1' for read. @@ -9077,7 +9082,7 @@ - + Compiling project changes...