| 1 |
/* |
| 2 |
* Copyright (C) 2012~2017 by CSSlayer |
| 3 |
* [email protected] |
| 4 |
* |
| 5 |
* Redistribution and use in source and binary forms, with or without |
| 6 |
* modification, are permitted provided that the following conditions |
| 7 |
* are met: |
| 8 |
* |
| 9 |
* 1. Redistributions of source code must retain the above Copyright |
| 10 |
* notice, this list of conditions and the following disclaimer. |
| 11 |
* |
| 12 |
* 2. Redistributions in binary form must reproduce the above Copyright |
| 13 |
* notice, this list of conditions and the following disclaimer in the |
| 14 |
* documentation and/or other materials provided with the distribution. |
| 15 |
* |
| 16 |
* 3. Neither the name of the authors nor the names of its contributors |
| 17 |
* may be used to endorse or promote products derived from this |
| 18 |
* software without specific prior written permission. |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef _DBUSADDONS_FCITXQTDBUSTYPES_H_ |
| 22 |
#define _DBUSADDONS_FCITXQTDBUSTYPES_H_ |
| 23 |
|
| 24 |
#include <QDBusArgument> |
| 25 |
#include <QList> |
| 26 |
#include <QMetaType> |
| 27 |
|
| 28 |
class FcitxFormattedPreedit { |
| 29 |
public: |
| 30 |
const QString &string() const; |
| 31 |
qint32 format() const; |
| 32 |
void setString(const QString &str); |
| 33 |
void setFormat(qint32 format); |
| 34 |
|
| 35 |
static void registerMetaType(); |
| 36 |
|
| 37 |
bool operator==(const FcitxFormattedPreedit &preedit) const; |
| 38 |
|
| 39 |
private: |
| 40 |
QString m_string; |
| 41 |
qint32 m_format = 0; |
| 42 |
}; |
| 43 |
|
| 44 |
typedef QList<FcitxFormattedPreedit> FcitxFormattedPreeditList; |
| 45 |
|
| 46 |
QDBusArgument &operator<<(QDBusArgument &argument, |
| 47 |
const FcitxFormattedPreedit &im); |
| 48 |
const QDBusArgument &operator>>(const QDBusArgument &argument, |
| 49 |
FcitxFormattedPreedit &im); |
| 50 |
|
| 51 |
class FcitxInputContextArgument { |
| 52 |
public: |
| 53 |
FcitxInputContextArgument() {} |
| 54 |
FcitxInputContextArgument(const QString &name, const QString &value) |
| 55 |
: m_name(name), m_value(value) {} |
| 56 |
|
| 57 |
static void registerMetaType(); |
| 58 |
|
| 59 |
const QString &name() const; |
| 60 |
const QString &value() const; |
| 61 |
void setName(const QString &); |
| 62 |
void setValue(const QString &); |
| 63 |
|
| 64 |
private: |
| 65 |
QString m_name; |
| 66 |
QString m_value; |
| 67 |
}; |
| 68 |
|
| 69 |
typedef QList<FcitxInputContextArgument> FcitxInputContextArgumentList; |
| 70 |
|
| 71 |
QDBusArgument &operator<<(QDBusArgument &argument, |
| 72 |
const FcitxInputContextArgument &im); |
| 73 |
const QDBusArgument &operator>>(const QDBusArgument &argument, |
| 74 |
FcitxInputContextArgument &im); |
| 75 |
|
| 76 |
Q_DECLARE_METATYPE(FcitxFormattedPreedit) |
| 77 |
Q_DECLARE_METATYPE(FcitxFormattedPreeditList) |
| 78 |
|
| 79 |
Q_DECLARE_METATYPE(FcitxInputContextArgument) |
| 80 |
Q_DECLARE_METATYPE(FcitxInputContextArgumentList) |
| 81 |
|
| 82 |
#endif // _DBUSADDONS_FCITXQTDBUSTYPES_H_ |