From 0d0e5e29126e373c8fc9d733e7e5c1e5cc882ada Mon Sep 17 00:00:00 2001 From: unK Date: Thu, 25 Sep 2008 20:18:16 +0200 Subject: [PATCH] rename Song::GetShortFilename() to Song::GetName() --- src/helpers.cpp | 18 +++++++++--------- src/ncmpcpp.cpp | 4 ++-- src/search_engine.cpp | 6 +++--- src/song.cpp | 2 +- src/song.h | 4 ++-- src/tag_editor.cpp | 14 +++++++------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/helpers.cpp b/src/helpers.cpp index 9057c175..9279ac15 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -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 *) 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 *) 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 *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 diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 2085c76f..efa1dfc4 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -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); diff --git a/src/search_engine.cpp b/src/search_engine.cpp index b46df812..c1bd1f98 100644 --- a/src/search_engine.cpp +++ b/src/search_engine.cpp @@ -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) { diff --git a/src/song.cpp b/src/song.cpp index d5f27e8b..83668cb1 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -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); } diff --git a/src/song.h b/src/song.h index b5879181..8e350a0d 100644 --- a/src/song.h +++ b/src/song.h @@ -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; } diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index 9ecff8f7..01b3a616 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -77,7 +77,7 @@ string DisplayTag(const Song &s, void *data, const Menu *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 separators; vector< std::pair > 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(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; }