cutter/src/widgets/ConsoleWidget.h

61 lines
1.2 KiB
C
Raw Normal View History

#ifndef CONSOLEWIDGET_H
#define CONSOLEWIDGET_H
#include <QWidget>
2017-10-02 09:41:28 +00:00
#include <memory>
2017-10-03 18:38:34 +00:00
#include "MainWindow.h"
namespace Ui
{
class ConsoleWidget;
}
class ConsoleWidget : public QWidget
{
Q_OBJECT
public:
2017-10-09 18:08:35 +00:00
explicit ConsoleWidget(QWidget *parent = 0);
~ConsoleWidget();
void addOutput(const QString &msg);
void addDebugOutput(const QString &msg);
void setDebugOutputEnabled(bool enabled) { debugOutputEnabled = enabled; }
void setMaxHistoryEntries(int max) { maxHistoryEntries = max; }
public slots:
void focusInputLineEdit();
private slots:
void setupFont();
void on_inputLineEdit_returnPressed();
void on_execButton_clicked();
void showCustomContextMenu(const QPoint &pt);
void historyNext();
void historyPrev();
void clear();
private:
void scrollOutputToEnd();
void historyAdd(const QString &input);
void invalidateHistoryPosition();
2017-10-03 18:38:34 +00:00
QString executeCommand(QString command);
2017-10-02 09:41:28 +00:00
std::unique_ptr<Ui::ConsoleWidget> ui;
QList<QAction *> actions;
bool debugOutputEnabled;
int maxHistoryEntries;
int lastHistoryPosition;
QStringList history;
};
#endif // CONSOLEWIDGET_H