init
[qstardict] / plugins / web / web.h
1 /*****************************************************************************
2  * web.h - QStarDict, a StarDict clone written with using Qt                 *
3  * Copyright (C) 2008 Alexander Rodin                                        *
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 2 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 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  *****************************************************************************/
19
20 #ifndef WEB_H
21 #define WEB_H
22
23 #include "../dictplugin.h"
24
25 #include <QHash>
26
27 class Web: public QObject, public QStarDict::DictPlugin
28 {
29     Q_OBJECT
30     Q_INTERFACES(QStarDict::DictPlugin)
31
32     public:
33         Web(QObject *parent = 0);
34
35         QString name() const
36         { return "web"; }
37         QString version() const
38         { return "0.01"; }
39         QString description() const
40         { return tr("An experimental plugin for WEB dictionaries.<br><b><font color=red>Warning:</font></b> now this plugin is unstable"); }
41         QStringList authors() const
42         { return QStringList("Alexander Rodin <rodin.alexander@gmail.com>"); }
43         Features features() const
44         { return Features(SettingsDialog); }
45
46         QStringList availableDicts() const;
47         QStringList loadedDicts() const
48         { return m_loadedDicts.keys(); }
49         void setLoadedDicts(const QStringList &dicts);
50         DictInfo dictInfo(const QString &dict);
51
52         bool isTranslatable(const QString &dict, const QString &word);
53         Translation translate(const QString &dict, const QString &word);
54
55         int execSettingsDialog(QWidget *parent);
56
57         friend class SettingsDialog;
58     private:
59         struct QueryStruct
60         {
61             QString query;
62             QByteArray codec;
63         };
64         QHash<QString, QueryStruct> m_loadedDicts;
65 };
66
67 #endif // WEB_H
68
69 // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent
70