Skip to content

Commit

Permalink
StringView; quickphrase; reload wbx config
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Dec 10, 2024
1 parent 979ad60 commit 7cc4369
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions keyboard/fcitx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ void reload() {
instance->reloadAddonConfig(name);
}
}
// Changing wbx's config needs this to reload table/wbx.conf.
instance->inputMethodManager().reset();
instance->inputMethodManager().load();
});
}
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ copy_to_keyboard(copy "${PROJECT_BINARY_DIR}/iosnotifications/notifications.conf
copy_to_keyboard(copy "${PROJECT_BINARY_DIR}/uipanel/uipanel.conf" "${ADDON_PREFIX}/uipanel.conf")

set(FCITX5_MODULE_BINARY_DIR "${PROJECT_BINARY_DIR}/fcitx5/src/modules")

# quickphrase
copy_to_keyboard(copy "${FCITX5_MODULE_BINARY_DIR}/quickphrase/quickphrase.conf" "${ADDON_PREFIX}/quickphrase.conf")
copy_to_keyboard(copy_directory "${PROJECT_SOURCE_DIR}/fcitx5/src/modules/quickphrase/quickphrase.d" "share/fcitx5/data/quickphrase.d")

# spell
copy_to_keyboard(copy "${FCITX5_MODULE_BINARY_DIR}/spell/spell.conf" "${ADDON_PREFIX}/spell.conf")
copy_share_to_keyboard(copy fcitx5/spell/en_dict.fscd "share/fcitx5/spell/en_dict.fscd")

Expand Down
22 changes: 22 additions & 0 deletions src/config/StringView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import SwiftUI

struct StringView: View {
let description: String
@ObservedObject private var viewModel: OptionViewModel<String>

init(data: [String: Any], onUpdate: @escaping (String) -> Void) {
description = data["Description"] as! String
viewModel = OptionViewModel(
value: data["Value"] as! String,
defaultValue: data["DefaultValue"] as! String,
onUpdate: onUpdate
)
}

var body: some View {
HStack {
Text(description)
TextField("", text: $viewModel.value).resettable(viewModel)
}
}
}
2 changes: 2 additions & 0 deletions src/config/option.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func toOptionView(_ data: [String: Any], onUpdate: @escaping (Encodable) -> Void
return EnumView(data: data, onUpdate: onUpdate)
case "Integer":
return IntegerView(data: data, onUpdate: onUpdate)
case "String":
return StringView(data: data, onUpdate: onUpdate)
default:
return UnknownView()
}
Expand Down

0 comments on commit 7cc4369

Please sign in to comment.