blob: 6928db9d6a42d97d82839b97196b313915d323da (
plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* Copyright (c) 2020, Hunter Salyer <thefalsehonesty@gmail.com>
* Copyright (c) 2021-2022, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Function.h>
#include <AK/Vector.h>
#include <QWidget>
class QLineEdit;
class QTextEdit;
namespace Ladybird {
class ConsoleWidget final : public QWidget {
Q_OBJECT
public:
ConsoleWidget();
virtual ~ConsoleWidget() = default;
void notify_about_new_console_message(i32 message_index);
void handle_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages);
void print_source_line(StringView);
void print_html(StringView);
void reset();
Function<void(DeprecatedString const&)> on_js_input;
Function<void(i32)> on_request_messages;
private:
void request_console_messages();
void clear_output();
QTextEdit* m_output_view { nullptr };
QLineEdit* m_input { nullptr };
i32 m_highest_notified_message_index { -1 };
i32 m_highest_received_message_index { -1 };
bool m_waiting_for_messages { false };
};
}
|