File indexing completed on 2024-12-01 03:37:12
0001 /* 0002 SPDX-FileCopyrightText: 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de> 0003 SPDX-FileCopyrightText: 2004-2007 Peter Hedlund <peter.hedlund@kdemail.net> 0004 SPDX-FileCopyrightText: 2007-2009 Frederik Gladhorn <gladhorn@kde.org> 0005 SPDX-FileCopyrightText: 2008 Daniel Laidig <d.laidig@gmx.de> 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef EDITOR_H 0010 #define EDITOR_H 0011 0012 #include "parleydocument.h" 0013 #include <KXmlGuiWindow> 0014 0015 class QLineEdit; 0016 0017 ///@brief contains objects for the editor main window 0018 0019 // Models around the Collection / KEduVocDocument 0020 class LessonModel; 0021 class VocabularyModel; 0022 class VocabularyFilter; 0023 class WordClassModel; 0024 0025 namespace Editor 0026 { 0027 class VocabularyView; 0028 class LessonView; 0029 class WordTypeView; 0030 class AudioWidget; 0031 class InflectionWidget; 0032 class ComparisonWidget; 0033 class SummaryWordWidget; 0034 class LatexWidget; 0035 class SynonymWidget; 0036 0037 class EditorWindow : public KXmlGuiWindow 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 explicit EditorWindow(ParleyMainWindow *parent); 0043 ~EditorWindow() override; 0044 0045 /** 0046 * setup the action (menus etc) 0047 */ 0048 void initActions(); 0049 0050 /** setup the main model*/ 0051 void initModel(); 0052 0053 /** setup the main view*/ 0054 void initView(); 0055 0056 void initDockWidgets(); 0057 0058 /** This will look at the lesson list and also the combo box to determine what should be displayed in the table. */ 0059 void updateTableFilter(); 0060 0061 VocabularyView *vocabularyView() const 0062 { 0063 return m_vocabularyView; 0064 } 0065 0066 public Q_SLOTS: 0067 /** 0068 * Edit languages contained in the document. 0069 * This includes adding/removing languages, 0070 * editing articles, personal pronouns and tenses. 0071 */ 0072 void slotLanguagesChanged(); 0073 0074 void slotConfigShowSearch(); 0075 0076 void applyPrefs(); 0077 0078 /** 0079 * Removes all grading information from the current document 0080 */ 0081 void removeGrades(); 0082 0083 /** when closing the application, save the editor's state */ 0084 void saveState(); 0085 0086 /** 0087 * Set the current doc (after creating a new one or opening a file) 0088 */ 0089 void updateDocument(const std::shared_ptr<KEduVocDocument> &doc); 0090 0091 /** 0092 * DBus method for adding words by external apps 0093 */ 0094 void addWordWithTranslation(const QStringList &w); 0095 0096 private Q_SLOTS: 0097 0098 /** Make the search bar visible and focus it */ 0099 void startSearch(); 0100 0101 Q_SIGNALS: 0102 void signalSetData(const QList<int> &entries, int currentTranslation); 0103 0104 private: 0105 ParleyMainWindow *m_mainWindow{nullptr}; 0106 0107 QAction *m_vocabShowSearchBarAction{nullptr}; 0108 0109 VocabularyModel *m_vocabularyModel{nullptr}; 0110 VocabularyView *m_vocabularyView{nullptr}; 0111 VocabularyFilter *m_vocabularyFilter{nullptr}; 0112 0113 QLineEdit *m_searchLine{nullptr}; 0114 QWidget *m_searchWidget{nullptr}; 0115 QAction *m_spellCheckMenu{nullptr}; 0116 0117 /** Show a single conjugation and let the user edit it */ 0118 InflectionWidget *m_inflectionWidget{nullptr}; 0119 SummaryWordWidget *m_summaryWordWidget{nullptr}; 0120 ComparisonWidget *m_comparisonWidget{nullptr}; 0121 LatexWidget *m_latexWidget{nullptr}; 0122 SynonymWidget *m_synonymWidget{nullptr}; 0123 SynonymWidget *m_antonymWidget{nullptr}; 0124 SynonymWidget *m_falseFriendWidget{nullptr}; 0125 AudioWidget *m_audioWidget{nullptr}; 0126 0127 /// dock widgets to display lessons, word types, ... 0128 LessonView *m_lessonView{nullptr}; 0129 LessonModel *m_lessonModel{nullptr}; 0130 0131 WordClassModel *m_wordTypeModel{nullptr}; 0132 WordTypeView *m_wordTypeView{nullptr}; 0133 0134 QList<QDockWidget *> m_dockWidgets; 0135 QList<bool> m_dockWidgetVisibility; 0136 0137 friend class ::ParleyDocument; 0138 }; 0139 0140 } 0141 0142 #endif // EDITOR_H