1
by Aron Xu
Initial commit |
1 |
/***************************************************************************
|
2 |
* Copyright (C) 2009 by Wang Hoi <zealot.hoi@gmail.com> *
|
|
3 |
* Copyright (C) 2011 by CSSlayer <wengxt@gmail.com> *
|
|
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 *
|
|
16 |
* along with this program; if not, write to the *
|
|
17 |
* Free Software Foundation, Inc., *
|
|
18 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
19 |
***************************************************************************/
|
|
20 |
||
21 |
#ifndef KIMPANEL_AGENTTYPE_H
|
|
22 |
#define KIMPANEL_AGENTTYPE_H
|
|
23 |
||
24 |
// Qt
|
|
25 |
#include <QString> |
|
26 |
#include <QList> |
|
27 |
#include <QVariant> |
|
28 |
||
29 |
struct TextAttribute { |
|
30 |
enum Type { |
|
31 |
None, |
|
32 |
Decorate, |
|
33 |
Foreground, |
|
34 |
Background
|
|
35 |
};
|
|
36 |
Type type; |
|
37 |
int start; |
|
38 |
int length; |
|
39 |
int value; |
|
40 |
};
|
|
41 |
||
42 |
struct KimpanelProperty { |
|
43 |
enum State { |
|
44 |
None = 0, |
|
45 |
Active = 1, |
|
46 |
Visible = (1 << 1) |
|
47 |
};
|
|
48 |
Q_DECLARE_FLAGS(States, State) |
|
49 |
||
50 |
KimpanelProperty() { } |
|
51 |
||
52 |
KimpanelProperty(QString key, QString label, QString icon, QString tip, int state, QString menu) { |
|
53 |
this->key = key; |
|
54 |
this->label = label; |
|
55 |
this->tip = tip; |
|
56 |
this->icon = icon; |
|
57 |
this->state = (State) state; |
|
58 |
this->menu = menu; |
|
59 |
}
|
|
60 |
||
61 |
QString key; |
|
62 |
QString label; |
|
63 |
QString icon; |
|
64 |
QString tip; |
|
65 |
States state; |
|
66 |
QString menu; |
|
67 |
||
68 |
QVariantMap toMap() const { |
|
69 |
QVariantMap map; |
|
70 |
map["key"] = key; |
|
71 |
map["label"] = label; |
|
72 |
map["icon"] = icon; |
|
73 |
map["tip"] = tip; |
|
74 |
map["state"] = (int) state; |
|
75 |
map["menu"] = menu; |
|
76 |
return map; |
|
77 |
}
|
|
78 |
};
|
|
79 |
Q_DECLARE_OPERATORS_FOR_FLAGS(KimpanelProperty::States) |
|
80 |
||
81 |
struct KimpanelLookupTable { |
|
82 |
struct Entry { |
|
83 |
QString label; //存放标号字符串,比如“1.”,“2.”,“3.”,“4.”,“5.” |
|
84 |
QString text; //存放候选词字符串,比如“啊”,“阿”,“吖”,“呵”,“腌” |
|
85 |
QList<TextAttribute> attr; |
|
86 |
};
|
|
87 |
||
88 |
QList<Entry> entries; |
|
89 |
bool has_prev; |
|
90 |
bool has_next; |
|
91 |
};
|
|
92 |
||
93 |
#endif // KIMPANEL_AGENTTYPE_H |