From 24f88f8d35d9bed95494fd0c1092f89e72413bc6 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 2 Apr 2024 17:19:50 +0800 Subject: [PATCH] minor fix fix: can't edit custom tool items update translations add log info for tool output --- RedPandaIDE/mainwindow.cpp | 10 + .../settingsdialog/toolsgeneralwidget.cpp | 4 +- .../settingsdialog/toolsgeneralwidget.ui | 2 +- RedPandaIDE/translations/RedPandaIDE_pt_BR.ts | 202 +++++++++--------- RedPandaIDE/translations/RedPandaIDE_zh_CN.ts | 176 ++++++++------- RedPandaIDE/translations/RedPandaIDE_zh_TW.ts | 198 +++++++++-------- libs/redpanda_qt_utils/qt_utils/utils.cpp | 4 +- 7 files changed, 318 insertions(+), 278 deletions(-) diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 8a067217..db2d3397 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -43,6 +43,7 @@ #include "iconsmanager.h" #include "widgets/newclassdialog.h" #include "widgets/newheaderdialog.h" +#include "utils/escape.h" #ifdef ENABLE_LUA_ADDON #include "addon/executor.h" #include "addon/runtime.h" @@ -1210,6 +1211,9 @@ void MainWindow::onFileSaved(const QString &path, bool inProject) ui->treeFiles->update(index); } } +#else + Q_UNUSED(path); + Q_UNUSED(inProject); #endif //updateForEncodingInfo(); } @@ -1237,6 +1241,7 @@ void MainWindow::executeTool(PToolItem item) inputContent=e->text().toUtf8(); break; } + QString command; if (!fileExists(program)) { QTemporaryFile file(QDir::tempPath()+QDir::separator()+"XXXXXX.bat"); @@ -1248,15 +1253,20 @@ void MainWindow::executeTool(PToolItem item) file.write(escapeCommandForPlatformShell(program, params).toLocal8Bit() + LINE_BREAKER); file.close(); + command = escapeCommandForLog(file.fileName(), params); output = runAndGetOutput(file.fileName(), workDir, params, inputContent); } } else { + command = escapeCommandForLog(program, params); output = runAndGetOutput(program, workDir, params, inputContent); } switch(item->outputTarget) { case ToolItemOutputTarget::RedirectToToolsOutputPanel: clearToolsOutput(); + logToolsOutput(tr(" - Command: %1").arg(command)); logToolsOutput(QString::fromUtf8(output)); + stretchMessagesPanel(true); + ui->tabMessages->setCurrentWidget(ui->tabToolsOutput); break; case ToolItemOutputTarget::RedirectToNull: break; diff --git a/RedPandaIDE/settingsdialog/toolsgeneralwidget.cpp b/RedPandaIDE/settingsdialog/toolsgeneralwidget.cpp index ebf475ce..8ce6bedc 100644 --- a/RedPandaIDE/settingsdialog/toolsgeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/toolsgeneralwidget.cpp @@ -82,7 +82,7 @@ ToolsGeneralWidget::~ToolsGeneralWidget() void ToolsGeneralWidget::editTool(const QModelIndex &index) { - if (mCurrentEditingRow>=-1) + if (mCurrentEditingRow>=0) return; if (!index.isValid()) return; @@ -368,7 +368,7 @@ void ToolsGeneralWidget::on_btnBrowseProgram_clicked() if (!fileName.isEmpty() ) { QString appPath = includeTrailingPathDelimiter(pSettings->dirs().appDir()); if (fileName.startsWith(appPath)) - fileName = ""+fileName.mid(appPath.length()); + fileName = QString("") + QDir::separator() + fileName.mid(appPath.length()); ui->txtProgram->setText(fileName); } } diff --git a/RedPandaIDE/settingsdialog/toolsgeneralwidget.ui b/RedPandaIDE/settingsdialog/toolsgeneralwidget.ui index 7b4a8c2c..d4186c0e 100644 --- a/RedPandaIDE/settingsdialog/toolsgeneralwidget.ui +++ b/RedPandaIDE/settingsdialog/toolsgeneralwidget.ui @@ -108,7 +108,7 @@ true - QAbstractItemView::DragDrop + QAbstractItemView::InternalMove Qt::MoveAction diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index 1b3471e7..3555cbb1 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -4276,7 +4276,7 @@ MainWindow - + Red Panda C++ Red Panda C++ @@ -4316,14 +4316,14 @@ - + New Problem Set Novo conjunto de problemas - + Add Problem Acrescentar problema @@ -4338,15 +4338,15 @@ - + Save Problem Set Salvar conjunto de problemas - - + + Load Problem Set Carregar conjunto de problemas @@ -4383,7 +4383,7 @@ - + Debug Console Console do depurador @@ -5063,7 +5063,7 @@ - + Clear all breakpoints Limpar todos os pontos de paradas @@ -5483,14 +5483,14 @@ Ctrl+Shift+Down - + - - + + @@ -5501,7 +5501,7 @@ Erro - + New Novo @@ -5527,18 +5527,18 @@ - + Problem Set %1 Conjunto de problemas %1 - + Load Theme Error Erro ao carregar tema - + @@ -5731,7 +5731,12 @@ Propriedades... - + + - Command: %1 + + + + Line: %1/%2 Col: %3 Sel: %4 @@ -5812,12 +5817,12 @@ - + Add Folder Acrescentar pasta - + Rename Folder Renomear pasta @@ -5863,18 +5868,18 @@ - + New Folder Nova pasta - + New File Novo arquivo - + @@ -5882,7 +5887,7 @@ Remover - + Open in Editor Abrir no editor @@ -5902,7 +5907,7 @@ Abrir no navegador de arquivos - + Character sets Conjuntos de caracteres @@ -6416,8 +6421,8 @@ Escolher arquivo para a saída esperada de dados - - + + Batch Set Cases Conjunto de casos em lote @@ -6492,7 +6497,7 @@ Expressão a observar - + Rename Renomear @@ -6525,7 +6530,7 @@ Deslocar para a linha ... - + Go to Line Deslocar para linha @@ -6543,7 +6548,7 @@ - + Open Anwser Source File @@ -6563,7 +6568,7 @@ - + Template Exists @@ -6573,35 +6578,35 @@ - + - + Wrong Compiler Settings - + - + Compiler is set not to generate executable. - - + + We need the executabe to run problem case. - - + + Please correct this before start debugging - + Can't open last open information file '%1' for write! @@ -6653,12 +6658,12 @@ - + Import FPS Problem Set - + Rename Problem @@ -6668,7 +6673,7 @@ - + FPS Problem Set Files (*.fps;*.xml) @@ -6679,8 +6684,8 @@ - - + + Export FPS Problem Set @@ -6695,7 +6700,7 @@ - + Rename Problem Set @@ -6710,7 +6715,7 @@ - + Newline @@ -6820,7 +6825,7 @@ - + Missing Project Files @@ -6830,7 +6835,7 @@ - + Save settings failed! @@ -6855,14 +6860,14 @@ - + - + Correct compile settings for debug - + The generated executable won't have debug symbol infos, and can't be debugged. @@ -6870,49 +6875,49 @@ - + Or you can manually change the following settings in the options dialog's compiler set page: - - - - - - Turned on the "Generate debug info (-g3)" option. - - - - - - - - Turned off the "Strip executable (-s)" option. - - - - - - - - Turned off the "Optimization level (-O)" option or set it to "Debug (-Og)". - - - + + - Turned on the "Generate debug info (-g3)" option. + + + + + + + - Turned off the "Strip executable (-s)" option. + + + + + + + - Turned off the "Optimization level (-O)" option or set it to "Debug (-Og)". + + + + + + If you are using the Release compiler set, please use choose the Debug version from toolbar. - + - + Do you want to mannually change the compiler set settings now? - + - + You should recompile after change the compiler set or it's settings. @@ -7013,7 +7018,7 @@ - + Exact @@ -7028,7 +7033,7 @@ - + Folder Not Empty @@ -7043,7 +7048,7 @@ - + Line: %1/%2 Char: %3/%4 @@ -8376,7 +8381,7 @@ QFileSystemModel - + <b>The name "%1" cannot be used.</b><p>Try using another name, with fewer characters or no punctuation marks. @@ -8676,7 +8681,7 @@ - + Save Salvar @@ -10197,7 +10202,7 @@ Cancelar - + @@ -10261,9 +10266,9 @@ Desempenho - + - + @@ -10271,8 +10276,8 @@ Compilador - - + + Compiler @@ -10381,8 +10386,8 @@ Opções de projeto - - + + @@ -10677,13 +10682,18 @@ Add Acrescentar + + + Edit + Editar + Remove Remover - + Output To @@ -10738,7 +10748,7 @@ Inserir macro - + Save Changes? Salvar alterações? @@ -10747,7 +10757,7 @@ Quer salvar as alterações na ferramenta atual? - + Choose Folder Escolher pasta @@ -10761,7 +10771,7 @@ Arquivos executáveis (*.exe) - + None @@ -10792,12 +10802,12 @@ - + Do you want to save changes to "%1"? - + Error Erro @@ -10807,7 +10817,7 @@ - + untitled sem nome diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index 9850d1f5..cbcf97b2 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -4629,14 +4629,14 @@ p, li { white-space: pre-wrap; } MainWindow - + Red Panda C++ 小熊猫C++ - + @@ -4714,7 +4714,7 @@ p, li { white-space: pre-wrap; } - + Debug Console 调试主控台 @@ -4790,7 +4790,7 @@ p, li { white-space: pre-wrap; } 工具栏2 - + New 新建 @@ -4923,7 +4923,7 @@ p, li { white-space: pre-wrap; } - + Copy @@ -5078,14 +5078,14 @@ p, li { white-space: pre-wrap; } - + New Problem Set 新建试题集 - + Add Problem 添加试题 @@ -5100,15 +5100,15 @@ p, li { white-space: pre-wrap; } - + Save Problem Set 保存试题集 - - + + Load Problem Set 载入试题集 @@ -5156,7 +5156,7 @@ p, li { white-space: pre-wrap; } - + Remove Problem Case Remove Problem Set 删除试题案例 @@ -5239,14 +5239,14 @@ p, li { white-space: pre-wrap; } - + Import FPS Problem Set 导入FPS试题集 - - + + Export FPS Problem Set 导出FPS试题集 @@ -5860,7 +5860,7 @@ p, li { white-space: pre-wrap; } 保存为模板... - + New File 新建文件 @@ -5901,7 +5901,7 @@ p, li { white-space: pre-wrap; } - + Rename Symbol 重命名符号 @@ -6202,12 +6202,12 @@ p, li { white-space: pre-wrap; } 文件编码 - + Recent Files 文件历史 - + @@ -6292,27 +6292,27 @@ p, li { white-space: pre-wrap; } - + Wrong Compiler Settings 错误的编译器设置 - + - + Compiler is set not to generate executable. 编译器被设置为不生成可执行文件。 - - + + We need the executabe to run problem case. 我们需要可执行文件来运行试题案例。 - + No compiler set 无编译器设置 @@ -6369,7 +6369,7 @@ p, li { white-space: pre-wrap; } - + Please correct this before start debugging 请在调试前改正设置。 @@ -6378,7 +6378,7 @@ p, li { white-space: pre-wrap; } 重新编译? - + Save last open info error 保存上次打开信息失败 @@ -6425,12 +6425,12 @@ p, li { white-space: pre-wrap; } - + Correct compile settings for debug 纠正调试用编译设置 - + The generated executable won't have debug symbol infos, and can't be debugged. 生成的可执行文件中会缺少调试符号信息,因此无法编译。 @@ -6442,54 +6442,54 @@ p, li { white-space: pre-wrap; } - + Or you can manually change the following settings in the options dialog's compiler set page: 您也可以手动在选项对话框的编译器设置页中修正下列选项: - + - + - Turned on the "Generate debug info (-g3)" option. - 打开“生成调试信息(-g3)"选项. - + - + - Turned off the "Strip executable (-s)" option. - 关闭"剥除附加信息(-s)"选项. - + - + - Turned off the "Optimization level (-O)" option or set it to "Debug (-Og)". - 关闭"优化级别(-O)选项,或将其设置为"调试(-Og)"级别. - + - + You should recompile after change the compiler set or it's settings. 在更换编译器设置集或修改其设置后,需要重新编译. - + - + Do you want to mannually change the compiler set settings now? 您现在就要手动修改编译器设置集的设置吗? - - + + Batch Set Cases 批量设置案例 - + Show detail debug logs 显示详细调试器日志 @@ -6499,7 +6499,7 @@ p, li { white-space: pre-wrap; } 全部复制 - + Go to Line 跳转到行 @@ -6522,14 +6522,14 @@ p, li { white-space: pre-wrap; } - + Clear 清除 - + Export 导出 @@ -6540,7 +6540,7 @@ p, li { white-space: pre-wrap; } - + Problem Set %1 试题集%1 @@ -6569,7 +6569,7 @@ p, li { white-space: pre-wrap; } 项目已经被修改过,是否需要重新构建? - + Auto Save Error 自动保存出错 @@ -6584,7 +6584,7 @@ p, li { white-space: pre-wrap; } 试题属性... - + Set Problem Set Name 设置试题集名称 @@ -6594,12 +6594,17 @@ p, li { white-space: pre-wrap; } 试题集名称: - + Remove 删除 - + + - Command: %1 + - 命令: %1 + + + %1 Version %1版 @@ -6629,7 +6634,7 @@ p, li { white-space: pre-wrap; } 修改描述 - + Bookmark Description @@ -6647,7 +6652,7 @@ p, li { white-space: pre-wrap; } 在调试主控台中显示调试器输出 - + Remove this search 清除这次搜索 @@ -6662,7 +6667,7 @@ p, li { white-space: pre-wrap; } 断点条件... - + Break point condition 断点条件 @@ -6672,7 +6677,7 @@ p, li { white-space: pre-wrap; } 输入当前断点的生效条件: - + Remove All Breakpoints Remove all breakpoints 删除所有断点 @@ -6693,7 +6698,7 @@ p, li { white-space: pre-wrap; } - + Add Folder 添加文件夹 @@ -6709,7 +6714,7 @@ p, li { white-space: pre-wrap; } 文件夹: - + Rename Folder 重命名 @@ -6853,18 +6858,18 @@ p, li { white-space: pre-wrap; } - + New Folder 新建文件夹 - + Rename 重命名 - + @@ -6872,7 +6877,7 @@ p, li { white-space: pre-wrap; } 删除 - + Open in Editor 在编辑器中打开 @@ -6892,7 +6897,7 @@ p, li { white-space: pre-wrap; } 在文件资源管理器中打开 - + Character sets 字符集 @@ -7491,14 +7496,14 @@ p, li { white-space: pre-wrap; } 试题案例%1 - + - - + + @@ -7509,7 +7514,7 @@ p, li { white-space: pre-wrap; } 错误 - + Recent Projects 项目历史 @@ -7520,7 +7525,7 @@ p, li { white-space: pre-wrap; } 载入主题失败 - + Clear History 清除历史 @@ -7530,7 +7535,7 @@ p, li { white-space: pre-wrap; } 编译生成的可执行文件中没有符号表,无法被调试。 - + Version Control 版本控制 @@ -7584,7 +7589,7 @@ p, li { white-space: pre-wrap; } 确认转换 - + Exact 完全一致 @@ -7603,9 +7608,9 @@ p, li { white-space: pre-wrap; } 行: %1 列: %2 (%3个字符) 总行数: %4 - + - + If you are using the Release compiler set, please use choose the Debug version from toolbar. 如果你正在使用Release版的编译器设置集,请在工具栏中将其改为Debug版本。 @@ -9052,7 +9057,7 @@ p, li { white-space: pre-wrap; } QFileSystemModel - + <b>The name "%1" cannot be used.</b><p>Try using another name, with fewer characters or no punctuation marks. <b>文件名 "%1" 无法被使用!</b><p>可能是重名、过长、为空或者是使用了不能出现在文件名里的符号。 @@ -9061,7 +9066,7 @@ p, li { white-space: pre-wrap; } QObject - + Save 保存 @@ -11127,7 +11132,7 @@ p, li { white-space: pre-wrap; } - + @@ -11135,8 +11140,8 @@ p, li { white-space: pre-wrap; } 编译器配置集 - - + + Compiler @@ -11291,8 +11296,8 @@ p, li { white-space: pre-wrap; } 项目选项 - - + + @@ -11573,13 +11578,18 @@ p, li { white-space: pre-wrap; } Add 添加 + + + Edit + 编辑 + Remove 删除 - + Output To 输出到 @@ -11634,7 +11644,7 @@ p, li { white-space: pre-wrap; } 插入宏指令 - + Save Changes? 保存修改? @@ -11643,7 +11653,7 @@ p, li { white-space: pre-wrap; } 您需要保存对当前工具的修改吗? - + None @@ -11674,12 +11684,12 @@ p, li { white-space: pre-wrap; } 替换整个文档 - + Do you want to save changes to "%1"? 要保存对"%1"的修改吗? - + Error 错误 @@ -11689,7 +11699,7 @@ p, li { white-space: pre-wrap; } 标题不可以为空! - + untitled 无标题 diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 4b8e1cfd..4e87da2a 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -4061,7 +4061,7 @@ MainWindow - + Red Panda C++ @@ -4101,14 +4101,14 @@ - + New Problem Set - + Add Problem @@ -4123,15 +4123,15 @@ - + Save Problem Set - - + + Load Problem Set @@ -4168,7 +4168,7 @@ - + Debug Console @@ -4835,7 +4835,7 @@ - + Clear all breakpoints @@ -5255,14 +5255,14 @@ - + - - + + @@ -5273,7 +5273,7 @@ - + New @@ -5299,18 +5299,18 @@ - + Problem Set %1 - + Load Theme Error - + @@ -5444,7 +5444,12 @@ - + + - Command: %1 + + + + Line: %1/%2 Col: %3 Sel: %4 @@ -5470,12 +5475,12 @@ - + Batch Set Cases - + Remove @@ -5531,12 +5536,12 @@ - + Add Folder - + Rename Folder @@ -5582,18 +5587,18 @@ - + New Folder - + New File - + @@ -5601,7 +5606,7 @@ - + Open in Editor @@ -5621,7 +5626,7 @@ - + Character sets @@ -6201,7 +6206,7 @@ - + Rename @@ -6226,7 +6231,7 @@ - + Go to Line @@ -6256,35 +6261,35 @@ - + - + Wrong Compiler Settings - + - + Compiler is set not to generate executable. - - + + We need the executabe to run problem case. - - + + Please correct this before start debugging - + Can't open last open information file '%1' for write! @@ -6336,12 +6341,12 @@ - + Import FPS Problem Set - + Rename Problem @@ -6351,7 +6356,7 @@ - + FPS Problem Set Files (*.fps;*.xml) @@ -6362,8 +6367,8 @@ - - + + Export FPS Problem Set @@ -6378,7 +6383,7 @@ - + Rename Problem Set @@ -6398,7 +6403,7 @@ - + Newline @@ -6508,7 +6513,7 @@ - + Missing Project Files @@ -6518,7 +6523,7 @@ - + Save settings failed! @@ -6548,14 +6553,14 @@ - + - + Correct compile settings for debug - + The generated executable won't have debug symbol infos, and can't be debugged. @@ -6563,49 +6568,49 @@ - + Or you can manually change the following settings in the options dialog's compiler set page: - - - - - - Turned on the "Generate debug info (-g3)" option. - - - - - - - - Turned off the "Strip executable (-s)" option. - - - - - - - - Turned off the "Optimization level (-O)" option or set it to "Debug (-Og)". - - - + + - Turned on the "Generate debug info (-g3)" option. + + + + + + + - Turned off the "Strip executable (-s)" option. + + + + + + + - Turned off the "Optimization level (-O)" option or set it to "Debug (-Og)". + + + + + + If you are using the Release compiler set, please use choose the Debug version from toolbar. - + - + Do you want to mannually change the compiler set settings now? - + - + You should recompile after change the compiler set or it's settings. @@ -6706,7 +6711,7 @@ - + Exact @@ -6721,7 +6726,7 @@ - + Folder Not Empty @@ -6736,7 +6741,7 @@ - + Line: %1/%2 Char: %3/%4 @@ -7976,7 +7981,7 @@ QFileSystemModel - + <b>The name "%1" cannot be used.</b><p>Try using another name, with fewer characters or no punctuation marks. @@ -8269,7 +8274,7 @@ - + Save @@ -9462,7 +9467,7 @@ - + @@ -9522,9 +9527,9 @@ - + - + @@ -9532,8 +9537,8 @@ - - + + Compiler @@ -9642,8 +9647,8 @@ - - + + @@ -9908,13 +9913,18 @@ Add + + + Edit + + Remove - + Output To @@ -9965,12 +9975,12 @@ - + Save Changes? - + Choose Folder @@ -9980,12 +9990,12 @@ - + Do you want to save changes to "%1"? - + None @@ -10016,7 +10026,7 @@ - + Error @@ -10026,7 +10036,7 @@ - + untitled diff --git a/libs/redpanda_qt_utils/qt_utils/utils.cpp b/libs/redpanda_qt_utils/qt_utils/utils.cpp index adc52d74..273fb9dc 100644 --- a/libs/redpanda_qt_utils/qt_utils/utils.cpp +++ b/libs/redpanda_qt_utils/qt_utils/utils.cpp @@ -511,10 +511,10 @@ void copyFolder(const QString &fromDir, const QString &toDir) QString includeTrailingPathDelimiter(const QString &path) { - if (path.endsWith('/') || path.endsWith(QDir::separator())) { + if (path.endsWith(QDir::separator()) || path.endsWith(QDir::separator())) { return path; } else { - return path + "/"; + return path + QDir::separator(); } }