diff --git a/NEWS.md b/NEWS.md index 7b245dc2..9f962658 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,15 @@ + - change: rename "compile log" panel to "tools output" + - fix: debug panel can't be correctly show/hide + - enhancement: redesign tools output's context menu, add "clear" menu item + - enhancement: tools -> git in the options dialog + - enhancement: auto detect git in PATH + - enhancement: basic git commands + Red Panda C++ Version 0.14.3 - fix: wrong code completion font size, when screen dpi changed - enhancement: replace Files View Panel's path lineedit control with combo box - enhancement: custome icons for project view + - fix: convert to encoding setting in compiler set option not correctly handled Red Panda C++ Version 0.14.2 - enhancement: file system view mode for project diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 5847f659..f1befd7e 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -85,11 +85,14 @@ SOURCES += \ settingsdialog/projectoutputwidget.cpp \ settingsdialog/projectprecompilewidget.cpp \ settingsdialog/toolsgeneralwidget.cpp \ + settingsdialog/toolsgitwidget.cpp \ shortcutmanager.cpp \ symbolusagemanager.cpp \ thememanager.cpp \ todoparser.cpp \ toolsmanager.cpp \ + vcs/gitmanager.cpp \ + vcs/gitrepository.cpp \ widgets/aboutdialog.cpp \ widgets/bookmarkmodel.cpp \ widgets/classbrowser.cpp \ @@ -136,6 +139,7 @@ SOURCES += \ widgets/coloredit.cpp \ widgets/consolewidget.cpp \ widgets/customdisablediconengine.cpp \ + widgets/customfilesystemmodel.cpp \ widgets/custommakefileinfodialog.cpp \ widgets/darkfusionstyle.cpp \ widgets/editorstabwidget.cpp \ @@ -212,11 +216,14 @@ HEADERS += \ settingsdialog/projectoutputwidget.h \ settingsdialog/projectprecompilewidget.h \ settingsdialog/toolsgeneralwidget.h \ + settingsdialog/toolsgitwidget.h \ shortcutmanager.h \ symbolusagemanager.h \ thememanager.h \ todoparser.h \ toolsmanager.h \ + vcs/gitmanager.h \ + vcs/gitrepository.h \ widgets/aboutdialog.h \ widgets/bookmarkmodel.h \ widgets/classbrowser.h \ @@ -264,6 +271,7 @@ HEADERS += \ widgets/coloredit.h \ widgets/consolewidget.h \ widgets/customdisablediconengine.h \ + widgets/customfilesystemmodel.h \ widgets/custommakefileinfodialog.h \ widgets/darkfusionstyle.h \ widgets/editorstabwidget.h \ @@ -308,6 +316,7 @@ FORMS += \ settingsdialog/projectoutputwidget.ui \ settingsdialog/projectprecompilewidget.ui \ settingsdialog/toolsgeneralwidget.ui \ + settingsdialog/toolsgitwidget.ui \ widgets/aboutdialog.ui \ widgets/cpudialog.ui \ mainwindow.ui \ diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 47b2defd..f8930252 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -3096,6 +3096,14 @@ Are you really want to continue? 启用保持多语句单行选项。 + + GitManager + + + Folder "%1" already has a repository! + 文件夹"%1"中已存在仓库! + + InitChooseLanguageWidget @@ -3270,65 +3278,63 @@ Are you really want to continue? 小熊猫C++ - - - - - - - + + + + + + + Issues 编译器 - - Compile Log - 编译日志 + 编译日志 - + File 文件 - + Tools 工具 - - + + Run 运行 - + Edit 编辑 - - + + Project 项目 - + Watch 监视 - + Structure 结构 - + Files 文件 @@ -3337,85 +3343,85 @@ Are you really want to continue? 资源 - - - - - + + + + + Debug 调试 - + Evaluate: 求值 - + Debug Console 调试主控台 - + Call Stack 调用栈 - + Breakpoints 断点 - + Locals 局部变量 - - - + + + Search 查找 - + History: 历史: - + Search Again 重新查找 - + Replace with: 替换为: - + Replace 替换 - + Close 关闭 - + Execute 运行 - - + + Code 代码 - + Window 窗口 @@ -3433,390 +3439,403 @@ Are you really want to continue? 新建 - + Ctrl+N Ctrl+N - + Open... 打开... - + Ctrl+O Ctrl+O - + Save 保存 - + Ctrl+S Ctrl+S - + Save As... 另存为... - + Save As 另存为 - + Save All 全部保存 - + Ctrl+Shift+S Ctrl+Shift+S - + Options 选项 - - - + + + Compile 编译 - + + + Tools Output + 工具输出 + + + Tool Panels 工具面板 - + + Git + Git + + + F9 F9 - + F10 F10 - + Undo 恢复 - + Ctrl+Z Ctrl+Z - + Redo 重做 - + Ctrl+Y Ctrl+Y - + Cut 剪切 - + Ctrl+X Ctrl+X - + + Copy 复制 - + Ctrl+C Ctrl+C - + Paste 粘贴 - + Ctrl+V Ctrl+V - + + Select All 选择全部 - + Ctrl+A Ctrl+A - + Indent 缩进 - + UnIndent 取消缩进 - + Toggle Comment 切换注释 - + Ctrl+/ Ctrl+/ - + Collapse All 全部收起 - + Uncollapse All 全部展开 - + Encode in ANSI 使用ANSI编码 - + Encode in UTF-8 使用UTF-8编码 - + Auto Detect 自动检测 - + Convert to ANSI 转换为ANSI编码 - + Convert to UTF-8 转换为UTF-8编码 - - + + Compile & Run 编译运行 - + F11 F11 - - + + Rebuild All 全部重编译 - + F12 F12 - + Stop Execution 停止执行 - + F6 F6 - + F5 F5 - + Step Over 单步跳过 - + F7 F7 - + Step Into 单步进入 - - - + + + Problem Set 试题集 - - - + + + New Problem Set 新建试题集 - - + + Add Problem 添加试题 - - + + Remove Problem 删除试题 - - - + + + Save Problem Set 保存试题集 - - - + + + Load Problem Set 载入试题集 - + Memory 内存 - + Address Expression: Address: 地址表达式: - + Cancel 取消 - - + + TODO TODO - - + + Bookmark 书签 - - - + + + Problem 试题 - - + + Add Probem Case 添加试题案例 - - + + Remove Problem Case Remove Problem Set 删除试题集 - - + + Open Anwser Source File 打开答案源代码文件 - - + + Run All Cases Run Current Case 运行所有案例 - + Problem Cases Validation Options 测试案例验证选项 - + %v/%m %v/%m - + Output 输出 - + Input 输入 - + Expected 期望输出 - + Help 帮助 - + Refactor 重构 - + View 视图 @@ -3825,441 +3844,461 @@ Are you really want to continue? 工具窗口 - + Main 主工具栏 - + Compiler Set 编译器配置集 - - + + New Source File 新建源代码文件 - + Tab Tab - + Shift+Tab Shift+Tab - + F8 F8 - + Step Out 单步跳出 - + Ctrl+F8 Ctrl+F8 - + Run To Cursor 执行到光标处 - + Ctrl+F5 Ctrl+F5 - + Continue 继续执行 - + F4 F4 - + Add Watch... 添加监视 - + View CPU Window... 打开CPU信息窗口... - + Exit 退出 - + Find... 查找... - + Ctrl+F Ctrl+F - + Find in Files... 在文件中查找... - + Ctrl+Shift+F Ctrl+Shift+F - + Replace... 替换 - + Ctrl+R Ctrl+R - + Find Next 查找下一个 - + F3 F3 - + Find Previous 查找前一个 - + Shift+F3 Shift+F3 - + Remove Watch 删除监视值 - + Remove All Watches Remove All 删除全部监视值 - + Modify Watch... 修改监视值 - + Reformat Code 对代码重新排版 - + Ctrl+Shift+A Ctrl+Shift+A - + Go back 前一次编辑位置 - + Ctrl+Alt+Left Ctrl+Alt+Left - + Forward 后一次编辑位置 - + Ctrl+Alt+Right Ctrl+Alt+Right - + Ctrl+W Ctrl+W - + Close All 全部关闭 - + Ctrl+Shift+W Ctrl+Shift+W - + Maximize Editor 最大化编辑器 - + Ctrl+F11 Ctrl+F11 - + Next 下一窗口 - + Ctrl+Tab Ctrl+Tab - + Previous 前一窗口 - + Ctrl+Shift+Tab Ctrl+Shift+Tab - + Toggle breakpoint 切换断点 - + Ctrl+F4 Ctrl+F4 - - + + Clear all breakpoints 删除所有断点 - + Breakpoint property... 设置断点条件... - + Goto Declaration 跳转到声明处 - + Goto Definition 跳转到定义处 - + Find references 查找符号的引用 - + Open containing folder 打开所在的文件夹 - + Ctrl+B Ctrl+B - + Open a terminal here 打开命令行窗口 - + File Properties... 文件属性... - + Close Project 关闭项目 - + Project options 项目属性 - + New Project... 新建项目... - + New File 新建项目文件 - + Add to project... 添加到项目... - + Remove from project 从项目删除 - + View Makefile 查看Makefile - + Clean 清理构建文件 - + Open Folder in Explorer 在浏览器中打开 - + Open In Terminal 在终端中打开 - + About 关于 - - + + Rename Symbol 重命名符号 - + Shift+F6 Shift+F6 - + Print... 打印... - + Ctrl+P Ctrl+P - - + + Export As RTF 导出为RTF - - + + Export As HTML 导出为HTML - + Move To Other View 移动到其他视图 - + Ctrl+M Ctrl+M - - + + C++ Reference C++参考手册 - + C Reference C参考手册 - + Show Tool Panels 显示全部工具面板 + + + Create Repository + 创建仓库 + + + + Commit + 提交(Commit) + + + + Revert + 撤销(Revert) + + + + Reset + 回滚(Reset) + Tool Window Bars 工具窗口栏 - + Status Bar 状态栏 - + Ctrl+Backspace Ctrl+Backspace - + Interrupt 中断 - - + + Delete To Word Begin 删除到单词开头 - + Ctrl+Shift+B Ctrl+Shift+B - + Delete to Word End 删除到单词结尾 - + Ctrl+Shift+E Ctrl+Shift+E - + New Class... Add Class... 新建类... - - + + New Header... New Header 新建头文件... @@ -4269,47 +4308,47 @@ Are you really want to continue? 插入行 - + Delete Line 删除当前行 - + Ctrl+D Ctrl+D - + Duplicate Line 复制当前行 - + Ctrl+E Ctrl+E - + Delete Word 删除当前单词 - + Ctrl+Shift+D Ctrl+Shift+D - + Delete to EOL 删除到行尾 - + Ctrl+Del Ctrl+Del - + Delete to BOL 删除到行首 @@ -4318,43 +4357,43 @@ Are you really want to continue? C/C++参考 - + EGE Manual EGE图形库手册 - + Add Bookmark 添加书签 - + Remove Bookmark 删除书签 - + Modify Bookmark Description 修改书签说明 - + Locate in Files View 在文件视图中定位 - - + + Open Folder 打开文件夹 - + Running Parameters... 运行参数... - + File Encoding 文件编码 @@ -4569,6 +4608,7 @@ Are you really want to continue? + Clear 清除 @@ -4584,7 +4624,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -4658,15 +4698,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -4777,170 +4817,205 @@ Are you really want to continue? 跳转到定义处 - + + + + New Folder + 新建文件夹 + + + + + + + Delete + 删除 + + + Open in Editor 在编辑器中打开 - + Open in External Program 使用外部程序打开 - + Open in Terminal 在终端中打开 - + Open in Windows Explorer 在Windows浏览器中打开 - + Character sets 字符集 - + %1 files autosaved 已自动保存%1个文件 - + Set answer to... 设置答案源代码... - + select other file... 选择其他文件... - + Select Answer Source File 选择答案源代码文件 - + C/C++Source Files (*.c *.cpp *.cc *.cxx) C/C++Source Files (*.c *.cpp *.cc *.cxx C/C++源代码文件 (*.c *.cpp *.cc *.cxx) - + + Do you really want to delete %1? + 你真的要删除%1吗? + + + + Do you really want to delete %1 files? + 你真的要删除%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? 你真的想要做那些吗? - + 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? + 你真的要删除它吗? + + + + Header Exists 头文件已存在 - - + + Header file "%1" already exists! 头文件"%1"已存在! - + Source Exists 源文件已存在! - + Source file "%1" already exists! 源文件"%1"已存在! @@ -4949,125 +5024,125 @@ Are you really want to continue? 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? - + untitled 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 - + 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 @@ -5080,13 +5155,13 @@ Are you really want to continue? - - - - - - - + + + + + + + Error 错误 @@ -5101,75 +5176,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个文件) @@ -5406,93 +5481,93 @@ Are you really want to continue? 无标题 - + Can't save file 无法保存文件 - + Can't save file '%1' 无法保存文件'%1'. - + Error Load File 载入文件错误 - + File Exists 文件已存在 - + File '%1' is already in the project 文件'%1'已在项目中 - + Project Updated 项目已升级 - + Your project was succesfully updated to a newer file format! 已成功将项目升级到新的格式 - + If something has gone wrong, we kept a backup-file: '%1'... 旧项目文件备份在'%1'。 - + Headers 头文件 - + Sources 源文件 - + Others 其他文件 - + Settings need update 设置需要更新 - + The compiler settings format of Red Panda C++ has changed. The compiler settings format of Dev-C++ has changed. 小熊猫C++的编译器设置格式已发生改变。 - + Please update your settings at Project >> Project Options >> Compiler and save your project. 请在项目 >> 项目属性 >> 编译器设置中修改您的设置并保存您的项目 - + Compiler not found 未找到编译器 - + The compiler set you have selected for this project, no longer exists. 您为该项目设置的编译器不存在。 - + It will be substituted by the global compiler set. 它将会被全局编译器设置代替。 - + Developed using the Red Panda C++ IDE Developed using the Red Panda Dev-C++ IDE 使用小熊猫C++编辑器开发 @@ -5899,24 +5974,24 @@ Are you really want to continue? ProjectModel - + File exists 文件已存在 - + File '%1' already exists. Delete it now? 文件'%1'已存在。是否删除? - - + + Remove failed 删除失败 - - + + Failed to remove file '%1' 无法删除文件'%1' @@ -6215,200 +6290,200 @@ Are you really want to continue? 无法载入自动链接设置 - - - - + + + + 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 Compiler C编译器 - + C++ Compiler C++编译器 - + Maker 构建程序(Make) - + Debugger 调试器 - + 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) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? - + 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) @@ -6417,54 +6492,54 @@ 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 @@ -7215,7 +7290,7 @@ Are you really want to continue? SettingsDialog - + Options 选项 @@ -7241,239 +7316,245 @@ 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 代码排版 - + Program 程序 - + + Tools 工具 - + + Git + Git + + + 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? 本页中有尚未保存的设置修改,是否保存后再切换到其他页? @@ -7756,6 +7837,53 @@ Are you really want to continue? 可执行文件 (*.exe) + + ToolsGitWidget + + Form + 表单 + + + + Git + Git + + + + Test + 测试 + + + + Browse + 浏览 + + + + ... + ... + + + + Path to Git Executable: + Git程序路径 + + + + TextLabel + 选项 + + + + Git Executable + Git程序文件 + + + + All files (%1) + 所有文件 (%1) + + ToolsManager diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index 7114bd31..a84fa2cb 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -292,8 +292,7 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding) } else { encodingName = encoding; } - if (compilerSetExecCharset == ENCODING_SYSTEM_DEFAULT - || compilerSetExecCharset.isEmpty()) { + if (compilerSetExecCharset == ENCODING_SYSTEM_DEFAULT || compilerSetExecCharset.isEmpty()) { execEncodingName = systemEncodingName; } else { execEncodingName = compilerSetExecCharset; diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index fe32c699..6a146dd5 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -99,7 +99,7 @@ void CompilerManager::compile(const QString& filename, const QByteArray& encodin connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue); connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted); - connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog); + connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::logToolsOutput); connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue); connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured); mCompiler->start(); @@ -129,7 +129,7 @@ void CompilerManager::compileProject(std::shared_ptr project, bool rebu connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue); connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted); - connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog); + connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::logToolsOutput); connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue); connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured); mCompiler->start(); @@ -161,7 +161,7 @@ void CompilerManager::cleanProject(std::shared_ptr project) connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue); connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted); - connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog); + connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::logToolsOutput); connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue); connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured); mCompiler->start(); @@ -209,7 +209,7 @@ void CompilerManager::checkSyntax(const QString &filename, const QString &conten connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, this, &CompilerManager::onSyntaxCheckIssue); connect(mBackgroundSyntaxChecker, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted); connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, this, &CompilerManager::onSyntaxCheckFinished); - connect(mBackgroundSyntaxChecker, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog); + connect(mBackgroundSyntaxChecker, &Compiler::compileOutput, pMainWindow, &MainWindow::logToolsOutput); connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue); connect(mBackgroundSyntaxChecker, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured); mBackgroundSyntaxChecker->start(); diff --git a/RedPandaIDE/customfileiconprovider.cpp b/RedPandaIDE/customfileiconprovider.cpp index c28af730..9610c5ea 100644 --- a/RedPandaIDE/customfileiconprovider.cpp +++ b/RedPandaIDE/customfileiconprovider.cpp @@ -1,9 +1,25 @@ #include "customfileiconprovider.h" #include "iconsmanager.h" +#include "vcs/gitrepository.h" CustomFileIconProvider::CustomFileIconProvider() { + mVCSRepository = new GitRepository(""); +} +CustomFileIconProvider::~CustomFileIconProvider() +{ + delete mVCSRepository; +} + +void CustomFileIconProvider::setRootFolder(const QString &folder) +{ + mVCSRepository->setFolder(folder); +} + +void CustomFileIconProvider::update() +{ + mVCSRepository->update(); } QIcon CustomFileIconProvider::icon(IconType type) const @@ -20,14 +36,56 @@ QIcon CustomFileIconProvider::icon(IconType type) const QIcon CustomFileIconProvider::icon(const QFileInfo &info) const { QIcon icon; - if (isHFile(info.fileName())) - icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE); - else if (isCppFile(info.fileName())) { - icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE); + if (info.isDir()) { + if (mVCSRepository->isFileInRepository(info)) { + if (mVCSRepository->isFileStaged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_STAGED); + else if (mVCSRepository->isFileChanged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_CHANGED); + else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_NOCHANGE); + } else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER); + } else if (isHFile(info.fileName())) { + if (mVCSRepository->isFileInRepository(info)) { + if (mVCSRepository->isFileStaged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_STAGED); + else if (mVCSRepository->isFileChanged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_CHANGED); + else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_NOCHANGE); + } else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE); + } else if (isCppFile(info.fileName())) { + if (mVCSRepository->isFileInRepository(info)) { + if (mVCSRepository->isFileStaged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_STAGED); + else if (mVCSRepository->isFileChanged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_CHANGED); + else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_NOCHANGE); + } else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE); } else if (isCFile(info.fileName())) { - icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE); + if (mVCSRepository->isFileInRepository(info)) { + if (mVCSRepository->isFileStaged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_STAGED); + else if (mVCSRepository->isFileChanged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_CHANGED); + else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_NOCHANGE); + } else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE); } else if (info.suffix()=="dev") { - icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE); + if (mVCSRepository->isFileInRepository(info)) { + if (mVCSRepository->isFileStaged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_STAGED); + else if (mVCSRepository->isFileChanged(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_CHANGED); + else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_NOCHANGE); + } else + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE); } if (!icon.isNull()) return icon; diff --git a/RedPandaIDE/customfileiconprovider.h b/RedPandaIDE/customfileiconprovider.h index 890ca9f9..5e79a45a 100644 --- a/RedPandaIDE/customfileiconprovider.h +++ b/RedPandaIDE/customfileiconprovider.h @@ -3,11 +3,16 @@ #include +class GitRepository; class CustomFileIconProvider : public QFileIconProvider { public: CustomFileIconProvider(); - + ~CustomFileIconProvider(); + void setRootFolder(const QString& folder); + void update(); +private: + GitRepository* mVCSRepository; // QFileIconProvider interface public: QIcon icon(IconType type) const override; diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 638614bd..f3670d70 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -68,7 +68,7 @@ const char* SaveException::what() const noexcept { } Editor::Editor(QWidget *parent): - Editor(parent,QObject::tr("untitled"),ENCODING_SYSTEM_DEFAULT,false,true,nullptr) + Editor(parent,QObject::tr("untitled"),ENCODING_AUTO_DETECT,false,true,nullptr) { } @@ -226,7 +226,7 @@ void Editor::saveFile(QString filename) { this->lines()->saveToFile(file,mEncodingOption, pSettings->editor().useUTF8ByDefault()? ENCODING_UTF8 : QTextCodec::codecForLocale()->name(), mFileEncoding); - pMainWindow->updateForEncodingInfo(); + emit fileSaved(filename, mInProject); } void Editor::convertToEncoding(const QByteArray &encoding) diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index beef612c..9eb62ed5 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -225,6 +225,7 @@ public: void tab() override; signals: void renamed(const QString& oldName, const QString& newName, bool firstSave); + void fileSaved(const QString& filename, bool inProject); private slots: void onStatusChanged(SynStatusChanges changes); void onGutterClicked(Qt::MouseButton button, int x, int y, int line); diff --git a/RedPandaIDE/editorlist.cpp b/RedPandaIDE/editorlist.cpp index 4ebf7ccc..03f4727d 100644 --- a/RedPandaIDE/editorlist.cpp +++ b/RedPandaIDE/editorlist.cpp @@ -62,6 +62,8 @@ Editor* EditorList::newEditor(const QString& filename, const QByteArray& encodin e->setInProject(true); } } + connect(e,&Editor::fileSaved, + pMainWindow, &MainWindow::onFileSaved); return e; } diff --git a/RedPandaIDE/iconsmanager.cpp b/RedPandaIDE/iconsmanager.cpp index 12e2be12..b4159153 100644 --- a/RedPandaIDE/iconsmanager.cpp +++ b/RedPandaIDE/iconsmanager.cpp @@ -181,11 +181,29 @@ void IconsManager::updateFileSystemIcons(const QString &iconSet, int size) updateMakeDisabledIconDarker(iconSet); mIconPixmaps.insert(FILESYSTEM_GIT, createSVGIcon(iconFolder+"git.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_FOLDER, createSVGIcon(iconFolder+"folder.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_FOLDER_VCS_CHANGED, createSVGIcon(iconFolder+"folder-vcs-changed.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_FOLDER_VCS_NOCHANGE, createSVGIcon(iconFolder+"folder-vcs-nochange.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_FOLDER_VCS_STAGED, createSVGIcon(iconFolder+"folder-vcs-staged.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_FILE, createSVGIcon(iconFolder+"file.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_FILE_VCS_CHANGED, createSVGIcon(iconFolder+"file-vcs-changed.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_FILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"file-vcs-nochange.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_FILE_VCS_STAGED, createSVGIcon(iconFolder+"file-vcs-staged.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_CFILE, createSVGIcon(iconFolder+"cfile.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_CFILE_VCS_CHANGED, createSVGIcon(iconFolder+"cfile-vcs-changed.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_CFILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"cfile-vcs-nochange.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_CFILE_VCS_STAGED, createSVGIcon(iconFolder+"cfile-vcs-staged.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_HFILE, createSVGIcon(iconFolder+"hfile.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_HFILE_VCS_CHANGED, createSVGIcon(iconFolder+"hfile-vcs-changed.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_HFILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"hfile-vcs-nochange.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_HFILE_VCS_STAGED, createSVGIcon(iconFolder+"hfile-vcs-staged.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_CPPFILE, createSVGIcon(iconFolder+"cppfile.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_CPPFILE_VCS_CHANGED, createSVGIcon(iconFolder+"cppfile-vcs-changed.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_CPPFILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"cppfile-vcs-nochange.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_CPPFILE_VCS_STAGED, createSVGIcon(iconFolder+"cppfile-vcs-staged.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_PROJECTFILE, createSVGIcon(iconFolder+"projectfile.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_PROJECTFILE_VCS_CHANGED, createSVGIcon(iconFolder+"projectfile-vcs-changed.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_PROJECTFILE_VCS_NOCHANGE, createSVGIcon(iconFolder+"projectfile-vcs-nochange.svg",size,size)); + mIconPixmaps.insert(FILESYSTEM_PROJECTFILE_VCS_STAGED, createSVGIcon(iconFolder+"projectfile-vcs-staged.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_HEADERS_FOLDER, createSVGIcon(iconFolder+"headerfolder.svg",size,size)); mIconPixmaps.insert(FILESYSTEM_SOURCES_FOLDER, createSVGIcon(iconFolder+"sourcefolder.svg",size,size)); } diff --git a/RedPandaIDE/iconsmanager.h b/RedPandaIDE/iconsmanager.h index 13138c6f..703230bd 100644 --- a/RedPandaIDE/iconsmanager.h +++ b/RedPandaIDE/iconsmanager.h @@ -72,6 +72,24 @@ public: FILESYSTEM_HFILE, FILESYSTEM_PROJECTFILE, FILESYSTEM_CPPFILE, + FILESYSTEM_FOLDER_VCS_CHANGED, + FILESYSTEM_FILE_VCS_CHANGED, + FILESYSTEM_CFILE_VCS_CHANGED, + FILESYSTEM_HFILE_VCS_CHANGED, + FILESYSTEM_PROJECTFILE_VCS_CHANGED, + FILESYSTEM_CPPFILE_VCS_CHANGED, + FILESYSTEM_FOLDER_VCS_NOCHANGE, + FILESYSTEM_FILE_VCS_NOCHANGE, + FILESYSTEM_CFILE_VCS_NOCHANGE, + FILESYSTEM_HFILE_VCS_NOCHANGE, + FILESYSTEM_PROJECTFILE_VCS_NOCHANGE, + FILESYSTEM_CPPFILE_VCS_NOCHANGE, + FILESYSTEM_FOLDER_VCS_STAGED, + FILESYSTEM_FILE_VCS_STAGED, + FILESYSTEM_CFILE_VCS_STAGED, + FILESYSTEM_HFILE_VCS_STAGED, + FILESYSTEM_PROJECTFILE_VCS_STAGED, + FILESYSTEM_CPPFILE_VCS_STAGED, FILESYSTEM_HEADERS_FOLDER, FILESYSTEM_SOURCES_FOLDER, diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 4097dc21..7e6e1803 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -162,6 +162,11 @@ int main(int argc, char *argv[]) //set default open folder QDir::setCurrent(pSettings->environment().defaultOpenFolder()); + //auto detect git in path + if (!pSettings->vcs().gitOk()) { + pSettings->vcs().detectGitInPath(); + } + MainWindow mainWindow; pMainWindow = &mainWindow; if (app.arguments().count()>1) { diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 05ea8036..917b7ae6 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -39,6 +39,8 @@ #include "iconsmanager.h" #include "widgets/newclassdialog.h" #include "widgets/newheaderdialog.h" +#include "vcs/gitmanager.h" +#include "vcs/gitrepository.h" #include #include @@ -287,7 +289,7 @@ MainWindow::MainWindow(QWidget *parent) //files view ui->treeFiles->setModel(&mFileSystemModel); mFileSystemModel.setReadOnly(false); - mFileSystemModel.setIconProvider(&mFileIconProvider); + mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); setFilesViewRoot(pSettings->environment().currentFolder()); for (int i=1;itreeFiles->hideColumn(i); @@ -324,6 +326,9 @@ MainWindow::MainWindow(QWidget *parent) ui->actionEGE_Manual->setVisible(pSettings->environment().language()=="zh_CN"); + //git menu + connect(ui->menuGit, &QMenu::aboutToShow, + this, &MainWindow::updateVCSActions); buildContextMenus(); updateAppTitle(); //applySettings(); @@ -425,7 +430,8 @@ void MainWindow::updateEditorActions() ui->actionAuto_Detect->setEnabled(true); ui->actionEncode_in_ANSI->setEnabled(true); ui->actionEncode_in_UTF_8->setEnabled(true); - ui->actionConvert_to_ANSI->setEnabled(e->encodingOption()!=ENCODING_SYSTEM_DEFAULT && e->fileEncoding()!=ENCODING_SYSTEM_DEFAULT); + ui->actionConvert_to_ANSI->setEnabled(e->encodingOption()!=ENCODING_SYSTEM_DEFAULT + && e->fileEncoding()!=ENCODING_SYSTEM_DEFAULT); ui->actionConvert_to_UTF_8->setEnabled(e->encodingOption()!=ENCODING_UTF8 && e->fileEncoding()!=ENCODING_UTF8); ui->actionCopy->setEnabled(e->selAvail()); @@ -663,6 +669,8 @@ void MainWindow::applySettings() // ui->cbFilesPath->setItemIcon(i,pIconsManager->getIcon(IconsManager::FILESYSTEM_GIT)); // } + ui->menuGit->menuAction()->setVisible(pSettings->vcs().gitOk()); + } void MainWindow::applyUISettings() @@ -690,8 +698,8 @@ void MainWindow::applyUISettings() ui->actionIssues->setChecked(settings.showIssues()); showHideMessagesTab(ui->tabIssues,settings.showIssues()); - ui->actionCompile_Log->setChecked(settings.showCompileLog()); - showHideMessagesTab(ui->tabCompilerOutput,settings.showCompileLog()); + ui->actionTools_Output->setChecked(settings.showCompileLog()); + showHideMessagesTab(ui->tabToolsOutput,settings.showCompileLog()); ui->actionDebug_Window->setChecked(settings.showDebug()); showHideMessagesTab(ui->tabDebug,settings.showDebug()); ui->actionSearch->setChecked(settings.showSearch()); @@ -737,6 +745,22 @@ void MainWindow::updateDPI() applySettings(); } +void MainWindow::onFileSaved(const QString &path, bool inProject) +{ + qDebug()<model()->beginUpdate(); + mProject->model()->endUpdate(); + } + QModelIndex index = mFileSystemModel.index(path); + if (index.isValid()) { + mFileSystemModelIconProvider.update(); + mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); + ui->treeFiles->update(index); + } + pMainWindow->updateForEncodingInfo(); +} + void MainWindow::updateAppTitle() { QString appName=tr("Red Panda C++"); @@ -1293,6 +1317,8 @@ void MainWindow::updateActionIcons() mBreakpointViewRemoveAllAction->setIcon(pIconsManager->getIcon(IconsManager::ACTION_MISC_CLEAN)); mBreakpointViewRemoveAction->setIcon(pIconsManager->getIcon(IconsManager::ACTION_MISC_CROSS)); + //Tools Output + //classbrowser mClassBrowser_Sort_By_Name->setIcon(pIconsManager->getIcon(IconsManager::ACTION_EDIT_SORT_BY_NAME)); mClassBrowser_Sort_By_Type->setIcon(pIconsManager->getIcon(IconsManager::ACTION_EDIT_SORT_BY_TYPE)); @@ -1349,14 +1375,12 @@ void MainWindow::updateActionIcons() idx = ui->tabMessages->indexOf(ui->tabSearch); if (idx>=0) ui->tabMessages->setTabIcon(idx,pIconsManager->getIcon(IconsManager::ACTION_EDIT_SEARCH)); - idx = ui->tabMessages->indexOf(ui->tabCompilerOutput); + idx = ui->tabMessages->indexOf(ui->tabToolsOutput); if (idx>=0) ui->tabMessages->setTabIcon(idx,pIconsManager->getIcon(IconsManager::ACTION_VIEW_COMPILELOG)); idx = ui->tabMessages->indexOf(ui->tabTODO); if (idx>=0) ui->tabMessages->setTabIcon(idx,pIconsManager->getIcon(IconsManager::ACTION_VIEW_TODO)); - - idx = ui->tabMessages->indexOf(ui->tabBookmark); if (idx>=0) ui->tabMessages->setTabIcon(idx,pIconsManager->getIcon(IconsManager::ACTION_VIEW_BOOKMARK)); @@ -1423,7 +1447,7 @@ bool MainWindow::compile(bool rebuild) mCompileSuccessionTask->filename = mProject->executable(); } openCloseBottomPanel(true); - ui->tabMessages->setCurrentWidget(ui->tabCompilerOutput); + ui->tabMessages->setCurrentWidget(ui->tabToolsOutput); mCompilerManager->compileProject(mProject,rebuild); updateCompileActions(); updateAppTitle(); @@ -1439,7 +1463,7 @@ bool MainWindow::compile(bool rebuild) mCompileSuccessionTask->filename = getCompiledExecutableName(editor->filename()); } openCloseBottomPanel(true); - ui->tabMessages->setCurrentWidget(ui->tabCompilerOutput); + ui->tabMessages->setCurrentWidget(ui->tabToolsOutput); mCompilerManager->compile(editor->filename(),editor->fileEncoding(),rebuild); updateCompileActions(); updateAppTitle(); @@ -2749,6 +2773,26 @@ void MainWindow::buildContextMenus() hlayout->addWidget(toolButton); } + //context menu signal for class browser + ui->txtToolsOutput->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui->txtToolsOutput,&QWidget::customContextMenuRequested, + this, &MainWindow::onToolsOutputContextMenu); + mToolsOutput_Clear = createActionFor( + tr("Clear"), + ui->txtToolsOutput); + connect(mToolsOutput_Clear, &QAction::triggered, + this, &MainWindow::onToolsOutputClear); + mToolsOutput_Copy = createActionFor( + tr("Copy"), + ui->txtToolsOutput); + mToolsOutput_Copy->setShortcut(QKeySequence("Ctrl+C")); + connect(mToolsOutput_Copy, &QAction::triggered, + this, &MainWindow::onToolsOutputCopy); + mToolsOutput_SelectAll = createActionFor( + tr("Select All"), + ui->txtToolsOutput); + connect(mToolsOutput_SelectAll, &QAction::triggered, + this, &MainWindow::onToolsOutputSelectAll); } void MainWindow::buildEncodingMenu() @@ -2948,7 +2992,12 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) onRoot = true; } } + GitManager vcsManager; + QString branch; + bool hasRepository = vcsManager.hasRepository(mProject->folder(),branch); + QMenu menu(this); + QMenu vcsMenu(this); updateProjectActions(); menu.addAction(ui->actionProject_New_File); menu.addAction(ui->actionNew_Class); @@ -2961,6 +3010,15 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) menu.addAction(mProject_Rename_Unit); } menu.addSeparator(); + if (pSettings->vcs().gitOk()) { + if (hasRepository) { + menu.addMenu(&vcsMenu); + } else { + ui->actionGit_Create_Repository->setEnabled(true); + menu.addAction(ui->actionGit_Create_Repository); + } + menu.addSeparator(); + } if (onFolder && mProject->modelType()==ProjectModelType::Custom) { menu.addAction(mProject_Add_Folder); if (!onRoot) { @@ -2981,6 +3039,18 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) } menu.addAction(ui->actionProject_options); + if (pSettings->vcs().gitOk() && hasRepository) { + vcsMenu.setTitle(tr("VCS")); + if (ui->projectView->selectionModel()->hasSelection()) + vcsMenu.addAction(ui->actionGit_Add_Files); + vcsMenu.addAction(ui->actionGit_Commit); + vcsMenu.addAction(ui->actionGit_Reset); + vcsMenu.addAction(ui->actionGit_Revert); + + ui->actionGit_Commit->setEnabled(true); + ui->actionGit_Reset->setEnabled(true); + ui->actionGit_Revert->setEnabled(true); + } menu.exec(ui->projectView->mapToGlobal(pos)); } @@ -3034,12 +3104,24 @@ void MainWindow::onFileEncodingContextMenu(const QPoint &pos) void MainWindow::onFilesViewContextMenu(const QPoint &pos) { - + GitManager vcsManager; + QString branch; + bool hasRepository = vcsManager.hasRepository(pSettings->environment().currentFolder(),branch); QMenu menu(this); + QMenu vcsMenu(this); menu.addAction(ui->actionOpen_Folder); menu.addSeparator(); menu.addAction(mFilesView_CreateFolder); menu.addSeparator(); + if (pSettings->vcs().gitOk()) { + if (hasRepository) { + menu.addMenu(&vcsMenu); + } else { + ui->actionGit_Create_Repository->setEnabled(true); + menu.addAction(ui->actionGit_Create_Repository); + } + menu.addSeparator(); + } menu.addAction(mFilesView_Open); menu.addAction(mFilesView_OpenWithExternal); menu.addSeparator(); @@ -3051,6 +3133,19 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos) mFilesView_OpenWithExternal->setEnabled(info.isFile()); mFilesView_OpenInTerminal->setEnabled(!path.isEmpty()); mFilesView_OpenInExplorer->setEnabled(!path.isEmpty()); + + if (pSettings->vcs().gitOk() && hasRepository) { + vcsMenu.setTitle(tr("VCS")); + if (ui->treeFiles->selectionModel()->hasSelection()) + vcsMenu.addAction(ui->actionGit_Add_Files); + vcsMenu.addAction(ui->actionGit_Commit); + vcsMenu.addAction(ui->actionGit_Reset); + vcsMenu.addAction(ui->actionGit_Revert); + + ui->actionGit_Commit->setEnabled(true); + ui->actionGit_Reset->setEnabled(true); + ui->actionGit_Revert->setEnabled(true); + } menu.exec(ui->treeFiles->mapToGlobal(pos)); } @@ -3124,6 +3219,16 @@ void MainWindow::onLstProblemSetContextMenu(const QPoint &pos) menu.exec(ui->lstProblemSet->mapToGlobal(pos)); } +void MainWindow::onToolsOutputContextMenu(const QPoint &pos) +{ + QMenu menu(this); + menu.addAction(mToolsOutput_Copy); + menu.addAction(mToolsOutput_SelectAll); + menu.addSeparator(); + menu.addAction(mToolsOutput_Clear); + menu.exec(ui->txtToolsOutput->mapToGlobal(pos)); +} + void MainWindow::onProblemSetIndexChanged(const QModelIndex ¤t, const QModelIndex &/* previous */) { QModelIndex idx = current; @@ -3276,6 +3381,21 @@ void MainWindow::onEditorClosed() updateAppTitle(); } +void MainWindow::onToolsOutputClear() +{ + ui->txtToolsOutput->clear(); +} + +void MainWindow::onToolsOutputCopy() +{ + ui->txtToolsOutput->copy(); +} + +void MainWindow::onToolsOutputSelectAll() +{ + ui->txtToolsOutput->selectAll(); +} + void MainWindow::onShowInsertCodeSnippetMenu() { mMenuInsertCodeSnippet->clear(); @@ -3982,12 +4102,12 @@ void MainWindow::onCompilerSetChanged(int index) pSettings->compilerSets().saveDefaultIndex(); } -void MainWindow::onCompileLog(const QString& msg) +void MainWindow::logToolsOutput(const QString& msg) { - ui->txtCompilerOutput->appendPlainText(msg); - ui->txtCompilerOutput->moveCursor(QTextCursor::End); - ui->txtCompilerOutput->moveCursor(QTextCursor::StartOfLine); - ui->txtCompilerOutput->ensureCursorVisible(); + ui->txtToolsOutput->appendPlainText(msg); + ui->txtToolsOutput->moveCursor(QTextCursor::End); + ui->txtToolsOutput->moveCursor(QTextCursor::StartOfLine); + ui->txtToolsOutput->ensureCursorVisible(); } void MainWindow::onCompileIssue(PCompileIssue issue) @@ -4013,9 +4133,14 @@ void MainWindow::onCompileIssue(PCompileIssue issue) } } +void MainWindow::clearToolsOutput() +{ + ui->txtToolsOutput->clear(); +} + void MainWindow::onCompileStarted() { - ui->txtCompilerOutput->clear(); + //do nothing } void MainWindow::onCompileFinished(bool isCheckSyntax) @@ -5451,6 +5576,7 @@ void MainWindow::newProjectUnitFile() PProjectUnit newUnit = mProject->newUnit( mProject->pointerToNode(node),newFileName); idx = mProject->units().count()-1; + mProject->rebuildNodes(); mProject->saveUnits(); updateProjectView(); Editor * editor = mProject->openUnit(idx); @@ -5478,6 +5604,27 @@ void MainWindow::doFilesViewRemoveFile(const QModelIndex &index) } } +void MainWindow::updateVCSActions() +{ + bool hasRepository = false; + bool shouldEnable = false; + if (ui->projectView->isVisible() && mProject) { + GitManager vcsManager; + QString branch; + hasRepository = vcsManager.hasRepository(mProject->folder(),branch); + shouldEnable = true; + } else if (ui->treeFiles->isVisible()) { + GitManager vcsManager; + QString branch; + hasRepository = vcsManager.hasRepository(pSettings->environment().currentFolder(),branch); + shouldEnable = true; + } + ui->actionGit_Create_Repository->setEnabled(!hasRepository && shouldEnable); + ui->actionGit_Commit->setEnabled(hasRepository && shouldEnable); + ui->actionGit_Reset->setEnabled(hasRepository && shouldEnable); + ui->actionGit_Revert->setEnabled(hasRepository && shouldEnable); +} + void MainWindow::invalidateProjectProxyModel() { mProjectProxyModel->invalidate(); @@ -5613,9 +5760,11 @@ void MainWindow::showSearchReplacePanel(bool show) void MainWindow::setFilesViewRoot(const QString &path) { + mFileSystemModelIconProvider.setRootFolder(path); mFileSystemModel.setRootPath(path); ui->treeFiles->setRootIndex(mFileSystemModel.index(path)); pSettings->environment().setCurrentFolder(path); + QDir::setCurrent(path); int pos = ui->cbFilesPath->findText(path); if (pos<0) { ui->cbFilesPath->addItem(mFileSystemModel.iconProvider()->icon(QFileIconProvider::Folder),path); @@ -6153,17 +6302,17 @@ void MainWindow::on_actionIssues_triggered() } -void MainWindow::on_actionCompile_Log_triggered() +void MainWindow::on_actionTools_Output_triggered() { - bool state = ui->actionCompile_Log->isChecked(); - ui->actionCompile_Log->setChecked(state); - showHideMessagesTab(ui->tabCompilerOutput,state); + bool state = ui->actionTools_Output->isChecked(); + ui->actionTools_Output->setChecked(state); + showHideMessagesTab(ui->tabToolsOutput,state); } void MainWindow::on_actionDebug_Window_triggered() { - bool state = ui->actionCompile_Log->isChecked(); + bool state = ui->actionDebug_Window->isChecked(); ui->actionDebug_Window->setChecked(state); showHideMessagesTab(ui->tabDebug, state); } @@ -6400,3 +6549,89 @@ void MainWindow::on_actionNew_Class_triggered() pSettings->ui().setNewHeaderDialogHeight(dialog.height()); } + +void MainWindow::on_actionGit_Create_Repository_triggered() +{ + if (ui->treeFiles->isVisible()) { + GitManager vcsManager; + vcsManager.createRepository(pSettings->environment().currentFolder()); + int pos = ui->cbFilesPath->findText(pSettings->environment().currentFolder()); + if (pos>=0) { + ui->cbFilesPath->setItemIcon(pos, pIconsManager->getIcon(IconsManager::FILESYSTEM_GIT)); + } + } else if (ui->projectView->isVisible() && mProject) { + GitManager vcsManager; + vcsManager.createRepository(mProject->folder()); + } + if (mProject) { + mProject->model()->beginUpdate(); + mProject->model()->endUpdate(); + } +} + + +void MainWindow::on_actionGit_Add_Files_triggered() +{ + if (ui->treeFiles->isVisible()) { + GitManager vcsManager; + QModelIndexList indices = ui->treeFiles->selectionModel()->selectedRows(); + foreach (const QModelIndex index,indices) { + QFileInfo info = mFileSystemModel.fileInfo(index); + vcsManager.add(info.absolutePath(),info.fileName()); + } + //update icons in files view + mFileSystemModelIconProvider.update(); + mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); + } else if (ui->projectView->isVisible() && mProject) { + GitManager vcsManager; + QModelIndexList indices = ui->projectView->selectionModel()->selectedRows(); + foreach (const QModelIndex index,indices) { + QModelIndex realIndex = mProjectProxyModel->mapToSource(index); + ProjectModelNode * node = static_cast(realIndex.internalPointer()); + PProjectModelNode folderNode = mProject->pointerToNode(node); + if (!folderNode) + continue; + if (folderNode->unitIndex>=0) { + PProjectUnit unit = mProject->units()[folderNode->unitIndex]; + QFileInfo info(unit->fileName()); + vcsManager.add(info.absolutePath(),info.fileName()); + } + } + } + //update icons in project view + if (mProject) { + mProject->model()->beginUpdate(); + mProject->model()->endUpdate(); + } + //update icons in files view too + mFileSystemModelIconProvider.update(); + mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); +} + + +void MainWindow::on_actionGit_Commit_triggered() +{ + QString folder; + if (ui->treeFiles->isVisible()) { + folder = pSettings->environment().currentFolder(); + } else if (ui->projectView->isVisible() && mProject) { + folder = mProject->folder(); + } + if (folder.isEmpty()) + return; + QString message = QInputDialog::getText(this,tr("Commit Message"),"Commit Message:"); + if (message.isEmpty()) + return; + GitRepository repository(folder); + repository.commit(message,true); + + //update project view + if (mProject) { + mProject->model()->beginUpdate(); + mProject->model()->endUpdate(); + } + //update files view + mFileSystemModelIconProvider.update(); + mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); +} + diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index ce0dd5ce..b848d186 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -38,6 +38,7 @@ #include "widgets/labelwithmenu.h" #include "widgets/bookmarkmodel.h" #include "widgets/ojproblemsetmodel.h" +#include "widgets/customfilesystemmodel.h" #include "customfileiconprovider.h" @@ -184,8 +185,9 @@ public: bool openningFiles() const; public slots: - void onCompileLog(const QString& msg); + void logToolsOutput(const QString& msg); void onCompileIssue(PCompileIssue issue); + void clearToolsOutput(); void onCompileStarted(); void onCompileFinished(bool isCheckSyntax); void onCompileErrorOccured(const QString& reason); @@ -216,6 +218,7 @@ public slots: void onTodoParseFinished(); void setActiveBreakpoint(QString FileName, int Line, bool setFocus); void updateDPI(); + void onFileSaved(const QString& path, bool inProject); private: void prepareProjectForCompile(); @@ -252,12 +255,12 @@ private: void doFilesViewRemoveFile(const QModelIndex& index); private slots: + void updateVCSActions(); void invalidateProjectProxyModel(); void onEditorRenamed(const QString& oldFilename, const QString& newFilename, bool firstSave); void onAutoSaveTimeout(); void onFileChanged(const QString& path); void onFilesViewPathChanged(); - void onWatchViewContextMenu(const QPoint& pos); void onBookmarkContextMenu(const QPoint& pos); void onTableIssuesContextMenu(const QPoint& pos); @@ -269,12 +272,17 @@ private slots: void onFileEncodingContextMenu(const QPoint& pos); void onFilesViewContextMenu(const QPoint& pos); void onLstProblemSetContextMenu(const QPoint& pos); + void onToolsOutputContextMenu(const QPoint&pos); + void onProblemSetIndexChanged(const QModelIndex ¤t, const QModelIndex &previous); void onProblemCaseIndexChanged(const QModelIndex ¤t, const QModelIndex &previous); void onProblemNameChanged(int index); void onNewProblemConnection(); void updateProblemTitle(); void onEditorClosed(); + void onToolsOutputClear(); + void onToolsOutputCopy(); + void onToolsOutputSelectAll(); void onShowInsertCodeSnippetMenu(); @@ -536,7 +544,7 @@ private slots: void on_actionIssues_triggered(); - void on_actionCompile_Log_triggered(); + void on_actionTools_Output_triggered(); void on_actionDebug_Window_triggered(); @@ -570,6 +578,12 @@ private slots: void on_actionNew_Header_triggered(); + void on_actionGit_Create_Repository_triggered(); + + void on_actionGit_Add_Files_triggered(); + + void on_actionGit_Commit_triggered(); + private: Ui::MainWindow *ui; EditorList *mEditorList; @@ -609,8 +623,8 @@ private: PCodeSnippetManager mCodeSnippetManager; PTodoParser mTodoParser; PToolsManager mToolsManager; - QFileSystemModel mFileSystemModel; - CustomFileIconProvider mFileIconProvider; + CustomFileSystemModel mFileSystemModel; + CustomFileIconProvider mFileSystemModelIconProvider; OJProblemSetModel mOJProblemSetModel; OJProblemModel mOJProblemModel; int mOJProblemSetNameCounter; @@ -692,6 +706,11 @@ private: QAction * mProblem_OpenSource; QAction * mProblem_Properties; + //action for tools output + QAction * mToolsOutput_Clear; + QAction * mToolsOutput_SelectAll; + QAction * mToolsOutput_Copy; + QSortFilterProxyModel* mProjectProxyModel; // QWidget interface diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 8eccde9c..35a5c356 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -229,7 +229,7 @@ - 0 + 2 0 @@ -291,6 +291,9 @@ QAbstractItemView::ExtendedSelection + + false + @@ -539,7 +542,7 @@ QTabWidget::South - 6 + 1 @@ -602,14 +605,14 @@ - + :/icons/images/newlook24/015-compres.png - Compile Log + Tools Output @@ -625,7 +628,7 @@ 5 - + false @@ -1582,7 +1585,7 @@ - + @@ -1593,6 +1596,16 @@ + + + Git + + + + + + + @@ -1601,6 +1614,7 @@ + @@ -2611,12 +2625,12 @@ Issues - + true - Compile Log + Tools Output @@ -2740,6 +2754,31 @@ New Header... + + + Create Repository + + + + + Commit + + + + + Revert + + + + + Reset + + + + + Add Files + + diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index 6db736ff..1d166bf5 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -36,6 +36,7 @@ #include "customfileiconprovider.h" #include #include "settings.h" +#include "vcs/gitmanager.h" Project::Project(const QString &filename, const QString &name, QObject *parent) : QObject(parent), @@ -1909,6 +1910,14 @@ ProjectModel::ProjectModel(Project *project, QObject *parent): mProject(project) { mUpdateCount = 0; + mVCSRepository = new GitRepository(""); + mIconProvider = new CustomFileIconProvider(); +} + +ProjectModel::~ProjectModel() +{ + delete mVCSRepository; + delete mIconProvider; } void ProjectModel::beginUpdate() @@ -1923,6 +1932,8 @@ void ProjectModel::endUpdate() { mUpdateCount--; if (mUpdateCount==0) { + mVCSRepository->setFolder(mProject->folder()); + mIconProvider->setRootFolder(mProject->folder()); endResetModel(); } } @@ -1980,26 +1991,38 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const ProjectModelNode* p = static_cast(index.internalPointer()); if (!p) return QVariant(); - if (role == Qt::DisplayRole || role==Qt::EditRole) { + if (role == Qt::DisplayRole) { + if (p == mProject->rootNode().get()) { + QString branch; + if (mVCSRepository->hasRepository(branch)) + return QString("%1 [%2]").arg(p->text,branch); + } + return p->text; + } else if (role==Qt::EditRole) { return p->text; } else if (role == Qt::DecorationRole) { - CustomFileIconProvider provider; QIcon icon; if (p->unitIndex>=0) { - icon = provider.icon(mProject->units()[p->unitIndex]->fileName()); + icon = mIconProvider->icon(mProject->units()[p->unitIndex]->fileName()); } else { - switch(p->folderNodeType) { - case ProjectSpecialFolderNode::HEADERS: - icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HEADERS_FOLDER); - break; - case ProjectSpecialFolderNode::SOURCES: - icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_SOURCES_FOLDER); - break; - default: - icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER); + if (p == mProject->rootNode().get()) { + QString branch; + if (mVCSRepository->hasRepository(branch)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_GIT); + } else { + switch(p->folderNodeType) { + case ProjectSpecialFolderNode::HEADERS: + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HEADERS_FOLDER); + break; + case ProjectSpecialFolderNode::SOURCES: + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_SOURCES_FOLDER); + break; + default: + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER); + } } if (icon.isNull()) - icon = provider.icon(QFileIconProvider::Folder); + icon = mIconProvider->icon(QFileIconProvider::Folder); } return icon; } diff --git a/RedPandaIDE/project.h b/RedPandaIDE/project.h index 73927200..063dc19e 100644 --- a/RedPandaIDE/project.h +++ b/RedPandaIDE/project.h @@ -101,15 +101,21 @@ private: using PProjectUnit = std::shared_ptr; +class GitRepository; +class CustomFileIconProvider; class ProjectModel : public QAbstractItemModel { Q_OBJECT public: explicit ProjectModel(Project* project, QObject* parent=nullptr); + ~ProjectModel(); void beginUpdate(); void endUpdate(); private: Project* mProject; + GitRepository *mVCSRepository; int mUpdateCount; + CustomFileIconProvider* mIconProvider; + // QAbstractItemModel interface public: @@ -143,7 +149,6 @@ protected: bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override; }; - class ProjectTemplate; class Project : public QObject { diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-changed.svg new file mode 100644 index 00000000..9774f39a --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-changed.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-nochange.svg new file mode 100644 index 00000000..324065c7 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-nochange.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-staged.svg new file mode 100644 index 00000000..3828e08e --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-staged.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile.svg new file mode 100644 index 00000000..650c0de9 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-changed.svg new file mode 100644 index 00000000..7c09e1a1 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-changed.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-nochange.svg new file mode 100644 index 00000000..31718dba --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-nochange.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-staged.svg new file mode 100644 index 00000000..d157b152 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-staged.svg @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile.svg new file mode 100644 index 00000000..d7d2c0a8 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-changed.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-changed.svg new file mode 100644 index 00000000..bc727ca3 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-changed.svg @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-nochange.svg new file mode 100644 index 00000000..8420fab5 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-nochange.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-staged.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-staged.svg new file mode 100644 index 00000000..8109db78 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-staged.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/file.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file.svg new file mode 100644 index 00000000..819de1ed --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-changed.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-changed.svg new file mode 100644 index 00000000..5a9abb6b --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-changed.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-nochange.svg new file mode 100644 index 00000000..4df3204f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-nochange.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-staged.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-staged.svg new file mode 100644 index 00000000..4f4f113e --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-staged.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder.svg new file mode 100644 index 00000000..714caabb --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/headerfolder.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/headerfolder.svg new file mode 100644 index 00000000..5021a799 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/headerfolder.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-changed.svg new file mode 100644 index 00000000..af8fe84d --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-changed.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-nochange.svg new file mode 100644 index 00000000..75e83585 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-nochange.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-staged.svg new file mode 100644 index 00000000..2852d6d2 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-staged.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile.svg new file mode 100644 index 00000000..dec5a3f6 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-changed.svg new file mode 100644 index 00000000..ba7a50cd --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-changed.svg @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-nochange.svg new file mode 100644 index 00000000..88541b45 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-nochange.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-staged.svg new file mode 100644 index 00000000..d099b25d --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-staged.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile.svg new file mode 100644 index 00000000..03095458 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/sourcefolder.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/sourcefolder.svg new file mode 100644 index 00000000..7712f510 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/sourcefolder.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-changed.svg new file mode 100644 index 00000000..9774f39a --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-changed.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-nochange.svg new file mode 100644 index 00000000..324065c7 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-nochange.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-staged.svg new file mode 100644 index 00000000..3828e08e --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-staged.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile.svg new file mode 100644 index 00000000..650c0de9 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-changed.svg new file mode 100644 index 00000000..7c09e1a1 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-changed.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-nochange.svg new file mode 100644 index 00000000..31718dba --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-nochange.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-staged.svg new file mode 100644 index 00000000..d157b152 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-staged.svg @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile.svg new file mode 100644 index 00000000..d7d2c0a8 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-changed.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-changed.svg new file mode 100644 index 00000000..bc727ca3 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-changed.svg @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-nochange.svg new file mode 100644 index 00000000..8420fab5 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-nochange.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-staged.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-staged.svg new file mode 100644 index 00000000..8109db78 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-staged.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/file.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/file.svg new file mode 100644 index 00000000..819de1ed --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/file.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-changed.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-changed.svg new file mode 100644 index 00000000..5a9abb6b --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-changed.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-nochange.svg new file mode 100644 index 00000000..4df3204f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-nochange.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-staged.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-staged.svg new file mode 100644 index 00000000..4f4f113e --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-staged.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/folder.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder.svg new file mode 100644 index 00000000..714caabb --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder.svg @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/headerfolder.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/headerfolder.svg new file mode 100644 index 00000000..5021a799 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/headerfolder.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-changed.svg new file mode 100644 index 00000000..af8fe84d --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-changed.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-nochange.svg new file mode 100644 index 00000000..75e83585 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-nochange.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-staged.svg new file mode 100644 index 00000000..2852d6d2 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-staged.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile.svg new file mode 100644 index 00000000..dec5a3f6 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-changed.svg new file mode 100644 index 00000000..ba7a50cd --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-changed.svg @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-nochange.svg new file mode 100644 index 00000000..88541b45 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-nochange.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-staged.svg new file mode 100644 index 00000000..d099b25d --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-staged.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile.svg new file mode 100644 index 00000000..03095458 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/sourcefolder.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/sourcefolder.svg new file mode 100644 index 00000000..7712f510 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/sourcefolder.svg @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-changed.svg new file mode 100644 index 00000000..9774f39a --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-changed.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-nochange.svg new file mode 100644 index 00000000..324065c7 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-nochange.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-staged.svg new file mode 100644 index 00000000..3828e08e --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-staged.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-changed.svg new file mode 100644 index 00000000..7c09e1a1 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-changed.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-nochange.svg new file mode 100644 index 00000000..31718dba --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-nochange.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-staged.svg new file mode 100644 index 00000000..d157b152 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-staged.svg @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-changed.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-changed.svg new file mode 100644 index 00000000..bc727ca3 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-changed.svg @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-nochange.svg new file mode 100644 index 00000000..8420fab5 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-nochange.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-staged.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-staged.svg new file mode 100644 index 00000000..8109db78 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-staged.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-changed.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-changed.svg new file mode 100644 index 00000000..5a9abb6b --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-changed.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-nochange.svg new file mode 100644 index 00000000..4df3204f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-nochange.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-staged.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-staged.svg new file mode 100644 index 00000000..4f4f113e --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-staged.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-changed.svg new file mode 100644 index 00000000..af8fe84d --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-changed.svg @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-nochange.svg new file mode 100644 index 00000000..75e83585 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-nochange.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-staged.svg new file mode 100644 index 00000000..2852d6d2 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-staged.svg @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-changed.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-changed.svg new file mode 100644 index 00000000..ba7a50cd --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-changed.svg @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-nochange.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-nochange.svg new file mode 100644 index 00000000..88541b45 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-nochange.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-staged.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-staged.svg new file mode 100644 index 00000000..d099b25d --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-staged.svg @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 6e11b216..2b61087f 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -46,7 +46,8 @@ Settings::Settings(const QString &filename): mCodeCompletion(this), mCodeFormatter(this), mHistory(this), - mUI(this) + mUI(this), + mVCS(this) { load(); } @@ -106,6 +107,8 @@ void Settings::load() mCodeFormatter.load(); mUI.load(); mDirs.load(); + mVCS.load(); + } Settings::Dirs &Settings::dirs() @@ -153,6 +156,11 @@ Settings::UI &Settings::ui() return mUI; } +Settings::VCS &Settings::vcs() +{ + return mVCS; +} + Settings::History& Settings::history() { return mHistory; @@ -5082,3 +5090,77 @@ void Settings::UI::doLoad() mNewHeaderDialogWidth = intValue("new_header_dialog_width", 642*qApp->desktop()->width()/1920); mNewHeaderDialogHeight = intValue("new_header_dialog_height", 300*qApp->desktop()->height()/1080); } + +Settings::VCS::VCS(Settings *settings):_Base(settings,SETTING_VCS), + mGitOk(false) +{ +} + +void Settings::VCS::doSave() +{ + saveValue("git_path",mGitPath); +} + +void Settings::VCS::doLoad() +{ + setGitPath(stringValue("git_path", "")); +} + +const QString &Settings::VCS::gitPath() const +{ + return mGitPath; +} + +void Settings::VCS::setGitPath(const QString &newGitPath) +{ + if (mGitPath!=newGitPath) { + mGitPath = newGitPath; + validateGit(); + } +} + +void Settings::VCS::validateGit() +{ + mGitOk = false; + QFileInfo fileInfo(mGitPath); + if (!fileInfo.exists()) { + return; + } + QStringList args; + args.append("--version"); + QString output = runAndGetOutput( + fileInfo.fileName(), + fileInfo.absolutePath(), + args); + mGitOk = output.startsWith("git version"); +} + +bool Settings::VCS::gitOk() const +{ + return mGitOk; +} + +void Settings::VCS::detectGitInPath() +{ + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QString path = env.value("PATH"); + QStringList pathList = path.split(PATH_SEPARATOR); + QSet searched; + foreach (const QString& s, pathList){ + if (searched.contains(s)) + continue;; + searched.insert(s); + QDir dir(s); + if (dir.exists(GIT_PROGRAM)) { + QString oldPath = mGitPath; + setGitPath(dir.filePath(GIT_PROGRAM)); + if (mGitOk) { + doSave(); + return; + } else { + mGitPath = oldPath; + } + } + + } +} diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 7e7f1361..1b198018 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -36,6 +36,7 @@ #define SETTING_DEBUGGER "Debugger" #define SETTING_HISTORY "History" #define SETTING_UI "UI" +#define SETTING_VCS "VCS" #define SETTING_CODE_COMPLETION "CodeCompletion" #define SETTING_CODE_FORMATTER "CodeFormatter" #define SETTING_COMPILTER_SETS "CompilerSets" @@ -881,6 +882,23 @@ public: void doLoad() override; }; + class VCS: public _Base { + public: + explicit VCS(Settings *settings); + const QString &gitPath() const; + void setGitPath(const QString &newGitPath); + bool gitOk() const; + void detectGitInPath(); + private: + void validateGit(); + private: + QString mGitPath; + bool mGitOk; + protected: + void doSave() override; + void doLoad() override; + }; + class UI: public _Base { public: explicit UI(Settings *settings); @@ -1325,6 +1343,7 @@ public: CodeCompletion &codeCompletion(); CodeFormatter &codeFormatter(); UI &ui(); + VCS &vcs(); QString filename() const; private: @@ -1340,6 +1359,7 @@ private: CodeFormatter mCodeFormatter; History mHistory; UI mUI; + VCS mVCS; }; diff --git a/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp b/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp index 5a8a535f..e3850d49 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp @@ -246,7 +246,7 @@ void CompilerSetOptionWidget::saveCurrentCompilerSet() if (ui->cbEncodingDetails->isVisible()) { pSet->setExecCharset(ui->cbEncodingDetails->currentText()); } else { - pSet->setExecCharset(ui->cbEncoding->currentText()); + pSet->setExecCharset(ui->cbEncoding->currentData().toString()); } //read values in the options widget diff --git a/RedPandaIDE/settingsdialog/settingsdialog.cpp b/RedPandaIDE/settingsdialog/settingsdialog.cpp index d1dafffd..5e2d69c4 100644 --- a/RedPandaIDE/settingsdialog/settingsdialog.cpp +++ b/RedPandaIDE/settingsdialog/settingsdialog.cpp @@ -48,6 +48,7 @@ #include "projectmakefilewidget.h" #include "projectdllhostwidget.h" #include "toolsgeneralwidget.h" +#include "toolsgitwidget.h" #ifdef Q_OS_WIN #include "environmentfileassociationwidget.h" #include "projectversioninfowidget.h" @@ -219,6 +220,10 @@ PSettingsDialog SettingsDialog::optionDialog() widget = new ToolsGeneralWidget(tr("General"),tr("Tools")); dialog->addWidget(widget); + widget = new ToolsGitWidget(tr("Git"),tr("Tools")); + dialog->addWidget(widget); + + dialog->selectFirstWidget(); return dialog; diff --git a/RedPandaIDE/settingsdialog/toolsgitwidget.cpp b/RedPandaIDE/settingsdialog/toolsgitwidget.cpp new file mode 100644 index 00000000..2be01b35 --- /dev/null +++ b/RedPandaIDE/settingsdialog/toolsgitwidget.cpp @@ -0,0 +1,71 @@ +#include "toolsgitwidget.h" +#include "ui_toolsgitwidget.h" +#include "../iconsmanager.h" +#include "../settings.h" +#include "../systemconsts.h" +#include "../utils.h" +#include "../mainwindow.h" + +#include + +ToolsGitWidget::ToolsGitWidget(const QString& name, const QString& group, QWidget *parent) : + SettingsWidget(name,group,parent), + ui(new Ui::ToolsGitWidget) +{ + ui->setupUi(this); + ui->lblGitInfo->setVisible(false); +} + +ToolsGitWidget::~ToolsGitWidget() +{ + delete ui; +} + +void ToolsGitWidget::doLoad() +{ + ui->txtGitPath->setText(pSettings->vcs().gitPath()); +} + +void ToolsGitWidget::doSave() +{ + pSettings->vcs().setGitPath(ui->txtGitPath->text()); + pSettings->vcs().save(); + pMainWindow->applySettings(); +} + +void ToolsGitWidget::updateIcons(const QSize &size) +{ + pIconsManager->setIcon(ui->btnBrowseGit,IconsManager::ACTION_FILE_OPEN_FOLDER); +} + +void ToolsGitWidget::on_btnBrowseGit_clicked() +{ + QString filename = QFileDialog::getOpenFileName( + this, + tr("Git Executable"), + QString(), + tr("All files (%1)").arg(ALL_FILE_WILDCARD)); + if (!filename.isEmpty() && fileExists(filename)) { + ui->txtGitPath->setText(filename); + } +} + + +void ToolsGitWidget::on_btnTestGit_clicked() +{ + QFileInfo fileInfo(ui->txtGitPath->text()); + if (!fileInfo.exists()) { + ui->lblGitInfo->setVisible(false); + return; + } + ui->lblGitInfo->setVisible(true); + ui->lblGitInfo->setText(""); + QStringList args; + args.append("--version"); + QString output = runAndGetOutput( + fileInfo.fileName(), + fileInfo.absolutePath(), + args); + ui->lblGitInfo->setText(output); +} + diff --git a/RedPandaIDE/settingsdialog/toolsgitwidget.h b/RedPandaIDE/settingsdialog/toolsgitwidget.h new file mode 100644 index 00000000..42d96d39 --- /dev/null +++ b/RedPandaIDE/settingsdialog/toolsgitwidget.h @@ -0,0 +1,32 @@ +#ifndef TOOLSGITWIDGET_H +#define TOOLSGITWIDGET_H + +#include +#include "settingswidget.h" + +namespace Ui { +class ToolsGitWidget; +} + +class ToolsGitWidget : public SettingsWidget +{ + Q_OBJECT + +public: + explicit ToolsGitWidget(const QString& name, const QString& group, QWidget *parent = nullptr); + ~ToolsGitWidget(); + +private: + Ui::ToolsGitWidget *ui; + + // SettingsWidget interface +protected: + void doLoad() override; + void doSave() override; + void updateIcons(const QSize &size) override; +private slots: + void on_btnBrowseGit_clicked(); + void on_btnTestGit_clicked(); +}; + +#endif // TOOLSGITWIDGET_H diff --git a/RedPandaIDE/settingsdialog/toolsgitwidget.ui b/RedPandaIDE/settingsdialog/toolsgitwidget.ui new file mode 100644 index 00000000..d41a85c7 --- /dev/null +++ b/RedPandaIDE/settingsdialog/toolsgitwidget.ui @@ -0,0 +1,77 @@ + + + ToolsGitWidget + + + + 0 + 0 + 555 + 300 + + + + Git + + + + + + Test + + + + + + + Browse + + + ... + + + + :/icons/images/newlook24/053-open.png:/icons/images/newlook24/053-open.png + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Path to Git Executable: + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + + diff --git a/RedPandaIDE/systemconsts.h b/RedPandaIDE/systemconsts.h index e60b313f..498821d6 100644 --- a/RedPandaIDE/systemconsts.h +++ b/RedPandaIDE/systemconsts.h @@ -31,6 +31,7 @@ #define GPROF_PROGRAM "gprof.exe" #define CLEAN_PROGRAM "del /q /f" #define CPP_PROGRAM "cpp.exe" +#define GIT_PROGRAM "git.exe" #elif defined(Q_OS_LINUX) #define GCC_PROGRAM "gcc" #define GPP_PROGRAM "g++" @@ -42,6 +43,7 @@ #define GPROF_PROGRAM "gprof" #define CLEAN_PROGRAM "rm -rf" #define CPP_PROGRAM "cpp" +#define GIT_PROGRAM "git" #else #error "Only support windows and linux now!" #endif diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index 5e6ef97c..4b0bd02e 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -1140,3 +1140,5 @@ void copyFolder(const QString &fromDir, const QString &toDir) } } } + + diff --git a/RedPandaIDE/vcs/gitmanager.cpp b/RedPandaIDE/vcs/gitmanager.cpp new file mode 100644 index 00000000..eb072f9b --- /dev/null +++ b/RedPandaIDE/vcs/gitmanager.cpp @@ -0,0 +1,315 @@ +#include "gitmanager.h" +#include "../utils.h" +#include "../settings.h" + +#include +#include + +GitManager::GitManager(QObject *parent) : QObject(parent) +{ +} + +void GitManager::createRepository(const QString &folder) +{ + QString currentBranch; + if (hasRepository(folder,currentBranch)) + throw GitError(tr("Folder \"%1\" already has a repository!")); + QStringList args; + args.append("init"); + runGit(folder,args); + + QStringList contents; + contents.append(".git"); + contents.append("*.o"); + contents.append("*.exe"); + contents.append("*."); + + QDir dir(folder); + stringsToFile(contents,dir.filePath(".gitignore")); + add(folder,".gitignore"); +} + +bool GitManager::hasRepository(const QString &folder, QString& currentBranch) +{ + + QStringList args; + args.append("status"); + args.append("-b"); + args.append("-u"); + args.append("no"); + args.append("--ignored=no"); + QString output = runGit(folder,args); + bool result = output.startsWith("On branch"); + if (result) { + int pos = QString("On branch").length(); + while (posvcs().gitOk(); +} + +QString GitManager::runGit(const QString& workingFolder, const QStringList &args) +{ + if (!isValid()) + return ""; + QFileInfo fileInfo(pSettings->vcs().gitPath()); + if (!fileInfo.exists()) + return "fatal: git doesn't exist"; + emit gitCmdRunning(QString("Running in \"%1\": \n \"%2\" \"%3\"") + .arg(workingFolder, + pSettings->vcs().gitPath(), + args.join("\" \""))); + QString output = runAndGetOutput( + fileInfo.absoluteFilePath(), + workingFolder, + args); + output = escapeUTF8String(output.toUtf8()); + emit gitCmdFinished(output); +// if (output.startsWith("fatal:")) +// throw GitError(output); + return output; +} + +QString GitManager::escapeUTF8String(const QByteArray &rawString) +{ + QByteArray stringValue; + int p = 0; + while (p=rawString.length() || + rawString[p+i]<'0' || rawString[p+i]>'7') + break; + } + bool ok; + unsigned char ch = rawString.mid(p,i).toInt(&ok,8); + stringValue+=ch; + p+=i; + break; + } + } + } else { + if (ch!='\"') + stringValue+=ch; + p++; + } + } + return QString::fromUtf8(stringValue); +} + +GitError::GitError(const QString &reason):BaseError(reason) +{ + +} diff --git a/RedPandaIDE/vcs/gitmanager.h b/RedPandaIDE/vcs/gitmanager.h new file mode 100644 index 00000000..ef54245f --- /dev/null +++ b/RedPandaIDE/vcs/gitmanager.h @@ -0,0 +1,56 @@ +#ifndef GITMANAGER_H +#define GITMANAGER_H + +#include +#include +#include +#include "utils.h" +#include "gitrepository.h" + +class GitError: public BaseError { +public: + explicit GitError(const QString& reason); +}; + +class GitManager : public QObject +{ + Q_OBJECT +public: + + explicit GitManager(QObject *parent = nullptr); + + void createRepository(const QString& folder); + bool hasRepository(const QString& folder, QString& currentBranch); + + QString rootFolder(const QString& folder); + + bool isFileInRepository(const QFileInfo& fileInfo); + bool isFileStaged(const QFileInfo& fileInfo); + bool isFileChanged(const QFileInfo& fileInfo); + + void add(const QString& folder, const QString& path); + void remove(const QString& folder, const QString& path); + void rename(const QString& folder, const QString& oldName, const QString& newName); + void restore(const QString& folder, const QString& path); + QStringList listFiles(const QString& folder); + QStringList listStagedFiles(const QString& folder); + QStringList listChangedFiles(const QString& folder); + + void clone(const QString& folder, const QString& url); + void commit(const QString& folder, const QString& message); + void revert(const QString& folder); + void reset(const QString& folder, const QString& commit, GitResetStrategy strategy); + + bool isValid(); + +signals: + void gitCmdRunning(const QString& gitCmd); + void gitCmdFinished(const QString& message); +private: + QString runGit(const QString& workingFolder, const QStringList& args); + + QString escapeUTF8String(const QByteArray& rawString); +private: +}; + +#endif // GITMANAGER_H diff --git a/RedPandaIDE/vcs/gitrepository.cpp b/RedPandaIDE/vcs/gitrepository.cpp new file mode 100644 index 00000000..0a882bad --- /dev/null +++ b/RedPandaIDE/vcs/gitrepository.cpp @@ -0,0 +1,122 @@ +#include "gitrepository.h" +#include "gitmanager.h" + +GitRepository::GitRepository(const QString& folder, QObject *parent) + : QObject{parent}, + mInRepository(false) +{ + mManager = new GitManager(); + setFolder(folder); +} + +GitRepository::~GitRepository() +{ + delete mManager; +} + +const QString &GitRepository::folder() const +{ + return mRealFolder; +} + +void GitRepository::createRepository() +{ + mManager->createRepository(mRealFolder); +} + +bool GitRepository::hasRepository(QString& currentBranch) +{ + currentBranch = mBranch; + return mInRepository; +} + +void GitRepository::add(const QString &path) +{ + mManager->add(mFolder,path); +} + +void GitRepository::remove(const QString &path) +{ + mManager->remove(mFolder,path); +} + +void GitRepository::rename(const QString &oldName, const QString &newName) +{ + mManager->rename(mFolder, oldName, newName); +} + +void GitRepository::restore(const QString &path) +{ + mManager->restore(mFolder, path); +} + +QSet GitRepository::listFiles(bool refresh) +{ + if (refresh) + update(); + return mFilesInRepositories; +} + +void GitRepository::clone(const QString &url) +{ + mManager->clone(mFolder,url); +} + +void GitRepository::commit(const QString &message, bool autoAdd) +{ + if (autoAdd) { + convertFilesListToSet(mManager->listChangedFiles(mRealFolder),mChangedFiles); + foreach(const QString& s, mChangedFiles) { + QFileInfo info(s); + mManager->add(info.absolutePath(),info.fileName()); + } + } + mManager->commit(mRealFolder, message); +} + +void GitRepository::revert() +{ + mManager->revert(mRealFolder); +} + +void GitRepository::reset(const QString &commit, GitResetStrategy strategy) +{ + mManager->reset(mRealFolder,commit,strategy); +} + +void GitRepository::setFolder(const QString &newFolder) +{ + mFolder = newFolder; + mRealFolder = mManager->rootFolder(mFolder); + update(); +} + +void GitRepository::update() +{ + if (!mManager->isValid()) { + mInRepository = false; + mBranch = ""; + mFilesInRepositories.clear(); + mChangedFiles.clear(); + mStagedFiles.clear(); + } else { + mInRepository = mManager->hasRepository(mRealFolder,mBranch); + convertFilesListToSet(mManager->listFiles(mRealFolder),mFilesInRepositories); + convertFilesListToSet(mManager->listChangedFiles(mRealFolder),mChangedFiles); + convertFilesListToSet(mManager->listStagedFiles(mRealFolder),mStagedFiles); + } +} + +const QString &GitRepository::realFolder() const +{ + return mRealFolder; +} + +void GitRepository::convertFilesListToSet(const QStringList &filesList, QSet &set) +{ + set.clear(); + foreach (const QString& s, filesList) { + set.insert(includeTrailingPathDelimiter(mRealFolder)+s); + } +} + diff --git a/RedPandaIDE/vcs/gitrepository.h b/RedPandaIDE/vcs/gitrepository.h new file mode 100644 index 00000000..2f8d55f7 --- /dev/null +++ b/RedPandaIDE/vcs/gitrepository.h @@ -0,0 +1,80 @@ +#ifndef GITREPOSITORY_H +#define GITREPOSITORY_H + +#include +#include +#include +#include + +enum class GitResetStrategy { + Soft, + Hard, + Merge, + Mixed, + Keep +}; + +class GitManager; +class GitRepository : public QObject +{ + Q_OBJECT +public: + explicit GitRepository(const QString& folder, QObject *parent = nullptr); + ~GitRepository(); + + const QString &folder() const; + + void createRepository(); + bool hasRepository(QString& currentBranch); + + bool isFileInRepository(const QFileInfo& fileInfo) { + return isFileInRepository(fileInfo.absoluteFilePath()); + } + bool isFileInRepository(const QString& filePath) { + return mFilesInRepositories.contains(filePath); + } + bool isFileStaged(const QFileInfo& fileInfo) { + return isFileStaged(fileInfo.absoluteFilePath()); + } + bool isFileStaged(const QString& filePath) { + return mStagedFiles.contains(filePath); + } + bool isFileChanged(const QFileInfo& fileInfo) { + return isFileChanged(fileInfo.absoluteFilePath()); + } + bool isFileChanged(const QString& filePath) { + return mChangedFiles.contains(filePath); + } + + void add(const QString& path); + void remove(const QString& path); + void rename(const QString& oldName, const QString& newName); + void restore(const QString& path); + QSet listFiles(bool refresh); + + void clone(const QString& url); + void commit(const QString& message, bool autoAdd=true); + void revert(); + void reset(const QString& commit, GitResetStrategy strategy); + + + void setFolder(const QString &newFolder); + void update(); + + const QString &realFolder() const; + +signals: +private: + QString mRealFolder; + QString mFolder; + bool mInRepository; + QString mBranch; + GitManager* mManager; + QSet mFilesInRepositories; + QSet mChangedFiles; + QSet mStagedFiles; +private: + void convertFilesListToSet(const QStringList& filesList,QSet& set); +}; + +#endif // GITREPOSITORY_H diff --git a/RedPandaIDE/widgets/customfilesystemmodel.cpp b/RedPandaIDE/widgets/customfilesystemmodel.cpp new file mode 100644 index 00000000..6bf3e517 --- /dev/null +++ b/RedPandaIDE/widgets/customfilesystemmodel.cpp @@ -0,0 +1,13 @@ +#include "customfilesystemmodel.h" +#include "../vcs/gitmanager.h" +#include "../vcs/gitrepository.h" + +CustomFileSystemModel::CustomFileSystemModel(QObject *parent) : QFileSystemModel(parent) +{ +} + +QVariant CustomFileSystemModel::data(const QModelIndex &index, int role) const +{ + return QFileSystemModel::data(index,role); +} + diff --git a/RedPandaIDE/widgets/customfilesystemmodel.h b/RedPandaIDE/widgets/customfilesystemmodel.h new file mode 100644 index 00000000..a87730ed --- /dev/null +++ b/RedPandaIDE/widgets/customfilesystemmodel.h @@ -0,0 +1,20 @@ +#ifndef CUSTOMFILESYSTEMMODEL_H +#define CUSTOMFILESYSTEMMODEL_H + +#include + + +class GitRepository; +class GitManager; +class CustomFileSystemModel : public QFileSystemModel +{ + Q_OBJECT +public: + explicit CustomFileSystemModel(QObject *parent = nullptr); + + // QAbstractItemModel interface +public: + QVariant data(const QModelIndex &index, int role) const override; +}; + +#endif // CUSTOMFILESYSTEMMODEL_H