1 /*****************************************************************************
2 * dictwidget.h - QStarDict, a StarDict clone written with using Qt *
3 * Copyright (C) 2007 Alexander Rodin *
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 2 of the License, or *
8 * (at your option) any later version. *
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. *
15 * You should have received a copy of the GNU General Public License along *
16 * with this program; if not, write to the Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
18 *****************************************************************************/
26 #include "dictbrowser.h"
35 * The DictBrowser widget provides view of translations from given dictionary.
37 class DictWidget: public QFrame
43 * Construct empty DictWidget.
45 DictWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
48 * Set source dictionary.
49 * Warning: DictWidget will copy only a pointer to dict. So set dictionaries
50 * allocated from heap and don't destroy it befor DictWidget.
52 void setDict(DictCore *dict)
53 { m_translationView->setDict(dict); }
55 * Return pointer to dictionary.
57 const DictCore* dict() const
58 { return m_translationView->dict(); }
60 * Clear translation text.
63 { m_translationView->clear(); }
69 { m_translationView->clearHistory(); }
72 * Show translation of str.
74 void translate(const QString &str);
76 * Return last translated word.
78 QString translatedWord() const
79 { return m_translationView->source().toString(QUrl::RemoveScheme); }
87 void setDefaultStyleSheet(const QString &css);
89 QString defaultStyleSheet() const
90 { return m_translationView->document()->defaultStyleSheet(); }
93 { m_translationView->reload(); }
97 * Emits when translated word is shown.
99 void wordTranslated(const QString &word);
102 void on_translationView_sourceChanged(const QUrl &name);
110 DictBrowser *m_translationView;
116 #endif // DICTWIDGET_H
118 // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent textwidth=120 formatoptions=tc