bindings: deprecate alt_/ctrl_/shift_ prefixes
This commit is contained in:
28
doc/bindings
28
doc/bindings
@@ -51,10 +51,10 @@
|
|||||||
## picked by ncmpcpp upon next call to readKey function.
|
## picked by ncmpcpp upon next call to readKey function.
|
||||||
## Accepted values: mouse, up, down, page_up, page_down,
|
## Accepted values: mouse, up, down, page_up, page_down,
|
||||||
## home, end, space, enter, insert, delete, left, right,
|
## home, end, space, enter, insert, delete, left, right,
|
||||||
## tab, ctrl_a, ctrl_b, ..., ctrl_z, ctrl_[, ctrl_\\,
|
## tab, ctrl-a, ctrl-b, ..., ctrl-z, ctrl-[, ctrl-\\,
|
||||||
## ctrl_], ctrl_^, ctrl__, f1, f2, ..., f12, backspace.
|
## ctrl-], ctrl-^, ctrl-_, f1, f2, ..., f12, backspace.
|
||||||
## In addition, most of these names can be prefixed with
|
## In addition, most of these names can be prefixed with
|
||||||
## alt_/ctrl_/shift_ to be recognized with the appropriate
|
## alt-/ctrl-/shift- to be recognized with the appropriate
|
||||||
## modifier key(s).
|
## modifier key(s).
|
||||||
##
|
##
|
||||||
## - push_characters "string" - pushes given string into
|
## - push_characters "string" - pushes given string into
|
||||||
@@ -235,7 +235,7 @@
|
|||||||
#def_key "tab"
|
#def_key "tab"
|
||||||
# next_screen
|
# next_screen
|
||||||
#
|
#
|
||||||
#def_key "shift_tab"
|
#def_key "shift-tab"
|
||||||
# previous_screen
|
# previous_screen
|
||||||
#
|
#
|
||||||
#def_key "f1"
|
#def_key "f1"
|
||||||
@@ -292,10 +292,10 @@
|
|||||||
#def_key "<"
|
#def_key "<"
|
||||||
# previous
|
# previous
|
||||||
#
|
#
|
||||||
#def_key "ctrl_h"
|
#def_key "ctrl-h"
|
||||||
# jump_to_parent_directory
|
# jump_to_parent_directory
|
||||||
#
|
#
|
||||||
#def_key "ctrl_h"
|
#def_key "ctrl-h"
|
||||||
# replay_song
|
# replay_song
|
||||||
#
|
#
|
||||||
#def_key "backspace"
|
#def_key "backspace"
|
||||||
@@ -352,19 +352,19 @@
|
|||||||
#def_key "u"
|
#def_key "u"
|
||||||
# update_database
|
# update_database
|
||||||
#
|
#
|
||||||
#def_key "ctrl_s"
|
#def_key "ctrl-s"
|
||||||
# sort_playlist
|
# sort_playlist
|
||||||
#
|
#
|
||||||
#def_key "ctrl_s"
|
#def_key "ctrl-s"
|
||||||
# toggle_browser_sort_mode
|
# toggle_browser_sort_mode
|
||||||
#
|
#
|
||||||
#def_key "ctrl_s"
|
#def_key "ctrl-s"
|
||||||
# toggle_media_library_sort_mode
|
# toggle_media_library_sort_mode
|
||||||
#
|
#
|
||||||
#def_key "ctrl_r"
|
#def_key "ctrl-r"
|
||||||
# reverse_playlist
|
# reverse_playlist
|
||||||
#
|
#
|
||||||
#def_key "ctrl__"
|
#def_key "ctrl-_"
|
||||||
# select_found_items
|
# select_found_items
|
||||||
#
|
#
|
||||||
#def_key "/"
|
#def_key "/"
|
||||||
@@ -418,7 +418,7 @@
|
|||||||
#def_key "l"
|
#def_key "l"
|
||||||
# show_lyrics
|
# show_lyrics
|
||||||
#
|
#
|
||||||
#def_key "ctrl_v"
|
#def_key "ctrl-v"
|
||||||
# select_range
|
# select_range
|
||||||
#
|
#
|
||||||
#def_key "v"
|
#def_key "v"
|
||||||
@@ -502,7 +502,7 @@
|
|||||||
#def_key "F"
|
#def_key "F"
|
||||||
# toggle_fetching_lyrics_in_background
|
# toggle_fetching_lyrics_in_background
|
||||||
#
|
#
|
||||||
#def_key "ctrl_l"
|
#def_key "ctrl-l"
|
||||||
# toggle_screen_lock
|
# toggle_screen_lock
|
||||||
#
|
#
|
||||||
#def_key "`"
|
#def_key "`"
|
||||||
@@ -514,7 +514,7 @@
|
|||||||
#def_key "`"
|
#def_key "`"
|
||||||
# add_random_items
|
# add_random_items
|
||||||
#
|
#
|
||||||
#def_key "ctrl_p"
|
#def_key "ctrl-p"
|
||||||
# set_selected_items_priority
|
# set_selected_items_priority
|
||||||
#
|
#
|
||||||
#def_key "q"
|
#def_key "q"
|
||||||
|
|||||||
@@ -30,13 +30,20 @@ BindingsConfiguration Bindings;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
void warning(const char *msg)
|
||||||
|
{
|
||||||
|
std::cerr << "WARNING: " << msg << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
NC::Key::Type stringToKey(const std::string &s);
|
NC::Key::Type stringToKey(const std::string &s);
|
||||||
|
|
||||||
NC::Key::Type stringToSpecialKey(const std::string &s)
|
NC::Key::Type stringToSpecialKey(const std::string &s)
|
||||||
{
|
{
|
||||||
NC::Key::Type result = NC::Key::None;
|
NC::Key::Type result = NC::Key::None;
|
||||||
if (!s.compare(0, 5, "ctrl_") && s.length() == 6)
|
if (!s.compare(0, 4, "ctrl") && s.length() == 6 && (s[4] == '_' || s[4] == '-'))
|
||||||
{
|
{
|
||||||
|
if (s[4] == '_')
|
||||||
|
warning("prefix 'ctrl_' is deprecated and will be removed in 0.8, use 'ctrl-' instead.");
|
||||||
if (s[5] >= 'a' && s[5] <= 'z')
|
if (s[5] >= 'a' && s[5] <= 'z')
|
||||||
result = NC::Key::Ctrl_A + (s[5] - 'a');
|
result = NC::Key::Ctrl_A + (s[5] - 'a');
|
||||||
else if (s[5] == '[')
|
else if (s[5] == '[')
|
||||||
@@ -50,12 +57,24 @@ NC::Key::Type stringToSpecialKey(const std::string &s)
|
|||||||
else if (s[5] == '_')
|
else if (s[5] == '_')
|
||||||
result = NC::Key::Ctrl_Underscore;
|
result = NC::Key::Ctrl_Underscore;
|
||||||
}
|
}
|
||||||
else if (!s.compare(0, 4, "alt_"))
|
else if (!s.compare(0, 3, "alt") && s.length() > 3 && (s[3] == '_' || s[3] == '-'))
|
||||||
|
{
|
||||||
|
if (s[3] == '_')
|
||||||
|
warning("prefix 'alt_' is deprecated and will be removed in 0.8, use 'alt-' instead.");
|
||||||
result = NC::Key::Alt | stringToKey(s.substr(4));
|
result = NC::Key::Alt | stringToKey(s.substr(4));
|
||||||
else if (!s.compare(0, 5, "ctrl_"))
|
}
|
||||||
|
else if (!s.compare(0, 4, "ctrl") && s.length() > 4 && (s[4] == '_' || s[4] == '-'))
|
||||||
|
{
|
||||||
|
if (s[4] == '_')
|
||||||
|
warning("prefix 'ctrl_' is deprecated and will be removed in 0.8, use 'ctrl-' instead.");
|
||||||
result = NC::Key::Ctrl | stringToKey(s.substr(5));
|
result = NC::Key::Ctrl | stringToKey(s.substr(5));
|
||||||
else if (!s.compare(0, 6, "shift_"))
|
}
|
||||||
|
else if (!s.compare(0, 5, "shift") && s.length() > 5 && (s[5] == '_' || s[5] == '-'))
|
||||||
|
{
|
||||||
|
if (s[5] == '_')
|
||||||
|
warning("prefix 'shift_' is deprecated and will be removed in 0.8, use 'shift-' instead.");
|
||||||
result = NC::Key::Shift | stringToKey(s.substr(6));
|
result = NC::Key::Shift | stringToKey(s.substr(6));
|
||||||
|
}
|
||||||
else if (!s.compare("escape"))
|
else if (!s.compare("escape"))
|
||||||
result = NC::Key::Escape;
|
result = NC::Key::Escape;
|
||||||
else if (!s.compare("mouse"))
|
else if (!s.compare("mouse"))
|
||||||
@@ -96,7 +115,7 @@ NC::Key::Type stringToSpecialKey(const std::string &s)
|
|||||||
result = NC::Key::Backspace;
|
result = NC::Key::Backspace;
|
||||||
else if (!s.compare("backspace_2"))
|
else if (!s.compare("backspace_2"))
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING: value 'backspace_2' is deprecated and will be removed in 0.8, use 'backspace' instead.\n";
|
warning("'backspace_2' is deprecated and will be removed in 0.8, use 'backspace' instead.");
|
||||||
result = NC::Key::Backspace;
|
result = NC::Key::Backspace;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -506,7 +525,7 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
bind(k, Actions::Type::ExecuteCommand);
|
bind(k, Actions::Type::ExecuteCommand);
|
||||||
if (notBound(k = stringToKey("tab")))
|
if (notBound(k = stringToKey("tab")))
|
||||||
bind(k, Actions::Type::NextScreen);
|
bind(k, Actions::Type::NextScreen);
|
||||||
if (notBound(k = stringToKey("shift_tab")))
|
if (notBound(k = stringToKey("shift-tab")))
|
||||||
bind(k, Actions::Type::PreviousScreen);
|
bind(k, Actions::Type::PreviousScreen);
|
||||||
if (notBound(k = stringToKey("f1")))
|
if (notBound(k = stringToKey("f1")))
|
||||||
bind(k, Actions::Type::ShowHelp);
|
bind(k, Actions::Type::ShowHelp);
|
||||||
@@ -547,7 +566,7 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
bind(k, Actions::Type::Next);
|
bind(k, Actions::Type::Next);
|
||||||
if (notBound(k = stringToKey("<")))
|
if (notBound(k = stringToKey("<")))
|
||||||
bind(k, Actions::Type::Previous);
|
bind(k, Actions::Type::Previous);
|
||||||
if (notBound(k = stringToKey("ctrl_h")))
|
if (notBound(k = stringToKey("ctrl-h")))
|
||||||
{
|
{
|
||||||
bind(k, Actions::Type::JumpToParentDirectory);
|
bind(k, Actions::Type::JumpToParentDirectory);
|
||||||
bind(k, Actions::Type::ReplaySong);
|
bind(k, Actions::Type::ReplaySong);
|
||||||
@@ -589,15 +608,15 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
bind(k, Actions::Type::SetCrossfade);
|
bind(k, Actions::Type::SetCrossfade);
|
||||||
if (notBound(k = stringToKey("u")))
|
if (notBound(k = stringToKey("u")))
|
||||||
bind(k, Actions::Type::UpdateDatabase);
|
bind(k, Actions::Type::UpdateDatabase);
|
||||||
if (notBound(k = stringToKey("ctrl_s")))
|
if (notBound(k = stringToKey("ctrl-s")))
|
||||||
{
|
{
|
||||||
bind(k, Actions::Type::SortPlaylist);
|
bind(k, Actions::Type::SortPlaylist);
|
||||||
bind(k, Actions::Type::ToggleBrowserSortMode);
|
bind(k, Actions::Type::ToggleBrowserSortMode);
|
||||||
bind(k, Actions::Type::ToggleMediaLibrarySortMode);
|
bind(k, Actions::Type::ToggleMediaLibrarySortMode);
|
||||||
}
|
}
|
||||||
if (notBound(k = stringToKey("ctrl_r")))
|
if (notBound(k = stringToKey("ctrl-r")))
|
||||||
bind(k, Actions::Type::ReversePlaylist);
|
bind(k, Actions::Type::ReversePlaylist);
|
||||||
if (notBound(k = stringToKey("ctrl__")))
|
if (notBound(k = stringToKey("ctrl-_")))
|
||||||
bind(k, Actions::Type::SelectFoundItems);
|
bind(k, Actions::Type::SelectFoundItems);
|
||||||
if (notBound(k = stringToKey("/")))
|
if (notBound(k = stringToKey("/")))
|
||||||
{
|
{
|
||||||
@@ -632,7 +651,7 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
bind(k, Actions::Type::JumpToPositionInSong);
|
bind(k, Actions::Type::JumpToPositionInSong);
|
||||||
if (notBound(k = stringToKey("l")))
|
if (notBound(k = stringToKey("l")))
|
||||||
bind(k, Actions::Type::ShowLyrics);
|
bind(k, Actions::Type::ShowLyrics);
|
||||||
if (notBound(k = stringToKey("ctrl_v")))
|
if (notBound(k = stringToKey("ctrl-v")))
|
||||||
bind(k, Actions::Type::SelectRange);
|
bind(k, Actions::Type::SelectRange);
|
||||||
if (notBound(k = stringToKey("v")))
|
if (notBound(k = stringToKey("v")))
|
||||||
bind(k, Actions::Type::ReverseSelection);
|
bind(k, Actions::Type::ReverseSelection);
|
||||||
@@ -692,7 +711,7 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
bind(k, Actions::Type::ToggleLyricsFetcher);
|
bind(k, Actions::Type::ToggleLyricsFetcher);
|
||||||
if (notBound(k = stringToKey("F")))
|
if (notBound(k = stringToKey("F")))
|
||||||
bind(k, Actions::Type::ToggleFetchingLyricsInBackground);
|
bind(k, Actions::Type::ToggleFetchingLyricsInBackground);
|
||||||
if (notBound(k = stringToKey("ctrl_l")))
|
if (notBound(k = stringToKey("ctrl-l")))
|
||||||
bind(k, Actions::Type::ToggleScreenLock);
|
bind(k, Actions::Type::ToggleScreenLock);
|
||||||
if (notBound(k = stringToKey("`")))
|
if (notBound(k = stringToKey("`")))
|
||||||
{
|
{
|
||||||
@@ -700,7 +719,7 @@ void BindingsConfiguration::generateDefaults()
|
|||||||
bind(k, Actions::Type::RefetchLyrics);
|
bind(k, Actions::Type::RefetchLyrics);
|
||||||
bind(k, Actions::Type::AddRandomItems);
|
bind(k, Actions::Type::AddRandomItems);
|
||||||
}
|
}
|
||||||
if (notBound(k = stringToKey("ctrl_p")))
|
if (notBound(k = stringToKey("ctrl-p")))
|
||||||
bind(k, Actions::Type::SetSelectedItemsPriority);
|
bind(k, Actions::Type::SetSelectedItemsPriority);
|
||||||
if (notBound(k = stringToKey("q")))
|
if (notBound(k = stringToKey("q")))
|
||||||
bind(k, Actions::Type::Quit);
|
bind(k, Actions::Type::Quit);
|
||||||
|
|||||||
Reference in New Issue
Block a user