- Enhancement: New option for compiler set "Don't localize gcc output messages"

This commit is contained in:
Roy Qu 2024-02-20 21:47:12 +08:00
parent 522722c418
commit f9d8212712
12 changed files with 927 additions and 864 deletions

View File

@ -47,6 +47,7 @@ Red Panda C++ Version 2.26
- Enhancement: Don't auto-indent in raw string. - Enhancement: Don't auto-indent in raw string.
- Fix: Function list is not correctly retrived for full-scoped functions. - Fix: Function list is not correctly retrived for full-scoped functions.
- Enhancement: Improved Raw string support - Enhancement: Improved Raw string support
- Enhancement: New option for compiler set "Don't localize gcc output messages"
Red Panda C++ Version 2.25 Red Panda C++ Version 2.25

View File

@ -37,10 +37,11 @@
#define COMPILE_PROCESS_END "---//END//----" #define COMPILE_PROCESS_END "---//END//----"
Compiler::Compiler(const QString &filename, bool onlyCheckSyntax): Compiler::Compiler(const QString &filename, bool onlyCheckSyntax):
QThread(), QThread{},
mOnlyCheckSyntax(onlyCheckSyntax), mOnlyCheckSyntax{onlyCheckSyntax},
mFilename(filename), mFilename{filename},
mRebuild(false), mRebuild{false},
mForceEnglishOutput{false},
mParserForFile() mParserForFile()
{ {
getParserForFile(filename); getParserForFile(filename);
@ -685,7 +686,8 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q
} }
env.insert("PATH",path); env.insert("PATH",path);
} }
//env.insert("LANG","en"); if (compilerSet() && compilerSet()->forceEnglishOutput())
env.insert("LANG","en");
env.insert("LDFLAGS","-Wl,--stack,12582912"); env.insert("LDFLAGS","-Wl,--stack,12582912");
env.insert("CFLAGS",""); env.insert("CFLAGS","");
env.insert("CXXFLAGS",""); env.insert("CXXFLAGS","");

View File

@ -104,6 +104,7 @@ protected:
std::shared_ptr<Project> mProject; std::shared_ptr<Project> mProject;
bool mSetLANG; bool mSetLANG;
PCppParser mParserForFile; PCppParser mParserForFile;
bool mForceEnglishOutput;
private: private:
bool mStop; bool mStop;

View File

@ -4448,7 +4448,7 @@ void CppParser::internalParse(const QString &fileName)
if (mTokenizer.tokenCount() == 0) if (mTokenizer.tokenCount() == 0)
return; return;
#ifdef QT_DEBUG #ifdef QT_DEBUG
mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName))); // mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
#endif #endif
#ifdef QT_DEBUG #ifdef QT_DEBUG
mLastIndex = -1; mLastIndex = -1;

View File

