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();
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:
@@ -1276,31 +1276,31 @@ int main(int argc, char *argv[])
break;
}
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;
s.SetAlbum(wFooter->GetString(s.GetAlbum()));
*mSearcher->Current().first << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum());
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:
{
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:
@@ -1311,31 +1311,38 @@ int main(int argc, char *argv[])
break;
}
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!");
}
}

View File

@@ -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)

View File

@@ -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();