Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 1 | /* |
| 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 | |
| 21 | ClientWrapper::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 | |
| 33 | NameDirectory * |
| 34 | ClientWrapper::getNameDirectory() |
| 35 | { |
| 36 | return &(NameDirectory::instance()); |
| 37 | } |
| 38 | |
| 39 | UtilsAdapter * |
| 40 | ClientWrapper::getUtilsAdapter() |
| 41 | { |
| 42 | return &(UtilsAdapter::instance()); |
| 43 | } |
| 44 | |
Andreas Traczyk | 84dec08 | 2020-09-01 14:31:31 -0400 | [diff] [blame^] | 45 | SettingsAdapter * |
| 46 | ClientWrapper::getSettingsAdapter() |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 47 | { |
Andreas Traczyk | 84dec08 | 2020-09-01 14:31:31 -0400 | [diff] [blame^] | 48 | return &(SettingsAdapter::instance()); |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | LRCInstance * |
| 52 | ClientWrapper::getLRCInstance() |
| 53 | { |
| 54 | return &(LRCInstance::instance()); |
| 55 | } |
| 56 | |
| 57 | AccountAdapter * |
| 58 | ClientWrapper::getAccountAdapter() |
| 59 | { |
| 60 | return &(AccountAdapter::instance()); |
| 61 | } |
| 62 | |
| 63 | RenderManager * |
| 64 | ClientWrapper::getRenderManager() |
| 65 | { |
| 66 | return LRCInstance::renderer(); |
| 67 | } |
| 68 | |
| 69 | lrc::api::NewAccountModel * |
| 70 | ClientWrapper::getAccountModel() |
| 71 | { |
| 72 | return &(LRCInstance::accountModel()); |
| 73 | } |
| 74 | |
| 75 | lrc::api::AVModel * |
| 76 | ClientWrapper::getAvModel() |
| 77 | { |
| 78 | return &(LRCInstance::avModel()); |
| 79 | } |
| 80 | |
| 81 | lrc::api::PluginModel * |
| 82 | ClientWrapper::getPluginModel() |
| 83 | { |
| 84 | return &(LRCInstance::pluginModel()); |
| 85 | } |
| 86 | |
| 87 | lrc::api::DataTransferModel * |
| 88 | ClientWrapper::getDataTransferModel() |
| 89 | { |
| 90 | return &(LRCInstance::dataTransferModel()); |
| 91 | } |
| 92 | |
| 93 | lrc::api::ContactModel * |
| 94 | ClientWrapper::getContactModel() |
| 95 | { |
Andreas Traczyk | 84dec08 | 2020-09-01 14:31:31 -0400 | [diff] [blame^] | 96 | return getSettingsAdapter()->getCurrentAccountInfo().contactModel.get(); |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | lrc::api::NewDeviceModel * |
| 100 | ClientWrapper::getDeviceModel() |
| 101 | { |
Andreas Traczyk | 84dec08 | 2020-09-01 14:31:31 -0400 | [diff] [blame^] | 102 | return getSettingsAdapter()->getCurrentAccountInfo().deviceModel.get(); |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 103 | } |