From cc0b209e2f9dd83625b0700653e4da34668c35d2 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 28 Feb 2022 22:40:09 +0800 Subject: [PATCH] - enhancement: option "open files in the same red panda C++ instance", in options->environment->file associations - enhancement: hide unsupported files in files view --- NEWS.md | 2 + RedPandaIDE/RedPandaIDE.pro | 2 +- RedPandaIDE/RedPandaIDE_zh_CN.ts | 536 +++++++++--------- RedPandaIDE/iconsmanager.cpp | 1 + RedPandaIDE/iconsmanager.h | 1 + RedPandaIDE/main.cpp | 135 ++++- RedPandaIDE/mainwindow.cpp | 28 +- RedPandaIDE/mainwindow.h | 2 + RedPandaIDE/mainwindow.ui | 14 +- .../bluesky/actions/00Misc-13Filter.svg | 73 +++ .../contrast/actions/00Misc-13Filter.svg | 73 +++ .../newlook/actions/00Misc-13Filter.svg | 73 +++ RedPandaIDE/settings.cpp | 25 + RedPandaIDE/settings.h | 8 + .../environmentfileassociationwidget.cpp | 6 + .../environmentfileassociationwidget.ui | 25 +- RedPandaIDE/systemconsts.cpp | 21 + RedPandaIDE/systemconsts.h | 3 + Red_Panda_CPP.pro | 2 +- 19 files changed, 766 insertions(+), 264 deletions(-) create mode 100644 RedPandaIDE/resources/iconsets/bluesky/actions/00Misc-13Filter.svg create mode 100644 RedPandaIDE/resources/iconsets/contrast/actions/00Misc-13Filter.svg create mode 100644 RedPandaIDE/resources/iconsets/newlook/actions/00Misc-13Filter.svg diff --git a/NEWS.md b/NEWS.md index 927f5596..17c7a632 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ Red Panda C++ Version 0.14.5 - fix: the "gnu c++ 20" option in compiler set options is wrong + - enhancement: option "open files in the same red panda C++ instance", in options->environment->file associations + - enhancement: hide unsupported files in files view Red Panda C++ Version 0.14.4 diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 54bde0ca..14b64c97 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -10,7 +10,7 @@ isEmpty(APP_NAME) { } isEmpty(APP_VERSION) { - APP_VERSION=0.14.4 + APP_VERSION=0.14.5 } isEmpty(PREFIX) { diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 3c675f8b..e512d01d 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -2089,11 +2089,26 @@ Are you really want to continue? + Open Each File In + 在...中打开每一个文件: + + + + Independant Red Panda C++ applications + 独立的小熊猫C++程序进程 + + + + The same Red Panda C++ application + 同一个小熊猫C++程序进程 + + + File Types: 文件类型: - + Just check or uncheck for which file types Red Panda C++ wil be registered as the default application to open them ... Just check or uncheck for which file types RedPand C++ wil be registered as the default application to open them ... 选择想要使用小熊猫C++打开的文件类型(可能需要管理员权限) @@ -2383,18 +2398,18 @@ Are you really want to continue? FileAssociationModel - + Register File Association Error 注册文件类型关联失败 - - + + Don't have privilege to register file types! 没有权限进行文件类型注册! - + Register File Type Error 注册文件类型失败 @@ -3740,18 +3755,18 @@ Are you really want to continue? MainWindow - + Red Panda C++ 小熊猫C++ - - - - - + + + + + Issues 编译器 @@ -3825,7 +3840,7 @@ Are you really want to continue? - + Debug Console 调试主控台 @@ -3959,8 +3974,8 @@ Are you really want to continue? - - + + Compile 编译 @@ -4022,9 +4037,9 @@ Are you really want to continue? - - - + + + Copy 复制 @@ -4035,7 +4050,7 @@ Are you really want to continue? - + Paste 粘贴 @@ -4046,8 +4061,8 @@ Are you really want to continue? - - + + Select All 选择全部 @@ -4167,14 +4182,14 @@ Are you really want to continue? - + Problem Set 试题集 - + New Problem Set 新建试题集 @@ -4193,14 +4208,14 @@ Are you really want to continue? - + Save Problem Set 保存试题集 - + Load Problem Set 载入试题集 @@ -4236,7 +4251,7 @@ Are you really want to continue? - + Problem 试题 @@ -4539,7 +4554,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -4640,7 +4655,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -4661,13 +4676,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -4770,6 +4785,11 @@ Are you really want to continue? Push 推送(Push) + + + Hide Non Support Files + 隐藏不支持的文件 + Tool Window Bars 工具窗口栏 @@ -4911,7 +4931,7 @@ Are you really want to continue? 运行参数... - + File Encoding 文件编码 @@ -4921,32 +4941,32 @@ Are you really want to continue? 文件历史 - - - - - - + + + + + + Debugging 正在调试 - - - - - - + + + + + + Running 正在运行 - - - - - - + + + + + + Compiling 正在编译 @@ -4955,178 +4975,178 @@ 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 清除 @@ -5142,7 +5162,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -5163,68 +5183,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: 描述: @@ -5233,354 +5253,354 @@ 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? 你真的要删除它吗? - + Can't Commit 无法提交 - + Git needs user info to commit. Git需要用信息进行提交。 - + Choose Working Folder 选择工作文件夹 - - + + 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 Message: 提交信息: - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -5589,125 +5609,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 @@ -5718,15 +5738,15 @@ Are you really want to continue? - - - - - - - - - + + + + + + + + + Error 错误 @@ -5736,92 +5756,92 @@ Are you really want to continue? 项目历史 - + Load Theme Error 载入主题失败 - - + + Clear History 清除历史 - - + + 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个文件) @@ -6792,7 +6812,7 @@ Are you really want to continue? QApplication - + Error 错误 @@ -6846,23 +6866,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 无法载入自动链接设置 @@ -7956,7 +7976,7 @@ Are you really want to continue? 自动链接 - + @@ -8032,15 +8052,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 diff --git a/RedPandaIDE/iconsmanager.cpp b/RedPandaIDE/iconsmanager.cpp index 3a1911c7..a802d7c4 100644 --- a/RedPandaIDE/iconsmanager.cpp +++ b/RedPandaIDE/iconsmanager.cpp @@ -95,6 +95,7 @@ void IconsManager::updateActionIcons(const QString& iconSet, int size) mIconPixmaps.insert(ACTION_MISC_VALIDATE, createSVGIcon(iconFolder+"00Misc-10Check.svg",size,size)); mIconPixmaps.insert(ACTION_MISC_RENAME, createSVGIcon(iconFolder+"00Misc-11Rename.svg",size,size)); mIconPixmaps.insert(ACTION_MISC_HELP, createSVGIcon(iconFolder+"00Misc-12Help.svg",size,size)); + mIconPixmaps.insert(ACTION_MISC_FILTER, createSVGIcon(iconFolder+"00Misc-13Filter.svg",size,size)); mIconPixmaps.insert(ACTION_FILE_NEW, createSVGIcon(iconFolder+"01File-01New.svg",size,size)); mIconPixmaps.insert(ACTION_FILE_OPEN, createSVGIcon(iconFolder+"01File-02Open.svg",size,size)); diff --git a/RedPandaIDE/iconsmanager.h b/RedPandaIDE/iconsmanager.h index 797983da..fad575b3 100644 --- a/RedPandaIDE/iconsmanager.h +++ b/RedPandaIDE/iconsmanager.h @@ -112,6 +112,7 @@ public: ACTION_MISC_VALIDATE, ACTION_MISC_RENAME, ACTION_MISC_HELP, + ACTION_MISC_FILTER, ACTION_FILE_NEW, ACTION_FILE_OPEN, diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 39a01037..8def0b91 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -38,9 +38,14 @@ #include "widgets/choosethemedialog.h" #include "thememanager.h" #ifdef Q_OS_WIN +#include #include +#include +#include +#include #endif +QString getSettingFilename(const QString& filepath, bool& firstRun); #ifdef Q_OS_WIN class WindowLogoutEventFilter : public QAbstractNativeEventFilter { @@ -48,6 +53,61 @@ class WindowLogoutEventFilter : public QAbstractNativeEventFilter { public: bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; }; +#define WM_USER_OPEN_FILE (WM_USER+1) +HWND prevAppInstance = NULL; +BOOL CALLBACK GetPreviousInstanceCallback(HWND hwnd, LPARAM param){ + BOOL result = TRUE; + WCHAR buffer[4098]; + HINSTANCE hWindowModule = (HINSTANCE)GetWindowLongPtr(hwnd,GWLP_HINSTANCE); + + if (hWindowModule==0) + return result; + + DWORD processID; + + // Get the ID of the process that created this window + GetWindowThreadProcessId(hwnd,&processID); + if (processID==0) + return result; + + // Get the process associated with the ID + HANDLE hWindowProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID); + if (hWindowProcess == 0) + return result; + + // Get its module filename + if (GetModuleFileNameExW(hWindowProcess, hWindowModule, buffer, sizeof(buffer)) == 0) + return TRUE; + + CloseHandle(hWindowProcess); // not needed anymore + WCHAR * compareFilename=(WCHAR*)param; + QString s1=QString::fromWCharArray(compareFilename); + QString s2=QString::fromWCharArray(buffer); + + //Is from the "same" application? + if (QString::compare(s1,s2,PATH_SENSITIVITY)==0) { + //found, stop EnumWindows loop + prevAppInstance = hwnd; + return FALSE; + } + + return TRUE; +} + +HWND getPreviousInstance() { + WCHAR buffer[4098]; + //ShowMessage('ERROR_ALREADY_EXISTS'); + // Store our own module filename + if (GetModuleFileNameW(GetModuleHandle(NULL), buffer, sizeof(buffer)) == 0) + return NULL; + + // If that's the case, walk all top level windows and find the previous instance + // At this point, the program that created the mutex might not have created its MainForm yet + if (EnumWindows(GetPreviousInstanceCallback, LPARAM(buffer))==0) { + return prevAppInstance; + } else + return NULL; +} bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/, void *message, long *result){ MSG * pMsg = static_cast(message); @@ -72,6 +132,46 @@ bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/ pMainWindow->updateDPI(oldDPI,newDPI); break; } + case WM_USER_OPEN_FILE: { + QSharedMemory sharedMemory("RedPandaCpp/openfiles"); + if (sharedMemory.attach()) { + QBuffer buffer; + QDataStream in(&buffer); + QStringList files; + sharedMemory.lock(); + buffer.setData((char*)sharedMemory.constData(), sharedMemory.size()); + buffer.open(QBuffer::ReadOnly); + in >> files; + sharedMemory.unlock(); + pMainWindow->openFiles(files); + sharedMemory.detach(); + } + return true; + } + } + return false; +} + +bool sendFilesToInstance() { + HWND prevInstance = getPreviousInstance(); + if (prevInstance != NULL) { + QSharedMemory sharedMemory("RedPandaCpp/openfiles"); + QBuffer buffer; + buffer.open(QBuffer::ReadWrite); + QDataStream out(&buffer); + QStringList filesToOpen = qApp->arguments(); + filesToOpen.pop_front(); + out<=2) { +#ifdef Q_OS_WIN + if (sendFilesToInstance()) { + tempFile.remove(); + return 0; + } +#endif + } + } + } //Translation must be loaded first QTranslator trans,transQt; @@ -138,8 +267,10 @@ int main(int argc, char *argv[]) if (!isGreenEdition()) { QDir::setCurrent(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0]); } - if (settingFilename.isEmpty()) + if (settingFilename.isEmpty()) { + tempFile.remove(); return -1; + } { QSettings languageSetting(settingFilename,QSettings::IniFormat); @@ -230,6 +361,7 @@ int main(int argc, char *argv[]) WindowLogoutEventFilter filter; app.installNativeEventFilter(&filter); #endif + tempFile.remove(); int retCode = app.exec(); QString configDir = pSettings->dirs().config(); // save settings @@ -242,6 +374,7 @@ int main(int argc, char *argv[]) } return retCode; } catch (BaseError e) { + tempFile.remove(); QMessageBox::critical(nullptr,QApplication::tr("Error"),e.reason()); return -1; } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 4b09bad5..63e260e6 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -296,6 +296,9 @@ MainWindow::MainWindow(QWidget *parent) ui->treeFiles->setModel(&mFileSystemModel); mFileSystemModel.setReadOnly(false); mFileSystemModel.setIconProvider(&mFileSystemModelIconProvider); + + mFileSystemModel.setNameFilters(pSystemConsts->defaultFileNameFilters()); + mFileSystemModel.setNameFilterDisables(false); setFilesViewRoot(pSettings->environment().currentFolder()); for (int i=1;itreeFiles->hideColumn(i); @@ -1366,6 +1369,7 @@ void MainWindow::updateActionIcons() mFilesView_Open->setIcon(pIconsManager->getIcon(IconsManager::ACTION_FILE_OPEN)); mFilesView_OpenInTerminal->setIcon(pIconsManager->getIcon(IconsManager::ACTION_MISC_TERM)); mFilesView_OpenInExplorer->setIcon(pIconsManager->getIcon(IconsManager::ACTION_MISC_FOLDER)); + ui->actionFilesView_Hide_Non_Support_Files->setIcon(pIconsManager->getIcon(IconsManager::ACTION_MISC_FILTER)); //problem view pIconsManager->setIcon(ui->btnNewProblemSet, IconsManager::ACTION_PROBLEM_SET); @@ -2796,7 +2800,7 @@ void MainWindow::buildContextMenus() //toolbar for files view { - QHBoxLayout* hlayout = dynamic_cast( ui->panelFiles->layout()); + QHBoxLayout* hlayout = dynamic_cast(ui->panelFiles->layout()); QToolButton * toolButton; int size = pointToPixel(pSettings->environment().interfaceFontSize()); QSize iconSize(size,size); @@ -2808,6 +2812,15 @@ void MainWindow::buildContextMenus() toolButton->setIconSize(iconSize); toolButton->setDefaultAction(ui->actionLocate_in_Files_View); hlayout->addWidget(toolButton); + QFrame * vLine = new QFrame(); + vLine->setFrameShape(QFrame::VLine); + vLine->setFrameShadow(QFrame::Sunken); + hlayout->addWidget(vLine); + toolButton = new QToolButton; + toolButton->setIconSize(iconSize); + toolButton->setDefaultAction(ui->actionFilesView_Hide_Non_Support_Files); + ui->actionFilesView_Hide_Non_Support_Files->setChecked(pSettings->environment().hideNonSupportFilesInFileView()); + hlayout->addWidget(toolButton); } //context menu signal for class browser @@ -3207,6 +3220,8 @@ void MainWindow::onFilesViewContextMenu(const QPoint &pos) menu.addSeparator(); menu.addAction(mFilesView_OpenInTerminal); menu.addAction(mFilesView_OpenInExplorer); + menu.addSeparator(); + menu.addAction(ui->actionFilesView_Hide_Non_Support_Files); QString path = mFileSystemModel.filePath(ui->treeFiles->currentIndex()); QFileInfo info(path); mFilesView_Open->setEnabled(info.isFile()); @@ -7062,3 +7077,14 @@ void MainWindow::on_actionGit_Push_triggered() } } + +void MainWindow::on_actionFilesView_Hide_Non_Support_Files_toggled(bool /* arg1 */) +{ + mFileSystemModel.setNameFilterDisables(!ui->actionFilesView_Hide_Non_Support_Files->isChecked()); + if (pSettings->environment().hideNonSupportFilesInFileView() + != ui->actionFilesView_Hide_Non_Support_Files->isChecked()) { + pSettings->environment().setHideNonSupportFilesInFileView(ui->actionFilesView_Hide_Non_Support_Files->isChecked()); + pSettings->environment().save(); + } +} + diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index fb20b1f7..deb30024 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -604,6 +604,8 @@ private slots: void on_actionGit_Push_triggered(); + void on_actionFilesView_Hide_Non_Support_Files_toggled(bool arg1); + private: Ui::MainWindow *ui; EditorList *mEditorList; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 5ad7ef02..f0c99c98 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -1422,7 +1422,7 @@ 0 0 1114 - 25 + 26 @@ -2839,6 +2839,18 @@ Push + + + true + + + + :/icons/images/newlook24/037-filter.png:/icons/images/newlook24/037-filter.png + + + Hide Non Support Files + + diff --git a/RedPandaIDE/resources/iconsets/bluesky/actions/00Misc-13Filter.svg b/RedPandaIDE/resources/iconsets/bluesky/actions/00Misc-13Filter.svg new file mode 100644 index 00000000..d4d1286f --- /dev/null +++ b/RedPandaIDE/resources/iconsets/bluesky/actions/00Misc-13Filter.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/contrast/actions/00Misc-13Filter.svg b/RedPandaIDE/resources/iconsets/contrast/actions/00Misc-13Filter.svg new file mode 100644 index 00000000..0e336b6a --- /dev/null +++ b/RedPandaIDE/resources/iconsets/contrast/actions/00Misc-13Filter.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/resources/iconsets/newlook/actions/00Misc-13Filter.svg b/RedPandaIDE/resources/iconsets/newlook/actions/00Misc-13Filter.svg new file mode 100644 index 00000000..06ffb958 --- /dev/null +++ b/RedPandaIDE/resources/iconsets/newlook/actions/00Misc-13Filter.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index d89b376d..4c6364e3 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -2937,6 +2937,8 @@ void Settings::Environment::doLoad() mTerminalPath = stringValue("terminal_path","/usr/bin/x-terminal-emulator"); mAStylePath = includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"astyle"; #endif + mHideNonSupportFilesInFileView=boolValue("hide_non_support_files_file_view",true); + mOpenFilesInSingleInstance = boolValue("open_files_in_single_instance",false); } int Settings::Environment::interfaceFontSize() const @@ -3029,6 +3031,26 @@ void Settings::Environment::setUseCustomTheme(bool newUseCustomTheme) mUseCustomTheme = newUseCustomTheme; } +bool Settings::Environment::hideNonSupportFilesInFileView() const +{ + return mHideNonSupportFilesInFileView; +} + +void Settings::Environment::setHideNonSupportFilesInFileView(bool newHideNonSupportFilesInFileView) +{ + mHideNonSupportFilesInFileView = newHideNonSupportFilesInFileView; +} + +bool Settings::Environment::openFilesInSingleInstance() const +{ + return mOpenFilesInSingleInstance; +} + +void Settings::Environment::setOpenFilesInSingleInstance(bool newOpenFilesInSingleInstance) +{ + mOpenFilesInSingleInstance = newOpenFilesInSingleInstance; +} + void Settings::Environment::doSave() { //Appearence @@ -3046,6 +3068,9 @@ void Settings::Environment::doSave() saveValue("terminal_path",mTerminalPath); saveValue("asyle_path",mAStylePath); #endif + + saveValue("hide_non_support_files_file_view",mHideNonSupportFilesInFileView); + saveValue("open_files_in_single_instance",mOpenFilesInSingleInstance); } QString Settings::Environment::interfaceFont() const diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 5ad71a1a..11a4ad1a 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -528,6 +528,12 @@ public: bool useCustomTheme() const; void setUseCustomTheme(bool newUseCustomTheme); + bool hideNonSupportFilesInFileView() const; + void setHideNonSupportFilesInFileView(bool newHideNonSupportFilesInFileView); + + bool openFilesInSingleInstance() const; + void setOpenFilesInSingleInstance(bool newOpenFilesInSingleInstance); + private: //Appearence @@ -543,6 +549,8 @@ public: QString mDefaultOpenFolder; QString mTerminalPath; QString mAStylePath; + bool mHideNonSupportFilesInFileView; + bool mOpenFilesInSingleInstance; // _Base interface protected: void doSave() override; diff --git a/RedPandaIDE/settingsdialog/environmentfileassociationwidget.cpp b/RedPandaIDE/settingsdialog/environmentfileassociationwidget.cpp index 7d9deb14..a7f84182 100644 --- a/RedPandaIDE/settingsdialog/environmentfileassociationwidget.cpp +++ b/RedPandaIDE/settingsdialog/environmentfileassociationwidget.cpp @@ -49,6 +49,10 @@ EnvironmentFileAssociationWidget::~EnvironmentFileAssociationWidget() void EnvironmentFileAssociationWidget::doLoad() { + if (pSettings->environment().openFilesInSingleInstance()) + ui->rbOpenInSingleApplication->setChecked(true); + else + ui->rbOpenInMultiApplication->setChecked(true); mModel.updateAssociationStates(); } @@ -56,6 +60,8 @@ void EnvironmentFileAssociationWidget::doSave() { mModel.saveAssociations(); mModel.updateAssociationStates(); + pSettings->environment().setOpenFilesInSingleInstance(ui->rbOpenInSingleApplication->isChecked()); + pSettings->environment().save(); } FileAssociationModel::FileAssociationModel(QObject *parent) : QAbstractListModel(parent) diff --git a/RedPandaIDE/settingsdialog/environmentfileassociationwidget.ui b/RedPandaIDE/settingsdialog/environmentfileassociationwidget.ui index 6ec76ee1..a46ab780 100644 --- a/RedPandaIDE/settingsdialog/environmentfileassociationwidget.ui +++ b/RedPandaIDE/settingsdialog/environmentfileassociationwidget.ui @@ -7,13 +7,36 @@ 0 0 708 - 350 + 459 Form + + + + Open Each File In + + + + + + Independant Red Panda C++ applications + + + + + + + The same Red Panda C++ application + + + + + + diff --git a/RedPandaIDE/systemconsts.cpp b/RedPandaIDE/systemconsts.cpp index 769c3c08..2322aaa8 100644 --- a/RedPandaIDE/systemconsts.cpp +++ b/RedPandaIDE/systemconsts.cpp @@ -59,6 +59,22 @@ SystemConsts::SystemConsts(): mDefaultFileFilters() } std::sort(codecNames.begin(),codecNames.end()); mCodecNames.append(codecNames); + + mDefaultFileNameFilters.append("*.c"); + mDefaultFileNameFilters.append("*.cpp"); + mDefaultFileNameFilters.append("*.cc"); + mDefaultFileNameFilters.append("*.C"); + mDefaultFileNameFilters.append("*.cxx"); + mDefaultFileNameFilters.append("*.cxx"); + mDefaultFileNameFilters.append("*.h"); + mDefaultFileNameFilters.append("*.hpp"); + mDefaultFileNameFilters.append("*.hxx"); + mDefaultFileNameFilters.append(".gitignore"); + mDefaultFileNameFilters.append("*.vs"); + mDefaultFileNameFilters.append("*.fs"); + mDefaultFileNameFilters.append("*.txt"); + mDefaultFileNameFilters.append("*.md"); + mDefaultFileNameFilters.append("*.dev"); } const QStringList &SystemConsts::defaultFileFilters() const noexcept @@ -91,6 +107,11 @@ void SystemConsts::addFileFilter(QStringList& filters, const QString &name, cons filters.append(name+ " (" + fileExtensions+")"); } +const QStringList &SystemConsts::defaultFileNameFilters() const +{ + return mDefaultFileNameFilters; +} + const QStringList &SystemConsts::codecNames() const { return mCodecNames; diff --git a/RedPandaIDE/systemconsts.h b/RedPandaIDE/systemconsts.h index 498821d6..8f9e75fb 100644 --- a/RedPandaIDE/systemconsts.h +++ b/RedPandaIDE/systemconsts.h @@ -109,10 +109,13 @@ public: const QStringList &codecNames() const; + const QStringList &defaultFileNameFilters() const; + private: void addFileFilter(QStringList& filters, const QString& name, const QString& fileExtensions); QStringList mDefaultFileFilters; QStringList mIconFileFilters; + QStringList mDefaultFileNameFilters; QStringList mCodecNames; }; diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index 015775a5..ee170624 100644 --- a/Red_Panda_CPP.pro +++ b/Red_Panda_CPP.pro @@ -17,7 +17,7 @@ SUBDIRS += \ APP_NAME = RedPandaCPP -APP_VERSION = 0.14.4 +APP_VERSION = 0.14.5 linux: {