diff --git a/Captuocr/HistoryViewModel.swift b/Captuocr/HistoryViewModel.swift index 78d4ad5..9ba2753 100644 --- a/Captuocr/HistoryViewModel.swift +++ b/Captuocr/HistoryViewModel.swift @@ -49,6 +49,7 @@ extension HistoryWindowController { } func initialize() { + viewmodel.itemsource.removeAll() historyCenter.getRecordList() .forEach { record in viewmodel.itemsource.append(record) diff --git a/Captuocr/HistoryWindowController.swift b/Captuocr/HistoryWindowController.swift index cd63991..9c9b9f1 100644 --- a/Captuocr/HistoryWindowController.swift +++ b/Captuocr/HistoryWindowController.swift @@ -23,4 +23,8 @@ class HistoryWindowController: NSWindowController { bindViewmodel() initialize() } + + func reload() { + initialize() + } } diff --git a/Captuocr/MenuInfo.json b/Captuocr/MenuInfo.json index dbcd56f..6788384 100644 --- a/Captuocr/MenuInfo.json +++ b/Captuocr/MenuInfo.json @@ -4,13 +4,31 @@ "is_separator": false, "title": "截图识字", "key": "c", - "selector": "capturePic" + "selector": "capturePic4Txt" }, { "is_separator": false, "title": "选择文件", "key": "s", - "selector": "selectPic" + "selector": "selectPic4Txt" + }, + { + "is_separator": true, + "title": "", + "key": "", + "selector": "" + }, + { + "is_separator": false, + "title": "截图识别二维码", + "key": null, + "selector": "capturePic4Qrcode" + }, + { + "is_separator": false, + "title": "选择文件识别二维码", + "key": null, + "selector": "selectPic4Qrcode" }, { "is_separator": true, diff --git a/Captuocr/MenuInfo.swift b/Captuocr/MenuInfo.swift index 3dbfeb7..97bd5bc 100644 --- a/Captuocr/MenuInfo.swift +++ b/Captuocr/MenuInfo.swift @@ -10,20 +10,19 @@ import Foundation struct MenuInfo { var is_separator: Bool var title: String - var key: String + var key: String? var selector: String init(_ anyObj: NSDictionary?) throws { guard let anyObj = anyObj, let is_separator = anyObj["is_separator"] as? Bool, let title = anyObj["title"] as? String, - let key = anyObj["key"] as? String, let selector = anyObj["selector"] as? String else { throw NSError() } self.is_separator = is_separator self.title = title - self.key = key + key = anyObj["key"] as? String self.selector = selector } } diff --git a/Captuocr/PreferenceGeneralView.xib b/Captuocr/PreferenceGeneralView.xib index be7919a..7fbb3f4 100644 --- a/Captuocr/PreferenceGeneralView.xib +++ b/Captuocr/PreferenceGeneralView.xib @@ -8,7 +8,6 @@ - @@ -41,7 +40,7 @@ - + @@ -69,21 +68,6 @@ - - - - - - - - -