- 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.
- Fix: Function list is not correctly retrived for full-scoped functions.
- Enhancement: Improved Raw string support
- Enhancement: New option for compiler set "Don't localize gcc output messages"
Red Panda C++ Version 2.25

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@
</message>
<message>
<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>
<source>Build time: %1 %2</source>
@ -21,7 +21,7 @@
</message>
<message>
<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>
<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>
<translation>Microsoft Visual C++ Legado</translation>
</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>
<name>AppTheme</name>
@ -815,6 +823,10 @@
<source>Survive auto-finds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Don&apos;t localize compiler output messages</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<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>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copyright(C) 2021-2022 (royqh1979@gmail.com)</source>
<translation type="unfinished"></translation>
</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>
<translation type="unfinished"></translation>
@ -71,6 +67,10 @@
<source>Legacy Microsoft Visual C++</source>
<translation> Microsoft Visual C++</translation>
</message>
<message>
<source>Copyright(C) 2021-2024 (royqh1979@gmail.com)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AppTheme</name>
@ -704,6 +704,10 @@
<source>Survive auto-finds</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Don&apos;t localize compiler output messages</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CppRefacter</name>

View File

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