{"action":"created","issue":{"url":"https://api.github.com/repos/wesnoth/wesnoth/issues/3441","repository_url":"https://api.github.com/repos/wesnoth/wesnoth","labels_url":"https://api.github.com/repos/wesnoth/wesnoth/issues/3441/labels{/name}","comments_url":"https://api.github.com/repos/wesnoth/wesnoth/issues/3441/comments","events_url":"https://api.github.com/repos/wesnoth/wesnoth/issues/3441/events","html_url":"https://github.com/wesnoth/wesnoth/pull/3441","id":348746315,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3MDIzNDI5","number":3441,"title":"[WIP] Add battery percentage into game view (next to current time)","user":{"login":"hrubymar10","id":2218817,"node_id":"MDQ6VXNlcjIyMTg4MTc=","avatar_url":"https://avatars3.githubusercontent.com/u/2218817?v=4","gravatar_id":"","url":"https://api.github.com/users/hrubymar10","html_url":"https://github.com/hrubymar10","followers_url":"https://api.github.com/users/hrubymar10/followers","following_url":"https://api.github.com/users/hrubymar10/following{/other_user}","gists_url":"https://api.github.com/users/hrubymar10/gists{/gist_id}","starred_url":"https://api.github.com/users/hrubymar10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrubymar10/subscriptions","organizations_url":"https://api.github.com/users/hrubymar10/orgs","repos_url":"https://api.github.com/users/hrubymar10/repos","events_url":"https://api.github.com/users/hrubymar10/events{/privacy}","received_events_url":"https://api.github.com/users/hrubymar10/received_events","type":"User","site_admin":false},"labels":[{"id":35865190,"node_id":"MDU6TGFiZWwzNTg2NTE5MA==","url":"https://api.github.com/repos/wesnoth/wesnoth/labels/Enhancement","name":"Enhancement","color":"84b6eb","default":false}],"state":"open","locked":false,"assignee":{"login":"hrubymar10","id":2218817,"node_id":"MDQ6VXNlcjIyMTg4MTc=","avatar_url":"https://avatars3.githubusercontent.com/u/2218817?v=4","gravatar_id":"","url":"https://api.github.com/users/hrubymar10","html_url":"https://github.com/hrubymar10","followers_url":"https://api.github.com/users/hrubymar10/followers","following_url":"https://api.github.com/users/hrubymar10/following{/other_user}","gists_url":"https://api.github.com/users/hrubymar10/gists{/gist_id}","starred_url":"https://api.github.com/users/hrubymar10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrubymar10/subscriptions","organizations_url":"https://api.github.com/users/hrubymar10/orgs","repos_url":"https://api.github.com/users/hrubymar10/repos","events_url":"https://api.github.com/users/hrubymar10/events{/privacy}","received_events_url":"https://api.github.com/users/hrubymar10/received_events","type":"User","site_admin":false},"assignees":[{"login":"hrubymar10","id":2218817,"node_id":"MDQ6VXNlcjIyMTg4MTc=","avatar_url":"https://avatars3.githubusercontent.com/u/2218817?v=4","gravatar_id":"","url":"https://api.github.com/users/hrubymar10","html_url":"https://github.com/hrubymar10","followers_url":"https://api.github.com/users/hrubymar10/followers","following_url":"https://api.github.com/users/hrubymar10/following{/other_user}","gists_url":"https://api.github.com/users/hrubymar10/gists{/gist_id}","starred_url":"https://api.github.com/users/hrubymar10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrubymar10/subscriptions","organizations_url":"https://api.github.com/users/hrubymar10/orgs","repos_url":"https://api.github.com/users/hrubymar10/repos","events_url":"https://api.github.com/users/hrubymar10/events{/privacy}","received_events_url":"https://api.github.com/users/hrubymar10/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/wesnoth/wesnoth/milestones/14","html_url":"https://github.com/wesnoth/wesnoth/milestone/14","labels_url":"https://api.github.com/repos/wesnoth/wesnoth/milestones/14/labels","id":3563235,"node_id":"MDk6TWlsZXN0b25lMzU2MzIzNQ==","number":14,"title":"1.14.5","description":"Things to be done for Wesnoth 1.14.5","creator":{"login":"hrubymar10","id":2218817,"node_id":"MDQ6VXNlcjIyMTg4MTc=","avatar_url":"https://avatars3.githubusercontent.com/u/2218817?v=4","gravatar_id":"","url":"https://api.github.com/users/hrubymar10","html_url":"https://github.com/hrubymar10","followers_url":"https://api.github.com/users/hrubymar10/followers","following_url":"https://api.github.com/users/hrubymar10/following{/other_user}","gists_url":"https://api.github.com/users/hrubymar10/gists{/gist_id}","starred_url":"https://api.github.com/users/hrubymar10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrubymar10/subscriptions","organizations_url":"https://api.github.com/users/hrubymar10/orgs","repos_url":"https://api.github.com/users/hrubymar10/repos","events_url":"https://api.github.com/users/hrubymar10/events{/privacy}","received_events_url":"https://api.github.com/users/hrubymar10/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":1,"state":"open","created_at":"2018-08-12T17:12:59Z","updated_at":"2018-08-13T16:06:05Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2018-08-08T14:16:24Z","updated_at":"2018-08-15T22:06:22Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/wesnoth/wesnoth/pulls/3441","html_url":"https://github.com/wesnoth/wesnoth/pull/3441","diff_url":"https://github.com/wesnoth/wesnoth/pull/3441.diff","patch_url":"https://github.com/wesnoth/wesnoth/pull/3441.patch"},"body":"I am working on new feature. I want add current battery percentage next to current time in game view:\r\n![2018-08-08 at 16 07](https://user-images.githubusercontent.com/2218817/43842250-3a9f41b2-9b25-11e8-8bda-3be812410418.png)\r\n\r\n## TODO\r\n- [x] Create `battery_info` class\r\n- [x] Add function to check if is battery present\r\n- [x] Add function to get battery percentage\r\n- [x] Port to macOS\r\n- [x] Port to iOS\r\n- [ ] Port to Linux\r\n- [x] Port to Windows\r\n- [x] Create/Find nice battery icon (e1aefce)\r\n- [x] Ask someone to create Windows port (probably jyrkive)\r\n- [x] Ask someone to create Linux port (probably jyrkive)\r\n- [x] Move battery icon on right from current time (b1c12acb8ee9b82c088114dfe00cf1a7ceff9c33)\r\n- [x] Ask someone to fix CMake build on macOS (add `-framework IOKit` linker option) (827063d)\r\n- [x] Find way to hide GUI element (if battery not present) - (16a44b25f1bf3f00efdc8e55cf8c107ede8fdca3)\r\n\r\n## Example usage (patch):\r\n```\r\ndiff --git a/src/wesnoth.cpp b/src/wesnoth.cpp\r\nindex fc78252d34..2a7c53ab32 100644\r\n--- a/src/wesnoth.cpp\r\n+++ b/src/wesnoth.cpp\r\n@@ -17,6 +17,7 @@\r\n #include \"commandline_options.hpp\" // for commandline_options, etc\r\n #include \"config.hpp\"              // for config, config::error, etc\r\n #include \"cursor.hpp\"              // for set, CURSOR_TYPE::NORMAL, etc\r\n+#include \"desktop/battery_info.hpp\"\r\n #include \"editor/editor_main.hpp\"\r\n #include \"filesystem.hpp\" // for filesystem::file_exists, filesystem::io_exception, etc\r\n #include \"floating_label.hpp\"\r\n@@ -1112,6 +1113,10 @@ int main(int argc, char** argv)\r\n \t\tstd::cerr << \"Battle for Wesnoth v\" << game_config::revision << '\\n';\r\n \t\tconst time_t t = time(nullptr);\r\n \t\tstd::cerr << \"Started on \" << ctime(&t) << \"\\n\";\r\n+        \r\n+        if (desktop::battery_info::does_device_have_battery()) {\r\n+            std::cerr << \"Battery level is \" << desktop::battery_info::get_battery_percentage() << \"%\\n\";\r\n+        }\r\n \r\n \t\tconst std::string& exe_dir = filesystem::get_exe_dir();\r\n \t\tif(!exe_dir.empty()) {\r\n```"},"comment":{"url":"https://api.github.com/repos/wesnoth/wesnoth/issues/comments/413353598","html_url":"https://github.com/wesnoth/wesnoth/pull/3441#issuecomment-413353598","issue_url":"https://api.github.com/repos/wesnoth/wesnoth/issues/3441","id":413353598,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzM1MzU5OA==","user":{"login":"hrubymar10","id":2218817,"node_id":"MDQ6VXNlcjIyMTg4MTc=","avatar_url":"https://avatars3.githubusercontent.com/u/2218817?v=4","gravatar_id":"","url":"https://api.github.com/users/hrubymar10","html_url":"https://github.com/hrubymar10","followers_url":"https://api.github.com/users/hrubymar10/followers","following_url":"https://api.github.com/users/hrubymar10/following{/other_user}","gists_url":"https://api.github.com/users/hrubymar10/gists{/gist_id}","starred_url":"https://api.github.com/users/hrubymar10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrubymar10/subscriptions","organizations_url":"https://api.github.com/users/hrubymar10/orgs","repos_url":"https://api.github.com/users/hrubymar10/repos","events_url":"https://api.github.com/users/hrubymar10/events{/privacy}","received_events_url":"https://api.github.com/users/hrubymar10/received_events","type":"User","site_admin":false},"created_at":"2018-08-15T22:06:22Z","updated_at":"2018-08-15T22:06:22Z","author_association":"CONTRIBUTOR","body":"Linux port could probably use some code from here: https://www.cemetech.net/forum/viewtopic.php?p=84036&sid=b7003b8768e90f2ef4506cf82c292729#84036\r\n\r\nAlso it would be nice to support more than one battery. We can sum all batteries so if there will be 2 fully charged batteries, then Wesnoth will show 200%."}}
{"actor":{"display_login":"hrubymar10"}}