refactor(clang-tidy): Apply fixes
This commit is contained in:
parent
7c7e053e1f
commit
97fa7052fe
@ -82,7 +82,7 @@ class logger {
|
||||
/**
|
||||
* Convert string
|
||||
*/
|
||||
const char* convert(string arg) const;
|
||||
const char* convert(string arg) const; // NOLINT
|
||||
|
||||
/**
|
||||
* Convert thread id
|
||||
|
@ -28,6 +28,7 @@ namespace modules {
|
||||
public:
|
||||
explicit ipc_module(const bar_settings&, string);
|
||||
|
||||
void update() {}
|
||||
string get_output();
|
||||
bool build(builder* builder, const string& tag) const;
|
||||
void on_message(const ipc_hook& message);
|
||||
|
@ -21,6 +21,7 @@ namespace modules {
|
||||
explicit menu_module(const bar_settings&, string);
|
||||
|
||||
bool build(builder* builder, const string& tag) const;
|
||||
void update() {}
|
||||
|
||||
protected:
|
||||
bool on(const input_event_t& evt);
|
||||
|
@ -17,13 +17,9 @@ namespace modules {
|
||||
protected:
|
||||
void runner() {
|
||||
try {
|
||||
// Warm up module output and
|
||||
// send broadcast before entering
|
||||
// the update loop
|
||||
if (this->running()) {
|
||||
// Warm up the module output before entering the loop
|
||||
CAST_MOD(Impl)->update();
|
||||
CAST_MOD(Impl)->broadcast();
|
||||
}
|
||||
|
||||
while (this->running()) {
|
||||
CAST_MOD(Impl)->idle();
|
||||
|
@ -18,13 +18,9 @@ namespace modules {
|
||||
protected:
|
||||
void runner() {
|
||||
try {
|
||||
// Warm up module output and
|
||||
// send broadcast before entering
|
||||
// the update loop
|
||||
if (this->running()) {
|
||||
// Warm up module output before entering the loop
|
||||
CAST_MOD(Impl)->on_event(nullptr);
|
||||
CAST_MOD(Impl)->broadcast();
|
||||
}
|
||||
|
||||
while (this->running()) {
|
||||
CAST_MOD(Impl)->poll_events();
|
||||
|
@ -11,6 +11,7 @@ namespace modules {
|
||||
using module<Impl>::module;
|
||||
|
||||
void start() {
|
||||
CAST_MOD(Impl)->update();
|
||||
CAST_MOD(Impl)->broadcast();
|
||||
}
|
||||
|
||||
|
@ -30,35 +30,49 @@ namespace modules {
|
||||
bool on(const input_event_t& evt);
|
||||
|
||||
private:
|
||||
static constexpr auto FORMAT_ONLINE = "format-online";
|
||||
static constexpr auto TAG_BAR_PROGRESS = "<bar-progress>";
|
||||
static constexpr auto TAG_TOGGLE = "<toggle>";
|
||||
static constexpr auto TAG_TOGGLE_STOP = "<toggle-stop>";
|
||||
static constexpr auto TAG_LABEL_SONG = "<label-song>";
|
||||
static constexpr auto TAG_LABEL_TIME = "<label-time>";
|
||||
static constexpr auto TAG_ICON_RANDOM = "<icon-random>";
|
||||
static constexpr auto TAG_ICON_REPEAT = "<icon-repeat>";
|
||||
static constexpr auto TAG_ICON_REPEAT_ONE = "<icon-repeatone>";
|
||||
static constexpr auto TAG_ICON_PREV = "<icon-prev>";
|
||||
static constexpr auto TAG_ICON_STOP = "<icon-stop>";
|
||||
static constexpr auto TAG_ICON_PLAY = "<icon-play>";
|
||||
static constexpr auto TAG_ICON_PAUSE = "<icon-pause>";
|
||||
static constexpr auto TAG_ICON_NEXT = "<icon-next>";
|
||||
static constexpr auto TAG_ICON_SEEKB = "<icon-seekb>";
|
||||
static constexpr auto TAG_ICON_SEEKF = "<icon-seekf>";
|
||||
static constexpr const char* FORMAT_ONLINE{"format-online"};
|
||||
static constexpr const char* TAG_BAR_PROGRESS{"<bar-progress>"};
|
||||
static constexpr const char* TAG_TOGGLE{"<toggle>"};
|
||||
static constexpr const char* TAG_TOGGLE_STOP{"<toggle-stop>"};
|
||||
static constexpr const char* TAG_LABEL_SONG{"<label-song>"};
|
||||
static constexpr const char* TAG_LABEL_TIME{"<label-time>"};
|
||||
static constexpr const char* TAG_ICON_RANDOM{"<icon-random>"};
|
||||
static constexpr const char* TAG_ICON_REPEAT{"<icon-repeat>"};
|
||||
static constexpr const char* TAG_ICON_REPEAT_ONE{"<icon-repeatone>"};
|
||||
static constexpr const char* TAG_ICON_PREV{"<icon-prev>"};
|
||||
static constexpr const char* TAG_ICON_STOP{"<icon-stop>"};
|
||||
static constexpr const char* TAG_ICON_PLAY{"<icon-play>"};
|
||||
static constexpr const char* TAG_ICON_PAUSE{"<icon-pause>"};
|
||||
static constexpr const char* TAG_ICON_NEXT{"<icon-next>"};
|
||||
static constexpr const char* TAG_ICON_SEEKB{"<icon-seekb>"};
|
||||
static constexpr const char* TAG_ICON_SEEKF{"<icon-seekf>"};
|
||||
|
||||
static constexpr auto FORMAT_OFFLINE = "format-offline";
|
||||
static constexpr auto TAG_LABEL_OFFLINE = "<label-offline>";
|
||||
static constexpr const char* FORMAT_OFFLINE{"format-offline"};
|
||||
static constexpr const char* TAG_LABEL_OFFLINE{"<label-offline>"};
|
||||
|
||||
static constexpr auto EVENT_PLAY = "mpdplay";
|
||||
static constexpr auto EVENT_PAUSE = "mpdpause";
|
||||
static constexpr auto EVENT_STOP = "mpdstop";
|
||||
static constexpr auto EVENT_PREV = "mpdprev";
|
||||
static constexpr auto EVENT_NEXT = "mpdnext";
|
||||
static constexpr auto EVENT_REPEAT = "mpdrepeat";
|
||||
static constexpr auto EVENT_REPEAT_ONE = "mpdrepeatone";
|
||||
static constexpr auto EVENT_RANDOM = "mpdrandom";
|
||||
static constexpr auto EVENT_SEEK = "mpdseek";
|
||||
static constexpr const char* EVENT_PLAY{"mpdplay"};
|
||||
static constexpr const char* EVENT_PAUSE{"mpdpause"};
|
||||
static constexpr const char* EVENT_STOP{"mpdstop"};
|
||||
static constexpr const char* EVENT_PREV{"mpdprev"};
|
||||
static constexpr const char* EVENT_NEXT{"mpdnext"};
|
||||
static constexpr const char* EVENT_REPEAT{"mpdrepeat"};
|
||||
static constexpr const char* EVENT_REPEAT_ONE{"mpdrepeatone"};
|
||||
static constexpr const char* EVENT_RANDOM{"mpdrandom"};
|
||||
static constexpr const char* EVENT_SEEK{"mpdseek"};
|
||||
|
||||
unique_ptr<mpdconnection> m_mpd;
|
||||
unique_ptr<mpdstatus> m_status;
|
||||
|
||||
string m_host{"127.0.0.1"};
|
||||
string m_pass;
|
||||
unsigned int m_port{6600U};
|
||||
|
||||
chrono::system_clock::time_point m_lastsync{};
|
||||
float m_synctime{1.0f};
|
||||
|
||||
// This flag is used to let thru a broadcast once every time
|
||||
// the connection state changes
|
||||
mpd::connection_state m_statebroadcasted{mpd::connection_state::NONE};
|
||||
|
||||
progressbar_t m_bar_progress;
|
||||
iconset_t m_icons;
|
||||
@ -66,22 +80,8 @@ namespace modules {
|
||||
label_t m_label_time;
|
||||
label_t m_label_offline;
|
||||
|
||||
unique_ptr<mpdconnection> m_mpd;
|
||||
unique_ptr<mpdstatus> m_status;
|
||||
|
||||
string m_host = "127.0.0.1";
|
||||
string m_pass = "";
|
||||
unsigned int m_port = 6600;
|
||||
|
||||
string m_toggle_on_color;
|
||||
string m_toggle_off_color;
|
||||
|
||||
chrono::system_clock::time_point m_lastsync;
|
||||
float m_synctime = 1.0f;
|
||||
|
||||
// This flag is used to let thru a broadcast once every time
|
||||
// the connection state changes
|
||||
mpd::connection_state m_statebroadcasted;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ namespace modules {
|
||||
public:
|
||||
explicit text_module(const bar_settings&, string);
|
||||
|
||||
void update() {}
|
||||
string get_format() const;
|
||||
string get_output();
|
||||
};
|
||||
|
@ -15,10 +15,10 @@ namespace modules {
|
||||
template class module<mpd_module>;
|
||||
|
||||
mpd_module::mpd_module(const bar_settings& bar, string name_) : event_module<mpd_module>(bar, move(name_)) {
|
||||
m_host = m_conf.get<string>(name(), "host", m_host);
|
||||
m_port = m_conf.get<unsigned int>(name(), "port", m_port);
|
||||
m_pass = m_conf.get<string>(name(), "password", m_pass);
|
||||
m_synctime = m_conf.get<float>(name(), "interval", m_synctime);
|
||||
m_host = m_conf.get(name(), "host", m_host);
|
||||
m_port = m_conf.get(name(), "port", m_port);
|
||||
m_pass = m_conf.get(name(), "password", m_pass);
|
||||
m_synctime = m_conf.get(name(), "interval", m_synctime);
|
||||
|
||||
// Add formats and elements {{{
|
||||
|
||||
|
@ -68,9 +68,6 @@ namespace modules {
|
||||
if (m_formatter->has(TAG_RAMP)) {
|
||||
m_ramp = load_ramp(m_conf, name(), TAG_RAMP);
|
||||
}
|
||||
|
||||
// Trigger the initial draw event
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,8 +39,6 @@ namespace modules {
|
||||
|
||||
// Create keyboard object
|
||||
query_keyboard();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,9 +80,6 @@ namespace modules {
|
||||
if (m_formatter->has(TAG_LABEL)) {
|
||||
m_label = load_optional_label(m_conf, name(), TAG_LABEL, "%title%");
|
||||
}
|
||||
|
||||
// Trigger the initial draw event
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,8 +75,6 @@ namespace modules {
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
// Make sure we get notified when root properties change
|
||||
window{m_connection, m_connection.root()}.ensure_event_mask(XCB_EVENT_MASK_PROPERTY_CHANGE);
|
||||
}
|
||||
|
@ -8,8 +8,9 @@ namespace concurrency_util {
|
||||
static mutex mtx;
|
||||
static map<thread::id, size_t> ids;
|
||||
std::lock_guard<mutex> lock(mtx);
|
||||
if (ids.find(id) == ids.end())
|
||||
if (ids.find(id) == ids.end()) {
|
||||
ids[id] = idx++;
|
||||
}
|
||||
return ids[id];
|
||||
}
|
||||
}
|
||||
|
@ -72,9 +72,9 @@ bool font_manager::load(const string& name, uint8_t fontindex, int8_t offset_y)
|
||||
return false;
|
||||
} else if (fontindex == 0) {
|
||||
fontindex = m_fonts.size();
|
||||
m_logger.trace("font_manager: Assign font '%s' to index '%d'", name.c_str(), fontindex);
|
||||
m_logger.trace("font_manager: Assign font '%s' to index '%u'", name, fontindex);
|
||||
} else {
|
||||
m_logger.trace("font_manager: Add font '%s' to index '%i'", name, fontindex);
|
||||
m_logger.trace("font_manager: Add font '%s' to index '%u'", name, fontindex);
|
||||
}
|
||||
|
||||
shared_ptr<font_ref> font{new font_ref{}, font_ref::deleter};
|
||||
|
Loading…
Reference in New Issue
Block a user