From b5523aaedae8e6a42f463b5623536cf2152c9f3f Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Fri, 15 Oct 2021 10:23:46 +0800 Subject: [PATCH] - enhancement: click the encoding info in the statusbar will show encoding menu --- NEWS.md | 1 + RedPandaIDE/RedPandaIDE.pro | 2 + RedPandaIDE/RedPandaIDE_zh_CN.qm | Bin 94780 -> 94900 bytes RedPandaIDE/RedPandaIDE_zh_CN.ts | 176 ++++++++++++------------ RedPandaIDE/mainwindow.cpp | 24 +++- RedPandaIDE/mainwindow.h | 4 +- RedPandaIDE/mainwindow.ui | 10 +- RedPandaIDE/resources/codesnippets.json | 14 ++ RedPandaIDE/widgets/labelwithmenu.cpp | 18 +++ RedPandaIDE/widgets/labelwithmenu.h | 17 +++ 10 files changed, 168 insertions(+), 98 deletions(-) create mode 100644 RedPandaIDE/widgets/labelwithmenu.cpp create mode 100644 RedPandaIDE/widgets/labelwithmenu.h diff --git a/NEWS.md b/NEWS.md index b2524987..d91c8f2a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ Version 0.6.7 - adjust: the max value of the debug console's vertical scrollbar. - fix: shfit+click not correctly set selection's end - fix: ctrl+home/end not correctly set cursor to start/end of the editor + - enhancement: click the encoding info in the statusbar will show encoding menu Version 0.6.6 - fix: crash when create new file diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 3ecceff8..8a7f39f4 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -115,6 +115,7 @@ SOURCES += \ widgets/functiontooltipwidget.cpp \ widgets/headercompletionpopup.cpp \ widgets/issuestable.cpp \ + widgets/labelwithmenu.cpp \ widgets/macroinfomodel.cpp \ widgets/newprojectdialog.cpp \ widgets/qconsole.cpp \ @@ -226,6 +227,7 @@ HEADERS += \ widgets/functiontooltipwidget.h \ widgets/headercompletionpopup.h \ widgets/issuestable.h \ + widgets/labelwithmenu.h \ widgets/macroinfomodel.h \ widgets/newprojectdialog.h \ widgets/qconsole.h \ diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm index d1bae071fc3ac111d7c1f2276e4ba20e0be454e2..c156fffc7e42d7784e27c88e2ae068740ad765cf 100644 GIT binary patch delta 6178 zcmX|_cUTl>*T&DYJF_#hRq6`JE~tQ5C>9jK1}cIA5ls|S6cvmHdr2$-Uo}<&%2)tV zqmf|21}Zi{!5$S0b_FXI>@}8z?{@dPzQ2A9JLQ>k?sK2>%%KPT?uYzRQ)&kyP9{32 z2A6}r;0mxmxDuQWt^(JBSzra24L$}7i8)RL-w<=EA>wU`xpW4Dh{g}LkhM7pM&th{ zz(GWQ^DSf{U5WhlM9bDVg`Xt~+el>EX5|ky7P78bS~yNSkO_7J4}c-yJ)#KQJ~z$E zHEqG8M0@%#t2g>jBZ@60x`20yn?!UCHyN~qX!T8^p%uhDjuYncTNL^z6`@ADM@g4C=2tZ`4l_yoik6%ZWl~4SV9Ykj* z6E9~VFgoJ1juAyASb4Fph0J_Pj#e6_v&0|8**CVz<8f3?hG9*KYJ%kqrLXs6YW2rx zVtq8!>YWKGEFhm3Snj$FYg#ZY*= z)kOWqQ~1K8#Cjd2@Ffy4yGRP(s3g{$qwvE`i77`@M6*AM*@Vc^oXOcQo+45%6Vtd* z#QtI=`!z)zyH6})tGs|SyZ5C&*~5tmkF0bUM3D+)yY)7TY&VaX!&~_T=f!r*FFDV~ zDvtW|I9b(|`p;cVRPAcz+bH^BaURiWd$~RDnd&}*;->f`%V)sWM0Jef7KubJ3n{K7 z6N=wQgESt*LLbqfq&5hZ*+Leui3ZQzL#*dP8nPG_b8`^=*bpz$P)nnW&*8;tX^a|c z^EA-d_FhB zokXQ`?TDs?Q2FQxqB2LSFlQ5U|3t^WpausFpmS$m6Vu1ixkt$F)gY?;REhx1p{h=k ziDD+vwRI?=?Z49X>rh~f!)&^tg_O=7qgy@p<3_uwdOY4xG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+Dz7atfpTCx++8N z4*cakW)S>GB>b1x7Q_sacSQ7ZaEM9OjFmC;{#TmG{8gHm)<{5pq$aj4kD!^XiOsG; z37o2#`0eMWwl_7CZk@r^hc}aXSZERpe}SLxX%bI6L)B6>iDg#kz?+)MRDt3_2e-c6 z|I{pj=rPw`nsuRQ$a9J`>*nvl^j)OcSTq8SMv-RIg;b)s+cjGZyU={GX&N$J&{=zkLmc%Ub2XoPArXq_YrdqH!z3zA(*~IE z<_3Df5>65nBl1ROVjF8Vd!6$Y3;s^NVPMy24xcTdy3Y6`xc^=OzUBp zk9ZE(_LvSW7(G|QuhyJwUcTa4~K=qd5MN2x6+dx;-^QnV$Bk1vBX(#TCV%^WFArKDc!LJwJ1fu>rQl>i?x1gCTl-QSJJMOsO+rnWL+`Ds!> BacktraceModel - + Function 函数 - + Filename 文件名 - + Line @@ -100,17 +100,17 @@ BreakpointModel - + Filename 文件名 - + Line - + Condition 条件 @@ -836,68 +836,68 @@ Are you really want to continue? Debugger - + No compiler set 无编译器设置 - + No compiler set is configured. 没有配置编译器设置。 - + Can't start debugging. 无法启动调试器 - + Debugger path error 调试路径错误 - + Debugger's path "%1" contains non-ascii characters. 调试路径"%1"中包含非ASCII字符(如,中文字符) - + This prevents it from executing. 这会导致调试器无法启动。 - + Debugger not exists 找不到调试器 - + Can''t find debugger in : "%1" 找不到调试器程序"%1" - - + + Execute to evaluate 执行以求值 - + Not found in current context 不在当前语境中 - + Compile 编译 - + Source file is more recent than executable. 源文件比程序文件新。 - + Recompile? 重新编译? @@ -2686,7 +2686,7 @@ Are you really want to continue? - + Issues 编译器 @@ -2889,8 +2889,8 @@ Are you really want to continue? - - + + Compile 编译 @@ -3334,7 +3334,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -3435,7 +3435,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -3456,13 +3456,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -3474,10 +3474,10 @@ Are you really want to continue? Ctrl+M - + Ctrl+M - + File Encoding 文件编码 @@ -3522,8 +3522,9 @@ Are you really want to continue? - Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5 - 行:%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 @@ -3690,6 +3691,11 @@ Are you really want to continue? Export 导出 + + + Insert Snippet + 插入代码段 + Show debug logs in the debug console @@ -3782,141 +3788,141 @@ Are you really want to continue? 跳转到定义处 - + Character sets 字符集 - + %1 files autosaved 已自动保存%1个文件 - + Save project 保存项目 - + The project '%1' has modifications. 项目'%1'有改动。 - + Do you want to save it? 需要保存吗? - + 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 - + Red panda Dev-C++ project file (*.dev) 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Add to project 添加到项目 - + 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) - - - - - - - + + + + + + + Error 错误 @@ -3926,75 +3932,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个文件) @@ -5400,17 +5406,17 @@ Are you really want to continue? RegisterModel - + Register 寄存器 - + Value(Hex) 值(HEX) - + Value(Dec) 值(DEC) @@ -6238,12 +6244,12 @@ Are you really want to continue? WatchModel - + Expression 表达式 - + Value diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index c72e4b15..bb0e2abf 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -57,7 +57,7 @@ MainWindow::MainWindow(QWidget *parent) ui->setupUi(this); // status bar mFileInfoStatus=new QLabel(); - mFileEncodingStatus = new QLabel(); + mFileEncodingStatus = new LabelWithMenu(); mFileModeStatus = new QLabel(); mFileInfoStatus->setStyleSheet("margin-left:10px; margin-right:10px"); mFileEncodingStatus->setStyleSheet("margin-left:10px; margin-right:10px"); @@ -119,7 +119,7 @@ MainWindow::MainWindow(QWidget *parent) rebuildOpenedFileHisotryMenu(); mMenuInsertCodeSnippet = new QMenu(); - mMenuInsertCodeSnippet->setTitle("Insert Snippet"); + mMenuInsertCodeSnippet->setTitle(tr("Insert Snippet")); ui->menuCode->insertMenu(ui->actionReformat_Code,mMenuInsertCodeSnippet); ui->menuCode->insertSeparator(ui->actionReformat_Code); connect(mMenuInsertCodeSnippet,&QMenu::aboutToShow, @@ -686,11 +686,11 @@ void MainWindow::updateStatusbarForLineCol() if (e!=nullptr) { int col = e->charToColumn(e->caretY(),e->caretX()); QString msg = tr("Line:%1 Col:%2 Selected:%3 Lines:%4 Length:%5") - .arg(e->caretY(),4) - .arg(col,3) - .arg(e->selText().length(),6) - .arg(e->lines()->count(),4) - .arg(e->lines()->getTextLength(),6); + .arg(e->caretY()) + .arg(col) + .arg(e->selText().length()) + .arg(e->lines()->count()) + .arg(e->lines()->getTextLength()); mFileInfoStatus->setText(msg); } else { mFileInfoStatus->setText(""); @@ -1930,6 +1930,11 @@ void MainWindow::buildContextMenus() toolButton->setDefaultAction(mClassBrowser_Show_Inherited); hlayout->addWidget(toolButton); hlayout->addStretch(); + + //menu for statusbar + mFileEncodingStatus->setContextMenuPolicy(Qt::CustomContextMenu); + connect(mFileEncodingStatus,&QWidget::customContextMenuRequested, + this, &MainWindow::onFileEncodingContextMenu); } void MainWindow::buildEncodingMenu() @@ -2185,6 +2190,11 @@ void MainWindow::onDebugConsoleContextMenu(const QPoint &pos) menu.exec(ui->debugConsole->mapToGlobal(pos)); } +void MainWindow::onFileEncodingContextMenu(const QPoint &pos) +{ + mMenuEncoding->exec(mFileEncodingStatus->mapToGlobal(pos)); +} + void MainWindow::onShowInsertCodeSnippetMenu() { mMenuInsertCodeSnippet->clear(); diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 28338060..872b7c6a 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -15,6 +15,7 @@ #include "codesnippetsmanager.h" #include "todoparser.h" #include "toolsmanager.h" +#include "widgets/labelwithmenu.h" QT_BEGIN_NAMESPACE @@ -199,6 +200,7 @@ private slots: void onProjectViewContextMenu(const QPoint& pos); void onClassBrowserContextMenu(const QPoint& pos); void onDebugConsoleContextMenu(const QPoint& pos); + void onFileEncodingContextMenu(const QPoint& pos); void onShowInsertCodeSnippetMenu(); @@ -405,7 +407,7 @@ private: Ui::MainWindow *ui; EditorList *mEditorList; QLabel *mFileInfoStatus; - QLabel *mFileEncodingStatus; + LabelWithMenu *mFileEncodingStatus; QLabel *mFileModeStatus; QMenu *mMenuEncoding; QMenu *mMenuExport; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index e6161fe4..6cfc87ac 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -283,7 +283,7 @@ QTabWidget::South - 1 + 2 @@ -388,16 +388,16 @@ - 2 + 0 - 2 + 0 - 2 + 0 - 2 + 0 diff --git a/RedPandaIDE/resources/codesnippets.json b/RedPandaIDE/resources/codesnippets.json index 81d2ce8f..af572a91 100644 --- a/RedPandaIDE/resources/codesnippets.json +++ b/RedPandaIDE/resources/codesnippets.json @@ -61,5 +61,19 @@ "description": "", "prefix": "function()", "section": -1 + }, + { + "caption": "Comment Header", + "code": "/**\r\n * @file %REPL_BEGIN%%REPL_END% \r\n * @brief: %INSERT%\r\n * @version: %INSERT% \r\n * @copyright: %INSERT%\r\n * @author: %INSERT%\r\n * @date: \r\n * \r\n **/", + "description": "", + "prefix": "", + "section": 0 + }, + { + "caption": "Date/Time", + "code": "", + "description": "", + "prefix": "", + "section": 0 } ] diff --git a/RedPandaIDE/widgets/labelwithmenu.cpp b/RedPandaIDE/widgets/labelwithmenu.cpp new file mode 100644 index 00000000..79ace327 --- /dev/null +++ b/RedPandaIDE/widgets/labelwithmenu.cpp @@ -0,0 +1,18 @@ +#include "labelwithmenu.h" + +#include +#include +#include + +LabelWithMenu::LabelWithMenu(QWidget* parent):QLabel(parent) +{ + +} + +void LabelWithMenu::mousePressEvent(QMouseEvent *event) +{ + QContextMenuEvent *e = new QContextMenuEvent(QContextMenuEvent::Reason::Mouse, + event->pos()); + QApplication::instance()->postEvent(this,e); + event->accept(); +} diff --git a/RedPandaIDE/widgets/labelwithmenu.h b/RedPandaIDE/widgets/labelwithmenu.h new file mode 100644 index 00000000..0d1d4e86 --- /dev/null +++ b/RedPandaIDE/widgets/labelwithmenu.h @@ -0,0 +1,17 @@ +#ifndef LABELWITHMENU_H +#define LABELWITHMENU_H + +#include + +class LabelWithMenu : public QLabel +{ + Q_OBJECT +public: + explicit LabelWithMenu(QWidget* parent = nullptr); + + // QWidget interface +protected: + void mousePressEvent(QMouseEvent *event) override; +}; + +#endif // LABELWITHMENU_H