From a154048a0b28811a778db271572d4d66e1726fca Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Sun, 29 Sep 2024 11:49:05 -0400 Subject: [PATCH] allow setting row count for scroll mode --- assets/po/zh_CN.po | 126 ++++++++++++++++++++++-------------------- fcitx5-webview | 2 +- webpanel/webpanel.cpp | 3 +- webpanel/webpanel.h | 2 + 4 files changed, 70 insertions(+), 63 deletions(-) diff --git a/assets/po/zh_CN.po b/assets/po/zh_CN.po index 6fd994f..6164ac8 100644 --- a/assets/po/zh_CN.po +++ b/assets/po/zh_CN.po @@ -143,246 +143,250 @@ msgstr "启用卷轴" msgid "Auto expand" msgstr "自动展开" -#: webpanel/webpanel.h:188 +#: webpanel/webpanel.h:189 +msgid "Max row count" +msgstr "最大行数" + +#: webpanel/webpanel.h:190 msgid "Expand" msgstr "展开" -#: webpanel/webpanel.h:189 +#: webpanel/webpanel.h:191 msgid "Collapse" msgstr "折叠" -#: webpanel/webpanel.h:190 +#: webpanel/webpanel.h:192 msgid "Up" msgstr "上" -#: webpanel/webpanel.h:191 +#: webpanel/webpanel.h:193 msgid "Down" msgstr "下" -#: webpanel/webpanel.h:192 +#: webpanel/webpanel.h:194 msgid "Left" msgstr "左" -#: webpanel/webpanel.h:193 +#: webpanel/webpanel.h:195 msgid "Right" msgstr "右" -#: webpanel/webpanel.h:195 +#: webpanel/webpanel.h:197 msgid "Row start" msgstr "行首" -#: webpanel/webpanel.h:196 +#: webpanel/webpanel.h:198 msgid "Row end" msgstr "行尾" -#: webpanel/webpanel.h:198 +#: webpanel/webpanel.h:200 msgid "Page up" msgstr "上一页" -#: webpanel/webpanel.h:200 +#: webpanel/webpanel.h:202 msgid "Page down" msgstr "下一页" -#: webpanel/webpanel.h:201 +#: webpanel/webpanel.h:203 msgid "Commit" msgstr "提交" -#: webpanel/webpanel.h:203 +#: webpanel/webpanel.h:205 msgid "Optimize for Hyper key" msgstr "针对 Hyper 键优化" -#: webpanel/webpanel.h:208 +#: webpanel/webpanel.h:210 msgid "Layout" msgstr "布局" -#: webpanel/webpanel.h:210 +#: webpanel/webpanel.h:212 msgid "Writing mode" msgstr "书写模式" -#: webpanel/webpanel.h:213 +#: webpanel/webpanel.h:215 msgid "Paging buttons style" msgstr "翻页按钮样式" -#: webpanel/webpanel.h:219 +#: webpanel/webpanel.h:220 msgid "Image" msgstr "图片" -#: webpanel/webpanel.h:220 +#: webpanel/webpanel.h:221 msgid "Blur" msgstr "模糊" -#: webpanel/webpanel.h:221 +#: webpanel/webpanel.h:222 msgid "Shadow" msgstr "阴影" -#: webpanel/webpanel.h:229 +#: webpanel/webpanel.h:230 msgid "Text font family" msgstr "文本字体族" -#: webpanel/webpanel.h:231 +#: webpanel/webpanel.h:232 msgid "Text font size" msgstr "文本字号" -#: webpanel/webpanel.h:233 +#: webpanel/webpanel.h:234 msgid "Label font family" msgstr "标签字体族" -#: webpanel/webpanel.h:235 +#: webpanel/webpanel.h:236 msgid "Label font size" msgstr "标签字号" -#: webpanel/webpanel.h:237 +#: webpanel/webpanel.h:238 msgid "Comment font family" msgstr "注释字体族" -#: webpanel/webpanel.h:239 +#: webpanel/webpanel.h:240 msgid "Comment font size" msgstr "注释字号" -#: webpanel/webpanel.h:242 +#: webpanel/webpanel.h:243 msgid "Preedit font family" msgstr "预编辑字体族" -#: webpanel/webpanel.h:244 +#: webpanel/webpanel.h:245 msgid "Preedit font size" msgstr "预编辑字号" -#: webpanel/webpanel.h:246 +#: webpanel/webpanel.h:247 msgid "User font dir" msgstr "用户字体目录" -#: webpanel/webpanel.h:247 +#: webpanel/webpanel.h:248 msgid "System font dir" msgstr "系统字体目录" -#: webpanel/webpanel.h:251 +#: webpanel/webpanel.h:252 msgid "Style" msgstr "样式" -#: webpanel/webpanel.h:253 +#: webpanel/webpanel.h:254 msgid "Text" msgstr "文本" -#: webpanel/webpanel.h:257 +#: webpanel/webpanel.h:258 msgid "Mark style" msgstr "标记样式" -#: webpanel/webpanel.h:259 +#: webpanel/webpanel.h:260 msgid "Mark text" msgstr "标记文本" -#: webpanel/webpanel.h:261 +#: webpanel/webpanel.h:262 msgid "Hover behavior" msgstr "悬停行为" -#: webpanel/webpanel.h:266 +#: webpanel/webpanel.h:267 msgid "Border width (px)" msgstr "边框宽度(px)" -#: webpanel/webpanel.h:269 +#: webpanel/webpanel.h:270 msgid "Border radius (px)" msgstr "边框半径(px)" -#: webpanel/webpanel.h:270 +#: webpanel/webpanel.h:271 msgid "Margin (px)" msgstr "外边距(px)" -#: webpanel/webpanel.h:273 +#: webpanel/webpanel.h:274 msgid "Highlight radius (px)" msgstr "高亮半径(px)" -#: webpanel/webpanel.h:276 +#: webpanel/webpanel.h:277 msgid "Top padding (px)" msgstr "顶填充(px)" -#: webpanel/webpanel.h:278 +#: webpanel/webpanel.h:279 msgid "Right padding (px)" msgstr "右填充(px)" -#: webpanel/webpanel.h:280 +#: webpanel/webpanel.h:281 msgid "Bottom padding (px)" msgstr "底填充(px)" -#: webpanel/webpanel.h:283 +#: webpanel/webpanel.h:284 msgid "Left padding (px)" msgstr "左填充(px)" -#: webpanel/webpanel.h:285 +#: webpanel/webpanel.h:286 msgid "Gap between label, text and comment (px)" msgstr "标签、文本、注释间隔(px)" -#: webpanel/webpanel.h:288 +#: webpanel/webpanel.h:289 msgid "Vertical minimum width (px)" msgstr "垂直时最小宽度(px)" -#: webpanel/webpanel.h:291 +#: webpanel/webpanel.h:292 msgid "Horizontal divider width (px)" msgstr "水平分隔线宽度(px)" -#: webpanel/webpanel.h:300 +#: webpanel/webpanel.h:301 msgid "User CSS" msgstr "用户 CSS" -#: webpanel/webpanel.h:301 +#: webpanel/webpanel.h:302 msgid "Copy HTML" msgstr "复制 HTML" -#: webpanel/webpanel.h:302 +#: webpanel/webpanel.h:303 msgid "Plugin dir" msgstr "插件目录" -#: webpanel/webpanel.h:304 +#: webpanel/webpanel.h:305 msgid "I know there may be risks for using plugins" msgstr "我知道使用插件可能有风险" -#: webpanel/webpanel.h:307 +#: webpanel/webpanel.h:308 msgid "Plugins" msgstr "插件" -#: webpanel/webpanel.h:309 +#: webpanel/webpanel.h:310 msgid "Dangerous API for JavaScript plugins" msgstr "用于 JavaScript 插件的危险 API" -#: webpanel/webpanel.h:312 +#: webpanel/webpanel.h:313 msgid "Basic" msgstr "基础" -#: webpanel/webpanel.h:313 +#: webpanel/webpanel.h:314 msgid "Light mode" msgstr "浅色模式" -#: webpanel/webpanel.h:314 +#: webpanel/webpanel.h:315 msgid "Dark mode" msgstr "深色模式" -#: webpanel/webpanel.h:315 +#: webpanel/webpanel.h:316 msgid "Typography" msgstr "版式" -#: webpanel/webpanel.h:316 +#: webpanel/webpanel.h:317 msgid "Scroll mode" msgstr "卷轴模式" -#: webpanel/webpanel.h:317 +#: webpanel/webpanel.h:318 msgid "Background" msgstr "背景" -#: webpanel/webpanel.h:318 +#: webpanel/webpanel.h:319 msgid "Font" msgstr "字体" -#: webpanel/webpanel.h:319 +#: webpanel/webpanel.h:320 msgid "Cursor" msgstr "光标" -#: webpanel/webpanel.h:320 +#: webpanel/webpanel.h:321 msgid "Highlight" msgstr "高亮" -#: webpanel/webpanel.h:321 +#: webpanel/webpanel.h:322 msgid "Size" msgstr "尺寸" -#: webpanel/webpanel.h:322 +#: webpanel/webpanel.h:323 msgid "Advanced" msgstr "高级" diff --git a/fcitx5-webview b/fcitx5-webview index d36dd67..a5210d4 160000 --- a/fcitx5-webview +++ b/fcitx5-webview @@ -1 +1 @@ -Subproject commit d36dd673d84ab04ab72636378c2751e8a0c4a173 +Subproject commit a5210d41e83c0c243a54b1689d47cfafc4cacd62 diff --git a/webpanel/webpanel.cpp b/webpanel/webpanel.cpp index 89c1b5a..b99b7eb 100644 --- a/webpanel/webpanel.cpp +++ b/webpanel/webpanel.cpp @@ -516,7 +516,8 @@ void WebPanel::scroll(int start, int count) { } void WebPanel::expand() { - scroll(0, 42); // Hard-coded like fcitx5-webview + scroll(0, 6 * (*config_.scrollMode->maxRowCount + + 1)); // Hard-coded like fcitx5-webview } void WebPanel::collapse() { diff --git a/webpanel/webpanel.h b/webpanel/webpanel.h index 52e294e..05d51bf 100644 --- a/webpanel/webpanel.h +++ b/webpanel/webpanel.h @@ -185,6 +185,8 @@ FCITX_CONFIGURATION( ScrollConfig, Option enableScroll{this, "EnableScroll", _("Enable scroll"), true}; Option autoExpand{this, "AutoExpand", _("Auto expand"), false}; + Option maxRowCount{ + this, "MaxRowCount", _("Max row count"), 6, IntConstrain(2, 10)}; Option expand{this, "Expand", _("Expand"), {Key(FcitxKey_Down)}}; Option collapse{this, "Collapse", _("Collapse"), {}}; Option up{this, "Up", _("Up"), {Key(FcitxKey_Up)}};