File indexing completed on 2024-04-21 03:41:58
0001 /* 0002 This file is part of Kiten, a KDE Japanese Reference Tool... 0003 SPDX-FileCopyrightText: 2001 Jason Katz-Brown <jason@katzbrown.com> 0004 SPDX-FileCopyrightText: 2005 Paul Temple <paul.temple@gmx.net> 0005 SPDX-FileCopyrightText: 2006 Joseph Kerian <jkerian@gmail.com> 0006 SPDX-FileCopyrightText: 2006 Eric Kjeldergaard <kjelderg@gmail.com> 0007 SPDX-FileCopyrightText: 2011 Daniel E. Moctezuma <democtezuma@gmail.com> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 0012 #ifndef KITEN_H 0013 #define KITEN_H 0014 0015 #include <KXmlGuiWindow> 0016 0017 #include "dictionarymanager.h" 0018 #include "dictquery.h" 0019 #include "entry.h" 0020 #include "historyptrlist.h" 0021 0022 class QAction; 0023 class KProcess; 0024 class QStatusBar; 0025 class KToggleAction; 0026 class KitenConfigSkeleton; 0027 0028 class QDockWidget; 0029 0030 class ConfigureDialog; 0031 class DictionaryUpdateManager; 0032 class EntryListView; 0033 class ResultsView; 0034 class SearchStringInput; 0035 0036 class Kiten : public KXmlGuiWindow 0037 { 0038 Q_OBJECT 0039 0040 // Constructors and other setup/takedown related methods 0041 public: 0042 explicit Kiten(QWidget *parent = nullptr, const char *name = nullptr); 0043 ~Kiten() override; 0044 0045 KitenConfigSkeleton *getConfig(); 0046 0047 public Q_SLOTS: 0048 void searchTextAndRaise(const QString &str); 0049 void addExportListEntry(int index); 0050 0051 protected: 0052 void setupActions(); 0053 void setupExportListDock(); 0054 bool queryClose() override; // overridden from KXmlGuiWindow (called@shutdown) override 0055 0056 private Q_SLOTS: 0057 void finishInit(); 0058 void focusResultsView(); 0059 0060 // Searching related methods 0061 void searchFromEdit(); 0062 void searchText(const QString &); 0063 void searchClipboard(); 0064 void searchAndDisplay(const DictQuery &); 0065 void searchInResults(); 0066 void displayResults(EntryList *); 0067 void radicalSearch(); 0068 void kanjiBrowserSearch(); 0069 0070 // Configuration related slots 0071 void slotConfigure(); 0072 void configureToolBars(); 0073 void newToolBarConfig(); 0074 void updateConfiguration(); 0075 void loadDictionaries(); 0076 void loadDictConfig(const QString &); 0077 0078 // Other 0079 void print(); 0080 0081 // History related methods 0082 void back(); 0083 void forward(); 0084 void goInHistory(int); 0085 void displayHistoryItem(); 0086 void addHistory(EntryList *); 0087 void enableHistoryButtons(); 0088 void setCurrentScrollValue(int value); 0089 0090 private: 0091 QStatusBar *_statusBar = nullptr; 0092 DictionaryManager _dictionaryManager; 0093 DictionaryUpdateManager *_dictionaryUpdateManager = nullptr; 0094 SearchStringInput *_inputManager = nullptr; 0095 ResultsView *_mainView = nullptr; 0096 0097 DictQuery _lastQuery; 0098 KToggleAction *_autoSearchToggle = nullptr; 0099 QAction *_irAction = nullptr; 0100 QAction *_backAction = nullptr; 0101 QAction *_forwardAction = nullptr; 0102 KProcess *_radselect_proc = nullptr; 0103 KProcess *_kanjibrowser_proc = nullptr; 0104 0105 // Export list related: 0106 QDockWidget *_exportListDock = nullptr; 0107 QWidget *_exportListDockContents = nullptr; 0108 EntryListView *_exportList = nullptr; 0109 0110 ConfigureDialog *_optionDialog = nullptr; 0111 KitenConfigSkeleton *_config = nullptr; 0112 0113 HistoryPtrList _historyList; 0114 QString _personalDict; 0115 }; 0116 0117 #endif