1 /*********************************************************************** 2 * 3 * Copyright (C) 2009, 2013 Graeme Gott <graeme@gottcode.org> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 ***********************************************************************/ 19 20 #ifndef DEFINITIONS_H 21 #define DEFINITIONS_H 22 23 #include <QDialog> 24 #include <QHash> 25 class QListWidget; 26 class QListWidgetItem; 27 class QSplitter; 28 class QTextBrowser; 29 class QUrl; 30 class Dictionary; 31 class WordList; 32 33 class Definitions : public QDialog { 34 Q_OBJECT 35 36 public: 37 Definitions(const WordList* wordlist, QWidget* parent = 0); 38 ~Definitions(); 39 40 public slots: 41 void clear(); 42 void addWord(const QString& word); 43 void solveWord(const QString& original_word, const QString& current_word); 44 void selectWord(const QString& word = QString()); 45 46 protected: 47 virtual void hideEvent(QHideEvent* event); 48 49 private slots: 50 void anchorClicked(const QUrl& link); 51 void wordSelected(QListWidgetItem* item); 52 void wordDefined(const QString& word, const QString& definition); 53 54 private: 55 QSplitter* m_contents; 56 QListWidget* m_words; 57 QTextBrowser* m_text; 58 Dictionary* m_dictionary; 59 QHash<QString, QListWidgetItem*> m_word_table; 60 }; 61 62 #endif 63