change default behaviour of 'go to given position' function

before that number without any other signs was treated as time
in seconds to go, now it's threated as %. treating a number as
seconds needs you to type 's' after numeric value.
This commit is contained in:
Andrzej Rybczak
2009-03-20 17:53:32 +01:00
parent eeb1951547
commit 3d5e62aa65
2 changed files with 9 additions and 9 deletions

View File

@@ -179,7 +179,7 @@ void Help::GetKeybindings()
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
*w << DisplayKeys(Key.EditTags) << "Edit song's tags/playlist's name\n"; *w << DisplayKeys(Key.EditTags) << "Edit song's tags/playlist's name\n";
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
*w << DisplayKeys(Key.GoToPosition) << "Go to chosen position in current song\n"; *w << DisplayKeys(Key.GoToPosition) << "Go to given position in current song (in % by default)\n";
*w << DisplayKeys(Key.SongInfo) << "Show song's info\n"; *w << DisplayKeys(Key.SongInfo) << "Show song's info\n";
# ifdef HAVE_CURL_CURL_H # ifdef HAVE_CURL_CURL_H
*w << DisplayKeys(Key.ArtistInfo) << "Show artist's info\n"; *w << DisplayKeys(Key.ArtistInfo) << "Show artist's info\n";

View File

@@ -1290,7 +1290,7 @@ int main(int argc, char *argv[])
continue; continue;
} }
LockStatusbar(); LockStatusbar();
Statusbar() << "Position to go (in %/mm:ss/seconds): "; Statusbar() << "Position to go (in %/mm:ss/seconds(s)): ";
string position = wFooter->GetString(); string position = wFooter->GetString();
UnlockStatusbar(); UnlockStatusbar();
@@ -1308,18 +1308,18 @@ int main(int argc, char *argv[])
if (newpos > 0 && newpos < s->GetTotalLength()) if (newpos > 0 && newpos < s->GetTotalLength())
Mpd->Seek(newpos); Mpd->Seek(newpos);
} }
else if (position.find('%') != string::npos) // probably position in % else if (position.find('s') != string::npos) // probably position in seconds
{
newpos = StrToInt(position);
if (newpos > 0 && newpos < 100)
Mpd->Seek(s->GetTotalLength()*newpos/100.0);
}
else
{ {
newpos = StrToInt(position); newpos = StrToInt(position);
if (newpos > 0 && newpos < s->GetTotalLength()) if (newpos > 0 && newpos < s->GetTotalLength())
Mpd->Seek(newpos); Mpd->Seek(newpos);
} }
else
{
newpos = StrToInt(position);
if (newpos > 0 && newpos < 100)
Mpd->Seek(s->GetTotalLength()*newpos/100.0);
}
} }
else if (Keypressed(input, Key.ReverseSelection)) else if (Keypressed(input, Key.ReverseSelection))
{ {