- fix: Can't correctly set project file's encoding back to 'UTF-8'/'ANSI' in the project options dialog/files setting page.
This commit is contained in:
parent
0ccec06f33
commit
35e3c9af8d
1
NEWS.md
1
NEWS.md
|
@ -16,6 +16,7 @@ Red Panda C++ Version 2.10
|
||||||
- fix: Settings in Options/Tools/General is messed up when switching items in the list.
|
- fix: Settings in Options/Tools/General is messed up when switching items in the list.
|
||||||
- fix: Infos in the status bar not correctly updated when editor closed.
|
- fix: Infos in the status bar not correctly updated when editor closed.
|
||||||
- change: Project's encoding shouldn't be set to "auto detect"
|
- change: Project's encoding shouldn't be set to "auto detect"
|
||||||
|
- fix: Can't correctly set project file's encoding back to 'UTF-8'/'ANSI' in the project options dialog/files setting page.
|
||||||
|
|
||||||
Red Panda C++ Version 2.9
|
Red Panda C++ Version 2.9
|
||||||
|
|
||||||
|
|
|
@ -529,9 +529,12 @@ const QByteArray& Editor::encodingOption() const noexcept{
|
||||||
return mEncodingOption;
|
return mEncodingOption;
|
||||||
}
|
}
|
||||||
void Editor::setEncodingOption(const QByteArray& encoding) noexcept{
|
void Editor::setEncodingOption(const QByteArray& encoding) noexcept{
|
||||||
if (mEncodingOption == encoding)
|
QByteArray newEncoding=encoding;
|
||||||
|
if (mProject && encoding==ENCODING_PROJECT)
|
||||||
|
newEncoding=mProject->options().encoding;
|
||||||
|
if (mEncodingOption == newEncoding)
|
||||||
return;
|
return;
|
||||||
mEncodingOption = encoding;
|
mEncodingOption = newEncoding;
|
||||||
if (!isNew()) {
|
if (!isNew()) {
|
||||||
try {
|
try {
|
||||||
loadFile();
|
loadFile();
|
||||||
|
|
|
@ -270,6 +270,8 @@ void ProjectFilesWidget::on_cbEncodingDetail_currentTextChanged(const QString &)
|
||||||
PProjectUnit unit = currentUnit();
|
PProjectUnit unit = currentUnit();
|
||||||
if(!unit)
|
if(!unit)
|
||||||
return;
|
return;
|
||||||
|
if (ui->cbEncodingDetail->currentText().isEmpty())
|
||||||
|
return;
|
||||||
unit->setEncoding(ui->cbEncodingDetail->currentText().toUtf8());
|
unit->setEncoding(ui->cbEncodingDetail->currentText().toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue