Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support paste text to search input #398

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/i18n/en-US/hints.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"exit": "Exit",
"on": "On",
"off": "Off",
"paste": "Paste",
"delete": "Delete",
"save": "Save",
"submit": "Submit",
Expand Down
1 change: 1 addition & 0 deletions resources/i18n/zh-Hans/hints.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"exit": "退出",
"on": "开",
"off": "关",
"paste": "粘贴",
"delete": "删除",
"save": "保存",
"submit": "提交",
Expand Down
1 change: 1 addition & 0 deletions resources/i18n/zh-Hant/hints.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"exit": "退出",
"on": "開",
"off": "關",
"paste": "粘貼",
"delete": "刪除",
"save": "儲存",
"submit": "提交",
Expand Down
14 changes: 14 additions & 0 deletions wiliwili/source/activity/search_activity_tv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "bilibili/result/search_result.h"
#include "analytics.h"

#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32)
#include <clip/clip.h>
#endif

using namespace brls::literals;

typedef brls::Event<char> KeyboardEvent;
Expand Down Expand Up @@ -164,6 +168,16 @@ void TVSearchActivity::onContentAvailable() {
return true;
});
inputLabel->getParent()->addGestureRecognizer(new brls::TapGestureRecognizer(this->inputLabel->getParent()));
#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32)
inputLabel->getParent()->registerAction("hints/paste"_i18n, brls::BUTTON_B, [this](brls::View* view) {
std::string text;
if (clip::get_text(text)) {
this->setCurrentSearch(text);
this->updateInputLabel();
}
return true;
});
#endif

KeyboardData keyboard;
for (int i = 'A'; i <= 'Z'; i++) {
Expand Down
4 changes: 1 addition & 3 deletions wiliwili/source/utils/config_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#elif defined(__APPLE__) || defined(__linux__) || defined(_WIN32)
#include <unistd.h>
#include <borealis/platforms/desktop/desktop_platform.hpp>
#if defined(_WIN32)
#include <shlobj.h>
#endif
#endif

#include <borealis/core/application.hpp>
Expand Down Expand Up @@ -48,6 +45,7 @@ extern in_addr_t secondary_dns;

#ifdef _WIN32
#include <winsock2.h>
#include <shlobj.h>
#endif

#ifndef PATH_MAX
Expand Down
Loading