diff --git a/NEWS.md b/NEWS.md index 39f6d5c2..1617110d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,8 @@ Red Panda C++ Version 2.21 - fix: Horizontal scroll by touchpad is not working. - fix: Horizontal scroll by touchpad is inversed. - enhancement: Auto skip ; and , when input. + - enhancement: Add 'characters' column in the file properties dialog. + - enhancement: Just keeping two digits after the decimal point for file size in the file properties dialog. Red Panda C++ Version 2.20 diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index a5d9069f..f78becc7 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -757,11 +757,7 @@ MB - MB - - - Syntax error for stack frame larger than - + MB @@ -2215,6 +2211,10 @@ OK OK + + Characters: + + FormatterGeneralWidget diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index 83a614d2..6bc2ecc3 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -588,7 +588,7 @@ p, li { white-space: pre-wrap; } [说明] - + The compiler process for '%1' failed to start. 无法启动编译器进程'%1'。 @@ -597,27 +597,27 @@ p, li { white-space: pre-wrap; } 无法启动编译进程。 - + The compiler process crashed after starting successfully. 编译进程启动后崩溃。 - + The last waitFor...() function timed out. waitFor()函数等待超时。 - + An error occurred when attempting to write to the compiler process. 在向编译进程输入内容时出错。 - + An error occurred when attempting to read from the compiler process. 在从编译进程读取内容时出错。 - + An unknown error occurred. 发生了未知错误。 @@ -764,12 +764,12 @@ p, li { white-space: pre-wrap; } 当变量占用栈空间大于此值时报错 - - - - - - + + + + + + ... ... @@ -779,12 +779,12 @@ p, li { white-space: pre-wrap; } 基本选项 - + Add the following arguments when calling the compiler 编译时加入下列选项: - + Add the following arguments when calling the linker 链接时加入下列选项 @@ -834,27 +834,25 @@ p, li { white-space: pre-wrap; } 用静态链接方式链接库文件 - Syntax error for stack frame larger than - 单个函数栈大小超过指定值时报错: + 单个函数栈大小超过指定值时报错: - MB - MB + MB - + Settings 编译/链接选项 - + Directories 文件夹 - + Programs 程序 @@ -863,22 +861,22 @@ p, li { white-space: pre-wrap; } 汇编器(NASM) - + Output 输出 - + Compilation Stages 编译阶段 - + Stop after the preprocessing stage 在完成预处理后停止编译 - + Stop after the compilation proper stage 在生成汇编代码后停止。 @@ -887,12 +885,12 @@ p, li { white-space: pre-wrap; } 在完成汇编后停止。 - + Link and generate the executable 链接得到可执行文件。 - + Preprocessing output suffix 预处理输出后缀 @@ -901,12 +899,12 @@ p, li { white-space: pre-wrap; } 编译输出后缀 - + Compiling output suffix 编译(汇编代码)输出后缀 - + Executable suffix 可执行文件后缀 @@ -915,37 +913,37 @@ p, li { white-space: pre-wrap; } 选项 - + gdb gdb - + gdb server gdb server - + Resource Compiler(windres) 资源编辑器(winres) - + C++ Compiler(g++) C++编译器(g++) - + Choose C++ Compiler 选择C++编译器 - + Choose C Compiler 选择C编译器 - + C Compiler(gcc) C编译器(gcc) @@ -958,22 +956,22 @@ p, li { white-space: pre-wrap; } 性能分析器(gprof) - + make - + Choose make 选择make - + Choose Debugger 选择调试器 - + Choose Resource Compiler 选择资源编译器 @@ -982,12 +980,12 @@ p, li { white-space: pre-wrap; } 选择性能分析器 - + Confirm 确认 - + Red Panda C++ will clear current compiler list and search for compilers in the following locations:<br /> '%1'<br /> '%2'<br />Are you really want to continue? Red Panda C++ will clear current compiler list and search for compilers in the following locations: '%1' @@ -1006,80 +1004,80 @@ Are you really want to continue? UTF-8 - + Red Panda C++ will clear current compiler list and search for compilers in the the PATH. <br />Are you really want to continue? 小熊猫C++ 将会清除现有的编译器配置列表,然后在PATH路径中搜索gcc编译器.<br />你确定要继续吗? - - + + Failed 失败 - - + + Can't find any compiler. 找不到编译器 - - + + Compiler Set Name 编译器配置名称 - + Name 名称 - + Compiler Set Folder 编译器所在文件夹 - + New name 新名称 - + Locate C Compiler 定位C编译器 - - - - - - + + + + + + Executable files (*.exe) 可执行文件 (*.exe) - + Locate C++ Compiler 定位C++编译器 - + Locate Make 定位make程序 - + Locate GDB 定位gdb程序 - + Locate GDB Server 定位gdb server程序 - + Locate windres 定位windres程序 @@ -1454,10 +1452,10 @@ Are you really want to continue? - - - - + + + + Error 错误 @@ -1506,44 +1504,44 @@ Are you really want to continue? 文件%1已经被打开! - + The text to be copied exceeds count limit! 要复制的内容超过了行数限制! - + The text to be copied exceeds character limit! 要复制的内容超过了字符数限制! - + The text to be cut exceeds count limit! 要剪切的内容超过了行数限制! - + The text to be cut exceeds character limit! 要剪切的内容超过了字符数限制! - + hex: %1 16进制: %1 - + dec: %1 十进制: %1 - + Print Document 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 @@ -1552,27 +1550,27 @@ Are you really want to continue? 未找到符号'%1'! - + astyle not found 找不到astyle程序 - + Can't find astyle in "%1". 找不到astyle程序"%1". - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -3016,17 +3014,22 @@ Are you really want to continue? 空行数: - + File size: 文件大小: - + + Characters: + 字符数: + + + File date: 修改日期: - + OK 确定 @@ -4318,11 +4321,11 @@ Are you really want to continue? - - - - - + + + + + Issues 编译器 @@ -4755,7 +4758,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -4777,7 +4780,7 @@ Are you really want to continue? - + Save Problem Set 保存试题集 @@ -4785,7 +4788,7 @@ Are you really want to continue? - + Load Problem Set 载入试题集 @@ -4916,14 +4919,14 @@ Are you really want to continue? - + Import FPS Problem Set 导入FPS试题集 - + Export FPS Problem Set 导出FPS试题集 @@ -5175,7 +5178,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -5476,7 +5479,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -5497,13 +5500,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -5867,22 +5870,22 @@ Are you really want to continue? - - + + Wrong Compiler Settings 错误的编译器设置 - - + + Compiler is set not to generate executable. 编译器被设置为不生成可执行文件。 - + We need the executabe to run problem case. 我们需要可执行文件来运行试题案例。 @@ -5944,7 +5947,7 @@ Are you really want to continue? - + Please correct this before start debugging 请在调试前改正设置。 @@ -6061,22 +6064,22 @@ Are you really want to continue? 全部复制 - + Go to Line 跳转到行 - + Line - + Template Exists 模板已存在 - + Template %1 already exists. Do you want to overwrite? 模板%1已存在。是否覆盖? @@ -6102,7 +6105,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -6172,15 +6175,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -6401,7 +6404,7 @@ Are you really want to continue? - + Delete 删除 @@ -6461,47 +6464,47 @@ Are you really want to continue? 选择答案源代码文件 - + Watchpoint hitted 变量断点被触发 - + Value of "%1" has changed: "%1"的值发生了变化: - + New value: %1 新值: %1 - + Project folder removed. 项目文件夹被删除 - + Folder for project '%1' was removed. 项目"%1"的文件夹已被外部程序删除. - + It will be closed. 项目将被关闭. - + Save settings failed! 保存设置失败 - + Watchpoint variable name 被监控的变量 - + Stop execution when the following variable is modified (it must be visible from the currect scope): 当下面的变量被修改时暂停执行(该变量必须可以从当前程序处访问): @@ -6510,17 +6513,17 @@ Are you really want to continue? 中止 - + FPS Problem Set Files (*.fps;*.xml) FPS试题集文件(*.fps;*.xml) - + FPS Problem Set Files (*.fps) FPS试题集文件(*.fps) - + Export Error 导出时出错 @@ -6561,7 +6564,7 @@ Are you really want to continue? 变量"%1"有改动: - + Old value: %1 旧值: %1 @@ -6570,63 +6573,66 @@ Are you really want to continue? 新值: %1 - + Save project 保存项目 - + The project '%1' has modifications. 项目'%1'有改动。 - - + + Do you want to save it? 需要保存吗? - - + + File Changed 文件已发生变化 - - - + + + New Project File? 新建项目文件? - - - + + + Do you want to add the new file to the project? 您是否要将新建的文件加入项目? - - - - - + + + + + Save Error 保存失败 - + + Change Project Compiler Set 改变项目编译器配置集 - + + Change the project's compiler set will lose all custom compiler set options. 改变项目的编译器配置集会导致所有的自定义编译器选项被重置。 - + + Do you really want to do that? 你真的想要那么做吗? @@ -6649,78 +6655,78 @@ Are you really want to continue? 无标题%1 - + Modify Watch 修改监视表达式 - + Watch Expression 监视表达式 - + Do you really want to clear all breakpoints in this file? 您真的要清除该文件的所有断点吗? - + New project 新建项目 - + Close %1 and start new project? 关闭'%1'以打开新项目? - + Folder not exist 文件夹不存在 - + Folder '%1' doesn't exist. Create it now? 文件夹'%1'不存在。是否创建? - + Can't create folder 无法创建文件夹 - + Failed to create folder '%1'. 创建文件夹'%1'失败。 - + Save new project as - + Folder %1 is not empty. 文件夹%1不是空的。 - + Do you really want to delete it? 你真的要删除它吗? - + Change working folder 改变工作文件夹 - + File '%1' is not in the current working folder. File '%1' is not in the current working folder 文件'%1'不在当前工作文件夹中。 - + Do you want to change working folder to '%1'? 是否将工作文件夹改设为'%1'? @@ -6729,28 +6735,28 @@ Are you really want to continue? 正在删除试题... - + Can't Commit 无法提交 - + Git needs user info to commit. Git需要用信息进行提交。 - + Choose Input Data File 选择输入数据文件 - - + + All files (*.*) 所有文件 (*.*) - + Choose Expected Output Data File Choose Expected Input Data File 选择期望输出文件 @@ -6762,59 +6768,59 @@ Are you really want to continue? - + Choose Working Folder 选择工作文件夹 - - + + Header Exists 头文件已存在 - - + + Header file "%1" already exists! 头文件"%1"已存在! - + Source Exists 源文件已存在! - + Source file "%1" already exists! 源文件"%1"已存在! - + Can't commit! 无法提交! - + The following files are in conflicting: 下列文件处于冲突状态,请解决后重新添加和提交: - + Commit Message 提交信息 - + Commit Message: 提交信息: - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -6823,22 +6829,22 @@ Are you really want to continue? 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? @@ -6847,27 +6853,27 @@ Are you really want to continue? 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 @@ -6923,88 +6929,88 @@ Are you really want to continue? 您也可以删除所有断点,打开“CPU信息窗口”,然后调试汇编代码。 - + Failed to generate the executable. 未能生成可执行文件。 - + Please check detail info in "Tools Output" panel. 请查看“工具输出”面板中的详细信息。 - + Red Panda C++ project file (*.dev) 小熊猫C++项目文件(*.dev) - + Rename Error 重命名出错 - + Symbol '%1' is defined in system header. 符号'%1'在系统头文件中定义,无法修改。 - + New Name 新名称 - - - - + + + + Replace Error 替换出错 - + Can't open file '%1' for replace! 无法打开文件'%1'进行替换! - + Contents has changed since last search! 内容和上次查找时不一致。 - + Rich Text Format Files (*.rtf) RTF格式文件 (*.rtf) - + HTML Files (*.html) HTML文件 (*.html) - + The current problem set is not empty. 当前的试题集不是空的。 - + Problem %1 试题%1 - - + + Problem Set Files (*.pbs) 试题集文件 (*.pbs) - - + + Load Error 载入失败 - + Problem Case %1 试题案例%1 @@ -7018,11 +7024,11 @@ Are you really want to continue? - - - - - + + + + + Error 错误 @@ -7057,46 +7063,46 @@ Are you really want to continue? 请在工具栏中选用Debug编译器配置集,或者在选项对话框的编辑器配置集页中勾选“生成调试信息(-g3)"选项。 - + File '%1' was changed. 磁盘文件'%1'已被修改。 - + Reload its content from disk? 是否重新读取它的内容? - + File '%1' was removed. 磁盘文件'%1'已被删除。 - + Keep it open? 是否保持它在小熊猫C++中打开的编辑窗口? - + Open 打开 - - + + Compile Failed 编译失败 - + Run Failed 运行失败 - - - + + + Confirm Convertion 确认转换 @@ -7109,35 +7115,35 @@ Are you really want to continue? - - - + + + The editing file will be saved using %1 encoding. <br />This operation can't be reverted. <br />Are you sure to continue? 当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗? - + New Watch Expression 新监视表达式 - + Enter Watch Expression (it is recommended to use 'this->' for class members): 输入监视表达式 - + Parsing file %1 of %2: "%3" (%1/%2)正在解析文件"%3" - - + + Done parsing %1 files in %2 seconds 完成%1个文件的解析,用时%2秒 - + (%1 files per second) (每秒%1个文件) @@ -7879,12 +7885,12 @@ Are you really want to continue? 在编译时加入字符集选项 - + ANSI ANSI - + UTF-8 UTF-8 @@ -8658,7 +8664,7 @@ Are you really want to continue? 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? @@ -8789,7 +8795,7 @@ Are you really want to continue? 只生成汇编代码(-S) - + Confirm 确认 @@ -8810,13 +8816,13 @@ Are you really want to continue? 如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果, - - + + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2 @@ -8841,12 +8847,12 @@ Are you really want to continue? C++包含文件 - + Remove 删除 - + Do you really want to remove "%1"? 您确定要删除"%1"吗? @@ -10224,9 +10230,8 @@ Are you really want to continue? - - - + + Compiler Set @@ -10234,8 +10239,7 @@ Are you really want to continue? - - + Compiler @@ -10247,7 +10251,7 @@ Are you really want to continue? 自动链接 - + @@ -10323,15 +10327,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 @@ -10391,7 +10395,7 @@ Are you really want to continue? - + diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 5d75a56c..5ee7dd8d 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -652,14 +652,6 @@ Locate windres - - MB - - - - Syntax error for stack frame larger than - - CppRefacter @@ -2048,6 +2040,10 @@ OK + + Characters: + + FormatterGeneralWidget diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index 62ab8ac7..8480fa24 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -523,7 +523,7 @@ QString getSizeString(int size) if (size < 1024) { return QString("%1 ").arg(size)+QObject::tr("bytes"); } else if (size < 1024 * 1024) { - return QString("%1 ").arg(size / 1024.0)+QObject::tr("KB"); + return QString("%1 ").arg(size / 1024.0,0,'f',2)+QObject::tr("KB"); } else if (size < 1024 * 1024 * 1024) { return QString("%1 ").arg(size / 1024.0 / 1024.0)+QObject::tr("MB"); } else { diff --git a/RedPandaIDE/widgets/filepropertiesdialog.cpp b/RedPandaIDE/widgets/filepropertiesdialog.cpp index c695fef5..5849fd62 100644 --- a/RedPandaIDE/widgets/filepropertiesdialog.cpp +++ b/RedPandaIDE/widgets/filepropertiesdialog.cpp @@ -15,6 +15,7 @@ * along with this program. If not, see . */ #include "filepropertiesdialog.h" +#include "systemconsts.h" #include "ui_filepropertiesdialog.h" #include "../mainwindow.h" #include "../editorlist.h" @@ -42,22 +43,25 @@ void FilePropertiesDialog::calcFile(Editor *editor, int &commentLines, int &emptyLines, int &codeLines, - int &includeLines) + int &includeLines, + int &charCounts) { totalLines = editor->document()->count(); codeLines = 0; commentLines = 0; emptyLines = 0; includeLines = 0; + charCounts = 0; + int lineBreakerLen = QString(LINE_BREAKER).length(); // iterate through all lines of file for (int i=0;idocument()->count();i++) { QString line = editor->document()->getLine(i); - int j=0; - while (jgetTokenAttriAtRowCol(QSynedit::BufferCoord{j+1,i+1}, + if (editor->getTokenAttriAtRowCol(QSynedit::BufferCoord{1,i+1}, token,attr)) { // if it is preprocessor... if (attr->name() == SYNS_AttrPreprocessor) { @@ -134,14 +138,15 @@ void FilePropertiesDialog::on_cbFiles_currentIndexChanged(int index) ui->txtRelativeToProject->setText("_"); ui->txtLines->setText(QString("%1").arg(editor->document()->count())); - int totalLines, codeLines,emptyLines,commentLines,includeLines; - calcFile(editor,totalLines,commentLines,emptyLines,codeLines,includeLines); + int totalLines, codeLines,emptyLines,commentLines,includeLines, charCounts; + calcFile(editor,totalLines,commentLines,emptyLines,codeLines,includeLines,charCounts); ui->txtLines->setText(QString("%1").arg(totalLines)); ui->txtEmptyLines->setText(QString("%1").arg(emptyLines)); ui->txtCodeLines->setText(QString("%1").arg(codeLines)); ui->txtCommentLines->setText(QString("%1").arg(commentLines)); ui->txtIncludes->setText(QString("%1").arg(includeLines)); + ui->txtCharacters->setText(QString("%1").arg(charCounts)); } } diff --git a/RedPandaIDE/widgets/filepropertiesdialog.h b/RedPandaIDE/widgets/filepropertiesdialog.h index cbaf6610..21df22f4 100644 --- a/RedPandaIDE/widgets/filepropertiesdialog.h +++ b/RedPandaIDE/widgets/filepropertiesdialog.h @@ -49,7 +49,8 @@ private: int &commentLines, int &emptyLines, int &codeLines, - int &includeLines); + int &includeLines, + int &charCounts); private: FilePropertiesModel mModel; Editor * mActiveEditor; diff --git a/RedPandaIDE/widgets/filepropertiesdialog.ui b/RedPandaIDE/widgets/filepropertiesdialog.ui index 63020b95..593d7d9c 100644 --- a/RedPandaIDE/widgets/filepropertiesdialog.ui +++ b/RedPandaIDE/widgets/filepropertiesdialog.ui @@ -7,7 +7,7 @@ 0 0 726 - 444 + 471 @@ -228,58 +228,6 @@ - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - File size: - - - - - - - true - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - File date: - - - - - - - true - - - - - - @@ -319,6 +267,84 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + File date: + + + + + + + true + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + File size: + + + + + + + true + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Characters: + + + + + + + true + + + + + +