~josephjamesmills/ubuntutv/mockup-ppa-branch

« back to all changes in this revision

Viewing changes to Unity-2d/ubuntu-tv/libunity-2d-private/src/filteroption.cpp

  • Committer: Joseph Mills
  • Date: 2012-11-19 21:25:03 UTC
  • Revision ID: josephjamesmills@gmail.com-20121119212503-lwix013dozhb0ar4
adding Unity 2d stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Florian Boucault <florian.boucault@canonical.com>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; version 3.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
// Self
 
21
#include "filteroption.h"
 
22
 
 
23
// libunity-core
 
24
#include <UnityCore/Filter.h>
 
25
 
 
26
FilterOption::FilterOption(unity::dash::FilterOption::Ptr unityFilterOption, QObject *parent) :
 
27
    QObject(parent), m_unityFilterOption(NULL)
 
28
{
 
29
    setUnityFilterOption(unityFilterOption);
 
30
}
 
31
 
 
32
QString FilterOption::id() const
 
33
{
 
34
    return QString::fromStdString(m_unityFilterOption->id());
 
35
}
 
36
 
 
37
QString FilterOption::name() const
 
38
{
 
39
    return QString::fromStdString(m_unityFilterOption->name());
 
40
}
 
41
 
 
42
QString FilterOption::iconHint() const
 
43
{
 
44
    return QString::fromStdString(m_unityFilterOption->icon_hint());
 
45
}
 
46
 
 
47
bool FilterOption::active() const
 
48
{
 
49
    return m_unityFilterOption->active();
 
50
}
 
51
 
 
52
void FilterOption::setActive(bool active)
 
53
{
 
54
    m_unityFilterOption->active = active;
 
55
}
 
56
 
 
57
void FilterOption::setUnityFilterOption(unity::dash::FilterOption::Ptr unityFilterOption)
 
58
{
 
59
    if (m_unityFilterOption != NULL) {
 
60
        // FIXME: should disconnect from m_unityFilterOption's signals
 
61
    }
 
62
 
 
63
    m_unityFilterOption = unityFilterOption;
 
64
 
 
65
    /* Property change signals */
 
66
    m_unityFilterOption->id.changed.connect(sigc::mem_fun(this, &FilterOption::idChanged));
 
67
    m_unityFilterOption->name.changed.connect(sigc::mem_fun(this, &FilterOption::nameChanged));
 
68
    m_unityFilterOption->icon_hint.changed.connect(sigc::mem_fun(this, &FilterOption::iconHintChanged));
 
69
    m_unityFilterOption->active.changed.connect(sigc::mem_fun(this, &FilterOption::activeChanged));
 
70
}
 
71
 
 
72
#include "filteroption.moc"