Fix comment end after SPDX identifier
[gd/wireshark/.git] / ui / qt / widgets / follow_stream_text.cpp
1 /* follow_stream_text.cpp
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9
10 #include <ui/qt/widgets/follow_stream_text.h>
11
12 #include <wireshark_application.h>
13
14 #include <QMouseEvent>
15 #include <QTextCursor>
16
17 // To do:
18 // - Draw text by hand similar to ByteViewText. This would let us add
19 //   extra information, e.g. a timestamp column and get rid of
20 //   max_document_length_ in FollowStreamDialog.
21
22 FollowStreamText::FollowStreamText(QWidget *parent) :
23     QPlainTextEdit(parent)
24 {
25     setMouseTracking(true);
26 //    setMaximumBlockCount(1);
27     QTextDocument *text_doc = document();
28     text_doc->setDefaultFont(wsApp->monospaceFont());
29 }
30
31 void FollowStreamText::mouseMoveEvent(QMouseEvent *event)
32 {
33     emit mouseMovedToTextCursorPosition(cursorForPosition(event->pos()).position());
34     QPlainTextEdit::mouseMoveEvent(event);
35 }
36
37 void FollowStreamText::mousePressEvent(QMouseEvent *event)
38 {
39     emit mouseClickedOnTextCursorPosition(cursorForPosition(event->pos()).position());
40     QPlainTextEdit::mousePressEvent(event);
41 }
42
43 void FollowStreamText::leaveEvent(QEvent *event)
44 {
45     emit mouseMovedToTextCursorPosition(-1);
46     QPlainTextEdit::leaveEvent(event);
47 }
48
49 /*
50  * Editor modelines
51  *
52  * Local Variables:
53  * c-basic-offset: 4
54  * tab-width: 8
55  * indent-tabs-mode: nil
56  * End:
57  *
58  * ex: set shiftwidth=4 tabstop=8 expandtab:
59  * :indentSize=4:tabSize=8:noTabs=true:
60  */