move some functions from helpers to status_checker
This commit is contained in:
@@ -34,15 +34,6 @@ extern Window *wFooter;
|
||||
|
||||
extern NcmpcppScreen current_screen;
|
||||
|
||||
extern int lock_statusbar_delay;
|
||||
|
||||
extern time_t time_of_statusbar_lock;
|
||||
|
||||
extern bool messages_allowed;
|
||||
extern bool block_progressbar_update;
|
||||
extern bool block_statusbar_update;
|
||||
extern bool allow_statusbar_unlock;
|
||||
|
||||
extern bool search_case_sensitive;
|
||||
extern bool search_match_to_pattern;
|
||||
|
||||
@@ -164,27 +155,6 @@ bool ParseArgv(int argc, char **argv)
|
||||
return exit;
|
||||
}
|
||||
|
||||
void LockStatusbar()
|
||||
{
|
||||
if (Config.statusbar_visibility)
|
||||
block_statusbar_update = 1;
|
||||
else
|
||||
block_progressbar_update = 1;
|
||||
allow_statusbar_unlock = 0;
|
||||
}
|
||||
|
||||
void UnlockStatusbar()
|
||||
{
|
||||
allow_statusbar_unlock = 1;
|
||||
if (lock_statusbar_delay < 0)
|
||||
{
|
||||
if (Config.statusbar_visibility)
|
||||
block_statusbar_update = 0;
|
||||
else
|
||||
block_progressbar_update = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool CaseInsensitiveSorting::operator()(string a, string b)
|
||||
{
|
||||
ToLower(a);
|
||||
@@ -312,7 +282,7 @@ Window &operator<<(Window &w, mpd_TagItems tag)
|
||||
return w;
|
||||
}
|
||||
|
||||
string IntoStr(mpd_TagItems tag)
|
||||
string IntoStr(mpd_TagItems tag) // this is only for left column's title in media library
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
@@ -822,29 +792,6 @@ void GetInfo(Song &s, Scrollpad &info)
|
||||
info << fmtBold << "\nComment: " << fmtBoldEnd << ShowTagInInfoScreen(s.GetComment());
|
||||
}
|
||||
|
||||
void ShowMessage(const char *format, ...)
|
||||
{
|
||||
if (messages_allowed)
|
||||
{
|
||||
time_of_statusbar_lock = time(NULL);
|
||||
lock_statusbar_delay = Config.message_delay_time;
|
||||
if (Config.statusbar_visibility)
|
||||
block_statusbar_update = 1;
|
||||
else
|
||||
block_progressbar_update = 1;
|
||||
wFooter->GotoXY(0, Config.statusbar_visibility);
|
||||
wFooter->Bold(0);
|
||||
va_list list;
|
||||
va_start(list, format);
|
||||
wmove(wFooter->Raw(), Config.statusbar_visibility, 0);
|
||||
vw_printw(wFooter->Raw(), format, list);
|
||||
wclrtoeol(wFooter->Raw());
|
||||
va_end(list);
|
||||
wFooter->Bold(1);
|
||||
wFooter->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
Window &Statusbar()
|
||||
{
|
||||
wFooter->GotoXY(0, Config.statusbar_visibility);
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
bool ConnectToMPD();
|
||||
bool ParseArgv(int, char **);
|
||||
|
||||
void LockStatusbar();
|
||||
void UnlockStatusbar();
|
||||
|
||||
class CaseInsensitiveSorting
|
||||
{
|
||||
public:
|
||||
@@ -64,7 +61,6 @@ void DisplaySongInColumns(const Song &, void *, Menu<Song> *);
|
||||
void DisplaySong(const Song &, void * = &Config.song_list_format, Menu<Song> * = NULL);
|
||||
void GetInfo(Song &, Scrollpad &);
|
||||
|
||||
void ShowMessage(const char *, ...);
|
||||
Window &Statusbar();
|
||||
|
||||
const Buffer &ShowTag(const string &);
|
||||
|
||||
@@ -57,6 +57,7 @@ extern bool block_progressbar_update;
|
||||
extern bool block_playlist_update;
|
||||
extern bool block_item_list_update;
|
||||
|
||||
extern bool messages_allowed;
|
||||
extern bool redraw_header;
|
||||
extern bool reload_lyrics;
|
||||
|
||||
@@ -72,6 +73,27 @@ bool allow_statusbar_unlock = 1;
|
||||
bool header_update_status = 0;
|
||||
bool repeat_one_allowed = 0;
|
||||
|
||||
void LockStatusbar()
|
||||
{
|
||||
if (Config.statusbar_visibility)
|
||||
block_statusbar_update = 1;
|
||||
else
|
||||
block_progressbar_update = 1;
|
||||
allow_statusbar_unlock = 0;
|
||||
}
|
||||
|
||||
void UnlockStatusbar()
|
||||
{
|
||||
allow_statusbar_unlock = 1;
|
||||
if (lock_statusbar_delay < 0)
|
||||
{
|
||||
if (Config.statusbar_visibility)
|
||||
block_statusbar_update = 0;
|
||||
else
|
||||
block_progressbar_update = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void TraceMpdStatus()
|
||||
{
|
||||
Mpd->UpdateStatus();
|
||||
@@ -440,3 +462,26 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
||||
wFooter->Refresh();
|
||||
}
|
||||
|
||||
void ShowMessage(const char *format, ...)
|
||||
{
|
||||
if (messages_allowed)
|
||||
{
|
||||
time_of_statusbar_lock = time(NULL);
|
||||
lock_statusbar_delay = Config.message_delay_time;
|
||||
if (Config.statusbar_visibility)
|
||||
block_statusbar_update = 1;
|
||||
else
|
||||
block_progressbar_update = 1;
|
||||
wFooter->GotoXY(0, Config.statusbar_visibility);
|
||||
wFooter->Bold(0);
|
||||
va_list list;
|
||||
va_start(list, format);
|
||||
wmove(wFooter->Raw(), Config.statusbar_visibility, 0);
|
||||
vw_printw(wFooter->Raw(), format, list);
|
||||
wclrtoeol(wFooter->Raw());
|
||||
va_end(list);
|
||||
wFooter->Bold(1);
|
||||
wFooter->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,14 @@
|
||||
#include "mpdpp.h"
|
||||
#include "ncmpcpp.h"
|
||||
|
||||
void LockStatusbar();
|
||||
void UnlockStatusbar();
|
||||
|
||||
void TraceMpdStatus();
|
||||
void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges, void *);
|
||||
void NcmpcppErrorCallback(MPD::Connection *, int, const char *, void *);
|
||||
|
||||
void ShowMessage(const char *, ...);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user