move WindowTitle() to local unnamed namespace
This commit is contained in:
@@ -39,8 +39,6 @@ extern NcmpcppScreen current_screen;
|
|||||||
extern bool search_case_sensitive;
|
extern bool search_case_sensitive;
|
||||||
extern bool search_match_to_pattern;
|
extern bool search_match_to_pattern;
|
||||||
|
|
||||||
const string term_type = getenv("TERM") ? getenv("TERM") : "";
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
inline void remove_the_word(string &s)
|
inline void remove_the_word(string &s)
|
||||||
@@ -260,55 +258,6 @@ bool SortSongsByTrack(Song *a, Song *b)
|
|||||||
return StrToInt(a->GetDisc()) < StrToInt(b->GetDisc());
|
return StrToInt(a->GetDisc()) < StrToInt(b->GetDisc());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowTitle(const string &status)
|
|
||||||
{
|
|
||||||
if (term_type != "linux" && Config.set_window_title)
|
|
||||||
std::cout << "\033]0;" << status << "\7";
|
|
||||||
}
|
|
||||||
|
|
||||||
Window &operator<<(Window &w, mpd_TagItems tag)
|
|
||||||
{
|
|
||||||
switch (tag)
|
|
||||||
{
|
|
||||||
case MPD_TAG_ITEM_ARTIST:
|
|
||||||
w << "Artist";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_ALBUM:
|
|
||||||
w << "Album";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_TITLE:
|
|
||||||
w << "Title";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_TRACK:
|
|
||||||
w << "Track";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_GENRE:
|
|
||||||
w << "Genre";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_DATE:
|
|
||||||
w << "Year";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_COMPOSER:
|
|
||||||
w << "Composer";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_PERFORMER:
|
|
||||||
w << "Performer";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_COMMENT:
|
|
||||||
w << "Comment";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_DISC:
|
|
||||||
w << "Disc";
|
|
||||||
break;
|
|
||||||
case MPD_TAG_ITEM_FILENAME:
|
|
||||||
w << "Filename";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
string FindSharedDir(const string &one, const string &two)
|
string FindSharedDir(const string &one, const string &two)
|
||||||
{
|
{
|
||||||
if (one == two)
|
if (one == two)
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ void UpdateSongList(Menu<MPD::Song> *);
|
|||||||
|
|
||||||
bool Keypressed(int, const int *);
|
bool Keypressed(int, const int *);
|
||||||
|
|
||||||
void WindowTitle(const std::string &);
|
|
||||||
|
|
||||||
Window &operator<<(Window &, mpd_TagItems);
|
|
||||||
|
|
||||||
std::string FindSharedDir(const std::string &, const std::string &);
|
std::string FindSharedDir(const std::string &, const std::string &);
|
||||||
|
|
||||||
void GetInfo(MPD::Song &, Scrollpad &);
|
void GetInfo(MPD::Song &, Scrollpad &);
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ int main(int argc, char *argv[])
|
|||||||
gettimeofday(&past, 0);
|
gettimeofday(&past, 0);
|
||||||
const size_t max_allowed_title_length = wHeader ? wHeader->GetWidth()-volume_state.length()-screen_title.length() : 0;
|
const size_t max_allowed_title_length = wHeader ? wHeader->GetWidth()-volume_state.length()-screen_title.length() : 0;
|
||||||
if (((past.tv_sec == now.tv_sec && past.tv_usec >= now.tv_usec+500000)
|
if (((past.tv_sec == now.tv_sec && past.tv_usec >= now.tv_usec+500000)
|
||||||
|| past.tv_sec >= now.tv_sec+1)
|
|| past.tv_sec > now.tv_sec)
|
||||||
&& ((current_screen == csBrowser && browsed_dir.length() > max_allowed_title_length)
|
&& ((current_screen == csBrowser && browsed_dir.length() > max_allowed_title_length)
|
||||||
|| current_screen == csLyrics))
|
|| current_screen == csLyrics))
|
||||||
{
|
{
|
||||||
@@ -2658,7 +2658,7 @@ int main(int argc, char *argv[])
|
|||||||
if (wCurrent == mLibArtists)
|
if (wCurrent == mLibArtists)
|
||||||
{
|
{
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
Statusbar() << fmtBold << Config.media_lib_primary_tag << fmtBoldEnd << ": ";
|
Statusbar() << fmtBold << IntoStr(Config.media_lib_primary_tag) << fmtBoldEnd << ": ";
|
||||||
string new_tag = wFooter->GetString(mLibArtists->Current());
|
string new_tag = wFooter->GetString(mLibArtists->Current());
|
||||||
UnlockStatusbar();
|
UnlockStatusbar();
|
||||||
if (!new_tag.empty() && new_tag != mLibArtists->Current())
|
if (!new_tag.empty() && new_tag != mLibArtists->Current())
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "browser.h"
|
#include "browser.h"
|
||||||
@@ -65,18 +66,31 @@ extern bool messages_allowed;
|
|||||||
extern bool redraw_header;
|
extern bool redraw_header;
|
||||||
extern bool reload_lyrics;
|
extern bool reload_lyrics;
|
||||||
|
|
||||||
int old_playing;
|
string volume_state;
|
||||||
|
|
||||||
|
bool header_update_status = 0;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
time_t time_of_statusbar_lock;
|
time_t time_of_statusbar_lock;
|
||||||
|
|
||||||
string volume_state;
|
int old_playing;
|
||||||
|
|
||||||
string switch_state;
|
string switch_state;
|
||||||
|
|
||||||
bool block_statusbar_update = 0;
|
bool block_statusbar_update = 0;
|
||||||
bool allow_statusbar_unlock = 1;
|
bool allow_statusbar_unlock = 1;
|
||||||
bool header_update_status = 0;
|
|
||||||
bool repeat_one_allowed = 0;
|
bool repeat_one_allowed = 0;
|
||||||
|
|
||||||
|
const string term_type = getenv("TERM") ? getenv("TERM") : "";
|
||||||
|
|
||||||
|
void WindowTitle(const string &status)
|
||||||
|
{
|
||||||
|
if (term_type != "linux" && Config.set_window_title)
|
||||||
|
std::cout << "\033]0;" << status << "\7";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LockStatusbar()
|
void LockStatusbar()
|
||||||
{
|
{
|
||||||
if (Config.statusbar_visibility)
|
if (Config.statusbar_visibility)
|
||||||
|
|||||||
Reference in New Issue
Block a user