mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-05 20:39:11 -05: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.
117 lines
3.1 KiB
C++
117 lines
3.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
|
|
|
|
#pragma once
|
|
|
|
#include "AppWindow.hpp"
|
|
#include <Text.hpp>
|
|
#include <functional>
|
|
#include <DialogMetadata.hpp>
|
|
#include <module-gui/gui/widgets/Icon.hpp>
|
|
|
|
namespace gui::window::name
|
|
{
|
|
inline constexpr auto dialog_confirm = "DialogConfirm";
|
|
inline constexpr auto dialog_retry = "DialogRetry";
|
|
}; // namespace gui::window::name
|
|
|
|
namespace gui
|
|
{
|
|
namespace dialog
|
|
{
|
|
enum Option
|
|
{
|
|
YES,
|
|
NO
|
|
};
|
|
|
|
namespace style
|
|
{
|
|
namespace option
|
|
{
|
|
inline constexpr auto w = 150;
|
|
inline constexpr auto h = 75;
|
|
inline constexpr auto margin = 30;
|
|
inline constexpr auto iconTextH = 99;
|
|
} // namespace option
|
|
|
|
namespace iconTextLabel
|
|
{
|
|
inline constexpr auto h = 188;
|
|
} // namespace iconTextLabel
|
|
|
|
} // namespace style
|
|
} // namespace dialog
|
|
|
|
/// @brief base Dialog class
|
|
///
|
|
/// Contain icon, text and Back action
|
|
class Dialog : public AppWindow
|
|
{
|
|
protected:
|
|
Icon *icon = nullptr;
|
|
|
|
public:
|
|
Dialog(app::ApplicationCommon *app, const std::string &name);
|
|
|
|
void onBeforeShow(ShowMode mode, SwitchData *data) override;
|
|
};
|
|
|
|
/// @brief Confirm Dialog class
|
|
///
|
|
/// Contain same items as Dialog but instead of Back there is OK action
|
|
/// @Note it is also showing signal strength, battery on mode indicators
|
|
class DialogConfirm : public Dialog
|
|
{
|
|
public:
|
|
DialogConfirm(app::ApplicationCommon *app, const std::string &name);
|
|
|
|
void onBeforeShow(ShowMode mode, SwitchData *data) override;
|
|
};
|
|
|
|
/// @brief Yes/No Dialog class
|
|
///
|
|
/// Contain same items as Dialog and additionally Yes and No selectable options
|
|
class DialogYesNo : public Dialog
|
|
{
|
|
protected:
|
|
Label *yes = nullptr;
|
|
Label *no = nullptr;
|
|
HBox *hBox = nullptr;
|
|
|
|
public:
|
|
DialogYesNo(app::ApplicationCommon *app, const std::string &name);
|
|
|
|
void onBeforeShow(ShowMode mode, SwitchData *data) override;
|
|
|
|
private:
|
|
Label *createYesNoOption(Item *parent, const gui::dialog::Option &optionName);
|
|
};
|
|
|
|
/// @brief Yes/No Icon Text Dialog class
|
|
///
|
|
/// Contain same items as DialogYesNo and additionally puts text on icon
|
|
class DialogYesNoIconTxt : public DialogYesNo
|
|
{
|
|
protected:
|
|
Label *iconText = nullptr;
|
|
|
|
public:
|
|
DialogYesNoIconTxt(app::ApplicationCommon *app, const std::string &name);
|
|
|
|
void onBeforeShow(ShowMode mode, SwitchData *data) override;
|
|
};
|
|
|
|
/// @brief Retry Dialog class
|
|
///
|
|
/// Contain same items as Dialog but instead of OK there is a TRY AGAIN button
|
|
class DialogRetry : public Dialog
|
|
{
|
|
public:
|
|
DialogRetry(app::ApplicationCommon *app, const std::string &name);
|
|
|
|
void onBeforeShow(ShowMode mode, SwitchData *data) override;
|
|
};
|
|
|
|
}; // namespace gui
|