rename Song::GetShortFilename() to Song::GetName()

This commit is contained in:
unK
2008-09-25 20:18:16 +02:00
parent 25719527e9
commit 0d0e5e2912
6 changed files with 24 additions and 24 deletions

View File

@@ -84,8 +84,8 @@ bool CaseInsensitiveSorting::operator()(string a, string b)
bool CaseInsensitiveSorting::operator()(Song *sa, Song *sb) bool CaseInsensitiveSorting::operator()(Song *sa, Song *sb)
{ {
string a = sa->GetShortFilename(); string a = sa->GetName();
string b = sb->GetShortFilename(); string b = sb->GetName();
transform(a.begin(), a.end(), a.begin(), tolower); transform(a.begin(), a.end(), a.begin(), tolower);
transform(b.begin(), b.end(), b.begin(), tolower); transform(b.begin(), b.end(), b.begin(), tolower);
return a < b; return a < b;
@@ -95,8 +95,8 @@ bool CaseInsensitiveSorting::operator()(const Item &a, const Item &b)
{ {
if (a.type == b.type) if (a.type == b.type)
{ {
string sa = a.type == itSong ? a.song->GetShortFilename() : a.name; string sa = a.type == itSong ? a.song->GetName() : a.name;
string sb = b.type == itSong ? b.song->GetShortFilename() : b.name; string sb = b.type == itSong ? b.song->GetName() : b.name;
transform(sa.begin(), sa.end(), sa.begin(), tolower); transform(sa.begin(), sa.end(), sa.begin(), tolower);
transform(sb.begin(), sb.end(), sb.begin(), tolower); transform(sb.begin(), sb.end(), sb.begin(), tolower);
return sa < sb; return sa < sb;
@@ -365,7 +365,7 @@ string DisplaySongInColumns(const Song &s, void *s_template, const Menu<Song> *)
ss = s.GetLength(); ss = s.GetLength();
break; break;
case 'f': case 'f':
ss = s.GetShortFilename(); ss = s.GetName();
break; break;
case 'F': case 'F':
ss = s.GetFile(); ss = s.GetFile();
@@ -378,7 +378,7 @@ string DisplaySongInColumns(const Song &s, void *s_template, const Menu<Song> *)
ss = s.GetTitle(); ss = s.GetTitle();
else else
{ {
const string &file = s.GetShortFilename(); const string &file = s.GetName();
ss = !s.IsStream() ? file.substr(0, file.find_last_of(".")) : file; ss = !s.IsStream() ? file.substr(0, file.find_last_of(".")) : file;
} }
break; break;
@@ -514,8 +514,8 @@ string DisplaySong(const Song &s, void *s_template, const Menu<Song> *menu)
} }
case 'f': case 'f':
{ {
result += s.GetShortFilename(); result += s.GetName();
i += s.GetShortFilename().length(); i += s.GetName().length();
break; break;
} }
case 'a': case 'a':
@@ -709,7 +709,7 @@ string GetInfo(Song &s)
s.SetComment(f.tag()->comment().to8Bit(UNICODE)); s.SetComment(f.tag()->comment().to8Bit(UNICODE));
# endif // HAVE_TAGLIB_H # 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 + "]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"; result += "[.b][." + Config.color1 + "]Length: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetLength() + "[/" + Config.color2 + "]\n";
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H

View File

@@ -1077,7 +1077,7 @@ int main(int argc, char *argv[])
case 1: case 1:
{ {
wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]Filename:[/b] ", 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()); s.SetFile(wFooter->GetString());
else else
s.SetFile(wFooter->GetString(s.GetFile())); s.SetFile(wFooter->GetString(s.GetFile()));
@@ -1514,7 +1514,7 @@ int main(int argc, char *argv[])
else if (wCurrent == mEditorTags) else if (wCurrent == mEditorTags)
{ {
Song &s = mEditorTags->Current(); 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("."); int last_dot = old_name.find_last_of(".");
string extension = old_name.substr(last_dot); string extension = old_name.substr(last_dot);
old_name = old_name.substr(0, last_dot); old_name = old_name.substr(0, last_dot);

View File

@@ -58,7 +58,7 @@ void PrepareSearchEngine(Song &s)
s.Clear(); s.Clear();
mSearcher->Clear(); mSearcher->Clear();
mSearcher->Reset(); 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]Title:[/b] " + s.GetTitle(), Song()));
mSearcher->AddOption(make_pair("[.b]Artist:[/b] " + s.GetArtist(), Song())); mSearcher->AddOption(make_pair("[.b]Artist:[/b] " + s.GetArtist(), Song()));
mSearcher->AddOption(make_pair("[.b]Album:[/b] " + s.GetAlbum(), Song())); mSearcher->AddOption(make_pair("[.b]Album:[/b] " + s.GetAlbum(), Song()));
@@ -121,7 +121,7 @@ void Search(Song &s)
if (!search_case_sensitive) if (!search_case_sensitive)
{ {
string t; string t;
t = copy.GetShortFilename(); t = copy.GetName();
transform(t.begin(), t.end(), t.begin(), tolower); transform(t.begin(), t.end(), t.begin(), tolower);
copy.SetFile(t); copy.SetFile(t);
@@ -146,7 +146,7 @@ void Search(Song &s)
copy.SetComment(t); copy.SetComment(t);
} }
else else
copy.SetFile(copy.GetShortFilename()); copy.SetFile(copy.GetName());
if (search_match_to_pattern) if (search_match_to_pattern)
{ {

View File

@@ -115,7 +115,7 @@ string Song::GetFile() const
return !itsSong->file ? (itsGetEmptyFields ? "" : EMPTY_TAG) : itsSong->file; 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); return !itsSong->file ? (itsGetEmptyFields ? "" : EMPTY_TAG) : (itsSlash != string::npos && !isStream ? string(itsSong->file).substr(itsSlash+1) : itsSong->file);
} }

View File

@@ -42,7 +42,7 @@ class Song
~Song(); ~Song();
string GetFile() const; string GetFile() const;
string GetShortFilename() const; string GetName() const;
string GetDirectory() const; string GetDirectory() const;
string GetArtist() const; string GetArtist() const;
string GetTitle() const; string GetTitle() const;
@@ -73,7 +73,7 @@ class Song
void SetComment(const string &str); void SetComment(const string &str);
void SetPosition(int pos); 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; } string GetNewName() const { return itsNewName; }
void NullMe() { itsSong = 0; } void NullMe() { itsSong = 0; }

View File

@@ -77,7 +77,7 @@ string DisplayTag(const Song &s, void *data, const Menu<Song> *null)
case 6: case 6:
return s.GetComment(); return s.GetComment();
case 8: 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: default:
return ""; return "";
} }
@@ -95,7 +95,7 @@ bool GetSongTags(Song &s)
mTagEditor->Clear(); mTagEditor->Clear();
mTagEditor->Reset(); 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("[.b][." + Config.color1 + "]Location in DB: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetDirectory() + "[/" + Config.color2 + "]", 0, 1);
mTagEditor->AddOption("", 0, 1); mTagEditor->AddOption("", 0, 1);
mTagEditor->AddOption("[.b][." + Config.color1 + "]Length: [/" + Config.color1 + "][." + Config.color2 + "][/b]" + s.GetLength() + "[/" + Config.color2 + "]", 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; std::stringstream result;
vector<string> separators; vector<string> separators;
vector< std::pair<char, string> > tags; 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 try
{ {
@@ -300,7 +300,7 @@ void __deal_with_filenames(SongList &v)
Legend->Add("%C - comment\n\n"); Legend->Add("%C - comment\n\n");
Legend->Add("[.b]Files:[/b]\n"); Legend->Add("[.b]Files:[/b]\n");
for (SongList::const_iterator it = v.begin(); it != v.end(); it++) 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 = static_cast<Scrollpad *>(Legend->EmptyClone());
Preview->SetTitle("Preview"); Preview->SetTitle("Preview");
@@ -377,7 +377,7 @@ void __deal_with_filenames(SongList &v)
{ {
if (preview) if (preview)
{ {
Preview->Add("[.b]" + s.GetShortFilename() + ":[/b]\n"); Preview->Add("[.b]" + s.GetName() + ":[/b]\n");
Preview->Add(ParseFilename(s, Config.pattern, preview) + "\n"); Preview->Add(ParseFilename(s, Config.pattern, preview) + "\n");
} }
else else
@@ -385,7 +385,7 @@ void __deal_with_filenames(SongList &v)
} }
else else
{ {
const string &file = s.GetShortFilename(); const string &file = s.GetName();
int last_dot = file.find_last_of("."); int last_dot = file.find_last_of(".");
string extension = file.substr(last_dot); string extension = file.substr(last_dot);
s.GetEmptyFields(1); s.GetEmptyFields(1);
@@ -396,7 +396,7 @@ void __deal_with_filenames(SongList &v)
new_file = "[.red]!EMPTY![/red]"; new_file = "[.red]!EMPTY![/red]";
else else
{ {
ShowMessage("File '" + s.GetShortFilename() + "' would have an empty name!"); ShowMessage("File '" + s.GetName() + "' would have an empty name!");
success = 0; success = 0;
break; break;
} }