2017-04-26 22:56:19 +00:00
|
|
|
#ifndef CONSOLEWIDGET_H
|
|
|
|
#define CONSOLEWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class QRCore;
|
|
|
|
|
2017-04-27 23:57:13 +00:00
|
|
|
class QAction;
|
|
|
|
|
2017-04-26 22:56:19 +00:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class ConsoleWidget;
|
|
|
|
}
|
|
|
|
|
2017-04-27 23:57:13 +00:00
|
|
|
|
2017-04-26 22:56:19 +00:00
|
|
|
class ConsoleWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ConsoleWidget(QRCore *core, QWidget *parent = 0);
|
|
|
|
~ConsoleWidget();
|
|
|
|
|
|
|
|
void addOutput(const QString &msg);
|
|
|
|
void addDebugOutput(const QString &msg);
|
|
|
|
|
2017-04-27 23:57:13 +00:00
|
|
|
void setDebugOutputEnabled(bool enabled) { debugOutputEnabled = enabled; }
|
|
|
|
|
|
|
|
void setMaxHistoryEntries(int max) { maxHistoryEntries = max; }
|
|
|
|
|
2017-04-26 22:56:19 +00:00
|
|
|
public slots:
|
|
|
|
void focusInputLineEdit();
|
|
|
|
|
|
|
|
private slots:
|
2017-04-27 23:57:13 +00:00
|
|
|
void on_inputLineEdit_returnPressed();
|
|
|
|
|
|
|
|
void on_execButton_clicked();
|
2017-04-26 22:56:19 +00:00
|
|
|
|
2017-04-27 23:57:13 +00:00
|
|
|
void showCustomContextMenu(const QPoint &pt);
|
2017-04-26 22:56:19 +00:00
|
|
|
|
2017-04-27 23:57:13 +00:00
|
|
|
void syncWithCoreToggled(bool checked);
|
2017-04-26 22:56:19 +00:00
|
|
|
|
2017-04-27 23:57:13 +00:00
|
|
|
void historyNext();
|
|
|
|
void historyPrev();
|
2017-04-26 22:56:19 +00:00
|
|
|
|
2017-04-27 23:57:13 +00:00
|
|
|
void clear();
|
2017-04-26 22:56:19 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-27 23:57:13 +00:00
|
|
|
void scrollOutputToEnd();
|
|
|
|
void historyAdd(const QString &input);
|
|
|
|
void invalidateHistoryPosition();
|
|
|
|
|
2017-04-26 22:56:19 +00:00
|
|
|
Ui::ConsoleWidget *ui;
|
|
|
|
QRCore *core;
|
2017-04-27 23:57:13 +00:00
|
|
|
QList<QAction *> actions;
|
|
|
|
bool debugOutputEnabled;
|
|
|
|
int maxHistoryEntries;
|
|
|
|
int lastHistoryPosition;
|
|
|
|
QStringList history;
|
2017-04-26 22:56:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CONSOLEWIDGET_H
|