2022-08-19 15:59:36 +02:00
|
|
|
// 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
|
2017-12-04 16:04:04 +01:00
|
|
|
|
|
|
|
|
#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:
|
2018-11-24 20:37:59 +01:00
|
|
|
void keyPressEvent(QKeyEvent *event) final;
|
2017-12-04 16:04:04 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QStringList m_history;
|
|
|
|
|
int m_maxEntries; // TODO: add to settings
|
|
|
|
|
int m_currentEntryIndex = 0;
|
|
|
|
|
QString m_editingEntry;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace SerialTerminal
|