aboutsummaryrefslogtreecommitdiff
path: root/include/widgets
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/widgets/CommandInput.hpp29
-rw-r--r--include/widgets/InputLine.hpp35
-rw-r--r--include/widgets/MainWindow.hpp11
3 files changed, 41 insertions, 34 deletions
diff --git a/include/widgets/CommandInput.hpp b/include/widgets/CommandInput.hpp
deleted file mode 100644
index 3ce9500..0000000
--- a/include/widgets/CommandInput.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#pragma once
-
-#include <QBoxLayout>
-#include <QLineEdit>
-#include <QWidget>
-#include <QtCore>
-
-class CommandInput : public QWidget {
- Q_OBJECT
-
-public:
- CommandInput(QString defaultInput = "", QWidget *parentNode = nullptr);
- void setInputFocus(bool focussed);
- bool isInputFocussed();
- QString getInputCommand();
- void setInputText(QString text);
-
-signals:
- void submitted(QString command);
- void cancelled();
-
-protected:
- void keyPressEvent(QKeyEvent *event) override;
- void emitSubmit();
-
-private:
- QBoxLayout *layout;
- QLineEdit *input;
-};
diff --git a/include/widgets/InputLine.hpp b/include/widgets/InputLine.hpp
new file mode 100644
index 0000000..2324f18
--- /dev/null
+++ b/include/widgets/InputLine.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <QBoxLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QWidget>
+#include <QtCore>
+
+#include "completion/Adapter.hpp"
+
+class InputLine : public QWidget {
+ Q_OBJECT
+
+public:
+ InputLine(QString defaultInput = "", QWidget *parentNode = nullptr);
+ void setInputFocus(bool focussed);
+ bool isInputFocussed();
+ QString getInputCommand();
+ void setInputText(QString text);
+ void setAdapter(Adapter *adapter);
+
+signals:
+ void submitted(QString command);
+ void cancelled();
+
+protected:
+ void keyPressEvent(QKeyEvent *event) override;
+ void emitSubmit();
+
+private:
+ QBoxLayout *layout;
+ QLineEdit *input;
+ QLabel *promptPrefix;
+ Adapter *adapter = nullptr;
+};
diff --git a/include/widgets/MainWindow.hpp b/include/widgets/MainWindow.hpp
index 7f54ce2..b64bf8c 100644
--- a/include/widgets/MainWindow.hpp
+++ b/include/widgets/MainWindow.hpp
@@ -7,7 +7,7 @@
#include "LuaRuntime.hpp"
#include "widgets/BrowserManager.hpp"
-#include "widgets/CommandInput.hpp"
+#include "widgets/InputLine.hpp"
class MainWindow : public QMainWindow {
public:
@@ -15,14 +15,15 @@ public:
protected:
void keyPressEvent(QKeyEvent *event) override;
- void toggleURLInput();
void evaluateCommand(QString command);
- void hideURLInput();
- void showURLInput();
+ void hideInputLine();
+ void showInputLine();
+ void showURLInput(QString url = "");
+ void showCommandInput(QString command = "");
private:
BrowserManager *browserManager;
- CommandInput *commandInput;
+ InputLine *inputLine;
LuaRuntime *luaRuntime;
QStackedLayout *layout;
};