- enhancement: add "OI Wiki" and "turtle graphics tutorial" in help menu for zh_CN locale.

- change: rename "graphics.h" template to "ege" for zh_CN locale
  - change: update graphics.h/ege template's icon
This commit is contained in:
Roy Qu 2023-07-02 11:09:34 +08:00
parent 362cf5701c
commit e11a81d3c0
12 changed files with 1116 additions and 1005 deletions

View File

@ -20,8 +20,9 @@ Red Panda C++ Version 2.23
- change: remove "Assembly" color scheme item (it's not used anymore).
- fix: crash when parsing files containing inline assembly code.
- fix: crash when source files contains macro definitions like "#define cfun (cfun + 0)"
- improve: Correctly expands multi-line macros when parsing;
- improve: Correctly eppands macros when real param string contains '(' or ')'.
- improvement: Correctly expands multi-line macros when parsing;
- improvement: Correctly eppands macros when real param string contains '(' or ')'.
- enhancement: add "OI Wiki" and "turtle graphics tutorial" in help menu for zh_CN locale.
Red Panda C++ Version 2.22

View File

@ -21,7 +21,7 @@
#include "settings.h"
#include "widgets/cpudialog.h"
#include "systemconsts.h"
#include "editorlist.h"
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
@ -1126,6 +1126,20 @@ void DebugReader::processConsoleOutput(const QByteArray& line)
}
}
void DebugReader::processLogOutput(const QByteArray &line)
{
if (mDebugger->debugInfosUsingUTF8() && line.endsWith(": No such file or directory.\n\"")) {
QByteArray newLine = line;
newLine[0]='~';
int p=newLine.lastIndexOf(':');
if (p>0) {
newLine=newLine.left(p);
qDebug()<<newLine;
processConsoleOutput(newLine);
}
}
}
void DebugReader::processResult(const QByteArray &result)
{
GDBMIResultParser parser;
@ -1263,6 +1277,7 @@ void DebugReader::processError(const QByteArray &errorLine)
return;
}
}
static QRegularExpression reGdbSourceLine("^(\\d)+\\s+in\\s+(.+)$");
void DebugReader::processResultRecord(const QByteArray &line)
{
@ -1288,6 +1303,36 @@ void DebugReader::processResultRecord(const QByteArray &line)
disOutput.pop_front();
disOutput.pop_front();
}
if (mDebugger->debugInfosUsingUTF8()) {
QStringList newOutput;
foreach(const QString& s, disOutput) {
QString line = s;
if (!s.isEmpty() && s.front().isDigit()) {
QRegularExpressionMatch match = reGdbSourceLine.match(s);
// qDebug()<<s;
if (match.hasMatch()) {
bool isOk;
int lineno=match.captured(1).toInt(&isOk)-1;;
QString filename = match.captured(2).trimmed();
if (isOk && fileExists(filename)) {
QStringList contents;
if (mFileCache.contains(filename))
contents = mFileCache.value(filename);
else {
if (!pMainWindow->editorList()->getContentFromOpenedEditor(filename,contents))
contents = readFileToLines(filename);
mFileCache[filename]=contents;
}
if (lineno>=0 && lineno<contents.size()) {
line = QString("%1\t%2").arg(lineno+1).arg(contents[lineno]);
}
}
}
}
newOutput.append(line);
}
disOutput=newOutput;
}
emit disassemblyUpdate(mCurrentFile,mCurrentFunc, disOutput);
}
}
@ -1327,7 +1372,9 @@ void DebugReader::processDebugOutput(const QByteArray& debugOutput)
processConsoleOutput(line);
break;
case '@': // target stream output
break;
case '&': // log stream output
processLogOutput(line);
break;
case '^': // result record
processResultRecord(line);

View File

