aboutsummaryrefslogtreecommitdiff
path: root/include/widgets
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-11 11:31:14 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-11 11:44:31 +0530
commit12d0ce37db7323e8efd56d6a698a98abcb8d680b (patch)
treeec2102d40326a332b2ecb976869585f81cba8574 /include/widgets
parent971854bfefad4c644ac3d5f5d6003f24d551bf1d (diff)
downloadnull-browser-12d0ce37db7323e8efd56d6a698a98abcb8d680b.tar.gz
null-browser-12d0ce37db7323e8efd56d6a698a98abcb8d680b.zip
Add command+url adapter and switching
Diffstat (limited to 'include/widgets')
-rw-r--r--include/widgets/InputLine.hpp (renamed from include/widgets/CommandInput.hpp)10
-rw-r--r--include/widgets/MainWindow.hpp11
2 files changed, 14 insertions, 7 deletions
diff --git a/include/widgets/CommandInput.hpp b/include/widgets/InputLine.hpp
index 3ce9500..2324f18 100644
--- a/include/widgets/CommandInput.hpp
+++ b/include/widgets/InputLine.hpp
@@ -1,19 +1,23 @@
#pragma once
#include <QBoxLayout>
+#include <QLabel>
#include <QLineEdit>
#include <QWidget>
#include <QtCore>
-class CommandInput : public QWidget {
+#include "completion/Adapter.hpp"
+
+class InputLine : public QWidget {
Q_OBJECT
public:
- CommandInput(QString defaultInput = "", QWidget *parentNode = nullptr);
+ 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);
@@ -26,4 +30,6 @@ protected:
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;
};