base for custom keys configuration + a few minor fixes
This commit is contained in:
@@ -61,6 +61,11 @@ extern string UNKNOWN_ARTIST;
|
|||||||
extern string UNKNOWN_TITLE;
|
extern string UNKNOWN_TITLE;
|
||||||
extern string UNKNOWN_ALBUM;
|
extern string UNKNOWN_ALBUM;
|
||||||
|
|
||||||
|
bool Keypressed(int in, const int *key)
|
||||||
|
{
|
||||||
|
return in == key[0] || in == key[1];
|
||||||
|
}
|
||||||
|
|
||||||
bool SortSongsByTrack(Song *a, Song *b)
|
bool SortSongsByTrack(Song *a, Song *b)
|
||||||
{
|
{
|
||||||
return StrToInt(a->GetTrack()) < StrToInt(b->GetTrack());
|
return StrToInt(a->GetTrack()) < StrToInt(b->GetTrack());
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
extern ncmpcpp_config Config;
|
extern ncmpcpp_config Config;
|
||||||
|
|
||||||
|
bool Keypressed(int, const int *);
|
||||||
bool SortSongsByTrack(Song *, Song *);
|
bool SortSongsByTrack(Song *, Song *);
|
||||||
bool CaseInsensitiveComparison(string, string);
|
bool CaseInsensitiveComparison(string, string);
|
||||||
void WindowTitle(const string &);
|
void WindowTitle(const string &);
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ void MPDConnection::GetPlaylistChanges(long long id, SongList &v) const
|
|||||||
{
|
{
|
||||||
if (isConnected)
|
if (isConnected)
|
||||||
{
|
{
|
||||||
if (id == -1)
|
if (id < 0)
|
||||||
{
|
{
|
||||||
id = 0;
|
id = 0;
|
||||||
v.reserve(GetPlaylistLength());
|
v.reserve(GetPlaylistLength());
|
||||||
|
|||||||
264
src/ncmpcpp.cpp
264
src/ncmpcpp.cpp
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#define UNLOCK_STATUSBAR \
|
#define UNLOCK_STATUSBAR \
|
||||||
allow_statusbar_unblock = 1; \
|
allow_statusbar_unblock = 1; \
|
||||||
if (block_statusbar_update_delay <= 0) \
|
if (block_statusbar_update_delay < 0) \
|
||||||
{ \
|
{ \
|
||||||
if (Config.statusbar_visibility) \
|
if (Config.statusbar_visibility) \
|
||||||
block_statusbar_update = 0; \
|
block_statusbar_update = 0; \
|
||||||
@@ -59,6 +59,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ncmpcpp_config Config;
|
ncmpcpp_config Config;
|
||||||
|
ncmpcpp_keys Key;
|
||||||
|
|
||||||
SongList vPlaylist;
|
SongList vPlaylist;
|
||||||
SongList vSearched;
|
SongList vSearched;
|
||||||
@@ -146,6 +147,7 @@ const string message_part_of_songs_added = "Only part of requested songs' list a
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
DefaultConfiguration(Config);
|
DefaultConfiguration(Config);
|
||||||
|
DefaultKeys(Key);
|
||||||
ReadConfiguration(Config);
|
ReadConfiguration(Config);
|
||||||
DefineEmptyTags();
|
DefineEmptyTags();
|
||||||
|
|
||||||
@@ -248,7 +250,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
sHelp->Add(" [b]Keys - Playlist screen\n -----------------------------------------[/b]\n");
|
sHelp->Add(" [b]Keys - Playlist screen\n -----------------------------------------[/b]\n");
|
||||||
sHelp->Add("\tEnter : Play\n");
|
sHelp->Add("\tEnter : Play\n");
|
||||||
sHelp->Add("\tDelete : Delete song from playlist\n");
|
sHelp->Add("\tDelete d : Delete song from playlist\n");
|
||||||
sHelp->Add("\tc : Clear whole playlist\n");
|
sHelp->Add("\tc : Clear whole playlist\n");
|
||||||
sHelp->Add("\tC : Clear playlist but hold currently playing song\n");
|
sHelp->Add("\tC : Clear playlist but hold currently playing song\n");
|
||||||
sHelp->Add("\tm : Move song up\n");
|
sHelp->Add("\tm : Move song up\n");
|
||||||
@@ -261,7 +263,7 @@ int main(int argc, char *argv[])
|
|||||||
sHelp->Add("\tEnter : Enter directory/Add item to playlist and play\n");
|
sHelp->Add("\tEnter : Enter directory/Add item to playlist and play\n");
|
||||||
sHelp->Add("\tSpace : Add item to playlist\n");
|
sHelp->Add("\tSpace : Add item to playlist\n");
|
||||||
sHelp->Add("\tBackspace : Go to parent directory\n");
|
sHelp->Add("\tBackspace : Go to parent directory\n");
|
||||||
sHelp->Add("\tDelete : Delete playlist\n\n\n");
|
sHelp->Add("\tDelete d : Delete playlist\n\n\n");
|
||||||
|
|
||||||
sHelp->Add(" [b]Keys - Search engine\n -----------------------------------------[/b]\n");
|
sHelp->Add(" [b]Keys - Search engine\n -----------------------------------------[/b]\n");
|
||||||
sHelp->Add("\tEnter : Change option/Add to playlist and play song\n");
|
sHelp->Add("\tEnter : Change option/Add to playlist and play song\n");
|
||||||
@@ -496,7 +498,7 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case csLibrary:
|
case csLibrary:
|
||||||
{
|
{
|
||||||
if (input == KEY_UP || input == 'k' || input == KEY_DOWN || input == 'j' || input == KEY_PPAGE || input == KEY_NPAGE || input == KEY_HOME || input == KEY_END)
|
if (Keypressed(input, Key.Up) || Keypressed(input, Key.Down) || Keypressed(input, Key.PageUp) || Keypressed(input, Key.PageDown) || Keypressed(input, Key.Home) || Keypressed(input, Key.End))
|
||||||
{
|
{
|
||||||
if (wCurrent == mLibArtists)
|
if (wCurrent == mLibArtists)
|
||||||
{
|
{
|
||||||
@@ -512,15 +514,21 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (input)
|
// key mapping beginning
|
||||||
{
|
|
||||||
case KEY_UP: case 'k': wCurrent->Go(UP); continue;
|
if (Keypressed(input, Key.Up))
|
||||||
case KEY_DOWN: case 'j': wCurrent->Go(DOWN); continue;
|
wCurrent->Go(UP);
|
||||||
case KEY_PPAGE: wCurrent->Go(PAGE_UP); continue;
|
else if (Keypressed(input, Key.Down))
|
||||||
case KEY_NPAGE: wCurrent->Go(PAGE_DOWN); continue;
|
wCurrent->Go(DOWN);
|
||||||
case KEY_HOME: wCurrent->Go(HOME); continue;
|
else if (Keypressed(input, Key.PageUp))
|
||||||
case KEY_END: wCurrent->Go(END); continue;
|
wCurrent->Go(PAGE_UP);
|
||||||
case KEY_RESIZE:
|
else if (Keypressed(input, Key.PageDown))
|
||||||
|
wCurrent->Go(PAGE_DOWN);
|
||||||
|
else if (Keypressed(input, Key.Home))
|
||||||
|
wCurrent->Go(HOME);
|
||||||
|
else if (Keypressed(input, Key.End))
|
||||||
|
wCurrent->Go(END);
|
||||||
|
else if (input == KEY_RESIZE)
|
||||||
{
|
{
|
||||||
int in;
|
int in;
|
||||||
|
|
||||||
@@ -598,17 +606,16 @@ int main(int argc, char *argv[])
|
|||||||
changes.PlayerState = 1;
|
changes.PlayerState = 1;
|
||||||
|
|
||||||
NcmpcppStatusChanged(Mpd, changes, NULL);
|
NcmpcppStatusChanged(Mpd, changes, NULL);
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case KEY_BACKSPACE: case 127:
|
else if (Keypressed(input, Key.GoToParentDir))
|
||||||
{
|
{
|
||||||
if (wCurrent == mBrowser && browsed_dir != "/")
|
if (wCurrent == mBrowser && browsed_dir != "/")
|
||||||
|
{
|
||||||
mBrowser->Reset();
|
mBrowser->Reset();
|
||||||
else
|
goto GO_TO_PARENT_DIR;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case ENTER:
|
}
|
||||||
|
else if (Keypressed(input, Key.Enter))
|
||||||
{
|
{
|
||||||
switch (current_screen)
|
switch (current_screen)
|
||||||
{
|
{
|
||||||
@@ -620,6 +627,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
case csBrowser:
|
case csBrowser:
|
||||||
{
|
{
|
||||||
|
GO_TO_PARENT_DIR:
|
||||||
|
|
||||||
int ci = mBrowser->GetChoice()-1;
|
int ci = mBrowser->GetChoice()-1;
|
||||||
switch (vBrowser[ci].type)
|
switch (vBrowser[ci].type)
|
||||||
{
|
{
|
||||||
@@ -775,8 +784,8 @@ int main(int argc, char *argv[])
|
|||||||
f.tag()->setTitle(NCMPCPP_TO_WSTRING(s.GetTitle()));
|
f.tag()->setTitle(NCMPCPP_TO_WSTRING(s.GetTitle()));
|
||||||
f.tag()->setArtist(NCMPCPP_TO_WSTRING(s.GetArtist()));
|
f.tag()->setArtist(NCMPCPP_TO_WSTRING(s.GetArtist()));
|
||||||
f.tag()->setAlbum(NCMPCPP_TO_WSTRING(s.GetAlbum()));
|
f.tag()->setAlbum(NCMPCPP_TO_WSTRING(s.GetAlbum()));
|
||||||
f.tag()->setYear(atoi(s.GetYear().c_str()));
|
f.tag()->setYear(StrToInt(s.GetYear()));
|
||||||
f.tag()->setTrack(atoi(s.GetTrack().c_str()));
|
f.tag()->setTrack(StrToInt(s.GetTrack()));
|
||||||
f.tag()->setGenre(NCMPCPP_TO_WSTRING(s.GetGenre()));
|
f.tag()->setGenre(NCMPCPP_TO_WSTRING(s.GetGenre()));
|
||||||
f.tag()->setComment(NCMPCPP_TO_WSTRING(s.GetComment()));
|
f.tag()->setComment(NCMPCPP_TO_WSTRING(s.GetComment()));
|
||||||
s.GetEmptyFields(0);
|
s.GetEmptyFields(0);
|
||||||
@@ -985,7 +994,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
case csLibrary:
|
case csLibrary:
|
||||||
{
|
{
|
||||||
Start_Point_For_KEY_SPACE: // same code for KEY_SPACE, but without playing.
|
ENTER_LIBRARY_SCREEN: // same code for Key.Space, but without playing.
|
||||||
|
|
||||||
SongList list;
|
SongList list;
|
||||||
|
|
||||||
@@ -1003,33 +1012,31 @@ int main(int argc, char *argv[])
|
|||||||
Song *s = vPlaylist[vPlaylist.size()-list.size()];
|
Song *s = vPlaylist[vPlaylist.size()-list.size()];
|
||||||
if (s->GetHash() == list[0]->GetHash())
|
if (s->GetHash() == list[0]->GetHash())
|
||||||
{
|
{
|
||||||
if (input == ENTER)
|
if (Keypressed(input, Key.Enter))
|
||||||
Mpd->PlayID(s->GetID());
|
Mpd->PlayID(s->GetID());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ShowMessage(message_part_of_songs_added);
|
ShowMessage(message_part_of_songs_added);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (wCurrent == mLibAlbums)
|
||||||
if (wCurrent == mLibAlbums)
|
|
||||||
{
|
{
|
||||||
for (SongList::const_iterator it = vSongs.begin(); it != vSongs.end(); it++)
|
for (SongList::const_iterator it = vSongs.begin(); it != vSongs.end(); it++)
|
||||||
Mpd->QueueAddSong(**it);
|
Mpd->QueueAddSong(**it);
|
||||||
if (Mpd->CommitQueue())
|
if (Mpd->CommitQueue())
|
||||||
{
|
{
|
||||||
ShowMessage("Adding songs from album: " + mLibAlbums->GetCurrentOption());
|
ShowMessage("Adding songs from: " + mLibArtists->GetCurrentOption() + " \"" + mLibAlbums->GetCurrentOption() + "\"");
|
||||||
Song *s = vPlaylist[vPlaylist.size()-vSongs.size()];
|
Song *s = vPlaylist[vPlaylist.size()-vSongs.size()];
|
||||||
if (s->GetHash() == vSongs[0]->GetHash())
|
if (s->GetHash() == vSongs[0]->GetHash())
|
||||||
{
|
{
|
||||||
if (input == ENTER)
|
if (Keypressed(input, Key.Enter))
|
||||||
Mpd->PlayID(s->GetID());
|
Mpd->PlayID(s->GetID());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ShowMessage(message_part_of_songs_added);
|
ShowMessage(message_part_of_songs_added);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (wCurrent == mLibSongs)
|
||||||
if (wCurrent == mLibSongs)
|
|
||||||
{
|
{
|
||||||
if (!vSongs.empty())
|
if (!vSongs.empty())
|
||||||
{
|
{
|
||||||
@@ -1038,7 +1045,7 @@ int main(int argc, char *argv[])
|
|||||||
if (id >= 0)
|
if (id >= 0)
|
||||||
{
|
{
|
||||||
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
||||||
if (input == ENTER)
|
if (Keypressed(input, Key.Enter))
|
||||||
Mpd->PlayID(id);
|
Mpd->PlayID(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1046,7 +1053,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
|
|
||||||
if (input == KEY_SPACE)
|
if (Keypressed(input, Key.Space))
|
||||||
wCurrent->Go(DOWN);
|
wCurrent->Go(DOWN);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -1054,9 +1061,8 @@ int main(int argc, char *argv[])
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case KEY_SPACE:
|
else if (Keypressed(input, Key.Space))
|
||||||
{
|
{
|
||||||
if (current_screen == csBrowser)
|
if (current_screen == csBrowser)
|
||||||
{
|
{
|
||||||
@@ -1108,24 +1114,23 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
mBrowser->Go(DOWN);
|
mBrowser->Go(DOWN);
|
||||||
}
|
}
|
||||||
if (current_screen == csSearcher && !vSearched.empty())
|
else if (current_screen == csSearcher && !vSearched.empty())
|
||||||
{
|
{
|
||||||
int id = mSearcher->GetChoice()-search_engine_static_option-1;
|
int id = mSearcher->GetChoice()-search_engine_static_option-1;
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
Song &s = *vSearched[id];
|
Song &s = *vSearched[id];
|
||||||
if (Mpd->AddSong(s) != -1)
|
if (Mpd->AddSong(s) != -1)
|
||||||
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
||||||
mSearcher->Go(DOWN);
|
mSearcher->Go(DOWN);
|
||||||
}
|
}
|
||||||
if (current_screen == csLibrary)
|
else if (current_screen == csLibrary)
|
||||||
goto Start_Point_For_KEY_SPACE; // sorry, but that's stupid to copy the same code here.
|
goto ENTER_LIBRARY_SCREEN; // sorry, but that's stupid to copy the same code here.
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case KEY_RIGHT:
|
else if (Keypressed(input, Key.VolumeUp))
|
||||||
{
|
{
|
||||||
if (current_screen == csLibrary)
|
if (current_screen == csLibrary && input == Key.VolumeUp[0])
|
||||||
{
|
{
|
||||||
if (wCurrent == mLibArtists)
|
if (wCurrent == mLibArtists)
|
||||||
{
|
{
|
||||||
@@ -1134,7 +1139,7 @@ int main(int argc, char *argv[])
|
|||||||
wCurrent = mLibAlbums;
|
wCurrent = mLibAlbums;
|
||||||
mLibAlbums->HighlightColor(Config.library_active_column_color);
|
mLibAlbums->HighlightColor(Config.library_active_column_color);
|
||||||
if (!mLibAlbums->Empty())
|
if (!mLibAlbums->Empty())
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
if (wCurrent == mLibAlbums)
|
if (wCurrent == mLibAlbums)
|
||||||
{
|
{
|
||||||
@@ -1142,19 +1147,14 @@ int main(int argc, char *argv[])
|
|||||||
wCurrent->Refresh();
|
wCurrent->Refresh();
|
||||||
wCurrent = mLibSongs;
|
wCurrent = mLibSongs;
|
||||||
mLibSongs->HighlightColor(Config.library_active_column_color);
|
mLibSongs->HighlightColor(Config.library_active_column_color);
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case '+': // volume up
|
else
|
||||||
{
|
|
||||||
Mpd->SetVolume(Mpd->GetVolume()+1);
|
Mpd->SetVolume(Mpd->GetVolume()+1);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case KEY_LEFT:
|
else if (Keypressed(input, Key.VolumeDown))
|
||||||
{
|
{
|
||||||
if (current_screen == csLibrary)
|
if (current_screen == csLibrary && input == Key.VolumeDown[0])
|
||||||
{
|
{
|
||||||
if (wCurrent == mLibSongs)
|
if (wCurrent == mLibSongs)
|
||||||
{
|
{
|
||||||
@@ -1163,7 +1163,7 @@ int main(int argc, char *argv[])
|
|||||||
wCurrent = mLibAlbums;
|
wCurrent = mLibAlbums;
|
||||||
mLibAlbums->HighlightColor(Config.library_active_column_color);
|
mLibAlbums->HighlightColor(Config.library_active_column_color);
|
||||||
if (!mLibAlbums->Empty())
|
if (!mLibAlbums->Empty())
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
if (wCurrent == mLibAlbums)
|
if (wCurrent == mLibAlbums)
|
||||||
{
|
{
|
||||||
@@ -1171,17 +1171,12 @@ int main(int argc, char *argv[])
|
|||||||
wCurrent->Refresh();
|
wCurrent->Refresh();
|
||||||
wCurrent = mLibArtists;
|
wCurrent = mLibArtists;
|
||||||
mLibArtists->HighlightColor(Config.library_active_column_color);
|
mLibArtists->HighlightColor(Config.library_active_column_color);
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case '-': // volume down
|
else
|
||||||
{
|
|
||||||
Mpd->SetVolume(Mpd->GetVolume()-1);
|
Mpd->SetVolume(Mpd->GetVolume()-1);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case KEY_DC: // delete position from list
|
else if (Keypressed(input, Key.Delete))
|
||||||
{
|
{
|
||||||
if (!mPlaylist->Empty() && current_screen == csPlaylist)
|
if (!mPlaylist->Empty() && current_screen == csPlaylist)
|
||||||
{
|
{
|
||||||
@@ -1190,23 +1185,17 @@ int main(int argc, char *argv[])
|
|||||||
mPlaylist->Timeout(50);
|
mPlaylist->Timeout(50);
|
||||||
int id = mPlaylist->GetChoice()-1;
|
int id = mPlaylist->GetChoice()-1;
|
||||||
|
|
||||||
while (!vPlaylist.empty() && input == KEY_DC)
|
while (!vPlaylist.empty() && Keypressed(input, Key.Delete))
|
||||||
{
|
{
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
|
|
||||||
if (input == KEY_DC)
|
|
||||||
{
|
|
||||||
id = mPlaylist->GetChoice()-1;
|
id = mPlaylist->GetChoice()-1;
|
||||||
|
|
||||||
Mpd->QueueDeleteSong(id);
|
Mpd->QueueDeleteSong(id);
|
||||||
delete vPlaylist[id];
|
delete vPlaylist[id];
|
||||||
vPlaylist.erase(vPlaylist.begin()+id);
|
vPlaylist.erase(vPlaylist.begin()+id);
|
||||||
mPlaylist->DeleteOption(id+1);
|
mPlaylist->DeleteOption(id+1);
|
||||||
if (now_playing > id)
|
|
||||||
now_playing--;
|
|
||||||
mPlaylist->Refresh();
|
mPlaylist->Refresh();
|
||||||
}
|
|
||||||
mPlaylist->ReadKey(input);
|
mPlaylist->ReadKey(input);
|
||||||
}
|
}
|
||||||
Mpd->CommitQueue();
|
Mpd->CommitQueue();
|
||||||
@@ -1219,7 +1208,6 @@ int main(int argc, char *argv[])
|
|||||||
int id = mBrowser->GetChoice()-1;
|
int id = mBrowser->GetChoice()-1;
|
||||||
if (vBrowser[id].type == itPlaylist)
|
if (vBrowser[id].type == itPlaylist)
|
||||||
{
|
{
|
||||||
block_statusbar_update = 1;
|
|
||||||
wFooter->WriteXY(0, Config.statusbar_visibility, "Delete playlist " + vBrowser[id].name + " ? [y/n] ", 1);
|
wFooter->WriteXY(0, Config.statusbar_visibility, "Delete playlist " + vBrowser[id].name + " ? [y/n] ", 1);
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
int in = 0;
|
int in = 0;
|
||||||
@@ -1229,7 +1217,6 @@ int main(int argc, char *argv[])
|
|||||||
wFooter->ReadKey(in);
|
wFooter->ReadKey(in);
|
||||||
}
|
}
|
||||||
while (in != 'y' && in != 'n');
|
while (in != 'y' && in != 'n');
|
||||||
block_statusbar_update = 0;
|
|
||||||
if (in == 'y')
|
if (in == 'y')
|
||||||
{
|
{
|
||||||
Mpd->DeletePlaylist(vBrowser[id].name);
|
Mpd->DeletePlaylist(vBrowser[id].name);
|
||||||
@@ -1239,27 +1226,17 @@ int main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
ShowMessage("Aborted!");
|
ShowMessage("Aborted!");
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
}
|
||||||
UNLOCK_STATUSBAR;
|
UNLOCK_STATUSBAR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
else if (Keypressed(input, Key.Prev))
|
||||||
}
|
|
||||||
case '<': // previous
|
|
||||||
{
|
|
||||||
Mpd->Prev();
|
Mpd->Prev();
|
||||||
break;
|
else if (Keypressed(input, Key.Next))
|
||||||
}
|
|
||||||
case '>': // next
|
|
||||||
{
|
|
||||||
Mpd->Next();
|
Mpd->Next();
|
||||||
break;
|
else if (Keypressed(input, Key.Pause))
|
||||||
}
|
|
||||||
case 'P': // pause
|
|
||||||
{
|
|
||||||
Mpd->Pause();
|
Mpd->Pause();
|
||||||
break;
|
else if (Keypressed(input, Key.SavePlaylist))
|
||||||
}
|
|
||||||
case 'S': // save playlist
|
|
||||||
{
|
{
|
||||||
LOCK_STATUSBAR;
|
LOCK_STATUSBAR;
|
||||||
wFooter->WriteXY(0, Config.statusbar_visibility, "Save playlist as: ", 1);
|
wFooter->WriteXY(0, Config.statusbar_visibility, "Save playlist as: ", 1);
|
||||||
@@ -1279,14 +1256,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (browsed_dir == "/" && !vBrowser.empty())
|
if (browsed_dir == "/" && !vBrowser.empty())
|
||||||
GetDirectory(browsed_dir);
|
GetDirectory(browsed_dir);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 's': // stop
|
else if (Keypressed(input, Key.Stop))
|
||||||
{
|
|
||||||
Mpd->Stop();
|
Mpd->Stop();
|
||||||
break;
|
else if (Keypressed(input, Key.MvSongUp))
|
||||||
}
|
|
||||||
case 'm': // move song up
|
|
||||||
{
|
{
|
||||||
block_playlist_update = 1;
|
block_playlist_update = 1;
|
||||||
int pos = mPlaylist->GetChoice()-1;
|
int pos = mPlaylist->GetChoice()-1;
|
||||||
@@ -1313,9 +1286,8 @@ int main(int argc, char *argv[])
|
|||||||
Mpd->Move(pos, pos-1);
|
Mpd->Move(pos, pos-1);
|
||||||
mPlaylist->Go(UP);
|
mPlaylist->Go(UP);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'n': // move song down
|
else if (Keypressed(input, Key.MvSongDown))
|
||||||
{
|
{
|
||||||
block_playlist_update = 1;
|
block_playlist_update = 1;
|
||||||
int pos = mPlaylist->GetChoice()-1;
|
int pos = mPlaylist->GetChoice()-1;
|
||||||
@@ -1342,12 +1314,11 @@ int main(int argc, char *argv[])
|
|||||||
Mpd->Move(pos, pos+1);
|
Mpd->Move(pos, pos+1);
|
||||||
mPlaylist->Go(DOWN);
|
mPlaylist->Go(DOWN);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'f': case 'b': // seek through song
|
else if (Keypressed(input, Key.SeekForward) || Keypressed(input, Key.SeekBackward))
|
||||||
{
|
{
|
||||||
if (now_playing < 0)
|
if (now_playing < 0)
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
block_progressbar_update = 1;
|
block_progressbar_update = 1;
|
||||||
LOCK_STATUSBAR;
|
LOCK_STATUSBAR;
|
||||||
@@ -1362,11 +1333,11 @@ int main(int argc, char *argv[])
|
|||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
mPlaylist->ReadKey(in);
|
mPlaylist->ReadKey(in);
|
||||||
if (in == 'f' || in == 'b')
|
if (Keypressed(in, Key.SeekForward) || Keypressed(in, Key.SeekBackward))
|
||||||
{
|
{
|
||||||
if (songpos < s.GetTotalLength() && in == 'f')
|
if (songpos < s.GetTotalLength() && Keypressed(in, Key.SeekForward))
|
||||||
songpos++;
|
songpos++;
|
||||||
if (songpos < s.GetTotalLength() && songpos > 0 && in == 'b')
|
if (songpos < s.GetTotalLength() && songpos > 0 && Keypressed(in, Key.SeekBackward))
|
||||||
songpos--;
|
songpos--;
|
||||||
if (songpos < 0)
|
if (songpos < 0)
|
||||||
songpos = 0;
|
songpos = 0;
|
||||||
@@ -1390,50 +1361,33 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
block_progressbar_update = 0;
|
block_progressbar_update = 0;
|
||||||
UNLOCK_STATUSBAR;
|
UNLOCK_STATUSBAR;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'U': // toggle autocenter mode
|
else if (Keypressed(input, Key.ToggleAutoCenter))
|
||||||
{
|
{
|
||||||
Config.autocenter_mode = !Config.autocenter_mode;
|
Config.autocenter_mode = !Config.autocenter_mode;
|
||||||
ShowMessage("Auto center mode: " + string(Config.autocenter_mode ? "On" : "Off"));
|
ShowMessage("Auto center mode: " + string(Config.autocenter_mode ? "On" : "Off"));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'u': // update database
|
else if (Keypressed(input, Key.UpdateDB))
|
||||||
{
|
{
|
||||||
if (current_screen == csBrowser)
|
if (current_screen == csBrowser)
|
||||||
Mpd->UpdateDirectory(browsed_dir);
|
Mpd->UpdateDirectory(browsed_dir);
|
||||||
else
|
else
|
||||||
Mpd->UpdateDirectory("/");
|
Mpd->UpdateDirectory("/");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'o': // go to playing song
|
else if (Keypressed(input, Key.GoToNowPlaying))
|
||||||
{
|
{
|
||||||
if (current_screen == csPlaylist && now_playing >= 0)
|
if (current_screen == csPlaylist && now_playing >= 0)
|
||||||
mPlaylist->Highlight(now_playing+1);
|
mPlaylist->Highlight(now_playing+1);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'r': // switch repeat state
|
else if (Keypressed(input, Key.ToggleRepeat))
|
||||||
{
|
|
||||||
Mpd->SetRepeat(!Mpd->GetRepeat());
|
Mpd->SetRepeat(!Mpd->GetRepeat());
|
||||||
break;
|
else if (Keypressed(input, Key.Shuffle))
|
||||||
}
|
|
||||||
case 'Z': // shuffle playlist
|
|
||||||
{
|
|
||||||
Mpd->Shuffle();
|
Mpd->Shuffle();
|
||||||
break;
|
else if (Keypressed(input, Key.ToggleRandom))
|
||||||
}
|
|
||||||
case 'z': // switch random state
|
|
||||||
{
|
|
||||||
Mpd->SetRandom(!Mpd->GetRandom());
|
Mpd->SetRandom(!Mpd->GetRandom());
|
||||||
break;
|
else if (Keypressed(input, Key.ToggleCrossfade))
|
||||||
}
|
|
||||||
case 'x': // switch crossfade state
|
|
||||||
{
|
|
||||||
Mpd->SetCrossfade(Mpd->GetCrossfade() ? 0 : Config.crossfade_time);
|
Mpd->SetCrossfade(Mpd->GetCrossfade() ? 0 : Config.crossfade_time);
|
||||||
break;
|
else if (Keypressed(input, Key.SetCrossfade))
|
||||||
}
|
|
||||||
case 'X': // set crossfade
|
|
||||||
{
|
{
|
||||||
LOCK_STATUSBAR;
|
LOCK_STATUSBAR;
|
||||||
wFooter->WriteXY(0, Config.statusbar_visibility, "Set crossfade to: ", 1);
|
wFooter->WriteXY(0, Config.statusbar_visibility, "Set crossfade to: ", 1);
|
||||||
@@ -1445,9 +1399,8 @@ int main(int argc, char *argv[])
|
|||||||
Config.crossfade_time = cf;
|
Config.crossfade_time = cf;
|
||||||
Mpd->SetCrossfade(cf);
|
Mpd->SetCrossfade(cf);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'e': // edit song's tags
|
else if (Keypressed(input, Key.EditTags))
|
||||||
{
|
{
|
||||||
if ((wCurrent == mPlaylist && !vPlaylist.empty())
|
if ((wCurrent == mPlaylist && !vPlaylist.empty())
|
||||||
|| (wCurrent == mBrowser && vBrowser[mBrowser->GetChoice()-1].type == itSong)
|
|| (wCurrent == mBrowser && vBrowser[mBrowser->GetChoice()-1].type == itSong)
|
||||||
@@ -1483,12 +1436,11 @@ int main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
ShowMessage("Cannot read file!");
|
ShowMessage("Cannot read file!");
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'g': // go to position in currently playing song
|
else if (Keypressed(input, Key.GoToPosition))
|
||||||
{
|
{
|
||||||
if (now_playing < 0)
|
if (now_playing < 0)
|
||||||
break;
|
continue;
|
||||||
int newpos = 0;
|
int newpos = 0;
|
||||||
string position;
|
string position;
|
||||||
LOCK_STATUSBAR;
|
LOCK_STATUSBAR;
|
||||||
@@ -1498,14 +1450,13 @@ int main(int argc, char *argv[])
|
|||||||
if (newpos > 0 && newpos < 100 && !position.empty())
|
if (newpos > 0 && newpos < 100 && !position.empty())
|
||||||
Mpd->Seek(vPlaylist[now_playing]->GetTotalLength()*newpos/100.0);
|
Mpd->Seek(vPlaylist[now_playing]->GetTotalLength()*newpos/100.0);
|
||||||
UNLOCK_STATUSBAR;
|
UNLOCK_STATUSBAR;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'C': // clear playlist but holds currently playing song
|
else if (Keypressed(input, Key.Crop))
|
||||||
{
|
{
|
||||||
if (now_playing < 0)
|
if (now_playing < 0)
|
||||||
{
|
{
|
||||||
ShowMessage("Nothing is playing now!");
|
ShowMessage("Nothing is playing now!");
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
for (SongList::iterator it = vPlaylist.begin(); it != vPlaylist.begin()+now_playing; it++)
|
for (SongList::iterator it = vPlaylist.begin(); it != vPlaylist.begin()+now_playing; it++)
|
||||||
Mpd->QueueDeleteSongId((*it)->GetID());
|
Mpd->QueueDeleteSongId((*it)->GetID());
|
||||||
@@ -1514,20 +1465,19 @@ int main(int argc, char *argv[])
|
|||||||
ShowMessage("Deleting all songs except now playing one...");
|
ShowMessage("Deleting all songs except now playing one...");
|
||||||
Mpd->CommitQueue();
|
Mpd->CommitQueue();
|
||||||
ShowMessage("Songs deleted!");
|
ShowMessage("Songs deleted!");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'c': // clear playlist
|
else if (Keypressed(input, Key.Clear))
|
||||||
{
|
{
|
||||||
ShowMessage("Clearing playlist...");
|
ShowMessage("Clearing playlist...");
|
||||||
Mpd->ClearPlaylist();
|
Mpd->ClearPlaylist();
|
||||||
ShowMessage("Cleared playlist!");
|
ShowMessage("Cleared playlist!");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case '/': case '?': // find forward/backward
|
else if (Keypressed(input, Key.FindForward) || Keypressed(input, Key.FindBackward))
|
||||||
{
|
{
|
||||||
if ((current_screen != csHelp && current_screen != csSearcher) || (current_screen == csSearcher && !vSearched.empty()))
|
if ((current_screen != csHelp && current_screen != csSearcher)
|
||||||
|
|| (current_screen == csSearcher && !vSearched.empty()))
|
||||||
{
|
{
|
||||||
string how = input == '/' ? "forward" : "backward";
|
string how = Keypressed(input, Key.FindForward) ? "forward" : "backward";
|
||||||
found_pos = 0;
|
found_pos = 0;
|
||||||
vFoundPositions.clear();
|
vFoundPositions.clear();
|
||||||
Menu *mCurrent = static_cast<Menu *>(wCurrent);
|
Menu *mCurrent = static_cast<Menu *>(wCurrent);
|
||||||
@@ -1540,7 +1490,7 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
transform(findme.begin(), findme.end(), findme.begin(), tolower);
|
transform(findme.begin(), findme.end(), findme.begin(), tolower);
|
||||||
|
|
||||||
if (input == '/') // forward
|
if (Keypressed(input, Key.FindForward)) // forward
|
||||||
{
|
{
|
||||||
for (int i = mCurrent->GetChoice(); i <= mCurrent->MaxChoice(); i++)
|
for (int i = mCurrent->GetChoice(); i <= mCurrent->MaxChoice(); i++)
|
||||||
{
|
{
|
||||||
@@ -1569,20 +1519,19 @@ int main(int argc, char *argv[])
|
|||||||
mCurrent->Highlighting(1);
|
mCurrent->Highlighting(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case ',': case '.': // go to previous/next found position
|
else if (Keypressed(input, Key.NextFoundPosition) || Keypressed(input, Key.PrevFoundPosition))
|
||||||
{
|
{
|
||||||
if (!vFoundPositions.empty())
|
if (!vFoundPositions.empty())
|
||||||
{
|
{
|
||||||
Menu *mCurrent = static_cast<Menu *>(wCurrent);
|
Menu *mCurrent = static_cast<Menu *>(wCurrent);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mCurrent->Highlight(vFoundPositions.at(input == '.' ? ++found_pos : --found_pos));
|
mCurrent->Highlight(vFoundPositions.at(Keypressed(input, Key.NextFoundPosition) ? ++found_pos : --found_pos));
|
||||||
}
|
}
|
||||||
catch (std::out_of_range)
|
catch (std::out_of_range)
|
||||||
{
|
{
|
||||||
if (input == '.')
|
if (Keypressed(input, Key.NextFoundPosition))
|
||||||
{
|
{
|
||||||
mCurrent->Highlight(vFoundPositions.front());
|
mCurrent->Highlight(vFoundPositions.front());
|
||||||
found_pos = 0;
|
found_pos = 0;
|
||||||
@@ -1594,9 +1543,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'l': // show lyrics
|
else if (Keypressed(input, Key.Lyrics))
|
||||||
{
|
{
|
||||||
if (wCurrent == sLyrics)
|
if (wCurrent == sLyrics)
|
||||||
{
|
{
|
||||||
@@ -1608,7 +1556,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
REFRESH_MEDIA_LIBRARY_SCREEN;
|
REFRESH_MEDIA_LIBRARY_SCREEN;
|
||||||
}
|
}
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
if ((wCurrent == mPlaylist && !vPlaylist.empty())
|
if ((wCurrent == mPlaylist && !vPlaylist.empty())
|
||||||
|| (wCurrent == mBrowser && vBrowser[mBrowser->GetChoice()-1].type == itSong)
|
|| (wCurrent == mBrowser && vBrowser[mBrowser->GetChoice()-1].type == itSong)
|
||||||
@@ -1649,9 +1597,8 @@ int main(int argc, char *argv[])
|
|||||||
sLyrics->Timeout(ncmpcpp_window_timeout);
|
sLyrics->Timeout(ncmpcpp_window_timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case '1': // help screen
|
else if (Keypressed(input, Key.Help))
|
||||||
{
|
{
|
||||||
if (wCurrent != sHelp)
|
if (wCurrent != sHelp)
|
||||||
{
|
{
|
||||||
@@ -1659,18 +1606,17 @@ int main(int argc, char *argv[])
|
|||||||
wCurrent->Hide();
|
wCurrent->Hide();
|
||||||
current_screen = csHelp;
|
current_screen = csHelp;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case KEY_TAB: // switch between playlist and browser
|
else if (Keypressed(input, Key.ScreenSwitcher))
|
||||||
{
|
{
|
||||||
if (wCurrent == mPlaylist)
|
if (wCurrent == mPlaylist)
|
||||||
goto KEY_TAB_BROWSER_REDIRECT;
|
goto SWITCHER_BROWSER_REDIRECT;
|
||||||
else
|
else
|
||||||
goto KEY_TAB_PLAYLIST_REDIRECT;
|
goto SWITCHER_PLAYLIST_REDIRECT;
|
||||||
}
|
}
|
||||||
case '2': // playlist screen
|
else if (Keypressed(input, Key.Playlist))
|
||||||
{
|
{
|
||||||
KEY_TAB_PLAYLIST_REDIRECT:
|
SWITCHER_PLAYLIST_REDIRECT:
|
||||||
if (wCurrent != mPlaylist && current_screen != csTagEditor)
|
if (wCurrent != mPlaylist && current_screen != csTagEditor)
|
||||||
{
|
{
|
||||||
found_pos = 0;
|
found_pos = 0;
|
||||||
@@ -1680,11 +1626,10 @@ int main(int argc, char *argv[])
|
|||||||
current_screen = csPlaylist;
|
current_screen = csPlaylist;
|
||||||
redraw_me = 1;
|
redraw_me = 1;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case '3': // browse screen
|
else if (Keypressed(input, Key.Browser))
|
||||||
{
|
{
|
||||||
KEY_TAB_BROWSER_REDIRECT:
|
SWITCHER_BROWSER_REDIRECT:
|
||||||
if (browsed_dir.empty())
|
if (browsed_dir.empty())
|
||||||
browsed_dir = "/";
|
browsed_dir = "/";
|
||||||
|
|
||||||
@@ -1719,9 +1664,8 @@ int main(int argc, char *argv[])
|
|||||||
current_screen = csBrowser;
|
current_screen = csBrowser;
|
||||||
redraw_me = 1;
|
redraw_me = 1;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case '4': // search screen
|
else if (Keypressed(input, Key.SearchEngine))
|
||||||
{
|
{
|
||||||
if (current_screen != csTagEditor && current_screen != csSearcher)
|
if (current_screen != csTagEditor && current_screen != csSearcher)
|
||||||
{
|
{
|
||||||
@@ -1753,9 +1697,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case '5': // artist library
|
else if (Keypressed(input, Key.MediaLibrary))
|
||||||
{
|
{
|
||||||
if (current_screen != csLibrary)
|
if (current_screen != csLibrary)
|
||||||
{
|
{
|
||||||
@@ -1782,12 +1725,11 @@ int main(int argc, char *argv[])
|
|||||||
current_screen = csLibrary;
|
current_screen = csLibrary;
|
||||||
redraw_me = 1;
|
redraw_me = 1;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 'q': case 'Q': // quit
|
else if (Keypressed(input, Key.Quit))
|
||||||
main_exit = 1;
|
main_exit = 1;
|
||||||
default: continue;
|
|
||||||
}
|
// key mapping end
|
||||||
}
|
}
|
||||||
Mpd->Disconnect();
|
Mpd->Disconnect();
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
|
|||||||
@@ -24,6 +24,103 @@ const string config_file = home_folder + "/.ncmpcpprc";
|
|||||||
|
|
||||||
using std::ifstream;
|
using std::ifstream;
|
||||||
|
|
||||||
|
void DefaultKeys(ncmpcpp_keys &keys)
|
||||||
|
{
|
||||||
|
const int null_key = 0x0fffffff;
|
||||||
|
|
||||||
|
keys.Up[0] = KEY_UP;
|
||||||
|
keys.Down[0] = KEY_DOWN;
|
||||||
|
keys.PageUp[0] = KEY_PPAGE;
|
||||||
|
keys.PageDown[0] = KEY_NPAGE;
|
||||||
|
keys.Home[0] = KEY_HOME;
|
||||||
|
keys.End[0] = KEY_END;
|
||||||
|
keys.Space[0] = 32;
|
||||||
|
keys.Enter[0] = 10;
|
||||||
|
keys.Delete[0] = KEY_DC;
|
||||||
|
keys.VolumeUp[0] = KEY_RIGHT;
|
||||||
|
keys.VolumeDown[0] = KEY_LEFT;
|
||||||
|
keys.ScreenSwitcher[0] = 9;
|
||||||
|
keys.Help[0] = '1';
|
||||||
|
keys.Playlist[0] = '2';
|
||||||
|
keys.Browser[0] = '3';
|
||||||
|
keys.SearchEngine[0] = '4';
|
||||||
|
keys.MediaLibrary[0] = '5';
|
||||||
|
keys.Stop[0] = 's';
|
||||||
|
keys.Pause[0] = 'P';
|
||||||
|
keys.Next[0] = '>';
|
||||||
|
keys.Prev[0] = '<';
|
||||||
|
keys.SeekForward[0] = 'f';
|
||||||
|
keys.SeekBackward[0] = 'b';
|
||||||
|
keys.ToggleRepeat[0] = 'r';
|
||||||
|
keys.ToggleRandom[0] = 'z';
|
||||||
|
keys.Shuffle[0] = 'Z';
|
||||||
|
keys.ToggleCrossfade[0] = 'x';
|
||||||
|
keys.SetCrossfade[0] = 'X';
|
||||||
|
keys.UpdateDB[0] = 'u';
|
||||||
|
keys.FindForward[0] = '/';
|
||||||
|
keys.FindBackward[0] = '?';
|
||||||
|
keys.NextFoundPosition[0] = '.';
|
||||||
|
keys.PrevFoundPosition[0] = ',';
|
||||||
|
keys.EditTags[0] = 'e';
|
||||||
|
keys.GoToPosition[0] = 'g';
|
||||||
|
keys.Lyrics[0] = 'l';
|
||||||
|
keys.Clear[0] = 'c';
|
||||||
|
keys.Crop[0] = 'C';
|
||||||
|
keys.MvSongUp[0] = 'm';
|
||||||
|
keys.MvSongDown[0] = 'n';
|
||||||
|
keys.SavePlaylist[0] = 'S';
|
||||||
|
keys.GoToNowPlaying[0] = 'o';
|
||||||
|
keys.ToggleAutoCenter[0] = 'U';
|
||||||
|
keys.GoToParentDir[0] = 263;
|
||||||
|
keys.Quit[0] = 'q';
|
||||||
|
|
||||||
|
keys.Up[1] = 'k';
|
||||||
|
keys.Down[1] = 'j';
|
||||||
|
keys.PageUp[1] = null_key;
|
||||||
|
keys.PageDown[1] = null_key;
|
||||||
|
keys.Home[1] = null_key;
|
||||||
|
keys.End[1] = null_key;
|
||||||
|
keys.Space[1] = null_key;
|
||||||
|
keys.Enter[1] = null_key;
|
||||||
|
keys.Delete[1] = 'd';
|
||||||
|
keys.VolumeUp[1] = '+';
|
||||||
|
keys.VolumeDown[1] = '-';
|
||||||
|
keys.ScreenSwitcher[1] = null_key;
|
||||||
|
keys.Help[1] = null_key;
|
||||||
|
keys.Playlist[1] = null_key;
|
||||||
|
keys.Browser[1] = null_key;
|
||||||
|
keys.SearchEngine[1] = null_key;
|
||||||
|
keys.MediaLibrary[1] = null_key;
|
||||||
|
keys.Stop[1] = null_key;
|
||||||
|
keys.Pause[1] = null_key;
|
||||||
|
keys.Next[1] = null_key;
|
||||||
|
keys.Prev[1] = null_key;
|
||||||
|
keys.SeekForward[1] = null_key;
|
||||||
|
keys.SeekBackward[1] = null_key;
|
||||||
|
keys.ToggleRepeat[1] = null_key;
|
||||||
|
keys.ToggleRandom[1] = null_key;
|
||||||
|
keys.Shuffle[1] = null_key;
|
||||||
|
keys.ToggleCrossfade[1] = null_key;
|
||||||
|
keys.SetCrossfade[1] = null_key;
|
||||||
|
keys.UpdateDB[1] = null_key;
|
||||||
|
keys.FindForward[1] = null_key;
|
||||||
|
keys.FindBackward[1] = null_key;
|
||||||
|
keys.NextFoundPosition[1] = null_key;
|
||||||
|
keys.PrevFoundPosition[1] = null_key;
|
||||||
|
keys.EditTags[1] = null_key;
|
||||||
|
keys.GoToPosition[1] = null_key;
|
||||||
|
keys.Lyrics[1] = null_key;
|
||||||
|
keys.Clear[1] = null_key;
|
||||||
|
keys.Crop[1] = null_key;
|
||||||
|
keys.MvSongUp[1] = null_key;
|
||||||
|
keys.MvSongDown[1] = null_key;
|
||||||
|
keys.SavePlaylist[1] = null_key;
|
||||||
|
keys.GoToNowPlaying[1] = null_key;
|
||||||
|
keys.ToggleAutoCenter[1] = null_key;
|
||||||
|
keys.GoToParentDir[1] = 127;
|
||||||
|
keys.Quit[1] = 'Q';
|
||||||
|
}
|
||||||
|
|
||||||
void DefaultConfiguration(ncmpcpp_config &conf)
|
void DefaultConfiguration(ncmpcpp_config &conf)
|
||||||
{
|
{
|
||||||
conf.mpd_music_dir = "/var/lib/mpd/music";
|
conf.mpd_music_dir = "/var/lib/mpd/music";
|
||||||
@@ -240,3 +337,4 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,55 @@
|
|||||||
|
|
||||||
#include "ncmpcpp.h"
|
#include "ncmpcpp.h"
|
||||||
|
|
||||||
|
struct ncmpcpp_keys
|
||||||
|
{
|
||||||
|
int Up[2];
|
||||||
|
int Down[2];
|
||||||
|
int PageUp[2];
|
||||||
|
int PageDown[2];
|
||||||
|
int Home[2];
|
||||||
|
int End[2];
|
||||||
|
int Space[2];
|
||||||
|
int Enter[2];
|
||||||
|
int Delete[2];
|
||||||
|
int VolumeUp[2];
|
||||||
|
int VolumeDown[2];
|
||||||
|
int ScreenSwitcher[2];
|
||||||
|
int Help[2];
|
||||||
|
int Playlist[2];
|
||||||
|
int Browser[2];
|
||||||
|
int SearchEngine[2];
|
||||||
|
int MediaLibrary[2];
|
||||||
|
int Stop[2];
|
||||||
|
int Pause[2];
|
||||||
|
int Next[2];
|
||||||
|
int Prev[2];
|
||||||
|
int SeekForward[2];
|
||||||
|
int SeekBackward[2];
|
||||||
|
int ToggleRepeat[2];
|
||||||
|
int ToggleRandom[2];
|
||||||
|
int Shuffle[2];
|
||||||
|
int ToggleCrossfade[2];
|
||||||
|
int SetCrossfade[2];
|
||||||
|
int UpdateDB[2];
|
||||||
|
int FindForward[2];
|
||||||
|
int FindBackward[2];
|
||||||
|
int NextFoundPosition[2];
|
||||||
|
int PrevFoundPosition[2];
|
||||||
|
int EditTags[2];
|
||||||
|
int GoToPosition[2];
|
||||||
|
int Lyrics[2];
|
||||||
|
int Clear[2];
|
||||||
|
int Crop[2];
|
||||||
|
int MvSongUp[2];
|
||||||
|
int MvSongDown[2];
|
||||||
|
int SavePlaylist[2];
|
||||||
|
int GoToNowPlaying[2];
|
||||||
|
int ToggleAutoCenter[2];
|
||||||
|
int GoToParentDir[2];
|
||||||
|
int Quit[2];
|
||||||
|
};
|
||||||
|
|
||||||
struct ncmpcpp_config
|
struct ncmpcpp_config
|
||||||
{
|
{
|
||||||
string mpd_music_dir;
|
string mpd_music_dir;
|
||||||
@@ -57,6 +106,7 @@ struct ncmpcpp_config
|
|||||||
int message_delay_time;
|
int message_delay_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void DefaultKeys(ncmpcpp_keys &);
|
||||||
void DefaultConfiguration(ncmpcpp_config &);
|
void DefaultConfiguration(ncmpcpp_config &);
|
||||||
string GetLineValue(const string &);
|
string GetLineValue(const string &);
|
||||||
string IntoStr(COLOR);
|
string IntoStr(COLOR);
|
||||||
|
|||||||
Reference in New Issue
Block a user