- enhancement: Auto reload openned project files that use "Project Default" as the encoding, when the project encoding setting is changed in the project options dialog.
This commit is contained in:
parent
aac17beb85
commit
d8f237a10e
1
NEWS.md
1
NEWS.md
|
@ -9,6 +9,7 @@ Red Panda C++ Version 2.11
|
|||
- enhancement: Show progress dialog when search/find occurrencies in large projects.
|
||||
- enhancement: Improve auto indent.
|
||||
- enhancement: Change the way to calculate execution time.
|
||||
- enhancement: Auto reload openned project files that use "Project Default" as the encoding, when the project encoding setting is changed in the project options dialog.
|
||||
|
||||
Red Panda C++ Version 2.10
|
||||
|
||||
|
|
|
@ -2025,6 +2025,8 @@ CSimpleIniTempl<SI_CHAR,SI_STRLESS,SI_CONVERTER>::GetValue(
|
|||
}
|
||||
}
|
||||
|
||||
if (*(iKeyVal->second)==0)
|
||||
return a_pDefault;
|
||||
return iKeyVal->second;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,17 +237,6 @@ void Editor::loadFile(QString filename) {
|
|||
if (mProject) {
|
||||
PProjectUnit unit = mProject->findUnit(this);
|
||||
if (unit) {
|
||||
// if (mEncodingOption==ENCODING_AUTO_DETECT) {
|
||||
// if (mFileEncoding==ENCODING_ASCII)
|
||||
// unit->setEncoding(mProject->options().encoding);
|
||||
// else
|
||||
// unit->setEncoding(mFileEncoding);
|
||||
// mEncodingOption=unit->encoding();
|
||||
// } else {
|
||||
// unit->setEncoding(mEncodingOption);
|
||||
// }
|
||||
// unit->setRealEncoding(mFileEncoding);
|
||||
//unit->setEncoding(mEncodingOption);
|
||||
unit->setRealEncoding(mFileEncoding);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1100,6 +1100,21 @@ bool Project::saveAsTemplate(const QString &templateFolder,
|
|||
return true;
|
||||
}
|
||||
|
||||
void Project::setEncoding(const QByteArray &encoding)
|
||||
{
|
||||
if (encoding!=mOptions.encoding) {
|
||||
mOptions.encoding=encoding;
|
||||
foreach (const PProjectUnit& unit,mUnits) {
|
||||
if (unit->encoding()!=ENCODING_PROJECT)
|
||||
continue;
|
||||
Editor * e=unitEditor(unit);
|
||||
if (e) {
|
||||
e->setEncodingOption(mOptions.encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Project::saveOptions()
|
||||
{
|
||||
SimpleIni ini;
|
||||
|
@ -2067,7 +2082,7 @@ void Project::loadOptions(SimpleIni& ini)
|
|||
if (useUTF8) {
|
||||
mOptions.encoding = ini.GetValue("Project","Encoding", ENCODING_UTF8);
|
||||
} else {
|
||||
mOptions.encoding = ini.GetValue("Project","Encoding", ENCODING_SYSTEM_DEFAULT);
|
||||
mOptions.encoding = ini.GetValue("Project","Encoding", pSettings->editor().defaultEncoding());
|
||||
}
|
||||
if (mOptions.encoding == ENCODING_AUTO_DETECT)
|
||||
mOptions.encoding = pSettings->editor().defaultEncoding();
|
||||
|
|
|
@ -268,6 +268,8 @@ public:
|
|||
const QString& description,
|
||||
const QString& category);
|
||||
|
||||
void setEncoding(const QByteArray& encoding);
|
||||
|
||||
std::shared_ptr<CppParser> cppParser();
|
||||
const QString &filename() const;
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ void ProjectGeneralWidget::doSave()
|
|||
return;
|
||||
project->setName(ui->txtName->text().trimmed());
|
||||
|
||||
project->options().encoding = ui->cbDefaultEncoding->currentText().toUtf8();
|
||||
project->setEncoding(ui->cbDefaultEncoding->currentText().toUtf8());
|
||||
|
||||
int row = std::max(0,ui->lstType->currentRow());
|
||||
project->options().type = static_cast<ProjectType>(row);
|
||||
|
|
|
@ -3353,7 +3353,7 @@ Are you really want to continue?</oldsource>
|
|||
<message>
|
||||
<location filename="../settingsdialog/formattergeneralwidget.cpp" line="155"/>
|
||||
<source>Default</source>
|
||||
<translation>缺省</translation>
|
||||
<translation>默认</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settingsdialog/formattergeneralwidget.cpp" line="156"/>
|
||||
|
@ -6888,7 +6888,7 @@ Are you really want to continue?</oldsource>
|
|||
<location filename="../widgets/newprojectdialog.cpp" line="167"/>
|
||||
<location filename="../widgets/newprojectdialog.cpp" line="188"/>
|
||||
<source>Default</source>
|
||||
<translation>缺省</translation>
|
||||
<translation>默认</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../widgets/newprojectdialog.cpp" line="268"/>
|
||||
|
@ -8661,7 +8661,7 @@ Are you really want to continue?</oldsource>
|
|||
<message>
|
||||
<location filename="../colorscheme.cpp" line="760"/>
|
||||
<source>default</source>
|
||||
<translation>缺省</translation>
|
||||
<translation>默认</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't open file '%1' to write!</source>
|
||||
|
|
Loading…
Reference in New Issue