use wstrings uncoditionally where needed

This commit is contained in:
Andrzej Rybczak
2012-09-08 17:50:01 +02:00
parent cf06d9fa8d
commit d5e2d315fd
46 changed files with 196 additions and 221 deletions

View File

@@ -800,7 +800,7 @@ void Delete::Run()
question = "Delete ";
question += itemTypeToString(item.type);
question += " \"";
question += Shorten(TO_WSTRING(name), COLS-question.size()-10);
question += Shorten(ToWString(name), COLS-question.size()-10);
question += "\"?";
}
bool yes = AskYesNoQuestion(question, TraceMpdStatus);
@@ -815,12 +815,12 @@ void Delete::Run()
if (myBrowser->deleteItem(i))
{
const char msg[] = "\"%s\" deleted";
ShowMessage(msg, Shorten(TO_WSTRING(name), COLS-const_strlen(msg)).c_str());
ShowMessage(msg, Shorten(ToWString(name), COLS-const_strlen(msg)).c_str());
}
else
{
const char msg[] = "Couldn't delete \"%s\": %s";
ShowMessage(msg, Shorten(TO_WSTRING(name), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
ShowMessage(msg, Shorten(ToWString(name), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
success = false;
break;
}
@@ -845,7 +845,7 @@ void Delete::Run()
else
{
question = "Delete playlist \"";
question += Shorten(TO_WSTRING(myPlaylistEditor->Playlists->current().value()), COLS-question.size()-10);
question += Shorten(ToWString(myPlaylistEditor->Playlists->current().value()), COLS-question.size()-10);
question += "\"?";
}
bool yes = AskYesNoQuestion(question, TraceMpdStatus);
@@ -1385,7 +1385,7 @@ void EditLibraryTag::Run()
if (!TagEditor::WriteTags(es))
{
const char msg[] = "Error while updating tags in \"%s\"";
ShowMessage(msg, Shorten(TO_WSTRING(es.getURI()), COLS-const_strlen(msg)).c_str());
ShowMessage(msg, Shorten(ToWString(es.getURI()), COLS-const_strlen(msg)).c_str());
success = false;
break;
}
@@ -1431,7 +1431,7 @@ void EditLibraryAlbum::Run()
if (f.isNull())
{
const char msg[] = "Error while opening file \"%s\"";
ShowMessage(msg, Shorten(TO_WSTRING((*myLibrary->Songs)[i].value().getURI()), COLS-const_strlen(msg)).c_str());
ShowMessage(msg, Shorten(ToWString((*myLibrary->Songs)[i].value().getURI()), COLS-const_strlen(msg)).c_str());
success = 0;
break;
}
@@ -1439,7 +1439,7 @@ void EditLibraryAlbum::Run()
if (!f.save())
{
const char msg[] = "Error while writing tags in \"%s\"";
ShowMessage(msg, Shorten(TO_WSTRING((*myLibrary->Songs)[i].value().getURI()), COLS-const_strlen(msg)).c_str());
ShowMessage(msg, Shorten(ToWString((*myLibrary->Songs)[i].value().getURI()), COLS-const_strlen(msg)).c_str());
success = 0;
break;
}
@@ -1492,7 +1492,7 @@ void EditDirectoryName::Run()
if (rename_result == 0)
{
const char msg[] = "Directory renamed to \"%s\"";
ShowMessage(msg, Shorten(TO_WSTRING(new_dir), COLS-const_strlen(msg)).c_str());
ShowMessage(msg, Shorten(ToWString(new_dir), COLS-const_strlen(msg)).c_str());
if (!myBrowser->isLocal())
Mpd.UpdateDirectory(locale_to_utf_cpy(getSharedDirectory(old_dir, new_dir)));
myBrowser->GetDirectory(myBrowser->CurrentDir());
@@ -1500,7 +1500,7 @@ void EditDirectoryName::Run()
else
{
const char msg[] = "Couldn't rename \"%s\": %s";
ShowMessage(msg, Shorten(TO_WSTRING(old_dir), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
ShowMessage(msg, Shorten(ToWString(old_dir), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
}
}
}
@@ -1519,13 +1519,13 @@ void EditDirectoryName::Run()
if (rename(full_old_dir.c_str(), full_new_dir.c_str()) == 0)
{
const char msg[] = "Directory renamed to \"%s\"";
ShowMessage(msg, Shorten(TO_WSTRING(new_dir), COLS-const_strlen(msg)).c_str());
ShowMessage(msg, Shorten(ToWString(new_dir), COLS-const_strlen(msg)).c_str());
Mpd.UpdateDirectory(myTagEditor->CurrentDir());
}
else
{
const char msg[] = "Couldn't rename \"%s\": %s";
ShowMessage(msg, Shorten(TO_WSTRING(old_dir), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
ShowMessage(msg, Shorten(ToWString(old_dir), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
}
}
}
@@ -1559,7 +1559,7 @@ void EditPlaylistName::Run()
if (Mpd.Rename(locale_to_utf_cpy(old_name), locale_to_utf_cpy(new_name)))
{
const char msg[] = "Playlist renamed to \"%s\"";
ShowMessage(msg, Shorten(TO_WSTRING(new_name), COLS-const_strlen(msg)).c_str());
ShowMessage(msg, Shorten(ToWString(new_name), COLS-const_strlen(msg)).c_str());
if (myBrowser->Main() && !myBrowser->isLocal())
myBrowser->GetDirectory("/");
if (myPlaylistEditor->Main())
@@ -1932,7 +1932,7 @@ void Find::Run()
ShowMessage("Searching...");
Screen<NC::Scrollpad> *s = static_cast<Screen<NC::Scrollpad> *>(myScreen);
s->Main()->removeFormatting();
ShowMessage("%s", findme.empty() || s->Main()->setFormatting(NC::fmtReverse, TO_WSTRING(findme), NC::fmtReverseEnd, 0) ? "Done!" : "No matching patterns found");
ShowMessage("%s", findme.empty() || s->Main()->setFormatting(NC::fmtReverse, ToWString(findme), NC::fmtReverseEnd, 0) ? "Done!" : "No matching patterns found");
s->Main()->flush();
}
@@ -2060,7 +2060,7 @@ void AddRandomItems::Run()
while (answer != 's' && answer != 'a' && answer != 'b');
UnlockStatusbar();
mpd_tag_type tag_type;
mpd_tag_type tag_type = MPD_TAG_ARTIST;
std::string tag_type_str ;
if (answer != 's')
{