on 436b607 help sign in
unity8/tests/mocks/Ubuntu/Telephony/MockCallManager.cpp
80 lines 2.1 kB history raw
1/*
2 * Copyright (C) 2014 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 *
16 * Authored by: Nick Dedekind <nick.dedekind@canonical.com
17 */
19#include "MockCallManager.h"
21MockCallManager::MockCallManager(QObject *parent)
22 : QObject(parent)
23 , m_foregroundCall(nullptr)
24 , m_backgroundCall(nullptr)
25 , m_callIndicatorVisible(false)
29MockCallManager *MockCallManager::instance()
31 static MockCallManager* manager = new MockCallManager();
32 return manager;
35QObject* MockCallManager::foregroundCall() const
37 return m_foregroundCall;
40void MockCallManager::setForegroundCall(QObject* foregroundCall)
42 if(m_foregroundCall != foregroundCall){
43 m_foregroundCall = foregroundCall;
44 Q_EMIT foregroundCallChanged();
45 Q_EMIT hasCallsChanged();
46 }
49QObject* MockCallManager::backgroundCall() const
51 return m_backgroundCall;
54void MockCallManager::setBackgroundCall(QObject* backgroundCall)
56 if(m_backgroundCall != backgroundCall){
57 m_backgroundCall = backgroundCall;
58 Q_EMIT backgroundCallChanged();
59 Q_EMIT hasCallsChanged();
60 }
63bool MockCallManager::hasCalls() const
65 return m_foregroundCall || m_backgroundCall;
69bool MockCallManager::callIndicatorVisible() const
71 return m_callIndicatorVisible;
74void MockCallManager::setCallIndicatorVisible(bool callIndicatorVisible)
76 if(m_callIndicatorVisible != callIndicatorVisible){
77 m_callIndicatorVisible = callIndicatorVisible;
78 Q_EMIT callIndicatorVisibleChanged();
79 }