2018-04-30 23:30:05 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QMap>
|
|
|
|
#include <memory>
|
2018-06-05 18:51:14 +02:00
|
|
|
#include <mutex>
|
2018-04-30 23:30:05 +02:00
|
|
|
|
|
|
|
#include "controllers/commands/command.hpp"
|
|
|
|
#include "util/signalvector2.hpp"
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
class Channel;
|
|
|
|
|
|
|
|
namespace controllers {
|
|
|
|
namespace commands {
|
|
|
|
|
|
|
|
class CommandModel;
|
|
|
|
|
|
|
|
class CommandController
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CommandController();
|
|
|
|
|
|
|
|
QString execCommand(const QString &text, std::shared_ptr<Channel> channel, bool dryRun);
|
2018-06-24 13:56:56 +02:00
|
|
|
QStringList getDefaultTwitchCommandList();
|
2018-04-30 23:30:05 +02:00
|
|
|
|
|
|
|
void load();
|
|
|
|
void save();
|
|
|
|
|
|
|
|
CommandModel *createModel(QObject *parent);
|
|
|
|
|
|
|
|
util::UnsortedSignalVector<Command> items;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QMap<QString, Command> commandsMap;
|
|
|
|
|
|
|
|
std::mutex mutex;
|
|
|
|
QString filePath;
|
|
|
|
|
|
|
|
QString execCustomCommand(const QStringList &words, const Command &command);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace commands
|
|
|
|
} // namespace controllers
|
|
|
|
} // namespace chatterino
|