did some more things and stuff

This commit is contained in:
fourtf
2020-02-23 23:07:28 +01:00
parent 5ad427bd61
commit e537277fa8
17 changed files with 98 additions and 174 deletions
@@ -7,51 +7,6 @@ namespace chatterino {
void MutedChannelController::initialize(Settings &settings, Paths &paths)
{
this->initialized_ = true;
persist(this->channels, "/pings/muted");
}
bool MutedChannelController::isMuted(const QString &channelName)
{
for (const auto &channel : this->channels)
{
if (channelName.toLower() == channel.toLower())
{
return true;
}
}
return false;
}
void MutedChannelController::mute(const QString &channelName)
{
channels.append(channelName);
}
void MutedChannelController::unmute(const QString &channelName)
{
for (std::vector<int>::size_type i = 0; i != channels.raw().size(); i++)
{
if (channels.raw()[i].toLower() == channelName.toLower())
{
channels.removeAt(i);
i--;
}
}
}
bool MutedChannelController::toggleMuted(const QString &channelName)
{
if (this->isMuted(channelName))
{
unmute(channelName);
return false;
}
else
{
mute(channelName);
return true;
}
}
} // namespace chatterino
@@ -18,12 +18,7 @@ class MutedChannelController final : public Singleton, private QObject
public:
virtual void initialize(Settings &settings, Paths &paths) override;
bool isMuted(const QString &channelName);
bool toggleMuted(const QString &channelName);
private:
void mute(const QString &channelName);
void unmute(const QString &channelName);
bool initialized_ = false;
SignalVector<QString> channels;