File: fcitxqtdbustypes.h

package info (click to toggle)
fcitx-qt5 1.2.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 940 kB
  • sloc: cpp: 6,202; xml: 340; makefile: 12; sh: 4
file content (82 lines) | stat: -rw-r--r-- 2,537 bytes parent folder | download | duplicates (3)
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
/*
 * Copyright (C) 2012~2017 by CSSlayer
 * wengxt@gmail.com
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above Copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above Copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * 3. Neither the name of the authors nor the names of its contributors
 *    may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 */

#ifndef _DBUSADDONS_FCITXQTDBUSTYPES_H_
#define _DBUSADDONS_FCITXQTDBUSTYPES_H_

#include <QDBusArgument>
#include <QList>
#include <QMetaType>

class FcitxFormattedPreedit {
public:
    const QString &string() const;
    qint32 format() const;
    void setString(const QString &str);
    void setFormat(qint32 format);

    static void registerMetaType();

    bool operator==(const FcitxFormattedPreedit &preedit) const;

private:
    QString m_string;
    qint32 m_format = 0;
};

typedef QList<FcitxFormattedPreedit> FcitxFormattedPreeditList;

QDBusArgument &operator<<(QDBusArgument &argument,
                          const FcitxFormattedPreedit &im);
const QDBusArgument &operator>>(const QDBusArgument &argument,
                                FcitxFormattedPreedit &im);

class FcitxInputContextArgument {
public:
    FcitxInputContextArgument() {}
    FcitxInputContextArgument(const QString &name, const QString &value)
        : m_name(name), m_value(value) {}

    static void registerMetaType();

    const QString &name() const;
    const QString &value() const;
    void setName(const QString &);
    void setValue(const QString &);

private:
    QString m_name;
    QString m_value;
};

typedef QList<FcitxInputContextArgument> FcitxInputContextArgumentList;

QDBusArgument &operator<<(QDBusArgument &argument,
                          const FcitxInputContextArgument &im);
const QDBusArgument &operator>>(const QDBusArgument &argument,
                                FcitxInputContextArgument &im);

Q_DECLARE_METATYPE(FcitxFormattedPreedit)
Q_DECLARE_METATYPE(FcitxFormattedPreeditList)

Q_DECLARE_METATYPE(FcitxInputContextArgument)
Q_DECLARE_METATYPE(FcitxInputContextArgumentList)

#endif // _DBUSADDONS_FCITXQTDBUSTYPES_H_