on 16fa310 help sign in
unity8/tests/mocks/Unity/fake_valuesliderfilter.cpp
84 lines 2.0 kB history raw
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 General Public License as published by
6 * the Free Software Foundation; version 3.
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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#include "fake_valuesliderfilter.h"
18#include "fake_valueslidervalues.h"
20FakeValueSliderFilter::FakeValueSliderFilter(const QString &id, const QString &tag, double value, double minValue, double maxValue, const QMap<double, QString> &labels, QObject* parent)
21 : unity::shell::scopes::ValueSliderFilterInterface(parent),
22 m_filterId(id),
23 m_filterTag(tag),
24 m_value(value),
25 m_minValue(minValue),
26 m_maxValue(maxValue),
27 m_values(new FakeValueSliderValues(labels, this))
31QString FakeValueSliderFilter::filterId() const
33 return m_filterId;
36QString FakeValueSliderFilter::filterTag() const
38 return m_filterTag;
41QString FakeValueSliderFilter::title() const
43 return m_title;
46double FakeValueSliderFilter::value() const
48 return m_value;
51void FakeValueSliderFilter::setValue(double value)
53 if (value != m_value) {
54 m_value = value;
55 Q_EMIT valueChanged();
56 }
59double FakeValueSliderFilter::minValue() const
61 return m_minValue;
64double FakeValueSliderFilter::maxValue() const
66 return m_maxValue;
69unity::shell::scopes::ValueSliderValuesInterface* FakeValueSliderFilter::values() const
71 return m_values;
74bool FakeValueSliderFilter::isActive() const
76 // Doesn't really matter
77 return false;
80void FakeValueSliderFilter::setTitle(const QString &title)
82 m_title = title;
83 Q_EMIT titleChanged();