on 4e86d64 help sign in
unity8/tests/mocks/Ubuntu/Telephony/MockCallManager.cpp
65 lines 1.7 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)
28MockCallManager *MockCallManager::instance()
30 static MockCallManager* manager = new MockCallManager();
31 return manager;
34QObject* MockCallManager::foregroundCall() const
36 return m_foregroundCall;
39void MockCallManager::setForegroundCall(QObject* foregroundCall)
41 if(m_foregroundCall != foregroundCall){
42 m_foregroundCall = foregroundCall;
43 Q_EMIT foregroundCallChanged();
44 Q_EMIT hasCallsChanged();
45 }
48QObject* MockCallManager::backgroundCall() const
50 return m_backgroundCall;
53void MockCallManager::setBackgroundCall(QObject* backgroundCall)
55 if(m_backgroundCall != backgroundCall){
56 m_backgroundCall = backgroundCall;
57 Q_EMIT backgroundCallChanged();
58 Q_EMIT hasCallsChanged();
59 }
62bool MockCallManager::hasCalls() const
64 return m_foregroundCall || m_backgroundCall;