File indexing completed on 2023-10-01 03:58:29
0001 /* 0002 SPDX-FileCopyrightText: 2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef SYNONYMWIDGET_H 0007 #define SYNONYMWIDGET_H 0008 0009 #include "ui_synonymwidget.h" 0010 0011 #include <QModelIndex> 0012 0013 class KEduVocExpression; 0014 class KEduVocTranslation; 0015 class KEduVocDocument; 0016 class QStringListModel; 0017 0018 namespace Editor 0019 { 0020 class SynonymWidget : public QWidget, public Ui::SynonymWidget 0021 { 0022 Q_OBJECT 0023 public: 0024 enum SynonymWidgetType { Synonym, Antonym, FalseFriend }; 0025 0026 explicit SynonymWidget(SynonymWidgetType type, QWidget *parent = nullptr); 0027 0028 public Q_SLOTS: 0029 /** 0030 * Register the document inside the widget so that it can be marked as modified. 0031 * @param doc 0032 */ 0033 void setDocument(KEduVocDocument *doc); 0034 0035 void setTranslation(KEduVocExpression *entry, int translation); 0036 0037 private Q_SLOTS: 0038 void togglePair(); 0039 void updateList(); 0040 0041 private: 0042 KEduVocDocument *m_doc; 0043 0044 // the one that was selected before 0045 KEduVocTranslation *m_lastTranslation{nullptr}; 0046 // the one the user clicked on latest 0047 KEduVocTranslation *m_currentTranslation{nullptr}; 0048 QStringListModel *m_listModel{nullptr}; 0049 SynonymWidgetType m_type; 0050 }; 0051 } 0052 #endif