mirror of https://gitee.com/cxasm/notepad--.git
!52 Build Main App nodepad-- with QT6
Merge pull request !52 from troxyz/wip/build-with-qt6
This commit is contained in:
commit
e392ef0da9
|
@ -5,7 +5,8 @@ set(CMAKE_AUTOMOC ON)
|
|||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns)
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport Xml Core5Compat)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport Xml Core5Compat)
|
||||
|
||||
# qscint 关键依赖库
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint)
|
||||
|
@ -54,7 +55,17 @@ ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/lexlib
|
|||
${PROJECT_SOURCE_DIR}/src/qscint/scintilla/boostregex
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
qscint
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::Xml
|
||||
Qt${QT_VERSION_MAJOR}::Core5Compat
|
||||
)
|
||||
|
||||
# set(PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/bin")
|
||||
# set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
|
|
@ -281,7 +281,7 @@ quint32 CmpareMode::readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fi
|
|||
else if (mode == 2)
|
||||
{
|
||||
QString temp = lineInfo.unicodeStr;
|
||||
md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8());
|
||||
md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -529,7 +529,7 @@ CODE_ID CmpareMode::readLineFromFile(uchar* m_fileFpr, const int fileLength, con
|
|||
else if (mode == 2)
|
||||
{
|
||||
QString temp = lineInfo.unicodeStr;
|
||||
md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8());
|
||||
md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "batchfindreplace.h"
|
||||
#include "batchfindreplace.h"
|
||||
#include "scintillaeditview.h"
|
||||
#include "ccnotepad.h"
|
||||
#include "progresswin.h"
|
||||
|
@ -98,7 +98,7 @@ void BatchFindReplace::appendToFindReplaceTable(QStringList& findKeyword)
|
|||
bool BatchFindReplace::tranInputKeyword(QString& findKeyWord, QStringList& outputKeyWordList)
|
||||
{
|
||||
//把空白字符,空格或者\t \r\n 等字符进行替换为空格
|
||||
QRegExp re("\\s");
|
||||
QRegularExpression re("\\s");
|
||||
findKeyWord.replace(re, QString(" "));
|
||||
|
||||
//再进行空格分隔处理
|
||||
|
@ -266,7 +266,9 @@ void BatchFindReplace::on_export()
|
|||
if (!fileName.isEmpty())
|
||||
{
|
||||
QSettings setting(fileName, QSettings::IniFormat);
|
||||
setting.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
setting->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
int rowNums = ui.findReplaceTable->rowCount();
|
||||
|
||||
|
@ -312,7 +314,9 @@ void BatchFindReplace::on_import()
|
|||
QFileInfo fi(fileNameList[0]);
|
||||
|
||||
QSettings setting(fi.filePath(), QSettings::IniFormat);
|
||||
setting.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
setting->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
ui.findKeywordEdit->setPlainText(setting.value("find").toStringList().join(" "));
|
||||
ui.replaceKeywordEdit->setPlainText(setting.value("replace").toStringList().join(" "));
|
||||
|
|
|
@ -53,9 +53,11 @@
|
|||
#include <QDateTime>
|
||||
#include <QShortcut>
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#include <QXmlQuery>
|
||||
#include <QXmlFormatter>
|
||||
#endif
|
||||
#endif
|
||||
#include <QBuffer>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QJsonObject>
|
||||
|
@ -535,7 +537,9 @@ void initFileTypeLangMap()
|
|||
//把新语言tagName,和关联ext单独存放起来ext_tag.ini。只读取一个文件就能获取所有,避免遍历慢
|
||||
QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
QStringList keys = qs.allKeys();
|
||||
//LangType lexId = L_USER_TXT;
|
||||
|
@ -4730,7 +4734,7 @@ void CCNotePad::initFileListDockWin()
|
|||
}
|
||||
});
|
||||
m_dockFileListWin->setAttribute(Qt::WA_DeleteOnClose);
|
||||
m_dockFileListWin->layout()->setMargin(0);
|
||||
//m_dockFileListWin->layout()->setMargin(0);
|
||||
m_dockFileListWin->layout()->setSpacing(0);
|
||||
|
||||
//暂时不提供关闭,因为关闭后需要同步菜单的check状态
|
||||
|
@ -5149,8 +5153,8 @@ void CCNotePad::saveTabEdit(int tabIndex)
|
|||
|
||||
if (pEdit != nullptr)
|
||||
{
|
||||
//如果是新建的文件,则弹出保存对话框,进行保存
|
||||
if (pEdit->property(Edit_File_New) >= 0)
|
||||
//如果是新建的文件,则弹出保存对话框,进行保存
|
||||
if (pEdit->property(Edit_File_New).toInt() >= 0)
|
||||
{
|
||||
QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)");
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QString(), filter);
|
||||
|
@ -5317,7 +5321,7 @@ void CCNotePad::slot_actionSaveAsFile_toggle(bool /*checked*/)
|
|||
if (pEdit != nullptr)
|
||||
{
|
||||
//如果是新建的文件,则弹出保存对话框,进行保存
|
||||
if (pEdit->property(Edit_File_New) >= 0)
|
||||
if (pEdit->property(Edit_File_New).toInt() >= 0)
|
||||
{
|
||||
QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)");
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File As ..."),QString(), filter);
|
||||
|
@ -5619,7 +5623,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs)
|
|||
//把文件记录到qs中去
|
||||
//index一定不能重复。n表示新建
|
||||
//如果是新建的文件
|
||||
if (pEdit->property(Edit_File_New) >= 0)
|
||||
if (pEdit->property(Edit_File_New).toInt() >= 0)
|
||||
{
|
||||
//不再保存新建的非脏文件。因为一定是空的,意义不大
|
||||
//qs.setValue(QString("%1").arg(index), QString("%1|1").arg(fileName));
|
||||
|
@ -5639,7 +5643,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs)
|
|||
}
|
||||
|
||||
//如果是新建的文件
|
||||
if (pEdit->property(Edit_File_New) >= 0)
|
||||
if (pEdit->property(Edit_File_New).toInt() >= 0)
|
||||
{
|
||||
QString qsSavePath = qs.fileName();
|
||||
|
||||
|
@ -5771,7 +5775,9 @@ void CCNotePad::closeAllFileStatic()
|
|||
{
|
||||
QString tempFileList = QString("notepad/temp/list");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
QString qsSavePath = qs.fileName();
|
||||
QFileInfo fi(qsSavePath);
|
||||
QDir saveDir = fi.dir();
|
||||
|
@ -6312,7 +6318,9 @@ int CCNotePad::initFindWindow(FindTabIndex type)
|
|||
//从历史查找记录文件中加载
|
||||
QString searchHistory = QString("notepad/searchHistory");//历史查找记录
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
if (qs.contains("keys"))
|
||||
{
|
||||
|
@ -6412,7 +6420,9 @@ void CCNotePad::slot_saveSearchHistory()
|
|||
//从历史查找记录文件中加载
|
||||
QString searchHistory = QString("notepad/searchHistory");//历史查找记录
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
if (s_findHistroy.count() > 15)
|
||||
{
|
||||
|
@ -6639,7 +6649,7 @@ void CCNotePad::initFindResultDockWin()
|
|||
m_dockSelectTreeWin = new QDockWidget(tr("Find result"), this);
|
||||
connect(m_dockSelectTreeWin, &QDockWidget::dockLocationChanged, this, &CCNotePad::slot_findResultPosChangeed);
|
||||
|
||||
m_dockSelectTreeWin->layout()->setMargin(0);
|
||||
//m_dockSelectTreeWin->layout()->setMargin(0);
|
||||
m_dockSelectTreeWin->layout()->setSpacing(0);
|
||||
|
||||
//暂时不提供关闭,因为关闭后需要同步菜单的check状态
|
||||
|
@ -7561,7 +7571,7 @@ bool CCNotePad::nativeOpenfile(QString openFilePath)
|
|||
this->activateWindow();
|
||||
return true;
|
||||
}
|
||||
bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, long * result)
|
||||
bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, qintptr * result)
|
||||
{
|
||||
MSG *param = static_cast<MSG *>(message);
|
||||
|
||||
|
@ -8111,7 +8121,9 @@ int CCNotePad::restoreLastFiles()
|
|||
|
||||
QString tempFileList = QString("notepad/temp/list");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
QStringList fileList = qs.allKeys();
|
||||
//从小到大排序一下。这里是按照ASCII排序,不得行。
|
||||
|
|
|
@ -196,7 +196,7 @@ protected:
|
|||
void dropEvent(QDropEvent* e) override;
|
||||
bool eventFilter(QObject *watched, QEvent *event)override;
|
||||
#ifdef Q_OS_WIN
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||||
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||
bool nativeOpenfile(QString openFilePath);
|
||||
#endif
|
||||
#ifdef uos
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "draglineedit.h"
|
||||
#include "draglineedit.h"
|
||||
#include <QFile>
|
||||
|
||||
DragLineEdit::DragLineEdit(QWidget *parent)
|
||||
: QLineEdit(parent)
|
||||
: QLineEdit(parent)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
|
||||
DragLineEdit::~DragLineEdit()
|
||||
|
@ -28,25 +29,25 @@ void DragLineEdit::dragMoveEvent(QDragMoveEvent* )
|
|||
|
||||
void DragLineEdit::dropEvent(QDropEvent* e)
|
||||
{
|
||||
QList<QUrl> urls = e->mimeData()->urls();
|
||||
if (urls.isEmpty())
|
||||
return;
|
||||
QList<QUrl> urls = e->mimeData()->urls();
|
||||
if (urls.isEmpty())
|
||||
return;
|
||||
|
||||
QString fileName = urls.first().toLocalFile();
|
||||
QString fileName = urls.first().toLocalFile();
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QFile::exists(fileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!QFile::exists(fileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->setText(fileName);
|
||||
this->setText(fileName);
|
||||
|
||||
e->accept();
|
||||
e->accept();
|
||||
|
||||
emit this->returnPressed();
|
||||
emit this->returnPressed();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <QtConcurrent>
|
||||
#include <QInputDialog>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QTextCodec>
|
||||
|
||||
|
||||
const int ITEM_CODE = Qt::UserRole + 1;
|
||||
|
|
|
@ -208,12 +208,12 @@ void FindResultWin::slot_selectAll()
|
|||
//遍历下面的子节点
|
||||
int i = 0;
|
||||
QModelIndex childMi;
|
||||
childMi = sectionItem.child(i, 0);
|
||||
childMi = sectionItem.model()->index(i, 0);
|
||||
while (childMi.isValid())
|
||||
{
|
||||
++i;
|
||||
ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select);
|
||||
childMi = sectionItem.child(i, 0);
|
||||
childMi = sectionItem.model()->index(i, 0);
|
||||
}
|
||||
return i+1;
|
||||
};
|
||||
|
@ -226,12 +226,12 @@ void FindResultWin::slot_selectAll()
|
|||
//遍历根节点下面每一个section
|
||||
{
|
||||
int i = 0;
|
||||
QModelIndex section = rootItem.child(i, 0);
|
||||
QModelIndex section = rootItem.model()->index(i, 0);
|
||||
while (section.isValid() && !section.data(ResultItemEditor).isNull())
|
||||
{
|
||||
++i;
|
||||
selectCount += selectSection(section);
|
||||
section = firstRootItem.child(i, 0);
|
||||
section = firstRootItem.model()->index(i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,12 +255,12 @@ void FindResultWin::slot_selectSection()
|
|||
//遍历下面的子节点
|
||||
int i = 0;
|
||||
QModelIndex childMi;
|
||||
childMi = sectionItem.child(i, 0);
|
||||
childMi = sectionItem.model()->index(i, 0);
|
||||
while (childMi.isValid())
|
||||
{
|
||||
++i;
|
||||
ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select);
|
||||
childMi = sectionItem.child(i, 0);
|
||||
childMi = sectionItem.model()->index(i, 0);
|
||||
}
|
||||
return i+1;
|
||||
};
|
||||
|
@ -453,7 +453,7 @@ QString FindResultWin::highlightFindText(FindRecord& record)
|
|||
head = QString("<font style='font-size:14px;'>%1</font>").arg(head);
|
||||
src = QString("<font style='font-size:14px;background-color:#ffffbf'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
|
||||
tail = QString(utf8bytes.mid(tailStart));
|
||||
if (tail > MAX_TAIL_LENGTH)
|
||||
if (tail.size() > MAX_TAIL_LENGTH)
|
||||
{
|
||||
tail = (tail.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped();
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ QString FindResultWin::highlightFindText(FindRecord& record)
|
|||
src = QString("<font style='font-size:14px;font-weight:bold;color:#ffaa00'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
|
||||
|
||||
QString tailContens = QString(utf8bytes.mid(tailStart));
|
||||
if (tailContens > MAX_TAIL_LENGTH)
|
||||
if (tailContens.size() > MAX_TAIL_LENGTH)
|
||||
{
|
||||
tailContens = (tailContens.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped();
|
||||
}
|
||||
|
|
|
@ -620,9 +620,9 @@ bool readBase(const QChar * str, int * value, int base, int size)
|
|||
{
|
||||
current = str[i];
|
||||
if (current >= 'A')
|
||||
{
|
||||
current = current.digitValue() & 0xdf;
|
||||
current = current.digitValue() - ('A' - '0' - 10);
|
||||
{
|
||||
current = QChar(current.digitValue() & 0xdf);
|
||||
current = QChar(current.digitValue() - ('A' - '0' - 10));
|
||||
}
|
||||
else if (current > '9')
|
||||
return false;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <QHeaderView>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QFile>
|
||||
|
||||
int ITEM_CHANGED = Qt::UserRole;
|
||||
int ITEM_LEX_ID = Qt::UserRole + 1; //对应的语法lexer的 ID
|
||||
|
@ -112,8 +113,10 @@ void LangExtSet::slot_save()
|
|||
int rowNums = ui.langTableWidget->rowCount();
|
||||
|
||||
QString userLangFile = QString("notepad/tag_ext");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < rowNums; ++i)
|
||||
{
|
||||
|
@ -180,7 +183,9 @@ void LangExtSet::loadExtRelevanceToMagr()
|
|||
{
|
||||
QString userLangFile = QString("notepad/tag_ext");//自定义语言中不能有.字符,否则可能有错,后续要检查
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
if (!QFile::exists(qs.fileName()))
|
||||
{
|
||||
|
|
|
@ -30,8 +30,10 @@ bool LangStyleDefine::readLangSetFile(QString langName, bool isLoadToUI)
|
|||
{
|
||||
QString userLangFile = QString("notepad/userlang/%1").arg(langName);//自定义语言中不能有.字符,否则可能有错,后续要检查
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
qDebug() << qs.fileName();
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
//qDebug() << qs.fileName();
|
||||
|
||||
if (!qs.contains("mz"))
|
||||
{
|
||||
|
@ -160,7 +162,9 @@ void LangStyleDefine::slot_save()
|
|||
//把新语言tagName,和关联ext单独存放起来。后面只读取一个文件就能获取所有,避免遍历慢
|
||||
QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
QStringList extList = ui.extNameLe->text().trimmed().split(" ");
|
||||
extList.append(QString::number(motherLangs)); //最后一个是mother lexer
|
||||
|
@ -201,7 +205,9 @@ void LangStyleDefine::slot_delete()
|
|||
{
|
||||
QString userLangFile = QString("notepad/userlang/%1").arg(name);//自定义语言中不能有.字符,否则可能有错,后续要检查
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
//删除userlang下面的tag.ini
|
||||
QFile::remove(qs.fileName());
|
||||
|
@ -211,7 +217,9 @@ void LangStyleDefine::slot_delete()
|
|||
//把新语言在ext_tag中的关联文件记录也删除
|
||||
QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
QStringList extList = qs.value(name).toStringList();
|
||||
//更新当前ExtLexerManager::getInstance()。如果不更新,就要重启软件才能生效
|
||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -1,4 +1,4 @@
|
|||
#include "ccnotepad.h"
|
||||
#include "ccnotepad.h"
|
||||
#include "nddsetting.h"
|
||||
#include "styleset.h"
|
||||
|
||||
|
@ -23,11 +23,20 @@
|
|||
|
||||
#ifdef Q_OS_WIN
|
||||
#pragma comment(lib, "user32.lib")
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#if _DEBUG
|
||||
#pragma comment(lib, "qmyedit_qt5d.lib")
|
||||
#else
|
||||
#pragma comment(lib, "qmyedit_qt5.lib")
|
||||
#endif
|
||||
#else
|
||||
#if _DEBUG
|
||||
#pragma comment(lib, "qmyedit_qt6d.lib")
|
||||
#else
|
||||
#pragma comment(lib, "qmyedit_qt6.lib")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <qt_windows.h>
|
||||
const ULONG_PTR CUSTOM_TYPE = 10000;
|
||||
const ULONG_PTR OPEN_NOTEPAD_TYPE = 10001;
|
||||
|
|
|
@ -25,20 +25,20 @@ bool NddSetting::checkNoExistAdd(QString key, QVariant& value)
|
|||
{
|
||||
s_nddSet->setValue(key, value);
|
||||
|
||||
if (!s_isContentChanged)
|
||||
{
|
||||
s_isContentChanged = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if (!s_isContentChanged)
|
||||
{
|
||||
s_isContentChanged = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//20220402这里隐含了一个前置条件:数据库句柄是在主线程创建的,最好不要在子线程中调用。
|
||||
//避免因为跨线程访问和多线程冲突访问引发的闪退问题。所以最好配置文件的读写都在主线程中进行
|
||||
void NddSetting::init()
|
||||
{
|
||||
++s_reference;
|
||||
++s_reference;
|
||||
|
||||
//如果已经初始化过了,则直接返回
|
||||
if (s_isExistDb)
|
||||
|
@ -49,9 +49,11 @@ void NddSetting::init()
|
|||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
QString qsSetPath = qs.fileName();
|
||||
|
||||
s_nddSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
s_nddSet->setIniCodec("UTF-8");
|
||||
bool initOk = true;
|
||||
s_nddSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
s_nddSet->setIniCodec("UTF-8");
|
||||
#endif
|
||||
bool initOk = true;
|
||||
|
||||
auto initNddSet = []() {
|
||||
QString key = "signdate";
|
||||
|
@ -60,21 +62,21 @@ void NddSetting::init()
|
|||
//直接写一个过去的时间,让第一次运行,总是要签到
|
||||
addKeyValueToSets(key, "2022/2/20");
|
||||
|
||||
QString str;
|
||||
QString str;
|
||||
|
||||
//tab的长度,默认为4
|
||||
addKeyValueToNumSets("tablens", 4);
|
||||
//space replace tab空格替换tab,默认0, 1为true,0为false
|
||||
addKeyValueToNumSets("tabnouse", 0);
|
||||
|
||||
addKeyValueToSets("mac", "0");
|
||||
addKeyValueToNumSets("padtimes", 0);
|
||||
addKeyValueToNumSets("serverip", 0);
|
||||
addKeyValueToSets("mac", "0");
|
||||
addKeyValueToNumSets("padtimes", 0);
|
||||
addKeyValueToNumSets("serverip", 0);
|
||||
|
||||
//是否高亮不同处背景
|
||||
addKeyValueToNumSets("hexhigh", 1);
|
||||
|
||||
addKeyValueToNumSets(VERSION, version_num);
|
||||
addKeyValueToNumSets(VERSION, version_num);
|
||||
|
||||
//皮肤id
|
||||
addKeyValueToNumSets(SKIN_KEY, 0);
|
||||
|
@ -94,18 +96,18 @@ void NddSetting::init()
|
|||
//最大文本文件的门限。默认100M.(50-300)
|
||||
addKeyValueToNumSets(MAX_BIG_TEXT, 100);
|
||||
|
||||
addKeyValueToSets(SOFT_KEY, "0");
|
||||
addKeyValueToSets(SOFT_KEY, "0");
|
||||
|
||||
addKeyValueToSets(RESTORE_CLOSE_FILE, "1");
|
||||
addKeyValueToSets(RESTORE_CLOSE_FILE, "1");
|
||||
|
||||
//0 24 1 36 2 48
|
||||
addKeyValueToNumSets(ICON_SIZE, 1);
|
||||
//0 24 1 36 2 48
|
||||
addKeyValueToNumSets(ICON_SIZE, 1);
|
||||
|
||||
addKeyValueToNumSets(ZOOMVALUE, 100);
|
||||
addKeyValueToNumSets(ZOOMVALUE, 100);
|
||||
|
||||
addKeyValueToNumSets(FINDRESULTPOS, Qt::BottomDockWidgetArea);
|
||||
addKeyValueToNumSets(FINDRESULTPOS, Qt::BottomDockWidgetArea);
|
||||
|
||||
addKeyValueToNumSets(FILELISTPOS, Qt::LeftDockWidgetArea);
|
||||
addKeyValueToNumSets(FILELISTPOS, Qt::LeftDockWidgetArea);
|
||||
|
||||
//默认0不显示
|
||||
addKeyValueToNumSets(FILELISTSHOW, 0);
|
||||
|
@ -152,86 +154,86 @@ void NddSetting::init()
|
|||
checkNoExistAdd(SKIN_KEY, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant langs(0);
|
||||
checkNoExistAdd(LANGS_KEY, langs);
|
||||
}
|
||||
{
|
||||
QVariant langs(0);
|
||||
checkNoExistAdd(LANGS_KEY, langs);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(AUTOWARP_KEY, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(AUTOWARP_KEY, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(INDENT_KEY, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(INDENT_KEY, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(SHOWSPACE_KEY, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(SHOWSPACE_KEY, v);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
QVariant v(100);
|
||||
checkNoExistAdd(MAX_BIG_TEXT, v);
|
||||
}
|
||||
{
|
||||
QVariant v(100);
|
||||
checkNoExistAdd(MAX_BIG_TEXT, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(SOFT_STATUS, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(SOFT_STATUS, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v("0");
|
||||
checkNoExistAdd(SOFT_KEY, v);
|
||||
}
|
||||
{
|
||||
QVariant v("0");
|
||||
checkNoExistAdd(SOFT_KEY, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v(1);
|
||||
checkNoExistAdd(RESTORE_CLOSE_FILE, v);
|
||||
}
|
||||
{
|
||||
QVariant v(1);
|
||||
checkNoExistAdd(RESTORE_CLOSE_FILE, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v(1);
|
||||
checkNoExistAdd(ICON_SIZE, v);
|
||||
}
|
||||
{
|
||||
QVariant v(1);
|
||||
checkNoExistAdd(ICON_SIZE, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v(100);
|
||||
checkNoExistAdd(ZOOMVALUE, v);
|
||||
}
|
||||
{
|
||||
QVariant v(Qt::BottomDockWidgetArea);
|
||||
checkNoExistAdd(FINDRESULTPOS, v);
|
||||
}
|
||||
{
|
||||
QVariant v(100);
|
||||
checkNoExistAdd(ZOOMVALUE, v);
|
||||
}
|
||||
{
|
||||
QVariant v(Qt::BottomDockWidgetArea);
|
||||
checkNoExistAdd(FINDRESULTPOS, v);
|
||||
}
|
||||
|
||||
{
|
||||
QVariant v(Qt::LeftDockWidgetArea);
|
||||
checkNoExistAdd(FILELISTPOS, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(FILELISTSHOW, v);
|
||||
}
|
||||
{
|
||||
QVariant v(1);
|
||||
checkNoExistAdd(TOOLBARSHOW, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(SHOWWEBADDR, v);
|
||||
}
|
||||
{
|
||||
QVariant v(14);
|
||||
checkNoExistAdd(FIND_RESULT_FONT_SIZE, v);
|
||||
}
|
||||
} while (false);
|
||||
{
|
||||
QVariant v(Qt::LeftDockWidgetArea);
|
||||
checkNoExistAdd(FILELISTPOS, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(FILELISTSHOW, v);
|
||||
}
|
||||
{
|
||||
QVariant v(1);
|
||||
checkNoExistAdd(TOOLBARSHOW, v);
|
||||
}
|
||||
{
|
||||
QVariant v(0);
|
||||
checkNoExistAdd(SHOWWEBADDR, v);
|
||||
}
|
||||
{
|
||||
QVariant v(14);
|
||||
checkNoExistAdd(FIND_RESULT_FONT_SIZE, v);
|
||||
}
|
||||
} while (false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
s_isExistDb = initOk;
|
||||
s_isExistDb = initOk;
|
||||
|
||||
}
|
||||
|
||||
|
@ -240,65 +242,65 @@ void NddSetting::init()
|
|||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
|
||||
QString NddSetting::getKeyValueFromSets(QString key)
|
||||
{
|
||||
return s_nddSet->value(key,"").toString();
|
||||
return s_nddSet->value(key,"").toString();
|
||||
}
|
||||
|
||||
bool NddSetting::updataKeyValueFromSets(QString key, QString value)
|
||||
{
|
||||
s_nddSet->setValue(key,value);
|
||||
s_isContentChanged = true;
|
||||
return true;
|
||||
s_nddSet->setValue(key,value);
|
||||
s_isContentChanged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口
|
||||
QByteArray NddSetting::getKeyByteArrayValue(QString key)
|
||||
{
|
||||
return s_nddSet->value(key, "").toByteArray();
|
||||
return s_nddSet->value(key, "").toByteArray();
|
||||
}
|
||||
|
||||
void NddSetting::updataKeyByteArrayValue(QString key, QByteArray& value)
|
||||
{
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
s_isContentChanged = true;
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
s_isContentChanged = true;
|
||||
}
|
||||
|
||||
//第一次加一条记录,用于初始化
|
||||
void NddSetting::addKeyValueToSets(QString key, QString value)
|
||||
{
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
}
|
||||
|
||||
|
||||
//写一个总的获取配置的接口,避免以后每个字段都需要写一个读写接口.0做默认值,外部最好不用0做初始化值
|
||||
int NddSetting::getKeyValueFromNumSets(const QString key)
|
||||
{
|
||||
QVariant v = s_nddSet->value(key, QVariant(0));
|
||||
return v.toInt();
|
||||
QVariant v = s_nddSet->value(key, QVariant(0));
|
||||
return v.toInt();
|
||||
}
|
||||
|
||||
bool NddSetting::updataKeyValueFromNumSets(const QString key, int value)
|
||||
{
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
return true;
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//第一次加一条记录,用于初始化
|
||||
void NddSetting::addKeyValueToNumSets(QString key, int value)
|
||||
{
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
s_nddSet->setValue(key, QVariant(value));
|
||||
}
|
||||
|
||||
|
||||
void NddSetting::close()
|
||||
{
|
||||
if (s_reference > 0)
|
||||
{
|
||||
--s_reference;
|
||||
if (s_reference > 0)
|
||||
{
|
||||
--s_reference;
|
||||
|
||||
if (s_reference == 0)
|
||||
{
|
||||
s_isExistDb = false;
|
||||
if (s_reference == 0)
|
||||
{
|
||||
s_isExistDb = false;
|
||||
|
||||
//做一次真正的保存
|
||||
if (s_isContentChanged)
|
||||
|
@ -322,25 +324,27 @@ void NddSetting::close()
|
|||
//子窗口的位置,单独放在一个winpos.ini文件中,而且启动程序时,不需要读取,可避免启动时拖慢速度
|
||||
QByteArray NddSetting::getWinPos(QString key)
|
||||
{
|
||||
winPosInit();
|
||||
return s_winPosSet->value(key, "").toByteArray();
|
||||
winPosInit();
|
||||
return s_winPosSet->value(key, "").toByteArray();
|
||||
}
|
||||
|
||||
void NddSetting::updataWinPos(QString key, QByteArray& value)
|
||||
{
|
||||
winPosInit();
|
||||
s_winPosSet->setValue(key, QVariant(value));
|
||||
winPosInit();
|
||||
s_winPosSet->setValue(key, QVariant(value));
|
||||
}
|
||||
|
||||
void NddSetting::winPosInit()
|
||||
{
|
||||
if (s_winPosSet == nullptr)
|
||||
{
|
||||
QString settingDir = QString("notepad/delayset");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
QString qsSetPath = qs.fileName();
|
||||
if (s_winPosSet == nullptr)
|
||||
{
|
||||
QString settingDir = QString("notepad/delayset");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
QString qsSetPath = qs.fileName();
|
||||
|
||||
s_winPosSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
s_winPosSet->setIniCodec("UTF-8");
|
||||
}
|
||||
s_winPosSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
s_winPosSet->setIniCodec("UTF-8");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@ set(CMAKE_AUTOMOC ON)
|
|||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns)
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport Xml)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport Xml)
|
||||
|
||||
add_definitions(-D_UNICODE -DUNICODE)
|
||||
|
||||
|
@ -31,7 +32,15 @@ ${PROJECT_SOURCE_DIR}/../../qscint/scintilla/lexlib
|
|||
${PROJECT_SOURCE_DIR}/../../qscint/scintilla/boostregex
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
qscint
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::Xml)
|
||||
|
||||
# if(NOT DEFINED ${notepad--_BINARY_DIR})
|
||||
# set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${notepad--_BINARY_DIR}/bin/plugin)
|
||||
|
|
|
@ -5,7 +5,8 @@ set(CMAKE_AUTOMOC ON)
|
|||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport)
|
||||
find_package(Qt$ NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets PrintSupport)
|
||||
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)
|
||||
aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/lexers SRC)
|
||||
|
@ -35,12 +36,18 @@ ${PROJECT_SOURCE_DIR}/src/Qsci
|
|||
${PROJECT_SOURCE_DIR}/scintilla/src
|
||||
${PROJECT_SOURCE_DIR}/scintilla/include)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Concurrent
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport)
|
||||
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "qmyedit_qt5")
|
||||
else()
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "qmyedit_qt5d")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "qmyedit_qt${QT_VERSION_MAJOR}d")
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// This module implements the QsciLexer class.
|
||||
// This module implements the QsciLexer class.
|
||||
//
|
||||
// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
|
||||
//
|
||||
|
@ -907,7 +907,9 @@ const char* QsciLexer::getUserDefineKeywords()
|
|||
|
||||
QString userLangFile = QString("notepad/userlang/%1").arg(m_tagName);//自定义语言中不能有.字符,否则可能有错,后续要检查
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
if (!qs.contains("mz"))
|
||||
{
|
||||
|
|
|
@ -826,7 +826,9 @@ bool QtLangSet::readLangSetFile(QString langName,QString &keyword, QString &moth
|
|||
{
|
||||
QString userLangFile = QString("notepad/userlang/%1").arg(langName);//自定义语言中不能有.字符,否则可能有错,后续要检查
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs.setIniCodec("UTF-8");
|
||||
#endif
|
||||
//qDebug() << qs.fileName();
|
||||
|
||||
if (!qs.contains("mz"))
|
||||
|
|
|
@ -3307,8 +3307,8 @@ bool isUrlQueryDelimiter(QChar const c)
|
|||
|
||||
void scanToUrlEnd(QString & text, int textLen, int start, int* distance)
|
||||
{
|
||||
int p = start;
|
||||
QChar q = 0;
|
||||
int p = start;
|
||||
QChar q{0};
|
||||
enum { sHostAndPath, sQuery, sQueryAfterDelimiter, sQueryQuotes, sQueryAfterQuotes, sFragment } s = sHostAndPath;
|
||||
while (p < textLen)
|
||||
{
|
||||
|
|
|
@ -139,7 +139,9 @@ void ShortcutKeyMgr::loadUserDefSet()
|
|||
{
|
||||
QString userDefFile = QString("notepad/shortcuttab");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userDefFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
QStringList keys = qs.allKeys();
|
||||
|
||||
|
@ -164,7 +166,9 @@ bool ShortcutKeyMgr::ModifyShortCutKey(QString initTag, QString keySeqStr)
|
|||
{
|
||||
QString userDefFile = QString("notepad/shortcuttab");
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userDefFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
if (s_shortcutKeysMap->contains(initTag))
|
||||
{
|
||||
|
|
|
@ -24,7 +24,9 @@ bool UserLexDef::readUserSettings(QString langTagName)
|
|||
|
||||
QString userLangFile = QString("notepad/userlang/%1").arg(langTagName);
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
if (!qs.contains(QString("mz")))
|
||||
{
|
||||
|
@ -93,7 +95,9 @@ bool UserLexDef::writeUserSettings(QString langTagName)
|
|||
|
||||
QString userLangFile = QString("notepad/userlang/%1").arg(langTagName);
|
||||
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
|
||||
qs.setIniCodec("UTF-8");
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
qs->setIniCodec("UTF-8");
|
||||
#endif
|
||||
qs.clear();
|
||||
|
||||
qs.setValue("mz", langTagName);
|
||||
|
|
Loading…
Reference in New Issue