mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-04-23 16:40:22 -04:00
1. Prepare Pure and Bell specific `Application` classes and add them to `app` target: - `products/BellHybrid/apps/Application.cpp` - `products/PurePhone/apps/Application.cpp` 2. Update `CMakeLists.txt` files. 3. Move `ApplicationBell` implementation to Bell-specific `Application` class and remove `ApplicationBell` files. 4. Change Bell apps parent classes from `ApplicationBell` to Bell-specific `Application` class. 5. Rename `Application` to `ApplicationCommon` in the rest of the files.
60 lines
2.1 KiB
C++
60 lines
2.1 KiB
C++
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
|
|
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
|
|
|
|
#include "PhoneWindow.hpp"
|
|
|
|
#include <application-settings/data/SoundSelectData.hpp>
|
|
#include <application-settings/windows/WindowNames.hpp>
|
|
|
|
namespace gui
|
|
{
|
|
PhoneWindow::PhoneWindow(app::ApplicationCommon *app,
|
|
std::unique_ptr<audio_settings::AbstractAudioSettingsModel> &&audioModel)
|
|
: BaseSettingsWindow(app, gui::window::name::phone), mWidgetMaker(this), mAudioModel(std::move(audioModel))
|
|
{
|
|
setTitle(utils::translate("app_settings_apps_phone"));
|
|
}
|
|
|
|
std::list<Option> PhoneWindow::buildOptionsList()
|
|
{
|
|
std::list<gui::Option> optionList;
|
|
mVibrationsEnabled = mAudioModel->isVibrationEnabled();
|
|
mSoundEnabled = mAudioModel->isSoundEnabled();
|
|
|
|
mWidgetMaker.addSwitchOption(optionList, utils::translate("app_settings_vibration"), mVibrationsEnabled, [&]() {
|
|
switchVibrationState();
|
|
});
|
|
|
|
mWidgetMaker.addSwitchOption(
|
|
optionList, utils::translate("app_settings_sound"), mSoundEnabled, [&]() { switchSoundState(); });
|
|
|
|
if (mSoundEnabled) {
|
|
mWidgetMaker.addSelectOption(
|
|
optionList, utils::translate("app_settings_call_ringtome"), [&]() { openRingtoneWindow(); }, true);
|
|
}
|
|
|
|
return optionList;
|
|
}
|
|
|
|
void PhoneWindow::switchVibrationState()
|
|
{
|
|
(mVibrationsEnabled) ? mAudioModel->setVibrationDisabled() : mAudioModel->setVibrationEnabled();
|
|
refreshOptionsList();
|
|
}
|
|
|
|
void PhoneWindow::switchSoundState()
|
|
{
|
|
mSoundEnabled ? mAudioModel->setSoundDisabled() : mAudioModel->setSoundEnabled();
|
|
refreshOptionsList();
|
|
}
|
|
|
|
void PhoneWindow::openRingtoneWindow()
|
|
{
|
|
SoundSelectData::Info info;
|
|
info.windowTitle = utils::translate("app_settings_call_ringtome");
|
|
info.audioModel = mAudioModel.get();
|
|
application->switchWindow(gui::window::name::sound_select, std::make_unique<SoundSelectData>(info));
|
|
}
|
|
|
|
} // namespace gui
|