File indexing completed on 2024-10-06 06:37:37
0001 /* 0002 SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef BROWSERWIDGET_H 0007 #define BROWSERWIDGET_H 0008 0009 #include "ui_browserwidget.h" 0010 #include <QWebEngineView> 0011 0012 class KEduVocExpression; 0013 0014 namespace Editor 0015 { 0016 struct DictionaryProvider { 0017 QString name; 0018 QString url; 0019 QStringList languages; 0020 }; 0021 0022 class BrowserWidget : public QWidget, public Ui::BrowserWidget 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit BrowserWidget(QWidget *parent = nullptr); 0027 0028 public Q_SLOTS: 0029 /** 0030 * Update the word 0031 * @param entry 0032 * @param translation 0033 */ 0034 void setTranslation(KEduVocExpression *entry, int translation); 0035 0036 private Q_SLOTS: 0037 void showCurrentTranslation(); 0038 void openUrl(const QUrl &targetUrl); 0039 void providerChanged(int); 0040 0041 private: 0042 /** 0043 * Load a list of providers of online dictionaries 0044 */ 0045 void setupProviders(); 0046 0047 /// Column in the document - corresponds to the language (-KV_COL_TRANS) 0048 int m_currentTranslation; 0049 /// Selection in the doc - if more than one row is selected behavior is different 0050 KEduVocExpression *m_entry{nullptr}; 0051 0052 QWebEngineView *m_htmlPart{nullptr}; 0053 QList<DictionaryProvider> m_providers; 0054 int m_currentProvider; 0055 }; 0056 0057 } 0058 0059 #endif