aboutsummaryrefslogtreecommitdiff
path: root/src/InputMediator.hpp
blob: 2cd34f2f02df5c781218b2346c883ff755fc90c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include <QWidget>
#include <QtCore>

#include "LuaRuntime.hpp"
#include "keymap/KeymapEvaluator.hpp"
#include "utils.hpp"
#include "widgets/WebViewStack.hpp"

class InputMediator : public QObject {
  Q_OBJECT

public:
  InputMediator(WebViewStack *web_view_stack, LuaRuntime *lua_runtime,
                KeymapEvaluator *keymap_evaluator);
  ~InputMediator() override;

  DELEGATE(web_view_stack, open_url, open_url)
  DELEGATE(web_view_stack, current_url, current_url)
  DELEGATE(web_view_stack, next, next_web_view)
  DELEGATE(web_view_stack, previous, previous_web_view)
  DELEGATE(web_view_stack, close_current, close_current_web_view)
  DELEGATE(keymap_evaluator, evaluate, evaluate_keymap)

protected:
  void add_keymap(const QString &mode_string, const QString &keyseq,
                  std::function<void()> action);

private:
  WebViewStack *web_view_stack;
  LuaRuntime *lua_runtime;
  KeymapEvaluator *keymap_evaluator;
};