cutter/src/widgets/ConsoleWidget.h
xarkes ab27e09b91 Splitted Cutter.h and moved everything in core (#1201)
Sometimes it is not necessary to include the whole Cutter.h file
Hence, it's been splitted so you can include only what you require
E.g. #include "core/CutterCommon.h" to have access to the common types
2019-02-22 17:50:45 +01:00

71 lines
1.3 KiB
C++

#ifndef CONSOLEWIDGET_H
#define CONSOLEWIDGET_H
#include <memory>
#include "core/MainWindow.h"
#include "CutterDockWidget.h"
#include "common/CommandTask.h"
namespace Ui {
class ConsoleWidget;
}
class ConsoleWidget : public CutterDockWidget
{
Q_OBJECT
public:
explicit ConsoleWidget(MainWindow *main, QAction *action = nullptr);
~ConsoleWidget();
void setDebugOutputEnabled(bool enabled)
{
debugOutputEnabled = enabled;
}
void setMaxHistoryEntries(int max)
{
maxHistoryEntries = max;
}
public slots:
void focusInputLineEdit();
void addOutput(const QString &msg);
void addDebugOutput(const QString &msg);
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();
void removeLastLine();
void executeCommand(const QString &command);
QSharedPointer<CommandTask> commandTask;
std::unique_ptr<Ui::ConsoleWidget> ui;
QList<QAction *> actions;
bool debugOutputEnabled;
int maxHistoryEntries;
int lastHistoryPosition;
QStringList history;
};
#endif // CONSOLEWIDGET_H