diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 43e3feae..bb281c3f 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -318,6 +318,15 @@ win32: SOURCES += \ settingsdialog/environmentfileassociationwidget.cpp \ settingsdialog/projectversioninfowidget.cpp +linux: HEADERS += \ + settingsdialog/environmentprogramswidget.h + +linux: SOURCES += \ + settingsdialog/environmentprogramswidget.cpp + +linux: FORMS += \ + settingsdialog/environmentprogramswidget.ui + TRANSLATIONS += \ RedPandaIDE_zh_CN.ts diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm index ab0dc0f8..8c686d20 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 e1260249..1c42da33 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -95,17 +95,17 @@ BacktraceModel - + Function 函数 - + Filename 文件名 - + Line @@ -151,37 +151,37 @@ BreakpointModel - + Filename 文件名 - + Line - + Condition 条件 - + Save file '%1' failed. 保存文件'%1'失败。 - + Can't open file '%1' for write. 无法写入文件'%1'. - + Error in json file '%1':%2 : %3 JSON文件'%1':%2中存在错误:%3 - + Can't open file '%1' for read. 无法读取文件'%1'. @@ -229,113 +229,113 @@ CharsetInfoManager - - - + + + Arabic 阿拉伯语系 - - - - + + + + Greek 希腊语系 - - - - + + + + Baltic 巴尔干语系 - - - - - - + + + + + + Western Europe 西欧语言 - - + + Central Europe 中欧语言 - - - - - - + + + + + + Cyrillic 西里尔语系 - - - - + + + + Turkish 土耳其语系 - - + + Northern Europe 北欧语系 - - - + + + Hebrew 希伯来语 - + Thai 泰语 - - + + Japanese 日语 - - - + + + Chinese 中文 - - + + Korean 韩语 - + Vietnamese 越南语 - + Eastern Europe 东欧语系 - + Celtic 凯尔特语系 @@ -667,12 +667,13 @@ 编译器配置方案 - - - - - - + + + + + + + ... ... @@ -752,72 +753,81 @@ 选项 - + + 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) - Debugger(gdb) - 调试器(gdb) + 调试器(gdb) - + Profiler(gprof) 性能分析器(gprof) - + make - + Choose make 选择make - + Choose Debugger 选择调试器 - + Choose Resource Compiler 选择资源编译器 - + Choose Profiler 选择性能分析器 - + Confirm 确认 - + Red Panda C++ will clear current compiler list and search for compilers in the following locations: '%1' '%2' @@ -828,35 +838,35 @@ Are you really want to continue? 你确定要继续吗? - - + + Failed 失败 - - + + Can't find any compiler. 找不到编译器 - - + + Compiler Set Name 编译器配置名称 - + Name 名称 - + Compiler Set Folder 编译器所在文件夹 - + New name 新名称 @@ -907,47 +917,57 @@ Are you really want to continue? + Use GDB Server to debug + 使用gdb server调试 + + + + GDB Server Port + gdb server TCP端口号 + + + Skip system header and library files when step into 单步进入时,跳过系统头文件和库文件 - + Skip project header and library files when step into 单步进入时,跳过项目头文件和库文件 - + Skip custom header and library files when step into 单步进入时,跳过自定义头文件和库文件 - + Debug Console 调试主控台 - + Font: 字体: - + Show only monospaced fonts 只显示等宽字体 - + Size: 大小: - + Show detail debug logs Show debug logs in the debug console 显示详细调试器日志 - + Show CPU Window when signal received 程序收到信号停止时缺省打开CPU窗口 @@ -956,17 +976,17 @@ Are you really want to continue? 在调试主控台中显示gdb输出注解 - + Autosave 自动保存 - + Autosave breakpoints 自动保存断点 - + Autosave watches 自动保存监视 @@ -975,27 +995,27 @@ Are you really want to continue? 反汇编代码样式 - + CPU Window CPU信息窗口 - + Disassembly Coding Style: 反汇编代码样式 - + Intel Intel - + AT&&T AT&&T - + Show disassembly code in blend mode 以混合模式显示反汇编代码 @@ -1003,47 +1023,68 @@ Are you really want to continue? Debugger - + No compiler set 无编译器设置 - + No compiler set is configured. 没有配置编译器设置。 - + Can't start debugging. 无法启动调试器 - + Debugger path error 调试路径错误 - + Debugger's path "%1" contains non-ascii characters. 调试路径"%1"中包含非ASCII字符(如,中文字符) - + + This prevents it from executing. 这会导致调试器无法启动。 - + Debugger not exists 找不到调试器 - + Can''t find debugger in : "%1" 找不到调试器程序"%1" - + + GDB Server path error + gdb server路径错误 + + + + GDB Server's path "%1" contains non-ascii characters. + gdb server的路径"%1"包含中文或者全角字符 + + + + GDB Server not exists + 找不到gdb server + + + + Can''t find gdb server in : "%1" + 无法在"%1"找到gdb server + + + Execute to evaluate 执行以求值 @@ -1052,22 +1093,22 @@ Are you really want to continue? 不在当前语境中 - + Compile 编译 - + Source file is more recent than executable. 源文件比程序文件新。 - + Recompile? 重新编译? - + Signal "%1" Received: 收到信号"%1": @@ -1944,6 +1985,34 @@ Are you really want to continue? 自动清理被隐藏的编辑器中的符号表 + + EnvironmentProgramsWidget + + + Form + 表单 + + + + ... + ... + + + + Terminal + 终端 + + + + Choose Terminal Program + 选择终端程序 + + + + All files (*.*) + 所有文件 (*.*) + + EnvironmentShortcutModel @@ -1968,7 +2037,7 @@ Are you really want to continue? ExecutableRunner - + The runner process '%1' failed to start. The runner process failed to start. 无法启动程序运行进程'%1'。 @@ -1978,17 +2047,17 @@ Are you really want to continue? 程序运行进程启动后崩溃。 - + The last waitFor...() function timed out. waitFor()函数等待超时。 - + An error occurred when attempting to write to the runner process. 在向程序运行进程写入内容时出错。 - + An error occurred when attempting to read from the runner process. 在从程序运行进程读取内容时出错。 @@ -3069,7 +3138,7 @@ Are you really want to continue? - + Debug Console 调试主控台 @@ -3145,7 +3214,7 @@ Are you really want to continue? 工具栏2 - + New 新建 @@ -3203,8 +3272,8 @@ Are you really want to continue? - - + + Compile 编译 @@ -3250,8 +3319,8 @@ Are you really want to continue? - - + + Copy 复制 @@ -3262,7 +3331,7 @@ Are you really want to continue? - + Paste 粘贴 @@ -3273,7 +3342,7 @@ Are you really want to continue? - + Select All 选择全部 @@ -3393,14 +3462,14 @@ Are you really want to continue? - + Problem Set 试题集 - + New Problem Set 新建试题集 @@ -3419,14 +3488,14 @@ Are you really want to continue? - + Save Problem Set 保存试题集 - + Load Problem Set 载入试题集 @@ -3462,7 +3531,7 @@ Are you really want to continue? - + Problem 试题 @@ -3888,13 +3957,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -4014,7 +4083,7 @@ Are you really want to continue? - + Open Folder 打开文件夹 @@ -4024,42 +4093,42 @@ Are you really want to continue? 运行参数... - + File Encoding 文件编码 - + Recent Files 文件历史 - - - - - - + + + + + + Debugging 正在调试 - - - - - - + + + + + + Running 正在运行 - - - - - - + + + + + + Compiling 正在编译 @@ -4068,188 +4137,188 @@ Are you really want to continue? 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%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' - + Show detail debug logs 显示详细调试器日志 - + Copy all 全部复制 - - + + Clear 清除 - + Export 导出 - + Insert Snippet 插入代码段 - - + + Problem Set %1 试题集%1 @@ -4270,73 +4339,73 @@ Are you really want to continue? 或者选择使用其他的网络端口。 - + Red Panda Dev-C++ 小熊猫Dev-C++ - - + + Rebuild Project 重新构建项目 - - + + Project has been modified, do you want to rebuild it? 项目已经被修改过,是否需要重新构建? - + Auto Save Error 自动保存出错 - + Auto save "%1" to "%2" failed:%3 自动保存"%1"到"%2"失败:%3 - + Properties... 试题属性... - + Set Problem Set Name 设置试题集名称 - + Problem Set Name: 试题集名称: - + Remove 删除 - + Remove All Bookmarks 删除全部书签 - + Modify Description 修改描述 - - - + + + Bookmark Description 书签描述 - - - + + + Description: 描述: @@ -4345,119 +4414,119 @@ Are you really want to continue? 在调试主控台中显示调试器输出 - + Remove this search 清除这次搜索 - + Clear all searches 删除所有搜索 - + Breakpoint condition... 断点条件... - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Remove All Breakpoints Remove all breakpoints 删除所有断点 - + Remove Breakpoint 删除当前断点 - + Rename File 重命名文件 - - + + Add Folder 添加文件夹 - + New folder 新文件夹 - + Folder name: 文件夹: - + Rename Folder 重命名 - + Remove Folder 删除文件夹 - + Sort By Type 按类型排序 - + Sort alphabetically 按名称排序 - + Show inherited members 显示继承的成员 - + Goto declaration 跳转到声明处 - + Goto definition 跳转到定义处 - + Open in Editor 在编辑器中打开 - + Open in External Program 使用外部程序打开 - + Open in Terminal 在终端中打开 - + Open in Windows Explorer 在Windows浏览器中打开 - + Character sets 字符集 @@ -4499,7 +4568,7 @@ Are you really want to continue? - + Do you want to save it? 需要保存吗? @@ -4523,7 +4592,7 @@ Are you really want to continue? - + Save Error 保存失败 @@ -4653,68 +4722,68 @@ Are you really want to continue? 新名称 - - + + 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 - - - - - - - - - + + + + + + + + + @@ -4725,7 +4794,7 @@ Are you really want to continue? 错误 - + Recent Projects 项目历史 @@ -5640,7 +5709,7 @@ Are you really want to continue? QApplication - + Error 错误 @@ -5694,196 +5763,196 @@ Are you really want to continue? - - + + Error 错误 - + Can't create configuration folder %1 无法创建配置文件夹"%1" - + Can't write to configuration file %1 无法写入配置文件夹"%1" - + Can't load autolink settings 无法载入自动链接设置 - - - - + + + + The following %1 directories don't exist: 下列%1文件夹不存在: - - + + binary 二进制 - + No %1 directories have been specified. 未指定%1文件夹 - + C include C包含 - - + + C++ include C++包含 - - - - + + + + Cannot find the %1 "%2" 无法找到%1程序"%2" - + C options C语言选项 - + Support all ANSI standard C programs (-ansi) 支持所有ANSI标准C程序(-ansi) - + Do not recognize asm,inline or typeof as a keyword (-fno-asm) 不支持将asm、inline和typeof作为关键字(-fno-asm) - + Imitate traditional C preprocessors (-traditional-cpp) 模仿传统C预处理器行为(-traditional-cpp) - + Code Generation 代码生成 - + Optimize for the following machine (-march) 生成特定机器的专用指令(-march) - + Optimize less, while maintaining full compatibility (-tune) 完整兼容特定机器,较少优化(-tune) - + Enable use of specific instructions (-mx) 启用特定指令集(-mx) - + Optimization level (-Ox) 优化级别(-Ox) - + Compile with the following pointer size (-mx) 使用下列指针大小编译(-mx) - + Language standard (-std) 语言标准(-std) - + Profile 性能分析 - + Generate debugging information (-g3) 生成调试信息(-g3) - + Generate profiling info for analysis (-pg) 生成性能分析信息(-pg) - + Warnings 代码警告 - + Inhibit all warning messages (-w) 忽略所有警告信息(-w) - + Show most warnings (-Wall) 启用常见问题警告(-Wall) - + Show some more warnings (-Wextra) 启用更多问题警告(-Wextra) - + Check ISO C/C++/C++0x conformance (-pedantic) 检查ISO C/C++/C++0x语法一致性(-pedantic) - + Only check the code for syntax errors (-fsyntax-only) 只进行语法检查(不编译)(-fsyntax-only) - + Make all warnings into errors (-Werror) 将警告作为错误处理(-Werror) - + Abort compilation on first error (-Wfatal-errors) 遇到第一个错误后立即中止编译(-Wfatal-errors) - + Linker 链接器 - + Link an Objective C program (-lobjc) 链接Objective-C程序 (-lobjc) - + Do not use standard system libraries (-nostdlib) 不使用标准库和系统启动文件(-nostdlib) - + Do not create a console window (-mwindows) 不产生控制台窗口(-mwindows) - + Strip executable (-s) 剥除附加信息(-s) @@ -5892,53 +5961,53 @@ Are you really want to continue? 链接Ojbective C程序(-lobjc) - + Output 输出 - + Put comments in generated assembly code (-fverbose-asm) 在生成的汇编代码中加入注释(-fverbose-asm) - + Use pipes instead of temporary files during compilation (-pipe) 编译时使用管道而不是临时文件(-pipe) - + Do not assemble, compile and generate the assemble code (-S) 只生成汇编代码(-S) - - + + Confirm 确认 - + The following problems were found during validation of compiler set "%1": 在验证编译器设置"%1"时遇到了下列问题: - + Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths? 是否让小熊猫C++删除这些配置,并尝试重新建立配置? - + Leaving those directories will lead to problems during compilation.<br /><br />Unless you know exactly what you're doing, it is recommended that you click Yes. 如果仍然保留这些设置,可能会导致编译错误。<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 @@ -5981,27 +6050,27 @@ Are you really want to continue? 无标题 - + Index %1 out of range 下标"%1"越界 - + bytes 字节 - + KB KB - + MB MB - + GB GB @@ -6322,12 +6391,12 @@ Are you really want to continue? RegisterModel - + Register 寄存器 - + Value @@ -6658,7 +6727,7 @@ Are you really want to continue? SettingsDialog - + Options 选项 @@ -6684,227 +6753,233 @@ Are you really want to continue? 取消 - + Appearence 外观 - - - - - + + + + + + Environment 环境 - + File Association 文件关联 - + Shortcuts 快捷键 - + Folders 文件夹 - + + Terminal + 终端程序 + + + Performance 性能 - - + + Compiler Set 编译器配置集 - - + + Compiler 编译器 - + Auto Link 自动链接 - - - - - - - + + + + + + + General 通用 - - - - - - - - - - - + + + + + + + + + + + Editor 编辑器 - + Font 字体 - + Copy & Export 复制/导出 - + Color 配色 - + Code Completion 代码补全 - + Symbol Completion 符号补全 - + Snippet 代码模板 - + Auto Syntax Checking 自动语法检查 - + Tooltips 信息提示 - + Auto save 自动保存 - + Misc 杂项 - - - - + + + + Program Runner 程序运行 - - + + Problem Set 试题集 - + Debugger 调试器 - + Code Formatter 代码排版 - + Tools 工具 - + Project Options 项目选项 - - - - - - - - - - + + + + + + + + + + Project 项目 - + Files 文件 - + Custom Compile options 自定义编译选项 - + Directories 文件夹 - + Precompiled Header 预编译头文件 - + Makefile Makefile - + Output 输出 - + DLL host DLL宿主 - + Version info 版本信息 - + Save Changes 保存修改 - + There are changes in the settings, do you want to save them before swtich to other page? 本页中有尚未保存的设置修改,是否保存后再切换到其他页? @@ -7195,34 +7270,34 @@ Are you really want to continue? 删除编译文件 - - + + Read tools config failed 读取工具配置失败 - + Can't open tools config file '%1' for read. 无法读取工具配置文件'%1' - + Read tools config file '%1' failed:%2 读取工具配置文件'%1'失败:%2 - - + + Save tools config failed 保存工具配置失败 - + Can't open tools config file '%1' for write. 无法写入工具配置文件'%1'。 - + Write to tools config file '%1' failed. Write to tool config file '%1' failed. 写入工具配置文件'%1'失败。 @@ -7231,49 +7306,49 @@ Are you really want to continue? WatchModel - + Save file '%1' failed. 保存文件'%1'失败。 - + Can't open file '%1' for write. 无法写入文件'%1'. - + Error in json file '%1':%2 : %3 JSON文件'%1':%2中存在错误:%3 - - + + Execute to evaluate 执行以求值 - - + + Not Valid 在当前作用域中无效 - + Can't open file '%1' for read. 无法读取文件'%1'. - + Expression 表达式 - + Type 类型 - + Value diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index aa7244b7..18240cce 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -228,7 +228,7 @@ void CompilerManager::run(const QString &filename, const QString &arguments, con #else QString newArguments = QString(" -e \"%1\" %2") .arg(localizePath(filename)).arg(arguments); - execRunner = new ExecutableRunner("/usr/bin/x-terminal-emulator",newArguments,workDir); + execRunner = new ExecutableRunner(pSettings->environment().terminalPath(),newArguments,workDir); #endif execRunner->setStartConsole(true); } else { diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index 1ca92e61..6acd076e 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -2253,8 +2253,13 @@ void DebugTarget::run() cmd= mGDBServer; arguments = QString(" localhost:%1 \"%2\"").arg(mPort).arg(mInferior); #else - cmd= "/usr/bin/x-terminal-emulator"; - arguments = QString(" -e \"%1\" localhost:%2 \"%3\"").arg(mGDBServer).arg(mPort).arg(mInferior); + if (programHasConsole(mInferior)) { + cmd= pSettings->environment().terminalPath(); + arguments = QString(" -e \"%1\" localhost:%2 \"%3\"").arg(mGDBServer).arg(mPort).arg(mInferior); + } else { + cmd= mGDBServer; + arguments = QString(" localhost:%1 \"%2\"").arg(mPort).arg(mInferior); + } #endif QString workingDir = QFileInfo(mInferior).path(); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 0971b969..93adbdd7 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -2798,6 +2798,10 @@ void Settings::Environment::doLoad() if (!fileExists(mDefaultOpenFolder)) { mDefaultOpenFolder = QDir::currentPath(); } + +#ifdef Q_OS_LINUX + mTerminalPath = stringValue("terminal_path","/usr/bin/x-terminal-emulator"); +#endif } int Settings::Environment::interfaceFontSize() const @@ -2850,6 +2854,16 @@ void Settings::Environment::setIconSet(const QString &newIconSet) mIconSet = newIconSet; } +QString Settings::Environment::terminalPath() const +{ + return mTerminalPath; +} + +void Settings::Environment::setTerminalPath(const QString &terminalPath) +{ + mTerminalPath = terminalPath; +} + void Settings::Environment::doSave() { //Appearence @@ -2861,6 +2875,9 @@ void Settings::Environment::doSave() saveValue("current_folder",mCurrentFolder); saveValue("default_open_folder",mDefaultOpenFolder); +#ifndef Q_OS_WIN + saveValue("terminal_path",mTerminalPath); +#endif } QString Settings::Environment::interfaceFont() const diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 18e7fa2b..be4cd9ef 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -487,6 +487,9 @@ public: const QString &iconSet() const; void setIconSet(const QString &newIconSet); + QString terminalPath() const; + void setTerminalPath(const QString &terminalPath); + private: //Appearence @@ -498,6 +501,7 @@ public: QString mIconSet; QString mDefaultOpenFolder; + QString mTerminalPath; // _Base interface protected: void doSave() override; diff --git a/RedPandaIDE/settingsdialog/environmentprogramswidget.cpp b/RedPandaIDE/settingsdialog/environmentprogramswidget.cpp new file mode 100644 index 00000000..603b206f --- /dev/null +++ b/RedPandaIDE/settingsdialog/environmentprogramswidget.cpp @@ -0,0 +1,46 @@ +#include "environmentprogramswidget.h" +#include "ui_environmentprogramswidget.h" +#include "../settings.h" +#include "../iconsmanager.h" + +#include + +EnvironmentProgramsWidget::EnvironmentProgramsWidget(const QString& name, const QString& group, QWidget *parent) : + SettingsWidget(name,group,parent), + ui(new Ui::EnvironmentProgramsWidget) +{ + ui->setupUi(this); +} + +EnvironmentProgramsWidget::~EnvironmentProgramsWidget() +{ + delete ui; +} + +void EnvironmentProgramsWidget::doLoad() +{ + ui->txtTerminal->setText(pSettings->environment().terminalPath()); +} + +void EnvironmentProgramsWidget::doSave() +{ + pSettings->environment().setTerminalPath(ui->txtTerminal->text()); + pSettings->environment().save(); +} + +void EnvironmentProgramsWidget::updateIcons(const QSize &) +{ + pIconsManager->setIcon(ui->btnChooseTerminal,IconsManager::ACTION_FILE_OPEN_FOLDER); +} + +void EnvironmentProgramsWidget::on_btnChooseTerminal_clicked() +{ + QString filename = QFileDialog::getOpenFileName( + this, + tr("Choose Terminal Program"), + QString(), + tr("All files (*.*)")); + if (!filename.isEmpty() && fileExists(filename) ) { + ui->txtTerminal->setText(filename); + } +} diff --git a/RedPandaIDE/settingsdialog/environmentprogramswidget.h b/RedPandaIDE/settingsdialog/environmentprogramswidget.h new file mode 100644 index 00000000..22d1e30a --- /dev/null +++ b/RedPandaIDE/settingsdialog/environmentprogramswidget.h @@ -0,0 +1,30 @@ +#ifndef ENVIRONMENTPROGRAMSWIDGET_H +#define ENVIRONMENTPROGRAMSWIDGET_H + +#include "settingswidget.h" + +namespace Ui { +class EnvironmentProgramsWidget; +} + +class EnvironmentProgramsWidget : public SettingsWidget +{ + Q_OBJECT + +public: + explicit EnvironmentProgramsWidget(const QString& name, const QString& group, QWidget *parent = nullptr); + ~EnvironmentProgramsWidget(); + +private: + Ui::EnvironmentProgramsWidget *ui; + + // SettingsWidget interface +protected: + void doLoad(); + void doSave(); + void updateIcons(const QSize &size); +private slots: + void on_btnChooseTerminal_clicked(); +}; + +#endif // ENVIRONMENTPROGRAMSWIDGET_H diff --git a/RedPandaIDE/settingsdialog/environmentprogramswidget.ui b/RedPandaIDE/settingsdialog/environmentprogramswidget.ui new file mode 100644 index 00000000..7f896b69 --- /dev/null +++ b/RedPandaIDE/settingsdialog/environmentprogramswidget.ui @@ -0,0 +1,57 @@ + + + EnvironmentProgramsWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + ... + + + + :/icons/images/newlook24/053-open.png:/icons/images/newlook24/053-open.png + + + + + + + Terminal + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + diff --git a/RedPandaIDE/settingsdialog/settingsdialog.cpp b/RedPandaIDE/settingsdialog/settingsdialog.cpp index 81a79866..7469ea63 100644 --- a/RedPandaIDE/settingsdialog/settingsdialog.cpp +++ b/RedPandaIDE/settingsdialog/settingsdialog.cpp @@ -36,6 +36,9 @@ #include "environmentfileassociationwidget.h" #include "projectversioninfowidget.h" #endif +#ifdef Q_OS_LINUX +#include "environmentprogramswidget.h" +#endif #include #include #include @@ -129,6 +132,12 @@ PSettingsDialog SettingsDialog::optionDialog() widget->init(); dialog->addWidget(widget); +#ifdef Q_OS_LINUX + widget = new EnvironmentProgramsWidget(tr("Terminal"),tr("Environment")); + widget->init(); + dialog->addWidget(widget); +#endif + widget = new EnvironmentPerformanceWidget(tr("Performance"),tr("Environment")); widget->init(); dialog->addWidget(widget); diff --git a/RedPandaIDE/toolsmanager.cpp b/RedPandaIDE/toolsmanager.cpp index 7c577f3c..5d082a62 100644 --- a/RedPandaIDE/toolsmanager.cpp +++ b/RedPandaIDE/toolsmanager.cpp @@ -21,7 +21,11 @@ void ToolsManager::load() mTools.clear(); PToolItem item = std::make_shared(); item->title = tr("Remove Compiled"); +#ifdef Q_OS_WIN item->program = "del"; +#else + item->program = "rm"; +#endif item->workingDirectory = ""; item->parameters = ""; item->pauseAfterExit = false;