@ -1680,6 +1680,7 @@ Settings::CompilerSet::CompilerSet():
mExecCharset{ENCODING_SYSTEM_DEFAULT}, mExecCharset{ENCODING_SYSTEM_DEFAULT},
mStaticLink{false}, mStaticLink{false},
mPersistInAutoFind{false}, mPersistInAutoFind{false},
mForceEnglishOutput{false},
mPreprocessingSuffix{DEFAULT_PREPROCESSING_SUFFIX}, mPreprocessingSuffix{DEFAULT_PREPROCESSING_SUFFIX},
mCompilationProperSuffix{DEFAULT_COMPILATION_SUFFIX}, mCompilationProperSuffix{DEFAULT_COMPILATION_SUFFIX},
mAssemblingSuffix{DEFAULT_ASSEMBLING_SUFFIX}, mAssemblingSuffix{DEFAULT_ASSEMBLING_SUFFIX},
@ -1695,6 +1696,7 @@ Settings::CompilerSet::CompilerSet(const QString& compilerFolder, const QString&
mExecCharset{ENCODING_SYSTEM_DEFAULT}, mExecCharset{ENCODING_SYSTEM_DEFAULT},
mStaticLink{true}, mStaticLink{true},
mPersistInAutoFind{false}, mPersistInAutoFind{false},
mForceEnglishOutput{false},
mPreprocessingSuffix{DEFAULT_PREPROCESSING_SUFFIX}, mPreprocessingSuffix{DEFAULT_PREPROCESSING_SUFFIX},
mCompilationProperSuffix{DEFAULT_COMPILATION_SUFFIX}, mCompilationProperSuffix{DEFAULT_COMPILATION_SUFFIX},
mAssemblingSuffix{DEFAULT_ASSEMBLING_SUFFIX}, mAssemblingSuffix{DEFAULT_ASSEMBLING_SUFFIX},
@ -1753,6 +1755,7 @@ Settings::CompilerSet::CompilerSet(const Settings::CompilerSet &set):
mTarget{set.mTarget}, mTarget{set.mTarget},
mCompilerType{set.mCompilerType}, mCompilerType{set.mCompilerType},
mUseCustomCompileParams{set.mUseCustomCompileParams}, mUseCustomCompileParams{set.mUseCustomCompileParams},
mUseCustomLinkParams{set.mUseCustomLinkParams}, mUseCustomLinkParams{set.mUseCustomLinkParams},
mCustomCompileParams{set.mCustomCompileParams}, mCustomCompileParams{set.mCustomCompileParams},
@ -1761,6 +1764,7 @@ Settings::CompilerSet::CompilerSet(const Settings::CompilerSet &set):
mExecCharset{set.mExecCharset}, mExecCharset{set.mExecCharset},
mStaticLink{set.mStaticLink}, mStaticLink{set.mStaticLink},
mPersistInAutoFind{set.mPersistInAutoFind}, mPersistInAutoFind{set.mPersistInAutoFind},
mForceEnglishOutput{set.mForceEnglishOutput},
mPreprocessingSuffix{set.mPreprocessingSuffix}, mPreprocessingSuffix{set.mPreprocessingSuffix},
mCompilationProperSuffix{set.mCompilationProperSuffix}, mCompilationProperSuffix{set.mCompilationProperSuffix},
@ -1804,6 +1808,7 @@ Settings::CompilerSet::CompilerSet(const QJsonObject &set) :
mExecCharset{}, // handle later mExecCharset{}, // handle later
mStaticLink{set["staticLink"].toBool()}, mStaticLink{set["staticLink"].toBool()},
mPersistInAutoFind{false}, mPersistInAutoFind{false},
mForceEnglishOutput{false},
mPreprocessingSuffix{set["preprocessingSuffix"].toString()}, mPreprocessingSuffix{set["preprocessingSuffix"].toString()},
mCompilationProperSuffix{set["compilationProperSuffix"].toString()}, mCompilationProperSuffix{set["compilationProperSuffix"].toString()},
@ -2907,6 +2912,16 @@ QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const
return result.trimmed(); return result.trimmed();
} }
bool Settings::CompilerSet::forceEnglishOutput() const
{
return mForceEnglishOutput;
}
void Settings::CompilerSet::setForceEnglishOutput(bool newForceEnglishOutput)
{
mForceEnglishOutput = newForceEnglishOutput;
}
bool Settings::CompilerSet::persistInAutoFind() const bool Settings::CompilerSet::persistInAutoFind() const
{ {
return mPersistInAutoFind; return mPersistInAutoFind;
@ -3556,6 +3571,7 @@ void Settings::CompilerSets::saveSet(int index)
mSettings->mSettings.setValue("StaticLink", pSet->staticLink()); mSettings->mSettings.setValue("StaticLink", pSet->staticLink());
mSettings->mSettings.setValue("ExecCharset", pSet->execCharset()); mSettings->mSettings.setValue("ExecCharset", pSet->execCharset());
mSettings->mSettings.setValue("PersistInAutoFind", pSet->persistInAutoFind()); mSettings->mSettings.setValue("PersistInAutoFind", pSet->persistInAutoFind());
mSettings->mSettings.setValue("forceEnglishOutput", pSet->forceEnglishOutput());
mSettings->mSettings.setValue("preprocessingSuffix", pSet->preprocessingSuffix()); mSettings->mSettings.setValue("preprocessingSuffix", pSet->preprocessingSuffix());
mSettings->mSettings.setValue("compilationProperSuffix", pSet->compilationProperSuffix()); mSettings->mSettings.setValue("compilationProperSuffix", pSet->compilationProperSuffix());
@ -3644,6 +3660,7 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
pSet->setAutoAddCharsetParams(mSettings->mSettings.value("AddCharset", true).toBool()); pSet->setAutoAddCharsetParams(mSettings->mSettings.value("AddCharset", true).toBool());
pSet->setStaticLink(mSettings->mSettings.value("StaticLink", false).toBool()); pSet->setStaticLink(mSettings->mSettings.value("StaticLink", false).toBool());
pSet->setPersistInAutoFind(mSettings->mSettings.value("PersistInAutoFind", false).toBool()); pSet->setPersistInAutoFind(mSettings->mSettings.value("PersistInAutoFind", false).toBool());
pSet->setForceEnglishOutput(mSettings->mSettings.value("forceEnglishOutput", false).toBool());
pSet->setExecCharset(mSettings->mSettings.value("ExecCharset", ENCODING_SYSTEM_DEFAULT).toString()); pSet->setExecCharset(mSettings->mSettings.value("ExecCharset", ENCODING_SYSTEM_DEFAULT).toString());
if (pSet->execCharset().isEmpty()) { if (pSet->execCharset().isEmpty()) {

View File

@ -1472,6 +1472,9 @@ public:
bool persistInAutoFind() const; bool persistInAutoFind() const;
void setPersistInAutoFind(bool newPersistInAutoFind); void setPersistInAutoFind(bool newPersistInAutoFind);
bool forceEnglishOutput() const;
void setForceEnglishOutput(bool newForceEnglishOutput);
private: private:
void setGCCProperties(const QString& binDir, const QString& c_prog); void setGCCProperties(const QString& binDir, const QString& c_prog);
void setDirectories(const QString& binDir); void setDirectories(const QString& binDir);
@ -1523,6 +1526,7 @@ public:
QString mExecCharset; QString mExecCharset;
bool mStaticLink; bool mStaticLink;
bool mPersistInAutoFind; bool mPersistInAutoFind;
bool mForceEnglishOutput;
QString mPreprocessingSuffix; QString mPreprocessingSuffix;
QString mCompilationProperSuffix; QString mCompilationProperSuffix;

View File

@ -96,6 +96,7 @@ static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSet
ui->chkAutoAddCharset->setChecked(pSet->autoAddCharsetParams()); ui->chkAutoAddCharset->setChecked(pSet->autoAddCharsetParams());
ui->chkStaticLink->setChecked(pSet->staticLink()); ui->chkStaticLink->setChecked(pSet->staticLink());
ui->chkPersistInAutoFind->setChecked(pSet->persistInAutoFind()); ui->chkPersistInAutoFind->setChecked(pSet->persistInAutoFind());
ui->chkForceEnglishOutput->setChecked(pSet->forceEnglishOutput());
//rest tabs in the options widget //rest tabs in the options widget
ui->optionTabs->resetUI(pSet,pSet->compileOptions()); ui->optionTabs->resetUI(pSet,pSet->compileOptions());
@ -242,6 +243,8 @@ void CompilerSetOptionWidget::saveCurrentCompilerSet()
pSet->setAutoAddCharsetParams(ui->chkAutoAddCharset->isChecked()); pSet->setAutoAddCharsetParams(ui->chkAutoAddCharset->isChecked());
pSet->setStaticLink(ui->chkStaticLink->isChecked()); pSet->setStaticLink(ui->chkStaticLink->isChecked());
pSet->setPersistInAutoFind(ui->chkPersistInAutoFind->isChecked()); pSet->setPersistInAutoFind(ui->chkPersistInAutoFind->isChecked());
pSet->setForceEnglishOutput(ui->chkForceEnglishOutput->isChecked());
pSet->setCCompiler(ui->txtCCompiler->text().trimmed()); pSet->setCCompiler(ui->txtCCompiler->text().trimmed());
pSet->setCppCompiler(ui->txtCppCompiler->text().trimmed()); pSet->setCppCompiler(ui->txtCppCompiler->text().trimmed());

View File

@ -85,7 +85,7 @@
<item> <item>
<widget class="QTabWidget" name="settingTabs"> <widget class="QTabWidget" name="settingTabs">
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>0</number>
</property> </property>
<property name="movable"> <property name="movable">
<bool>false</bool> <bool>false</bool>
@ -146,6 +146,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="chkForceEnglishOutput">
<property name="text">
<string>Don't localize compiler output messages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkPersistInAutoFind">
<property name="text">
<string>Survive auto-finds</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="chkUseCustomCompilerParams"> <widget class="QCheckBox" name="chkUseCustomCompilerParams">
<property name="text"> <property name="text">
@ -166,13 +180,6 @@
<item> <item>
<widget class="QPlainTextEdit" name="txtCustomLinkParams"/> <widget class="QPlainTextEdit" name="txtCustomLinkParams"/>
</item> </item>
<item>
<widget class="QCheckBox" name="chkPersistInAutoFind">
<property name="text">
<string>Survive auto-finds</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabSettings"> <widget class="QWidget" name="tabSettings">
@ -497,8 +504,6 @@
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources/>
<include location="../icons.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -13,7 +13,7 @@
</message> </message>
<message> <message>
<source>Based on Qt %1 (%2) rodando em %3</source> <source>Based on Qt %1 (%2) rodando em %3</source>
<translation>Com base em Qt %1 (%2) executado em %3</translation> <translation type="vanished">Com base em Qt %1 (%2) executado em %3</translation>
</message> </message>
<message> <message>
<source>Build time: %1 %2</source> <source>Build time: %1 %2</source>
@ -21,7 +21,7 @@
</message> </message>
<message> <message>
<source>Copyright(C) 2021-2022 (royqh1979@gmail.com)</source> <source>Copyright(C) 2021-2022 (royqh1979@gmail.com)</source>
<translation>Copyright(C) 2021-2022 (royqh1979@gmail.com)</translation> <translation type="vanished">Copyright(C) 2021-2022 (royqh1979@gmail.com)</translation>
</message> </message>
<message> <message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Homepage: &lt;a href=&quot;Homepage: https://sourceforge.net/projects/dev-cpp-2020/&quot;&gt;https://sourceforge.net/projects/dev-cpp-2020/&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Homepage: &lt;a href=&quot;Homepage: https://sourceforge.net/projects/dev-cpp-2020/&quot;&gt;https://sourceforge.net/projects/dev-cpp-2020/&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
@ -75,6 +75,14 @@
<source>Legacy Microsoft Visual C++</source> <source>Legacy Microsoft Visual C++</source>
<translation>Microsoft Visual C++ Legado</translation> <translation>Microsoft Visual C++ Legado</translation>
</message> </message>
<message>
<source>Based on Qt %1 (%2) running on %3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copyright(C) 2021-2024 (royqh1979@gmail.com)</source>
<translation type="unfinished">Copyright(C) 2021-2022 (royqh1979@gmail.com) {2021-2024 ?} {1979@?}</translation>
</message>
</context> </context>
<context> <context>
<name>AppTheme</name> <name>AppTheme</name>
@ -815,6 +823,10 @@
<source>Survive auto-finds</source> <source>Survive auto-finds</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Don&apos;t localize compiler output messages</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CppRefacter</name> <name>CppRefacter</name>

File diff suppressed because it is too large Load Diff

View File

@ -19,10 +19,6 @@
<source>Build time: %1 %2</source> <source>Build time: %1 %2</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Copyright(C) 2021-2022 (royqh1979@gmail.com)</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Homepage: &lt;a href=&quot;Homepage: https://sourceforge.net/projects/dev-cpp-2020/&quot;&gt;https://sourceforge.net/projects/dev-cpp-2020/&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Homepage: &lt;a href=&quot;Homepage: https://sourceforge.net/projects/dev-cpp-2020/&quot;&gt;https://sourceforge.net/projects/dev-cpp-2020/&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -71,6 +67,10 @@
<source>Legacy Microsoft Visual C++</source> <source>Legacy Microsoft Visual C++</source>
<translation> Microsoft Visual C++</translation> <translation> Microsoft Visual C++</translation>
</message> </message>
<message>
<source>Copyright(C) 2021-2024 (royqh1979@gmail.com)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>AppTheme</name> <name>AppTheme</name>
@ -704,6 +704,10 @@
<source>Survive auto-finds</source> <source>Survive auto-finds</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Don&apos;t localize compiler output messages</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CppRefacter</name> <name>CppRefacter</name>

View File

@ -985,9 +985,6 @@ void CppSyntaxer::procRawString()
} }
break; break;
case ')': case ')':
qDebug()<<mRawStringInitialDCharSeq;
qDebug()<<mLine.mid(mRun+1,mRawStringInitialDCharSeq.length());
qDebug()<<(mLine.mid(mRun+1,mRawStringInitialDCharSeq.length()) == mRawStringInitialDCharSeq);
if (mRange.state == RangeState::rsRawStringNotEscaping if (mRange.state == RangeState::rsRawStringNotEscaping
&& mLine.mid(mRun+1,mRawStringInitialDCharSeq.length()) == mRawStringInitialDCharSeq) { && mLine.mid(mRun+1,mRawStringInitialDCharSeq.length()) == mRawStringInitialDCharSeq) {
mRun = mRun+1+mRawStringInitialDCharSeq.length(); mRun = mRun+1+mRawStringInitialDCharSeq.length();