add support for columns view in browser and search engine
This commit is contained in:
@@ -106,6 +106,10 @@
|
|||||||
#
|
#
|
||||||
#playlist_display_mode = "classic" (classic/columns)
|
#playlist_display_mode = "classic" (classic/columns)
|
||||||
#
|
#
|
||||||
|
#browser_display_mode = "classic" (classic/columns)
|
||||||
|
#
|
||||||
|
#search_engine_display_mode = "classic" (classic/columns)
|
||||||
|
#
|
||||||
#incremental_seeking = "yes"
|
#incremental_seeking = "yes"
|
||||||
#
|
#
|
||||||
#seek_time = "1"
|
#seek_time = "1"
|
||||||
|
|||||||
2
doc/keys
2
doc/keys
@@ -124,7 +124,7 @@
|
|||||||
#
|
#
|
||||||
#key_toggle_auto_center = 'U'
|
#key_toggle_auto_center = 'U'
|
||||||
#
|
#
|
||||||
#key_toggle_playlist_display_mode = 'p'
|
#key_toggle_display_mode = 'p'
|
||||||
#
|
#
|
||||||
#key_go_to_containing_directory = 'G'
|
#key_go_to_containing_directory = 'G'
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -143,7 +143,12 @@ void DisplayItem(const Item &item, void *, Menu<Item> *menu)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case itSong:
|
case itSong:
|
||||||
DisplaySong(*item.song, &Config.song_list_format, reinterpret_cast<Menu<Song> *>(menu));
|
!Config.columns_in_browser
|
||||||
|
?
|
||||||
|
DisplaySong(*item.song, &Config.song_list_format, reinterpret_cast<Menu<Song> *>(menu))
|
||||||
|
:
|
||||||
|
DisplaySongInColumns(*item.song, &Config.song_columns_list_format, reinterpret_cast<Menu<Song> *>(menu))
|
||||||
|
;
|
||||||
return;
|
return;
|
||||||
case itPlaylist:
|
case itPlaylist:
|
||||||
*menu << Config.browser_playlist_prefix << item.name;
|
*menu << Config.browser_playlist_prefix << item.name;
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ void GetKeybindings(Scrollpad &help)
|
|||||||
help << DisplayKeys(Key.NextFoundPosition) << "Go to next found position\n";
|
help << DisplayKeys(Key.NextFoundPosition) << "Go to next found position\n";
|
||||||
help << DisplayKeys(Key.ToggleFindMode) << "Toggle find mode (normal/wrapped)\n";
|
help << DisplayKeys(Key.ToggleFindMode) << "Toggle find mode (normal/wrapped)\n";
|
||||||
help << DisplayKeys(Key.GoToContainingDir) << "Go to directory containing current item\n";
|
help << DisplayKeys(Key.GoToContainingDir) << "Go to directory containing current item\n";
|
||||||
|
help << DisplayKeys(Key.ToggleDisplayMode) << "Toggle display mode\n";
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
help << DisplayKeys(Key.EditTags) << "Edit song's tags/playlist's name\n";
|
help << DisplayKeys(Key.EditTags) << "Edit song's tags/playlist's name\n";
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
@@ -166,7 +167,6 @@ void GetKeybindings(Scrollpad &help)
|
|||||||
help << DisplayKeys(Key.Add) << "Add url/file/directory to playlist\n";
|
help << DisplayKeys(Key.Add) << "Add url/file/directory to playlist\n";
|
||||||
help << DisplayKeys(Key.SavePlaylist) << "Save playlist\n";
|
help << DisplayKeys(Key.SavePlaylist) << "Save playlist\n";
|
||||||
help << DisplayKeys(Key.GoToNowPlaying) << "Go to currently playing position\n";
|
help << DisplayKeys(Key.GoToNowPlaying) << "Go to currently playing position\n";
|
||||||
help << DisplayKeys(Key.TogglePlaylistDisplayMode) << "Toggle playlist display mode\n";
|
|
||||||
help << DisplayKeys(Key.ToggleAutoCenter) << "Toggle auto center mode\n\n\n";
|
help << DisplayKeys(Key.ToggleAutoCenter) << "Toggle auto center mode\n\n\n";
|
||||||
|
|
||||||
help << " " << fmtBold << "Keys - Browse screen\n -----------------------------------------\n" << fmtBoldEnd;
|
help << " " << fmtBold << "Keys - Browse screen\n -----------------------------------------\n" << fmtBoldEnd;
|
||||||
|
|||||||
@@ -826,10 +826,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (Config.columns_in_playlist && wCurrent == mPlaylist)
|
wCurrent->Display();
|
||||||
wCurrent->Display();
|
|
||||||
else
|
|
||||||
wCurrent->Refresh();
|
|
||||||
// redraw_screen = 0;
|
// redraw_screen = 0;
|
||||||
|
|
||||||
wCurrent->ReadKey(input);
|
wCurrent->ReadKey(input);
|
||||||
@@ -1362,6 +1359,8 @@ int main(int argc, char *argv[])
|
|||||||
Search(s);
|
Search(s);
|
||||||
if (!mSearcher->Back().first)
|
if (!mSearcher->Back().first)
|
||||||
{
|
{
|
||||||
|
if (Config.columns_in_search_engine)
|
||||||
|
mSearcher->SetTitle(DisplayColumns(Config.song_columns_list_format));
|
||||||
size_t found = mSearcher->Size()-search_engine_static_options;
|
size_t found = mSearcher->Size()-search_engine_static_options;
|
||||||
found += 3; // don't count options inserted below
|
found += 3; // don't count options inserted below
|
||||||
mSearcher->InsertSeparator(16);
|
mSearcher->InsertSeparator(16);
|
||||||
@@ -2538,13 +2537,29 @@ int main(int argc, char *argv[])
|
|||||||
block_progressbar_update = 0;
|
block_progressbar_update = 0;
|
||||||
UnlockStatusbar();
|
UnlockStatusbar();
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.TogglePlaylistDisplayMode) && wCurrent == mPlaylist)
|
else if (Keypressed(input, Key.ToggleDisplayMode))
|
||||||
{
|
{
|
||||||
Config.columns_in_playlist = !Config.columns_in_playlist;
|
if (wCurrent == mPlaylist)
|
||||||
ShowMessage("Playlist display mode: %s", Config.columns_in_playlist ? "Columns" : "Classic");
|
{
|
||||||
mPlaylist->SetItemDisplayer(Config.columns_in_playlist ? DisplaySongInColumns : DisplaySong);
|
Config.columns_in_playlist = !Config.columns_in_playlist;
|
||||||
mPlaylist->SetItemDisplayerUserData(Config.columns_in_playlist ? &Config.song_columns_list_format : &Config.song_list_format);
|
ShowMessage("Playlist display mode: %s", Config.columns_in_playlist ? "Columns" : "Classic");
|
||||||
mPlaylist->SetTitle(Config.columns_in_playlist ? DisplayColumns(Config.song_columns_list_format) : "");
|
mPlaylist->SetItemDisplayer(Config.columns_in_playlist ? DisplaySongInColumns : DisplaySong);
|
||||||
|
mPlaylist->SetItemDisplayerUserData(Config.columns_in_playlist ? &Config.song_columns_list_format : &Config.song_list_format);
|
||||||
|
mPlaylist->SetTitle(Config.columns_in_playlist ? DisplayColumns(Config.song_columns_list_format) : "");
|
||||||
|
}
|
||||||
|
else if (wCurrent == mBrowser)
|
||||||
|
{
|
||||||
|
Config.columns_in_browser = !Config.columns_in_browser;
|
||||||
|
ShowMessage("Browser display mode: %s", Config.columns_in_browser ? "Columns" : "Classic");
|
||||||
|
mBrowser->SetTitle(Config.columns_in_browser ? DisplayColumns(Config.song_columns_list_format) : "");
|
||||||
|
}
|
||||||
|
else if (wCurrent == mSearcher)
|
||||||
|
{
|
||||||
|
Config.columns_in_search_engine = !Config.columns_in_search_engine;
|
||||||
|
ShowMessage("Search engine display mode: %s", Config.columns_in_search_engine ? "Columns" : "Classic");
|
||||||
|
if (mSearcher->Size() > search_engine_static_options)
|
||||||
|
mSearcher->SetTitle(Config.columns_in_search_engine ? DisplayColumns(Config.song_columns_list_format) : "");
|
||||||
|
}
|
||||||
// redraw_screen = 1;
|
// redraw_screen = 1;
|
||||||
}
|
}
|
||||||
else if (Keypressed(input, Key.ToggleAutoCenter))
|
else if (Keypressed(input, Key.ToggleAutoCenter))
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "search_engine.h"
|
#include "search_engine.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
using namespace MPD;
|
using namespace MPD;
|
||||||
|
|
||||||
@@ -36,7 +37,15 @@ const char *search_mode_strict = "Match only if both values are the same";
|
|||||||
void SearchEngineDisplayer(const std::pair<Buffer *, Song *> &pair, void *, Menu< std::pair<Buffer *, Song *> > *menu)
|
void SearchEngineDisplayer(const std::pair<Buffer *, Song *> &pair, void *, Menu< std::pair<Buffer *, Song *> > *menu)
|
||||||
{
|
{
|
||||||
if (pair.second)
|
if (pair.second)
|
||||||
DisplaySong(*pair.second, &Config.song_list_format, reinterpret_cast<Menu<Song> *>(menu));
|
{
|
||||||
|
!Config.columns_in_search_engine
|
||||||
|
?
|
||||||
|
DisplaySong(*pair.second, &Config.song_list_format, reinterpret_cast<Menu<Song> *>(menu))
|
||||||
|
:
|
||||||
|
DisplaySongInColumns(*pair.second, &Config.song_columns_list_format, reinterpret_cast<Menu<Song> *>(menu))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
*menu << *pair.first;
|
*menu << *pair.first;
|
||||||
}
|
}
|
||||||
@@ -72,6 +81,7 @@ void PrepareSearchEngine(Song &s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.Clear();
|
s.Clear();
|
||||||
|
mSearcher->SetTitle("");
|
||||||
mSearcher->Clear();
|
mSearcher->Clear();
|
||||||
mSearcher->Reset();
|
mSearcher->Reset();
|
||||||
mSearcher->ResizeBuffer(16);
|
mSearcher->ResizeBuffer(16);
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.GoToContainingDir[0] = 'G';
|
keys.GoToContainingDir[0] = 'G';
|
||||||
keys.StartSearching[0] = 'y';
|
keys.StartSearching[0] = 'y';
|
||||||
keys.ToggleAutoCenter[0] = 'U';
|
keys.ToggleAutoCenter[0] = 'U';
|
||||||
keys.TogglePlaylistDisplayMode[0] = 'p';
|
keys.ToggleDisplayMode[0] = 'p';
|
||||||
keys.GoToParentDir[0] = 263;
|
keys.GoToParentDir[0] = 263;
|
||||||
keys.SwitchTagTypeList[0] = '`';
|
keys.SwitchTagTypeList[0] = '`';
|
||||||
keys.Quit[0] = 'q';
|
keys.Quit[0] = 'q';
|
||||||
@@ -222,7 +222,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.GoToContainingDir[1] = null_key;
|
keys.GoToContainingDir[1] = null_key;
|
||||||
keys.StartSearching[1] = null_key;
|
keys.StartSearching[1] = null_key;
|
||||||
keys.ToggleAutoCenter[1] = null_key;
|
keys.ToggleAutoCenter[1] = null_key;
|
||||||
keys.TogglePlaylistDisplayMode[1] = null_key;
|
keys.ToggleDisplayMode[1] = null_key;
|
||||||
keys.GoToParentDir[1] = 127;
|
keys.GoToParentDir[1] = 127;
|
||||||
keys.SwitchTagTypeList[1] = null_key;
|
keys.SwitchTagTypeList[1] = null_key;
|
||||||
keys.Quit[1] = 'Q';
|
keys.Quit[1] = 'Q';
|
||||||
@@ -261,6 +261,8 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
|||||||
conf.colors_enabled = true;
|
conf.colors_enabled = true;
|
||||||
conf.fancy_scrolling = true;
|
conf.fancy_scrolling = true;
|
||||||
conf.columns_in_playlist = false;
|
conf.columns_in_playlist = false;
|
||||||
|
conf.columns_in_browser = false;
|
||||||
|
conf.columns_in_search_engine = false;
|
||||||
conf.header_visibility = true;
|
conf.header_visibility = true;
|
||||||
conf.statusbar_visibility = true;
|
conf.statusbar_visibility = true;
|
||||||
conf.autocenter_mode = false;
|
conf.autocenter_mode = false;
|
||||||
@@ -476,8 +478,8 @@ void ReadKeys(ncmpcpp_keys &keys)
|
|||||||
GetKeys(key, keys.GoToNowPlaying);
|
GetKeys(key, keys.GoToNowPlaying);
|
||||||
else if (key.find("key_toggle_auto_center ") != string::npos)
|
else if (key.find("key_toggle_auto_center ") != string::npos)
|
||||||
GetKeys(key, keys.ToggleAutoCenter);
|
GetKeys(key, keys.ToggleAutoCenter);
|
||||||
else if (key.find("key_toggle_playlist_display_mode ") != string::npos)
|
else if (key.find("key_toggle_display_mode ") != string::npos)
|
||||||
GetKeys(key, keys.TogglePlaylistDisplayMode);
|
GetKeys(key, keys.ToggleDisplayMode);
|
||||||
else if (key.find("key_go_to_containing_directory ") != string::npos)
|
else if (key.find("key_go_to_containing_directory ") != string::npos)
|
||||||
GetKeys(key, keys.GoToContainingDir);
|
GetKeys(key, keys.GoToContainingDir);
|
||||||
else if (key.find("key_start_searching ") != string::npos)
|
else if (key.find("key_start_searching ") != string::npos)
|
||||||
@@ -628,6 +630,14 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
|||||||
{
|
{
|
||||||
conf.columns_in_playlist = v == "columns";
|
conf.columns_in_playlist = v == "columns";
|
||||||
}
|
}
|
||||||
|
else if (cl.find("browser_display_mode") != string::npos)
|
||||||
|
{
|
||||||
|
conf.columns_in_browser = v == "columns";
|
||||||
|
}
|
||||||
|
else if (cl.find("search_engine_display_mode") != string::npos)
|
||||||
|
{
|
||||||
|
conf.columns_in_search_engine = v == "columns";
|
||||||
|
}
|
||||||
else if (cl.find("header_visibility") != string::npos)
|
else if (cl.find("header_visibility") != string::npos)
|
||||||
{
|
{
|
||||||
conf.header_visibility = v == "yes";
|
conf.header_visibility = v == "yes";
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ struct ncmpcpp_keys
|
|||||||
int GoToContainingDir[2];
|
int GoToContainingDir[2];
|
||||||
int StartSearching[2];
|
int StartSearching[2];
|
||||||
int ToggleAutoCenter[2];
|
int ToggleAutoCenter[2];
|
||||||
int TogglePlaylistDisplayMode[2];
|
int ToggleDisplayMode[2];
|
||||||
int GoToParentDir[2];
|
int GoToParentDir[2];
|
||||||
int SwitchTagTypeList[2];
|
int SwitchTagTypeList[2];
|
||||||
int Quit[2];
|
int Quit[2];
|
||||||
@@ -133,6 +133,8 @@ struct ncmpcpp_config
|
|||||||
bool colors_enabled;
|
bool colors_enabled;
|
||||||
bool fancy_scrolling;
|
bool fancy_scrolling;
|
||||||
bool columns_in_playlist;
|
bool columns_in_playlist;
|
||||||
|
bool columns_in_browser;
|
||||||
|
bool columns_in_search_engine;
|
||||||
bool set_window_title;
|
bool set_window_title;
|
||||||
bool header_visibility;
|
bool header_visibility;
|
||||||
bool statusbar_visibility;
|
bool statusbar_visibility;
|
||||||
|
|||||||
Reference in New Issue
Block a user