summaryrefslogtreecommitdiffstats
path: root/homescreen/src/layouthandler.h
blob: 4b9e5101ce7d04027fa5b83a39db9bcb30521401 (plain)
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
/*
 * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef LAYOUTHANDLER_H
#define LAYOUTHANDLER_H

#include <QObject>
#include <libwindowmanager.h>

class LayoutHandler : public QObject
{
    Q_OBJECT
public:
    explicit LayoutHandler(QObject *parent = 0);
    ~LayoutHandler();

    void init(int port, const char* token);
    void activateSurface();

signals:

public slots:
    void slotActivateSurface();
    void slotHomeButton();

private:
     LibWindowmanager* mp_wm;
    bool isActived;
};

#endif // LAYOUTHANDLER_H
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
WRAP-JSON facility
==================

The facility wrap-json is based on the pack/unpack API on the
libray jansson. The two chapters below are copied from the
documentation of jansson library copyrighted by Petri Lehtinen
(see at end).

Building Values
---------------

This section describes functions that help to create, or *pack*, complex
JSON values, especially nested objects and arrays. Value building is
based on a *format string* that is used to tell the functions about the
expected arguments.

For example, the format string `"i"` specifies a single integer value,
while the format string `"[ssb]"` or the equivalent `"[s, s, b]"`
specifies an array value with two strings and a boolean as its items:

    /* Create the JSON integer 42 */
    wrap_json_pack(&result, "i", 42);

    /* Create the JSON array ["foo", "bar", true] */
    wrap_json_pack(&result, "[ssb]", "foo", "bar", 1);

Here's the full list of format specifiers. The type in parentheses
denotes the resulting JSON type, and the type in brackets (if any)
denotes the C type that is expected as the corresponding argument or
arguments.

`s` (string) \[const char \*\]

:   Convert a null terminated UTF-8 string to a JSON string.

`s?` (string) \[const char \*\]

:   Like `s`, but if the argument is *NULL*, output a JSON null value.

`s*` (string) \[const char \*\]

:   Like `s`, but if the argument is *NULL*, do not output any value.
    This format can only be used inside an object or an array. If used
    inside an object, the corresponding key is additionally suppressed
    when the value is omitted. See below for an example.

`s#` (string) \[const char \*, int\]

:   Convert a UTF-8 buffer of a given length to a JSON string.

`s%` (string) \[const char \*, size\_t\]

:   Like `s#` but the length argument is of type size\_t.

`+` \[const char \*\]

:   Like `s`, but concatenate to the previous string. Only valid after
    `s`, `s#`, `+` or `+#`.

`+#` \[const char \*, int\]

:   Like `s#`, but concatenate to the previous string. Only valid after
    `s`, `s#`, `+` or `+#`.

`+%` (string) \[const char \*, size\_t\]

:   Like `+#` but the length argument is of type size\_t.

`n` (null)

:   Output a JSON null value. No argument is consumed.

`b` (boolean) \[int\]

:   Convert a C int to JSON boolean value. Zero is converted to `false`
    and non-zero to `true`.

`i` (integer) \[int\]

:   Convert a C int to JSON integer.

`I` (integer) \[json\_int\_t\]

:   Convert a C json\_int\_t to JSON integer.

`f` (real) \[double\]

:   Convert a C double to JSON real.

`o` (any value) \[json\_t \*\]

:   Output any given JSON value as-is. If the value is added to an array
    or object, the reference to the value passed to `o` is stolen by the
    container.

`O` (any value) \[json\_t \*\]

:   Like `o`, but the argument's reference count is incremented. This is
    useful if you pack into an array or object and want to keep the
    reference for the JSON value consumed by `O` to yourself.

`o?`, `O?` (any value) \[json\_t \*\]

:   Like `o` and `O`, respectively, but if the argument is *NULL*,
    output a JSON null value.

`o*`, `O*` (any value) \[json\_t \*\]

:   Like `o` and `O`, respectively, but if the argument is *NULL*, do
    not output any value. This format can only be used inside an object
    or an array. If used inside an object, the corresponding key is
    additionally suppressed. See below for an example.

`[fmt]` (array)

:   Build an array with contents from the inner format string. `fmt` may
    contain objects and arrays, i.e. recursive value building is
    supported.

`{fmt}` (object)

:   Build an object with contents from the inner format string `fmt`.
    The first, third, etc. format specifier represent a key, and must be
    a string (see `s`, `s#`, `+` and `+#` above), as object keys are
    always strings. The second, fourth, etc. format specifier represent
    a value. Any value may be an object or array, i.e. recursive value
    building is supported.

Whitespace, `:` and `,` are ignored.

