- enhancement: "use utf8 by default" in editor's misc setting
This commit is contained in:
parent
24b771550c
commit
c7205f572e
14
NEWS.md
14
NEWS.md
|
@ -1,14 +1,18 @@
|
|||
Version 0.7.2
|
||||
- fix: rainbow parenthesis stop functioning when change editor's general options
|
||||
- fix: issue count not correctly displayed when syntax check/compile finished
|
||||
- fix: function declaration's parameters not correctly parsed, if it have a definition which have different parameter names
|
||||
- fix: file path seperator used in the app is not unified, and cause errors somtimes.
|
||||
Version 0.7.3
|
||||
- enhancement: icons in project view
|
||||
- fix: sometimes option widget will show confirm dialog even not changed
|
||||
- enhancement: only editor area will receive file drop events
|
||||
- enhancement: change project file's folder by drag and drop in the project view
|
||||
- enhancement: open project file by drag it to the editor area
|
||||
- fix: the "add bookmark" menu item is not correctly disabled on a bookmarked line
|
||||
- enhancement: "use utf8 by default" in editor's misc setting
|
||||
|
||||
Version 0.7.2
|
||||
- fix: rainbow parenthesis stop functioning when change editor's general options
|
||||
- fix: issue count not correctly displayed when syntax check/compile finished
|
||||
- fix: function declaration's parameters not correctly parsed, if it have a definition which have different parameter names
|
||||
- fix: file path seperator used in the app is not unified, and cause errors somtimes.
|
||||
|
||||
|
||||
Version 0.7.1
|
||||
- fix: can't add bookmark at a breakpoint line
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,6 +5,7 @@
|
|||
#include "editorlist.h"
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QTextCodec>
|
||||
#include "HighlighterManager.h"
|
||||
#include "project.h"
|
||||
|
||||
|
@ -235,7 +236,9 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement &
|
|||
} else {
|
||||
QByteArray realEncoding;
|
||||
QFile file(filename);
|
||||
editor.lines()->saveToFile(file,ENCODING_AUTO_DETECT, realEncoding);
|
||||
editor.lines()->saveToFile(file,ENCODING_AUTO_DETECT,
|
||||
pSettings->editor().useUTF8ByDefault()? ENCODING_UTF8 : QTextCodec::codecForLocale()->name(),
|
||||
realEncoding);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QPrinter>
|
||||
#include <QPrintDialog>
|
||||
#include <QTextDocument>
|
||||
#include <QTextCodec>
|
||||
#include "iconsmanager.h"
|
||||
#include "debugger.h"
|
||||
#include "editorlist.h"
|
||||
|
@ -204,7 +205,9 @@ void Editor::loadFile(QString filename) {
|
|||
|
||||
void Editor::saveFile(QString filename) {
|
||||
QFile file(filename);
|
||||
this->lines()->saveToFile(file,mEncodingOption,mFileEncoding);
|
||||
this->lines()->saveToFile(file,mEncodingOption,
|
||||
pSettings->editor().useUTF8ByDefault()? ENCODING_UTF8 : QTextCodec::codecForLocale()->name(),
|
||||
mFileEncoding);
|
||||
pMainWindow->updateForEncodingInfo();
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ QString SynEditStringList::lineBreak() const
|
|||
return "\n";
|
||||
}
|
||||
|
||||
const SynRangeState& SynEditStringList::ranges(int Index)
|
||||
SynRangeState SynEditStringList::ranges(int Index)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
if (Index>=0 && Index < mList.size()) {
|
||||
|
@ -588,7 +588,8 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray&
|
|||
|
||||
|
||||
|
||||
void SynEditStringList::saveToFile(QFile &file, const QByteArray& encoding, QByteArray& realEncoding)
|
||||
void SynEditStringList::saveToFile(QFile &file, const QByteArray& encoding,
|
||||
const QByteArray& defaultEncoding, QByteArray& realEncoding)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
if (!file.open(QFile::WriteOnly | QFile::Truncate))
|
||||
|
@ -607,6 +608,8 @@ void SynEditStringList::saveToFile(QFile &file, const QByteArray& encoding, QByt
|
|||
} else if (realEncoding == ENCODING_SYSTEM_DEFAULT) {
|
||||
codec = QTextCodec::codecForLocale();
|
||||
} else if (realEncoding == ENCODING_AUTO_DETECT) {
|
||||
codec = QTextCodec::codecForName(defaultEncoding);
|
||||
if (!codec)
|
||||
codec = QTextCodec::codecForLocale();
|
||||
} else {
|
||||
codec = QTextCodec::codecForName(realEncoding);
|
||||
|
|
|
@ -88,7 +88,8 @@ public:
|
|||
void insertStrings(int Index, const QStringList& NewStrings);
|
||||
void insertText(int Index,const QString& NewText);
|
||||
void loadFromFile(const QString& filename, const QByteArray& encoding, QByteArray& realEncoding);
|
||||
void saveToFile(QFile& file, const QByteArray& encoding, QByteArray& realEncoding);
|
||||
void saveToFile(QFile& file, const QByteArray& encoding,
|
||||
const QByteArray& defaultEncoding, QByteArray& realEncoding);
|
||||
|
||||
bool getAppendNewLineAtEOF();
|
||||
void setAppendNewLineAtEOF(bool appendNewLineAtEOF);
|
||||
|
|
|
@ -507,6 +507,16 @@ void Settings::Editor::setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed)
|
|||
mMouseWheelScrollSpeed = newMouseWheelScrollSpeed;
|
||||
}
|
||||
|
||||
bool Settings::Editor::useUTF8ByDefault() const
|
||||
{
|
||||
return mUseUTF8ByDefault;
|
||||
}
|
||||
|
||||
void Settings::Editor::setUseUTF8ByDefault(bool newUseUTF8ByDefault)
|
||||
{
|
||||
mUseUTF8ByDefault = newUseUTF8ByDefault;
|
||||
}
|
||||
|
||||
bool Settings::Editor::enableTooltips() const
|
||||
{
|
||||
return mEnableTooltips;
|
||||
|
@ -1065,6 +1075,8 @@ void Settings::Editor::doSave()
|
|||
saveValue("readonly_system_header",mReadOnlySytemHeader);
|
||||
saveValue("auto_load_last_files",mAutoLoadLastFiles);
|
||||
saveValue("default_file_cpp",mDefaultFileCpp);
|
||||
saveValue("use_utf8_by_default",mUseUTF8ByDefault);
|
||||
|
||||
|
||||
//tooltips
|
||||
saveValue("enable_tooltips",mEnableTooltips);
|
||||
|
@ -1178,6 +1190,7 @@ void Settings::Editor::doLoad()
|
|||
mReadOnlySytemHeader = boolValue("readonly_system_header",true);
|
||||
mAutoLoadLastFiles = boolValue("auto_load_last_files",true);
|
||||
mDefaultFileCpp = boolValue("default_file_cpp",true);
|
||||
mUseUTF8ByDefault = boolValue("use_utf8_by_default",false);
|
||||
|
||||
//tooltips
|
||||
mEnableTooltips = boolValue("enable_tooltips",true);
|
||||
|
|
|
@ -327,6 +327,9 @@ public:
|
|||
int mouseWheelScrollSpeed() const;
|
||||
void setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed);
|
||||
|
||||
bool useUTF8ByDefault() const;
|
||||
void setUseUTF8ByDefault(bool newUseUTF8ByDefault);
|
||||
|
||||
private:
|
||||
//General
|
||||
// indents
|
||||
|
@ -426,6 +429,7 @@ public:
|
|||
bool mReadOnlySytemHeader;
|
||||
bool mAutoLoadLastFiles;
|
||||
bool mDefaultFileCpp;
|
||||
bool mUseUTF8ByDefault;
|
||||
|
||||
//hints tooltip
|
||||
bool mEnableTooltips;
|
||||
|
|
|
@ -24,6 +24,7 @@ void EditorMiscWidget::doLoad()
|
|||
} else {
|
||||
ui->rbCFile->setChecked(true);
|
||||
}
|
||||
ui->chkUseUTF8ByDefault->setChecked(pSettings->editor().useUTF8ByDefault());
|
||||
}
|
||||
|
||||
void EditorMiscWidget::doSave()
|
||||
|
@ -31,5 +32,6 @@ void EditorMiscWidget::doSave()
|
|||
pSettings->editor().setReadOnlySytemHeader(ui->chkReadonlySystemHeaders->isChecked());
|
||||
pSettings->editor().setAutoLoadLastFiles(ui->chkLoadLastFiles->isChecked());
|
||||
pSettings->editor().setDefaultFileCpp(ui->rbCppFile->isChecked());
|
||||
pSettings->editor().setUseUTF8ByDefault(ui->chkUseUTF8ByDefault->isChecked());
|
||||
pSettings->editor().save();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<width>515</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -28,6 +28,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkUseUTF8ByDefault">
|
||||
<property name="text">
|
||||
<string>Use UTF-8 as the default encoding for new file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
|
|
Loading…
Reference in New Issue