diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-16 14:39:57 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-16 14:39:57 +0530 |
| commit | 350d2bd7ccf80b91abdff154344f0ce88080a195 (patch) | |
| tree | deaee10aeec4594f02daa314c843a438f2346337 /src/InputMediator.cpp | |
| parent | 5a2a6aef3703d6aaaee24d9436da9e60ffcae769 (diff) | |
| download | null-browser-350d2bd7ccf80b91abdff154344f0ce88080a195.tar.gz null-browser-350d2bd7ccf80b91abdff154344f0ce88080a195.zip | |
Add tab selector listing and evaluation
Diffstat (limited to '')
| -rw-r--r-- | src/InputMediator.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/InputMediator.cpp b/src/InputMediator.cpp index ee7a552..6c797a3 100644 --- a/src/InputMediator.cpp +++ b/src/InputMediator.cpp @@ -1,3 +1,4 @@ +#include <QList> #include <QWidget> #include <QtCore> @@ -28,14 +29,17 @@ InputMediator::InputMediator(InputLine *inputLine, WebViewStack *webViewStack, void InputMediator::onInputSubmit(QString input) { hideInputLine(); + // Evaluate input from command if (dynamic_cast<CommandEval *>(currentEvaluationType)) return evaluateCommand(input); + // Evaluate input from url if (auto urlEval = dynamic_cast<UrlEval *>(currentEvaluationType)) return webViewStack->openUrl(input, urlEval->type()); - if (dynamic_cast<BufferEval *>(currentEvaluationType)) - return webViewStack->focusWebView(1); + // Evaluate input from tab list + if (dynamic_cast<TabsEval *>(currentEvaluationType)) + return webViewStack->focusWebView(input.toLong()); } void InputMediator::hideInputLine() { @@ -56,9 +60,10 @@ void InputMediator::showCommandInput(QString cmd) { showInputLine(); } -void InputMediator::showBufferInput(QString url) { - setEvaluationType(new CommandEval()); - inputLine->setAdapter(new TabsAdapter); +void InputMediator::showTabsInput(QString url) { + setEvaluationType(new TabsEval()); + QList<Tab> tabs = webViewStack->getTabList(); + inputLine->setAdapter(new TabsAdapter(tabs)); inputLine->setInputText(url); showInputLine(); } @@ -103,7 +108,7 @@ void InputMediator::evaluateCommand(QString command) { previousWebView(); break; case CommandType::TabSelect: - showBufferInput(); + showTabsInput(); // focusWebView(long index) // TODO: parse index and select break; case CommandType::Noop: |
