From 350d2bd7ccf80b91abdff154344f0ce88080a195 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 16 Mar 2025 14:39:57 +0530 Subject: Add tab selector listing and evaluation --- src/InputMediator.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/InputMediator.cpp') 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 #include #include @@ -28,14 +29,17 @@ InputMediator::InputMediator(InputLine *inputLine, WebViewStack *webViewStack, void InputMediator::onInputSubmit(QString input) { hideInputLine(); + // Evaluate input from command if (dynamic_cast(currentEvaluationType)) return evaluateCommand(input); + // Evaluate input from url if (auto urlEval = dynamic_cast(currentEvaluationType)) return webViewStack->openUrl(input, urlEval->type()); - if (dynamic_cast(currentEvaluationType)) - return webViewStack->focusWebView(1); + // Evaluate input from tab list + if (dynamic_cast(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 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: -- cgit v1.3.1