11 #include <pajlada/settings.hpp> 15 #include <unordered_map> 31 QString
execCommand(
const QString &text, std::shared_ptr<Channel> channel,
36 virtual void save()
override;
41 const QStringList &words,
const Command &command,
bool dryRun,
43 std::unordered_map<QString, QString> context = {});
46 void load(
Paths &paths);
48 using CommandFunction =
49 std::function<QString(QStringList ,
ChannelPtr )>;
51 using CommandFunctionWithContext = std::function<QString(CommandContext)>;
53 using CommandFunctionVariants =
54 std::variant<CommandFunction, CommandFunctionWithContext>;
56 void registerCommand(
const QString &commandName,
57 CommandFunctionVariants commandFunction);
60 std::unordered_map<QString, CommandFunctionVariants> commands_;
63 QMap<QString, Command> userCommands_;
66 std::shared_ptr<pajlada::Settings::SettingManager> sm_;
71 std::unique_ptr<pajlada::Settings::Setting<std::vector<Command>>>
74 QStringList defaultChatterinoCommandAutoCompletions_;
Definition: Command.hpp:10
Definition: Singleton.hpp:10
Definition: Application.cpp:48
Definition: CommandController.hpp:26
CommandModel * createModel(QObject *parent)
Definition: CommandController.cpp:3136
QString execCustomCommand(const QStringList &words, const Command &command, bool dryRun, ChannelPtr channel, const Message *message=nullptr, std::unordered_map< QString, QString > context={})
Definition: CommandController.cpp:3233
Settings which are availlable for reading and writing on the gui thread.
Definition: Settings.hpp:78
QString execCommand(const QString &text, std::shared_ptr< Channel > channel, bool dryRun)
Definition: CommandController.cpp:3144
Definition: Message.hpp:54
virtual void initialize(Settings &, Paths &paths) override
Definition: CommandController.cpp:555
Definition: CommandModel.hpp:12
std::shared_ptr< Channel > ChannelPtr
Definition: Channel.hpp:125
QStringList getDefaultChatterinoCommandList()
Definition: CommandController.cpp:3332
virtual void save() override
Definition: CommandController.cpp:3131
SignalVector< Command > items
Definition: CommandController.hpp:29