Skip to content

Commit 32fd34c

Browse files
committed
fix: 修复工作区保存插件数据的小问题;
1 parent fa0fb89 commit 32fd34c

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

lang/en_US/winghex_en_US.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429
<translation>Untitled</translation>
430430
</message>
431431
<message>
432-
<location filename="../../src/control/editorview.cpp" line="1044"/>
432+
<location filename="../../src/control/editorview.cpp" line="1042"/>
433433
<source>Not allowed operation in non-UI thread</source>
434434
<translation>Not allowed operation in non-UI thread</translation>
435435
</message>

lang/zh_CN/winghex_zh_CN.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429
<translation>未命名</translation>
430430
</message>
431431
<message>
432-
<location filename="../../src/control/editorview.cpp" line="1044"/>
432+
<location filename="../../src/control/editorview.cpp" line="1042"/>
433433
<source>Not allowed operation in non-UI thread</source>
434434
<translation>该操作在非 UI 线程非法</translation>
435435
</message>

lang/zh_TW/winghex_zh_TW.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@
429429
<translation>未命名</translation>
430430
</message>
431431
<message>
432-
<location filename="../../src/control/editorview.cpp" line="1044"/>
432+
<location filename="../../src/control/editorview.cpp" line="1042"/>
433433
<source>Not allowed operation in non-UI thread</source>
434434
<translation>該操作在非 UI 線程非法</translation>
435435
</message>

src/control/editorview.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,8 @@ ErrFile EditorView::save(const QString &workSpaceName, const QString &path,
615615
if (needSaveWS) {
616616
WorkSpaceInfo infos;
617617
infos.base = doc->baseAddress();
618-
infos.pluginData = savePluginData();
618+
savePluginData();
619+
infos.pluginData = _pluginData;
619620

620621
auto b = WorkSpaceManager::saveWorkSpace(
621622
workSpaceName, fileName.url(), doc->bookMarks(),
@@ -764,9 +765,11 @@ ErrFile EditorView::reload() {
764765
switch (documentType()) {
765766
case DocumentType::File:
766767
if (m_workSpaceName.isEmpty()) {
767-
return openFile(fileNameUrl().toLocalFile());
768+
auto fileName = fileNameUrl();
769+
return openFile(fileName.toLocalFile());
768770
} else {
769-
return openWorkSpace(m_workSpaceName);
771+
auto fileName = m_workSpaceName;
772+
return openWorkSpace(fileName);
770773
}
771774
case DocumentType::Extension:
772775
return openExtFile(fileNameUrl());
@@ -938,19 +941,14 @@ void EditorView::setFileNameUrl(const QUrl &fileName) {
938941
}
939942
}
940943

941-
QMap<QString, QByteArray> EditorView::savePluginData() {
942-
QMap<QString, QByteArray> ret;
944+
void EditorView::savePluginData() {
943945
for (auto p = m_others.constKeyValueBegin();
944946
p != m_others.constKeyValueEnd(); ++p) {
945947
if (p->second->hasUnsavedState()) {
946948
auto data = p->second->saveState();
947-
if (data.isEmpty()) {
948-
continue;
949-
}
950-
ret.insert(p->first, data);
949+
_pluginData.insert(p->first, data);
951950
}
952951
}
953-
return ret;
954952
}
955953

956954
bool EditorView::checkHasUnsavedState() const {

src/control/editorview.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public slots:
228228

229229
void setFileNameUrl(const QUrl &fileName);
230230

231-
QMap<QString, QByteArray> savePluginData();
231+
void savePluginData();
232232
bool checkHasUnsavedState() const;
233233

234234
FindResultModel::FindInfo readContextFinding(qsizetype offset,

0 commit comments

Comments
 (0)