fix(battery): Use full namespace

This commit is contained in:
Michael Carlberg 2016-12-31 07:32:57 +01:00
parent a4f77dd840
commit 22b93a1167

View File

@ -183,9 +183,9 @@ namespace modules {
m_percentage = percentage; m_percentage = percentage;
const auto label = [this] { const auto label = [this] {
if (m_state == state::FULL) { if (m_state == battery_module::state::FULL) {
return m_label_full; return m_label_full;
} else if (m_state == state::DISCHARGING) { } else if (m_state == battery_module::state::DISCHARGING) {
return m_label_discharging; return m_label_discharging;
} else { } else {
return m_label_charging; return m_label_charging;
@ -195,7 +195,7 @@ namespace modules {
label->reset_tokens(); label->reset_tokens();
label->replace_token("%percentage%", to_string(m_percentage) + "%"); label->replace_token("%percentage%", to_string(m_percentage) + "%");
if (m_state != state::FULL && !m_timeformat.empty()) { if (m_state != battery_module::state::FULL && !m_timeformat.empty()) {
label->replace_token("%time%", current_time()); label->replace_token("%time%", current_time());
} }
@ -206,9 +206,9 @@ namespace modules {
* Get the output format based on state * Get the output format based on state
*/ */
string battery_module::get_format() const { string battery_module::get_format() const {
if (m_state == state::CHARGING) { if (m_state == battery_module::state::CHARGING) {
return FORMAT_CHARGING; return FORMAT_CHARGING;
} else if (m_state == state::DISCHARGING) { } else if (m_state == battery_module::state::DISCHARGING) {
return FORMAT_DISCHARGING; return FORMAT_DISCHARGING;
} else { } else {
return FORMAT_FULL; return FORMAT_FULL;
@ -243,11 +243,11 @@ namespace modules {
*/ */
battery_module::state battery_module::current_state() { battery_module::state battery_module::current_state() {
if (!read(*m_state_reader)) { if (!read(*m_state_reader)) {
return state::DISCHARGING; return battery_module::state::DISCHARGING;
} else if (read(*m_capacity_reader) < m_fullat) { } else if (read(*m_capacity_reader) < m_fullat) {
return state::CHARGING; return battery_module::state::CHARGING;
} else { } else {
return state::FULL; return battery_module::state::FULL;
} }
} }
@ -256,7 +256,7 @@ namespace modules {
*/ */
int battery_module::current_percentage(state state) { int battery_module::current_percentage(state state) {
int percentage{read(*m_capacity_reader)}; int percentage{read(*m_capacity_reader)};
if (state == state::FULL && percentage >= m_fullat) { if (state == battery_module::state::FULL && percentage >= m_fullat) {
percentage = 100; percentage = 100;
} }
return percentage; return percentage;
@ -299,7 +299,7 @@ namespace modules {
while (running()) { while (running()) {
for (int i = 0; running() && i < dur.count(); ++i) { for (int i = 0; running() && i < dur.count(); ++i) {
if (m_state == state::CHARGING) { if (m_state == battery_module::state::CHARGING) {
broadcast(); broadcast();
} }
sleep(dur); sleep(dur);