diff --git a/app/mf-resources.qrc b/app/mf-resources.qrc index 75907a22..2358eb23 100644 --- a/app/mf-resources.qrc +++ b/app/mf-resources.qrc @@ -23,6 +23,10 @@ resources/icons/stackoverflow.png resources/icons/duckduckgo.png resources/icons/h2oai.png + resources/icons/github.png + resources/icons/bard.png + resources/icons/python.png + resources/icons/cpp.png resources/qt/translations/mindforger_cs.qm diff --git a/app/resources/icons/bard.png b/app/resources/icons/bard.png new file mode 100644 index 00000000..e9250331 Binary files /dev/null and b/app/resources/icons/bard.png differ diff --git a/app/resources/icons/cpp.png b/app/resources/icons/cpp.png new file mode 100644 index 00000000..d736e194 Binary files /dev/null and b/app/resources/icons/cpp.png differ diff --git a/app/resources/icons/github.png b/app/resources/icons/github.png new file mode 100644 index 00000000..2bfbc541 Binary files /dev/null and b/app/resources/icons/github.png differ diff --git a/app/resources/icons/python.png b/app/resources/icons/python.png new file mode 100644 index 00000000..c48d3af7 Binary files /dev/null and b/app/resources/icons/python.png differ diff --git a/app/src/qt/dialogs/run_tool_dialog.cpp b/app/src/qt/dialogs/run_tool_dialog.cpp index 729b1b1f..7d44a308 100644 --- a/app/src/qt/dialogs/run_tool_dialog.cpp +++ b/app/src/qt/dialogs/run_tool_dialog.cpp @@ -32,7 +32,7 @@ RunToolDialog::RunToolDialog(QWidget* parent) QString{TOOL_DUCKDUCKGO}, QString{TOOL_GOOGLE_BARD}, QString{TOOL_GOOGLE_SEARCH}, - QString{TOOL_GH_PROJECTS}, + QString{TOOL_GH_REPOS}, QString{TOOL_GH_TOPICS}, QString{TOOL_H2O_GPT_WEB}, QString{TOOL_H2O_GPT_API}, @@ -113,6 +113,14 @@ QString RunToolDialog::getTemplateTextForToolName(string selectedTool) const return templateText; } else if(selectedTool == TOOL_DEEPL) { return QString{"https://www.deepl.com/en/translator"}; + } else if(selectedTool == TOOL_DOC_PYTHON) { + QString templateText{"https://docs.python.org/3.10/search.html?q="}; + templateText.append(TOOL_PHRASE); + return templateText; + } else if(selectedTool == TOOL_DOC_CPP) { + QString templateText{"https://duckduckgo.com/?sites=cppreference.com&ia=web&q="}; + templateText.append(TOOL_PHRASE); + return templateText; } else if(selectedTool == TOOL_STACK_OVERFLOW) { QString templateText{"https://stackoverflow.com/search?q="}; templateText.append(TOOL_PHRASE); @@ -126,7 +134,7 @@ QString RunToolDialog::getTemplateTextForToolName(string selectedTool) const QString templateText{"https://www.github.com/search?q="}; templateText.append(TOOL_PHRASE); return templateText; - } else if(selectedTool == TOOL_GH_PROJECTS) { + } else if(selectedTool == TOOL_GH_REPOS) { // TODO fix search URL QString templateText{"https://www.github.com/search?q="}; templateText.append(TOOL_PHRASE); diff --git a/app/src/qt/left_toolbar_view.cpp b/app/src/qt/left_toolbar_view.cpp index 5a56fbeb..5f693407 100644 --- a/app/src/qt/left_toolbar_view.cpp +++ b/app/src/qt/left_toolbar_view.cpp @@ -30,27 +30,38 @@ LeftToolbarView::LeftToolbarView(MainWindowView* mainWindowView) actionLeftToolbarWikipedia = addAction( QIcon(":/icons/wikipedia.png"), - "Open Wikipedia and find entry related to the current context... (Alt-2)"); + "Open Wikipedia and find entries 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)"); + "Open StackOverflow and find entries 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)"); + "Open h2oGPT and chat about the current context... (Alt-4)"); actionLeftToolbarDuckDuckGo = addAction( QIcon(":/icons/duckduckgo.png"), - "Open DuckDuckGo and find entry related to the current context... (Alt-5)"); + "Open DuckDuckGo and find entries related to the current context... (Alt-5)"); - // TODO "Open DuckDuckGo and search web for the selected entity..." + actionLeftToolbarGitHub = addAction( + QIcon(":/icons/github.png"), + "Open GitHub and find entries related to the current context... (Alt-6)"); - // 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..." + actionLeftToolbarBard = addAction( + QIcon(":/icons/bard.png"), + "Open Bard and chat about the current context... (Alt-7)"); + + actionLeftToolbarPython = addAction( + QIcon(":/icons/python.png"), + "Open Python documentation and find entries related to the current context... (Alt-8)"); + actionLeftToolbarCpp = addAction( + QIcon(":/icons/cpp.png"), + "Open C++ documentation and find entries related to the current context... (Alt-9)"); + + // TODO "Let chatGPT to explaine in simple terms..." + // TODO "Use Gramarly to check to grammar..." > bard/chatGPT can check grammar } LeftToolbarView::~LeftToolbarView() diff --git a/app/src/qt/left_toolbar_view.h b/app/src/qt/left_toolbar_view.h index 82a44445..e1d69d86 100644 --- a/app/src/qt/left_toolbar_view.h +++ b/app/src/qt/left_toolbar_view.h @@ -39,6 +39,10 @@ class LeftToolbarView : public QToolBar QAction* actionLeftToolbarStackOverflow; QAction* actionLeftToolbarH2oGpt; QAction* actionLeftToolbarDuckDuckGo; + QAction* actionLeftToolbarGitHub; + QAction* actionLeftToolbarBard; + QAction* actionLeftToolbarPython; + QAction* actionLeftToolbarCpp; // IMPORTANT: hide event hidden as it was causing undesired configuration // changes and toolbar hiding on Qt's spontaneous hide/show events. Citation diff --git a/app/src/qt/main_window_presenter.cpp b/app/src/qt/main_window_presenter.cpp index 09cbe135..523a22bc 100644 --- a/app/src/qt/main_window_presenter.cpp +++ b/app/src/qt/main_window_presenter.cpp @@ -211,6 +211,38 @@ MainWindowPresenter::MainWindowPresenter(MainWindowView& view) view.getLeftToolBar()->actionLeftToolbarDuckDuckGo, SIGNAL(triggered()), this, SLOT(doActionDuckDuckGoToolbar()) ); + QObject::connect( + new QShortcut(QKeySequence("Alt+6"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionGitHubToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarGitHub, SIGNAL(triggered()), + this, SLOT(doActionGitHubToolbar()) + ); + QObject::connect( + new QShortcut(QKeySequence("Alt+7"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionBardToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarBard, SIGNAL(triggered()), + this, SLOT(doActionBardToolbar()) + ); + QObject::connect( + new QShortcut(QKeySequence("Alt+8"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionPythonToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarPython, SIGNAL(triggered()), + this, SLOT(doActionPythonToolbar()) + ); + QObject::connect( + new QShortcut(QKeySequence("Alt+9"), view.getOrloj()), SIGNAL(activated()), + this, SLOT(doActionCppToolbar()) + ); + QObject::connect( + view.getLeftToolBar()->actionLeftToolbarCpp, SIGNAL(triggered()), + this, SLOT(doActionCppToolbar()) + ); // wire TOP toolbar signals QObject::connect( view.getToolBar()->actionNewOutlineOrNote, SIGNAL(triggered()), @@ -2120,6 +2152,26 @@ void MainWindowPresenter::doActionDuckDuckGoToolbar() handleLeftToolbarAction(TOOL_DUCKDUCKGO); } +void MainWindowPresenter::doActionGitHubToolbar() +{ + handleLeftToolbarAction(TOOL_GH_REPOS); +} + +void MainWindowPresenter::doActionBardToolbar() +{ + handleLeftToolbarAction(TOOL_GOOGLE_BARD); +} + +void MainWindowPresenter::doActionPythonToolbar() +{ + handleLeftToolbarAction(TOOL_DOC_PYTHON); +} + +void MainWindowPresenter::doActionCppToolbar() +{ + handleLeftToolbarAction(TOOL_DOC_CPP); +} + void MainWindowPresenter::handleLeftToolbarAction(string selectedTool) { // get PHRASE from the active context: diff --git a/app/src/qt/main_window_presenter.h b/app/src/qt/main_window_presenter.h index 5efd84c1..b798eeea 100644 --- a/app/src/qt/main_window_presenter.h +++ b/app/src/qt/main_window_presenter.h @@ -376,6 +376,10 @@ public slots: void doActionStackOverflowToolbar(); void doActionH2oGptToolbar(); void doActionDuckDuckGoToolbar(); + void doActionGitHubToolbar(); + void doActionBardToolbar(); + void doActionPythonToolbar(); + void doActionCppToolbar(); // help void doActionHelpDocumentation(); void doActionHelpWeb(); diff --git a/lib/src/config/configuration.h b/lib/src/config/configuration.h index 5f3ed689..35bbdd58 100644 --- a/lib/src/config/configuration.h +++ b/lib/src/config/configuration.h @@ -105,7 +105,7 @@ 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_REPOS = "GitHub repositories"; constexpr const auto TOOL_GH_TOPICS = "GitHub topics"; constexpr const auto TOOL_GOOGLE_BARD = "Google Bard"; constexpr const auto TOOL_GOOGLE_SEARCH = "Google Search"; @@ -113,6 +113,8 @@ constexpr const auto TOOL_H2O_GPT_WEB = "h2oGPT web"; constexpr const auto TOOL_H2O_GPT_API = "h2oGPT API"; constexpr const auto TOOL_CHAT_GPT_WEB = "OpenAI chatGPT web"; constexpr const auto TOOL_WIKIPEDIA = "Wikipedia"; +constexpr const auto TOOL_DOC_PYTHON = "Python documentation"; +constexpr const auto TOOL_DOC_CPP = "C++ documentation"; // improve platform/language specific constexpr const auto DEFAULT_NEW_OUTLINE = "# New Markdown File\n\nThis is a new Markdown file created by MindForger.\n\n#Section 1\nThe first section.\n\n";