mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor: lint
This commit is contained in:
@ -22,8 +22,8 @@ class MPD : public ALabel {
|
||||
|
||||
// Not using unique_ptr since we don't manage the pointer
|
||||
// (It's either nullptr, or from the config)
|
||||
const char* server_;
|
||||
const unsigned port_;
|
||||
const char* server_;
|
||||
const unsigned port_;
|
||||
const std::string password_;
|
||||
|
||||
unsigned timeout_;
|
||||
@ -31,8 +31,8 @@ class MPD : public ALabel {
|
||||
detail::unique_connection connection_;
|
||||
|
||||
detail::unique_status status_;
|
||||
mpd_state state_;
|
||||
detail::unique_song song_;
|
||||
mpd_state state_;
|
||||
detail::unique_song song_;
|
||||
|
||||
public:
|
||||
MPD(const std::string&, const Json::Value&);
|
||||
@ -41,7 +41,7 @@ class MPD : public ALabel {
|
||||
|
||||
private:
|
||||
std::string getTag(mpd_tag_type type, unsigned idx = 0) const;
|
||||
void setLabel();
|
||||
void setLabel();
|
||||
std::string getStateIcon() const;
|
||||
std::string getOptionIcon(std::string optionName, bool activated) const;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <mpd/client.h>
|
||||
#include <fmt/format.h>
|
||||
#include <mpd/client.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <condition_variable>
|
||||
@ -57,7 +57,7 @@ class State {
|
||||
};
|
||||
|
||||
class Idle : public State {
|
||||
Context* const ctx_;
|
||||
Context* const ctx_;
|
||||
sigc::connection idle_connection_;
|
||||
|
||||
public:
|
||||
@ -80,7 +80,7 @@ class Idle : public State {
|
||||
};
|
||||
|
||||
class Playing : public State {
|
||||
Context* const ctx_;
|
||||
Context* const ctx_;
|
||||
sigc::connection timer_connection_;
|
||||
|
||||
public:
|
||||
@ -102,7 +102,7 @@ class Playing : public State {
|
||||
};
|
||||
|
||||
class Paused : public State {
|
||||
Context* const ctx_;
|
||||
Context* const ctx_;
|
||||
sigc::connection timer_connection_;
|
||||
|
||||
public:
|
||||
@ -124,7 +124,7 @@ class Paused : public State {
|
||||
};
|
||||
|
||||
class Stopped : public State {
|
||||
Context* const ctx_;
|
||||
Context* const ctx_;
|
||||
sigc::connection timer_connection_;
|
||||
|
||||
public:
|
||||
@ -146,7 +146,7 @@ class Stopped : public State {
|
||||
};
|
||||
|
||||
class Disconnected : public State {
|
||||
Context* const ctx_;
|
||||
Context* const ctx_;
|
||||
sigc::connection timer_connection_;
|
||||
|
||||
public:
|
||||
@ -170,7 +170,7 @@ class Disconnected : public State {
|
||||
|
||||
class Context {
|
||||
std::unique_ptr<State> state_;
|
||||
waybar::modules::MPD* mpd_module_;
|
||||
waybar::modules::MPD* mpd_module_;
|
||||
|
||||
friend class State;
|
||||
friend class Playing;
|
||||
@ -188,18 +188,18 @@ class Context {
|
||||
state_->entry();
|
||||
}
|
||||
|
||||
bool is_connected() const;
|
||||
bool is_playing() const;
|
||||
bool is_paused() const;
|
||||
bool is_stopped() const;
|
||||
constexpr std::size_t interval() const;
|
||||
void tryConnect() const;
|
||||
void checkErrors(mpd_connection*) const;
|
||||
void do_update();
|
||||
void queryMPD() const;
|
||||
void fetchState() const;
|
||||
constexpr mpd_state state() const;
|
||||
void emit() const;
|
||||
bool is_connected() const;
|
||||
bool is_playing() const;
|
||||
bool is_paused() const;
|
||||
bool is_stopped() const;
|
||||
constexpr std::size_t interval() const;
|
||||
void tryConnect() const;
|
||||
void checkErrors(mpd_connection*) const;
|
||||
void do_update();
|
||||
void queryMPD() const;
|
||||
void fetchState() const;
|
||||
constexpr mpd_state state() const;
|
||||
void emit() const;
|
||||
[[nodiscard]] unique_connection& connection();
|
||||
|
||||
public:
|
||||
|
@ -8,13 +8,11 @@ inline bool Context::is_paused() const { return mpd_module_->paused(); }
|
||||
inline bool Context::is_stopped() const { return mpd_module_->stopped(); }
|
||||
|
||||
constexpr inline std::size_t Context::interval() const { return mpd_module_->interval_.count(); }
|
||||
inline void Context::tryConnect() const { mpd_module_->tryConnect(); }
|
||||
inline unique_connection& Context::connection() { return mpd_module_->connection_; }
|
||||
constexpr inline mpd_state Context::state() const { return mpd_module_->state_; }
|
||||
inline void Context::tryConnect() const { mpd_module_->tryConnect(); }
|
||||
inline unique_connection& Context::connection() { return mpd_module_->connection_; }
|
||||
constexpr inline mpd_state Context::state() const { return mpd_module_->state_; }
|
||||
|
||||
inline void Context::do_update() {
|
||||
mpd_module_->setLabel();
|
||||
}
|
||||
inline void Context::do_update() { mpd_module_->setLabel(); }
|
||||
|
||||
inline void Context::checkErrors(mpd_connection* conn) const { mpd_module_->checkErrors(conn); }
|
||||
inline void Context::queryMPD() const { mpd_module_->queryMPD(); }
|
||||
|
Reference in New Issue
Block a user