You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
697 B
34 lines
697 B
// SPDX-License-Identifier: BSD-3-Clause
|
|
// Copyright (c) 2021, The Monero Project.
|
|
|
|
#ifndef MONEROSERVICE_COMMANDLINEEDIT_H
|
|
#define MONEROSERVICE_COMMANDLINEEDIT_H
|
|
|
|
#include <QObject>
|
|
#include <QLineEdit>
|
|
|
|
class CommandLineEdit : public QLineEdit {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit CommandLineEdit(QWidget *parent = nullptr);
|
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
signals:
|
|
void commandExecuted(const QStringList &command);
|
|
|
|
private:
|
|
void updateHistory();
|
|
bool decreaseIndex();
|
|
bool increaseIndex();
|
|
QString getCommand(int index);
|
|
|
|
QString m_currentLine;
|
|
int m_historyIndex = 1;
|
|
QStringList m_history;
|
|
};
|
|
|
|
|
|
#endif //MONEROSERVICE_COMMANDLINEEDIT_H
|