From 33d659b12ad6c2adc70dacf82fd672c9fbe9611b Mon Sep 17 00:00:00 2001
From: xfangfang <2553041586@qq.com>
Date: Sun, 20 Oct 2024 01:14:42 +0800
Subject: [PATCH] Setting activity: rearrange setting items
---
library/borealis | 2 +-
resources/i18n/en-US/wiliwili.json | 7 +
resources/i18n/zh-Hans/wiliwili.json | 11 +-
resources/i18n/zh-Hant/wiliwili.json | 11 +-
resources/svg/setting_about.svg | 1 +
resources/svg/setting_about_active.svg | 1 +
resources/svg/setting_github.svg | 1 +
resources/svg/setting_github_active.svg | 1 +
resources/svg/setting_others.svg | 1 +
resources/svg/setting_others_active.svg | 1 +
resources/svg/setting_play.svg | 1 +
resources/svg/setting_play_active.svg | 1 +
resources/svg/setting_tools.svg | 1 +
resources/svg/setting_tools_active.svg | 1 +
resources/svg/setting_ui.svg | 1 +
resources/svg/setting_ui_active.svg | 1 +
resources/xml/activity/setting_activity.xml | 191 ++++++++++++++----
.../include/activity/setting_activity.hpp | 4 +-
wiliwili/include/view/auto_tab_frame.hpp | 2 +-
wiliwili/source/activity/setting_activity.cpp | 40 ++--
wiliwili/source/utils/config_helper.cpp | 6 +-
wiliwili/source/utils/register_helper.cpp | 2 +-
wiliwili/source/view/auto_tab_frame.cpp | 65 +++++-
23 files changed, 275 insertions(+), 78 deletions(-)
create mode 100644 resources/svg/setting_about.svg
create mode 100644 resources/svg/setting_about_active.svg
create mode 100644 resources/svg/setting_github.svg
create mode 100644 resources/svg/setting_github_active.svg
create mode 100644 resources/svg/setting_others.svg
create mode 100644 resources/svg/setting_others_active.svg
create mode 100644 resources/svg/setting_play.svg
create mode 100644 resources/svg/setting_play_active.svg
create mode 100644 resources/svg/setting_tools.svg
create mode 100644 resources/svg/setting_tools_active.svg
create mode 100644 resources/svg/setting_ui.svg
create mode 100644 resources/svg/setting_ui_active.svg
diff --git a/library/borealis b/library/borealis
index ef44dfd5a..7eb69eaf5 160000
--- a/library/borealis
+++ b/library/borealis
@@ -1 +1 @@
-Subproject commit ef44dfd5a26eab735b102ba9a07285cb49bb7892
+Subproject commit 7eb69eaf58f68d3f0750aa19c867fd6fe73036d4
diff --git a/resources/i18n/en-US/wiliwili.json b/resources/i18n/en-US/wiliwili.json
index d10c6b37b..3045c15ee 100644
--- a/resources/i18n/en-US/wiliwili.json
+++ b/resources/i18n/en-US/wiliwili.json
@@ -8,6 +8,7 @@
"tab": "App",
"playback": {
"header": "Playback",
+ "player": "Player",
"report": "Upload history playback record",
"player_bar": "Always show progress bar",
"low_quality": "Low quality decoding (with less CPU usage)",
@@ -22,6 +23,7 @@
"auto_no": "Pause video after playing",
"auto_hint": "\"Automatically playing recommend video\" will automatically play recommended videos after the episode is played.",
"sleep": "Timing Off",
+ "format": "Format",
"video_codec": "Video Codec",
"audio_quality": "Audio Quality",
"video_format": "Video format"
@@ -39,6 +41,9 @@
},
"ui": {
"header": "UI",
+ "window": "Window",
+ "bottom_bar": "Bottom bar",
+ "ui_style": "UI style",
"tv_osd": "TV style OSD control"
},
"others": {
@@ -46,6 +51,8 @@
"vibration": "Gamepad vibration",
"hide_bottom": "Hide the hint bar below",
"hide_fps": "Hide FPS",
+ "show_bottom": "Show bottom bar",
+ "show_fps": "Show FPS",
"limited_fps": "Maximum frame limit",
"limited_fps_vsync": "Vertical Synchronization",
"fullscreen": "Fullscreen",
diff --git a/resources/i18n/zh-Hans/wiliwili.json b/resources/i18n/zh-Hans/wiliwili.json
index db662f07f..7561c5b2b 100644
--- a/resources/i18n/zh-Hans/wiliwili.json
+++ b/resources/i18n/zh-Hans/wiliwili.json
@@ -8,6 +8,7 @@
"tab": "应用设置",
"playback": {
"header": "播放设置",
+ "player": "播放器",
"report": "上传历史播放记录",
"player_bar": "下方固定显示进度条",
"low_quality": "低画质解码(以画质为代价换取更低的功耗)",
@@ -22,6 +23,7 @@
"auto_no": "播完暂停视频",
"auto_hint": "「自动播放推荐」 会在播完分集之后自动播放推荐视频",
"sleep": "定时关闭",
+ "format": "格式",
"video_codec": "视频编码",
"audio_quality": "视频音质",
"video_format": "视频格式"
@@ -39,13 +41,18 @@
},
"ui": {
"header": "界面设置",
+ "window": "窗口",
+ "bottom_bar": "底部提示栏",
+ "ui_style": "界面风格",
"tv_osd": "电视风格播放器"
},
"others": {
- "header": "其他",
+ "header": "其他设置",
"vibration": "手柄振动",
"hide_bottom": "隐藏下方提示栏",
"hide_fps": "隐藏 FPS",
+ "show_bottom": "显示提示栏",
+ "show_fps": "显示 FPS",
"limited_fps": "最高帧数限制",
"limited_fps_vsync": "垂直同步",
"fullscreen": "全屏显示",
@@ -84,7 +91,7 @@
"opencc": "自动转换简体中文 (需要重启)",
"keymap": {
"header": "键位图标 (需要重启)",
- "swap": "键位交换",
+ "swap": "键位交换 (需要重启)",
"xbox": "Xbox",
"ps": "PlayStation",
"keyboard": "键盘"
diff --git a/resources/i18n/zh-Hant/wiliwili.json b/resources/i18n/zh-Hant/wiliwili.json
index ee90504fd..e1a39dd6b 100644
--- a/resources/i18n/zh-Hant/wiliwili.json
+++ b/resources/i18n/zh-Hant/wiliwili.json
@@ -8,6 +8,7 @@
"tab": "應用設定",
"playback": {
"header": "播放設定",
+ "player": "播放機",
"report": "上傳歷史播放記錄",
"player_bar": "下方固定顯示進度條",
"low_quality": "低畫質解碼(以畫質為代價換取更低的功耗)",
@@ -22,6 +23,7 @@
"auto_no": "播完暫停影片",
"auto_hint": "「自動播放推薦」 會在播完分集之後自動播放推薦影片",
"sleep": "定時關閉",
+ "format": "格式",
"video_codec": "影像編碼",
"audio_quality": "影像音質",
"video_format": "影像格式"
@@ -39,13 +41,18 @@
},
"ui": {
"header": "介面設定",
+ "window": "視窗",
+ "bottom_bar": "底部提示欄",
+ "ui_style": "介面風格",
"tv_osd": "電視風格播放器"
},
"others": {
- "header": "其他",
+ "header": "其他設定",
"vibration": "手柄振動",
"hide_bottom": "隱藏下方提示欄",
"hide_fps": "隱藏 FPS",
+ "show_bottom": "顯示提示欄",
+ "show_fps": "顯示 FPS",
"limited_fps": "最高幀數限制",
"limited_fps_vsync": "垂直同步",
"fullscreen": "全荧幕顯示",
@@ -84,7 +91,7 @@
"opencc": "自動轉換簡體中文 (需要重啓)",
"keymap": {
"header": "鍵位風格 (需要重啟)",
- "swap": "鍵位交換",
+ "swap": "鍵位交換 (需要重啟)",
"xbox": "Xbox",
"ps": "PlayStation",
"keyboard": "鍵盤"
diff --git a/resources/svg/setting_about.svg b/resources/svg/setting_about.svg
new file mode 100644
index 000000000..3503db567
--- /dev/null
+++ b/resources/svg/setting_about.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_about_active.svg b/resources/svg/setting_about_active.svg
new file mode 100644
index 000000000..130e565f6
--- /dev/null
+++ b/resources/svg/setting_about_active.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_github.svg b/resources/svg/setting_github.svg
new file mode 100644
index 000000000..1babbaf15
--- /dev/null
+++ b/resources/svg/setting_github.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_github_active.svg b/resources/svg/setting_github_active.svg
new file mode 100644
index 000000000..7a4c20d5f
--- /dev/null
+++ b/resources/svg/setting_github_active.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_others.svg b/resources/svg/setting_others.svg
new file mode 100644
index 000000000..9eaf7b136
--- /dev/null
+++ b/resources/svg/setting_others.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_others_active.svg b/resources/svg/setting_others_active.svg
new file mode 100644
index 000000000..03236ec2a
--- /dev/null
+++ b/resources/svg/setting_others_active.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_play.svg b/resources/svg/setting_play.svg
new file mode 100644
index 000000000..2c2cdd519
--- /dev/null
+++ b/resources/svg/setting_play.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_play_active.svg b/resources/svg/setting_play_active.svg
new file mode 100644
index 000000000..ddcd24b06
--- /dev/null
+++ b/resources/svg/setting_play_active.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_tools.svg b/resources/svg/setting_tools.svg
new file mode 100644
index 000000000..62e0411e8
--- /dev/null
+++ b/resources/svg/setting_tools.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_tools_active.svg b/resources/svg/setting_tools_active.svg
new file mode 100644
index 000000000..a7da2b291
--- /dev/null
+++ b/resources/svg/setting_tools_active.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_ui.svg b/resources/svg/setting_ui.svg
new file mode 100644
index 000000000..5e6bea2e1
--- /dev/null
+++ b/resources/svg/setting_ui.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/svg/setting_ui_active.svg b/resources/svg/setting_ui_active.svg
new file mode 100644
index 000000000..c08c58470
--- /dev/null
+++ b/resources/svg/setting_ui_active.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/xml/activity/setting_activity.xml b/resources/xml/activity/setting_activity.xml
index e838dc833..3671b94f7 100644
--- a/resources/xml/activity/setting_activity.xml
+++ b/resources/xml/activity/setting_activity.xml
@@ -1,6 +1,5 @@
@@ -12,10 +11,13 @@
tabItemActiveTextColor="@theme/color/bilibili"
defaultTab="0"
demandMode="false"
- sidebarWidth="200"
+ sidebarWidth="240"
sidebarPosition="left">
-
-
-
+
+
+
+
@@ -68,7 +79,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id="cell/onTopMode"/>
+ id="setting/fps"/>
+
+
+
+
+
+
+ id="cell/showBottomBar"/>
+ id="cell/showFPS"/>
-
+
+
+
+ id="cell/tvSearch"/>
+ id="cell/tvOSD"/>
+
+
+
+ id="cell/gamepadVibration"/>
+ id="setting/opencc"/>
+ id="setting/language"/>
+
+
+
+
-
+
+
-
+
+
+
-
+
+ id="setting/image/threads"/>
+
+ marginBottom="30px">
-
-
+ id="setting/network/tls"/>
-
-
+ id="setting/network/proxy"/>
-
+
-
TabViewCreator;
enum class AutoTabBarPosition { TOP, LEFT, RIGHT };
-enum class AutoTabBarStyle { ACCENT, PLAIN, NONE };
+enum class AutoTabBarStyle { ACCENT, PLAIN, INLINE, NONE };
class AutoSidebarItemGroup;
class AttachedView;
diff --git a/wiliwili/source/activity/setting_activity.cpp b/wiliwili/source/activity/setting_activity.cpp
index 2078d3e98..5e41f3b58 100644
--- a/wiliwili/source/activity/setting_activity.cpp
+++ b/wiliwili/source/activity/setting_activity.cpp
@@ -212,7 +212,6 @@ void SettingActivity::onContentAvailable() {
return true;
});
-
btnTutorialFont->registerClickAction([](...) -> bool {
auto dialog =
new brls::Dialog((brls::Box*)brls::View::createFromXMLResource("fragment/settings_tutorial_font.xml"));
@@ -258,19 +257,19 @@ void SettingActivity::onContentAvailable() {
labelAboutVersion->setText(version
#if defined(BOREALIS_USE_DEKO3D)
- + " (deko3d)"
+ + " (deko3d)"
#elif defined(BOREALIS_USE_OPENGL)
#if defined(USE_GL2)
- + " (OpenGL2)"
+ + " (OpenGL2)"
#elif defined(USE_GLES2)
- + " (OpenGL ES2)"
+ + " (OpenGL ES2)"
#elif defined(USE_GLES3)
- + " (OpenGL ES3)"
+ + " (OpenGL ES3)"
#else
- + " (OpenGL)"
+ + " (OpenGL)"
#endif
#elif defined(BOREALIS_USE_D3D11)
- + " (D3D11)"
+ + " (D3D11)"
#endif
);
labelOpensource->setText(OPENSOURCE);
@@ -291,8 +290,9 @@ void SettingActivity::onContentAvailable() {
auto& conf = ProgramConfig::instance();
/// Hide bottom bar
- cellHideBar->init("wiliwili/setting/app/others/hide_bottom"_i18n, conf.getBoolOption(SettingItem::HIDE_BOTTOM_BAR),
- [this](bool value) {
+ cellShowBar->init("wiliwili/setting/app/others/show_bottom"_i18n, !conf.getBoolOption(SettingItem::HIDE_BOTTOM_BAR),
+ [](bool value) {
+ value = !value;
ProgramConfig::instance().setSettingItem(SettingItem::HIDE_BOTTOM_BAR, value);
// 更新设置
brls::AppletFrame::HIDE_BOTTOM_BAR = value;
@@ -304,19 +304,13 @@ void SettingActivity::onContentAvailable() {
if (!frame) continue;
frame->setFooterVisibility(value ? brls::Visibility::GONE : brls::Visibility::VISIBLE);
}
-
- if (value) {
- ProgramConfig::instance().setSettingItem(SettingItem::HIDE_FPS, true);
- brls::Application::setFPSStatus(false);
- }
- this->cellHideFPS->setOn(true);
});
/// Hide FPS
- cellHideFPS->init("wiliwili/setting/app/others/hide_fps"_i18n, conf.getBoolOption(SettingItem::HIDE_FPS),
+ cellShowFPS->init("wiliwili/setting/app/others/show_fps"_i18n, !conf.getBoolOption(SettingItem::HIDE_FPS),
[](bool value) {
- ProgramConfig::instance().setSettingItem(SettingItem::HIDE_FPS, value);
- brls::Application::setFPSStatus(!value);
+ ProgramConfig::instance().setSettingItem(SettingItem::HIDE_FPS, !value);
+ brls::Application::setFPSStatus(value);
});
/// Limited FPS
@@ -482,11 +476,11 @@ void SettingActivity::onContentAvailable() {
#endif
/// Swap ABXY
- btnKeymapSwap->init("wiliwili/setting/app/others/keymap/swap"_i18n, conf.getBoolOption(SettingItem::APP_SWAP_ABXY),
- [](bool data) {
- ProgramConfig::instance().setSettingItem(SettingItem::APP_SWAP_ABXY, data);
- brls::Application::setSwapInputKeys(data);
- });
+ btnKeymapSwap->init(
+ "wiliwili/setting/app/others/keymap/swap"_i18n, conf.getBoolOption(SettingItem::APP_SWAP_ABXY), [](bool data) {
+ ProgramConfig::instance().setSettingItem(SettingItem::APP_SWAP_ABXY, data);
+ DialogHelper::quitApp();
+ });
/// App language
static int langIndex = conf.getStringOptionIndex(SettingItem::APP_LANG);
diff --git a/wiliwili/source/utils/config_helper.cpp b/wiliwili/source/utils/config_helper.cpp
index dfa5b9e98..8066500df 100644
--- a/wiliwili/source/utils/config_helper.cpp
+++ b/wiliwili/source/utils/config_helper.cpp
@@ -688,8 +688,10 @@ void ProgramConfig::load() {
auto activityStack = brls::Application::getActivitiesStack();
brls::Activity* top = activityStack[activityStack.size() - 1];
VideoView* video = dynamic_cast(top->getContentView()->getView("video"));
- if (!video) break;
- video->togglePlay();
+ if (video) {
+ video->togglePlay();
+ }
+ break;
}
default:
break;
diff --git a/wiliwili/source/utils/register_helper.cpp b/wiliwili/source/utils/register_helper.cpp
index 3af02354c..bb566f982 100644
--- a/wiliwili/source/utils/register_helper.cpp
+++ b/wiliwili/source/utils/register_helper.cpp
@@ -179,7 +179,7 @@ void Register::initCustomStyle() {
brls::getStyle().addMetric("wiliwili/comment/level/x", 30);
brls::getStyle().addMetric("wiliwili/margin/20", 10);
brls::getStyle().addMetric("wiliwili/about/qr", 150);
- brls::getStyle().addMetric("wiliwili/about/speech/width", 430);
+ brls::getStyle().addMetric("wiliwili/about/speech/width", 380);
brls::getStyle().addMetric("wiliwili/about/speech/header", 495);
brls::getStyle().addMetric("wiliwili/tab_frame/content_padding_top_bottom", 20);
brls::getStyle().addMetric("wiliwili/mine/num", 18);
diff --git a/wiliwili/source/view/auto_tab_frame.cpp b/wiliwili/source/view/auto_tab_frame.cpp
index 57d005491..bcb50f278 100644
--- a/wiliwili/source/view/auto_tab_frame.cpp
+++ b/wiliwili/source/view/auto_tab_frame.cpp
@@ -681,6 +681,63 @@ const std::string autoSidebarItemPlainXML = R"xml(
)xml";
+const std::string autoSidebarItemInlineXML = R"xml(
+
+
+
+
+
+
+
+)xml";
+
AutoSidebarItem::AutoSidebarItem() : Box(brls::Axis::ROW) {
this->registerStringXMLAttribute("label", [this](std::string value) {
this->label->setText(value);
@@ -704,6 +761,7 @@ AutoSidebarItem::AutoSidebarItem() : Box(brls::Axis::ROW) {
{
{"accent", AutoTabBarStyle::ACCENT},
{"plain", AutoTabBarStyle::PLAIN},
+ {"inline", AutoTabBarStyle::INLINE},
});
this->setFocusSound(brls::SOUND_FOCUS_SIDEBAR);
@@ -749,6 +807,9 @@ void AutoSidebarItem::setTabStyle(AutoTabBarStyle style) {
case AutoTabBarStyle::PLAIN:
this->inflateFromXMLString(autoSidebarItemPlainXML);
break;
+ case AutoTabBarStyle::INLINE:
+ this->inflateFromXMLString(autoSidebarItemInlineXML);
+ break;
default:
this->inflateFromXMLString(autoSidebarItemXML);
}
@@ -761,7 +822,7 @@ void AutoSidebarItem::setActive(bool active) {
if (active) {
this->activeEvent.fire(this);
- if (this->tabStyle == AutoTabBarStyle::ACCENT)
+ if (this->tabStyle == AutoTabBarStyle::ACCENT || this->tabStyle == AutoTabBarStyle::INLINE )
this->accent->setVisibility(brls::Visibility::VISIBLE);
else if (this->tabStyle == AutoTabBarStyle::PLAIN) {
this->setBackgroundColor(this->tabItemActiveBackgroundColor);
@@ -776,7 +837,7 @@ void AutoSidebarItem::setActive(bool active) {
this->icon->setImageFromSVGFile(this->iconDefault);
}
} else {
- if (this->tabStyle == AutoTabBarStyle::ACCENT)
+ if (this->tabStyle == AutoTabBarStyle::ACCENT || this->tabStyle == AutoTabBarStyle::INLINE)
this->accent->setVisibility(brls::Visibility::INVISIBLE);
else if (this->tabStyle == AutoTabBarStyle::PLAIN) {
this->setBackgroundColor(this->tabItemBackgroundColor);