forked from lmq3342xja/fcitx-qimpanel
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathkimpanelagent.h
123 lines (107 loc) · 4.63 KB
/
kimpanelagent.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/***************************************************************************
* Copyright (C) 2009 by Wang Hoi <[email protected]> *
* Copyright (C) 2011 by CSSlayer <[email protected]> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef KIMPANEL_AGENT_H
#define KIMPANEL_AGENT_H
#include "kimpanelagenttype.h"
// Qt
#include <QObject>
#include <QStringList>
#include <QDBusContext>
class QDBusServiceWatcher;
class Impanel2Adaptor;
class ImpanelAdaptor;
class PanelAgent: public QObject, protected QDBusContext
{
Q_OBJECT
public:
PanelAgent(QObject *parent);
virtual ~PanelAgent();
void configure();
void created();
void exit();
void restart();
void reloadConfig();
void selectCandidate(int idx);
void lookupTablePageUp();
void lookupTablePageDown();
void movePreeditCaret(int pos);
void triggerProperty(const QString& key);
public: // PROPERTIES
public Q_SLOTS: // METHODS
void UpdateLookupTable(const QStringList &labels,
const QStringList &candis,
const QStringList &attrlists,
bool has_prev, bool has_next);
void UpdatePreeditText(const QString &text, const QString &attr);
void UpdateAux(const QString &text, const QString &attr);
void UpdateScreen(int screen_id);
void UpdateProperty(const QString &prop);
void RegisterProperties(const QStringList &props);
void ExecDialog(const QString &prop);
void ExecMenu(const QStringList &entries);
void SetSpotRect(int x, int y, int w, int h);
void SetLookupTable(const QStringList &labels,
const QStringList &candis,
const QStringList &attrlists, //layout参数:用来覆盖是否要强制竖排/横排
bool hasPrev, bool hasNext, int cursor, int layout);
void serviceUnregistered(const QString& service);
Q_SIGNALS:
// signals that from kimpanel
void Configure();
void MovePreeditCaret(int position);
void SelectCandidate(int index);
void LookupTablePageUp();
void LookupTablePageDown();
void TriggerProperty(const QString &key);
void PanelCreated();
void PanelCreated2();
void Exit();
void Restart();
void ReloadConfig();
// signals to inform kimpanel
void enable(bool to_enable);
void updatePreeditCaret(int pos);
void updatePreeditText(const QString &text, const QList<TextAttribute> &attr);
void updateAux(const QString &text, const QList<TextAttribute> &attr);
void updateProperty(const KimpanelProperty &prop);
void updateLookupTable(const KimpanelLookupTable &lookup_table);
void updateLookupTableFull(const KimpanelLookupTable& lookup_table, int cursor, int layout);
void updateSpotLocation(int x, int y);
void updateSpotRect(int x, int y, int w, int h);
void registerProperties(const QList<KimpanelProperty> &props);
void execDialog(const KimpanelProperty &prop);
void execMenu(const QList<KimpanelProperty> &prop_list);
void showPreedit(bool to_show);
void showAux(bool to_show);
void showLookupTable(bool to_show);
void updateLookupTableCursor(int pos);
private:
bool m_show_aux;
bool m_show_preedit;
bool m_show_lookup_table;
int m_spot_x;
int m_spot_y;
QString m_currentService;
QStringList cached_props;
ImpanelAdaptor* adaptor;
Impanel2Adaptor* adaptor2;
QDBusServiceWatcher* watcher;
};
#endif // KIMPANEL_AGENT_H