init
[qstardict] / kdeplasma / applet / dict.h
1 /*
2  *   Copyright (C) 2008 Nick Shaforostoff <shaforostoff@kde.ru>
3  *
4  *   based on work by:
5  *   Copyright (C) 2007 Thomas Georgiou <TAGeorgiou@gmail.com> and Jeff Cooper <weirdsox11@gmail.com>
6  *
7  *   This program is free software; you can redistribute it and/or
8  *   modify it under the terms of the GNU General Public License as
9  *   published by the Free Software Foundation; either version 2 of 
10  *   the License, or (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef DICT_H
22 #define DICT_H
23
24 #include <Plasma/Applet>
25 #include <Plasma/DataEngine>
26
27 class QTimer;
28 class CheckableStringListModel;
29
30 class QTextBrowser;
31 class QGraphicsProxyWidget;
32 class QGraphicsLinearLayout;
33
34 namespace Plasma
35 {
36     class IconWidget;
37     class LineEdit;
38 }
39
40 class QStarDictApplet: public Plasma::Applet
41 {
42     Q_OBJECT
43     public:
44         QStarDictApplet(QObject *parent, const QVariantList &args);
45         ~QStarDictApplet();
46
47     void init();
48         void setPath(const QString&);
49
50     public slots:
51         void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
52         void autoDefine(const QString &word);
53         void linkDefine(const QString &word);
54
55     protected slots:
56         void define();
57         void configAccepted();
58
59     protected:
60         void createConfigurationInterface(KConfigDialog *parent);
61
62     private:
63         QString m_source;
64         QTimer* m_timer;
65         //QGraphicsPixmapItem *m_graphicsIcon;
66         QGraphicsLinearLayout *m_layout;
67         QGraphicsLinearLayout *m_horLayout;
68         Plasma::LineEdit *m_wordEdit;
69         //Plasma::Flash *m_flash;
70         QStringList m_defList;
71         QStringList::iterator m_i;
72         QTextBrowser* m_defBrowser;
73         QGraphicsProxyWidget *m_defBrowserProxy;
74         Plasma::IconWidget *m_icon;
75
76 //         QList< QPair<QString, bool> > m_dicts;
77         QPointer<CheckableStringListModel> m_dictsModel;
78         QStringList m_dicts;
79         QHash<QString,bool> m_activeDicts;
80 };
81
82 K_EXPORT_PLASMA_APPLET(qstardict, QStarDictApplet)
83
84 #endif