Skip to content

Commit a2d3629

Browse files
fix: add UOS build support and update dependencies
- Introduced a new option to build for UOS, enabling Sogou IM integration. - Updated CMakeLists.txt to define UOS-specific configurations. - Modified debian/control to include lsb-release as a build dependency. - Enhanced debian/rules to conditionally set UOS build flags. - Updated relevant source files to handle UOS-specific identifiers. Log: 添加UOS构建支持并更新依赖项 bug: https://pms.uniontech.com/bug-view-355273.html
1 parent fc3a2e4 commit a2d3629

6 files changed

Lines changed: 119 additions & 98 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ include(ECMSetupVersion)
1919
include(GenerateExportHeader)
2020
option(ENABLE_CONFIG_QT "Enable fcitx5-config-qt" On)
2121
option(ENABLE_TEST "Enable test" Off)
22+
option(BUILD_UOS "Build for UOS (use UOS Sogou IM)" Off)
23+
if (BUILD_UOS)
24+
add_definitions(-DBUILD_UOS)
25+
message(" >>> Build for UOS: Sogou IM = com.sogou.ime.ng.fcitx5.uos")
26+
else()
27+
message(" >>> Build for Deepin: Sogou IM = com.sogou.ime.ng.fcitx5.deepin")
28+
endif()
2229
add_definitions(-DTRANSLATION_DOMAIN=\"org.fcitx.fcitx5.kcm\")
2330
add_definitions(-DFCITX_GETTEXT_DOMAIN=\"deepin-fcitx5-configtool\")
2431
add_definitions(-DQT_NO_KEYWORDS)

debian/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Build-Depends:
2727
libpolkit-qt6-1-dev,
2828
pkg-config,
2929
xkb-data,
30+
lsb-release,
3031
Standards-Version: 4.6.2
3132
Rules-Requires-Root: no
3233
Homepage: https://github.com/fcitx/fcitx5-configtool

debian/rules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ $(eval $(call detect_qt_version))
2020
%:
2121
dh $@ --parallel
2222

23+
UOS_SYSTEM := $(shell lsb_release -i -s 2>/dev/null | grep -i uos | wc -l | tr -d ' ')
24+
2325
override_dh_auto_configure:
2426
dh_auto_configure -- \
2527
-DENABLE_KCM=Off \
2628
-DCMAKE_BUILD_TYPE=Release \
27-
-DQT_DIR=$(QT_DIR)
29+
-DQT_DIR=$(QT_DIR) \
30+
$(if $(filter 1,$(UOS_SYSTEM)),-DBUILD_UOS=ON,)
2831

2932
override_dh_auto_install:
3033
dh_auto_install --destdir=debian/tmp

src-old/src/dcc-module/imsettingwindow.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@
3636

3737
DWIDGET_USE_NAMESPACE
3838

39+
#ifdef BUILD_UOS
40+
const QString SOGOU_IM_UNIQUE_NAME = "com.sogou.ime.ng.fcitx5.uos";
41+
const QString SOGOU_CONFIGURE_APP_ID = "com.sogou.ime.ng.fcitx5.uos.configurer";
42+
#else
3943
const QString SOGOU_IM_UNIQUE_NAME = "com.sogou.ime.ng.fcitx5.deepin";
4044
const QString SOGOU_CONFIGURE_APP_ID = "com.sogou.ime.ng.fcitx5.deepin.configurer";
45+
#endif
4146

4247
using namespace dcc_fcitx_configtool::widgets;
4348

src/dcc-fcitx5configtool/operation/fcitx5configtool.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ namespace deepin {
3131
namespace fcitx5configtool {
3232

3333
static QString kFcitxConfigGlobalPath = "fcitx://config/global";
34+
#ifdef BUILD_UOS
35+
static const QString kSogouAddonUniqueName = "com.sogou.ime.ng.fcitx5.uos-addon";
36+
static const QString kSogouIMUniqueName = "com.sogou.ime.ng.fcitx5.uos";
37+
static const QString kSogouConfigureAppId = "com.sogou.ime.ng.fcitx5.uos.configurer";
38+
#else
3439
static const QString kSogouAddonUniqueName = "com.sogou.ime.ng.fcitx5.deepin-addon";
3540
static const QString kSogouIMUniqueName = "com.sogou.ime.ng.fcitx5.deepin";
36-
static const QString kSogouConfigureAppId = "sogou-ime-setting";
41+
static const QString kSogouConfigureAppId = "com.sogou.ime.ng.fcitx5.deepin.configurer";
42+
#endif
3743

3844
Fcitx5ConfigToolWorkerPrivate::Fcitx5ConfigToolWorkerPrivate(Fcitx5ConfigToolWorker *parent)
3945
: QObject(parent), q(parent)

src/dcc-fcitx5configtool/qml/DetailConfigItem.qml

Lines changed: 95 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -65,121 +65,120 @@ DccObject {
6565
}
6666
}
6767

68-
Loader {
69-
active: !root.loading
70-
asynchronous: true
71-
sourceComponent: DccRepeater {
72-
model: root.configOptions
73-
delegate: Component {
74-
DccObject {
75-
parentName: containerItem.name
76-
displayName: modelData.description
77-
weight: root.weight + index + 1
78-
pageType: DccObject.Editor
79-
visible: headerItem.expanded
80-
backgroundType: DccObject.Normal | DccObject.Hover
81-
page: Loader {
82-
height: 40
83-
sourceComponent: {
84-
switch (modelData.type) {
85-
case "Boolean":
86-
return booleanComponent
87-
case "Integer":
88-
return integerComponent
89-
case "String":
90-
return stringComponent
91-
case "List|Key":
92-
return keyComponent
93-
case "Enum":
94-
return enumComponent
95-
default:
96-
return null
97-
}
68+
// Must be a direct child of containerItem so DccManager can register it.
69+
DccRepeater {
70+
id: optionRepeater
71+
visible: !root.loading
72+
model: root.configOptions
73+
delegate: Component {
74+
DccObject {
75+
parentName: containerItem.name
76+
displayName: modelData.description
77+
weight: root.weight + index + 1
78+
pageType: DccObject.Editor
79+
visible: headerItem.expanded
80+
backgroundType: DccObject.Normal | DccObject.Hover
81+
page: Loader {
82+
height: 40
83+
sourceComponent: {
84+
switch (modelData.type) {
85+
case "Boolean":
86+
return booleanComponent
87+
case "Integer":
88+
return integerComponent
89+
case "String":
90+
return stringComponent
91+
case "List|Key":
92+
return keyComponent
93+
case "Enum":
94+
return enumComponent
95+
default:
96+
return null
9897
}
98+
}
9999

100-
Component {
101-
id: booleanComponent
102-
D.Switch {
103-
checked: modelData.value === "True"
104-
onCheckedChanged: {
105-
dccData.fcitx5ConfigProxy.setValue(
106-
root.name + "/" + modelData.name,
107-
checked ? "True" : "False")
108-
}
100+
Component {
101+
id: booleanComponent
102+
D.Switch {
103+
checked: modelData.value === "True"
104+
onCheckedChanged: {
105+
dccData.fcitx5ConfigProxy.setValue(
106+
root.name + "/" + modelData.name,
107+
checked ? "True" : "False")
109108
}
110109
}
110+
}
111111

112-
Component {
113-
id: integerComponent
114-
D.SpinBox {
115-
width: 55
116-
implicitWidth: 55
117-
value: parseInt(modelData.value)
118-
onValueChanged: {
119-
dccData.fcitx5ConfigProxy.setValue(
120-
root.name + "/" + modelData.name,
121-
value.toString())
122-
}
112+
Component {
113+
id: integerComponent
114+
D.SpinBox {
115+
width: 55
116+
implicitWidth: 55
117+
value: parseInt(modelData.value)
118+
onValueChanged: {
119+
dccData.fcitx5ConfigProxy.setValue(
120+
root.name + "/" + modelData.name,
121+
value.toString())
123122
}
124123
}
124+
}
125125

126-
Component {
127-
id: stringComponent
128-
D.TextField {
129-
text: modelData.value
130-
onTextChanged: {
131-
dccData.fcitx5ConfigProxy.setValue(
132-
root.name + "/" + modelData.name,
133-
text)
134-
}
126+
Component {
127+
id: stringComponent
128+
D.TextField {
129+
text: modelData.value
130+
onTextChanged: {
131+
dccData.fcitx5ConfigProxy.setValue(
132+
root.name + "/" + modelData.name,
133+
text)
135134
}
136135
}
136+
}
137137

138-
Component {
139-
id: keyComponent
140-
KeySequenceDisplay {
141-
placeholderText: qsTr("Please enter a new shortcut")
142-
keys: modelData.value
143-
background.visible: false
144-
onFocusChanged: {
145-
if (!focus) {
146-
if (keys.length > 0) {
147-
dccData.fcitx5ConfigProxy.setValue(
148-
root.name + "/" + modelData.name + "/0",
149-
keys, true)
150-
} else if (root.keyName != modelData.name) {
151-
keys = modelData.value
152-
}
138+
Component {
139+
id: keyComponent
140+
KeySequenceDisplay {
141+
placeholderText: qsTr("Please enter a new shortcut")
142+
keys: modelData.value
143+
background.visible: false
144+
onFocusChanged: {
145+
if (!focus) {
146+
if (keys.length > 0) {
147+
dccData.fcitx5ConfigProxy.setValue(
148+
root.name + "/" + modelData.name + "/0",
149+
keys, true)
150+
} else if (root.keyName != modelData.name) {
151+
keys = modelData.value
153152
}
154153
}
155-
onKeysChanged: {
156-
root.keyName = modelData.name
157-
}
154+
}
155+
onKeysChanged: {
156+
root.keyName = modelData.name
157+
}
158158

159-
Connections {
160-
target: root
161-
function onKeyNameChanged() {
162-
if (root.keyName != modelData.name) {
163-
focus = false
164-
}
159+
Connections {
160+
target: root
161+
function onKeyNameChanged() {
162+
if (root.keyName != modelData.name) {
163+
focus = false
165164
}
166165
}
167166
}
168167
}
168+
}
169169

170-
Component {
171-
id: enumComponent
172-
D.ComboBox {
173-
model: modelData.propertiesI18n
174-
flat: true
175-
currentIndex: modelData.properties.indexOf(
176-
modelData.value) ? modelData.properties.indexOf(
177-
modelData.value) : 0
178-
onCurrentIndexChanged: {
179-
dccData.fcitx5ConfigProxy.setValue(
180-
root.name + "/" + modelData.name,
181-
modelData.properties[currentIndex])
182-
}
170+
Component {
171+
id: enumComponent
172+
D.ComboBox {
173+
model: modelData.propertiesI18n
174+
flat: true
175+
currentIndex: modelData.properties.indexOf(
176+
modelData.value) ? modelData.properties.indexOf(
177+
modelData.value) : 0
178+
onCurrentIndexChanged: {
179+
dccData.fcitx5ConfigProxy.setValue(
180+
root.name + "/" + modelData.name,
181+
modelData.properties[currentIndex])
183182
}
184183
}
185184
}

0 commit comments

Comments
 (0)