123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- //
- // KMPreferenceCommon.swift
- // PDF Reader Pro
- //
- // Created by tangchao on 2024/1/16.
- //
- import Foundation
- // general
- public let KMUserNameKey = "SKUserName"
- public let KMReopenLastOpenFilesKey = "SKReopenLastOpenFiles"
- public let KMOpenDocumentInTabKey = "KMOpenDocumentInTab"
- public let KMInitialWindowSizeOptionKey = "SKInitialWindowSizeOption"
- public let KMOpenContentsPaneOnlyForTOCKey = "SKOpenContentsPaneOnlyForTOC"
- public let KMRememberSnapshotsKey = "SKRememberSnapshots"
- public let KMDefaultPDFDisplaySettingsKey = "SKDefaultPDFDisplaySettings"
- public let KMDefaultFullScreenPDFDisplaySettingsKey = "SKDefaultFullScreenPDFDisplaySettings"
- public let KMAutoSaveSkimNotesKey = "SKAutoSaveSkimNotes"
- public let KMSnapshotsOnTopKey = "SKSnapshotsOnTop"
- public let KMSavePasswordOptionKey = "SKSavePasswordOption"
- // display
- public let KMThumbnailSizeKey = "SKThumbnailSize"
- public let KMSnapshotThumbnailSizeKey = "SKSnapshotThumbnailSize"
- public let KMTableFontSizeKey = "SKTableFontSize"
- public let KMGreekingThresholdKey = "SKGreekingThreshold"
- public let KMShouldAntiAliasKey = "SKShouldAntiAlias"
- public let KMBackgroundColorKey = "SKBackgroundColor"
- public let KMFullScreenBackgroundColorKey = "SKFullScreenBackgroundColor"
- public let KMReadingBarColorKey = "SKReadingBarColor"
- public let KMReadingBarInvertKey = "SKReadingBarInvert"
- func KMPreferenceKeyToCKey(pKey: KMPreferenceKey) -> String? {
-
- return nil
- }
- // MARK: - NSUserDefault key 与 偏好设置 key 相互转换
- func KMPreferenceKeyToUDKey(pKey: KMPreferenceKey) -> String? {
- // general
- if pKey == KMPreference.generalAuthorNameKey {
- return KMUserNameKey
- } else if pKey == KMPreference.openLastUnclosedDocumentWhenAppStartKey {
- return KMReopenLastOpenFilesKey
- } else if pKey == KMPreference.openDocumentTypeKey {
- return KMOpenDocumentInTabKey
- } else if pKey == KMPreference.openFileTypeKey {
- return KMInitialWindowSizeOptionKey
- } else if pKey == KMPreference.showLeftSideBarKey {
- return KMOpenContentsPaneOnlyForTOCKey
- } else if pKey == KMPreference.rememberSnapshotKey {
- return KMRememberSnapshotsKey
- } else if pKey == KMPreference.autoSaveNoteBackupKey {
- return KMAutoSaveSkimNotesKey
- } else if pKey == KMPreference.keepSnapshotWindowToTopKey {
- return KMSnapshotsOnTopKey
- } else if pKey == KMPreference.savePasswordTypeKey {
- return KMSavePasswordOptionKey
- }
- // display
- else if pKey == KMPreference.thumbPageSizeKey {
- return KMThumbnailSizeKey
- } else if pKey == KMPreference.thumbSnapshotSizeKey {
- return KMSnapshotThumbnailSizeKey
- } else if pKey == KMPreference.outlineFontSizeKey {
- return KMTableFontSizeKey
- } else if pKey == KMPreference.greekThresholdKey {
- return KMGreekingThresholdKey
- } else if pKey == KMPreference.antiAliasTextKey {
- return KMShouldAntiAliasKey
- } else if pKey == KMPreference.displayBackgroundNormalColorKey {
- return KMBackgroundColorKey
- } else if pKey == KMPreference.displayBackgroundFullScreenColorKey {
- return KMFullScreenBackgroundColorKey
- } else if pKey == KMPreference.readBarColorKey {
- return KMReadingBarColorKey
- } else if pKey == KMPreference.invertBarKey {
- return KMReadingBarInvertKey
- }
-
- return nil
- }
- func KMPreferenceKeyFromUDKey(udKey: String) -> KMPreferenceKey? {
- // general
- if udKey == KMUserNameKey {
- return KMPreference.generalAuthorNameKey
- } else if udKey == KMReopenLastOpenFilesKey {
- return KMPreference.openLastUnclosedDocumentWhenAppStartKey
- } else if udKey == KMOpenDocumentInTabKey {
- return KMPreference.openDocumentTypeKey
- } else if udKey == KMInitialWindowSizeOptionKey {
- return KMPreference.openFileTypeKey
- } else if udKey == KMOpenContentsPaneOnlyForTOCKey {
- return KMPreference.showLeftSideBarKey
- } else if udKey == KMRememberSnapshotsKey {
- return KMPreference.rememberSnapshotKey
- } else if udKey == KMAutoSaveSkimNotesKey {
- return KMPreference.autoSaveNoteBackupKey
- } else if udKey == KMSnapshotsOnTopKey {
- return KMPreference.keepSnapshotWindowToTopKey
- } else if udKey == KMSavePasswordOptionKey {
- return KMPreference.savePasswordTypeKey
- }
- // display
- else if udKey == KMThumbnailSizeKey {
- return KMPreference.thumbPageSizeKey
- } else if udKey == KMSnapshotThumbnailSizeKey {
- return KMPreference.thumbSnapshotSizeKey
- } else if udKey == KMTableFontSizeKey {
- return KMPreference.outlineFontSizeKey
- } else if udKey == KMGreekingThresholdKey {
- return KMPreference.greekThresholdKey
- } else if udKey == KMShouldAntiAliasKey {
- return KMPreference.antiAliasTextKey
- } else if udKey == KMBackgroundColorKey {
- return KMPreference.displayBackgroundNormalColorKey
- } else if udKey == KMFullScreenBackgroundColorKey {
- return KMPreference.displayBackgroundFullScreenColorKey
- } else if udKey == KMReadingBarColorKey {
- return KMPreference.readBarColorKey
- } else if udKey == KMReadingBarInvertKey {
- return KMPreference.invertBarKey
- }
-
- return nil
- }
|