- 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
|
Version 0.7.3
|
||||||
- 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.
|
|
||||||
- enhancement: icons in project view
|
- enhancement: icons in project view
|
||||||
- fix: sometimes option widget will show confirm dialog even not changed
|
- fix: sometimes option widget will show confirm dialog even not changed
|
||||||
- enhancement: only editor area will receive file drop events
|
- enhancement: only editor area will receive file drop events
|
||||||
- enhancement: change project file's folder by drag and drop in the project view
|
- 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
|
- 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
|
- 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
|
Version 0.7.1
|
||||||
- fix: can't add bookmark at a breakpoint line
|
- 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 "editorlist.h"
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTextCodec>
|
||||||
#include "HighlighterManager.h"
|
#include "HighlighterManager.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
|
||||||
|
@ -235,7 +236,9 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement &
|
||||||
} else {
|
} else {
|
||||||
QByteArray realEncoding;
|
QByteArray realEncoding;
|
||||||
QFile file(filename);
|
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 <QPrinter>
|
||||||
#include <QPrintDialog>
|
#include <QPrintDialog>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
#include <QTextCodec>
|
||||||
#include "iconsmanager.h"
|
#include "iconsmanager.h"
|
||||||
#include "debugger.h"
|
#include "debugger.h"
|
||||||
#include "editorlist.h"
|
#include "editorlist.h"
|
||||||
|
@ -204,7 +205,9 @@ void Editor::loadFile(QString filename) {
|
||||||
|
|
||||||
void Editor::saveFile(QString filename) {
|
void Editor::saveFile(QString filename) {
|
||||||
QFile file(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();
|
pMainWindow->updateForEncodingInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ QString SynEditStringList::lineBreak() const
|
||||||
return "\n";
|
return "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
const SynRangeState& SynEditStringList::ranges(int Index)
|
SynRangeState SynEditStringList::ranges(int Index)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (Index>=0 && Index < mList.size()) {
|
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);
|
QMutexLocker locker(&mMutex);
|
||||||
if (!file.open(QFile::WriteOnly | QFile::Truncate))
|
if (!file.open(QFile::WriteOnly | QFile::Truncate))
|
||||||
|
@ -607,7 +608,9 @@ void SynEditStringList::saveToFile(QFile &file, const QByteArray& encoding, QByt
|
||||||
} else if (realEncoding == ENCODING_SYSTEM_DEFAULT) {
|
} else if (realEncoding == ENCODING_SYSTEM_DEFAULT) {
|
||||||
codec = QTextCodec::codecForLocale();
|
codec = QTextCodec::codecForLocale();
|
||||||
} else if (realEncoding == ENCODING_AUTO_DETECT) {
|
} else if (realEncoding == ENCODING_AUTO_DETECT) {
|
||||||
codec = QTextCodec::codecForLocale();
|
codec = QTextCodec::codecForName(defaultEncoding);
|
||||||
|
if (!codec)
|
||||||
|
codec = QTextCodec::codecForLocale();
|
||||||
} else {
|
} else {
|
||||||
codec = QTextCodec::codecForName(realEncoding);
|
codec = QTextCodec::codecForName(realEncoding);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,8 @@ public:
|
||||||
void insertStrings(int Index, const QStringList& NewStrings);
|
void insertStrings(int Index, const QStringList& NewStrings);
|
||||||
void insertText(int Index,const QString& NewText);
|
void insertText(int Index,const QString& NewText);
|
||||||
void loadFromFile(const QString& filename, const QByteArray& encoding, QByteArray& realEncoding);
|
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();
|
bool getAppendNewLineAtEOF();
|
||||||
void setAppendNewLineAtEOF(bool appendNewLineAtEOF);
|
void setAppendNewLineAtEOF(bool appendNewLineAtEOF);
|
||||||
|
|
|
@ -507,6 +507,16 @@ void Settings::Editor::setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed)
|
||||||
mMouseWheelScrollSpeed = newMouseWheelScrollSpeed;
|
mMouseWheelScrollSpeed = newMouseWheelScrollSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::Editor::useUTF8ByDefault() const
|
||||||
|
{
|
||||||
|
return mUseUTF8ByDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::Editor::setUseUTF8ByDefault(bool newUseUTF8ByDefault)
|
||||||
|
{
|
||||||
|
mUseUTF8ByDefault = newUseUTF8ByDefault;
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::Editor::enableTooltips() const
|
bool Settings::Editor::enableTooltips() const
|
||||||
{
|
{
|
||||||
return mEnableTooltips;
|
return mEnableTooltips;
|
||||||
|
@ -1065,6 +1075,8 @@ void Settings::Editor::doSave()
|
||||||
saveValue("readonly_system_header",mReadOnlySytemHeader);
|
saveValue("readonly_system_header",mReadOnlySytemHeader);
|
||||||
saveValue("auto_load_last_files",mAutoLoadLastFiles);
|
saveValue("auto_load_last_files",mAutoLoadLastFiles);
|
||||||
saveValue("default_file_cpp",mDefaultFileCpp);
|
saveValue("default_file_cpp",mDefaultFileCpp);
|
||||||
|
saveValue("use_utf8_by_default",mUseUTF8ByDefault);
|
||||||
|
|
||||||
|
|
||||||
//tooltips
|
//tooltips
|
||||||
saveValue("enable_tooltips",mEnableTooltips);
|
saveValue("enable_tooltips",mEnableTooltips);
|
||||||
|
@ -1178,6 +1190,7 @@ void Settings::Editor::doLoad()
|
||||||
mReadOnlySytemHeader = boolValue("readonly_system_header",true);
|
mReadOnlySytemHeader = boolValue("readonly_system_header",true);
|
||||||
mAutoLoadLastFiles = boolValue("auto_load_last_files",true);
|
mAutoLoadLastFiles = boolValue("auto_load_last_files",true);
|
||||||
mDefaultFileCpp = boolValue("default_file_cpp",true);
|
mDefaultFileCpp = boolValue("default_file_cpp",true);
|
||||||
|
mUseUTF8ByDefault = boolValue("use_utf8_by_default",false);
|
||||||
|
|
||||||
//tooltips
|
//tooltips
|
||||||
mEnableTooltips = boolValue("enable_tooltips",true);
|
mEnableTooltips = boolValue("enable_tooltips",true);
|
||||||
|
|
|
@ -327,6 +327,9 @@ public:
|
||||||
int mouseWheelScrollSpeed() const;
|
int mouseWheelScrollSpeed() const;
|
||||||
void setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed);
|
void setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed);
|
||||||
|
|
||||||
|
bool useUTF8ByDefault() const;
|
||||||
|
void setUseUTF8ByDefault(bool newUseUTF8ByDefault);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//General
|
//General
|
||||||
// indents
|
// indents
|
||||||
|
@ -426,6 +429,7 @@ public:
|
||||||
bool mReadOnlySytemHeader;
|
bool mReadOnlySytemHeader;
|
||||||
bool mAutoLoadLastFiles;
|
bool mAutoLoadLastFiles;
|
||||||
bool mDefaultFileCpp;
|
bool mDefaultFileCpp;
|
||||||
|
bool mUseUTF8ByDefault;
|
||||||
|
|
||||||
//hints tooltip
|
//hints tooltip
|
||||||
bool mEnableTooltips;
|
bool mEnableTooltips;
|
||||||
|
|
|
@ -24,6 +24,7 @@ void EditorMiscWidget::doLoad()
|
||||||
} else {
|
} else {
|
||||||
ui->rbCFile->setChecked(true);
|
ui->rbCFile->setChecked(true);
|
||||||
}
|
}
|
||||||
|
ui->chkUseUTF8ByDefault->setChecked(pSettings->editor().useUTF8ByDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorMiscWidget::doSave()
|
void EditorMiscWidget::doSave()
|
||||||
|
@ -31,5 +32,6 @@ void EditorMiscWidget::doSave()
|
||||||
pSettings->editor().setReadOnlySytemHeader(ui->chkReadonlySystemHeaders->isChecked());
|
pSettings->editor().setReadOnlySytemHeader(ui->chkReadonlySystemHeaders->isChecked());
|
||||||
pSettings->editor().setAutoLoadLastFiles(ui->chkLoadLastFiles->isChecked());
|
pSettings->editor().setAutoLoadLastFiles(ui->chkLoadLastFiles->isChecked());
|
||||||
pSettings->editor().setDefaultFileCpp(ui->rbCppFile->isChecked());
|
pSettings->editor().setDefaultFileCpp(ui->rbCppFile->isChecked());
|
||||||
|
pSettings->editor().setUseUTF8ByDefault(ui->chkUseUTF8ByDefault->isChecked());
|
||||||
pSettings->editor().save();
|
pSettings->editor().save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>515</width>
|
||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -28,6 +28,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|
Loading…
Reference in New Issue