aboutsummaryrefslogtreecommitdiff
path: root/src/InputMediator.hpp
blob: 5933bd7d2611d5e798d5cab29b9f5cdcd9ac6abe (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 *webview_stack, LuaRuntime *lua_runtime,
                KeymapEvaluator *keymap_evaluator);
  ~InputMediator() override;

  DELEGATE(webview_stack, open_url, open_url)
  DELEGATE(webview_stack, current_url, current_url)
  DELEGATE(webview_stack, next, next_webview)
  DELEGATE(webview_stack, previous, previous_webview)
  DELEGATE(webview_stack, close_current, close_current_webview)
  DELEGATE(keymap_evaluator, evaluate, evaluate_keymap)

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

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