summaryrefslogtreecommitdiffstats
path: root/xbmc/application/AppEnvironment.cpp
blob: 32d4c4f715fa330d765b381d562e957778ea85a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 *  Copyright (C) 2005-2022 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "AppEnvironment.h"

#include "ServiceBroker.h"
#include "settings/SettingsComponent.h"
#include "utils/log.h"

void CAppEnvironment::SetUp(const std::shared_ptr<CAppParams>& appParams)
{
  CServiceBroker::RegisterAppParams(appParams);
  CServiceBroker::CreateLogging();
  const auto settingsComponent = std::make_shared<CSettingsComponent>();
  settingsComponent->Initialize();
  CServiceBroker::RegisterSettingsComponent(settingsComponent);
}

void CAppEnvironment::TearDown()
{
  CServiceBroker::GetLogging().UnregisterFromSettings();
  CServiceBroker::GetSettingsComponent()->Deinitialize();
  CServiceBroker::UnregisterSettingsComponent();
  CServiceBroker::GetLogging().Deinitialize();
  CServiceBroker::DestroyLogging();
  CServiceBroker::UnregisterAppParams();
}