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
|
|
|
|
2018-06-28 20:25:37 +02:00
|
|
|
#include "common/SignalVector.hpp"
|
2018-06-26 17:20:03 +02:00
|
|
|
#include "controllers/commands/Command.hpp"
|
2018-04-30 23:30:05 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
class Channel;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2018-06-26 17:06:17 +02:00
|
|
|
UnsortedSignalVector<Command> items;
|
2018-04-30 23:30:05 +02:00
|
|
|
|
|
|
|
private:
|
2018-07-06 18:10:21 +02:00
|
|
|
QMap<QString, Command> commandsMap_;
|
2018-04-30 23:30:05 +02:00
|
|
|
|
2018-07-06 18:10:21 +02:00
|
|
|
std::mutex mutex_;
|
|
|
|
QString filePath_;
|
2018-04-30 23:30:05 +02:00
|
|
|
|
|
|
|
QString execCustomCommand(const QStringList &words, const Command &command);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|