@ -571,6 +571,7 @@ private:
void handleListVarChildren(const GDBMIResultParser::ParseObject& multiVars);
void handleUpdateVarValue(const QList<GDBMIResultParser::ParseValue> &changes);
void processConsoleOutput(const QByteArray& line);
void processLogOutput(const QByteArray& line);
void processResult(const QByteArray& result);
void processExecAsyncRecord(const QByteArray& line);
void processError(const QByteArray& errorLine);
@ -597,6 +598,7 @@ private:
PDebugCommand mCurrentCmd;
std::shared_ptr<QProcess> mProcess;
QStringList mBinDirs;
QMap<QString,QStringList> mFileCache;
//fWatchView: TTreeView;

View File

@ -432,6 +432,8 @@ MainWindow::MainWindow(QWidget *parent)
ui->actionx86_Assembly_Language_Reference_Manual->setVisible(false);
#endif
ui->actionEGE_Manual->setVisible(pSettings->environment().language()=="zh_CN");
ui->actionOI_Wiki->setVisible(pSettings->environment().language()=="zh_CN");
ui->actionTurtle_Graphics_Manual->setVisible(pSettings->environment().language()=="zh_CN");
ui->actionDocument->setVisible(pSettings->environment().language()=="zh_CN");
connect(ui->EditorTabsLeft, &EditorsTabWidget::middleButtonClicked,
@ -9959,3 +9961,15 @@ void MainWindow::on_actionClose_Others_triggered()
}
mClosing = false;
}
void MainWindow::on_actionOI_Wiki_triggered()
{
QDesktopServices::openUrl(QUrl("https://oi-wiki.org/"));
}
void MainWindow::on_actionTurtle_Graphics_Manual_triggered()
{
QDesktopServices::openUrl(QUrl("https://zhuanlan.zhihu.com/p/538666844"));
}

View File

@ -843,6 +843,10 @@ private slots:
void on_actionClose_Others_triggered();
void on_actionOI_Wiki_triggered();
void on_actionTurtle_Graphics_Manual_triggered();
private:
Ui::MainWindow *ui;
bool mFullInitialized;

View File

@ -286,11 +286,15 @@
<addaction name="actionDocument"/>
<addaction name="actionC_Reference"/>
<addaction name="actionC_C_Reference"/>
<addaction name="separator"/>
<addaction name="actionOI_Wiki"/>
<addaction name="actionRaylib_Manual"/>
<addaction name="actionEGE_Manual"/>
<addaction name="actionTurtle_Graphics_Manual"/>
<addaction name="separator"/>
<addaction name="actionGNU_Assembler_Manual"/>
<addaction name="actionx86_Assembly_Language_Reference_Manual"/>
<addaction name="actionIA_32_Assembly_Language_Reference_Manual"/>
<addaction name="actionRaylib_Manual"/>
<addaction name="actionEGE_Manual"/>
<addaction name="separator"/>
<addaction name="actionWebsite"/>
<addaction name="actionSubmit_Issues"/>
@ -3518,6 +3522,22 @@
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionOI_Wiki">
<property name="text">
<string>OI Wiki</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionTurtle_Graphics_Manual">
<property name="text">
<string>Turtle Graphics Tutorial</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -5275,6 +5275,14 @@
<source>Close Others</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OI Wiki</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turtle Graphics Tutorial</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MemoryModel</name>
@ -6323,7 +6331,7 @@
</message>
<message>
<source>Assembler</source>
<translation>Assembler</translation>
<translation type="vanished">Assembler</translation>
</message>
<message>
<source>Syntax</source>

File diff suppressed because it is too large Load Diff

View File

@ -4996,6 +4996,14 @@
<source>Close Others</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>OI Wiki</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Turtle Graphics Tutorial</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MemoryModel</name>
@ -5986,10 +5994,6 @@
<source>Can&apos;t remove the color scheme file %1!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Assembler</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Syntax</source>
<translation type="unfinished"></translation>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1,7 +1,8 @@
[Template]
ver=2
Name=Graphics.h
Icon=CL_Graphics.ico
Name[zh_CN]=xege
Icon=xege.ico
Description=A simple program use Easy Graphics Engine
Description[zh_CN]=使用EGE库的简单绘图程序
Category=Multimedia

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB