statusbar: use boost::format instead of c-style printf
This commit is contained in:
@@ -122,6 +122,12 @@ AC_CHECK_LIB(boost_system$BOOST_LIB_SUFFIX, main, LDFLAGS="$LDFLAGS -lboost_syst
|
|||||||
AC_MSG_ERROR([no boost.system library found])
|
AC_MSG_ERROR([no boost.system library found])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dnl =============================
|
||||||
|
dnl = checking for boost.format =
|
||||||
|
dnl =============================
|
||||||
|
AC_CHECK_HEADERS([boost/format.hpp], ,
|
||||||
|
AC_MSG_ERROR(boost/format.hpp is missing)
|
||||||
|
)
|
||||||
|
|
||||||
dnl =============================
|
dnl =============================
|
||||||
dnl = checking for boost.locale =
|
dnl = checking for boost.locale =
|
||||||
|
|||||||
204
src/actions.cpp
204
src/actions.cpp
@@ -275,7 +275,7 @@ bool isMPDMusicDirSet()
|
|||||||
{
|
{
|
||||||
if (Config.mpd_music_dir.empty())
|
if (Config.mpd_music_dir.empty())
|
||||||
{
|
{
|
||||||
Statusbar::msg("Proper mpd_music_dir variable has to be set in configuration file");
|
Statusbar::print("Proper mpd_music_dir variable has to be set in configuration file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -496,7 +496,7 @@ void ToggleInterface::run()
|
|||||||
resizeScreen(false);
|
resizeScreen(false);
|
||||||
Status::Changes::mixer();
|
Status::Changes::mixer();
|
||||||
Status::Changes::elapsedTime(false);
|
Status::Changes::elapsedTime(false);
|
||||||
Statusbar::msg("User interface: %s", Config.new_design ? "Alternative" : "Classic");
|
Statusbar::printf("User interface: %1%", Config.new_design ? "Alternative" : "Classic");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JumpToParentDirectory::canBeRun() const
|
bool JumpToParentDirectory::canBeRun() const
|
||||||
@@ -626,18 +626,18 @@ void DeletePlaylistItems::run()
|
|||||||
{
|
{
|
||||||
if (myScreen == myPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Deleting items...");
|
Statusbar::print("Deleting items...");
|
||||||
auto delete_fun = boost::bind(&MPD::Connection::Delete, _1, _2);
|
auto delete_fun = boost::bind(&MPD::Connection::Delete, _1, _2);
|
||||||
deleteSelectedSongs(myPlaylist->main(), delete_fun);
|
deleteSelectedSongs(myPlaylist->main(), delete_fun);
|
||||||
Statusbar::msg("Item(s) deleted");
|
Statusbar::print("Item(s) deleted");
|
||||||
}
|
}
|
||||||
else if (myScreen->isActiveWindow(myPlaylistEditor->Content))
|
else if (myScreen->isActiveWindow(myPlaylistEditor->Content))
|
||||||
{
|
{
|
||||||
std::string playlist = myPlaylistEditor->Playlists.current().value();
|
std::string playlist = myPlaylistEditor->Playlists.current().value();
|
||||||
auto delete_fun = boost::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2);
|
auto delete_fun = boost::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2);
|
||||||
Statusbar::msg("Deleting items...");
|
Statusbar::print("Deleting items...");
|
||||||
deleteSelectedSongs(myPlaylistEditor->Content, delete_fun);
|
deleteSelectedSongs(myPlaylistEditor->Content, delete_fun);
|
||||||
Statusbar::msg("Item(s) deleted");
|
Statusbar::print("Item(s) deleted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,7 +648,7 @@ bool DeleteBrowserItems::canBeRun() const
|
|||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Statusbar::msg("Flag 'allow_for_physical_item_deletion' needs to be enabled in configuration file");
|
Statusbar::print("Flag \"allow_for_physical_item_deletion\" needs to be enabled in configuration file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -685,12 +685,12 @@ void DeleteBrowserItems::run()
|
|||||||
std::string errmsg;
|
std::string errmsg;
|
||||||
if (myBrowser->deleteItem(i, errmsg))
|
if (myBrowser->deleteItem(i, errmsg))
|
||||||
{
|
{
|
||||||
const char msg[] = "\"%ls\" deleted";
|
const char msg[] = "\"%1%\" deleted";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(iname), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(iname, COLS-const_strlen(msg)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Statusbar::msg("%s", errmsg.c_str());
|
Statusbar::print(errmsg);
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -704,7 +704,7 @@ void DeleteBrowserItems::run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("Aborted");
|
Statusbar::print("Aborted");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeleteStoredPlaylist::canBeRun() const
|
bool DeleteStoredPlaylist::canBeRun() const
|
||||||
@@ -732,10 +732,10 @@ void DeleteStoredPlaylist::run()
|
|||||||
for (auto it = list.begin(); it != list.end(); ++it)
|
for (auto it = list.begin(); it != list.end(); ++it)
|
||||||
Mpd.DeletePlaylist((*it)->value());
|
Mpd.DeletePlaylist((*it)->value());
|
||||||
Mpd.CommitCommandsList();
|
Mpd.CommitCommandsList();
|
||||||
Statusbar::msg("Playlist%s deleted", list.size() == 1 ? "" : "s");
|
Statusbar::printf("%1% deleted", list.size() == 1 ? "Playlist" : "Playlists");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("Aborted");
|
Statusbar::print("Aborted");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReplaySong::run()
|
void ReplaySong::run()
|
||||||
@@ -769,7 +769,7 @@ void SavePlaylist::run()
|
|||||||
Statusbar::unlock();
|
Statusbar::unlock();
|
||||||
if (playlist_name.find("/") != std::string::npos)
|
if (playlist_name.find("/") != std::string::npos)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Playlist name must not contain slashes");
|
Statusbar::print("Playlist name must not contain slashes");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!playlist_name.empty())
|
if (!playlist_name.empty())
|
||||||
@@ -780,14 +780,14 @@ void SavePlaylist::run()
|
|||||||
for (size_t i = 0; i < myPlaylist->main().size(); ++i)
|
for (size_t i = 0; i < myPlaylist->main().size(); ++i)
|
||||||
Mpd.AddToPlaylist(playlist_name, myPlaylist->main()[i].value());
|
Mpd.AddToPlaylist(playlist_name, myPlaylist->main()[i].value());
|
||||||
Mpd.CommitCommandsList();
|
Mpd.CommitCommandsList();
|
||||||
Statusbar::msg("Filtered items added to playlist \"%s\"", playlist_name.c_str());
|
Statusbar::printf("Filtered items added to playlist \"%1%\"", playlist_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Mpd.SavePlaylist(playlist_name);
|
Mpd.SavePlaylist(playlist_name);
|
||||||
Statusbar::msg("Playlist saved as \"%s\"", playlist_name.c_str());
|
Statusbar::printf("Playlist saved as \"%1%\"", playlist_name);
|
||||||
}
|
}
|
||||||
catch (MPD::ServerError &e)
|
catch (MPD::ServerError &e)
|
||||||
{
|
{
|
||||||
@@ -798,10 +798,10 @@ void SavePlaylist::run()
|
|||||||
{
|
{
|
||||||
Mpd.DeletePlaylist(playlist_name);
|
Mpd.DeletePlaylist(playlist_name);
|
||||||
Mpd.SavePlaylist(playlist_name);
|
Mpd.SavePlaylist(playlist_name);
|
||||||
Statusbar::msg("Playlist overwritten");
|
Statusbar::print("Playlist overwritten");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("Aborted");
|
Statusbar::print("Aborted");
|
||||||
if (myScreen == myPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
myPlaylist->EnableHighlighting();
|
myPlaylist->EnableHighlighting();
|
||||||
}
|
}
|
||||||
@@ -835,12 +835,14 @@ void ExecuteCommand::run()
|
|||||||
auto cmd = Bindings.findCommand(cmd_name);
|
auto cmd = Bindings.findCommand(cmd_name);
|
||||||
if (cmd)
|
if (cmd)
|
||||||
{
|
{
|
||||||
Statusbar::msg(1, "Executing %s...", cmd_name.c_str());
|
Statusbar::printf(1, "Executing %1%...", cmd_name);
|
||||||
bool res = cmd->binding().execute();
|
bool res = cmd->binding().execute();
|
||||||
Statusbar::msg("Execution of command '%s' %s.", cmd_name.c_str(), res ? "successful" : "unsuccessful");
|
Statusbar::printf("Execution of command \"%1%\" %2%.",
|
||||||
|
cmd_name, res ? "successful" : "unsuccessful"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("No command named \"%s\"", cmd_name.c_str());
|
Statusbar::printf("No command named \"%1%\"", cmd_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoveSortOrderUp::canBeRun() const
|
bool MoveSortOrderUp::canBeRun() const
|
||||||
@@ -1001,7 +1003,9 @@ void ToggleDisplayMode::run()
|
|||||||
if (myScreen == myPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
{
|
{
|
||||||
Config.columns_in_playlist = !Config.columns_in_playlist;
|
Config.columns_in_playlist = !Config.columns_in_playlist;
|
||||||
Statusbar::msg("Playlist display mode: %s", Config.columns_in_playlist ? "Columns" : "Classic");
|
Statusbar::printf("Playlist display mode: %1%",
|
||||||
|
Config.columns_in_playlist ? "Columns" : "Classic"
|
||||||
|
);
|
||||||
|
|
||||||
if (Config.columns_in_playlist)
|
if (Config.columns_in_playlist)
|
||||||
{
|
{
|
||||||
@@ -1020,20 +1024,26 @@ void ToggleDisplayMode::run()
|
|||||||
else if (myScreen == myBrowser)
|
else if (myScreen == myBrowser)
|
||||||
{
|
{
|
||||||
Config.columns_in_browser = !Config.columns_in_browser;
|
Config.columns_in_browser = !Config.columns_in_browser;
|
||||||
Statusbar::msg("Browser display mode: %s", Config.columns_in_browser ? "Columns" : "Classic");
|
Statusbar::printf("Browser display mode: %1%",
|
||||||
|
Config.columns_in_browser ? "Columns" : "Classic"
|
||||||
|
);
|
||||||
myBrowser->main().setTitle(Config.columns_in_browser && Config.titles_visibility ? Display::Columns(myBrowser->main().getWidth()) : "");
|
myBrowser->main().setTitle(Config.columns_in_browser && Config.titles_visibility ? Display::Columns(myBrowser->main().getWidth()) : "");
|
||||||
}
|
}
|
||||||
else if (myScreen == mySearcher)
|
else if (myScreen == mySearcher)
|
||||||
{
|
{
|
||||||
Config.columns_in_search_engine = !Config.columns_in_search_engine;
|
Config.columns_in_search_engine = !Config.columns_in_search_engine;
|
||||||
Statusbar::msg("Search engine display mode: %s", Config.columns_in_search_engine ? "Columns" : "Classic");
|
Statusbar::printf("Search engine display mode: %1%",
|
||||||
|
Config.columns_in_search_engine ? "Columns" : "Classic"
|
||||||
|
);
|
||||||
if (mySearcher->main().size() > SearchEngine::StaticOptions)
|
if (mySearcher->main().size() > SearchEngine::StaticOptions)
|
||||||
mySearcher->main().setTitle(Config.columns_in_search_engine && Config.titles_visibility ? Display::Columns(mySearcher->main().getWidth()) : "");
|
mySearcher->main().setTitle(Config.columns_in_search_engine && Config.titles_visibility ? Display::Columns(mySearcher->main().getWidth()) : "");
|
||||||
}
|
}
|
||||||
else if (myScreen->isActiveWindow(myPlaylistEditor->Content))
|
else if (myScreen->isActiveWindow(myPlaylistEditor->Content))
|
||||||
{
|
{
|
||||||
Config.columns_in_playlist_editor = !Config.columns_in_playlist_editor;
|
Config.columns_in_playlist_editor = !Config.columns_in_playlist_editor;
|
||||||
Statusbar::msg("Playlist editor display mode: %s", Config.columns_in_playlist_editor ? "Columns" : "Classic");
|
Statusbar::printf("Playlist editor display mode: %1%",
|
||||||
|
Config.columns_in_playlist_editor ? "Columns" : "Classic"
|
||||||
|
);
|
||||||
if (Config.columns_in_playlist_editor)
|
if (Config.columns_in_playlist_editor)
|
||||||
myPlaylistEditor->Content.setItemDisplayer(boost::bind(Display::SongsInColumns, _1, myPlaylistEditor->contentProxyList()));
|
myPlaylistEditor->Content.setItemDisplayer(boost::bind(Display::SongsInColumns, _1, myPlaylistEditor->contentProxyList()));
|
||||||
else
|
else
|
||||||
@@ -1049,7 +1059,9 @@ bool ToggleSeparatorsBetweenAlbums::canBeRun() const
|
|||||||
void ToggleSeparatorsBetweenAlbums::run()
|
void ToggleSeparatorsBetweenAlbums::run()
|
||||||
{
|
{
|
||||||
Config.playlist_separate_albums = !Config.playlist_separate_albums;
|
Config.playlist_separate_albums = !Config.playlist_separate_albums;
|
||||||
Statusbar::msg("Separators between albums: %s", Config.playlist_separate_albums ? "On" : "Off");
|
Statusbar::printf("Separators between albums: %1%",
|
||||||
|
Config.playlist_separate_albums ? "On" : "Off"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_CURL_CURL_H
|
#ifndef HAVE_CURL_CURL_H
|
||||||
@@ -1077,14 +1089,18 @@ void ToggleFetchingLyricsInBackground::run()
|
|||||||
{
|
{
|
||||||
# ifdef HAVE_CURL_CURL_H
|
# ifdef HAVE_CURL_CURL_H
|
||||||
Config.fetch_lyrics_in_background = !Config.fetch_lyrics_in_background;
|
Config.fetch_lyrics_in_background = !Config.fetch_lyrics_in_background;
|
||||||
Statusbar::msg("Fetching lyrics for playing songs in background: %s", Config.fetch_lyrics_in_background ? "On" : "Off");
|
Statusbar::printf("Fetching lyrics for playing songs in background: %1%",
|
||||||
|
Config.fetch_lyrics_in_background ? "On" : "Off"
|
||||||
|
);
|
||||||
# endif // HAVE_CURL_CURL_H
|
# endif // HAVE_CURL_CURL_H
|
||||||
}
|
}
|
||||||
|
|
||||||
void TogglePlayingSongCentering::run()
|
void TogglePlayingSongCentering::run()
|
||||||
{
|
{
|
||||||
Config.autocenter_mode = !Config.autocenter_mode;
|
Config.autocenter_mode = !Config.autocenter_mode;
|
||||||
Statusbar::msg("Centering playing song: %s", Config.autocenter_mode ? "On" : "Off");
|
Statusbar::printf("Centering playing song: %1%",
|
||||||
|
Config.autocenter_mode ? "On" : "Off"
|
||||||
|
);
|
||||||
if (Config.autocenter_mode
|
if (Config.autocenter_mode
|
||||||
&& Status::State::player() != MPD::psStop
|
&& Status::State::player() != MPD::psStop
|
||||||
&& !myPlaylist->main().isFiltered())
|
&& !myPlaylist->main().isFiltered())
|
||||||
@@ -1221,7 +1237,7 @@ void SetVolume::run()
|
|||||||
int volume = fromString<unsigned>(strvolume);
|
int volume = fromString<unsigned>(strvolume);
|
||||||
boundsCheck(volume, 0, 100);
|
boundsCheck(volume, 0, 100);
|
||||||
Mpd.SetVolume(volume);
|
Mpd.SetVolume(volume);
|
||||||
Statusbar::msg("Volume set to %d%%", volume);
|
Statusbar::printf("Volume set to %1%%%", volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSong::canBeRun() const
|
bool EditSong::canBeRun() const
|
||||||
@@ -1265,7 +1281,7 @@ void EditLibraryTag::run()
|
|||||||
Statusbar::unlock();
|
Statusbar::unlock();
|
||||||
if (!new_tag.empty() && new_tag != myLibrary->Tags.current().value().tag())
|
if (!new_tag.empty() && new_tag != myLibrary->Tags.current().value().tag())
|
||||||
{
|
{
|
||||||
Statusbar::msg("Updating tags...");
|
Statusbar::print("Updating tags...");
|
||||||
Mpd.StartSearch(1);
|
Mpd.StartSearch(1);
|
||||||
Mpd.AddSearch(Config.media_lib_primary_tag, myLibrary->Tags.current().value().tag());
|
Mpd.AddSearch(Config.media_lib_primary_tag, myLibrary->Tags.current().value().tag());
|
||||||
MPD::MutableSong::SetFunction set = tagTypeToSetFunction(Config.media_lib_primary_tag);
|
MPD::MutableSong::SetFunction set = tagTypeToSetFunction(Config.media_lib_primary_tag);
|
||||||
@@ -1277,12 +1293,12 @@ void EditLibraryTag::run()
|
|||||||
return;
|
return;
|
||||||
MPD::MutableSong ms = s;
|
MPD::MutableSong ms = s;
|
||||||
ms.setTags(set, new_tag, Config.tags_separator);
|
ms.setTags(set, new_tag, Config.tags_separator);
|
||||||
Statusbar::msg("Updating tags in \"%s\"...", ms.getName().c_str());
|
Statusbar::printf("Updating tags in \"%1%\"...", ms.getName());
|
||||||
std::string path = Config.mpd_music_dir + ms.getURI();
|
std::string path = Config.mpd_music_dir + ms.getURI();
|
||||||
if (!Tags::write(ms))
|
if (!Tags::write(ms))
|
||||||
{
|
{
|
||||||
const char msg[] = "Error while updating tags in \"%ls\"";
|
const char msg[] = "Error while updating tags in \"%1%\"";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(ms.getURI()), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(ms.getURI(), COLS-const_strlen(msg)));
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
if (dir_to_update.empty())
|
if (dir_to_update.empty())
|
||||||
@@ -1293,7 +1309,7 @@ void EditLibraryTag::run()
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
Mpd.UpdateDirectory(dir_to_update);
|
Mpd.UpdateDirectory(dir_to_update);
|
||||||
Statusbar::msg("Tags updated successfully");
|
Statusbar::print("Tags updated successfully");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
@@ -1322,24 +1338,24 @@ void EditLibraryAlbum::run()
|
|||||||
if (!new_album.empty() && new_album != myLibrary->Albums.current().value().entry().album())
|
if (!new_album.empty() && new_album != myLibrary->Albums.current().value().entry().album())
|
||||||
{
|
{
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
Statusbar::msg("Updating tags...");
|
Statusbar::print("Updating tags...");
|
||||||
for (size_t i = 0; i < myLibrary->Songs.size(); ++i)
|
for (size_t i = 0; i < myLibrary->Songs.size(); ++i)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Updating tags in \"%s\"...", myLibrary->Songs[i].value().getName().c_str());
|
Statusbar::printf("Updating tags in \"%1%\"...", myLibrary->Songs[i].value().getName());
|
||||||
std::string path = Config.mpd_music_dir + myLibrary->Songs[i].value().getURI();
|
std::string path = Config.mpd_music_dir + myLibrary->Songs[i].value().getURI();
|
||||||
TagLib::FileRef f(path.c_str());
|
TagLib::FileRef f(path.c_str());
|
||||||
if (f.isNull())
|
if (f.isNull())
|
||||||
{
|
{
|
||||||
const char msg[] = "Error while opening file \"%ls\"";
|
const char msg[] = "Error while opening file \"%1%\"";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(myLibrary->Songs[i].value().getURI()), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(myLibrary->Songs[i].value().getURI(), COLS-const_strlen(msg)));
|
||||||
success = 0;
|
success = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
f.tag()->setAlbum(ToWString(new_album));
|
f.tag()->setAlbum(ToWString(new_album));
|
||||||
if (!f.save())
|
if (!f.save())
|
||||||
{
|
{
|
||||||
const char msg[] = "Error while writing tags in \"%ls\"";
|
const char msg[] = "Error while writing tags in \"%1%\"";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(myLibrary->Songs[i].value().getURI()), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(myLibrary->Songs[i].value().getURI(), COLS-const_strlen(msg)));
|
||||||
success = 0;
|
success = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1347,7 +1363,7 @@ void EditLibraryAlbum::run()
|
|||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
Mpd.UpdateDirectory(getSharedDirectory(myLibrary->Songs.beginV(), myLibrary->Songs.endV()));
|
Mpd.UpdateDirectory(getSharedDirectory(myLibrary->Songs.beginV(), myLibrary->Songs.endV()));
|
||||||
Statusbar::msg("Tags updated successfully");
|
Statusbar::print("Tags updated successfully");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
@@ -1390,16 +1406,16 @@ void EditDirectoryName::run()
|
|||||||
int rename_result = rename(full_old_dir.c_str(), full_new_dir.c_str());
|
int rename_result = rename(full_old_dir.c_str(), full_new_dir.c_str());
|
||||||
if (rename_result == 0)
|
if (rename_result == 0)
|
||||||
{
|
{
|
||||||
const char msg[] = "Directory renamed to \"%ls\"";
|
const char msg[] = "Directory renamed to \"%1%\"";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(new_dir), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(new_dir, COLS-const_strlen(msg)));
|
||||||
if (!myBrowser->isLocal())
|
if (!myBrowser->isLocal())
|
||||||
Mpd.UpdateDirectory(getSharedDirectory(old_dir, new_dir));
|
Mpd.UpdateDirectory(getSharedDirectory(old_dir, new_dir));
|
||||||
myBrowser->GetDirectory(myBrowser->CurrentDir());
|
myBrowser->GetDirectory(myBrowser->CurrentDir());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char msg[] = "Couldn't rename \"%ls\": %s";
|
const char msg[] = "Couldn't rename \"%1%\": %s";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(old_dir), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
|
Statusbar::printf(msg, wideShorten(old_dir, COLS-const_strlen(msg)-25), strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1417,14 +1433,14 @@ void EditDirectoryName::run()
|
|||||||
std::string full_new_dir = Config.mpd_music_dir + myTagEditor->CurrentDir() + "/" + new_dir;
|
std::string full_new_dir = Config.mpd_music_dir + myTagEditor->CurrentDir() + "/" + new_dir;
|
||||||
if (rename(full_old_dir.c_str(), full_new_dir.c_str()) == 0)
|
if (rename(full_old_dir.c_str(), full_new_dir.c_str()) == 0)
|
||||||
{
|
{
|
||||||
const char msg[] = "Directory renamed to \"%ls\"";
|
const char msg[] = "Directory renamed to \"%1%\"";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(new_dir), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(new_dir, COLS-const_strlen(msg)));
|
||||||
Mpd.UpdateDirectory(myTagEditor->CurrentDir());
|
Mpd.UpdateDirectory(myTagEditor->CurrentDir());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char msg[] = "Couldn't rename \"%ls\": %s";
|
const char msg[] = "Couldn't rename \"%1%\": %2%";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(old_dir), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
|
Statusbar::printf(msg, wideShorten(old_dir, COLS-const_strlen(msg)-25), strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1456,8 +1472,8 @@ void EditPlaylistName::run()
|
|||||||
if (!new_name.empty() && new_name != old_name)
|
if (!new_name.empty() && new_name != old_name)
|
||||||
{
|
{
|
||||||
Mpd.Rename(old_name, new_name);
|
Mpd.Rename(old_name, new_name);
|
||||||
const char msg[] = "Playlist renamed to \"%ls\"";
|
const char msg[] = "Playlist renamed to \"%1%\"";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(new_name), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(new_name, COLS-const_strlen(msg)));
|
||||||
if (!myBrowser->isLocal())
|
if (!myBrowser->isLocal())
|
||||||
myBrowser->GetDirectory("/");
|
myBrowser->GetDirectory("/");
|
||||||
}
|
}
|
||||||
@@ -1516,7 +1532,7 @@ void ToggleScreenLock::run()
|
|||||||
BaseScreen::unlock();
|
BaseScreen::unlock();
|
||||||
Actions::setResizeFlags();
|
Actions::setResizeFlags();
|
||||||
myScreen->resize();
|
myScreen->resize();
|
||||||
Statusbar::msg("Screen unlocked");
|
Statusbar::print("Screen unlocked");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1532,9 +1548,9 @@ void ToggleScreenLock::run()
|
|||||||
boundsCheck(part, 20, 80);
|
boundsCheck(part, 20, 80);
|
||||||
Config.locked_screen_width_part = part/100.0;
|
Config.locked_screen_width_part = part/100.0;
|
||||||
if (myScreen->lock())
|
if (myScreen->lock())
|
||||||
Statusbar::msg("Screen locked (with %d%% width)", part);
|
Statusbar::printf("Screen locked (with %1%%% width)", part);
|
||||||
else
|
else
|
||||||
Statusbar::msg("Current screen can't be locked");
|
Statusbar::print("Current screen can't be locked");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1595,7 +1611,7 @@ void JumpToPositionInSong::run()
|
|||||||
Mpd.Seek(s.getPosition(), secs);
|
Mpd.Seek(s.getPosition(), secs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("Invalid format ([m]:[ss], [s]s, [%%]%%, [%%] accepted)");
|
Statusbar::print("Invalid format ([m]:[ss], [s]s, [%]%, [%] accepted)");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReverseSelection::canBeRun() const
|
bool ReverseSelection::canBeRun() const
|
||||||
@@ -1608,7 +1624,7 @@ void ReverseSelection::run()
|
|||||||
{
|
{
|
||||||
auto w = hasSongs(myScreen);
|
auto w = hasSongs(myScreen);
|
||||||
w->reverseSelection();
|
w->reverseSelection();
|
||||||
Statusbar::msg("Selection reversed");
|
Statusbar::print("Selection reversed");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoveSelection::canBeRun() const
|
bool RemoveSelection::canBeRun() const
|
||||||
@@ -1621,7 +1637,7 @@ void RemoveSelection::run()
|
|||||||
auto pl = proxySongList(myScreen);
|
auto pl = proxySongList(myScreen);
|
||||||
for (size_t i = 0; i < pl.size(); ++i)
|
for (size_t i = 0; i < pl.size(); ++i)
|
||||||
pl.setSelected(i, false);
|
pl.setSelected(i, false);
|
||||||
Statusbar::msg("Selection removed");
|
Statusbar::print("Selection removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SelectAlbum::canBeRun() const
|
bool SelectAlbum::canBeRun() const
|
||||||
@@ -1658,7 +1674,7 @@ void SelectAlbum::run()
|
|||||||
else
|
else
|
||||||
pl.setSelected(pos, true);
|
pl.setSelected(pos, true);
|
||||||
}
|
}
|
||||||
Statusbar::msg("Album around cursor position selected");
|
Statusbar::print("Album around cursor position selected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1679,9 +1695,8 @@ void CropMainPlaylist::run()
|
|||||||
yes = askYesNoQuestion("Do you really want to crop main playlist?", Status::trace);
|
yes = askYesNoQuestion("Do you really want to crop main playlist?", Status::trace);
|
||||||
if (yes)
|
if (yes)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Cropping playlist...");
|
Statusbar::print("Cropping playlist...");
|
||||||
cropPlaylist(myPlaylist->main(), boost::bind(&MPD::Connection::Delete, _1, _2));
|
cropPlaylist(myPlaylist->main(), boost::bind(&MPD::Connection::Delete, _1, _2));
|
||||||
Statusbar::msg("Cropping playlist...");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1700,9 +1715,9 @@ void CropPlaylist::run()
|
|||||||
if (yes)
|
if (yes)
|
||||||
{
|
{
|
||||||
auto delete_fun = boost::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2);
|
auto delete_fun = boost::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2);
|
||||||
Statusbar::msg("Cropping playlist \"%s\"...", playlist.c_str());
|
Statusbar::printf("Cropping playlist \"%1%\"...", playlist);
|
||||||
cropPlaylist(myPlaylistEditor->Content, delete_fun);
|
cropPlaylist(myPlaylistEditor->Content, delete_fun);
|
||||||
Statusbar::msg("Playlist \"%s\" cropped", playlist.c_str());
|
Statusbar::printf("Playlist \"%1%\" cropped", playlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1715,9 +1730,9 @@ void ClearMainPlaylist::run()
|
|||||||
{
|
{
|
||||||
auto delete_fun = boost::bind(&MPD::Connection::Delete, _1, _2);
|
auto delete_fun = boost::bind(&MPD::Connection::Delete, _1, _2);
|
||||||
auto clear_fun = boost::bind(&MPD::Connection::ClearMainPlaylist, _1);
|
auto clear_fun = boost::bind(&MPD::Connection::ClearMainPlaylist, _1);
|
||||||
Statusbar::msg("Deleting items...");
|
Statusbar::printf("Deleting items...");
|
||||||
clearPlaylist(myPlaylist->main(), delete_fun, clear_fun);
|
clearPlaylist(myPlaylist->main(), delete_fun, clear_fun);
|
||||||
Statusbar::msg("Items deleted");
|
Statusbar::printf("Items deleted");
|
||||||
myPlaylist->main().reset();
|
myPlaylist->main().reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1738,9 +1753,9 @@ void ClearPlaylist::run()
|
|||||||
{
|
{
|
||||||
auto delete_fun = boost::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2);
|
auto delete_fun = boost::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2);
|
||||||
auto clear_fun = boost::bind(&MPD::Connection::ClearPlaylist, _1, playlist);
|
auto clear_fun = boost::bind(&MPD::Connection::ClearPlaylist, _1, playlist);
|
||||||
Statusbar::msg("Deleting items from \"%s\"...", playlist.c_str());
|
Statusbar::printf("Deleting items from \"%1%\"...", playlist);
|
||||||
clearPlaylist(myPlaylistEditor->Content, delete_fun, clear_fun);
|
clearPlaylist(myPlaylistEditor->Content, delete_fun, clear_fun);
|
||||||
Statusbar::msg("Items deleted from \"%s\"", playlist.c_str());
|
Statusbar::printf("Items deleted from \"%1%\"", playlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1788,14 +1803,14 @@ void ApplyFilter::run()
|
|||||||
if (filter.empty())
|
if (filter.empty())
|
||||||
{
|
{
|
||||||
myPlaylist->main().clearFilterResults();
|
myPlaylist->main().clearFilterResults();
|
||||||
Statusbar::msg("Filtering disabled");
|
Statusbar::printf("Filtering disabled");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// apply filter here so even if old one wasn't modified
|
// apply filter here so even if old one wasn't modified
|
||||||
// (and callback wasn't invoked), it still gets applied.
|
// (and callback wasn't invoked), it still gets applied.
|
||||||
f->applyFilter(filter);
|
f->applyFilter(filter);
|
||||||
Statusbar::msg("Using filter \"%s\"", filter.c_str());
|
Statusbar::printf("Using filter \"%1%\"", filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myScreen == myPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
@@ -1826,10 +1841,13 @@ void Find::run()
|
|||||||
std::string findme = wFooter->getString();
|
std::string findme = wFooter->getString();
|
||||||
Statusbar::unlock();
|
Statusbar::unlock();
|
||||||
|
|
||||||
Statusbar::msg("Searching...");
|
Statusbar::print("Searching...");
|
||||||
auto s = static_cast<Screen<NC::Scrollpad> *>(myScreen);
|
auto s = static_cast<Screen<NC::Scrollpad> *>(myScreen);
|
||||||
s->main().removeProperties();
|
s->main().removeProperties();
|
||||||
Statusbar::msg("%s", findme.empty() || s->main().setProperties(NC::Format::Reverse, findme, NC::Format::NoReverse) ? "Done" : "No matching patterns found");
|
if (findme.empty() || s->main().setProperties(NC::Format::Reverse, findme, NC::Format::NoReverse))
|
||||||
|
Statusbar::print("Done");
|
||||||
|
else
|
||||||
|
Statusbar::print("No matching patterns found");
|
||||||
s->main().flush();
|
s->main().flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1884,7 +1902,9 @@ void PreviousFoundItem::run()
|
|||||||
void ToggleFindMode::run()
|
void ToggleFindMode::run()
|
||||||
{
|
{
|
||||||
Config.wrapped_search = !Config.wrapped_search;
|
Config.wrapped_search = !Config.wrapped_search;
|
||||||
Statusbar::msg("Search mode: %s", Config.wrapped_search ? "Wrapped" : "Normal");
|
Statusbar::printf("Search mode: %1%",
|
||||||
|
Config.wrapped_search ? "Wrapped" : "Normal"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleReplayGainMode::run()
|
void ToggleReplayGainMode::run()
|
||||||
@@ -1903,32 +1923,38 @@ void ToggleReplayGainMode::run()
|
|||||||
while (answer != 'o' && answer != 't' && answer != 'a');
|
while (answer != 'o' && answer != 't' && answer != 'a');
|
||||||
Statusbar::unlock();
|
Statusbar::unlock();
|
||||||
Mpd.SetReplayGainMode(answer == 't' ? MPD::rgmTrack : (answer == 'a' ? MPD::rgmAlbum : MPD::rgmOff));
|
Mpd.SetReplayGainMode(answer == 't' ? MPD::rgmTrack : (answer == 'a' ? MPD::rgmAlbum : MPD::rgmOff));
|
||||||
Statusbar::msg("Replay gain mode: %s", Mpd.GetReplayGainMode().c_str());
|
Statusbar::printf("Replay gain mode: %1%", Mpd.GetReplayGainMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleSpaceMode::run()
|
void ToggleSpaceMode::run()
|
||||||
{
|
{
|
||||||
Config.space_selects = !Config.space_selects;
|
Config.space_selects = !Config.space_selects;
|
||||||
Statusbar::msg("Space mode: %s item", Config.space_selects ? "Select" : "Add");
|
Statusbar::printf("Space mode: %1% item", Config.space_selects ? "Select" : "Add");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleAddMode::run()
|
void ToggleAddMode::run()
|
||||||
{
|
{
|
||||||
Config.ncmpc_like_songs_adding = !Config.ncmpc_like_songs_adding;
|
Config.ncmpc_like_songs_adding = !Config.ncmpc_like_songs_adding;
|
||||||
Statusbar::msg("Add mode: %s", Config.ncmpc_like_songs_adding ? "Add item to playlist, remove if already added" : "Always add item to playlist");
|
Statusbar::printf("Add mode: %1%",
|
||||||
|
Config.ncmpc_like_songs_adding ? "Add item to playlist or remove if already added" : "Always add item to playlist"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleMouse::run()
|
void ToggleMouse::run()
|
||||||
{
|
{
|
||||||
Config.mouse_support = !Config.mouse_support;
|
Config.mouse_support = !Config.mouse_support;
|
||||||
mousemask(Config.mouse_support ? ALL_MOUSE_EVENTS : 0, 0);
|
mousemask(Config.mouse_support ? ALL_MOUSE_EVENTS : 0, 0);
|
||||||
Statusbar::msg("Mouse support %s", Config.mouse_support ? "enabled" : "disabled");
|
Statusbar::printf("Mouse support %1%",
|
||||||
|
Config.mouse_support ? "enabled" : "disabled"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleBitrateVisibility::run()
|
void ToggleBitrateVisibility::run()
|
||||||
{
|
{
|
||||||
Config.display_bitrate = !Config.display_bitrate;
|
Config.display_bitrate = !Config.display_bitrate;
|
||||||
Statusbar::msg("Bitrate visibility %s", Config.display_bitrate ? "enabled" : "disabled");
|
Statusbar::printf("Bitrate visibility %1%",
|
||||||
|
Config.display_bitrate ? "enabled" : "disabled"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddRandomItems::run()
|
void AddRandomItems::run()
|
||||||
@@ -1963,7 +1989,11 @@ void AddRandomItems::run()
|
|||||||
Statusbar::unlock();
|
Statusbar::unlock();
|
||||||
size_t number = fromString<size_t>(strnum);
|
size_t number = fromString<size_t>(strnum);
|
||||||
if (number && (answer == 's' ? Mpd.AddRandomSongs(number) : Mpd.AddRandomTag(tag_type, number)))
|
if (number && (answer == 's' ? Mpd.AddRandomSongs(number) : Mpd.AddRandomTag(tag_type, number)))
|
||||||
Statusbar::msg("%zu random %s%s added to playlist", number, tag_type_str.c_str(), number == 1 ? "" : "s");
|
{
|
||||||
|
Statusbar::printf("%1% random %2%%3% added to playlist",
|
||||||
|
number, tag_type_str, number == 1 ? "" : "s"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ToggleBrowserSortMode::canBeRun() const
|
bool ToggleBrowserSortMode::canBeRun() const
|
||||||
@@ -1977,15 +2007,15 @@ void ToggleBrowserSortMode::run()
|
|||||||
{
|
{
|
||||||
case smName:
|
case smName:
|
||||||
Config.browser_sort_mode = smMTime;
|
Config.browser_sort_mode = smMTime;
|
||||||
Statusbar::msg("Sort songs by: Modification time");
|
Statusbar::print("Sort songs by: Modification time");
|
||||||
break;
|
break;
|
||||||
case smMTime:
|
case smMTime:
|
||||||
Config.browser_sort_mode = smCustomFormat;
|
Config.browser_sort_mode = smCustomFormat;
|
||||||
Statusbar::msg("Sort songs by: Custom format");
|
Statusbar::print("Sort songs by: Custom format");
|
||||||
break;
|
break;
|
||||||
case smCustomFormat:
|
case smCustomFormat:
|
||||||
Config.browser_sort_mode = smName;
|
Config.browser_sort_mode = smName;
|
||||||
Statusbar::msg("Sort songs by: Name");
|
Statusbar::print("Sort songs by: Name");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
std::sort(myBrowser->main().begin()+(myBrowser->CurrentDir() != "/"), myBrowser->main().end(),
|
std::sort(myBrowser->main().begin()+(myBrowser->CurrentDir() != "/"), myBrowser->main().end(),
|
||||||
@@ -2037,7 +2067,7 @@ void ToggleLibraryTagType::run()
|
|||||||
myLibrary->Tags.clear();
|
myLibrary->Tags.clear();
|
||||||
myLibrary->Tags.display();
|
myLibrary->Tags.display();
|
||||||
}
|
}
|
||||||
Statusbar::msg("Switched to list of %s tag", item_type.c_str());
|
Statusbar::printf("Switched to the list of %1%s", item_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2071,7 +2101,7 @@ bool SetSelectedItemsPriority::canBeRun() const
|
|||||||
{
|
{
|
||||||
if (Mpd.Version() < 17)
|
if (Mpd.Version() < 17)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Priorities are supported in MPD >= 0.17.0");
|
Statusbar::print("Priorities are supported in MPD >= 0.17.0");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return myScreen == myPlaylist && !myPlaylist->main().empty();
|
return myScreen == myPlaylist && !myPlaylist->main().empty();
|
||||||
@@ -2109,7 +2139,7 @@ void FilterPlaylistOnPriorities::run()
|
|||||||
[prio](const NC::Menu<MPD::Song>::Item &s) {
|
[prio](const NC::Menu<MPD::Song>::Item &s) {
|
||||||
return s.value().getPrio() > prio;
|
return s.value().getPrio() > prio;
|
||||||
});
|
});
|
||||||
Statusbar::msg("Playlist filtered (songs with priority higher than %u)", prio);
|
Statusbar::printf("Playlist filtered (songs with priority higher than %1%)", prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowSongInfo::run()
|
void ShowSongInfo::run()
|
||||||
@@ -2548,7 +2578,7 @@ void seek()
|
|||||||
|
|
||||||
if (!myPlaylist->currentSongLength())
|
if (!myPlaylist->currentSongLength())
|
||||||
{
|
{
|
||||||
Statusbar::msg("Unknown item length");
|
Statusbar::print("Unknown item length");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2653,7 +2683,7 @@ void findItem(const Find direction)
|
|||||||
Statusbar::unlock();
|
Statusbar::unlock();
|
||||||
|
|
||||||
if (!findme.empty())
|
if (!findme.empty())
|
||||||
Statusbar::msg("Searching...");
|
Statusbar::print("Searching...");
|
||||||
|
|
||||||
bool success = w->search(findme);
|
bool success = w->search(findme);
|
||||||
|
|
||||||
@@ -2661,9 +2691,9 @@ void findItem(const Find direction)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
Statusbar::msg("Searching finished");
|
Statusbar::print("Searching finished");
|
||||||
else
|
else
|
||||||
Statusbar::msg("Unable to find \"%s\"", findme.c_str());
|
Statusbar::printf("Unable to find \"%1%\"", findme);
|
||||||
|
|
||||||
if (direction == ::Find::Forward)
|
if (direction == ::Find::Forward)
|
||||||
w->nextFound(Config.wrapped_search);
|
w->nextFound(Config.wrapped_search);
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ void Browser::enterPressed()
|
|||||||
MPD::SongList list;
|
MPD::SongList list;
|
||||||
Mpd.GetPlaylistContentNoInfo(item.name, vectorMoveInserter(list));
|
Mpd.GetPlaylistContentNoInfo(item.name, vectorMoveInserter(list));
|
||||||
bool success = addSongsToPlaylist(list.begin(), list.end(), true, -1);
|
bool success = addSongsToPlaylist(list.begin(), list.end(), true, -1);
|
||||||
Statusbar::msg("Playlist \"%s\" loaded%s",
|
Statusbar::printf("Playlist \"%1%\" loaded%2%",
|
||||||
item.name.c_str(), withErrors(success)
|
item.name, withErrors(success)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ void Browser::spacePressed()
|
|||||||
{
|
{
|
||||||
MPD::SongList list;
|
MPD::SongList list;
|
||||||
MPD::ItemList items;
|
MPD::ItemList items;
|
||||||
Statusbar::msg("Scanning directory \"%s\"...", item.name.c_str());
|
Statusbar::printf("Scanning directory \"%1%\"...", item.name);
|
||||||
myBrowser->GetLocalDirectory(items, item.name, 1);
|
myBrowser->GetLocalDirectory(items, item.name, 1);
|
||||||
list.reserve(items.size());
|
list.reserve(items.size());
|
||||||
for (MPD::ItemList::const_iterator it = items.begin(); it != items.end(); ++it)
|
for (MPD::ItemList::const_iterator it = items.begin(); it != items.end(); ++it)
|
||||||
@@ -177,8 +177,8 @@ void Browser::spacePressed()
|
|||||||
Mpd.Add(item.name);
|
Mpd.Add(item.name);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
Statusbar::msg("Directory \"%s\" added%s",
|
Statusbar::printf("Directory \"%1%\" added%2%",
|
||||||
item.name.c_str(), withErrors(success)
|
item.name, withErrors(success)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -190,7 +190,7 @@ void Browser::spacePressed()
|
|||||||
case itPlaylist:
|
case itPlaylist:
|
||||||
{
|
{
|
||||||
Mpd.LoadPlaylist(item.name);
|
Mpd.LoadPlaylist(item.name);
|
||||||
Statusbar::msg("Playlist \"%s\" loaded", item.name.c_str());
|
Statusbar::printf("Playlist \"%1%\" loaded", item.name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,8 +517,8 @@ void Browser::ClearDirectory(const std::string &path) const
|
|||||||
std::for_each(fs::directory_iterator(dir), fs::directory_iterator(), [&](fs::directory_entry &e) {
|
std::for_each(fs::directory_iterator(dir), fs::directory_iterator(), [&](fs::directory_entry &e) {
|
||||||
if (!fs::is_symlink(e) && fs::is_directory(e))
|
if (!fs::is_symlink(e) && fs::is_directory(e))
|
||||||
ClearDirectory(e.path().native());
|
ClearDirectory(e.path().native());
|
||||||
const char msg[] = "Deleting \"%ls\"...";
|
const char msg[] = "Deleting \"%1%\"...";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(e.path().native()), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(e.path().native(), COLS-const_strlen(msg)));
|
||||||
fs::remove(e.path());
|
fs::remove(e.path());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -527,12 +527,14 @@ void Browser::ChangeBrowseMode()
|
|||||||
{
|
{
|
||||||
if (Mpd.GetHostname()[0] != '/')
|
if (Mpd.GetHostname()[0] != '/')
|
||||||
{
|
{
|
||||||
Statusbar::msg("For browsing local filesystem connection to MPD via UNIX Socket is required");
|
Statusbar::print("For browsing local filesystem connection to MPD via UNIX Socket is required");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
itsBrowseLocally = !itsBrowseLocally;
|
itsBrowseLocally = !itsBrowseLocally;
|
||||||
Statusbar::msg("Browse mode: %s", itsBrowseLocally ? "Local filesystem" : "MPD database");
|
Statusbar::printf("Browse mode: %1%",
|
||||||
|
itsBrowseLocally ? "Local filesystem" : "MPD database"
|
||||||
|
);
|
||||||
itsBrowsedDir = itsBrowseLocally ? Config.GetHomeDirectory() : "/";
|
itsBrowsedDir = itsBrowseLocally ? Config.GetHomeDirectory() : "/";
|
||||||
if (itsBrowseLocally && *itsBrowsedDir.rbegin() == '/')
|
if (itsBrowseLocally && *itsBrowsedDir.rbegin() == '/')
|
||||||
itsBrowsedDir.resize(itsBrowsedDir.length()-1);
|
itsBrowsedDir.resize(itsBrowsedDir.length()-1);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void Clock::switchTo()
|
|||||||
size_t x_offset, width;
|
size_t x_offset, width;
|
||||||
getWindowResizeParams(x_offset, width, false);
|
getWindowResizeParams(x_offset, width, false);
|
||||||
if (Width > width || Height > MainHeight)
|
if (Width > width || Height > MainHeight)
|
||||||
Statusbar::msg("Screen is too small to display clock");
|
Statusbar::print("Screen is too small to display clock");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SwitchTo::execute(this);
|
SwitchTo::execute(this);
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ bool addSongToPlaylist(const MPD::Song &s, bool play, int position)
|
|||||||
int id = Mpd.AddSong(s, position);
|
int id = Mpd.AddSong(s, position);
|
||||||
if (id >= 0)
|
if (id >= 0)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Added to playlist: %s",
|
Statusbar::printf("Added to playlist: %s",
|
||||||
s.toString(Config.song_status_format_no_colors, Config.tags_separator).c_str()
|
s.toString(Config.song_status_format_no_colors, Config.tags_separator)
|
||||||
);
|
);
|
||||||
if (play)
|
if (play)
|
||||||
Mpd.PlayID(id);
|
Mpd.PlayID(id);
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ void Lyrics::switchTo()
|
|||||||
|
|
||||||
if (isDownloadInProgress || itsWorkersNumber > 0)
|
if (isDownloadInProgress || itsWorkersNumber > 0)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Lyrics are being downloaded...");
|
Statusbar::print("Lyrics are being downloaded...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
# endif // HAVE_CURL_CURL_H
|
# endif // HAVE_CURL_CURL_H
|
||||||
@@ -124,7 +124,7 @@ void Lyrics::switchTo()
|
|||||||
drawHeader();
|
drawHeader();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("Song must have both artist and title tag set");
|
Statusbar::print("Song must have both artist and title tag set");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
switchToPreviousScreen();
|
switchToPreviousScreen();
|
||||||
@@ -140,7 +140,9 @@ std::wstring Lyrics::title()
|
|||||||
void Lyrics::spacePressed()
|
void Lyrics::spacePressed()
|
||||||
{
|
{
|
||||||
Config.now_playing_lyrics = !Config.now_playing_lyrics;
|
Config.now_playing_lyrics = !Config.now_playing_lyrics;
|
||||||
Statusbar::msg("Reload lyrics if song changes: %s", Config.now_playing_lyrics ? "On" : "Off");
|
Statusbar::printf("Reload lyrics if song changes: %1%",
|
||||||
|
Config.now_playing_lyrics ? "On" : "Off"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CURL_CURL_H
|
#ifdef HAVE_CURL_CURL_H
|
||||||
@@ -156,7 +158,9 @@ void Lyrics::DownloadInBackground(const MPD::Song &s)
|
|||||||
f.close();
|
f.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Statusbar::msg("Fetching lyrics for \"%s\"...", s.toString(Config.song_status_format_no_colors, Config.tags_separator).c_str());
|
Statusbar::printf("Fetching lyrics for \"%1%\"...",
|
||||||
|
s.toString(Config.song_status_format_no_colors, Config.tags_separator)
|
||||||
|
);
|
||||||
|
|
||||||
MPD::Song *s_copy = new MPD::Song(s);
|
MPD::Song *s_copy = new MPD::Song(s);
|
||||||
pthread_mutex_lock(&itsDIBLock);
|
pthread_mutex_lock(&itsDIBLock);
|
||||||
@@ -349,11 +353,11 @@ void Lyrics::Edit()
|
|||||||
|
|
||||||
if (Config.external_editor.empty())
|
if (Config.external_editor.empty())
|
||||||
{
|
{
|
||||||
Statusbar::msg("Proper external_editor variable has to be set in configuration file");
|
Statusbar::print("Proper external_editor variable has to be set in configuration file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Statusbar::msg("Opening lyrics in external editor...");
|
Statusbar::print("Opening lyrics in external editor...");
|
||||||
|
|
||||||
GNUC_UNUSED int res;
|
GNUC_UNUSED int res;
|
||||||
if (Config.use_console_editor)
|
if (Config.use_console_editor)
|
||||||
@@ -385,8 +389,8 @@ void Lyrics::Refetch()
|
|||||||
{
|
{
|
||||||
if (remove(itsFilename.c_str()) && errno != ENOENT)
|
if (remove(itsFilename.c_str()) && errno != ENOENT)
|
||||||
{
|
{
|
||||||
const char msg[] = "Couldn't remove \"%ls\": %s";
|
const char msg[] = "Couldn't remove \"%1%\": %2%";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(itsFilename), COLS-const_strlen(msg)-25).c_str(), strerror(errno));
|
Statusbar::printf(msg, wideShorten(itsFilename, COLS-const_strlen(msg)-25), strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Load();
|
Load();
|
||||||
@@ -399,9 +403,9 @@ void Lyrics::ToggleFetcher()
|
|||||||
else
|
else
|
||||||
itsFetcher = &lyricsPlugins[0];
|
itsFetcher = &lyricsPlugins[0];
|
||||||
if (*itsFetcher)
|
if (*itsFetcher)
|
||||||
Statusbar::msg("Using lyrics database: %s", (*itsFetcher)->name());
|
Statusbar::printf("Using lyrics database: %s", (*itsFetcher)->name());
|
||||||
else
|
else
|
||||||
Statusbar::msg("Using all lyrics databases");
|
Statusbar::print("Using all lyrics databases");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lyrics::Take()
|
void Lyrics::Take()
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ LyricsFetcher::Result LyricsFetcher::fetch(const std::string &artist, const std:
|
|||||||
result.first = false;
|
result.first = false;
|
||||||
|
|
||||||
std::string url = urlTemplate();
|
std::string url = urlTemplate();
|
||||||
boost::replace_all(url, "%artist%", artist.c_str());
|
boost::replace_all(url, "%artist%", artist);
|
||||||
boost::replace_all(url, "%title%", title.c_str());
|
boost::replace_all(url, "%title%", title);
|
||||||
|
|
||||||
std::string data;
|
std::string data;
|
||||||
CURLcode code = Curl::perform(data, url);
|
CURLcode code = Curl::perform(data, url);
|
||||||
|
|||||||
@@ -884,7 +884,7 @@ ProxySongList MediaLibrary::songsProxyList()
|
|||||||
void MediaLibrary::toggleSortMode()
|
void MediaLibrary::toggleSortMode()
|
||||||
{
|
{
|
||||||
Config.media_library_sort_by_mtime = !Config.media_library_sort_by_mtime;
|
Config.media_library_sort_by_mtime = !Config.media_library_sort_by_mtime;
|
||||||
Statusbar::msg("Sorting library by: %s",
|
Statusbar::printf("Sorting library by: %1%",
|
||||||
Config.media_library_sort_by_mtime ? "Modification time" : "Name");
|
Config.media_library_sort_by_mtime ? "Modification time" : "Name");
|
||||||
if (hasTwoColumns)
|
if (hasTwoColumns)
|
||||||
{
|
{
|
||||||
@@ -916,7 +916,7 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
|
|||||||
{
|
{
|
||||||
std::string item_type = boost::locale::to_lower(
|
std::string item_type = boost::locale::to_lower(
|
||||||
tagTypeToString(Config.media_lib_primary_tag));
|
tagTypeToString(Config.media_lib_primary_tag));
|
||||||
Statusbar::msg("Can't use this function because the song has no %s tag set", item_type.c_str());
|
Statusbar::printf("Can't use this function because the song has no %s tag set", item_type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,8 +1007,8 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
|
|||||||
bool success = addSongsToPlaylist(list.begin(), list.end(), add_n_play, -1);
|
bool success = addSongsToPlaylist(list.begin(), list.end(), add_n_play, -1);
|
||||||
std::string tag_type = boost::locale::to_lower(
|
std::string tag_type = boost::locale::to_lower(
|
||||||
tagTypeToString(Config.media_lib_primary_tag));
|
tagTypeToString(Config.media_lib_primary_tag));
|
||||||
Statusbar::msg("Songs with %s = \"%s\" added%s",
|
Statusbar::printf("Songs with %1% \"%2%\" added%3%",
|
||||||
tag_type.c_str(), Tags.current().value().tag().c_str(), withErrors(success)
|
tag_type, Tags.current().value().tag(), withErrors(success)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (isActiveWindow(Albums))
|
else if (isActiveWindow(Albums))
|
||||||
@@ -1017,8 +1017,8 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
|
|||||||
withUnfilteredMenu(Songs, [&]() {
|
withUnfilteredMenu(Songs, [&]() {
|
||||||
success = addSongsToPlaylist(Songs.beginV(), Songs.endV(), add_n_play, -1);
|
success = addSongsToPlaylist(Songs.beginV(), Songs.endV(), add_n_play, -1);
|
||||||
});
|
});
|
||||||
Statusbar::msg("Songs from album \"%s\" added%s",
|
Statusbar::printf("Songs from album \"%1%\" added%2%",
|
||||||
Albums.current().value().entry().album().c_str(), withErrors(success)
|
Albums.current().value().entry().album(), withErrors(success)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if (sig == SIGPIPE)
|
if (sig == SIGPIPE)
|
||||||
{
|
{
|
||||||
Statusbar::msg("SIGPIPE (broken pipe signal) received");
|
Statusbar::print("SIGPIPE (broken pipe signal) received");
|
||||||
}
|
}
|
||||||
else if (sig == SIGWINCH)
|
else if (sig == SIGWINCH)
|
||||||
{
|
{
|
||||||
@@ -220,7 +220,7 @@ int main(int argc, char **argv)
|
|||||||
myVisualizer->FindOutputID();
|
myVisualizer->FindOutputID();
|
||||||
# endif // ENABLE_VISUALIZER
|
# endif // ENABLE_VISUALIZER
|
||||||
|
|
||||||
Statusbar::msg("Connected to %s", Mpd.GetHostname().c_str());
|
Statusbar::printf("Connected to \"%1%\"", Mpd.GetHostname());
|
||||||
}
|
}
|
||||||
catch (MPD::ClientError &e)
|
catch (MPD::ClientError &e)
|
||||||
{
|
{
|
||||||
@@ -260,11 +260,11 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
catch (ConversionError &e)
|
catch (ConversionError &e)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Couldn't convert value '%s' to target type", e.value().c_str());
|
Statusbar::printf("Couldn't convert value \"%1%\" to target type", e.value());
|
||||||
}
|
}
|
||||||
catch (OutOfBounds &e)
|
catch (OutOfBounds &e)
|
||||||
{
|
{
|
||||||
Statusbar::msg("%s", e.errorMessage().c_str());
|
Statusbar::print(e.errorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myScreen == myPlaylist)
|
if (myScreen == myPlaylist)
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ void Outputs::enterPressed()
|
|||||||
if (w.current().value().isEnabled())
|
if (w.current().value().isEnabled())
|
||||||
{
|
{
|
||||||
Mpd.DisableOutput(w.choice());
|
Mpd.DisableOutput(w.choice());
|
||||||
Statusbar::msg("Output \"%s\" disabled", w.current().value().name().c_str());
|
Statusbar::printf("Output \"%s\" disabled", w.current().value().name());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mpd.EnableOutput(w.choice());
|
Mpd.EnableOutput(w.choice());
|
||||||
Statusbar::msg("Output \"%s\" enabled", w.current().value().name().c_str());
|
Statusbar::printf("Output \"%s\" enabled", w.current().value().name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ bool Playlist::isFiltered()
|
|||||||
{
|
{
|
||||||
if (w.isFiltered())
|
if (w.isFiltered())
|
||||||
{
|
{
|
||||||
Statusbar::msg("Function currently unavailable due to filtered playlist");
|
Statusbar::print("Function currently unavailable due to filtered playlist");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -247,14 +247,14 @@ bool Playlist::isFiltered()
|
|||||||
|
|
||||||
void Playlist::Reverse()
|
void Playlist::Reverse()
|
||||||
{
|
{
|
||||||
Statusbar::msg("Reversing playlist order...");
|
Statusbar::print("Reversing playlist order...");
|
||||||
auto begin = w.begin(), end = w.end();
|
auto begin = w.begin(), end = w.end();
|
||||||
std::tie(begin, end) = getSelectedRange(begin, end);
|
std::tie(begin, end) = getSelectedRange(begin, end);
|
||||||
Mpd.StartCommandsList();
|
Mpd.StartCommandsList();
|
||||||
for (--end; begin < end; ++begin, --end)
|
for (--end; begin < end; ++begin, --end)
|
||||||
Mpd.Swap(begin->value().getPosition(), end->value().getPosition());
|
Mpd.Swap(begin->value().getPosition(), end->value().getPosition());
|
||||||
Mpd.CommitCommandsList();
|
Mpd.CommitCommandsList();
|
||||||
Statusbar::msg("Playlist reversed");
|
Statusbar::print("Playlist reversed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::EnableHighlighting()
|
void Playlist::EnableHighlighting()
|
||||||
@@ -319,7 +319,7 @@ void Playlist::SetSelectedItemsPriority(int prio)
|
|||||||
for (auto it = list.begin(); it != list.end(); ++it)
|
for (auto it = list.begin(); it != list.end(); ++it)
|
||||||
Mpd.SetPriority((*it)->value(), prio);
|
Mpd.SetPriority((*it)->value(), prio);
|
||||||
Mpd.CommitCommandsList();
|
Mpd.CommitCommandsList();
|
||||||
Statusbar::msg("Priority set");
|
Statusbar::print("Priority set");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::setStatus(MPD::Status status)
|
void Playlist::setStatus(MPD::Status status)
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ bool PlaylistEditor::isContentFiltered()
|
|||||||
{
|
{
|
||||||
if (Content.isFiltered())
|
if (Content.isFiltered())
|
||||||
{
|
{
|
||||||
Statusbar::msg("Function currently unavailable due to filtered playlist content");
|
Statusbar::print("Function currently unavailable due to filtered playlist content");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -224,8 +224,8 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
|
|||||||
withUnfilteredMenu(Content, [&]() {
|
withUnfilteredMenu(Content, [&]() {
|
||||||
success = addSongsToPlaylist(Content.beginV(), Content.endV(), add_n_play, -1);
|
success = addSongsToPlaylist(Content.beginV(), Content.endV(), add_n_play, -1);
|
||||||
});
|
});
|
||||||
Statusbar::msg("Playlist \"%s\" loaded%s",
|
Statusbar::printf("Playlist \"%1%\" loaded%2%",
|
||||||
Playlists.current().value().c_str(), withErrors(success)
|
Playlists.current().value(), withErrors(success)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (isActiveWindow(Content) && !Content.empty())
|
else if (isActiveWindow(Content) && !Content.empty())
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ void SearchEngine::enterPressed()
|
|||||||
else if (option == SearchButton)
|
else if (option == SearchButton)
|
||||||
{
|
{
|
||||||
w.showAll();
|
w.showAll();
|
||||||
Statusbar::msg("Searching...");
|
Statusbar::print("Searching...");
|
||||||
if (w.size() > StaticOptions)
|
if (w.size() > StaticOptions)
|
||||||
Prepare();
|
Prepare();
|
||||||
Search();
|
Search();
|
||||||
@@ -184,7 +184,7 @@ void SearchEngine::enterPressed()
|
|||||||
w.at(ResetButton+2).value().mkBuffer() << Config.color1 << "Search results: " << Config.color2 << "Found " << found << (found > 1 ? " songs" : " song") << NC::Color::Default;
|
w.at(ResetButton+2).value().mkBuffer() << Config.color1 << "Search results: " << Config.color2 << "Found " << found << (found > 1 ? " songs" : " song") << NC::Color::Default;
|
||||||
w.insertSeparator(ResetButton+3);
|
w.insertSeparator(ResetButton+3);
|
||||||
markSongsInPlaylist(proxySongList());
|
markSongsInPlaylist(proxySongList());
|
||||||
Statusbar::msg("Searching finished");
|
Statusbar::print("Searching finished");
|
||||||
if (Config.block_search_constraints_change)
|
if (Config.block_search_constraints_change)
|
||||||
for (size_t i = 0; i < StaticOptions-4; ++i)
|
for (size_t i = 0; i < StaticOptions-4; ++i)
|
||||||
w.at(i).setInactive(true);
|
w.at(i).setInactive(true);
|
||||||
@@ -192,7 +192,7 @@ void SearchEngine::enterPressed()
|
|||||||
w.scroll(NC::Scroll::Down);
|
w.scroll(NC::Scroll::Down);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("No results found");
|
Statusbar::print("No results found");
|
||||||
}
|
}
|
||||||
else if (option == ResetButton)
|
else if (option == ResetButton)
|
||||||
{
|
{
|
||||||
@@ -391,7 +391,7 @@ void SearchEngine::reset()
|
|||||||
itsConstraints[i].clear();
|
itsConstraints[i].clear();
|
||||||
w.reset();
|
w.reset();
|
||||||
Prepare();
|
Prepare();
|
||||||
Statusbar::msg("Search state reset");
|
Statusbar::print("Search state reset");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchEngine::Search()
|
void SearchEngine::Search()
|
||||||
|
|||||||
@@ -109,11 +109,11 @@ void SelectedItemsAdder::switchTo()
|
|||||||
if (!hs || !hs->allowsSelection())
|
if (!hs || !hs->allowsSelection())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Statusbar::msg(1, "Fetching selected songs...");
|
Statusbar::print(1, "Fetching selected songs...");
|
||||||
m_selected_items = hs->getSelectedSongs();
|
m_selected_items = hs->getSelectedSongs();
|
||||||
if (m_selected_items.empty())
|
if (m_selected_items.empty())
|
||||||
{
|
{
|
||||||
Statusbar::msg("List of selected items is empty");
|
Statusbar::print("List of selected items is empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
populatePlaylistSelector(myScreen);
|
populatePlaylistSelector(myScreen);
|
||||||
@@ -236,7 +236,7 @@ void SelectedItemsAdder::addToExistingPlaylist(const std::string &playlist) cons
|
|||||||
for (auto s = m_selected_items.begin(); s != m_selected_items.end(); ++s)
|
for (auto s = m_selected_items.begin(); s != m_selected_items.end(); ++s)
|
||||||
Mpd.AddToPlaylist(playlist, *s);
|
Mpd.AddToPlaylist(playlist, *s);
|
||||||
Mpd.CommitCommandsList();
|
Mpd.CommitCommandsList();
|
||||||
Statusbar::msg("Selected item(s) added to playlist \"%s\"", playlist.c_str());
|
Statusbar::printf("Selected item(s) added to playlist \"%1%\"", playlist);
|
||||||
switchToPreviousScreen();
|
switchToPreviousScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ void SelectedItemsAdder::cancel()
|
|||||||
|
|
||||||
void SelectedItemsAdder::exitSuccessfully(bool success) const
|
void SelectedItemsAdder::exitSuccessfully(bool success) const
|
||||||
{
|
{
|
||||||
Statusbar::msg("Selected items added%s", withErrors(success));
|
Statusbar::printf("Selected items added%1%", withErrors(success));
|
||||||
switchToPreviousScreen();
|
switchToPreviousScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ void SortPlaylistDialog::moveSortOrderUp()
|
|||||||
|
|
||||||
void SortPlaylistDialog::moveSortOrderHint() const
|
void SortPlaylistDialog::moveSortOrderHint() const
|
||||||
{
|
{
|
||||||
Statusbar::msg("Move tag types up and down to adjust sort order");
|
Statusbar::print("Move tag types up and down to adjust sort order");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SortPlaylistDialog::sort() const
|
void SortPlaylistDialog::sort() const
|
||||||
@@ -200,11 +200,11 @@ void SortPlaylistDialog::sort() const
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Statusbar::msg("Sorting...");
|
Statusbar::print("Sorting...");
|
||||||
Mpd.StartCommandsList();
|
Mpd.StartCommandsList();
|
||||||
quick_sort(playlist.begin(), playlist.end());
|
quick_sort(playlist.begin(), playlist.end());
|
||||||
Mpd.CommitCommandsList();
|
Mpd.CommitCommandsList();
|
||||||
Statusbar::msg("Playlist sorted");
|
Statusbar::print("Playlist sorted");
|
||||||
switchToPreviousScreen();
|
switchToPreviousScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ void Status::handleClientError(MPD::ClientError &e)
|
|||||||
{
|
{
|
||||||
if (!e.clearable())
|
if (!e.clearable())
|
||||||
Mpd.Disconnect();
|
Mpd.Disconnect();
|
||||||
Statusbar::msg("NCMPCPP: %s", e.what());
|
Statusbar::printf("ncmpcpp: %1%", e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Status::handleServerError(MPD::ServerError &e)
|
void Status::handleServerError(MPD::ServerError &e)
|
||||||
@@ -120,7 +120,7 @@ void Status::handleServerError(MPD::ServerError &e)
|
|||||||
Statusbar::put() << "Password: ";
|
Statusbar::put() << "Password: ";
|
||||||
Mpd.SetPassword(wFooter->getString(0, true));
|
Mpd.SetPassword(wFooter->getString(0, true));
|
||||||
Mpd.SendPassword();
|
Mpd.SendPassword();
|
||||||
Statusbar::msg("Password accepted");
|
Statusbar::print("Password accepted");
|
||||||
wFooter->setGetStringHelper(Statusbar::Helpers::getString);
|
wFooter->setGetStringHelper(Statusbar::Helpers::getString);
|
||||||
}
|
}
|
||||||
else if (e.code() == MPD_SERVER_ERROR_NO_EXIST && myScreen == myBrowser)
|
else if (e.code() == MPD_SERVER_ERROR_NO_EXIST && myScreen == myBrowser)
|
||||||
@@ -128,7 +128,7 @@ void Status::handleServerError(MPD::ServerError &e)
|
|||||||
myBrowser->GetDirectory(getParentDirectory(myBrowser->CurrentDir()));
|
myBrowser->GetDirectory(getParentDirectory(myBrowser->CurrentDir()));
|
||||||
myBrowser->refresh();
|
myBrowser->refresh();
|
||||||
}
|
}
|
||||||
Statusbar::msg("MPD: %s", e.what());
|
Statusbar::printf("MPD: %1%", e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
@@ -527,28 +527,28 @@ void Status::Changes::repeat(bool show_msg)
|
|||||||
{
|
{
|
||||||
m_repeat = m_status.repeat() ? 'r' : 0;
|
m_repeat = m_status.repeat() ? 'r' : 0;
|
||||||
if (show_msg)
|
if (show_msg)
|
||||||
Statusbar::msg("Repeat mode is %s", !m_repeat ? "off" : "on");
|
Statusbar::printf("Repeat mode is %1%", !m_repeat ? "off" : "on");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Status::Changes::random(bool show_msg)
|
void Status::Changes::random(bool show_msg)
|
||||||
{
|
{
|
||||||
m_random = m_status.random() ? 'z' : 0;
|
m_random = m_status.random() ? 'z' : 0;
|
||||||
if (show_msg)
|
if (show_msg)
|
||||||
Statusbar::msg("Random mode is %s", !m_random ? "off" : "on");
|
Statusbar::printf("Random mode is %1%", !m_random ? "off" : "on");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Status::Changes::single(bool show_msg)
|
void Status::Changes::single(bool show_msg)
|
||||||
{
|
{
|
||||||
m_single = m_status.single() ? 's' : 0;
|
m_single = m_status.single() ? 's' : 0;
|
||||||
if (show_msg)
|
if (show_msg)
|
||||||
Statusbar::msg("Single mode is %s", !m_single ? "off" : "on");
|
Statusbar::printf("Single mode is %1%", !m_single ? "off" : "on");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Status::Changes::consume(bool show_msg)
|
void Status::Changes::consume(bool show_msg)
|
||||||
{
|
{
|
||||||
m_consume = m_status.consume() ? 'c' : 0;
|
m_consume = m_status.consume() ? 'c' : 0;
|
||||||
if (show_msg)
|
if (show_msg)
|
||||||
Statusbar::msg("Consume mode is %s", !m_consume ? "off" : "on");
|
Statusbar::printf("Consume mode is %1%", !m_consume ? "off" : "on");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Status::Changes::crossfade(bool show_msg)
|
void Status::Changes::crossfade(bool show_msg)
|
||||||
@@ -556,14 +556,14 @@ void Status::Changes::crossfade(bool show_msg)
|
|||||||
int crossfade = m_status.crossfade();
|
int crossfade = m_status.crossfade();
|
||||||
m_crossfade = crossfade ? 'x' : 0;
|
m_crossfade = crossfade ? 'x' : 0;
|
||||||
if (show_msg)
|
if (show_msg)
|
||||||
Statusbar::msg("Crossfade set to %d seconds", crossfade);
|
Statusbar::printf("Crossfade set to %1% seconds", crossfade);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Status::Changes::dbUpdateState(bool show_msg)
|
void Status::Changes::dbUpdateState(bool show_msg)
|
||||||
{
|
{
|
||||||
m_db_updating = m_status.updateID() ? 'U' : 0;
|
m_db_updating = m_status.updateID() ? 'U' : 0;
|
||||||
if (show_msg)
|
if (show_msg)
|
||||||
Statusbar::msg("Database update %s", m_status.updateID() ? "started" : "finished");
|
Statusbar::printf("Database update %1%", m_status.updateID() ? "started" : "finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Status::Changes::flags()
|
void Status::Changes::flags()
|
||||||
|
|||||||
@@ -37,25 +37,6 @@ bool statusbarBlockUpdate = false;
|
|||||||
bool progressbarBlockUpdate = false;
|
bool progressbarBlockUpdate = false;
|
||||||
bool statusbarAllowUnlock = true;
|
bool statusbarAllowUnlock = true;
|
||||||
|
|
||||||
void showMessage(int time, const char *format, va_list list)
|
|
||||||
{
|
|
||||||
if (statusbarAllowUnlock)
|
|
||||||
{
|
|
||||||
statusbarLockTime = Global::Timer;
|
|
||||||
statusbarLockDelay = time;
|
|
||||||
if (Config.statusbar_visibility)
|
|
||||||
statusbarBlockUpdate = true;
|
|
||||||
else
|
|
||||||
progressbarBlockUpdate = true;
|
|
||||||
wFooter->goToXY(0, Config.statusbar_visibility);
|
|
||||||
*wFooter << NC::Format::NoBold;
|
|
||||||
wmove(wFooter->raw(), Config.statusbar_visibility, 0);
|
|
||||||
vw_printw(wFooter->raw(), format, list);
|
|
||||||
wclrtoeol(wFooter->raw());
|
|
||||||
wFooter->refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Progressbar::lock()
|
void Progressbar::lock()
|
||||||
@@ -168,20 +149,20 @@ NC::Window &Statusbar::put()
|
|||||||
return *wFooter;
|
return *wFooter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Statusbar::msg(const char *format, ...)
|
void Statusbar::print(int time, const std::string &message)
|
||||||
{
|
{
|
||||||
va_list list;
|
if (statusbarAllowUnlock)
|
||||||
va_start(list, format);
|
{
|
||||||
showMessage(Config.message_delay_time, format, list);
|
statusbarLockTime = Global::Timer;
|
||||||
va_end(list);
|
statusbarLockDelay = time;
|
||||||
}
|
if (Config.statusbar_visibility)
|
||||||
|
statusbarBlockUpdate = true;
|
||||||
void Statusbar::msg(int time, const char *format, ...)
|
else
|
||||||
{
|
progressbarBlockUpdate = true;
|
||||||
va_list list;
|
wFooter->goToXY(0, Config.statusbar_visibility);
|
||||||
va_start(list, format);
|
*wFooter << message << wclrtoeol;
|
||||||
showMessage(time, format, list);
|
wFooter->refresh();
|
||||||
va_end(list);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Statusbar::Helpers::mpd()
|
void Statusbar::Helpers::mpd()
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#ifndef NCMPCPP_STATUSBAR_H
|
#ifndef NCMPCPP_STATUSBAR_H
|
||||||
#define NCMPCPP_STATUSBAR_H
|
#define NCMPCPP_STATUSBAR_H
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
#include "settings.h"
|
||||||
#include "gcc.h"
|
#include "gcc.h"
|
||||||
#include "interfaces.h"
|
#include "interfaces.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
@@ -52,19 +54,13 @@ void unlock();
|
|||||||
/// @return true if statusbar is unlocked
|
/// @return true if statusbar is unlocked
|
||||||
bool isUnlocked();
|
bool isUnlocked();
|
||||||
|
|
||||||
/// tries to clear current message put there using Statusbar::msg if there is any
|
/// tries to clear current message put there using Statusbar::printf if there is any
|
||||||
void tryRedraw();
|
void tryRedraw();
|
||||||
|
|
||||||
/// clears statusbar and move cursor to beginning of line
|
/// clears statusbar and move cursor to beginning of line
|
||||||
/// @return window object that represents statusbar
|
/// @return window object that represents statusbar
|
||||||
NC::Window &put();
|
NC::Window &put();
|
||||||
|
|
||||||
/// displays message in statusbar for period of time set in configuration file
|
|
||||||
void msg(const char *format, ...) GNUC_PRINTF(1, 2);
|
|
||||||
|
|
||||||
/// displays message in statusbar for given period of time
|
|
||||||
void msg(int time, const char *format, ...) GNUC_PRINTF(2, 3);
|
|
||||||
|
|
||||||
namespace Helpers {//
|
namespace Helpers {//
|
||||||
|
|
||||||
/// called when statusbar window detects incoming idle notification
|
/// called when statusbar window detects incoming idle notification
|
||||||
@@ -97,6 +93,43 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// displays message in statusbar for a given period of time
|
||||||
|
void print(int time, const std::string &message);
|
||||||
|
|
||||||
|
/// displays message in statusbar for period of time set in configuration file
|
||||||
|
inline void print(const std::string &message)
|
||||||
|
{
|
||||||
|
print(Config.message_delay_time, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// displays formatted message in statusbar for period of time set in configuration file
|
||||||
|
template <typename FormatT>
|
||||||
|
void printf(FormatT &&fmt)
|
||||||
|
{
|
||||||
|
print(Config.message_delay_time, boost::format(std::forward<FormatT>(fmt)).str());
|
||||||
|
}
|
||||||
|
template <typename FormatT, typename ArgT, typename... Args>
|
||||||
|
void printf(FormatT &&fmt, ArgT &&arg, Args&&... args)
|
||||||
|
{
|
||||||
|
printf(boost::format(std::forward<FormatT>(fmt)) % std::forward<ArgT>(arg),
|
||||||
|
std::forward<Args>(args)...
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// displays formatted message in statusbar for a given period of time
|
||||||
|
template <typename FormatT>
|
||||||
|
void printf(int time, FormatT &&fmt)
|
||||||
|
{
|
||||||
|
print(time, boost::format(std::forward<FormatT>(fmt)).str());
|
||||||
|
}
|
||||||
|
template <typename FormatT, typename ArgT, typename... Args>
|
||||||
|
void printf(int time, FormatT &&fmt, ArgT &&arg, Args&&... args)
|
||||||
|
{
|
||||||
|
printf(time, boost::format(std::forward<FormatT>(fmt)) % std::forward<ArgT>(arg),
|
||||||
|
std::forward<Args>(args)...
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // NCMPCPP_STATUSBAR_H
|
#endif // NCMPCPP_STATUSBAR_H
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ void TagEditor::enterPressed()
|
|||||||
Dirs->reset();
|
Dirs->reset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("No subdirectories found");
|
Statusbar::print("No subdirectories found");
|
||||||
}
|
}
|
||||||
else if (w == FParserDialog)
|
else if (w == FParserDialog)
|
||||||
{
|
{
|
||||||
@@ -370,7 +370,7 @@ void TagEditor::enterPressed()
|
|||||||
else if (pos == 1 || pos == 4) // preview or proceed
|
else if (pos == 1 || pos == 4) // preview or proceed
|
||||||
{
|
{
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
Statusbar::msg("Parsing...");
|
Statusbar::print("Parsing...");
|
||||||
FParserPreview->clear();
|
FParserPreview->clear();
|
||||||
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
||||||
{
|
{
|
||||||
@@ -393,7 +393,7 @@ void TagEditor::enterPressed()
|
|||||||
std::string new_file = GenerateFilename(s, "{" + Config.pattern + "}");
|
std::string new_file = GenerateFilename(s, "{" + Config.pattern + "}");
|
||||||
if (new_file.empty() && !FParserUsePreview)
|
if (new_file.empty() && !FParserUsePreview)
|
||||||
{
|
{
|
||||||
Statusbar::msg("File \"%s\" would have an empty name", s.getName().c_str());
|
Statusbar::printf("File \"%1%\" would have an empty name", s.getName());
|
||||||
FParserUsePreview = 1;
|
FParserUsePreview = 1;
|
||||||
success = 0;
|
success = 0;
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ void TagEditor::enterPressed()
|
|||||||
quit = 1;
|
quit = 1;
|
||||||
}
|
}
|
||||||
if (pos != 4 || success)
|
if (pos != 4 || success)
|
||||||
Statusbar::msg("Operation finished");
|
Statusbar::print("Operation finished");
|
||||||
}
|
}
|
||||||
else if (pos == 2) // show legend
|
else if (pos == 2) // show legend
|
||||||
{
|
{
|
||||||
@@ -480,10 +480,10 @@ void TagEditor::enterPressed()
|
|||||||
else
|
else
|
||||||
(*it)->setTrack(boost::lexical_cast<std::string>(i));
|
(*it)->setTrack(boost::lexical_cast<std::string>(i));
|
||||||
}
|
}
|
||||||
Statusbar::msg("Tracks numbered");
|
Statusbar::print("Tracks numbered");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("Aborted");
|
Statusbar::print("Aborted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,42 +538,42 @@ void TagEditor::enterPressed()
|
|||||||
}
|
}
|
||||||
else if (id == TagTypes->size()-5) // capitalize first letters
|
else if (id == TagTypes->size()-5) // capitalize first letters
|
||||||
{
|
{
|
||||||
Statusbar::msg("Processing...");
|
Statusbar::print("Processing...");
|
||||||
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
||||||
CapitalizeFirstLetters(**it);
|
CapitalizeFirstLetters(**it);
|
||||||
Statusbar::msg("Done");
|
Statusbar::print("Done");
|
||||||
}
|
}
|
||||||
else if (id == TagTypes->size()-4) // lower all letters
|
else if (id == TagTypes->size()-4) // lower all letters
|
||||||
{
|
{
|
||||||
Statusbar::msg("Processing...");
|
Statusbar::print("Processing...");
|
||||||
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
||||||
LowerAllLetters(**it);
|
LowerAllLetters(**it);
|
||||||
Statusbar::msg("Done");
|
Statusbar::print("Done");
|
||||||
}
|
}
|
||||||
else if (id == TagTypes->size()-2) // reset
|
else if (id == TagTypes->size()-2) // reset
|
||||||
{
|
{
|
||||||
for (auto it = Tags->beginV(); it != Tags->endV(); ++it)
|
for (auto it = Tags->beginV(); it != Tags->endV(); ++it)
|
||||||
it->clearModifications();
|
it->clearModifications();
|
||||||
Statusbar::msg("Changes reset");
|
Statusbar::print("Changes reset");
|
||||||
}
|
}
|
||||||
else if (id == TagTypes->size()-1) // save
|
else if (id == TagTypes->size()-1) // save
|
||||||
{
|
{
|
||||||
bool success = 1;
|
bool success = 1;
|
||||||
Statusbar::msg("Writing changes...");
|
Statusbar::print("Writing changes...");
|
||||||
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
for (auto it = EditedSongs.begin(); it != EditedSongs.end(); ++it)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Writing tags in \"%s\"...", (*it)->getName().c_str());
|
Statusbar::printf("Writing tags in \"%1%\"...", (*it)->getName());
|
||||||
if (!Tags::write(**it))
|
if (!Tags::write(**it))
|
||||||
{
|
{
|
||||||
const char msg[] = "Error while writing tags in \"%ls\"";
|
const char msg[] = "Error while writing tags in \"%1%\"";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString((*it)->getURI()), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten((*it)->getURI(), COLS-const_strlen(msg)).c_str());
|
||||||
success = 0;
|
success = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Tags updated");
|
Statusbar::print("Tags updated");
|
||||||
TagTypes->setHighlightColor(Config.main_highlight_color);
|
TagTypes->setHighlightColor(Config.main_highlight_color);
|
||||||
TagTypes->reset();
|
TagTypes->reset();
|
||||||
w->refresh();
|
w->refresh();
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void TinyTagEditor::switchTo()
|
|||||||
using Global::myScreen;
|
using Global::myScreen;
|
||||||
if (itsEdited.isStream())
|
if (itsEdited.isStream())
|
||||||
{
|
{
|
||||||
Statusbar::msg("Streams can't be edited");
|
Statusbar::print("Streams can't be edited");
|
||||||
}
|
}
|
||||||
else if (getTags())
|
else if (getTags())
|
||||||
{
|
{
|
||||||
@@ -88,8 +88,8 @@ void TinyTagEditor::switchTo()
|
|||||||
full_path += Config.mpd_music_dir;
|
full_path += Config.mpd_music_dir;
|
||||||
full_path += itsEdited.getURI();
|
full_path += itsEdited.getURI();
|
||||||
|
|
||||||
const char msg[] = "Couldn't read file \"%ls\"";
|
const char msg[] = "Couldn't read file \"%1%\"";
|
||||||
Statusbar::msg(msg, wideShorten(ToWString(full_path), COLS-const_strlen(msg)).c_str());
|
Statusbar::printf(msg, wideShorten(full_path, COLS-const_strlen(msg)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,10 +128,10 @@ void TinyTagEditor::enterPressed()
|
|||||||
|
|
||||||
if (option == 22)
|
if (option == 22)
|
||||||
{
|
{
|
||||||
Statusbar::msg("Updating tags...");
|
Statusbar::print("Updating tags...");
|
||||||
if (Tags::write(itsEdited))
|
if (Tags::write(itsEdited))
|
||||||
{
|
{
|
||||||
Statusbar::msg("Tags updated");
|
Statusbar::print("Tags updated");
|
||||||
if (itsEdited.isFromDatabase())
|
if (itsEdited.isFromDatabase())
|
||||||
Mpd.UpdateDirectory(itsEdited.getDirectory());
|
Mpd.UpdateDirectory(itsEdited.getDirectory());
|
||||||
else
|
else
|
||||||
@@ -143,7 +143,7 @@ void TinyTagEditor::enterPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Statusbar::msg("Error while writing tags");
|
Statusbar::print("Error while writing tags");
|
||||||
}
|
}
|
||||||
if (option > 21)
|
if (option > 21)
|
||||||
m_previous_screen->switchTo();
|
m_previous_screen->switchTo();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include <boost/locale/encoding.hpp>
|
#include <boost/locale/encoding.hpp>
|
||||||
|
#include <cassert>
|
||||||
#include "utility/wide_string.h"
|
#include "utility/wide_string.h"
|
||||||
|
|
||||||
std::string ToString(std::wstring ws)
|
std::string ToString(std::wstring ws)
|
||||||
@@ -34,10 +35,8 @@ std::wstring ToWString(std::string s)
|
|||||||
size_t wideLength(const std::wstring &ws)
|
size_t wideLength(const std::wstring &ws)
|
||||||
{
|
{
|
||||||
int len = wcswidth(ws.c_str(), -1);
|
int len = wcswidth(ws.c_str(), -1);
|
||||||
if (len < 0)
|
assert(len >= 0);
|
||||||
return ws.length();
|
return len;
|
||||||
else
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wideCut(std::wstring &ws, size_t max_length)
|
void wideCut(std::wstring &ws, size_t max_length)
|
||||||
|
|||||||
@@ -31,4 +31,9 @@ size_t wideLength(const std::wstring &ws);
|
|||||||
void wideCut(std::wstring &ws, size_t max_length);
|
void wideCut(std::wstring &ws, size_t max_length);
|
||||||
std::wstring wideShorten(const std::wstring &ws, size_t max_length);
|
std::wstring wideShorten(const std::wstring &ws, size_t max_length);
|
||||||
|
|
||||||
|
inline std::string wideShorten(const std::string &s, size_t max_length)
|
||||||
|
{
|
||||||
|
return ToString(wideShorten(ToWString(s), max_length));
|
||||||
|
}
|
||||||
|
|
||||||
#endif // NCMPCPP_UTILITY_WIDE_STRING_h
|
#endif // NCMPCPP_UTILITY_WIDE_STRING_h
|
||||||
|
|||||||
@@ -134,7 +134,9 @@ void Visualizer::spacePressed()
|
|||||||
{
|
{
|
||||||
# ifdef HAVE_FFTW3_H
|
# ifdef HAVE_FFTW3_H
|
||||||
Config.visualizer_use_wave = !Config.visualizer_use_wave;
|
Config.visualizer_use_wave = !Config.visualizer_use_wave;
|
||||||
Statusbar::msg("Visualization type: %s", Config.visualizer_use_wave ? "Sound wave" : "Frequency spectrum");
|
Statusbar::printf("Visualization type: %1%",
|
||||||
|
Config.visualizer_use_wave ? "Sound wave" : "Frequency spectrum"
|
||||||
|
);
|
||||||
# endif // HAVE_FFTW3_H
|
# endif // HAVE_FFTW3_H
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +204,9 @@ void Visualizer::DrawFrequencySpectrum(int16_t *buf, ssize_t samples, size_t y_o
|
|||||||
void Visualizer::SetFD()
|
void Visualizer::SetFD()
|
||||||
{
|
{
|
||||||
if (m_fifo < 0 && (m_fifo = open(Config.visualizer_fifo_path.c_str(), O_RDONLY | O_NONBLOCK)) < 0)
|
if (m_fifo < 0 && (m_fifo = open(Config.visualizer_fifo_path.c_str(), O_RDONLY | O_NONBLOCK)) < 0)
|
||||||
Statusbar::msg("Couldn't open \"%s\" for reading PCM data: %s", Config.visualizer_fifo_path.c_str(), strerror(errno));
|
Statusbar::printf("Couldn't open \"%1%\" for reading PCM data: %2%",
|
||||||
|
Config.visualizer_fifo_path, strerror(errno)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Visualizer::ResetFD()
|
void Visualizer::ResetFD()
|
||||||
@@ -222,7 +226,7 @@ void Visualizer::FindOutputID()
|
|||||||
++idx;
|
++idx;
|
||||||
});
|
});
|
||||||
if (m_output_id == -1)
|
if (m_output_id == -1)
|
||||||
Statusbar::msg("There is no output named \"%s\"", Config.visualizer_output_name.c_str());
|
Statusbar::printf("There is no output named \"%s\"", Config.visualizer_output_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user