base-4c8661d74aa78ea504a9a2f8b06139d571caed3d-linux-qt6.patch 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  1. From 34d458cf82810609bee2c85f1eb772bbef40a152 Mon Sep 17 00:00:00 2001
  2. From: zinface <[email protected]>
  3. Date: Mon, 6 Feb 2023 16:40:36 +0800
  4. Subject: [PATCH] =?UTF-8?q?linux-qt6:=20=E6=B7=BB=E5=8A=A0=E7=94=A8?=
  5. =?UTF-8?q?=E4=BA=8E=20Qt6=20=E7=BC=96=E8=AF=91=E7=9A=84=E7=9B=B8=E5=85=B3?=
  6. =?UTF-8?q?=E5=8F=98=E6=9B=B4?=
  7. MIME-Version: 1.0
  8. Content-Type: text/plain; charset=UTF-8
  9. Content-Transfer-Encoding: 8bit
  10. ---
  11. src/CmpareMode.cpp | 4 +-
  12. src/Encode.cpp | 2 +-
  13. src/RealCompare.pro | 44 ++++++++++----------
  14. src/batchfindreplace.cpp | 6 +--
  15. src/cceditor/ccnotepad.cpp | 64 ++++++++++++++--------------
  16. src/columnedit.cpp | 4 +-
  17. src/ctipwin.cpp | 2 +-
  18. src/draglineedit.cpp | 1 +
  19. src/encodeconvert.cpp | 2 +-
  20. src/findresultwin.cpp | 26 +++++++-----
  21. src/findwin.cpp | 4 +-
  22. src/langstyledefine.cpp | 8 ++--
  23. src/nddsetting.cpp | 2 +-
  24. src/qscint/src/qscilexer.cpp | 4 +-
  25. src/qscint/src/qscintilla.pro | 18 ++------
  26. src/qtlangset.cpp | 78 +++++++++++++++++------------------
  27. src/scintillaeditview.cpp | 8 ++--
  28. src/userlexdef.cpp | 6 +--
  29. 18 files changed, 139 insertions(+), 144 deletions(-)
  30. diff --git a/src/CmpareMode.cpp b/src/CmpareMode.cpp
  31. index b8fb335..1245275 100755
  32. --- a/src/CmpareMode.cpp
  33. +++ b/src/CmpareMode.cpp
  34. @@ -181,7 +181,7 @@ quint32 CmpareMode::readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fi
  35. else if (mode == 2)
  36. {
  37. QString temp = lineInfo.unicodeStr;
  38. - md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8());
  39. + md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8());
  40. }
  41. };
  42. @@ -429,7 +429,7 @@ CODE_ID CmpareMode::readLineFromFile(uchar* m_fileFpr, const int fileLength, con
  43. else if (mode == 2)
  44. {
  45. QString temp = lineInfo.unicodeStr;
  46. - md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8());
  47. + md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8());
  48. }
  49. };
  50. diff --git a/src/Encode.cpp b/src/Encode.cpp
  51. index 2164880..9fd8af1 100755
  52. --- a/src/Encode.cpp
  53. +++ b/src/Encode.cpp
  54. @@ -1,6 +1,6 @@
  55. 锘�#include "Encode.h"
  56. #include <QTextCodec>
  57. -#include <QtDebug>
  58. +#include <QDebug>
  59. /* 妫€鏌ュ瓧绗︿覆缂栫爜鐨勭被銆傜湅浜嗗ぇ閲忔枃鐚�紝缁撹�濡備笅锛�
  60. *濡傛灉鏄疷TF BOM鏍煎紡锛屾垨鑰匲NICODE鏍煎紡锛屽叾鏂囦欢澶撮儴鍓嶅嚑涓�瓧鑺傦紙2-3锛夋湁涓€瀹氱殑鏍囪瘑銆傜敱姝ゆ爣璇嗙洿鎺ユ寜瀵瑰簲缂栫爜澶勭悊銆�
  61. diff --git a/src/RealCompare.pro b/src/RealCompare.pro
  62. index 1035414..0da717e 100755
  63. --- a/src/RealCompare.pro
  64. +++ b/src/RealCompare.pro
  65. @@ -3,9 +3,9 @@ LANGUAGE = C++
  66. TARGET = Notepad--
  67. -CONFIG += qt warn_on Debug
  68. +CONFIG += qt warn_on
  69. -QT += core gui widgets concurrent network xmlpatterns
  70. +QT += core gui widgets concurrent network core5compat
  71. HEADERS += *.h \
  72. @@ -33,47 +33,47 @@ INCLUDEPATH += cceditor
  73. TRANSLATIONS += realcompare_zh.ts
  74. - if(contains(QMAKE_HOST.arch, x86_64)){
  75. - CONFIG(Debug, Debug|Release){
  76. + if(contains(QMAKE_HOST.arch, x86_64|loongarch64)){
  77. + CONFIG(debug, debug|release){
  78. DESTDIR = x64/Debug
  79. - LIBS += -Lx64/Debug
  80. - LIBS += -lqmyedit_qt5d
  81. + LIBS += -Lx64/Debug
  82. + LIBS += -lqmyedit_qt6d
  83. }else{
  84. DESTDIR = x64/Release
  85. LIBS += -Lx64/Release
  86. - LIBS += -lqmyedit_qt5
  87. + LIBS += -lqmyedit_qt6
  88. #QMAKE_CXXFLAGS += /openmp
  89. }
  90. - }
  91. +}
  92. +
  93. unix{
  94. -if(CONFIG(debug, Debug|Release)){
  95. - LIBS += -L/home/yzw/build/CCNotePad/x64/Debug -lqmyedit_qt5
  96. + if(CONFIG(debug, debug|release)){
  97. + LIBS += -L/home/yzw/build/CCNotePad/x64/Debug -lqmyedit_qt6
  98. -QMAKE_CXXFLAGS += -fopenmp
  99. -LIBS += -lgomp -lpthread
  100. + QMAKE_CXXFLAGS += -fopenmp
  101. + LIBS += -lgomp -lpthread
  102. }else{
  103. - LIBS += -L/home/yzw/build/CCNotePad/x64/Release -lqmyedit_qt5
  104. + LIBS += -L/home/yzw/build/CCNotePad/x64/Release -lqmyedit_qt6
  105. DESTDIR = x64/Release
  106. QMAKE_CXXFLAGS += -fopenmp -O2
  107. LIBS += -lgomp -lpthread
  108. }
  109. - }
  110. -
  111. +}
  112. RC_FILE += RealCompare.rc
  113. +
  114. unix
  115. {
  116. -
  117. -INCLUDEPATH += $$PWD/.
  118. -DEPENDPATH += $$PWD/.
  119. + INCLUDEPATH += $$PWD/.
  120. + DEPENDPATH += $$PWD/.
  121. -unix:!macx: LIBS += -L$$PWD/x64/Release/ -lqmyedit_qt5
  122. + unix:!macx: LIBS += -L$$PWD/x64/Release/ -lqmyedit_qt6
  123. -INCLUDEPATH += $$PWD/x64/Release
  124. -DEPENDPATH += $$PWD/x64/Release
  125. + INCLUDEPATH += $$PWD/x64/Release
  126. + DEPENDPATH += $$PWD/x64/Release
  127. -unix:!macx: PRE_TARGETDEPS += $$PWD/x64/Release/libqmyedit_qt5.a
  128. + unix:!macx: PRE_TARGETDEPS += $$PWD/x64/Release/libqmyedit_qt6.a
  129. }
  130. diff --git a/src/batchfindreplace.cpp b/src/batchfindreplace.cpp
  131. index cb071c3..2602e3c 100755
  132. --- a/src/batchfindreplace.cpp
  133. +++ b/src/batchfindreplace.cpp
  134. @@ -89,7 +89,7 @@ void BatchFindReplace::appendToFindReplaceTable(QStringList& findKeyword)
  135. bool BatchFindReplace::tranInputKeyword(QString& findKeyWord, QStringList& outputKeyWordList)
  136. {
  137. //把空白字符,空格或者\t \r\n 等字符进行替换为空格
  138. - QRegExp re("\\s");
  139. + QRegularExpression re("\\s");
  140. findKeyWord.replace(re, QString(" "));
  141. //再进行空格分隔处理
  142. @@ -257,7 +257,7 @@ void BatchFindReplace::on_export()
  143. if (!fileName.isEmpty())
  144. {
  145. QSettings setting(fileName, QSettings::IniFormat);
  146. - setting.setIniCodec("UTF-8");
  147. +// setting.setIniCodec("UTF-8");
  148. int rowNums = ui.findReplaceTable->rowCount();
  149. @@ -303,7 +303,7 @@ void BatchFindReplace::on_import()
  150. QFileInfo fi(fileNameList[0]);
  151. QSettings setting(fi.filePath(), QSettings::IniFormat);
  152. - setting.setIniCodec("UTF-8");
  153. +// setting.setIniCodec("UTF-8");
  154. ui.findKeywordEdit->setPlainText(setting.value("find").toStringList().join(" "));
  155. ui.replaceKeywordEdit->setPlainText(setting.value("replace").toStringList().join(" "));
  156. diff --git a/src/cceditor/ccnotepad.cpp b/src/cceditor/ccnotepad.cpp
  157. index 1f04879..5efe091 100755
  158. --- a/src/cceditor/ccnotepad.cpp
  159. +++ b/src/cceditor/ccnotepad.cpp
  160. @@ -507,7 +507,7 @@ void initFileTypeLangMap()
  161. //鎶婃柊璇�█tagName,鍜屽叧鑱攅xt鍗曠嫭瀛樻斁璧锋潵ext_tag.ini銆傚彧璇诲彇涓€涓�枃浠跺氨鑳借幏鍙栨墍鏈夛紝閬垮厤閬嶅巻鎱�
  162. QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag鏄�瓨鍦ㄦ墍鏈塼ag ext鐨勬枃浠�
  163. QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
  164. - qs.setIniCodec("UTF-8");
  165. +// qs.setIniCodec("UTF-8");
  166. QStringList keys = qs.allKeys();
  167. //LangType lexId = L_USER_TXT;
  168. @@ -3981,7 +3981,7 @@ void CCNotePad::initFileListDockWin()
  169. }
  170. });
  171. m_dockFileListWin->setAttribute(Qt::WA_DeleteOnClose);
  172. - m_dockFileListWin->layout()->setMargin(0);
  173. + m_dockFileListWin->layout()->setContentsMargins(0, 0, 0, 0);
  174. m_dockFileListWin->layout()->setSpacing(0);
  175. //鏆傛椂涓嶆彁渚涘叧闂�紝鍥犱负鍏抽棴鍚庨渶瑕佸悓姝ヨ彍鍗曠殑check鐘舵€�
  176. @@ -4312,7 +4312,7 @@ void CCNotePad::slot_actionSaveFile_toggle(bool /*checked*/)
  177. if (pEdit != nullptr)
  178. {
  179. //濡傛灉鏄�柊寤虹殑鏂囦欢锛屽垯寮瑰嚭淇濆瓨瀵硅瘽妗嗭紝杩涜�淇濆瓨
  180. - if (pEdit->property(Edit_File_New) >= 0)
  181. + if (pEdit->property(Edit_File_New).toString().length() >= 0)
  182. {
  183. QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)");
  184. QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QString(), filter);
  185. @@ -4472,7 +4472,7 @@ void CCNotePad::slot_actionSaveAsFile_toggle(bool /*checked*/)
  186. if (pEdit != nullptr)
  187. {
  188. //濡傛灉鏄�柊寤虹殑鏂囦欢锛屽垯寮瑰嚭淇濆瓨瀵硅瘽妗嗭紝杩涜�淇濆瓨
  189. - if (pEdit->property(Edit_File_New) >= 0)
  190. + if (pEdit->property(Edit_File_New).toString().length() >= 0)
  191. {
  192. QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)");
  193. QString fileName = QFileDialog::getSaveFileName(this, tr("Save File As ..."),QString(), filter);
  194. @@ -4763,7 +4763,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs)
  195. return;
  196. }
  197. - QVariant v = pEdit->property(Edit_Text_Change);
  198. + QVariant v = pEdit->property(Edit_Text_Change);
  199. bool isDirty = v.toBool();
  200. //涓嶈剰鍒欎笉闇€瑕佷繚瀛橈紝鐩存帴璺宠繃銆備笉鑴忕殑鏂囦欢锛屽彧璁板綍1涓�悕绉帮紝涓嬫�鎵撳紑鏃舵仮澶�
  201. @@ -4773,7 +4773,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs)
  202. //鎶婃枃浠惰�褰曞埌qs涓�幓
  203. //index涓€瀹氫笉鑳介噸澶嶃€俷琛ㄧず鏂板缓
  204. //濡傛灉鏄�柊寤虹殑鏂囦欢
  205. - if (pEdit->property(Edit_File_New) >= 0)
  206. + if (pEdit->property(Edit_File_New).toInt() >= 0)
  207. {
  208. qs.setValue(QString("%1").arg(index), QString("%1|1").arg(fileName));
  209. }
  210. @@ -4792,7 +4792,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs)
  211. }
  212. //濡傛灉鏄�柊寤虹殑鏂囦欢
  213. - if (pEdit->property(Edit_File_New) >= 0)
  214. + if (pEdit->property(Edit_File_New).toInt() >= 0)
  215. {
  216. QString qsSavePath = qs.fileName();
  217. @@ -4963,7 +4963,7 @@ void CCNotePad::closeAllFileStatic()
  218. {
  219. QString tempFileList = QString("notepad/temp/list");
  220. QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList);
  221. - qs.setIniCodec("UTF-8");
  222. +// qs.setIniCodec("UTF-8");
  223. qs.clear();
  224. //浠庡熬閮ㄥ紑濮嬩緷娆¤皟鐢ㄤ繚瀛樻墍鏈夋枃浠躲€傛病淇�敼鐨勪笉闇€瑕佷繚瀛�
  225. @@ -5047,7 +5047,7 @@ void CCNotePad::closeEvent(QCloseEvent * event)
  226. #else
  227. if ((s_restoreLastFile == 1) && m_isMainWindows)
  228. {
  229. - closeAllFileStatic();
  230. + closeAllFileStatic();
  231. m_isQuitCancel = false;
  232. }
  233. else
  234. @@ -5094,9 +5094,9 @@ void CCNotePad::closeEvent(QCloseEvent * event)
  235. {
  236. c->showNormal();
  237. }
  238. - qlonglong winId = (qlonglong)c->effectiveWinId();
  239. - m_shareMem->lock();
  240. - memcpy(m_shareMem->data(), &winId, sizeof(qlonglong));
  241. + qlonglong winId = (qlonglong)c->effectiveWinId();
  242. + m_shareMem->lock();
  243. + memcpy(m_shareMem->data(), &winId, sizeof(qlonglong));
  244. m_shareMem->unlock();
  245. c->m_isMainWindows = true;
  246. }
  247. @@ -5480,7 +5480,7 @@ void CCNotePad::initFindWindow()
  248. //浠庡巻鍙叉煡鎵捐�褰曟枃浠朵腑鍔犺浇
  249. QString searchHistory = QString("notepad/searchHistory");//鍘嗗彶鏌ユ壘璁板綍
  250. QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory);
  251. - qs.setIniCodec("UTF-8");
  252. +// qs.setIniCodec("UTF-8");
  253. if (qs.contains("keys"))
  254. {
  255. @@ -5545,7 +5545,7 @@ void CCNotePad::slot_saveSearchHistory()
  256. //浠庡巻鍙叉煡鎵捐�褰曟枃浠朵腑鍔犺浇
  257. QString searchHistory = QString("notepad/searchHistory");//鍘嗗彶鏌ユ壘璁板綍
  258. QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory);
  259. - qs.setIniCodec("UTF-8");
  260. +// qs.setIniCodec("UTF-8");
  261. if (s_findHistroy.count() > 15)
  262. {
  263. @@ -5772,7 +5772,7 @@ void CCNotePad::initFindResultDockWin()
  264. m_dockSelectTreeWin = new QDockWidget(tr("Find result"), this);
  265. connect(m_dockSelectTreeWin, &QDockWidget::dockLocationChanged, this, &CCNotePad::slot_findResultPosChangeed);
  266. - m_dockSelectTreeWin->layout()->setMargin(0);
  267. + m_dockSelectTreeWin->layout()->setContentsMargins(0, 0, 0, 0);
  268. m_dockSelectTreeWin->layout()->setSpacing(0);
  269. //鏆傛椂涓嶆彁渚涘叧闂�紝鍥犱负鍏抽棴鍚庨渶瑕佸悓姝ヨ彍鍗曠殑check鐘舵€�
  270. @@ -6573,7 +6573,7 @@ bool CCNotePad::eventFilter(QObject * watched, QEvent * event)
  271. }
  272. return false;
  273. }
  274. -
  275. +
  276. #ifdef Q_OS_WIN
  277. static const ULONG_PTR CUSTOM_TYPE = 10000;
  278. @@ -6581,16 +6581,16 @@ static const ULONG_PTR OPEN_NOTEPAD_TYPE = 10001;
  279. bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, long * result)
  280. {
  281. - MSG *param = static_cast<MSG *>(message);
  282. -
  283. - switch (param->message)
  284. - {
  285. - case WM_COPYDATA:
  286. - {
  287. - COPYDATASTRUCT *cds = reinterpret_cast<COPYDATASTRUCT*>(param->lParam);
  288. - if (cds->dwData == CUSTOM_TYPE)
  289. - {
  290. - QString openFilePath = QString::fromUtf8(reinterpret_cast<char*>(cds->lpData), cds->cbData);
  291. + MSG *param = static_cast<MSG *>(message);
  292. +
  293. + switch (param->message)
  294. + {
  295. + case WM_COPYDATA:
  296. + {
  297. + COPYDATASTRUCT *cds = reinterpret_cast<COPYDATASTRUCT*>(param->lParam);
  298. + if (cds->dwData == CUSTOM_TYPE)
  299. + {
  300. + QString openFilePath = QString::fromUtf8(reinterpret_cast<char*>(cds->lpData), cds->cbData);
  301. int retIndex = findFileIsOpenAtPad(openFilePath);
  302. if (-1 == retIndex)
  303. @@ -6622,9 +6622,9 @@ bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, long *
  304. this->activateWindow();
  305. - *result = 1;
  306. - return true;
  307. - }
  308. + *result = 1;
  309. + return true;
  310. + }
  311. else if (cds->dwData == OPEN_NOTEPAD_TYPE)
  312. {
  313. activateWindow();
  314. @@ -6632,8 +6632,8 @@ bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, long *
  315. *result = 1;
  316. return true;
  317. - }
  318. - }
  319. + }
  320. + }
  321. }
  322. return QWidget::nativeEvent(eventType, message, result);
  323. @@ -7124,7 +7124,7 @@ int CCNotePad::restoreLastFiles()
  324. QString tempFileList = QString("notepad/temp/list");
  325. QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList);
  326. - qs.setIniCodec("UTF-8");
  327. +// qs.setIniCodec("UTF-8");
  328. QStringList fileList = qs.allKeys();
  329. //浠庡皬鍒板ぇ鎺掑簭涓€涓�
  330. diff --git a/src/columnedit.cpp b/src/columnedit.cpp
  331. index 50fd9ae..aaf93f1 100755
  332. --- a/src/columnedit.cpp
  333. +++ b/src/columnedit.cpp
  334. @@ -216,13 +216,13 @@ void ColumnEdit::slot_ok()
  335. {
  336. QByteArray s_space(cursorCol - lineEndCol, ' ');
  337. lineData.append(s_space);
  338. - lineData.append(text);
  339. + lineData.append(text.toLatin1());
  340. }
  341. else
  342. {
  343. int posAbs2Start = pEdit->execute(SCI_FINDCOLUMN, i, cursorCol);
  344. int posRelative2Start = posAbs2Start - lineBegin;
  345. - lineData.insert(posRelative2Start, text);
  346. + lineData.insert(posRelative2Start, text.toLatin1());
  347. }
  348. pEdit->SendScintilla(SCI_SETTARGETRANGE, lineBegin, lineEnd);
  349. diff --git a/src/ctipwin.cpp b/src/ctipwin.cpp
  350. index 9412777..5bf16a9 100755
  351. --- a/src/ctipwin.cpp
  352. +++ b/src/ctipwin.cpp
  353. @@ -9,7 +9,7 @@ CTipWin::CTipWin(QWidget *parent)
  354. this->setWindowFlags(Qt::ToolTip);
  355. QPalette palette(this->palette());
  356. - palette.setColor(QPalette::Background, QColor(0xfff29d));
  357. + palette.setColor(QPalette::Window, QColor(0xfff29d));
  358. this->setPalette(palette);
  359. }
  360. diff --git a/src/draglineedit.cpp b/src/draglineedit.cpp
  361. index c21f3de..d8a8513 100755
  362. --- a/src/draglineedit.cpp
  363. +++ b/src/draglineedit.cpp
  364. @@ -1,4 +1,5 @@
  365. #include "draglineedit.h"
  366. +#include <QFile>
  367. DragLineEdit::DragLineEdit(QWidget *parent)
  368. : QLineEdit(parent)
  369. diff --git a/src/encodeconvert.cpp b/src/encodeconvert.cpp
  370. index c17022e..7bbcfc5 100755
  371. --- a/src/encodeconvert.cpp
  372. +++ b/src/encodeconvert.cpp
  373. @@ -11,7 +11,7 @@
  374. #include <QtConcurrent>
  375. #include <QInputDialog>
  376. #include <QDragEnterEvent>
  377. -
  378. +#include <QTextCodec>
  379. const int ITEM_CODE = Qt::UserRole + 1;
  380. diff --git a/src/findresultwin.cpp b/src/findresultwin.cpp
  381. index 7d86701..ad01b46 100755
  382. --- a/src/findresultwin.cpp
  383. +++ b/src/findresultwin.cpp
  384. @@ -5,7 +5,7 @@
  385. #include <QTreeWidgetItem>
  386. #include <QStyleFactory>
  387. #include <QToolButton>
  388. -#include <qtreeview.h>
  389. +#include <QTreeView>>
  390. #include <QStandardItem>
  391. #include <QStandardItemModel>
  392. #include <QClipboard>
  393. @@ -151,8 +151,8 @@ void FindResultWin::slot_selectAll()
  394. QModelIndex pMi = curSelItem.parent();
  395. if (pMi.isValid())
  396. {
  397. - curSelItem = pMi;
  398. -}
  399. + curSelItem = pMi;
  400. + }
  401. else
  402. {
  403. break;
  404. @@ -176,12 +176,13 @@ void FindResultWin::slot_selectAll()
  405. //閬嶅巻涓嬮潰鐨勫瓙鑺傜偣
  406. int i = 0;
  407. QModelIndex childMi;
  408. - childMi = sectionItem.child(i, 0);
  409. + const QAbstractItemModel *const sectionItemModel = sectionItem.model();
  410. + childMi = sectionItemModel->index(i, 0);
  411. while (childMi.isValid())
  412. {
  413. ++i;
  414. ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select);
  415. - childMi = sectionItem.child(i, 0);
  416. + childMi = sectionItemModel->index(i, 0);
  417. }
  418. return i+1;
  419. };
  420. @@ -189,17 +190,20 @@ void FindResultWin::slot_selectAll()
  421. QModelIndex rootItem = firstRootItem;
  422. int j = 0;
  423. int selectCount = 0;
  424. + const QAbstractItemModel *const rootItemModel = rootItem.model();
  425. + const QAbstractItemModel *const firstRootItemModel = firstRootItem.model();
  426. +
  427. while (rootItem.isValid())
  428. {
  429. //閬嶅巻鏍硅妭鐐逛笅闈㈡瘡涓€涓猻ection
  430. {
  431. int i = 0;
  432. - QModelIndex section = rootItem.child(i, 0);
  433. + QModelIndex section = rootItemModel->index(i, 0);
  434. while (section.isValid() && !section.data(ResultItemEditor).isNull())
  435. {
  436. ++i;
  437. selectCount += selectSection(section);
  438. - section = firstRootItem.child(i, 0);
  439. + section = firstRootItemModel->index(i, 0);
  440. }
  441. }
  442. @@ -223,12 +227,12 @@ void FindResultWin::slot_selectSection()
  443. //閬嶅巻涓嬮潰鐨勫瓙鑺傜偣
  444. int i = 0;
  445. QModelIndex childMi;
  446. - childMi = sectionItem.child(i, 0);
  447. + childMi = sectionItem.model()->index(i, 0);
  448. while (childMi.isValid())
  449. {
  450. ++i;
  451. ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select);
  452. - childMi = sectionItem.child(i, 0);
  453. + childMi = sectionItem.model()->index(i, 0);
  454. }
  455. return i+1;
  456. };
  457. @@ -420,7 +424,7 @@ QString FindResultWin::highlightFindText(FindRecord& record)
  458. }
  459. src = QString("<font style='background-color:#ffffbf'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
  460. tail = QString(utf8bytes.mid(tailStart));
  461. - if (tail > MAX_TAIL_LENGTH)
  462. + if (tail.size() > MAX_TAIL_LENGTH)
  463. {
  464. tail = (tail.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped();
  465. }
  466. @@ -454,7 +458,7 @@ QString FindResultWin::highlightFindText(FindRecord& record)
  467. src = QString("<font style='font-weight:bold;color:#ffaa00'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
  468. QString tailContens = QString(utf8bytes.mid(tailStart));
  469. - if (tailContens > MAX_TAIL_LENGTH)
  470. + if (tailContens.size() > MAX_TAIL_LENGTH)
  471. {
  472. tailContens = (tailContens.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped();
  473. }
  474. diff --git a/src/findwin.cpp b/src/findwin.cpp
  475. index 7a55059..8fe891e 100755
  476. --- a/src/findwin.cpp
  477. +++ b/src/findwin.cpp
  478. @@ -559,8 +559,8 @@ bool readBase(const QChar * str, int * value, int base, int size)
  479. current = str[i];
  480. if (current >= 'A')
  481. {
  482. - current = current.digitValue() & 0xdf;
  483. - current = current.digitValue() - ('A' - '0' - 10);
  484. + current = static_cast<QChar>(current.digitValue() & 0xdf);
  485. + current = static_cast<QChar>(current.digitValue() - ('A' - '0' - 10));
  486. }
  487. else if (current > '9')
  488. return false;
  489. diff --git a/src/langstyledefine.cpp b/src/langstyledefine.cpp
  490. index 2df3a4f..f667f09 100755
  491. --- a/src/langstyledefine.cpp
  492. +++ b/src/langstyledefine.cpp
  493. @@ -30,7 +30,7 @@ bool LangStyleDefine::readLangSetFile(QString langName, bool isLoadToUI)
  494. {
  495. QString userLangFile = QString("notepad/userlang/%1").arg(langName);//鑷�畾涔夎�瑷€涓�笉鑳芥湁.瀛楃�锛屽惁鍒欏彲鑳芥湁閿欙紝鍚庣画瑕佹�鏌�
  496. QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
  497. - qs.setIniCodec("UTF-8");
  498. +// qs.setIniCodec("UTF-8");
  499. qDebug() << qs.fileName();
  500. if (!qs.contains("mz"))
  501. @@ -160,7 +160,7 @@ void LangStyleDefine::slot_save()
  502. //鎶婃柊璇�█tagName,鍜屽叧鑱攅xt鍗曠嫭瀛樻斁璧锋潵銆傚悗闈㈠彧璇诲彇涓€涓�枃浠跺氨鑳借幏鍙栨墍鏈夛紝閬垮厤閬嶅巻鎱�
  503. QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag鏄�瓨鍦ㄦ墍鏈塼ag ext鐨勬枃浠�
  504. QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
  505. - qs.setIniCodec("UTF-8");
  506. +// qs.setIniCodec("UTF-8");
  507. QStringList extList = ui.extNameLe->text().trimmed().split(" ");
  508. extList.append(QString::number(motherLangs)); //鏈€鍚庝竴涓�槸mother lexer
  509. @@ -201,7 +201,7 @@ void LangStyleDefine::slot_delete()
  510. {
  511. QString userLangFile = QString("notepad/userlang/%1").arg(name);//鑷�畾涔夎�瑷€涓�笉鑳芥湁.瀛楃�锛屽惁鍒欏彲鑳芥湁閿欙紝鍚庣画瑕佹�鏌�
  512. QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
  513. - qs.setIniCodec("UTF-8");
  514. +// qs.setIniCodec("UTF-8");
  515. //鍒犻櫎userlang涓嬮潰鐨則ag.ini
  516. QFile::remove(qs.fileName());
  517. @@ -211,7 +211,7 @@ void LangStyleDefine::slot_delete()
  518. //鎶婃柊璇�█鍦╡xt_tag涓�殑鍏宠仈鏂囦欢璁板綍涔熷垹闄�
  519. QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag鏄�瓨鍦ㄦ墍鏈塼ag ext鐨勬枃浠�
  520. QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
  521. - qs.setIniCodec("UTF-8");
  522. +// qs.setIniCodec("UTF-8");
  523. QStringList extList = qs.value(name).toStringList();
  524. //鏇存柊褰撳墠ExtLexerManager::getInstance()銆傚�鏋滀笉鏇存柊锛屽氨瑕侀噸鍚�蒋浠舵墠鑳界敓鏁�
  525. diff --git a/src/nddsetting.cpp b/src/nddsetting.cpp
  526. index ed20f73..7e2070a 100755
  527. --- a/src/nddsetting.cpp
  528. +++ b/src/nddsetting.cpp
  529. @@ -50,7 +50,7 @@ void NddSetting::init()
  530. QString qsSetPath = qs.fileName();
  531. s_nddSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
  532. - s_nddSet->setIniCodec("UTF-8");
  533. +// s_nddSet->setIniCodec("UTF-8");
  534. bool initOk = true;
  535. auto initNddSet = []() {
  536. diff --git a/src/qscint/src/qscilexer.cpp b/src/qscint/src/qscilexer.cpp
  537. index b49fdc5..f21fff8 100755
  538. --- a/src/qscint/src/qscilexer.cpp
  539. +++ b/src/qscint/src/qscilexer.cpp
  540. @@ -896,7 +896,7 @@ const char* QsciLexer::getUserDefineKeywords()
  541. QString userLangFile = QString("notepad/userlang/%1").arg(m_tagName);//鑷�畾涔夎�瑷€涓�笉鑳芥湁.瀛楃�锛屽惁鍒欏彲鑳芥湁閿欙紝鍚庣画瑕佹�鏌�
  542. QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
  543. - qs.setIniCodec("UTF-8");
  544. +// qs.setIniCodec("UTF-8");
  545. if (!qs.contains("mz"))
  546. {
  547. @@ -948,4 +948,4 @@ void QsciLexer::setCommentEnd(QByteArray commentEnd)
  548. void QsciLexer::setCurThemes(int themesId)
  549. {
  550. m_themesId = themesId;
  551. -}
  552. \ No newline at end of file
  553. +}
  554. diff --git a/src/qscint/src/qscintilla.pro b/src/qscint/src/qscintilla.pro
  555. index 2704d72..9ef4520 100755
  556. --- a/src/qscint/src/qscintilla.pro
  557. +++ b/src/qscint/src/qscintilla.pro
  558. @@ -21,24 +21,14 @@
  559. !win32:VERSION = 15.1.0
  560. TEMPLATE = lib
  561. -CONFIG += qt warn_off thread exceptions hide_symbols debug staticlib
  562. +CONFIG += qt warn_off thread exceptions hide_symbols staticlib
  563. CONFIG(debug, debug|release) {
  564. - mac: {
  565. - TARGET = qmyedit_qt$${QT_MAJOR_VERSION}_debug
  566. - } else {
  567. - win32: {
  568. - TARGET = qmyedit_qt$${QT_MAJOR_VERSION}d
  569. - } else {
  570. - TARGET = qmyedit_qt$${QT_MAJOR_VERSION}
  571. - }
  572. - }
  573. -
  574. - DESTDIR = ../../x64/Debug
  575. + TARGET = qmyedit_qt$${QT_MAJOR_VERSION}
  576. + DESTDIR = ../../x64/Debug
  577. } else {
  578. TARGET = qmyedit_qt$${QT_MAJOR_VERSION}
  579. -
  580. - DESTDIR = ../../x64/Release
  581. + DESTDIR = ../../x64/Release
  582. }
  583. macx:!CONFIG(staticlib) {
  584. diff --git a/src/qtlangset.cpp b/src/qtlangset.cpp
  585. index e88d132..99b6258 100755
  586. --- a/src/qtlangset.cpp
  587. +++ b/src/qtlangset.cpp
  588. @@ -36,8 +36,8 @@ enum LangType {
  589. // Don't use L_JS, use L_JAVASCRIPT instead
  590. // The end of enumated language type, so it should be always at the end
  591. L_EXTERNAL = 100, L_USER_DEFINE = 200
  592. -};
  593. -#endif
  594. +};
  595. +#endif
  596. //static const QColor blackColor(Qt::black);
  597. //static const QColor lightColor(0xdedede);
  598. @@ -421,14 +421,14 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
  599. QsciLexer *pLexer = ScintillaEditView::createLexer(index);
  600. if (nullptr != pLexer)
  601. {
  602. -
  603. +
  604. switch (flag)
  605. {
  606. case GLOBAL_FONT:
  607. {
  608. - for (int i = 0; i <= 255; ++i)
  609. - {
  610. - if (!pLexer->description(i).isEmpty())
  611. + for (int i = 0; i <= 255; ++i)
  612. + {
  613. + if (!pLexer->description(i).isEmpty())
  614. {
  615. oldfont = pLexer->font(i);
  616. oldfont.setFamily(m_curStyleData.font.family());
  617. @@ -439,9 +439,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
  618. break;
  619. case GLOBAL_FONT_SIZE:
  620. {
  621. - for (int i = 0; i <= 255; ++i)
  622. - {
  623. - if (!pLexer->description(i).isEmpty())
  624. + for (int i = 0; i <= 255; ++i)
  625. + {
  626. + if (!pLexer->description(i).isEmpty())
  627. {
  628. oldfont = pLexer->font(i);
  629. oldfont.setPointSize(m_curStyleData.font.pointSize());
  630. @@ -452,9 +452,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
  631. break;
  632. case GLOBAL_FONT_BOLD:
  633. {
  634. - for (int i = 0; i <= 255; ++i)
  635. - {
  636. - if (!pLexer->description(i).isEmpty())
  637. + for (int i = 0; i <= 255; ++i)
  638. + {
  639. + if (!pLexer->description(i).isEmpty())
  640. {
  641. oldfont = pLexer->font(i);
  642. oldfont.setBold(m_curStyleData.font.bold());
  643. @@ -465,9 +465,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
  644. break;
  645. case GLOBAL_FONT_UNDERLINE:
  646. {
  647. - for (int i = 0; i <= 255; ++i)
  648. - {
  649. - if (!pLexer->description(i).isEmpty())
  650. + for (int i = 0; i <= 255; ++i)
  651. + {
  652. + if (!pLexer->description(i).isEmpty())
  653. {
  654. oldfont = pLexer->font(i);
  655. oldfont.setUnderline(m_curStyleData.font.underline());
  656. @@ -478,9 +478,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
  657. break;
  658. case GLOBAL_FONT_ITALIC:
  659. {
  660. - for (int i = 0; i <= 255; ++i)
  661. - {
  662. - if (!pLexer->description(i).isEmpty())
  663. + for (int i = 0; i <= 255; ++i)
  664. + {
  665. + if (!pLexer->description(i).isEmpty())
  666. {
  667. oldfont = pLexer->font(i);
  668. oldfont.setItalic(m_curStyleData.font.italic());
  669. @@ -503,10 +503,10 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
  670. break;
  671. default:
  672. break;
  673. - }
  674. + }
  675. saveLangeSet(pLexer);
  676. - }
  677. + }
  678. delete pLexer;
  679. }
  680. }
  681. @@ -537,7 +537,7 @@ void QtLangSet::restoreOriginLangAllStyle()
  682. {
  683. QFile::remove(qs.fileName());
  684. }
  685. -
  686. +
  687. delete pLexer;
  688. pLexer = nullptr;
  689. }
  690. @@ -578,12 +578,12 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag)
  691. QsciLexer *pLexer = ScintillaEditView::createLexer(index);
  692. QsciLexer *pOriginLexer = ScintillaEditView::createLexer(index,"",true);
  693. if (nullptr != pLexer)
  694. - {
  695. - for (int i = 0; i <= 255; ++i)
  696. - {
  697. - if (!pLexer->description(i).isEmpty())
  698. - {
  699. -
  700. + {
  701. + for (int i = 0; i <= 255; ++i)
  702. + {
  703. + if (!pLexer->description(i).isEmpty())
  704. + {
  705. +
  706. switch (flag)
  707. {
  708. case GLOBAL_FONT:
  709. @@ -649,11 +649,11 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag)
  710. break;
  711. default:
  712. break;
  713. - }
  714. - }
  715. + }
  716. + }
  717. }
  718. saveLangeSet(pLexer);
  719. - }
  720. + }
  721. delete pLexer;
  722. delete pOriginLexer;
  723. }
  724. @@ -795,7 +795,7 @@ bool QtLangSet::readLangSetFile(QString langName,QString &keyword, QString &moth
  725. {
  726. QString userLangFile = QString("notepad/userlang/%1").arg(langName);//自定义语言中不能有.字符,否则可能有错,后续要检查
  727. QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
  728. - qs.setIniCodec("UTF-8");
  729. +// qs.setIniCodec("UTF-8");
  730. //qDebug() << qs.fileName();
  731. if (!qs.contains("mz"))
  732. @@ -917,15 +917,15 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item)
  733. ui.keywordTe->setPlainText(keyword);
  734. ui.motherLangCb->setCurrentIndex(0);
  735. - for (int i = 0; i <= 255; ++i)
  736. - {
  737. - QString desc = pLexer->description(i);
  738. - if (!desc.isEmpty())
  739. - {
  740. + for (int i = 0; i <= 255; ++i)
  741. + {
  742. + QString desc = pLexer->description(i);
  743. + if (!desc.isEmpty())
  744. + {
  745. QListWidgetItem *itemtemp = new QListWidgetItem(desc);
  746. - itemtemp->setData(Qt::UserRole, i);
  747. - ui.styleListWidget->addItem(itemtemp);
  748. - }
  749. + itemtemp->setData(Qt::UserRole, i);
  750. + ui.styleListWidget->addItem(itemtemp);
  751. + }
  752. }
  753. }
  754. diff --git a/src/scintillaeditview.cpp b/src/scintillaeditview.cpp
  755. index 60181dd..fac3648 100755
  756. --- a/src/scintillaeditview.cpp
  757. +++ b/src/scintillaeditview.cpp
  758. @@ -2155,7 +2155,7 @@ void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString&
  759. else if (caseToConvert == TITLECASE_FORCE)
  760. strToConvert[i] = strToConvert[i].toLower();
  761. //An exception
  762. - if ((i < 2) ? false : (strToConvert[i - 1] == L'\'' && (strToConvert[i - 2].isLetter())))
  763. + if ((i < 2) ? false : (strToConvert[i - 1] == QChar(L'\'') && (strToConvert[i - 2].isLetter())))
  764. strToConvert[i] = strToConvert[i].toLower();
  765. }
  766. }
  767. @@ -2183,11 +2183,11 @@ void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString&
  768. wasEolR = false;
  769. wasEolN = false;
  770. //An exception
  771. - if (strToConvert[i] == L'i' &&
  772. + if (strToConvert[i] == static_cast<QChar>(L'i') &&
  773. ((i < 1) ? false : (strToConvert[i - 1].isSpace() || strToConvert[i - 1] == '(' || strToConvert[i - 1] == '"')) && \
  774. ((i + 1 == nbChars) ? false : (strToConvert[i + 1].isSpace() || strToConvert[i + 1] == '\'')))
  775. {
  776. - strToConvert[i] = L'I';
  777. + strToConvert[i] = static_cast<QChar>(L'I');
  778. }
  779. }
  780. else if (strToConvert[i] == '.' || strToConvert[i] == '!' || strToConvert[i] == '?')
  781. @@ -2856,7 +2856,7 @@ bool isUrlQueryDelimiter(QChar const c)
  782. void scanToUrlEnd(QString & text, int textLen, int start, int* distance)
  783. {
  784. int p = start;
  785. - QChar q = 0;
  786. + QChar q;
  787. enum { sHostAndPath, sQuery, sQueryAfterDelimiter, sQueryQuotes, sQueryAfterQuotes, sFragment } s = sHostAndPath;
  788. while (p < textLen)
  789. {
  790. diff --git a/src/userlexdef.cpp b/src/userlexdef.cpp
  791. index 6b8c7d2..86e238b 100755
  792. --- a/src/userlexdef.cpp
  793. +++ b/src/userlexdef.cpp
  794. @@ -24,7 +24,7 @@ bool UserLexDef::readUserSettings(QString langTagName)
  795. QString userLangFile = QString("notepad/userlang/%1").arg(langTagName);
  796. QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
  797. - qs.setIniCodec("UTF-8");
  798. +// qs.setIniCodec("UTF-8");
  799. if (!qs.contains(QString("mz")))
  800. {
  801. @@ -93,13 +93,13 @@ bool UserLexDef::writeUserSettings(QString langTagName)
  802. QString userLangFile = QString("notepad/userlang/%1").arg(langTagName);
  803. QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
  804. - qs.setIniCodec("UTF-8");
  805. +// qs.setIniCodec("UTF-8");
  806. qs.clear();
  807. qs.setValue("mz", langTagName);
  808. qs.setValue("mother", m_motherLang);
  809. qs.setValue("ext", m_extTypes);
  810. - qs.setValue("keyword", m_keyword.data());
  811. + qs.setValue("keyword", m_keyword.toStdString().c_str());
  812. return true;
  813. }
  814. --
  815. 2.20.1