More examples:

    /* Build an empty JSON object */
    wrap_json_pack(&result, "{}");

    /* Build the JSON object {"foo": 42, "bar": 7} */
    wrap_json_pack(&result, "{sisi}", "foo", 42, "bar", 7);

    /* Like above, ':', ',' and whitespace are ignored */
    wrap_json_pack(&result, "{s:i, s:i}", "foo", 42, "bar", 7);

    /* Build the JSON array [[1, 2], {"cool": true}] */
    wrap_json_pack(&result, "[[i,i],{s:b}]", 1, 2, "cool", 1);

    /* Build a string from a non-null terminated buffer */
    char buffer[4] = {'t', 'e', 's', 't'};
    wrap_json_pack(&result, "s#", buffer, 4);

    /* Concatenate strings together to build the JSON string "foobarbaz" */
    wrap_json_pack(&result, "s++", "foo", "bar", "baz");

    /* Create an empty object or array when optional members are missing */
    wrap_json_pack(&result, "{s:s*,s:o*,s:O*}", "foo", NULL, "bar", NULL, "baz", NULL);
    wrap_json_pack(&result, "[s*,o*,O*]", NULL, NULL, NULL);

Parsing and Validating Values
-----------------------------

This section describes functions that help to validate complex values
and extract, or *unpack*, data from them. Like building values
&lt;apiref-pack&gt;, this is also based on format strings.

While a JSON value is unpacked, the type specified in the format string
is checked to match that of the JSON value. This is the validation part
of the process. In addition to this, the unpacking functions can also
check that all items of arrays and objects are unpacked. This check be
enabled with the format specifier `!` or by using the flag
`JSON_STRICT`. See below for details.

Here's the full list of format specifiers. The type in parentheses
denotes the JSON type, and the type in brackets (if any) denotes the C
type whose address should be passed.

`s` (string) \[const char \*\]

:   Convert a JSON string to a pointer to a null terminated UTF-8
    string. The resulting string is extracted by using
    json\_string\_value() internally, so it exists as long as there are
    still references to the corresponding JSON string.

`s%` (string) \[const char \*, size\_t \*\]

:   Convert a JSON string to a pointer to a null terminated UTF-8 string
    and its length.

`n` (null)

:   Expect a JSON null value. Nothing is extracted.

`b` (boolean) \[int\]

:   Convert a JSON boolean value to a C int, so that `true` is converted
    to 1 and `false` to 0.

`i` (integer) \[int\]

:   Convert a JSON integer to C int.

`I` (integer) \[json\_int\_t\]

:   Convert a JSON integer to C json\_int\_t.

`f` (real) \[double\]

:   Convert a JSON real to C double.

`F` (integer or real) \[double\]

:   Convert a JSON number (integer or real) to C double.

`o` (any value) \[json\_t \*\]

:   Store a JSON value with no conversion to a json\_t pointer.

`O` (any value) \[json\_t \*\]

:   Like `O`, but the JSON value's reference count is incremented.

`[fmt]` (array)

:   Convert each item in the JSON array according to the inner format
    string. `fmt` may contain objects and arrays, i.e. recursive value
    extraction is supported.

`{fmt}` (object)

:   Convert each item in the JSON object according to the inner format
    string `fmt`. The first, third, etc. format specifier represent a
    key, and must be `s`. The corresponding argument to unpack functions
    is read as the object key. The second fourth, etc. format specifier
    represent a value and is written to the address given as the
    corresponding argument. **Note** that every other argument is read
    from and every other is written to.

    `fmt` may contain objects and arrays as values, i.e. recursive value
    extraction is supported.

`!`

:   This special format specifier is used to enable the check that all
    object and array items are accessed, on a per-value basis. It must
    appear inside an array or object as the last format specifier before
    the closing bracket or brace.

`*`

:   This special format specifier is the opposite of `!`. This is the default.
    It must appear inside an array or object as the last format specifier
    before the closing bracket or brace.

Whitespace, `:` and `,` are ignored.

Examples:

    /* root is the JSON integer 42 */
    int myint;
    wrap_json_unpack(root, "i", &myint);
    assert(myint == 42);

    /* root is the JSON object {"foo": "bar", "quux": true} */
    const char *str;
    int boolean;
    wrap_json_unpack(root, "{s:s, s:b}", "foo", &str, "quux", &boolean);
    assert(strcmp(str, "bar") == 0 && boolean == 1);

    /* root is the JSON array [[1, 2], {"baz": null} */
    wrap_json_check(root, "[[i,i], {s:n}]", "baz");
    /* returns 0 for validation success, nothing is extracted */

    /* root is the JSON array [1, 2, 3, 4, 5] */
    int myint1, myint2;
    wrap_json_unpack(root, "[ii!]", &myint1, &myint2);
    /* returns -1 for failed validation */

    /* root is an empty JSON object */
    int myint = 0, myint2 = 0, myint3 = 0;
    wrap_json_unpack(root, "{s?i, s?[ii]}",
                "foo", &myint1,
                "bar", &myint2, &myint3);
    /* myint1, myint2 or myint3 is no touched as "foo" and "bar" don't exist */


Copyright
---------

Copyright (c) 2009-2016 Petri Lehtinen <petri@digip.org>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.