diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 29a7afb1..b28ef1f7 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -3450,18 +3450,18 @@ Are you really want to continue? MainWindow - + Red Panda C++ 小熊猫C++ - - - - - + + + + + Issues 编译器 @@ -3535,7 +3535,7 @@ Are you really want to continue? - + Debug Console 调试主控台 @@ -3611,7 +3611,7 @@ Are you really want to continue? 工具栏2 - + New 新建 @@ -3669,8 +3669,8 @@ Are you really want to continue? - - + + Compile 编译 @@ -3732,9 +3732,9 @@ Are you really want to continue? - - - + + + Copy 复制 @@ -3745,7 +3745,7 @@ Are you really want to continue? - + Paste 粘贴 @@ -3756,8 +3756,8 @@ Are you really want to continue? - - + + Select All 选择全部 @@ -3877,14 +3877,14 @@ Are you really want to continue? - + Problem Set 试题集 - + New Problem Set 新建试题集 @@ -3903,14 +3903,14 @@ Are you really want to continue? - + Save Problem Set 保存试题集 - + Load Problem Set 载入试题集 @@ -3946,7 +3946,7 @@ Are you really want to continue? - + Problem 试题 @@ -4249,7 +4249,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -4350,7 +4350,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -4371,13 +4371,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -4586,7 +4586,7 @@ Are you really want to continue? - + Open Folder 打开文件夹 @@ -4596,42 +4596,42 @@ Are you really want to continue? 运行参数... - + File Encoding 文件编码 - + Recent Files 文件历史 - - - - - - + + + + + + Debugging 正在调试 - - - - - - + + + + + + Running 正在运行 - - - - - - + + + + + + Compiling 正在编译 @@ -4640,194 +4640,194 @@ Are you really want to continue? 行:%1 列:%2 已选择:%3 总行数:%4 总长度:%5 - + Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5 Line: %1 Col: %2 Selected: %3 Lines: %4 Length: %5 行: %1 列: %2 已选择 :%3 总行数: %4 总长度: %5 - + Read Only 只读 - + Insert 插入 - + Overwrite 覆写 - + Close project 关闭项目 - + Are you sure you want to close %1? 你确定要关闭'%1'吗? - - + + Confirm 确认 - - - + + + Source file is not compiled. 源文件尚未编译。 - - + + Compile now? 现在编译? - - + + Source file is more recent than executable. 源文件比可执行程序新。 - + Recompile now? 重新编译? - + No compiler set 无编译器设置 - + No compiler set is configured. 没有配置编译器设置。 - + Can't start debugging. 无法启动调试器 - - + + Enable debugging 启用调试参数 - - + + You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.<BR /><BR />Do you want to correct this now? 当前编译设置中未启用调试选项(-g3),或启用了信息剥除选项(-s)<br /><br/>是否纠正这一问题? - + Project not built 项目尚未构建 - + Project hasn't been built. Build it now? 项目尚未构建。是否构建? - + Host applcation missing 宿主程序不存在 - + DLL project needs a host application to run. 动态链接库(DLL)需要一个宿主程序来运行。 - + But it's missing. 但它不存在。 - + Host application not exists 宿主程序不存在 - + Host application file '%1' doesn't exist. 宿主程序'%1'不存在。 - + Recompile? 重新编译? - - + + Save last open info error 保存上次打开信息失败 - + Can't remove old last open information file '%1' 无法删除旧上次打开信息文件'%1' - + Can't save last open info file '%1' 无法保存上次打开信息文件'%1' - + Load last open info error 载入上次打开信息失败 - + Can't load last open info file '%1' 无法载入上次打开信息文件'%1' - + Open Source File 打开源代码文件 - + Show detail debug logs 显示详细调试器日志 - + Copy all 全部复制 - - - + + + Clear 清除 - + Export 导出 - + Insert Snippet 插入代码段 - - + + Problem Set %1 试题集%1 @@ -4848,68 +4848,68 @@ Are you really want to continue? 或者选择使用其他的网络端口。 - - + + Rebuild Project 重新构建项目 - - + + Project has been modified, do you want to rebuild it? 项目已经被修改过,是否需要重新构建? - + Auto Save Error 自动保存出错 - + Auto save "%1" to "%2" failed:%3 自动保存"%1"到"%2"失败:%3 - + Properties... 试题属性... - + Set Problem Set Name 设置试题集名称 - + Problem Set Name: 试题集名称: - + Remove 删除 - + Remove All Bookmarks 删除全部书签 - + Modify Description 修改描述 - - - + + + Bookmark Description 书签描述 - - - + + + Description: 描述: @@ -4918,322 +4918,332 @@ Are you really want to continue? 在调试主控台中显示调试器输出 - + Remove this search 清除这次搜索 - + Clear all searches 删除所有搜索 - + Breakpoint condition... 断点条件... - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Remove All Breakpoints Remove all breakpoints 删除所有断点 - + Remove Breakpoint 删除当前断点 - + Rename File 重命名文件 - - + + Add Folder 添加文件夹 - + New folder 新文件夹 - + Folder name: 文件夹: - + Rename Folder 重命名 - + Remove Folder 删除文件夹 - + Switch to normal view 切换为普通视图 - + Switch to custom view 切换为自定义视图 - + Sort By Type 按类型排序 - + Sort alphabetically 按名称排序 - + Show inherited members 显示继承的成员 - + Goto declaration 跳转到声明处 - + Goto definition 跳转到定义处 - - - + + + 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"已存在! - + + Can't commit! + 无法提交! + + + + The following files are in conflicting: + 下列文件处于冲突状态,请解决后重新添加和提交: + + + Commit Message 提交信息 - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -5242,233 +5252,233 @@ 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 - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + Error 错误 - + Recent Projects 项目历史 - + Load Theme Error 载入主题失败 - - + + Version Control 版本控制 - + 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个文件) @@ -6439,7 +6449,7 @@ Are you really want to continue? QApplication - + Error 错误 @@ -6493,23 +6503,23 @@ Are you really want to continue? - - + + Error 错误 - + Can't create configuration folder %1 无法创建配置文件夹"%1" - + Can't write to configuration file %1 无法写入配置文件夹"%1" - + Can't load autolink settings 无法载入自动链接设置 @@ -7144,7 +7154,7 @@ Are you really want to continue? 无法解析试题集文件"%1":%2 - + <Auto Generated by Git> <由Git自动生成> @@ -7603,7 +7613,7 @@ Are you really want to continue? 自动链接 - + @@ -7679,15 +7689,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 diff --git a/RedPandaIDE/customfileiconprovider.cpp b/RedPandaIDE/customfileiconprovider.cpp index 4c827c1d..ae109d6d 100644 --- a/RedPandaIDE/customfileiconprovider.cpp +++ b/RedPandaIDE/customfileiconprovider.cpp @@ -43,7 +43,9 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const QIcon icon; if (info.isDir()) { if (mVCSRepository->isFileInRepository(info)) { - if (mVCSRepository->isFileStaged(info)) + if (mVCSRepository->isFileConflicting(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER_VCS_CONFLICT); + else 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); @@ -53,7 +55,9 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FOLDER); } else if (isHFile(info.fileName())) { if (mVCSRepository->isFileInRepository(info)) { - if (mVCSRepository->isFileStaged(info)) + if (mVCSRepository->isFileConflicting(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE_VCS_CONFLICT); + else 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); @@ -63,7 +67,9 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_HFILE); } else if (isCppFile(info.fileName())) { if (mVCSRepository->isFileInRepository(info)) { - if (mVCSRepository->isFileStaged(info)) + if (mVCSRepository->isFileConflicting(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE_VCS_CONFLICT); + else 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); @@ -73,7 +79,9 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CPPFILE); } else if (isCFile(info.fileName())) { if (mVCSRepository->isFileInRepository(info)) { - if (mVCSRepository->isFileStaged(info)) + if (mVCSRepository->isFileConflicting(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE_VCS_CONFLICT); + else 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); @@ -83,7 +91,9 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_CFILE); } else if (info.suffix()=="dev") { if (mVCSRepository->isFileInRepository(info)) { - if (mVCSRepository->isFileStaged(info)) + if (mVCSRepository->isFileConflicting(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE_VCS_CONFLICT); + else 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); @@ -93,7 +103,9 @@ QIcon CustomFileIconProvider::icon(const QFileInfo &info) const icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_PROJECTFILE); } else { if (mVCSRepository->isFileInRepository(info)) { - if (mVCSRepository->isFileStaged(info)) + if (mVCSRepository->isFileConflicting(info)) + icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FILE_VCS_CONFLICT); + else if (mVCSRepository->isFileStaged(info)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FILE_VCS_STAGED); else if (mVCSRepository->isFileChanged(info)) icon = pIconsManager->getIcon(IconsManager::FILESYSTEM_FILE_VCS_CHANGED); diff --git a/RedPandaIDE/iconsmanager.cpp b/RedPandaIDE/iconsmanager.cpp index b4159153..3a1911c7 100644 --- a/RedPandaIDE/iconsmanager.cpp +++ b/RedPandaIDE/iconsmanager.cpp @@ -182,26 +182,32 @@ void IconsManager::updateFileSystemIcons(const QString &iconSet, int size) 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_CONFLICT, createSVGIcon(iconFolder+"folder-vcs-conflict.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_CONFLICT, createSVGIcon(iconFolder+"file-vcs-conflict.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_CONFLICT, createSVGIcon(iconFolder+"cfile-vcs-conflict.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_CONFLICT, createSVGIcon(iconFolder+"hfile-vcs-conflict.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_CONFLICT, createSVGIcon(iconFolder+"cppfile-vcs-conflict.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_CONFLICT, createSVGIcon(iconFolder+"projectfile-vcs-conflict.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)); diff --git a/RedPandaIDE/iconsmanager.h b/RedPandaIDE/iconsmanager.h index 703230bd..797983da 100644 --- a/RedPandaIDE/iconsmanager.h +++ b/RedPandaIDE/iconsmanager.h @@ -78,6 +78,12 @@ public: FILESYSTEM_HFILE_VCS_CHANGED, FILESYSTEM_PROJECTFILE_VCS_CHANGED, FILESYSTEM_CPPFILE_VCS_CHANGED, + FILESYSTEM_FOLDER_VCS_CONFLICT, + FILESYSTEM_FILE_VCS_CONFLICT, + FILESYSTEM_CFILE_VCS_CONFLICT, + FILESYSTEM_HFILE_VCS_CONFLICT, + FILESYSTEM_PROJECTFILE_VCS_CONFLICT, + FILESYSTEM_CPPFILE_VCS_CONFLICT, FILESYSTEM_FOLDER_VCS_NOCHANGE, FILESYSTEM_FILE_VCS_NOCHANGE, FILESYSTEM_CFILE_VCS_NOCHANGE, diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 15af830b..913b7b12 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -43,6 +43,7 @@ #include "vcs/gitrepository.h" #include "vcs/gitbranchdialog.h" #include "vcs/gitmergedialog.h" +#include "widgets/infomessagebox.h" #include #include @@ -3061,6 +3062,7 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) menu.addAction(ui->actionProject_options); if (pSettings->vcs().gitOk() && hasRepository) { + mProject->model()->iconProvider()->update(); vcsMenu.setTitle(tr("Version Control")); if (ui->projectView->selectionModel()->hasSelection()) { bool shouldAdd = true; @@ -3078,7 +3080,11 @@ void MainWindow::onProjectViewContextMenu(const QPoint &pos) PProjectUnit pUnit=mProject->units()[node->unitIndex]; if (mProject->model()->iconProvider()->VCSRepository()->isFileInRepository( pUnit->fileName() - )) { + ) + && + !mProject->model()->iconProvider()->VCSRepository()->isFileConflicting( + pUnit->fileName() + )) { shouldAdd=false; break; } @@ -3187,13 +3193,18 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos) mFilesView_OpenInExplorer->setEnabled(!path.isEmpty()); if (pSettings->vcs().gitOk() && hasRepository) { + mFileSystemModelIconProvider.update(); vcsMenu.setTitle(tr("Version Control")); if (ui->treeFiles->selectionModel()->hasSelection()) { bool shouldAdd = true; foreach (const QModelIndex& index, ui->treeFiles->selectionModel()->selectedRows()) { if (mFileSystemModelIconProvider.VCSRepository()->isFileInRepository( mFileSystemModel.fileInfo(index) - )) { + ) && + ! mFileSystemModelIconProvider.VCSRepository()->isFileConflicting( + mFileSystemModel.fileInfo(index) + ) + ) { shouldAdd=false; break; } @@ -5710,16 +5721,16 @@ void MainWindow::updateVCSActions() bool shouldEnable = false; bool canBranch = false; if (ui->projectView->isVisible() && mProject) { - GitManager vcsManager; + mProject->model()->iconProvider()->update(); QString branch; - hasRepository = vcsManager.hasRepository(mProject->folder(),branch); + hasRepository = mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch); shouldEnable = true; canBranch = !mProject->model()->iconProvider()->VCSRepository()->hasChangedFiles() && !mProject->model()->iconProvider()->VCSRepository()->hasStagedFiles(); } else if (ui->treeFiles->isVisible()) { - GitManager vcsManager; + mFileSystemModelIconProvider.update(); QString branch; - hasRepository = vcsManager.hasRepository(pSettings->environment().currentFolder(),branch); + hasRepository = mFileSystemModelIconProvider.VCSRepository()->hasRepository(branch); shouldEnable = true; canBranch =!mFileSystemModelIconProvider.VCSRepository()->hasChangedFiles() && !mFileSystemModelIconProvider.VCSRepository()->hasStagedFiles(); @@ -6754,6 +6765,18 @@ void MainWindow::on_actionGit_Commit_triggered() } if (folder.isEmpty()) return; + + GitManager vcsManager; + QStringList conflicts = vcsManager.listConflicts(folder); + if (!conflicts.isEmpty()) { + InfoMessageBox infoBox; + infoBox.setMessage( + tr("Can't commit!") + "
" + +tr("The following files are in conflicting:")+"
" + + linesToText(conflicts)); + infoBox.exec(); + return; + } QString message = QInputDialog::getText(this,tr("Commit Message"),"Commit Message:"); if (message.isEmpty()) { QMessageBox::critical(this, @@ -6762,7 +6785,6 @@ void MainWindow::on_actionGit_Commit_triggered() ); return; } - GitManager vcsManager; vcsManager.commit(folder,message,true); //update project view diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-conflict.svg new file mode 100644 index 00000000..c2b7cb0f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cfile-vcs-conflict.svg @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-conflict.svg new file mode 100644 index 00000000..59466849 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/cppfile-vcs-conflict.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-conflict.svg new file mode 100644 index 00000000..64acd7b1 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/file-vcs-conflict.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-conflict.svg new file mode 100644 index 00000000..85c4f34f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/folder-vcs-conflict.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-conflict.svg new file mode 100644 index 00000000..c3b19b4e --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/hfile-vcs-conflict.svg @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-conflict.svg new file mode 100644 index 00000000..cf32579f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/filesystem/projectfile-vcs-conflict.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-conflict.svg new file mode 100644 index 00000000..55d395de --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cfile-vcs-conflict.svg @@ -0,0 +1,105 @@ + + + + + + + + + ! + + ! + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-conflict.svg new file mode 100644 index 00000000..05f30bde --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/cppfile-vcs-conflict.svg @@ -0,0 +1,134 @@ + + + + + + + + ! + + + + + + + + + ! + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-conflict.svg new file mode 100644 index 00000000..ec3f8626 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/file-vcs-conflict.svg @@ -0,0 +1,101 @@ + + + + + + + + ! + + ! + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-conflict.svg new file mode 100644 index 00000000..69f37686 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/folder-vcs-conflict.svg @@ -0,0 +1,77 @@ + + + + + + + ! + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-conflict.svg new file mode 100644 index 00000000..f3c3368a --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/hfile-vcs-conflict.svg @@ -0,0 +1,105 @@ + + + + + + + + ! + + + ! + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-conflict.svg new file mode 100644 index 00000000..a5f09fd1 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/filesystem/projectfile-vcs-conflict.svg @@ -0,0 +1,105 @@ + + + + + + + ! + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-conflict.svg index 10964c61..c2b7cb0f 100644 --- a/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-conflict.svg +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/cfile-vcs-conflict.svg @@ -25,8 +25,8 @@ inkscape:document-units="px" showgrid="false" inkscape:zoom="2.8934905" - inkscape:cx="160.70556" - inkscape:cy="10.886505" + inkscape:cx="87.092043" + inkscape:cy="132.88449" inkscape:window-width="1920" inkscape:window-height="1001" inkscape:window-x="-9" @@ -115,17 +115,31 @@ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:0.264583" x="-8.4125614" y="18.471058" /> - - + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-conflict.svg new file mode 100644 index 00000000..59466849 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/cppfile-vcs-conflict.svg @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-conflict.svg new file mode 100644 index 00000000..64acd7b1 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/file-vcs-conflict.svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-conflict.svg new file mode 100644 index 00000000..85c4f34f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/folder-vcs-conflict.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-conflict.svg new file mode 100644 index 00000000..c3b19b4e --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/hfile-vcs-conflict.svg @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-conflict.svg b/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-conflict.svg new file mode 100644 index 00000000..cf32579f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/filesystem/projectfile-vcs-conflict.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/vcs/gitbranchdialog.cpp b/RedPandaIDE/vcs/gitbranchdialog.cpp index 6bf4cb38..d08a4aeb 100644 --- a/RedPandaIDE/vcs/gitbranchdialog.cpp +++ b/RedPandaIDE/vcs/gitbranchdialog.cpp @@ -41,18 +41,17 @@ void GitBranchDialog::on_btnCancel_clicked() void GitBranchDialog::on_btnOk_clicked() { - QString branch = ui->lstBranches->currentText(); - QString text; + QString branch; if (ui->chkCreate->isChecked()) - text = ui->txtNewBranch->text(); + branch = ui->txtNewBranch->text(); else - text = ui->lstBranches->currentText(); + branch = ui->lstBranches->currentText(); bool result = false; QString output; - if (!text.isEmpty()) { + if (!branch.isEmpty()) { result = mManager->switchToBranch( mFolder, - ui->txtNewBranch->text(), + branch, ui->chkCreate->isChecked(), ui->chkForce->isChecked(), ui->chkMerge->isChecked(), diff --git a/RedPandaIDE/vcs/gitmanager.cpp b/RedPandaIDE/vcs/gitmanager.cpp index 39955295..0738a5ed 100644 --- a/RedPandaIDE/vcs/gitmanager.cpp +++ b/RedPandaIDE/vcs/gitmanager.cpp @@ -150,6 +150,15 @@ QStringList GitManager::listChangedFiles(const QString &folder) return textToLines(runGit(folder,args)); } +QStringList GitManager::listConflicts(const QString &folder) +{ + QStringList args; + args.append("diff"); + args.append("--name-only"); + args.append("--diff-filter=U"); + return textToLines(runGit(folder,args)); +} + QStringList GitManager::listBranches(const QString &folder, int ¤t) { QStringList args; @@ -165,6 +174,8 @@ QStringList GitManager::listBranches(const QString &folder, int ¤t) temp[i] = s.mid(1).trimmed(); } else if (s.startsWith('+')) { temp[i] = s.mid(1).trimmed(); + } else { + temp[i] = s.trimmed(); } } return temp; diff --git a/RedPandaIDE/vcs/gitmanager.h b/RedPandaIDE/vcs/gitmanager.h index 59c93edf..915a87c3 100644 --- a/RedPandaIDE/vcs/gitmanager.h +++ b/RedPandaIDE/vcs/gitmanager.h @@ -36,6 +36,8 @@ public: QStringList listFiles(const QString& folder); QStringList listStagedFiles(const QString& folder); QStringList listChangedFiles(const QString& folder); + QStringList listConflicts(const QString& folder); + QStringList listBranches(const QString& folder, int& current); bool switchToBranch(const QString& folder, const QString& branch, bool create, bool force, bool merge, bool track, bool noTrack, bool forceCreation, diff --git a/RedPandaIDE/vcs/gitmergedialog.cpp b/RedPandaIDE/vcs/gitmergedialog.cpp index 4bf499dc..c92970e6 100644 --- a/RedPandaIDE/vcs/gitmergedialog.cpp +++ b/RedPandaIDE/vcs/gitmergedialog.cpp @@ -56,6 +56,9 @@ void GitMergeDialog::on_btnOk_clicked() output, ui->txtMergeMessage->toPlainText() )) { + InfoMessageBox box; + box.setMessage(output); + box.exec(); accept(); } else { InfoMessageBox box; diff --git a/RedPandaIDE/vcs/gitrepository.cpp b/RedPandaIDE/vcs/gitrepository.cpp index f7e1f574..ecb902eb 100644 --- a/RedPandaIDE/vcs/gitrepository.cpp +++ b/RedPandaIDE/vcs/gitrepository.cpp @@ -92,11 +92,13 @@ void GitRepository::update() mFilesInRepositories.clear(); mChangedFiles.clear(); mStagedFiles.clear(); + mConflicts.clear(); } else { mInRepository = mManager->hasRepository(mRealFolder,mBranch); convertFilesListToSet(mManager->listFiles(mRealFolder),mFilesInRepositories); convertFilesListToSet(mManager->listChangedFiles(mRealFolder),mChangedFiles); convertFilesListToSet(mManager->listStagedFiles(mRealFolder),mStagedFiles); + convertFilesListToSet(mManager->listConflicts(mRealFolder),mConflicts); // qDebug()<<"update"< mFilesInRepositories; QSet mChangedFiles; QSet mStagedFiles; + QSet mConflicts; private: void convertFilesListToSet(const QStringList& filesList,QSet& set); };