diff --git a/NEWS.md b/NEWS.md index 2eef58ee..a222df3f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,8 @@ Red Panda C++ Version 0.14.3 - enhancement: git - commit - enhancement: git - restore - fix: compiler set index not correctly saved, when remove compiler sets in options dialog + - enhancement: when add files to project, auto add it to git (if the project has a git repository) + Red Panda C++ Version 0.14.2 - enhancement: file system view mode for project diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 7a4ba211..62378be9 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -61,24 +61,28 @@ p, li { white-space: pre-wrap; } <html><head/><body><h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">小熊猫C++</span></h1></body></html> - + Based on Qt %1 (%2) 基于Qt %1 (%2) - + Build time: %1 %2 构建时间:%1 %2 - + Copyright(C) 2021-2022 瞿华(royqh1979@gmail.com) Copyright(C) 2021-2022 瞿华(royqh1979@gmail.com) - + + <html><head/><body><p>Homepage: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/">https://sourceforge.net/projects/dev-cpp-2020/</a></p></body></html> + <html><head/><body><p>官方网站: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/">https://sourceforge.net/projects/dev-cpp-2020/</a></p></body></html> + + <html><head/><body><p>Homepage: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/"><span style=" text-decoration: underline; color:#0000ff;">https://sourceforge.net/projects/dev-cpp-2020/</span></a></p></body></html> - <html><head/><body><p>主页: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/"><span style=" text-decoration: underline; color:#0000ff;">https://sourceforge.net/projects/dev-cpp-2020/</span></a></p></body></html> + <html><head/><body><p>主页: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/"><span style=" text-decoration: underline; color:#0000ff;">https://sourceforge.net/projects/dev-cpp-2020/</span></a></p></body></html> Red Panda Dev-C++ (<=6.7.5): @@ -86,12 +90,12 @@ p, li { white-space: pre-wrap; } 小熊猫Dev-C++ (<=6.7.5): - + GNU General Public License GNU通用公共许可 - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -116,15 +120,20 @@ p, li { white-space: pre-wrap; } 本程序附带一份GNU通用公共许可协议的副本。您也可以从GNU网站<http://www.gnu.org/licenses/>获取。 - + Version: 版本: - + Non-GCC Compiler 非GCC编译器 + + + Website: <a href="%1">%1</a> + 网址:<a href="%1">%1</a> + AppTheme @@ -3279,7 +3288,7 @@ Are you really want to continue? - + @@ -3293,48 +3302,48 @@ Are you really want to continue? 编译日志 - + File 文件 - + Tools 工具 - - + + Run 运行 - + Edit 编辑 - - + + Project 项目 - + Watch 监视 - + Structure 结构 - + Files 文件 @@ -3343,85 +3352,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 窗口 @@ -3439,67 +3448,67 @@ 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 工具输出 @@ -3514,47 +3523,47 @@ Are you really want to continue? Git - + F9 F9 - + F10 F10 - + Undo 恢复 - + Ctrl+Z Ctrl+Z - + Redo 重做 - + Ctrl+Y Ctrl+Y - + Cut 剪切 - + Ctrl+X Ctrl+X - + @@ -3562,144 +3571,144 @@ Are you really want to continue? 复制 - + 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 试题集 @@ -3707,7 +3716,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -3726,106 +3735,106 @@ Are you really want to continue? - + 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 帮助 @@ -3844,472 +3853,477 @@ 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 Git Repository Create Repository 创建Git仓库 - + Commit 提交(Commit) - + Revert 撤销(Revert) - + Reset 回滚(Reset) - + Add Files 添加文件 - + Restore 还原(Restore) + + + Website + 官方网站 + 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 新建头文件... @@ -4319,47 +4333,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 删除到行首 @@ -4368,38 +4382,38 @@ 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... 运行参数... @@ -4635,7 +4649,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -4709,15 +4723,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -4915,7 +4929,7 @@ Are you really want to continue? - + Do you want to save it? 需要保存吗? @@ -4939,7 +4953,7 @@ Are you really want to continue? - + Save Error 保存失败 @@ -5009,39 +5023,39 @@ Are you really want to continue? 你真的要删除它吗? - - + + Header Exists 头文件已存在 - - + + Header file "%1" already exists! 头文件"%1"已存在! - + Source Exists 源文件已存在! - + Source file "%1" already exists! 源文件"%1"已存在! - + Commit Message 提交信息 - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -5146,29 +5160,29 @@ Are you really want to continue? HTML文件 (*.html) - + The current problem set is not empty. 当前的试题集不是空的。 - + Problem %1 试题%1 - - + + Problem Set Files (*.pbs) 试题集文件 (*.pbs) - + Load Error 载入失败 - + Problem Case %1 试题案例%1 @@ -6445,7 +6459,7 @@ Are you really want to continue? 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? @@ -6545,7 +6559,7 @@ Are you really want to continue? - + Confirm 确认 @@ -6565,13 +6579,13 @@ Are you really want to continue? 如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果, - - + + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2 @@ -7405,7 +7419,7 @@ Are you really want to continue? 自动链接 - + @@ -7481,15 +7495,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 9bb93b71..93942c2b 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -748,12 +748,20 @@ void MainWindow::updateDPI() void MainWindow::onFileSaved(const QString &path, bool inProject) { if (pSettings->vcs().gitOk()) { - if (inProject && mProject) { + QString branch; + if (inProject && mProject && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) { mProject->model()->beginUpdate(); mProject->model()->endUpdate(); } QModelIndex index = mFileSystemModel.index(path); if (index.isValid()) { + if (!inProject) { + if ( (isCFile(path) || isHFile(path)) + && !mFileSystemModelIconProvider.VCSRepository()->isFileInRepository(path)) { + + mFileSystemModelIconProvider.VCSRepository()->add(extractRelativePath(mFileSystemModelIconProvider.VCSRepository()->folder(),path)); + } + } mFileSystemModelIconProvider.update(); mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); ui->treeFiles->update(index); @@ -5375,6 +5383,12 @@ void MainWindow::on_actionAdd_to_project_triggered() foreach (const QString& filename, dialog.selectedFiles()) { mProject->addUnit(filename,folderNode,false); mProject->cppParser()->addFileToScan(filename); + QString branch; + if (pSettings->vcs().gitOk() && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) { + mProject->model()->iconProvider()->VCSRepository()->add( + extractRelativePath(mProject->folder(),filename) + ); + } } mProject->rebuildNodes(); mProject->saveUnits(); @@ -5616,14 +5630,21 @@ void MainWindow::newProjectUnitFile() } PProjectUnit newUnit = mProject->newUnit( mProject->pointerToNode(node),newFileName); - idx = mProject->units().count()-1; mProject->rebuildNodes(); - mProject->saveUnits(); - updateProjectView(); + mProject->saveAll(); + updateProjectView(); + idx = mProject->units().count()-1; Editor * editor = mProject->openUnit(idx); //editor->setUseCppSyntax(mProject->options().useGPP); //editor->setModified(true); editor->activate(); + QString branch; + if (pSettings->vcs().gitOk() && mProject->model()->iconProvider()->VCSRepository()->hasRepository(branch)) { + mProject->model()->iconProvider()->VCSRepository()->add(newFileName); + mProject->model()->beginUpdate(); + mProject->model()->endUpdate(); + } + updateProjectView(); } void MainWindow::doFilesViewRemoveFile(const QModelIndex &index) @@ -5802,6 +5823,7 @@ void MainWindow::showSearchReplacePanel(bool show) void MainWindow::setFilesViewRoot(const QString &path) { mFileSystemModelIconProvider.setRootFolder(path); + mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); mFileSystemModel.setRootPath(path); ui->treeFiles->setRootIndex(mFileSystemModel.index(path)); pSettings->environment().setCurrentFolder(path); @@ -6004,7 +6026,8 @@ void MainWindow::on_actionC_C_Reference_triggered() if (fileInfo.exists()) { QDesktopServices::openUrl(QUrl::fromLocalFile(fileInfo.absoluteFilePath())); } else { - QDesktopServices::openUrl(QUrl("https://zh.cppreference.com/w/cpp")); + + QDesktopServices::openUrl(QUrl("https://qingcms.gitee.io/cppreference/20210212/zh/cpp.html")); } } else { QDesktopServices::openUrl(QUrl("https://en.cppreference.com/w/cpp")); @@ -6244,7 +6267,7 @@ void MainWindow::on_btnRunAllProblemCases_clicked() void MainWindow::on_actionC_Reference_triggered() { if (pSettings->environment().language()=="zh_CN") { - QDesktopServices::openUrl(QUrl("https://zh.cppreference.com/w/c")); + QDesktopServices::openUrl(QUrl("https://qingcms.gitee.io/cppreference/20210212/zh/c.html")); } else { QDesktopServices::openUrl(QUrl("https://en.cppreference.com/w/c")); } @@ -6601,7 +6624,7 @@ void MainWindow::on_actionGit_Create_Repository_triggered() if (pos>=0) { ui->cbFilesPath->setItemIcon(pos, pIconsManager->getIcon(IconsManager::FILESYSTEM_GIT)); } - mFileSystemModelIconProvider.update(); + mFileSystemModelIconProvider.setRootFolder(pSettings->environment().currentFolder()); mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); //update project view if (mProject && mProject->folder() == mFileSystemModel.rootPath()) { @@ -6614,6 +6637,7 @@ void MainWindow::on_actionGit_Create_Repository_triggered() GitManager vcsManager; vcsManager.createRepository(mProject->folder()); vcsManager.add(mProject->folder(), extractFileName(mProject->filename())); + vcsManager.add(mProject->folder(), extractFileName(mProject->options().icon)); foreach (PProjectUnit pUnit, mProject->units()) { vcsManager.add(mProject->folder(),extractRelativePath(mProject->folder(),pUnit->fileName())); } @@ -6729,3 +6753,13 @@ void MainWindow::on_actionGit_Restore_triggered() mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); } + +void MainWindow::on_actionWebsite_triggered() +{ + if (pSettings->environment().language()=="zh_CN") { + QDesktopServices::openUrl(QUrl("https://royqh1979.gitee.io/redpandacpp/")); + } else { + QDesktopServices::openUrl(QUrl("https://sourceforge.net/projects/redpanda-cpp/")); + } +} + diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 12b53b82..d114c32e 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -586,6 +586,8 @@ private slots: void on_actionGit_Restore_triggered(); + void on_actionWebsite_triggered(); + private: Ui::MainWindow *ui; EditorList *mEditorList; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index dd4263cc..7cd73802 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -576,7 +576,6 @@ - 50 false @@ -1422,7 +1421,7 @@ 0 0 1114 - 26 + 25 @@ -1559,6 +1558,7 @@ Help + @@ -2783,6 +2783,11 @@ Restore + + + Website + + diff --git a/RedPandaIDE/vcs/gitmanager.cpp b/RedPandaIDE/vcs/gitmanager.cpp index f109232f..42c9af19 100644 --- a/RedPandaIDE/vcs/gitmanager.cpp +++ b/RedPandaIDE/vcs/gitmanager.cpp @@ -218,11 +218,14 @@ QString GitManager::runGit(const QString& workingFolder, const QStringList &args .arg(workingFolder, pSettings->vcs().gitPath(), args.join("\" \""))); +// qDebug()<<"---------"; +// qDebug()< AboutDialog::AboutDialog(QWidget *parent) : @@ -41,6 +42,12 @@ AboutDialog::AboutDialog(QWidget *parent) : #endif ui->lblCompileTime->setText(ui->lblCompileTime->text() .arg(__DATE__, __TIME__)); + + QString website="https://sourceforge.net/projects/redpanda-cpp/"; + if (pSettings->environment().language()=="zh_CN") { + website = "https://royqh1979.gitee.io/redpandacpp/"; + } + ui->lblHomepage->setText(tr("Website: %1").arg(website)); } AboutDialog::~AboutDialog() diff --git a/RedPandaIDE/widgets/aboutdialog.ui b/RedPandaIDE/widgets/aboutdialog.ui index 4ad7c1d8..715595b0 100644 --- a/RedPandaIDE/widgets/aboutdialog.ui +++ b/RedPandaIDE/widgets/aboutdialog.ui @@ -28,7 +28,6 @@ - 50 false @@ -41,7 +40,6 @@ - 50 false @@ -54,7 +52,6 @@ - 50 false @@ -64,15 +61,17 @@ - + - 50 false - <html><head/><body><p>Homepage: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/"><span style=" text-decoration: underline; color:#0000ff;">https://sourceforge.net/projects/dev-cpp-2020/</span></a></p></body></html> + <html><head/><body><p>Homepage: <a href="Homepage: https://sourceforge.net/projects/dev-cpp-2020/">https://sourceforge.net/projects/dev-cpp-2020/</a></p></body></html> + + + true