aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/serialterminal/consolelineedit.h
blob: 2dd27029b4b3855945de24eb22afc950e94a48f1 (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
// Copyright (C) 2018 Benjamin Balga
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QLineEdit>

namespace SerialTerminal {
namespace Internal {

class ConsoleLineEdit : public QLineEdit
{
public:
    explicit ConsoleLineEdit(QWidget *parent = nullptr);

    void addHistoryEntry();
    void loadHistoryEntry(int entryIndex);

protected:
    void keyPressEvent(QKeyEvent *event) final;

private:
    QStringList m_history;
    int m_maxEntries; // TODO: add to settings
    int m_currentEntryIndex = 0;
    QString m_editingEntry;
};

} // namespace Internal
} // namespace SerialTerminal