rename Song::GetShortFilename() to Song::GetName()
This commit is contained in:
@@ -84,8 +84,8 @@ bool CaseInsensitiveSorting::operator()(string a, string b)
|
||||
|
||||
bool CaseInsensitiveSorting::operator()(Song *sa, Song *sb)
|
||||
{
|
||||
string a = sa->GetShortFilename();
|
||||
string b = sb->GetShortFilename();
|
||||
string a = sa->GetName();
|
||||
string b = sb->GetName();
|
||||
transform(a.begin(), a.end(), a.begin(), tolower);
|
||||
transform(b.begin(), b.end(), b.begin(), tolower);
|
||||
return a < b;
|
||||
@@ -95,8 +95,8 @@ bool CaseInsensitiveSorting::operator()(const Item &a, const Item &b)
|
||||
{
|
||||
if (a.type == b.type)
|
||||
{
|
||||
string sa = a.type == itSong ? a.song->GetShortFilename() : a.name;
|
||||
string sb = b.type == itSong ? b.song->GetShortFilename() : b.name;
|
||||
string sa = a.type == itSong ? a.song->GetName() : a.name;
|
||||
string sb = b.type == itSong ? b.song->GetName() : b.name;
|
||||
transform(sa.begin(), sa.end(), sa.begin(), tolower);
|
||||
transform(sb.begin(), sb.end(), sb.begin(), tolower);
|
||||
return sa < sb;
|
||||
@@ -365,7 +365,7 @@ string DisplaySongInColumns(const Song &s, void *s_template, const Menu<Song> *)
|
||||
ss = s.GetLength();
|
||||
break;
|
||||
case 'f':
|
||||
ss = s.GetShortFilename();
|
||||
ss = s.GetName();
|
||||
break;
|
||||
case 'F':
|
||||
ss = s.GetFile();
|
||||
@@ -378,7 +378,7 @@ string DisplaySongInColumns(const Song &s, void *s_template, const Menu<Song> *)
|
||||
ss = s.GetTitle();
|
||||
else
|
||||
{
|
||||
const string &file = s.GetShortFilename();
|
||||
const string &file = s.GetName();
|
||||
ss = !s.IsStream() ? file.substr(0, file.find_last_of(".")) : file;
|
||||
}
|
||||
break;
|
||||
@@ -514,8 +514,8 @@ string DisplaySong(const Song &s, void *s_template, const Menu<Song> *menu)
|
||||
}
|
||||
case 'f':
|
||||
{
|
||||
result += s.GetShortFilename();
|
||||
i += s.GetShortFilename().length();
|
||||
result += s.GetName();
|
||||
i += s.GetName().length();
|
||||
break;
|
||||
}
|
||||
case 'a':
|
||||
@@ -709,7 +709,7 @@ string GetInfo(Song &s)
|
||||
s.SetComment(f.tag()->comment().to8Bit(UNICODE));
|
||||
# endif // HAVE_TAGLIB_H
|
||||
|
||||
result = "[.b][." + Config.color1 + "]Filename: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetShortFilename() + "[/" + Config.color2 + "]\n";
|
||||
result = "[.b][." + Config.color1 + "]Filename: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetName() + "[/" + Config.color2 + "]\n";
|
||||
result += "[.b][." + Config.color1 + "]Directory: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetDirectory() + "[/" + Config.color2 + "]\n\n";
|
||||
result += "[.b][." + Config.color1 + "]Length: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetLength() + "[/" + Config.color2 + "]\n";
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
|
||||
@@ -1077,7 +1077,7 @@ int main(int argc, char *argv[])
|
||||
case 1:
|
||||
{
|
||||
wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]Filename:[/b] ", 1);
|
||||
if (s.GetShortFilename() == EMPTY_TAG)
|
||||
if (s.GetName() == EMPTY_TAG)
|
||||
s.SetFile(wFooter->GetString());
|
||||
else
|
||||
s.SetFile(wFooter->GetString(s.GetFile()));
|
||||
@@ -1514,7 +1514,7 @@ int main(int argc, char *argv[])
|
||||
else if (wCurrent == mEditorTags)
|
||||
{
|
||||
Song &s = mEditorTags->Current();
|
||||
string old_name = s.GetNewName().empty() ? s.GetShortFilename() : s.GetNewName();
|
||||
string old_name = s.GetNewName().empty() ? s.GetName() : s.GetNewName();
|
||||
int last_dot = old_name.find_last_of(".");
|
||||
string extension = old_name.substr(last_dot);
|
||||
old_name = old_name.substr(0, last_dot);
|
||||
|
||||
@@ -58,7 +58,7 @@ void PrepareSearchEngine(Song &s)
|
||||
s.Clear();
|
||||
mSearcher->Clear();
|
||||
mSearcher->Reset();
|
||||
mSearcher->AddOption(make_pair("[.b]Filename:[/b] " + s.GetShortFilename(), Song()));
|
||||
mSearcher->AddOption(make_pair("[.b]Filename:[/b] " + s.GetName(), Song()));
|
||||
mSearcher->AddOption(make_pair("[.b]Title:[/b] " + s.GetTitle(), Song()));
|
||||
mSearcher->AddOption(make_pair("[.b]Artist:[/b] " + s.GetArtist(), Song()));
|
||||
mSearcher->AddOption(make_pair("[.b]Album:[/b] " + s.GetAlbum(), Song()));
|
||||
@@ -121,7 +121,7 @@ void Search(Song &s)
|
||||
if (!search_case_sensitive)
|
||||
{
|
||||
string t;
|
||||
t = copy.GetShortFilename();
|
||||
t = copy.GetName();
|
||||
transform(t.begin(), t.end(), t.begin(), tolower);
|
||||
copy.SetFile(t);
|
||||
|
||||
@@ -146,7 +146,7 @@ void Search(Song &s)
|
||||
copy.SetComment(t);
|
||||
}
|
||||
else
|
||||
copy.SetFile(copy.GetShortFilename());
|
||||
copy.SetFile(copy.GetName());
|
||||
|
||||
if (search_match_to_pattern)
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ string Song::GetFile() const
|
||||
return !itsSong->file ? (itsGetEmptyFields ? "" : EMPTY_TAG) : itsSong->file;
|
||||
}
|
||||
|
||||
string Song::GetShortFilename() const
|
||||
string Song::GetName() const
|
||||
{
|
||||
return !itsSong->file ? (itsGetEmptyFields ? "" : EMPTY_TAG) : (itsSlash != string::npos && !isStream ? string(itsSong->file).substr(itsSlash+1) : itsSong->file);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class Song
|
||||
~Song();
|
||||
|
||||
string GetFile() const;
|
||||
string GetShortFilename() const;
|
||||
string GetName() const;
|
||||
string GetDirectory() const;
|
||||
string GetArtist() const;
|
||||
string GetTitle() const;
|
||||
@@ -73,7 +73,7 @@ class Song
|
||||
void SetComment(const string &str);
|
||||
void SetPosition(int pos);
|
||||
|
||||
void SetNewName(string name) { itsNewName = name == GetShortFilename() ? "" : name; }
|
||||
void SetNewName(string name) { itsNewName = name == GetName() ? "" : name; }
|
||||
string GetNewName() const { return itsNewName; }
|
||||
|
||||
void NullMe() { itsSong = 0; }
|
||||
|
||||
@@ -77,7 +77,7 @@ string DisplayTag(const Song &s, void *data, const Menu<Song> *null)
|
||||
case 6:
|
||||
return s.GetComment();
|
||||
case 8:
|
||||
return s.GetNewName().empty() ? s.GetShortFilename() : s.GetShortFilename() + " [." + Config.color2 + "]->[/" + Config.color2 + "] " + s.GetNewName();
|
||||
return s.GetNewName().empty() ? s.GetName() : s.GetName() + " [." + Config.color2 + "]->[/" + Config.color2 + "] " + s.GetNewName();
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -95,7 +95,7 @@ bool GetSongTags(Song &s)
|
||||
mTagEditor->Clear();
|
||||
mTagEditor->Reset();
|
||||
|
||||
mTagEditor->AddOption("[.b][." + Config.color1 + "]Song name: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetShortFilename() + "[/" + Config.color2 + "]", 0, 1);
|
||||
mTagEditor->AddOption("[.b][." + Config.color1 + "]Song name: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetName() + "[/" + Config.color2 + "]", 0, 1);
|
||||
mTagEditor->AddOption("[.b][." + Config.color1 + "]Location in DB: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetDirectory() + "[/" + Config.color2 + "]", 0, 1);
|
||||
mTagEditor->AddOption("", 0, 1);
|
||||
mTagEditor->AddOption("[.b][." + Config.color1 + "]Length: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetLength() + "[/" + Config.color2 + "]", 0, 1);
|
||||
@@ -195,7 +195,7 @@ string ParseFilename(Song &s, string mask, bool preview)
|
||||
std::stringstream result;
|
||||
vector<string> separators;
|
||||
vector< std::pair<char, string> > tags;
|
||||
string file = s.GetShortFilename().substr(0, s.GetShortFilename().find_last_of("."));
|
||||
string file = s.GetName().substr(0, s.GetName().find_last_of("."));
|
||||
|
||||
try
|
||||
{
|
||||
@@ -300,7 +300,7 @@ void __deal_with_filenames(SongList &v)
|
||||
Legend->Add("%C - comment\n\n");
|
||||
Legend->Add("[.b]Files:[/b]\n");
|
||||
for (SongList::const_iterator it = v.begin(); it != v.end(); it++)
|
||||
Legend->Add("[." + Config.color2 + "]*[/" + Config.color2 + "] " + (*it)->GetShortFilename() + "\n");
|
||||
Legend->Add("[." + Config.color2 + "]*[/" + Config.color2 + "] " + (*it)->GetName() + "\n");
|
||||
|
||||
Preview = static_cast<Scrollpad *>(Legend->EmptyClone());
|
||||
Preview->SetTitle("Preview");
|
||||
@@ -377,7 +377,7 @@ void __deal_with_filenames(SongList &v)
|
||||
{
|
||||
if (preview)
|
||||
{
|
||||
Preview->Add("[.b]" + s.GetShortFilename() + ":[/b]\n");
|
||||
Preview->Add("[.b]" + s.GetName() + ":[/b]\n");
|
||||
Preview->Add(ParseFilename(s, Config.pattern, preview) + "\n");
|
||||
}
|
||||
else
|
||||
@@ -385,7 +385,7 @@ void __deal_with_filenames(SongList &v)
|
||||
}
|
||||
else
|
||||
{
|
||||
const string &file = s.GetShortFilename();
|
||||
const string &file = s.GetName();
|
||||
int last_dot = file.find_last_of(".");
|
||||
string extension = file.substr(last_dot);
|
||||
s.GetEmptyFields(1);
|
||||
@@ -396,7 +396,7 @@ void __deal_with_filenames(SongList &v)
|
||||
new_file = "[.red]!EMPTY![/red]";
|
||||
else
|
||||
{
|
||||
ShowMessage("File '" + s.GetShortFilename() + "' would have an empty name!");
|
||||
ShowMessage("File '" + s.GetName() + "' would have an empty name!");
|
||||
success = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user