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
|
||||
Reference in New Issue
Block a user