did some more things and stuff
This commit is contained in:
@@ -71,11 +71,11 @@ ModerationAction::ModerationAction(const QString &action)
|
||||
}
|
||||
else if (action.startsWith("/ban "))
|
||||
{
|
||||
this->image_ = Image::fromPixmap(getResources().buttons.ban);
|
||||
this->imageToLoad_ = 1;
|
||||
}
|
||||
else if (action.startsWith("/delete "))
|
||||
{
|
||||
this->image_ = Image::fromPixmap(getResources().buttons.trashCan);
|
||||
this->imageToLoad_ = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -100,6 +100,16 @@ bool ModerationAction::isImage() const
|
||||
|
||||
const boost::optional<ImagePtr> &ModerationAction::getImage() const
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
if (this->imageToLoad_ != 0)
|
||||
{
|
||||
if (this->imageToLoad_ == 1)
|
||||
this->image_ = Image::fromPixmap(getResources().buttons.ban);
|
||||
else if (this->imageToLoad_ == 2)
|
||||
this->image_ = Image::fromPixmap(getResources().buttons.trashCan);
|
||||
}
|
||||
|
||||
return this->image_;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,11 @@ public:
|
||||
const QString &getAction() const;
|
||||
|
||||
private:
|
||||
boost::optional<ImagePtr> image_;
|
||||
mutable boost::optional<ImagePtr> image_;
|
||||
QString line1_;
|
||||
QString line2_;
|
||||
QString action_;
|
||||
int imageToLoad_{};
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#include "ModerationActions.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "controllers/moderationactions/ModerationActionModel.hpp"
|
||||
#include "util/PersistSignalVector.hpp"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
void ModerationActions::initialize(Settings &settings, Paths &paths)
|
||||
{
|
||||
assert(!this->initialized_);
|
||||
this->initialized_ = true;
|
||||
|
||||
persist(this->items, "/moderation/actions");
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/SignalVector.hpp"
|
||||
#include "common/Singleton.hpp"
|
||||
#include "controllers/moderationactions/ModerationAction.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Settings;
|
||||
class Paths;
|
||||
|
||||
class ModerationActions final : public Singleton
|
||||
{
|
||||
public:
|
||||
virtual void initialize(Settings &settings, Paths &paths) override;
|
||||
|
||||
SignalVector<ModerationAction> items;
|
||||
|
||||
private:
|
||||
bool initialized_ = false;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -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;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#include "TaggedUsersController.hpp"
|
||||
|
||||
#include "controllers/taggedusers/TaggedUsersModel.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
TaggedUsersController::TaggedUsersController()
|
||||
: users(std::less<TaggedUser>{})
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/Singleton.hpp"
|
||||
|
||||
#include "common/SignalVector.hpp"
|
||||
#include "controllers/taggedusers/TaggedUser.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class TaggedUsersModel;
|
||||
|
||||
class TaggedUsersController final : public Singleton
|
||||
{
|
||||
public:
|
||||
TaggedUsersController();
|
||||
|
||||
SignalVector<TaggedUser> users;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
Reference in New Issue
Block a user