refactor(core): Clean-up

- use "#pragma once" instead of the regular include guard
- fix errors and warnings reported by cppcheck
This commit is contained in:
Michael Carlberg
2016-05-31 05:58:58 +02:00
parent d0499d4d15
commit 39d3f61497
81 changed files with 588 additions and 730 deletions

View File

@ -12,7 +12,8 @@ using namespace modules;
// TODO: Add up-/download speed (check how ifconfig read the bytes)
NetworkModule::NetworkModule(const std::string& name_) : TimerModule(name_, 1s)
NetworkModule::NetworkModule(const std::string& name_)
: TimerModule(name_, 1s), connected(false), conseq_packetloss(false)
{
static const auto DEFAULT_FORMAT_CONNECTED = TAG_LABEL_CONNECTED;
static const auto DEFAULT_FORMAT_DISCONNECTED = TAG_LABEL_DISCONNECTED;
@ -22,9 +23,6 @@ NetworkModule::NetworkModule(const std::string& name_) : TimerModule(name_, 1s)
static const auto DEFAULT_LABEL_DISCONNECTED = "";
static const auto DEFAULT_LABEL_PACKETLOSS = "";
this->connected = false;
this->conseq_packetloss = false;
// Load configuration values
this->interface = config::get<std::string>(name(), "interface");
this->interval = std::chrono::duration<double>(config::get<float>(name(), "interval", 1));
@ -147,7 +145,6 @@ bool NetworkModule::update()
if (this->wired_network) {
label->replace_token("%linkspeed%", linkspeed);
} else if (this->wireless_network) {
// label->replace_token("%essid%", essid);
label->replace_token("%essid%", !essid.empty() ? essid : "No network");
label->replace_token("%signal%", std::to_string(signal_quality)+"%");
}