rearrange fields in search engine / +composer +performer -track

This commit is contained in:
Andrzej Rybczak
2009-01-30 18:41:40 +01:00
parent 7b6521a370
commit 4ce83854a2
3 changed files with 59 additions and 46 deletions

View File

@@ -1256,16 +1256,16 @@ int main(int argc, char *argv[])
LockStatusbar(); LockStatusbar();
Song &s = sought_pattern; Song &s = sought_pattern;
if (option <= 11) if (option <= 12)
mSearcher->Current().first->Clear(); mSearcher->Current().first->Clear();
switch (option+1) switch (option+1)
{ {
case 1: case 1:
{ {
Statusbar() << fmtBold << "Filename: " << fmtBoldEnd; Statusbar() << fmtBold << "Artist: " << fmtBoldEnd;
s.SetFile(wFooter->GetString(s.GetFile())); s.SetArtist(wFooter->GetString(s.GetArtist()));
*mSearcher->Current().first << fmtBold << "Filename:" << fmtBoldEnd << ' ' << ShowTag(s.GetFile()); *mSearcher->Current().first << fmtBold << "Artist:" << fmtBoldEnd << ' ' << ShowTag(s.GetArtist());
break; break;
} }
case 2: case 2:
@@ -1276,31 +1276,31 @@ int main(int argc, char *argv[])
break; break;
} }
case 3: case 3:
{
Statusbar() << fmtBold << "Artist: " << fmtBoldEnd;
s.SetArtist(wFooter->GetString(s.GetArtist()));
*mSearcher->Current().first << fmtBold << "Artist:" << fmtBoldEnd << ' ' << ShowTag(s.GetArtist());
break;
}
case 4:
{ {
Statusbar() << fmtBold << "Album: " << fmtBoldEnd; Statusbar() << fmtBold << "Album: " << fmtBoldEnd;
s.SetAlbum(wFooter->GetString(s.GetAlbum())); s.SetAlbum(wFooter->GetString(s.GetAlbum()));
*mSearcher->Current().first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum()); *mSearcher->Current().first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum());
break; break;
} }
case 4:
{
Statusbar() << fmtBold << "Filename: " << fmtBoldEnd;
s.SetFile(wFooter->GetString(s.GetFile()));
*mSearcher->Current().first << fmtBold << "Filename:" << fmtBoldEnd << ' ' << ShowTag(s.GetFile());
break;
}
case 5: case 5:
{ {
Statusbar() << fmtBold << "Year: " << fmtBoldEnd; Statusbar() << fmtBold << "Composer: " << fmtBoldEnd;
s.SetYear(wFooter->GetString(s.GetYear(), 4)); s.SetComposer(wFooter->GetString(s.GetComposer()));
*mSearcher->Current().first << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetYear()); *mSearcher->Current().first << fmtBold << "Composer:" << fmtBoldEnd << ' ' << ShowTag(s.GetComposer());
break; break;
} }
case 6: case 6:
{ {
Statusbar() << fmtBold << "Track: " << fmtBoldEnd; Statusbar() << fmtBold << "Performer: " << fmtBoldEnd;
s.SetTrack(wFooter->GetString(s.GetTrack(), 3)); s.SetPerformer(wFooter->GetString(s.GetPerformer()));
*mSearcher->Current().first << fmtBold << "Track:" << fmtBoldEnd << ' ' << ShowTag(s.GetTrack()); *mSearcher->Current().first << fmtBold << "Performer:" << fmtBoldEnd << ' ' << ShowTag(s.GetPerformer());
break; break;
} }
case 7: case 7:
@@ -1311,31 +1311,38 @@ int main(int argc, char *argv[])
break; break;
} }
case 8: 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; Statusbar() << fmtBold << "Comment: " << fmtBoldEnd;
s.SetComment(wFooter->GetString(s.GetComment())); s.SetComment(wFooter->GetString(s.GetComment()));
*mSearcher->Current().first << fmtBold << "Comment:" << fmtBoldEnd << ' ' << ShowTag(s.GetComment()); *mSearcher->Current().first << fmtBold << "Comment:" << fmtBoldEnd << ' ' << ShowTag(s.GetComment());
break; break;
} }
case 10: case 11:
{ {
Config.search_in_db = !Config.search_in_db; Config.search_in_db = !Config.search_in_db;
*mSearcher->Current().first << fmtBold << "Search in:" << fmtBoldEnd << ' ' << (Config.search_in_db ? "Database" : "Current playlist"); *mSearcher->Current().first << fmtBold << "Search in:" << fmtBoldEnd << ' ' << (Config.search_in_db ? "Database" : "Current playlist");
break; break;
} }
case 11: case 12:
{ {
search_match_to_pattern = !search_match_to_pattern; 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); *mSearcher->Current().first << fmtBold << "Search mode:" << fmtBoldEnd << ' ' << (search_match_to_pattern ? search_mode_normal : search_mode_strict);
break; break;
} }
case 12: case 13:
{ {
search_case_sensitive = !search_case_sensitive; search_case_sensitive = !search_case_sensitive;
*mSearcher->Current().first << fmtBold << "Case sensitive:" << fmtBoldEnd << ' ' << (search_case_sensitive ? "Yes" : "No"); *mSearcher->Current().first << fmtBold << "Case sensitive:" << fmtBoldEnd << ' ' << (search_case_sensitive ? "Yes" : "No");
break; break;
} }
case 14: case 15:
{ {
ShowMessage("Searching..."); ShowMessage("Searching...");
Search(s); Search(s);
@@ -1343,11 +1350,11 @@ int main(int argc, char *argv[])
{ {
size_t found = mSearcher->Size()-search_engine_static_options; size_t found = mSearcher->Size()-search_engine_static_options;
found += 3; // don't count options inserted below found += 3; // don't count options inserted below
mSearcher->InsertSeparator(15); mSearcher->InsertSeparator(16);
mSearcher->InsertOption(16, make_pair((Buffer *)0, (Song *)0), 1, 1); mSearcher->InsertOption(17, make_pair((Buffer *)0, (Song *)0), 1, 1);
mSearcher->at(16).first = new Buffer(); mSearcher->at(17).first = new Buffer();
*mSearcher->at(16).first << Config.color1 << "Search results: " << Config.color2 << "Found " << found << (found > 1 ? " songs" : " song") << clDefault; *mSearcher->at(17).first << Config.color1 << "Search results: " << Config.color2 << "Found " << found << (found > 1 ? " songs" : " song") << clDefault;
mSearcher->InsertSeparator(17); mSearcher->InsertSeparator(18);
UpdateFoundList(); UpdateFoundList();
ShowMessage("Searching finished!"); ShowMessage("Searching finished!");
for (size_t i = 0; i < search_engine_static_options-4; i++) 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"); ShowMessage("No results found");
break; break;
} }
case 15: case 16:
{ {
CLEAR_FIND_HISTORY; CLEAR_FIND_HISTORY;
PrepareSearchEngine(sought_pattern); PrepareSearchEngine(sought_pattern);
@@ -2834,7 +2841,10 @@ int main(int argc, char *argv[])
{ {
if (wCurrent == mSearcher) 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; goto ENTER_SEARCH_ENGINE_SCREEN;
} }
} }
@@ -2867,8 +2877,8 @@ int main(int argc, char *argv[])
if (wCurrent == mBrowser && browsed_dir != "/") if (wCurrent == mBrowser && browsed_dir != "/")
mList->Select(0, 0); // [..] cannot be selected, uhm. mList->Select(0, 0); // [..] cannot be selected, uhm.
if (wCurrent == mSearcher) if (wCurrent == mSearcher)
mList->Select(14, 0); // 'Reset' cannot be selected, omgplz. mList->Select(seach_engine_reset_button, 0); // 'Reset' cannot be selected, omgplz.
// hacking shit ends. need better solution :/ // hacking shit ends.
ShowMessage("Selection reversed!"); ShowMessage("Selection reversed!");
} }
} }

