Merge branch '4tf'
This commit is contained in:
@@ -33,7 +33,7 @@ AccountController::AccountController()
|
||||
});
|
||||
}
|
||||
|
||||
void AccountController::initialize(Application &app)
|
||||
void AccountController::initialize(Settings &settings, Paths &paths)
|
||||
{
|
||||
this->twitch.load();
|
||||
}
|
||||
|
||||
@@ -11,16 +11,19 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Settings;
|
||||
class Paths;
|
||||
|
||||
class AccountModel;
|
||||
|
||||
class AccountController : public Singleton
|
||||
class AccountController final : public Singleton
|
||||
{
|
||||
public:
|
||||
AccountController();
|
||||
|
||||
AccountModel *createModel(QObject *parent);
|
||||
|
||||
virtual void initialize(Application &app) override;
|
||||
virtual void initialize(Settings &settings, Paths &paths) override;
|
||||
|
||||
TwitchAccountManager twitch;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "singletons/Paths.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/CombinePath.hpp"
|
||||
#include "widgets/dialogs/LogsPopup.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
@@ -44,15 +45,14 @@ CommandController::CommandController()
|
||||
this->items.itemRemoved.connect(addFirstMatchToMap);
|
||||
}
|
||||
|
||||
void CommandController::initialize(Application &app)
|
||||
void CommandController::initialize(Settings &, Paths &paths)
|
||||
{
|
||||
this->load();
|
||||
this->load(paths);
|
||||
}
|
||||
|
||||
void CommandController::load()
|
||||
void CommandController::load(Paths &paths)
|
||||
{
|
||||
auto app = getApp();
|
||||
this->filePath_ = app->paths->settingsDirectory + "/commands.txt";
|
||||
this->filePath_ = combinePath(paths.settingsDirectory, "commands.txt");
|
||||
|
||||
QFile textFile(this->filePath_);
|
||||
if (!textFile.open(QIODevice::ReadOnly)) {
|
||||
@@ -140,7 +140,7 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel,
|
||||
|
||||
app->twitch.server->whispersChannel->addMessage(b.getMessage());
|
||||
|
||||
app->twitch.server->getWriteConnection()->sendRaw("PRIVMSG #jtv :" + text + "\r\n");
|
||||
app->twitch.server->sendMessage("jtv", text);
|
||||
|
||||
if (getSettings()->inlineWhispers) {
|
||||
app->twitch.server->forEachChannel(
|
||||
|
||||
@@ -10,11 +10,14 @@
|
||||
#include "controllers/commands/Command.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Settings;
|
||||
class Paths;
|
||||
class Channel;
|
||||
|
||||
class CommandModel;
|
||||
|
||||
class CommandController : public Singleton
|
||||
class CommandController final : public Singleton
|
||||
{
|
||||
public:
|
||||
CommandController();
|
||||
@@ -22,7 +25,7 @@ public:
|
||||
QString execCommand(const QString &text, std::shared_ptr<Channel> channel, bool dryRun);
|
||||
QStringList getDefaultTwitchCommandList();
|
||||
|
||||
virtual void initialize(Application &app) override;
|
||||
virtual void initialize(Settings &settings, Paths &paths) override;
|
||||
virtual void save() override;
|
||||
|
||||
CommandModel *createModel(QObject *parent);
|
||||
@@ -30,7 +33,7 @@ public:
|
||||
UnsortedSignalVector<Command> items;
|
||||
|
||||
private:
|
||||
void load();
|
||||
void load(Paths &paths);
|
||||
|
||||
QMap<QString, Command> commandsMap_;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ HighlightController::HighlightController()
|
||||
{
|
||||
}
|
||||
|
||||
void HighlightController::initialize(Application &app)
|
||||
void HighlightController::initialize(Settings &settings, Paths &paths)
|
||||
{
|
||||
assert(!this->initialized_);
|
||||
this->initialized_ = true;
|
||||
|
||||
@@ -10,16 +10,19 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Settings;
|
||||
class Paths;
|
||||
|
||||
class UserHighlightModel;
|
||||
class HighlightModel;
|
||||
class HighlightBlacklistModel;
|
||||
|
||||
class HighlightController : public Singleton
|
||||
class HighlightController final : public Singleton
|
||||
{
|
||||
public:
|
||||
HighlightController();
|
||||
|
||||
virtual void initialize(Application &app) override;
|
||||
virtual void initialize(Settings &settings, Paths &paths) override;
|
||||
|
||||
UnsortedSignalVector<HighlightPhrase> phrases;
|
||||
UnsortedSignalVector<HighlightBlacklistUser> blacklistedUsers;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
void IgnoreController::initialize(Application &)
|
||||
void IgnoreController::initialize(Settings &, Paths &)
|
||||
{
|
||||
assert(!this->initialized_);
|
||||
this->initialized_ = true;
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Settings;
|
||||
class Paths;
|
||||
|
||||
class IgnoreModel;
|
||||
|
||||
class IgnoreController : public Singleton
|
||||
class IgnoreController final : public Singleton
|
||||
{
|
||||
public:
|
||||
virtual void initialize(Application &app) override;
|
||||
virtual void initialize(Settings &settings, Paths &paths) override;
|
||||
|
||||
UnsortedSignalVector<IgnorePhrase> phrases;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "ModerationAction.hpp"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include "Application.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
|
||||
@@ -57,7 +58,7 @@ ModerationAction::ModerationAction(const QString &action)
|
||||
// this->_moderationActions.emplace_back(app->resources->buttonTimeout, str);
|
||||
// }
|
||||
} else if (action.startsWith("/ban ")) {
|
||||
this->image_ = getApp()->resources->buttonBan;
|
||||
this->image_ = Image::fromNonOwningPixmap(&getApp()->resources->buttons.ban);
|
||||
} else {
|
||||
QString xD = action;
|
||||
|
||||
@@ -75,10 +76,10 @@ bool ModerationAction::operator==(const ModerationAction &other) const
|
||||
|
||||
bool ModerationAction::isImage() const
|
||||
{
|
||||
return this->image_ != nullptr;
|
||||
return bool(this->image_);
|
||||
}
|
||||
|
||||
Image *ModerationAction::getImage() const
|
||||
const boost::optional<ImagePtr> &ModerationAction::getImage() const
|
||||
{
|
||||
return this->image_;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <boost/optional.hpp>
|
||||
#include <pajlada/settings/serialize.hpp>
|
||||
|
||||
#include "messages/Image.hpp"
|
||||
#include "util/RapidjsonHelpers.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Image;
|
||||
|
||||
class ModerationAction
|
||||
{
|
||||
public:
|
||||
@@ -17,13 +17,13 @@ public:
|
||||
bool operator==(const ModerationAction &other) const;
|
||||
|
||||
bool isImage() const;
|
||||
Image *getImage() const;
|
||||
const boost::optional<ImagePtr> &getImage() const;
|
||||
const QString &getLine1() const;
|
||||
const QString &getLine2() const;
|
||||
const QString &getAction() const;
|
||||
|
||||
private:
|
||||
Image *image_ = nullptr;
|
||||
boost::optional<ImagePtr> image_;
|
||||
QString line1_;
|
||||
QString line2_;
|
||||
QString action_;
|
||||
|
||||
@@ -12,7 +12,7 @@ ModerationActions::ModerationActions()
|
||||
{
|
||||
}
|
||||
|
||||
void ModerationActions::initialize(Application &app)
|
||||
void ModerationActions::initialize(Settings &settings, Paths &paths)
|
||||
{
|
||||
assert(!this->initialized_);
|
||||
this->initialized_ = true;
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Settings;
|
||||
class Paths;
|
||||
|
||||
class ModerationActionModel;
|
||||
|
||||
class ModerationActions final : public Singleton
|
||||
@@ -15,7 +18,7 @@ class ModerationActions final : public Singleton
|
||||
public:
|
||||
ModerationActions();
|
||||
|
||||
virtual void initialize(Application &app) override;
|
||||
virtual void initialize(Settings &settings, Paths &paths) override;
|
||||
|
||||
UnsortedSignalVector<ModerationAction> items;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace chatterino {
|
||||
|
||||
class TaggedUsersModel;
|
||||
|
||||
class TaggedUsersController : public Singleton
|
||||
class TaggedUsersController final : public Singleton
|
||||
{
|
||||
public:
|
||||
TaggedUsersController();
|
||||
|
||||
Reference in New Issue
Block a user