blob: ec61ffd8d4b36e2af8945d7ae93db597b4eeba79 [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001/*
2 * Copyright (C) 2019-2020 by Savoir-faire Linux
3 * Author: Yang Wang <yang.wang@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include "clientwrapper.h"
20
21ClientWrapper::ClientWrapper(QObject *parent)
22 : QObject(parent)
23{
24 connect(getAccountAdapter(), &AccountAdapter::accountSignalsReconnect, [this]() {
25 emit accountModelChanged();
26 emit avmodelChanged();
27 emit dataTransferModelChanged();
28 emit contactModelChanged();
29 emit deviceModelChanged();
30 });
31}
32
33NameDirectory *
34ClientWrapper::getNameDirectory()
35{
36 return &(NameDirectory::instance());
37}
38
39UtilsAdapter *
40ClientWrapper::getUtilsAdapter()
41{
42 return &(UtilsAdapter::instance());
43}
44
Andreas Traczyk84dec082020-09-01 14:31:31 -040045SettingsAdapter *
46ClientWrapper::getSettingsAdapter()
Sébastien Blin1f915762020-08-03 13:27:42 -040047{
Andreas Traczyk84dec082020-09-01 14:31:31 -040048 return &(SettingsAdapter::instance());
Sébastien Blin1f915762020-08-03 13:27:42 -040049}
50
51LRCInstance *
52ClientWrapper::getLRCInstance()
53{
54 return &(LRCInstance::instance());
55}
56
57AccountAdapter *
58ClientWrapper::getAccountAdapter()
59{
60 return &(AccountAdapter::instance());
61}
62
63RenderManager *
64ClientWrapper::getRenderManager()
65{
66 return LRCInstance::renderer();
67}
68
69lrc::api::NewAccountModel *
70ClientWrapper::getAccountModel()
71{
72 return &(LRCInstance::accountModel());
73}
74
75lrc::api::AVModel *
76ClientWrapper::getAvModel()
77{
78 return &(LRCInstance::avModel());
79}
80
81lrc::api::PluginModel *
82ClientWrapper::getPluginModel()
83{
84 return &(LRCInstance::pluginModel());
85}
86
87lrc::api::DataTransferModel *
88ClientWrapper::getDataTransferModel()
89{
90 return &(LRCInstance::dataTransferModel());
91}
92
93lrc::api::ContactModel *
94ClientWrapper::getContactModel()
95{
Andreas Traczyk84dec082020-09-01 14:31:31 -040096 return getSettingsAdapter()->getCurrentAccountInfo().contactModel.get();
Sébastien Blin1f915762020-08-03 13:27:42 -040097}
98
99lrc::api::NewDeviceModel *
100ClientWrapper::getDeviceModel()
101{
Andreas Traczyk84dec082020-09-01 14:31:31 -0400102 return getSettingsAdapter()->getCurrentAccountInfo().deviceModel.get();
Sébastien Blin1f915762020-08-03 13:27:42 -0400103}