#include #include #include #include "CommandParser.hpp" #include "InputMediator.hpp" #include "LuaRuntime.hpp" #include "widgets/WebViewStack.hpp" InputMediator::InputMediator(WebViewStack *webViewStack, LuaRuntime *luaRuntime) : QObject(), webViewStack(webViewStack), luaRuntime(luaRuntime) { connect(luaRuntime, &LuaRuntime::urlOpened, webViewStack, &WebViewStack::openUrl); } void InputMediator::evaluateCommand(QString command) { CommandParser parser; auto cmd = parser.parse(command); switch (cmd.command) { case CommandType::LuaEval: luaRuntime->evaluate(cmd.argsString); break; case CommandType::Open: openUrl(cmd.argsString, OpenType::OpenUrl); break; case CommandType::TabOpen: openUrl(cmd.argsString, OpenType::OpenUrlInTab); break; case CommandType::TabNext: nextWebView(); break; case CommandType::TabPrev: previousWebView(); break; case CommandType::TabSelect: webViewStack->focusWebView(cmd.argsString.toLong()); break; case CommandType::Noop: break; } }