2
* Copyright (C) 2015 Canonical Ltd
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.
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.
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/>.
16
* Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
19
#include <unity/scopes/qt/internal/QPreviewReplyImpl.h>
20
#include <unity/scopes/qt/internal/QColumnLayoutImpl.h>
21
#include <unity/scopes/qt/internal/QPreviewWidgetImpl.h>
23
#include <unity/scopes/qt/QUtils.h>
25
#include <unity/scopes/ColumnLayout.h>
26
#include <unity/scopes/PreviewReply.h>
28
#include <QtCore/QListIterator>
30
using namespace unity::scopes;
31
using namespace unity::scopes::qt::internal;
33
bool QPreviewReplyImpl::register_layout(QColumnLayoutList const& layouts)
35
ColumnLayoutList api_list;
36
QListIterator<QColumnLayout> it(layouts);
40
api_list.push_back(ColumnLayout(*it.next().p->api_layout_));
42
return api_reply_->register_layout(api_list);
45
bool QPreviewReplyImpl::push(QPreviewWidgetList const& widget_list)
47
PreviewWidgetList api_list;
48
QListIterator<QPreviewWidget> it(widget_list);
51
api_list.push_back(PreviewWidget(*it.next().p->api_widget_));
53
return api_reply_->push(api_list);
56
bool QPreviewReplyImpl::push(QString const& key, QVariant const& value)
58
return api_reply_->push(key.toUtf8().data(), qVariantToScopeVariant(value));
61
QPreviewReplyImpl::~QPreviewReplyImpl() = default;
63
QPreviewReplyImpl::QPreviewReplyImpl(unity::scopes::PreviewReplyProxy& reply)