diff --git a/NEWS.md b/NEWS.md index 55a93cfb..53de9ea9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,9 @@ Version 0.2.2 - fix: can't correctly get system default encoding name when save file - fix: Tokenizer can't correctly handle array parameters - fix: debug actions enabled states not correct updated when processing debug mouse tooltips + - enhancement: redesign charset selection in the project options dialog's file widget + - fix: can't correctly load last open files / project with non-asii characters in path + - fix: can't coorectly load last open project Version 0.2.1 - fix: crash when load last opens diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm index e15200cf..4cc6142d 100644 Binary files a/RedPandaIDE/RedPandaIDE_zh_CN.qm and b/RedPandaIDE/RedPandaIDE_zh_CN.qm differ diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index bd40c898..7867d260 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -27,17 +27,17 @@ BacktraceModel - + Function 函数 - + Filename 文件名 - + Line @@ -45,17 +45,17 @@ BreakpointModel - + Filename 文件名 - + Line - + Condition 条件 @@ -2304,7 +2304,7 @@ Are you really want to continue? - + Issues 编译器 @@ -2506,10 +2506,10 @@ Are you really want to continue? - - - - + + + + Compile 编译 @@ -2555,7 +2555,7 @@ Are you really want to continue? - + Copy 复制 @@ -2909,7 +2909,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -3004,7 +3004,7 @@ Are you really want to continue? 在终端中打开 - + File Encoding 文件编码 @@ -3014,32 +3014,32 @@ Are you really want to continue? 文件历史 - - - - - - + + + + + + Debugging 正在调试 - - - - - - + + + + + + Running 正在运行 - - - - - - + + + + + + Compiling 正在编译 @@ -3048,349 +3048,349 @@ Are you really want to continue? 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + Read Only 只读 - + Insert 插入 - + Overwrite 覆写 - + Close project 关闭项目 - + Are you sure you want to close %1? 你确定要关闭'%1'吗? - - + + Confirm 确认 - - - + + + Source file is not compiled. 源文件尚未编译。 - - + + Compile now? 现在编译? - - + + Source file is more recent than executable. 源文件比可执行程序新。 - + Recompile now? 重新编译? - + No compiler set 无编译器设置 - + No compiler set is configured. 没有配置编译器设置。 - + Can't start debugging. 无法启动调试器 - - + + Enable debugging 启用调试参数 - - + + You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.<BR /><BR />Do you want to correct this now? 当前编译设置中未启用调试选项(-g3),或启用了信息剥除选项(-s)<br /><br/>是否纠正这一问题? - + Project not built 项目尚未构建 - + Project hasn't been built. Build it now? 项目尚未构建。是否构建? - + Host applcation missing 宿主程序不存在 - + DLL project needs a host application to run. 动态链接库(DLL)需要一个宿主程序来运行。 - + But it's missing. 但它不存在。 - + Host application not exists 宿主程序不存在 - + Host application file '%1' doesn't exist. 宿主程序'%1'不存在。 - + Recompile? 重新编译? - - + + Save last open info error 保存上次打开信息失败 - + Can't remove old last open information file '%1' 无法删除旧上次打开信息文件'%1' - + Can't save last open info file '%1' 无法保存上次打开信息文件'%1' - + Load last open info error 载入上次打开信息失败 - + Can't load last open info file '%1' 无法载入上次打开信息文件'%1' - + Copy all 全部复制 - + Clear 清除 - + Remove this search 清除这次搜索 - + Clear all searches 删除所有搜索 - + Breakpoint condition... 断点条件... - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Remove all breakpoints 清除所有断点 - + Rename File 重命名文件 - - + + Add Folder 添加文件夹 - + New folder 新文件夹 - + Folder name: 文件夹: - + Rename Folder 重命名 - + Remove Folder 删除文件夹 - + Sort By Type 按类型排序 - + Sort alphabetically 按名称排序 - + Show inherited members 显示继承的成员 - + Goto declaration 跳转到声明处 - + Goto definition 跳转到定义处 - + Character sets 字符集 - + %1 files autosaved 已自动保存%1个文件 - + Save project 保存项目 - + The project '%1' has modifications. 项目'%1'有改动。 - + Do you want to save it? 需要保存吗? - + 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 - + Red panda Dev-C++ project file (*.dev) 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Add to project 添加到项目 - - - - - - - - - + + + + + + + + + Error 错误 @@ -3400,75 +3400,75 @@ Are you really want to continue? 项目历史 - + 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 确认转换 - - + + 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个文件) @@ -3813,10 +3813,25 @@ Are you really want to continue? 编码 - + Override build command: 自定义构建命令 + + + Auto detect + 自动检测 + + + + ANSI(System default) + ANSI + + + + UTF-8 + + ProjectGeneralWidget @@ -4845,17 +4860,17 @@ Are you really want to continue? RegisterModel - + Register 寄存器 - + Value(Hex) 值(HEX) - + Value(Dec) 值(DEC) @@ -5430,12 +5445,12 @@ Are you really want to continue? WatchModel - + Expression 表达式 - + Value diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 54e9bef9..636f581a 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1488,7 +1488,7 @@ void MainWindow::loadLastOpens() int count = lastOpenIni.GetLongValue("LastOpens","Count",0); for (int i=0;ihistory().removeFile(editorFilename); } - QString projectFilename = lastOpenIni.GetValue("LastOpens", "Project",""); + QString projectFilename = QString::fromLocal8Bit((lastOpenIni.GetValue("LastOpens", "Project",""))); if (fileExists(projectFilename)) { - openProject(filename); + openProject(projectFilename); } else { updateEditorActions(); updateForEncodingInfo(); @@ -2118,7 +2118,6 @@ void MainWindow::onEditorTabContextMenu(const QPoint &pos) void MainWindow::disableDebugActions() { - qDebug()<<"disabled"; ui->actionStep_Into->setEnabled(false); ui->actionStep_Over->setEnabled(false); ui->actionStep_Out->setEnabled(false); @@ -2129,7 +2128,6 @@ void MainWindow::disableDebugActions() void MainWindow::enableDebugActions() { - qDebug()<<"enabled"; ui->actionStep_Into->setEnabled(true); ui->actionStep_Over->setEnabled(true); ui->actionStep_Out->setEnabled(true); diff --git a/RedPandaIDE/platform.cpp b/RedPandaIDE/platform.cpp index 5c91374c..2b642b7a 100644 --- a/RedPandaIDE/platform.cpp +++ b/RedPandaIDE/platform.cpp @@ -10,9 +10,6 @@ CharsetInfoManager* pCharsetInfoManager; -static void initmCodePages(){ -} - QByteArray CharsetInfoManager::getDefaultSystemEncoding() { DWORD acp = GetACP(); diff --git a/RedPandaIDE/settingsdialog/projectfileswidget.cpp b/RedPandaIDE/settingsdialog/projectfileswidget.cpp index 09c60894..c37bb042 100644 --- a/RedPandaIDE/settingsdialog/projectfileswidget.cpp +++ b/RedPandaIDE/settingsdialog/projectfileswidget.cpp @@ -2,6 +2,7 @@ #include "ui_projectfileswidget.h" #include "../mainwindow.h" #include "../systemconsts.h" +#include "../platform.h" ProjectFilesWidget::ProjectFilesWidget(const QString &name, const QString &group, QWidget *parent) : SettingsWidget(name,group,parent), @@ -177,10 +178,24 @@ void ProjectFilesWidget::on_txtBuildCommand_textChanged() void ProjectFilesWidget::on_cbEncoding_currentTextChanged(const QString &) { - PProjectUnit unit = currentUnit(); - if(!unit) - return; - unit->setEncoding(ui->cbEncoding->currentText().toLocal8Bit()); + QString userData = ui->cbEncoding->currentData().toString(); + if (userData == ENCODING_AUTO_DETECT + || userData == ENCODING_SYSTEM_DEFAULT + || userData == ENCODING_UTF8) { + PProjectUnit unit = currentUnit(); + if(!unit) + return; + unit->setEncoding(userData.toLocal8Bit()); + ui->cbEncodingDetail->setVisible(false); + ui->cbEncodingDetail->clear(); + } else { + ui->cbEncodingDetail->setVisible(true); + ui->cbEncodingDetail->clear(); + QList infos = pCharsetInfoManager->findCharsetsByLanguageName(userData); + foreach (const PCharsetInfo& info, infos) { + ui->cbEncodingDetail->addItem(info->name); + } + } } @@ -193,8 +208,25 @@ void ProjectFilesWidget::init() { ui->spinPriority->setMinimum(0); ui->spinPriority->setMaximum(9999); + ui->cbEncodingDetail->setVisible(false); ui->cbEncoding->clear(); - ui->cbEncoding->addItems(pSystemConsts->codecNames()); + ui->cbEncoding->addItem(tr("Auto detect"),ENCODING_AUTO_DETECT); + ui->cbEncoding->addItem(tr("ANSI"),ENCODING_SYSTEM_DEFAULT); + ui->cbEncoding->addItem(tr("UTF-8"),ENCODING_UTF8); + foreach (const QString& langName, pCharsetInfoManager->languageNames()) { + ui->cbEncoding->addItem(langName,langName); + } SettingsWidget::init(); } + +void ProjectFilesWidget::on_cbEncodingDetail_currentTextChanged(const QString &arg1) +{ + PProjectUnit unit = currentUnit(); + if(!unit) + return; + unit->setEncoding(ui->cbEncodingDetail->currentText().toLocal8Bit()); + ui->cbEncodingDetail->setVisible(false); + ui->cbEncodingDetail->clear(); +} + diff --git a/RedPandaIDE/settingsdialog/projectfileswidget.h b/RedPandaIDE/settingsdialog/projectfileswidget.h index 440afb46..3cce77b0 100644 --- a/RedPandaIDE/settingsdialog/projectfileswidget.h +++ b/RedPandaIDE/settingsdialog/projectfileswidget.h @@ -42,6 +42,8 @@ private slots: void on_treeProject_clicked(const QModelIndex &index); // SettingsWidget interface + void on_cbEncodingDetail_currentTextChanged(const QString &arg1); + public: void init() override; }; diff --git a/RedPandaIDE/settingsdialog/projectfileswidget.ui b/RedPandaIDE/settingsdialog/projectfileswidget.ui index 60c91270..fc9f097a 100644 --- a/RedPandaIDE/settingsdialog/projectfileswidget.ui +++ b/RedPandaIDE/settingsdialog/projectfileswidget.ui @@ -135,6 +135,9 @@ + + +