View File

@@ -74,12 +74,12 @@ void PrepareSearchEngine(Song &s)
s.Clear(); s.Clear();
mSearcher->Clear(); mSearcher->Clear();
mSearcher->Reset(); mSearcher->Reset();
mSearcher->ResizeBuffer(15); mSearcher->ResizeBuffer(16);
mSearcher->IntoSeparator(8); mSearcher->IntoSeparator(9);
mSearcher->IntoSeparator(12); mSearcher->IntoSeparator(13);
for (size_t i = 0; i < 15; i++) for (size_t i = 0; i < 16; i++)
{ {
try try
{ {
@@ -88,21 +88,22 @@ void PrepareSearchEngine(Song &s)
catch (List::InvalidItem) { } 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(1).first << fmtBold << "Title:" << fmtBoldEnd << ' ' << ShowTag(s.GetTitle());
*mSearcher->at(2).first << fmtBold << "Artist:" << fmtBoldEnd << ' ' << ShowTag(s.GetArtist()); *mSearcher->at(2).first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum());
*mSearcher->at(3).first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum()); *mSearcher->at(3).first << fmtBold << "Filename:" << fmtBoldEnd << ' ' << ShowTag(s.GetName());
*mSearcher->at(4).first << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetYear()); *mSearcher->at(4).first << fmtBold << "Composer:" << fmtBoldEnd << ' ' << ShowTag(s.GetComposer());
*mSearcher->at(5).first << fmtBold << "Track:" << fmtBoldEnd << ' ' << ShowTag(s.GetTrack()); *mSearcher->at(5).first << fmtBold << "Performer:" << fmtBoldEnd << ' ' << ShowTag(s.GetPerformer());
*mSearcher->at(6).first << fmtBold << "Genre:" << fmtBoldEnd << ' ' << ShowTag(s.GetGenre()); *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 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 << "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(12).first << fmtBold << "Case sensitive:" << fmtBoldEnd << ' ' << (search_case_sensitive ? "Yes" : "No");
*mSearcher->at(13).first << "Search"; *mSearcher->at(14).first << "Search";
*mSearcher->at(14).first << "Reset"; *mSearcher->at(15).first << "Reset";
} }
void Search(Song &s) void Search(Song &s)

View File

@@ -24,7 +24,9 @@
#include "mpdpp.h" #include "mpdpp.h"
#include "ncmpcpp.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 SearchEngineDisplayer(const std::pair<Buffer *, Song *> &, void *, Menu< std::pair<Buffer *, Song *> > *);
void UpdateFoundList(); void UpdateFoundList();