diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2009-01-30 18:41:40 +0100 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2009-01-30 18:41:40 +0100 |
commit | 4ce83854a2a0f0a44b92408b96252bf90bd09920 (patch) | |
tree | 1b18f92b91dacc10822e5088065e309f6c5a1d5e /src | |
parent | 7b6521a370a93fc2d4e5364e7221710e56059b56 (diff) |
rearrange fields in search engine / +composer +performer -track
Diffstat (limited to 'src')
-rw-r--r-- | src/ncmpcpp.cpp | 68 | ||||
-rw-r--r-- | src/search_engine.cpp | 31 | ||||
-rw-r--r-- | src/search_engine.h | 4 |
3 files changed, 58 insertions, 45 deletions
diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 0897d8de..c14f595c 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -1256,16 +1256,16 @@ int main(int argc, char *argv[]) LockStatusbar(); Song &s = sought_pattern; - if (option <= 11) + if (option <= 12) mSearcher->Current().first->Clear(); switch (option+1) { case 1: { - Statusbar() << fmtBold << "Filename: " << fmtBoldEnd; - s.SetFile(wFooter->GetString(s.GetFile())); - *mSearcher->Current().first << fmtBold << "Filename:" << fmtBoldEnd << ' ' << ShowTag(s.GetFile()); + Statusbar() << fmtBold << "Artist: " << fmtBoldEnd; + s.SetArtist(wFooter->GetString(s.GetArtist())); + *mSearcher->Current().first << fmtBold << "Artist:" << fmtBoldEnd << ' ' << ShowTag(s.GetArtist()); break; } case 2: @@ -1277,30 +1277,30 @@ int main(int argc, char *argv[]) } case 3: { - Statusbar() << fmtBold << "Artist: " << fmtBoldEnd; - s.SetArtist(wFooter->GetString(s.GetArtist())); - *mSearcher->Current().first << fmtBold << "Artist:" << fmtBoldEnd << ' ' << ShowTag(s.GetArtist()); + Statusbar() << fmtBold << "Album: " << fmtBoldEnd; + s.SetAlbum(wFooter->GetString(s.GetAlbum())); + *mSearcher->Current().first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum()); break; } case 4: { - Statusbar() << fmtBold << "Album: " << fmtBoldEnd; - s.SetAlbum(wFooter->GetString(s.GetAlbum())); - *mSearcher->Current().first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum()); + Statusbar() << fmtBold << "Filename: " << fmtBoldEnd; + s.SetFile(wFooter->GetString(s.GetFile())); + *mSearcher->Current().first << fmtBold << "Filename:" << fmtBoldEnd << ' ' << ShowTag(s.GetFile()); break; } case 5: { - Statusbar() << fmtBold << "Year: " << fmtBoldEnd; - s.SetYear(wFooter->GetString(s.GetYear(), 4)); - *mSearcher->Current().first << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetYear()); + Statusbar() << fmtBold << "Composer: " << fmtBoldEnd; + s.SetComposer(wFooter->GetString(s.GetComposer())); + *mSearcher->Current().first << fmtBold << "Composer:" << fmtBoldEnd << ' ' << ShowTag(s.GetComposer()); break; } case 6: { - Statusbar() << fmtBold << "Track: " << fmtBoldEnd; - s.SetTrack(wFooter->GetString(s.GetTrack(), 3)); - *mSearcher->Current().first << fmtBold << "Track:" << fmtBoldEnd << ' ' << ShowTag(s.GetTrack()); + Statusbar() << fmtBold << "Performer: " << fmtBoldEnd; + s.SetPerformer(wFooter->GetString(s.GetPerformer())); + *mSearcher->Current().first << fmtBold << "Performer:" << fmtBoldEnd << ' ' << ShowTag(s.GetPerformer()); break; } case 7: @@ -1312,30 +1312,37 @@ int main(int argc, char *argv[]) } case 8: { + Statusbar() << fmtBold << "Year: " << fmtBoldEnd; + s.SetYear(wFooter->GetString(s.GetYear(), 4)); + *mSearcher->Current().first << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetYear()); + break; + } + case 9: + { Statusbar() << fmtBold << "Comment: " << fmtBoldEnd; s.SetComment(wFooter->GetString(s.GetComment())); *mSearcher->Current().first << fmtBold << "Comment:" << fmtBoldEnd << ' ' << ShowTag(s.GetComment()); break; } - case 10: + case 11: { Config.search_in_db = !Config.search_in_db; *mSearcher->Current().first << fmtBold << "Search in:" << fmtBoldEnd << ' ' << (Config.search_in_db ? "Database" : "Current playlist"); break; } - case 11: + case 12: { search_match_to_pattern = !search_match_to_pattern; *mSearcher->Current().first << fmtBold << "Search mode:" << fmtBoldEnd << ' ' << (search_match_to_pattern ? search_mode_normal : search_mode_strict); break; } - case 12: + case 13: { search_case_sensitive = !search_case_sensitive; *mSearcher->Current().first << fmtBold << "Case sensitive:" << fmtBoldEnd << ' ' << (search_case_sensitive ? "Yes" : "No"); break; } - case 14: + case 15: { ShowMessage("Searching..."); Search(s); @@ -1343,11 +1350,11 @@ int main(int argc, char *argv[]) { size_t found = mSearcher->Size()-search_engine_static_options; found += 3; // don't count options inserted below - mSearcher->InsertSeparator(15); - mSearcher->InsertOption(16, make_pair((Buffer *)0, (Song *)0), 1, 1); - mSearcher->at(16).first = new Buffer(); - *mSearcher->at(16).first << Config.color1 << "Search results: " << Config.color2 << "Found " << found << (found > 1 ? " songs" : " song") << clDefault; - mSearcher->InsertSeparator(17); + mSearcher->InsertSeparator(16); + mSearcher->InsertOption(17, make_pair((Buffer *)0, (Song *)0), 1, 1); + mSearcher->at(17).first = new Buffer(); + *mSearcher->at(17).first << Config.color1 << "Search results: " << Config.color2 << "Found " << found << (found > 1 ? " songs" : " song") << clDefault; + mSearcher->InsertSeparator(18); UpdateFoundList(); ShowMessage("Searching finished!"); for (size_t i = 0; i < search_engine_static_options-4; i++) @@ -1359,7 +1366,7 @@ int main(int argc, char *argv[]) ShowMessage("No results found"); break; } - case 15: + case 16: { CLEAR_FIND_HISTORY; PrepareSearchEngine(sought_pattern); @@ -2834,7 +2841,10 @@ int main(int argc, char *argv[]) { if (wCurrent == mSearcher) { - mSearcher->Highlight(13); // highlight 'search' button + mSearcher->Highlight(seach_engine_search_button); + mSearcher->Highlighting(0); + mSearcher->Refresh(); + mSearcher->Highlighting(1); goto ENTER_SEARCH_ENGINE_SCREEN; } } @@ -2867,8 +2877,8 @@ int main(int argc, char *argv[]) if (wCurrent == mBrowser && browsed_dir != "/") mList->Select(0, 0); // [..] cannot be selected, uhm. if (wCurrent == mSearcher) - mList->Select(14, 0); // 'Reset' cannot be selected, omgplz. - // hacking shit ends. need better solution :/ + mList->Select(seach_engine_reset_button, 0); // 'Reset' cannot be selected, omgplz. + // hacking shit ends. ShowMessage("Selection reversed!"); } } diff --git a/src/search_engine.cpp b/src/search_engine.cpp index cf4c36ef..671a5fdf 100644 --- a/src/search_engine.cpp +++ b/src/search_engine.cpp @@ -74,12 +74,12 @@ void PrepareSearchEngine(Song &s) s.Clear(); mSearcher->Clear(); mSearcher->Reset(); - mSearcher->ResizeBuffer(15); + mSearcher->ResizeBuffer(16); - mSearcher->IntoSeparator(8); - mSearcher->IntoSeparator(12); + mSearcher->IntoSeparator(9); + mSearcher->IntoSeparator(13); - for (size_t i = 0; i < 15; i++) + for (size_t i = 0; i < 16; i++) { try { @@ -88,21 +88,22 @@ void PrepareSearchEngine(Song &s) catch (List::InvalidItem) { } } - *mSearcher->at(0).first << fmtBold << "Filename:" << fmtBoldEnd << ' ' << ShowTag(s.GetName()); + *mSearcher->at(0).first << fmtBold << "Artist:" << fmtBoldEnd << ' ' << ShowTag(s.GetArtist()); *mSearcher->at(1).first << fmtBold << "Title:" << fmtBoldEnd << ' ' << ShowTag(s.GetTitle()); - *mSearcher->at(2).first << fmtBold << "Artist:" << fmtBoldEnd << ' ' << ShowTag(s.GetArtist()); - *mSearcher->at(3).first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum()); - *mSearcher->at(4).first << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetYear()); - *mSearcher->at(5).first << fmtBold << "Track:" << fmtBoldEnd << ' ' << ShowTag(s.GetTrack()); + *mSearcher->at(2).first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum()); + *mSearcher->at(3).first << fmtBold << "Filename:" << fmtBoldEnd << ' ' << ShowTag(s.GetName()); + *mSearcher->at(4).first << fmtBold << "Composer:" << fmtBoldEnd << ' ' << ShowTag(s.GetComposer()); + *mSearcher->at(5).first << fmtBold << "Performer:" << fmtBoldEnd << ' ' << ShowTag(s.GetPerformer()); *mSearcher->at(6).first << fmtBold << "Genre:" << fmtBoldEnd << ' ' << ShowTag(s.GetGenre()); - *mSearcher->at(7).first << fmtBold << "Comment:" << fmtBoldEnd << ' ' << ShowTag(s.GetComment()); + *mSearcher->at(7).first << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetYear()); + *mSearcher->at(8).first << fmtBold << "Comment:" << fmtBoldEnd << ' ' << ShowTag(s.GetComment()); - *mSearcher->at(9).first << fmtBold << "Search in:" << fmtBoldEnd << ' ' << (Config.search_in_db ? "Database" : "Current playlist"); - *mSearcher->at(10).first << fmtBold << "Search mode:" << fmtBoldEnd << ' ' << (search_match_to_pattern ? search_mode_normal : search_mode_strict); - *mSearcher->at(11).first << fmtBold << "Case sensitive:" << fmtBoldEnd << ' ' << (search_case_sensitive ? "Yes" : "No"); + *mSearcher->at(10).first << fmtBold << "Search in:" << fmtBoldEnd << ' ' << (Config.search_in_db ? "Database" : "Current playlist"); + *mSearcher->at(11).first << fmtBold << "Search mode:" << fmtBoldEnd << ' ' << (search_match_to_pattern ? search_mode_normal : search_mode_strict); + *mSearcher->at(12).first << fmtBold << "Case sensitive:" << fmtBoldEnd << ' ' << (search_case_sensitive ? "Yes" : "No"); - *mSearcher->at(13).first << "Search"; - *mSearcher->at(14).first << "Reset"; + *mSearcher->at(14).first << "Search"; + *mSearcher->at(15).first << "Reset"; } void Search(Song &s) diff --git a/src/search_engine.h b/src/search_engine.h index 79363a6b..27adad8f 100644 --- a/src/search_engine.h +++ b/src/search_engine.h @@ -24,7 +24,9 @@ #include "mpdpp.h" #include "ncmpcpp.h" -const size_t search_engine_static_options = 18; +const size_t search_engine_static_options = 19; +const size_t seach_engine_search_button = 14; +const size_t seach_engine_reset_button = 15; void SearchEngineDisplayer(const std::pair<Buffer *, Song *> &, void *, Menu< std::pair<Buffer *, Song *> > *); void UpdateFoundList(); |