From 934d2299aa6b25026f4daed3e4e9f698cf7be74a Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Sun, 19 Nov 2023 09:41:37 +0100 Subject: [PATCH] WIP left menu bar wit tools & short cuts. --- app/app.pro | 2 + app/mf-resources.qrc | 5 + app/resources/icons/arxiv.png | Bin 0 -> 3103 bytes app/resources/icons/duckduckgo.png | Bin 0 -> 6027 bytes app/resources/icons/h2oai.png | Bin 0 -> 1839 bytes app/resources/icons/stackoverflow.png | Bin 0 -> 3152 bytes app/resources/icons/wikipedia.png | Bin 0 -> 3163 bytes app/src/qt/dialogs/run_tool_dialog.cpp | 10 +- app/src/qt/dialogs/run_tool_dialog.h | 2 +- app/src/qt/left_toolbar_view.cpp | 60 ++++++++ app/src/qt/left_toolbar_view.h | 72 ++++++++++ app/src/qt/main_menu_presenter.cpp | 8 -- app/src/qt/main_menu_view.cpp | 53 ------- app/src/qt/main_menu_view.h | 9 -- app/src/qt/main_window_presenter.cpp | 185 +++++++++++++++++++------ app/src/qt/main_window_presenter.h | 14 +- app/src/qt/main_window_view.cpp | 3 + app/src/qt/main_window_view.h | 4 + app/src/qt/note_edit_view.cpp | 4 + app/src/qt/note_editor_view.cpp | 18 ++- app/src/qt/note_editor_view.h | 3 + lib/src/config/configuration.h | 1 + 22 files changed, 325 insertions(+), 128 deletions(-) create mode 100644 app/resources/icons/arxiv.png create mode 100644 app/resources/icons/duckduckgo.png create mode 100644 app/resources/icons/h2oai.png create mode 100644 app/resources/icons/stackoverflow.png create mode 100644 app/resources/icons/wikipedia.png create mode 100644 app/src/qt/left_toolbar_view.cpp create mode 100644 app/src/qt/left_toolbar_view.h diff --git a/app/app.pro b/app/app.pro index 7076e7e7..bc06ec1f 100644 --- a/app/app.pro +++ b/app/app.pro @@ -285,6 +285,7 @@ HEADERS += \ src/qt/kanban_column_view.h \ src/qt/kanban_presenter.h \ src/qt/kanban_view.h \ + src/qt/left_toolbar_view.h \ src/qt/note_smart_editor.h \ src/qt/organizer_view.h \ src/qt/organizer_presenter.h \ @@ -412,6 +413,7 @@ SOURCES += \ src/qt/kanban_column_view.cpp \ src/qt/kanban_presenter.cpp \ src/qt/kanban_view.cpp \ + src/qt/left_toolbar_view.cpp \ src/qt/note_smart_editor.cpp \ src/qt/organizer_view.cpp \ src/qt/organizer_presenter.cpp \ diff --git a/app/mf-resources.qrc b/app/mf-resources.qrc index 36bc6a29..75907a22 100644 --- a/app/mf-resources.qrc +++ b/app/mf-resources.qrc @@ -18,6 +18,11 @@ resources/icons/flat-think.svg resources/icons/flat-adapt.svg resources/icons/flat-help.svg + resources/icons/arxiv.png + resources/icons/wikipedia.png + resources/icons/stackoverflow.png + resources/icons/duckduckgo.png + resources/icons/h2oai.png resources/qt/translations/mindforger_cs.qm diff --git a/app/resources/icons/arxiv.png b/app/resources/icons/arxiv.png new file mode 100644 index 0000000000000000000000000000000000000000..08e504b67479150d310b44750ce0f7efecb050b3 GIT binary patch literal 3103 zcmV+)4B+#LP)RA@u(S_yDf)fxWo+p_3O$R74BKqw#x(rRVYK`OM>szU{I zMA32Tv{SLxDKc7>sWC6zRRlrDAqg~)Kp;T!!j?UG%YFU+ zbKjnq+?SUZgpOx`ci%n#Ip_cW^*e9S-WWC3kG_V?YJEzaQ}h-nlba6Bs{6574VM81zF6ZjU@01b!l6Yxr$nKz*n-hjI<_5{wVa@Q zZ|x{07E0|V3AZIb!AG`H^&EJoRN`}NJB?LU%?BeVrri!=>y1()VZcFW_tjF(+Gk(w z)@*I6{M<8#`^qtyi~SqaB=|nalzP+9Z2wdt>t&yw9`4K3W^RZV27T3qSf$MNPk}L_ zJvRIpTMA7xvqICIBVbv_CTX7#etu3%gBya<(7>4U?Y5W|3XM<{6mt^Ox zio_sRSI*K|Ca9F;k-?i8ZV`gvs1C>n=8W9qAFh?q>^yc9K0Xh<{Bn9yhjZ*$v>vEM z^OqGWPwmCUxahg3kx6eJd}|Y`f3q4^uG6hNkLy}%YH{p?_i^N{chOQ&3Ao)x=u32P zXp-B)=_4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H=K-CV62RwD8m9!X8Ffs`AZD8;>F1OHHamNe tbT>OT?!2u}>xX}=N^0`~EgGb={|7?vEdO45sdWGV002ovPDHLkV1fi#_9FlQ literal 0 HcmV?d00001 diff --git a/app/resources/icons/duckduckgo.png b/app/resources/icons/duckduckgo.png new file mode 100644 index 0000000000000000000000000000000000000000..66e630a6de88fe8f5b0cbf80eee4daeaf95cee3e GIT binary patch literal 6027 zcmV;67j)=}P)QA*RC_@BsNAcM)A zk_-kv8KefuY_5{bmaUS-TIm>FvD0&_*R8_&$BnXkfO%oZ+R=g}^kWGSMO;L!sol3-TEk0up z3`Qf7Q3lg-5AKsprdklb)ST~mx$OB*)*UV3M@4YWtn7>PJSqi^UjR1X0Z4WRg+}2oCy4sXIXNJzFTYeIq5RcT&>d zs&kz;2gFOVDK6*Qmzq5#kC!d{=!gkFB7*Dgx^zgaw)*#KIC#0HsuB~*+%mfJDfi@w zc|~MB zVGP+%pF%lfPNifxNP)kERIFXM%k%%yanu zwc<%7;F|&Q1xMo~D8n**OPDQ-zdCx6{)@!T?b_uR7i&i>}_RCJoKOS znMGdql#+eoRB}(dTG#;ZyDw5;<@?w`MTk1SQ_SvyN6VjG@{qw@r0;4kqfZ3aKX^m` z=#I))l~C{;0$0IZi0+T5@Wu!5U^BJ6wU9zzFDES)P3tI#JO)F9j+2^z*t^Mj&c&2> z*-TPu_fyjg^C`A#Gf5Vk5Odk-e#=oY=_b!zkM-)xdL_7N{;cDJo7cSueI3i3WfxL# zQugbHWgPk~h*QuCq(;yZ#nGdc4<&pq*nmlWOitiQX}bW3p4qqpS; zzhC_^h@Bvab>>sq?_MCumP@q{-Au}Xy=1W3+U7N|?@hv&rm_G9`(Go(TezWPG@$1x zsE%!P1(n|a9L2VNPxVjU1DgWN5C08LzgIGI&egUvFG_Uv#4cBos$64i`rwsCYS2Gb z5DWiVHh+--L^Tgghk>dkg9Rd-82}loE1ygw#*+;e);eS)nac*ks5u1qNJT=zKeHh_ zYOxoP)I=)WUF5reQ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Udo!D zMkqr`h7^+IK}iNhJ=K_(Jt7u}uic37t|KlNlvhc@zqi9i=!18JP z5lunLFCAisqOxU+3>j0l%>6v&C0nDQvLs8#(2n`9MaCM( zzf_xeJ8uz#yn^00y&tFUtsGHGTSQ_O_lQ|^d@S$=vh6Wtt}vP#NTF)!TZU$tvZ;6E|MBn^DMBJfYbj^l!DnSL;}-d~H$aNwDdWUksxY-I z@~@OHTU29#FGV%0c+AH=)qVe1d+c46vQHM?CyR_=Q7%#})mElxs=Zoed2fY+8J{gh zx7feoW6`<{DVv6RBl)E-=1#F-8Dl}2vh37!P*ALp(&?KlgMCJ1Uz|!c)yL92#)SW? zXc^+(|6?H7FC1)6Y8NhC7!*c(CHy4wvBR%(K2q8OJbhF5R*0f&KYumrtmH-~eHdU* z&Tqkj1z9acH2z4UeQQ}|->!o;ipH*EeLZSLeLP)l-)drnEex{#q^4E@)xm=YhbtemplateEdit->setText(getTemplateTextForToolName(text)); + this->templateEdit->setText(getTemplateTextForToolName(text.toStdString())); } } // m8r namespace diff --git a/app/src/qt/dialogs/run_tool_dialog.h b/app/src/qt/dialogs/run_tool_dialog.h index 3f685612..1834e4b9 100644 --- a/app/src/qt/dialogs/run_tool_dialog.h +++ b/app/src/qt/dialogs/run_tool_dialog.h @@ -53,7 +53,7 @@ class RunToolDialog : public QDialog void show(); - QString getTemplateTextForToolName(QString selectedTool) const; + QString getTemplateTextForToolName(std::string selectedTool) const; QPushButton* getRunButton() const { return runButton; } QString getSelectedTool() const { diff --git a/app/src/qt/left_toolbar_view.cpp b/app/src/qt/left_toolbar_view.cpp new file mode 100644 index 00000000..5a56fbeb --- /dev/null +++ b/app/src/qt/left_toolbar_view.cpp @@ -0,0 +1,60 @@ +/* + left_toolbar_view.cpp MindForger thinking notebook + + Copyright (C) 2016-2023 Martin Dvorak + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#include "left_toolbar_view.h" + +namespace m8r { + +LeftToolbarView::LeftToolbarView(MainWindowView* mainWindowView) + : QToolBar{tr("Tool Bar"), mainWindowView}, + mainWindow{mainWindowView} +{ + actionLeftToolbarArxiv = addAction( + QIcon(":/icons/arxiv.png"), + "Open arXiv and find papers related to the current context... (Alt-1)"); + + actionLeftToolbarWikipedia = addAction( + QIcon(":/icons/wikipedia.png"), + "Open Wikipedia and find entry related to the current context... (Alt-2)"); + + actionLeftToolbarStackOverflow = addAction( + QIcon(":/icons/stackoverflow.png"), + "Open StackOverflow and find entry related to the current context... (Alt-3)"); + + actionLeftToolbarH2oGpt= addAction( + QIcon(":/icons/h2oai.png"), + "Open h2oGPT and chat about entry related to the current context... (Alt-4)"); + + actionLeftToolbarDuckDuckGo = addAction( + QIcon(":/icons/duckduckgo.png"), + "Open DuckDuckGo and find entry related to the current context... (Alt-5)"); + + // TODO "Open DuckDuckGo and search web for the selected entity..." + + // TODO "Let chatGPT to explaine in simple terms..." + // TODO "Use Gramarly to check to grammar..." + // TODO "Use Pandoc to convert MindForger's Markdown documents..." + // TODO "Build your web with MindForger's Markdown documents and Docusaurus..." + +} + +LeftToolbarView::~LeftToolbarView() +{ +} + +} // m8r namespace diff --git a/app/src/qt/left_toolbar_view.h b/app/src/qt/left_toolbar_view.h new file mode 100644 index 00000000..82a44445 --- /dev/null +++ b/app/src/qt/left_toolbar_view.h @@ -0,0 +1,72 @@ +/* + left_toolbar_view.h MindForger thinking notebook + + Copyright (C) 2016-2023 Martin Dvorak + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifndef M8RUI_LEFT_TOOLBAR_VIEW_H +#define M8RUI_LEFT_TOOLBAR_VIEW_H + +#include + +#include "main_window_view.h" + +namespace m8r { + +class MainWindowView; + +class LeftToolbarView : public QToolBar +{ + Q_OBJECT + + MainWindowView* mainWindow; + +public: + QAction* actionLeftToolbarArxiv; + QAction* actionLeftToolbarWikipedia; + QAction* actionLeftToolbarStackOverflow; + QAction* actionLeftToolbarH2oGpt; + QAction* actionLeftToolbarDuckDuckGo; + + // IMPORTANT: hide event hidden as it was causing undesired configuration + // changes and toolbar hiding on Qt's spontaneous hide/show events. Citation + // from Qt doc: + // + // "Note: A widget receives spontaneous show and hide events when its mapping + // status is changed by the window system, e.g. a spontaneous hide event when + // the user minimizes the window, and a spontaneous show event when the window + // is restored again. After receiving a spontaneous hide event, a widget is + // still considered visible in the sense of isVisible()." + // + // Even use of this->isVisible() within the event didn't fixed the problem. + // + // @see https://github.com/dvorka/mindforger/issues/1437 + // + // void hideEvent(QHideEvent *) override; + +public: + explicit LeftToolbarView(MainWindowView* mainWindowView); + LeftToolbarView(const LeftToolbarView&) = delete; + LeftToolbarView(const LeftToolbarView&&) = delete; + LeftToolbarView &operator=(const LeftToolbarView&) = delete; + LeftToolbarView &operator=(const LeftToolbarView&&) = delete; + ~LeftToolbarView(); + +signals: + void signalLeftToolbarVisibilityChanged(bool visibility); +}; + +} +#endif // M8RUI_LEFT_TOOLBAR_VIEW_H diff --git a/app/src/qt/main_menu_presenter.cpp b/app/src/qt/main_menu_presenter.cpp index 59a88dbb..53012866 100644 --- a/app/src/qt/main_menu_presenter.cpp +++ b/app/src/qt/main_menu_presenter.cpp @@ -290,14 +290,6 @@ MainMenuPresenter::MainMenuPresenter(MainWindowPresenter* mwp) QObject::connect(view->actionFormatTable, SIGNAL(triggered()), mwp, SLOT(doActionFormatTable())); QObject::connect(view->actionFormatHr, SIGNAL(triggered()), mwp, SLOT(doActionFormatHr())); - // menu: tools - QObject::connect(view->actionToolsArxiv, SIGNAL(triggered()), mwp, SLOT(doActionToolsArxiv())); - QObject::connect(view->actionToolsPandoc, SIGNAL(triggered()), mwp, SLOT(doActionToolsPandoc())); - QObject::connect(view->actionToolsChatGpt, SIGNAL(triggered()), mwp, SLOT(doActionToolsChatGpt())); - QObject::connect(view->actionToolsWikipedia, SIGNAL(triggered()), mwp, SLOT(doActionToolsWikipedia())); - QObject::connect(view->actionToolsDocusaurus, SIGNAL(triggered()), mwp, SLOT(doActionToolsDocusaurus())); - QObject::connect(view->actionToolsDuckDuckGo, SIGNAL(triggered()), mwp, SLOT(doActionToolsDucDuckGo())); - // menu: help QObject::connect(view->actionHelpDocumentation, SIGNAL(triggered()), mwp, SLOT(doActionHelpDocumentation())); QObject::connect(view->actionHelpWeb, SIGNAL(triggered()), mwp, SLOT(doActionHelpWeb())); diff --git a/app/src/qt/main_menu_view.cpp b/app/src/qt/main_menu_view.cpp index 2188e788..c8e2b43b 100644 --- a/app/src/qt/main_menu_view.cpp +++ b/app/src/qt/main_menu_view.cpp @@ -957,59 +957,6 @@ MainMenuView::MainMenuView(MainWindowView& mainWindowView) menuFormat->addAction(actionFormatImage); menuFormat->setEnabled(false); - -#ifdef MF_WIP - // menu: tools - - /* - menuTools = qMenuBar->addMenu(tr("&Tools")); - - actionToolsWikipedia = new QAction( - QIcon(":/menu-icons/link.svg"), tr("&Wikipedia"), mainWindow); - actionToolsWikipedia->setStatusTip( - tr("Open Wikipadia and find entry of the selected entity...")); - menuTools->addAction(actionToolsWikipedia); - - actionToolsArxiv = new QAction( - QIcon(":/menu-icons/link.svg"), tr("&arXiv"), mainWindow); - actionToolsArxiv->setStatusTip(tr( - "Open arXiv and find papers related to the selected entity...")); - menuTools->addAction(actionToolsArxiv); - - actionToolsChatGpt = new QAction( - QIcon(":/menu-icons/link.svg"), - tr("&ChatGPT: Explain ... in simple terms."), - mainWindow); - actionToolsChatGpt->setStatusTip( - tr("Let ChatGPT to explain the selected entry...")); - menuTools->addAction(actionToolsChatGpt); - - actionToolsGramarly= new QAction( - QIcon(":/menu-icons/link.svg"), tr("&Gramarly"), mainWindow); - actionToolsGramarly->setStatusTip(tr( - "Use Gramarly to check to grammar...")); - menuTools->addAction(actionToolsGramarly); - - actionToolsDuckDuckGo = new QAction( - QIcon(":/menu-icons/link.svg"), tr("&DuckDuckGo"), mainWindow); - actionToolsDuckDuckGo->setStatusTip( - tr("Open DuckDuckGo and search web for the selected entity...")); - menuTools->addAction(actionToolsDuckDuckGo); - - actionToolsPandoc = new QAction( - QIcon(":/menu-icons/link.svg"), tr("&Pandoc"), mainWindow); - actionToolsPandoc ->setStatusTip( - tr("Use Pandoc to convert MindForger's Markdown documents...")); - menuTools->addAction(actionToolsPandoc); - - actionToolsDocusaurus = new QAction( - QIcon(":/menu-icons/link.svg"), tr("D&ocusaurus"), mainWindow); - actionToolsDocusaurus->setStatusTip( - tr("Build your web with MindForger's Markdown documents and Docusaurus...")); - menuTools->addAction(actionToolsDocusaurus); - */ -#endif - // menu: help actionHelpDocumentation = new QAction( diff --git a/app/src/qt/main_menu_view.h b/app/src/qt/main_menu_view.h index e60166df..d6ce0921 100644 --- a/app/src/qt/main_menu_view.h +++ b/app/src/qt/main_menu_view.h @@ -252,15 +252,6 @@ class MainMenuView : public QObject QAction* actionFormatHr; QAction* actionFormatTimestamp; - // menu: Tools - QAction* actionToolsWikipedia; - QAction* actionToolsArxiv; - QAction* actionToolsChatGpt; - QAction* actionToolsGramarly; - QAction* actionToolsDuckDuckGo; - QAction* actionToolsPandoc; - QAction* actionToolsDocusaurus; - // menu: Help QAction* actionHelpDocumentation; QAction* actionHelpWeb; diff --git a/app/src/qt/main_window_presenter.cpp b/app/src/qt/main_window_presenter.cpp index ea7ac589..09cbe135 100644 --- a/app/src/qt/main_window_presenter.cpp +++ b/app/src/qt/main_window_presenter.cpp @@ -18,6 +18,8 @@ */ #include "main_window_presenter.h" +#include + #include "kanban_column_presenter.h" using namespace std; @@ -168,7 +170,48 @@ MainWindowPresenter::MainWindowPresenter(MainWindowView& view) orloj->getOutlineHeaderEdit()->getView()->getHeaderEditor(), SIGNAL(signalPasteImageData(QImage)), this, SLOT(doActionEditPasteImageData(QImage)) ); - // wire toolbar signals + // wire LEFT toolbar signals + QObject::connect( + new QShortcut(QKeySequence("Alt+1"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionArxivToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarArxiv, SIGNAL(triggered()), + this, SLOT(doActionArxivToolbar()) + ); + QObject::connect( + new QShortcut(QKeySequence("Alt+2"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionWikipediaToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarWikipedia, SIGNAL(triggered()), + this, SLOT(doActionWikipediaToolbar()) + ); + QObject::connect( + new QShortcut(QKeySequence("Alt+3"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionStackOverflowToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarStackOverflow, SIGNAL(triggered()), + this, SLOT(doActionStackOverflowToolbar()) + ); + QObject::connect( + new QShortcut(QKeySequence("Alt+4"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionH2oGptToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarH2oGpt, SIGNAL(triggered()), + this, SLOT(doActionH2oGptToolbar()) + ); + QObject::connect( + new QShortcut(QKeySequence("Alt+5"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionDuckDuckGoToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarDuckDuckGo, SIGNAL(triggered()), + this, SLOT(doActionDuckDuckGoToolbar()) + ); + // wire TOP toolbar signals QObject::connect( view.getToolBar()->actionNewOutlineOrNote, SIGNAL(triggered()), this, SLOT(doActionOutlineOrNoteNew()) @@ -1891,7 +1934,7 @@ void MainWindowPresenter::doActionOpenRunToolDialog(QString& phrase) MF_DEBUG("SIGNAL handled: open run tool dialog..."); this->runToolDialog->setPhraseText(phrase); QString templateText = this->runToolDialog->getTemplateTextForToolName( - this->runToolDialog->getSelectedTool()); + this->runToolDialog->getSelectedTool().toStdString()); if(templateText.length() == 0) { return; } @@ -2052,6 +2095,101 @@ void MainWindowPresenter::doActionOutlineNew() ); } +void MainWindowPresenter::doActionArxivToolbar() +{ + handleLeftToolbarAction(TOOL_ARXIV); +} + +void MainWindowPresenter::doActionWikipediaToolbar() +{ + handleLeftToolbarAction(TOOL_WIKIPEDIA); +} + +void MainWindowPresenter::doActionStackOverflowToolbar() +{ + handleLeftToolbarAction(TOOL_STACK_OVERFLOW); +} + +void MainWindowPresenter::doActionH2oGptToolbar() +{ + handleLeftToolbarAction(TOOL_H2O_GPT_WEB); +} + +void MainWindowPresenter::doActionDuckDuckGoToolbar() +{ + handleLeftToolbarAction(TOOL_DUCKDUCKGO); +} + +void MainWindowPresenter::handleLeftToolbarAction(string selectedTool) +{ + // get PHRASE from the active context: + // - N editor: get word under cursor OR selected text + // - N tree: get N name + // - O tree: get O name + // - ... + QString phrase; + if(orloj->isFacetActive(OrlojPresenterFacets::FACET_EDIT_NOTE)) { + phrase = orloj->getNoteEdit()->getView()->getNoteEditor()->getToolPhrase(); + } else if( + orloj->isFacetActive(OrlojPresenterFacets::FACET_VIEW_OUTLINE) + || orloj->isFacetActive(OrlojPresenterFacets::FACET_VIEW_OUTLINE_HEADER) + ) { + Outline* o = orloj->getOutlineView()->getCurrentOutline(); + if(o) { + phrase = QString::fromStdString(o->getName()); + } + } else if(orloj->isFacetActive(OrlojPresenterFacets::FACET_VIEW_NOTE)) { + Note* note = orloj->getOutlineView()->getOutlineTree()->getCurrentNote(); + if(note) { + phrase = QString::fromStdString(note->getName()); + } + } else if(orloj->isFacetActive(OrlojPresenterFacets::FACET_EDIT_OUTLINE_HEADER)) { + phrase = orloj->getOutlineHeaderEdit()->getView()->getHeaderEditor()->getToolPhrase(); + } + else if(orloj->isFacetActive(OrlojPresenterFacets::FACET_LIST_OUTLINES)) { + int row = orloj->getOutlinesTable()->getCurrentRow(); + if(row != OutlinesTablePresenter::NO_ROW) { + QStandardItem* item + = orloj->getOutlinesTable()->getModel()->item(row); + if(item) { + Outline* outline = item->data(Qt::UserRole + 1).value(); + phrase = QString::fromStdString(outline->getName()); + } + } + } + + if(phrase.length() == 0) { + QMessageBox msgBox{ + QMessageBox::Critical, + QObject::tr("Empty Phrase"), + QObject::tr("Phrase to search/explain/process is empty.") + }; + msgBox.exec(); + return; + } + + // use phrase to RUN the tool + QString templateText + = this->runToolDialog->getTemplateTextForToolName(selectedTool); + MF_DEBUG( + "Run tool: " + << phrase.toStdString() << " -> " + << templateText.toStdString() << " -> " + << selectedTool << endl + ); + + // phrase replace @ template > get command, if invalid, then fallback + QString command = templateText.replace(QString{TOOL_PHRASE}, phrase); + MF_DEBUG("Run tool: command '" << command.toStdString() << "'" << endl); + if(selectedTool == TOOL_H2O_GPT_API) { + // TODO: sniff HTTP traffic and use HTTP client/JSon to talk to the service + MF_DEBUG("H2O GPT API not implemented yet"); + return; + } + + QDesktopServices::openUrl(QUrl{command}); +} + void MainWindowPresenter::doActionOutlineOrNoteNew() { if(orloj->isFacetActive(OrlojPresenterFacets::FACET_VIEW_OUTLINE_HEADER) @@ -3498,49 +3636,6 @@ void MainWindowPresenter::doActionViewLimbo() } } - -void MainWindowPresenter::doActionToolsWikipedia() -{ - QDesktopServices::openUrl( - QUrl{"https://wikipedia.org"} - ); -} - -void MainWindowPresenter::doActionToolsArxiv() -{ - QDesktopServices::openUrl( - QUrl{"https://arxiv.org/multi?group=grp_math&%2Ffind=Search"} - ); -} - -void MainWindowPresenter::doActionToolsDuckDuckGo() -{ - QDesktopServices::openUrl( - QUrl{"https://duckduckgo.com/"} - ); -} - -void MainWindowPresenter::doActionToolsDocusaurus() -{ - QDesktopServices::openUrl( - QUrl{"https://docusaurus.io/docs/installation"} - ); -} - -void MainWindowPresenter::doActionToolsPandoc() -{ - QDesktopServices::openUrl( - QUrl{"https://pandoc.org/installing.html"} - ); -} - -void MainWindowPresenter::doActionToolsChatGpt() -{ - QDesktopServices::openUrl( - QUrl{"https://chat.openai.com/chat"} - ); -} - void MainWindowPresenter::doActionHelpDocumentation() { QDesktopServices::openUrl(QUrl{"https://github.com/dvorka/mindforger/wiki"}); diff --git a/app/src/qt/main_window_presenter.h b/app/src/qt/main_window_presenter.h index 709dfcc2..5efd84c1 100644 --- a/app/src/qt/main_window_presenter.h +++ b/app/src/qt/main_window_presenter.h @@ -369,13 +369,13 @@ public slots: void doActionToggleLiveNotePreview(); void doActionNameDescFocusSwap(); void doActionSpellCheck(); - // tools - void doActionToolsWikipedia(); - void doActionToolsArxiv(); - void doActionToolsChatGpt(); - void doActionToolsDuckDuckGo(); - void doActionToolsPandoc(); - void doActionToolsDocusaurus(); + // tools toolbar + void handleLeftToolbarAction(std::string selectedTool); + void doActionArxivToolbar(); + void doActionWikipediaToolbar(); + void doActionStackOverflowToolbar(); + void doActionH2oGptToolbar(); + void doActionDuckDuckGoToolbar(); // help void doActionHelpDocumentation(); void doActionHelpWeb(); diff --git a/app/src/qt/main_window_view.cpp b/app/src/qt/main_window_view.cpp index 49505d65..12569b3d 100644 --- a/app/src/qt/main_window_view.cpp +++ b/app/src/qt/main_window_view.cpp @@ -31,6 +31,9 @@ MainWindowView::MainWindowView(LookAndFeels& lookAndFeel) // IMPROVE toolbar position to be configurable addToolBar(Qt::TopToolBarArea, toolBarView); + leftToolBarView = new LeftToolbarView{this}; + addToolBar(Qt::LeftToolBarArea, leftToolBarView); + centralWidget = new QWidget(this); centralLayout = new QVBoxLayout{centralWidget}; diff --git a/app/src/qt/main_window_view.h b/app/src/qt/main_window_view.h index 34dd4d8c..9643517c 100644 --- a/app/src/qt/main_window_view.h +++ b/app/src/qt/main_window_view.h @@ -26,6 +26,7 @@ #include "main_window_presenter.h" #include "main_toolbar_view.h" +#include "left_toolbar_view.h" #include "main_menu_presenter.h" #include "cli_n_breadcrumbs_view.h" #include "orloj_view.h" @@ -36,6 +37,7 @@ namespace m8r { class OrlojView; class MainWindowPresenter; class MainToolbarView; +class LeftToolbarView; class CliAndBreadcrumbsView; /** @@ -59,6 +61,7 @@ class MainWindowView: public QMainWindow OrlojView* orlojView; MainToolbarView* toolBarView; + LeftToolbarView* leftToolBarView; StatusBarView* statusBarView; public: @@ -71,6 +74,7 @@ class MainWindowView: public QMainWindow QMenuBar* getMenuBar() const { return menuBar(); } MainToolbarView* getToolBar() const { return toolBarView; } + LeftToolbarView* getLeftToolBar() const { return leftToolBarView; } CliAndBreadcrumbsView* getCli() const; OrlojView* getOrloj() const { return orlojView; } StatusBarView* getStatusBar() const { return statusBarView; } diff --git a/app/src/qt/note_edit_view.cpp b/app/src/qt/note_edit_view.cpp index af523da7..c1b4d53c 100644 --- a/app/src/qt/note_edit_view.cpp +++ b/app/src/qt/note_edit_view.cpp @@ -45,13 +45,16 @@ NoteEditView::NoteEditView(QWidget* parent) QKeySequence(Qt::CTRL+Qt::Key_L), this, SLOT(slotSaveAndCloseEditor())); #else + // TODO leak? new QShortcut( QKeySequence(Qt::ALT+Qt::Key_Left), this, SLOT(slotSaveAndCloseEditor())); #endif + // TODO leak? new QShortcut( QKeySequence(Qt::CTRL+Qt::Key_G), this, SLOT(slotCloseEditor())); + // TODO leak? new QShortcut( #if __APPLE__ QKeySequence(Qt::CTRL+Qt::Key_Return), @@ -59,6 +62,7 @@ NoteEditView::NoteEditView(QWidget* parent) QKeySequence(Qt::ALT+Qt::Key_Return), #endif this, SLOT(slotOpenNotePropertiesEditor())); + // TODO leak? new QShortcut( QKeySequence(Qt::CTRL+Qt::Key_S), this, SLOT(slotSaveNote())); diff --git a/app/src/qt/note_editor_view.cpp b/app/src/qt/note_editor_view.cpp index c0e1f895..5fd415f0 100644 --- a/app/src/qt/note_editor_view.cpp +++ b/app/src/qt/note_editor_view.cpp @@ -562,7 +562,14 @@ void NoteEditorView::performTextCompletion(const QString& completionPrefix) completer->complete(rect); } -void NoteEditorView::slotStartRunTool() +/** + * @brief Get phrase to be used by a tool (arXiv, GPT, Wikipedia, ...) + * + * Either return selected text or word under the cursor. + * + * @return phrase text + */ +QString NoteEditorView::getToolPhrase() { QString phrase{}; @@ -571,7 +578,6 @@ void NoteEditorView::slotStartRunTool() if(selection.size()) { phrase = selection; } else { - // TODO get word under cursor OR get selected text MF_DEBUG( "Run tool: getting the phrase under the cursor..." << endl); phrase = getCompletionPrefix(); @@ -580,6 +586,14 @@ void NoteEditorView::slotStartRunTool() << "'" << endl); } + return phrase; +} + + +void NoteEditorView::slotStartRunTool() +{ + QString phrase = getToolPhrase(); + if(!phrase.isEmpty()) { MF_DEBUG( "Run tool: sending signal to open the dialog..." << endl); diff --git a/app/src/qt/note_editor_view.h b/app/src/qt/note_editor_view.h index 5609f009..be2be9c3 100644 --- a/app/src/qt/note_editor_view.h +++ b/app/src/qt/note_editor_view.h @@ -122,6 +122,9 @@ class NoteEditorView : public QPlainTextEdit void clearHitCounter() { hitCounter=0; } int getHitCounter() const { return hitCounter; } + // tools + QString getToolPhrase(); + // autocomplete protected: virtual void mousePressEvent(QMouseEvent* event) override; diff --git a/lib/src/config/configuration.h b/lib/src/config/configuration.h index f58253ad..5f3ed689 100644 --- a/lib/src/config/configuration.h +++ b/lib/src/config/configuration.h @@ -104,6 +104,7 @@ constexpr const auto TOOL_PHRASE = "<>"; constexpr const auto TOOL_ARXIV = "arXiv"; constexpr const auto TOOL_DUCKDUCKGO = "DuckDuckGo"; constexpr const auto TOOL_DEEPL = "DeepL web"; +constexpr const auto TOOL_STACK_OVERFLOW = "StackOverflow"; constexpr const auto TOOL_GH_PROJECTS = "GitHub projects"; constexpr const auto TOOL_GH_TOPICS = "GitHub topics"; constexpr const auto TOOL_GOOGLE_BARD = "Google Bard";