~mardy/unity-scopes-api/clientid-1554040

« back to all changes in this revision

Viewing changes to src/scopes/qt/internal/QPreviewReplyImpl.cpp

  • Committer: Michi Henning
  • Date: 2015-02-25 05:20:57 UTC
  • mfrom: (163.386.1 devel)
  • mto: (163.386.2 devel)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: michi.henning@canonical.com-20150225052057-9p21sge1myzaowcb
Merged devel and resolved conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
 
17
 */
 
18
 
 
19
#include <unity/scopes/qt/internal/QPreviewReplyImpl.h>
 
20
#include <unity/scopes/qt/internal/QColumnLayoutImpl.h>
 
21
#include <unity/scopes/qt/internal/QPreviewWidgetImpl.h>
 
22
 
 
23
#include <unity/scopes/qt/QUtils.h>
 
24
 
 
25
#include <unity/scopes/ColumnLayout.h>
 
26
#include <unity/scopes/PreviewReply.h>
 
27
 
 
28
#include <QtCore/QListIterator>
 
29
 
 
30
using namespace unity::scopes;
 
31
using namespace unity::scopes::qt::internal;
 
32
 
 
33
bool QPreviewReplyImpl::register_layout(QColumnLayoutList const& layouts)
 
34
{
 
35
    ColumnLayoutList api_list;
 
36
    QListIterator<QColumnLayout> it(layouts);
 
37
 
 
38
    while (it.hasNext())
 
39
    {
 
40
        api_list.push_back(ColumnLayout(*it.next().p->api_layout_));
 
41
    }
 
42
    return api_reply_->register_layout(api_list);
 
43
}
 
44
 
 
45
bool QPreviewReplyImpl::push(QPreviewWidgetList const& widget_list)
 
46
{
 
47
    PreviewWidgetList api_list;
 
48
    QListIterator<QPreviewWidget> it(widget_list);
 
49
    while (it.hasNext())
 
50
    {
 
51
        api_list.push_back(PreviewWidget(*it.next().p->api_widget_));
 
52
    }
 
53
    return api_reply_->push(api_list);
 
54
}
 
55
 
 
56
bool QPreviewReplyImpl::push(QString const& key, QVariant const& value)
 
57
{
 
58
    return api_reply_->push(key.toUtf8().data(), qVariantToScopeVariant(value));
 
59
}
 
60
 
 
61
QPreviewReplyImpl::~QPreviewReplyImpl() = default;
 
62
 
 
63
QPreviewReplyImpl::QPreviewReplyImpl(unity::scopes::PreviewReplyProxy& reply)
 
64
    : api_reply_(reply)
 
65
{
 
66
}