commits
tags
#include "torlinkc/ui/keymap.hpp"
namespace torlinkc::ui {
const std::vector<HelpGroup>& helpGroups() {
static const std::vector<HelpGroup> groups = {
{"Navigate",
{
{"up/down/left/right", "Navigate panes and lists"},
{"enter", "Open"},
{"tab", "Switch pane"},
{"esc", "Back"},
{"o", "Default download folder"},
{"t", "Extra trackers"},
{"q", "Quit"},
}},
{"Search",
{
{"enter", "Search / download selected"},
{"d", "Download"},
{"s", "Sort results"},
{"z", "Hide dead torrents"},
}},
{"Downloads",
{
{"p", "Pause/resume"},
{"c", "Cancel or remove"},
{"f", "Retry failed"},
{"d", "Download again"},
{"e", "Open folder"},
}},
{"Seeding",
{
{"p", "Pause/resume"},
{"c", "Remove"},
{"e", "Open folder"},
}},
};
return groups;
}
namespace {
const Hint kNavigate{"up/down/left/right", "Move"};
const Hint kAlways{"?", "Keys"};
const Hint kSwitch{"tab", "Switch"};
const Hint kFolder{"e", "Folder"};
} // namespace
std::vector<Hint> footerHints(Region region, Section section, std::optional<DownloadFocus> downloadFocus,
std::optional<SeedFocus> seedFocus) {
if (region == Region::Sidebar) {
return {kNavigate, {"enter", "Open"}, kSwitch, kAlways, {"q", "Quit"}};
}
if (section == Section::Seeding) {
std::string label = "Resume";
if (seedFocus == SeedFocus::Seeding) label = "Pause";
else if (seedFocus == SeedFocus::Missing) label = "Retry";
return {{"p", label}, {"c", "Remove from list"}, kFolder, kSwitch, kAlways};
}
if (section == Section::Downloads) {
if (downloadFocus == DownloadFocus::Paused) {
return {{"p", "Resume"}, {"c", "Cancel"}, kFolder, kSwitch, kAlways};
}
if (downloadFocus == DownloadFocus::Failed) {
return {{"f", "Retry"}, {"c", "Remove"}, kFolder, kSwitch, kAlways};
}
if (downloadFocus == DownloadFocus::Recent) {
return {{"d", "Redownload"}, {"c", "Remove from list"}, kFolder, kSwitch, kAlways};
}
return {{"p", "Pause"}, {"c", "Cancel"}, kFolder, kSwitch, kAlways};
}
return {kNavigate, {"d", "Download"}, {"s", "Sort"}, {"z", "Hide dead"}, kSwitch, kAlways};
}
} // namespace torlinkc::ui