~timo-jyrinki/ubuntu/trusty/maliit-framework/fix_qt52

« back to all changes in this revision

Viewing changes to src/maliit/plugins/testsurfacefactory.cpp

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo, Sergio Schvezov, Ricardo Salveti de Araujo
  • Date: 2013-07-23 19:47:04 UTC
  • mfrom: (1.1.2) (1.2.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130723194704-1lsy1kmlda069cea
Tags: 0.99.0+git20130615+97e8335-0ubuntu1
[ Sergio Schvezov ]
* New build from HEAD 97e8335.
* Packaging import from lp:phablet-extras/maliit-framework.

[ Ricardo Salveti de Araujo ]
* debian/control: adding vcs and fixing dependencies
* General package cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* * This file is part of Maliit framework *
2
 
 *
3
 
 * Copyright (C) 2012 Openismus GmbH
4
 
 *
5
 
 * Contact: maliit-discuss@lists.maliit.org
6
 
 *
7
 
 * This library is free software; you can redistribute it and/or
8
 
 * modify it under the terms of the GNU Lesser General Public
9
 
 * License version 2.1 as published by the Free Software Foundation
10
 
 * and appearing in the file LICENSE.LGPL included in the packaging
11
 
 * of this file.
12
 
 */
13
 
 
14
 
#include "testsurfacefactory.h"
15
 
#include "windowedsurface.h"
16
 
 
17
 
namespace Maliit {
18
 
namespace Plugins {
19
 
 
20
 
//! \ingroup pluginapi
21
 
//! \brief Allows to create a surface without a running maliit-server instance. Useful for tests.
22
 
//!
23
 
//! \note Plugins must not use this, but should instead use the Maliit::Plugins::AbstractSurfaceFactory
24
 
//! returned by MAbstractInputMethodHost::surfaceFactory().
25
 
//!
26
 
//! \param options the options the surface should have
27
 
//! \param parent the parent of the new surface
28
 
//! \returns a new shared Maliit::Plugins::AbstractSurface
29
 
QSharedPointer<AbstractSurface> createTestSurface(AbstractSurface::Options options,
30
 
                                                  const QSharedPointer<AbstractSurface> &parent)
31
 
{
32
 
    static Maliit::Server::WindowedSurfaceFactory factory;
33
 
 
34
 
    return factory.create(options, parent);
35
 
}
36
 
 
37
 
//! \ingroup pluginapi
38
 
//! \brief Allows to create a graphics view surface without a running maliit-server instance. Useful for tests.
39
 
//!
40
 
//! \note Plugins must not use this, but should instead use the Maliit::Plugins::AbstractSurfaceFactory
41
 
//! returned by MAbstractInputMethodHost::surfaceFactory().
42
 
//!
43
 
//! \param parent the parent of the new surface
44
 
//! \returns a new shared Maliit::Plugins::AbstractGraphicsViewSurface
45
 
QSharedPointer<AbstractGraphicsViewSurface> createTestGraphicsViewSurface(const QSharedPointer<AbstractSurface> &parent)
46
 
{
47
 
    QSharedPointer<AbstractSurface> surface;
48
 
 
49
 
    if (parent) {
50
 
        surface = createTestSurface(AbstractSurface::PositionOverlay | AbstractSurface::TypeGraphicsView, parent);
51
 
    } else {
52
 
        surface = createTestSurface(AbstractSurface::PositionCenterBottom | AbstractSurface::TypeGraphicsView, parent);
53
 
    }
54
 
 
55
 
    return qSharedPointerDynamicCast<AbstractGraphicsViewSurface>(surface);
56
 
}
57
 
 
58
 
//! \ingroup pluginapi
59
 
//! \brief Allows to create a widget surface without a running maliit-server instance. Useful for tests.
60
 
//!
61
 
//! \note Plugins must not use this, but should instead use the Maliit::Plugins::AbstractSurfaceFactory
62
 
//! returned by MAbstractInputMethodHost::surfaceFactory().
63
 
//!
64
 
//! \param parent the parent of the new surface
65
 
//! \returns a new shared Maliit::Plugins::AbstractWidgetSurface
66
 
QSharedPointer<AbstractWidgetSurface> createTestWidgetSurface(const QSharedPointer<AbstractSurface> &parent)
67
 
{
68
 
    QSharedPointer<AbstractSurface> surface;
69
 
 
70
 
    if (parent) {
71
 
        surface = createTestSurface(AbstractSurface::PositionOverlay | AbstractSurface::TypeWidget, parent);
72
 
    } else {
73
 
        surface = createTestSurface(AbstractSurface::PositionCenterBottom | AbstractSurface::TypeWidget, parent);
74
 
    }
75
 
 
76
 
    return qSharedPointerDynamicCast<AbstractWidgetSurface>(surface);
77
 
}
78
 
 
79
 
} // namespace Plugins
80
 
} // namespace Maliit