diff options
author | Andrzej Rybczak <electricityispower@gmail.com> | 2014-11-10 00:31:53 +0100 |
---|---|---|
committer | Andrzej Rybczak <electricityispower@gmail.com> | 2014-11-11 00:08:23 +0100 |
commit | 8d24c42261c17d18ce723df5a65cc9d1e8dc3a9d (patch) | |
tree | 748e5215b607611a2d8c39625f5645e21bfa5d2c /src/status.cpp | |
parent | 25708093e6098a510b79dcbc715fa2fa465bd859 (diff) |
format: implement generic format parser and printer
Diffstat (limited to 'src/status.cpp')
-rw-r--r-- | src/status.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/status.cpp b/src/status.cpp index 17ce036c..cd4ea7f3 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -79,7 +79,7 @@ int m_volume; void drawTitle(const MPD::Song &np) { assert(!np.empty()); - windowTitle(np.toString(Config.song_window_title_format, Config.tags_separator)); + windowTitle(Format::stringify<char>(Config.song_window_title_format, &np)); } std::string playerStateToString(MPD::PlayerState ps) @@ -591,7 +591,7 @@ void Status::Changes::elapsedTime(bool update_elapsed) tracklength += "]"; } NC::WBuffer np_song; - stringToBuffer(ToWString(Charset::utf8ToLocale(np.toString(Config.song_status_format, Config.tags_separator, "$"))), np_song); + Format::print(Config.song_status_wformat, np_song, &np); *wFooter << NC::XY(0, 1) << wclrtoeol << NC::Format::Bold << ps << NC::Format::NoBold; writeCyclicBuffer(np_song, *wFooter, playing_song_scroll_begin, wFooter->getWidth()-ps.length()-tracklength.length(), L" ** "); *wFooter << NC::Format::Bold << NC::XY(wFooter->getWidth()-tracklength.length(), 1) << tracklength << NC::Format::NoBold; @@ -619,8 +619,8 @@ void Status::Changes::elapsedTime(bool update_elapsed) } NC::WBuffer first, second; - stringToBuffer(ToWString(Charset::utf8ToLocale(np.toString(Config.new_header_first_line, Config.tags_separator, "$"))), first); - stringToBuffer(ToWString(Charset::utf8ToLocale(np.toString(Config.new_header_second_line, Config.tags_separator, "$"))), second); + Format::print(Config.new_header_first_line, first, &np); + Format::print(Config.new_header_second_line, second, &np); size_t first_len = wideLength(first.str()); size_t first_margin = (std::max(tracklength.length()+1, VolumeState.length()))*2; |