Russian translation. Gui fix.
[qstardict] / plugins / stardict / stardict.h
1 /*****************************************************************************
2  * stardict.h - QStarDict, a StarDict clone written 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 STARDICT_H
21 #define STARDICT_H
22
23 #include "lib.h"
24 #include "../dictplugin.h"
25
26 #include <string>
27 #include <QVector>
28 #include <QHash>
29
30
31 class StarDict: public QObject, public QStarDict::DictPlugin
32 {
33     Q_OBJECT
34     Q_INTERFACES(QStarDict::DictPlugin)
35     
36     public:
37         StarDict(QObject *parent = 0);
38         ~StarDict();
39
40         QString name() const
41         { return "stardict"; }
42         QString version() const
43         { return "0.1"; }
44         QString description() const
45         { return "The StarDict plugin"; }
46         QStringList authors() const
47         { return QStringList()
48             << "Hu Zheng <huzheng_001@163.com>"
49             << "Opera Wang <wangvisual@sohu.com>"
50             << "Alexander Rodin <rodin.alexander@gmail.com>"; }
51         Features features() const
52         { return Features(SearchSimilar | SettingsDialog); }
53
54         QStringList availableDicts() const;
55         QStringList loadedDicts() const
56         { return m_loadedDicts.keys(); }
57         void setLoadedDicts(const QStringList &loadedDicts);
58         DictInfo dictInfo(const QString &dict);
59
60         bool isTranslatable(const QString &dict, const QString &word);
61         Translation translate(const QString &dict, const QString &word);
62         virtual QStringList findSimilarWords(const QString &dict, const QString &word);
63
64         int execSettingsDialog(QWidget *parent);
65
66         friend class SettingsDialog;
67
68     private:
69         QString parseData(const char *data, int dictIndex = -1,
70                 bool htmlSpaces = false, bool reformatLists = false, bool expandAbbreviations = false);
71
72         Libs *m_sdLibs;
73         QStringList m_dictDirs;
74         QHash<QString, int> m_loadedDicts;
75         bool m_reformatLists;
76         bool m_expandAbbreviations;
77 };
78
79 #endif // STARDICT_H
80
81 // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent
82