2
* Copyright (C) 2011, 2013 Canonical, Ltd.
5
* Florian Boucault <florian.boucault@canonical.com>
6
* Pawel Stolowski <pawel.stolowski@canonical.com>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; version 3.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
#include "filteroption.h"
25
#include <UnityCore/Filter.h>
27
FilterOption::FilterOption(unity::dash::FilterOption::Ptr unityFilterOption, QObject *parent) :
28
AbstractFilterOption(parent), m_unityFilterOption(nullptr)
30
setUnityFilterOption(unityFilterOption);
33
QString FilterOption::id() const
35
return QString::fromStdString(m_unityFilterOption->id());
38
QString FilterOption::name() const
40
return QString::fromStdString(m_unityFilterOption->name());
43
QString FilterOption::iconHint() const
45
return QString::fromStdString(m_unityFilterOption->icon_hint());
48
bool FilterOption::active() const
50
return m_unityFilterOption->active();
53
void FilterOption::setActive(bool active)
55
m_unityFilterOption->active = active;
58
void FilterOption::setUnityFilterOption(unity::dash::FilterOption::Ptr unityFilterOption)
60
if (m_unityFilterOption != nullptr) {
61
m_signals.disconnectAll();
64
m_unityFilterOption = unityFilterOption;
66
/* Property change signals */
67
m_signals << m_unityFilterOption->id.changed.connect(sigc::mem_fun(this, &FilterOption::onIdChanged))
68
<< m_unityFilterOption->name.changed.connect(sigc::mem_fun(this, &FilterOption::onNameChanged))
69
<< m_unityFilterOption->icon_hint.changed.connect(sigc::mem_fun(this, &FilterOption::onIconHintChanged))
70
<< m_unityFilterOption->active.changed.connect(sigc::mem_fun(this, &FilterOption::onActiveChanged));
73
void FilterOption::onIdChanged(const std::string &id)
75
Q_EMIT idChanged(QString::fromStdString(id));
78
void FilterOption::onNameChanged(const std::string &name)
80
Q_EMIT nameChanged(QString::fromStdString(name));
83
void FilterOption::onIconHintChanged(const std::string &iconHint)
85
Q_EMIT iconHintChanged(QString::fromStdString(iconHint));
88
void FilterOption::onActiveChanged(bool active)
90
Q_EMIT activeChanged(active);