Move Notice to Common/UI

This commit is contained in:
Henrik Rydgård
2026-01-25 15:08:50 +01:00
parent 90e9bff405
commit 34938e3de6
21 changed files with 248 additions and 209 deletions
+2
View File
@@ -893,6 +893,8 @@ add_library(Common STATIC
Common/UI/IconCache.h
Common/UI/UIScreen.cpp
Common/UI/UIScreen.h
Common/UI/Notice.cpp
Common/UI/Notice.h
Common/UI/Tween.cpp
Common/UI/Tween.h
Common/UI/View.cpp
+2
View File
@@ -541,6 +541,7 @@
<ClInclude Include="UI\AsyncImageFileView.h" />
<ClInclude Include="UI\Context.h" />
<ClInclude Include="UI\IconCache.h" />
<ClInclude Include="UI\Notice.h" />
<ClInclude Include="UI\PopupScreens.h" />
<ClInclude Include="UI\Root.h" />
<ClInclude Include="UI\Screen.h" />
@@ -992,6 +993,7 @@
<ClCompile Include="UI\AsyncImageFileView.cpp" />
<ClCompile Include="UI\Context.cpp" />
<ClCompile Include="UI\IconCache.cpp" />
<ClCompile Include="UI\Notice.cpp" />
<ClCompile Include="UI\PopupScreens.cpp" />
<ClCompile Include="UI\Root.cpp" />
<ClCompile Include="UI\Screen.cpp" />
+6
View File
@@ -722,6 +722,9 @@
<ClInclude Include="..\ext\aemu_postoffice\client\sock_impl.h">
<Filter>ext\aemu_postoffice</Filter>
</ClInclude>
<ClInclude Include="UI\Notice.h">
<Filter>UI</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ABI.cpp" />
@@ -1344,6 +1347,9 @@
<ClCompile Include="..\ext\aemu_postoffice\client\sock_impl_windows.c">
<Filter>ext\aemu_postoffice</Filter>
</ClCompile>
<ClCompile Include="UI\Notice.cpp">
<Filter>UI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Crypto">
+160
View File
@@ -0,0 +1,160 @@
#include "Common/UI/UI.h"
#include "Common/UI/Notice.h"
#include "Common/UI/IconCache.h"
#include "Common/UI/Context.h"
#include "Common/StringUtils.h"
#include "Common/System/OSD.h"
static const float extraTextScale = 0.7f;
uint32_t GetNoticeBackgroundColor(NoticeLevel type) {
// Colors from Infima
switch (type) {
case NoticeLevel::ERROR: return 0x3530d5; // danger-darker
case NoticeLevel::WARN: return 0x009ed9; // warning-darker
case NoticeLevel::INFO: return 0x706760; // gray-700
case NoticeLevel::SUCCESS: return 0x008b00; // nice green
default: return 0x606770;
}
}
ImageID GetOSDIcon(NoticeLevel level) {
switch (level) {
case NoticeLevel::INFO: return ImageID("I_INFO");
case NoticeLevel::ERROR: return ImageID("I_CROSS");
case NoticeLevel::WARN: return ImageID("I_WARNING");
case NoticeLevel::SUCCESS: return ImageID("I_CHECKMARK");
default: return ImageID::invalid();
}
}
NoticeLevel GetNoticeLevel(OSDType type) {
switch (type) {
case OSDType::MESSAGE_INFO:
return NoticeLevel::INFO;
case OSDType::MESSAGE_ERROR:
case OSDType::MESSAGE_ERROR_DUMP:
case OSDType::MESSAGE_CENTERED_ERROR:
return NoticeLevel::ERROR;
case OSDType::MESSAGE_WARNING:
case OSDType::MESSAGE_CENTERED_WARNING:
return NoticeLevel::WARN;
case OSDType::MESSAGE_SUCCESS:
return NoticeLevel::SUCCESS;
default:
return NoticeLevel::SUCCESS;
}
}
// Align only matters here for the ASCII-only flag.
void MeasureNotice(const UIContext &dc, NoticeLevel level, const std::string &text, const std::string &details, const std::string &iconName, int align, float maxWidth, float *width, float *height, float *height1) {
float iconW = 0.0f;
float iconH = 0.0f;
if (!iconName.empty() && !startsWith(iconName, "I_")) { // Check for atlas image. Bit hacky, but we choose prefixes for icon IDs anyway in a way that this is safe.
// Normal entry but with a cached icon.
int iconWidth, iconHeight;
if (g_iconCache.GetDimensions(iconName, &iconWidth, &iconHeight)) {
*width += 5.0f + iconWidth;
iconW = iconWidth;
iconH = iconHeight;
}
} else {
ImageID iconID = iconName.empty() ? GetOSDIcon(level) : ImageID(iconName.c_str());
if (iconID.isValid()) {
dc.Draw()->GetAtlas()->measureImage(iconID, &iconW, &iconH);
}
}
float chromeWidth = iconW + 5.0f + 12.0f;
float availableWidth = maxWidth - chromeWidth;
// OK, now that we have figured out how much space we have for the text, we can measure it (with wrapping if needed).
// We currently don't wrap the title.
float titleWidth, titleHeight;
dc.MeasureText(dc.GetTheme().uiFont, 1.0f, 1.0f, text, &titleWidth, &titleHeight, align);
*width = std::min(titleWidth, availableWidth);
*height1 = titleHeight;
float width2 = 0.0f, height2 = 0.0f;
if (!details.empty()) {
dc.MeasureTextRect(dc.GetTheme().uiFont, extraTextScale, extraTextScale, details, availableWidth, &width2, &height2, align | FLAG_WRAP_TEXT);
*width = std::max(*width, width2);
}
*width += chromeWidth;
if (height2 == 0.0f && iconH < 2.0f * *height1) {
// Center vertically using the icon.
*height1 = std::max(*height1, iconH + 2.0f);
}
*height = std::max(*height1 + height2 + 8.0f, iconH + 5.0f);
}
void RenderNotice(UIContext &dc, Bounds bounds, float height1, NoticeLevel level, const std::string &text, const std::string &details, const std::string &iconName, int align, float alpha, OSDMessageFlags flags, float timeVal) {
UI::Drawable background = UI::Drawable(colorAlpha(GetNoticeBackgroundColor(level), alpha));
dc.SetFontStyle(dc.GetTheme().uiFont);
uint32_t foreGround = whiteAlpha(alpha);
if (!(flags & OSDMessageFlags::Transparent)) {
dc.DrawRectDropShadow(bounds, 12.0f, 0.7f * alpha);
dc.FillRect(background, bounds);
}
float iconW = 0.0f;
float iconH = 0.0f;
if (!iconName.empty() && !startsWith(iconName, "I_")) {
dc.Flush();
// Normal entry but with a cached icon.
Draw::Texture *texture = g_iconCache.BindIconTexture(&dc, iconName);
if (texture) {
iconW = texture->Width();
iconH = texture->Height();
dc.Draw()->DrawTexRect(Bounds(bounds.x + 2.5f, bounds.y + 2.5f, iconW, iconH), 0.0f, 0.0f, 1.0f, 1.0f, foreGround);
dc.Flush();
dc.RebindTexture();
}
dc.Begin();
} else {
ImageID iconID = iconName.empty() ? GetOSDIcon(level) : ImageID(iconName.c_str());
if (iconID.isValid()) {
// Atlas icon.
dc.Draw()->GetAtlas()->measureImage(iconID, &iconW, &iconH);
if (!iconName.empty()) {
Bounds iconBounds = Bounds(bounds.x + 2.5f, bounds.y + 2.5f, iconW, iconH);
// If it's not a preset OSD icon, give it some background to blend in. The RA icon for example
// easily melts into the orange of warnings otherwise.
dc.FillRect(UI::Drawable(0x50000000), iconBounds.Expand(2.0f));
}
if (flags & (OSDMessageFlags::SpinLeft | OSDMessageFlags::SpinRight)) {
const float direction = (flags & OSDMessageFlags::SpinLeft) ? -1.5f : 1.5f;
dc.DrawImageRotated(iconID, bounds.x + 2.5f + iconW * 0.5f, bounds.y + 2.5f + iconW * 0.5f, 1.0f, direction * timeVal, foreGround, false);
} else {
dc.DrawImageVGradient(iconID, foreGround, foreGround, Bounds(bounds.x + 2.5f, bounds.y + 2.5f, iconW, iconH));
}
}
}
// Make room
bounds.x += iconW + 5.0f;
bounds.w -= iconW + 5.0f;
Bounds primaryBounds = bounds;
primaryBounds.h = height1;
dc.DrawTextShadowRect(text, primaryBounds.Inset(2.0f, 0.0f, 1.0f, 0.0f), foreGround, (align & FLAG_DYNAMIC_ASCII) | ALIGN_VCENTER | FLAG_ELLIPSIZE_TEXT);
if (!details.empty()) {
Bounds bottomTextBounds = bounds.Inset(3.0f, height1 + 5.0f, 3.0f, 3.0f);
if (!(flags & OSDMessageFlags::Transparent)) {
UI::Drawable backgroundDark = UI::Drawable(colorAlpha(darkenColor(GetNoticeBackgroundColor(level)), alpha));
dc.FillRect(backgroundDark, bottomTextBounds);
}
dc.SetFontScale(extraTextScale, extraTextScale);
dc.DrawTextRect(details, bottomTextBounds.Inset(1.0f, 1.0f), foreGround, (align & FLAG_DYNAMIC_ASCII) | ALIGN_LEFT | FLAG_WRAP_TEXT);
}
dc.SetFontScale(1.0f, 1.0f);
}
+53
View File
@@ -0,0 +1,53 @@
#pragma once
#include <cstdint>
#include <string>
#include <string_view>
#include "Common/UI/View.h"
#include "Common/System/OSD.h"
#undef ERROR
enum class NoticeLevel {
SUCCESS,
INFO,
WARN,
ERROR,
};
class NoticeView : public UI::InertView {
public:
NoticeView(NoticeLevel level, std::string_view text, std::string_view detailsText, UI::LayoutParams *layoutParams = 0)
: InertView(layoutParams), level_(level), text_(text), detailsText_(detailsText) {}
void SetIconName(std::string_view name) {
iconName_ = name;
}
void SetText(std::string_view text) {
text_ = text;
}
void SetLevel(NoticeLevel level) {
level_ = level;
}
void SetSquishy(bool squishy) {
squishy_ = squishy;
}
void GetContentDimensionsBySpec(const UIContext &dc, UI::MeasureSpec horiz, UI::MeasureSpec vert, float &w, float &h) const override;
void Draw(UIContext &dc) override;
private:
std::string text_;
std::string detailsText_;
std::string iconName_;
NoticeLevel level_;
mutable float height1_ = 0.0f;
bool squishy_ = false;
};
ImageID GetOSDIcon(NoticeLevel level);
NoticeLevel GetNoticeLevel(OSDType type);
uint32_t GetNoticeBackgroundColor(NoticeLevel type);
void MeasureNotice(const UIContext &dc, NoticeLevel level, const std::string &text, const std::string &details, const std::string &iconName, int align, float maxWidth, float *width, float *height, float *height1);
void RenderNotice(UIContext &dc, Bounds bounds, float height1, NoticeLevel level, const std::string &text, const std::string &details, const std::string &iconName, int align, float alpha, OSDMessageFlags flags, float timeVal);
+5 -13
View File
@@ -22,32 +22,26 @@
#include <unordered_map>
#include "Common/Render/TextureAtlas.h"
#include "Common/UI/Root.h"
#include "Common/UI/UI.h"
#include "Common/UI/Context.h"
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/Notice.h"
#include "Common/VR/PPSSPPVR.h"
#include "Common/Log.h"
#include "Common/Data/Color/RGBAUtil.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Input/KeyCodes.h"
#include "Common/Input/InputState.h"
#include "Common/StringUtils.h"
#include "Common/System/Display.h"
#include "Common/System/System.h"
#include "Common/System/Request.h"
#include "Common/TimeUtil.h"
#include "Core/KeyMap.h"
#include "Core/HLE/sceCtrl.h"
#include "Core/System.h"
#include "Core/Config.h"
#include "UI/ControlMappingScreen.h"
#include "UI/PopupScreens.h"
#include "UI/GameSettingsScreen.h"
#include "UI/JoystickHistoryView.h"
#include "UI/OnScreenDisplay.h"
#if PPSSPP_PLATFORM(ANDROID)
#include "android/jni/app-android.h"
@@ -57,7 +51,10 @@ using KeyMap::MultiInputMapping;
class SingleControlMapper : public UI::LinearLayout {
public:
SingleControlMapper(int pspKey, std::string keyName, bool portrait, ScreenManager *scrm, UI::LinearLayoutParams *layoutParams = nullptr);
SingleControlMapper(int pspKey, std::string_view keyName, bool portrait, ScreenManager *scrm, UI::LinearLayoutParams *layoutParams = nullptr)
: UI::LinearLayout(ORIENT_VERTICAL, layoutParams), pspKey_(pspKey), keyName_(keyName), scrm_(scrm), portrait_(portrait) {
Refresh();
}
~SingleControlMapper() {
g_IsMappingMouseInput = false;
}
@@ -82,11 +79,6 @@ private:
bool portrait_;
};
SingleControlMapper::SingleControlMapper(int pspKey, std::string keyName, bool portrait, ScreenManager *scrm, UI::LinearLayoutParams *layoutParams)
: UI::LinearLayout(ORIENT_VERTICAL, layoutParams), pspKey_(pspKey), keyName_(keyName), scrm_(scrm), portrait_(portrait) {
Refresh();
}
void SingleControlMapper::Refresh() {
Clear();
auto mc = GetI18NCategory(I18NCat::MAPPABLECONTROLS);
+1
View File
@@ -6,6 +6,7 @@
#include "Common/Log.h"
#include "Common/StringUtils.h"
#include "Common/UI/PopupScreens.h"
#include "Common/UI/Notice.h"
#include "Core/Config.h"
#include "Core/System.h"
+1
View File
@@ -24,6 +24,7 @@
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/PopupScreens.h"
#include "Common/UI/Notice.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Text/Parsers.h"
#include "Common/Data/Encoding/Utf8.h"
+1 -7
View File
@@ -29,6 +29,7 @@
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/Context.h"
#include "Common/UI/Notice.h"
#include "Common/Render/ManagedTexture.h"
#include "Common/VR/PPSSPPVR.h"
#include "Common/BitSet.h"
@@ -37,7 +38,6 @@
#include "Common/System/OSD.h"
#include "Common/System/NativeApp.h"
#include "Common/Data/Color/RGBAUtil.h"
#include "Common/Math/curves.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/UI/PopupScreens.h"
@@ -66,8 +66,6 @@
#include "Common/File/FileUtil.h"
#include "Common/File/AndroidContentURI.h"
#include "Common/OSVersion.h"
#include "Common/TimeUtil.h"
#include "Common/StringUtils.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
@@ -79,11 +77,7 @@
#include "Core/HLE/sceUsbCam.h"
#include "Core/HLE/sceUsbMic.h"
#include "Core/HLE/sceUtility.h"
#include "GPU/Common/TextureReplacer.h"
#include "GPU/Common/PostShader.h"
#include "GPU/Common/FramebufferManagerCommon.h"
#include "Core/Core.h" // for Core_IsStepping
#if PPSSPP_PLATFORM(MAC) || PPSSPP_PLATFORM(IOS)
#include "UI/DarwinFileSystemServices.h"
+1
View File
@@ -18,6 +18,7 @@
#include "Common/UI/UI.h"
#include "Common/UI/View.h"
#include "Common/UI/ViewGroup.h"
#include "Common/UI/Notice.h"
#include "Common/StringUtils.h"
#include "Common/File/FileUtil.h"
+1
View File
@@ -40,6 +40,7 @@
#include "Common/Thread/ThreadManager.h"
#include "Common/UI/ScrollView.h"
#include "Common/UI/Notice.h"
#include "Core/Config.h"
#include "Core/Reporting.h"
+1 -153
View File
@@ -14,6 +14,7 @@
#include "UI/DebugOverlay.h"
#include "Common/UI/Context.h"
#include "Common/UI/Notice.h"
#include "Common/System/OSD.h"
#include "Common/TimeUtil.h"
@@ -26,91 +27,6 @@ static inline const char *DeNull(const char *ptr) {
extern bool g_TakeScreenshot;
static const float g_atlasIconSize = 36.0f;
static const float extraTextScale = 0.7f;
static uint32_t GetNoticeBackgroundColor(NoticeLevel type) {
// Colors from Infima
switch (type) {
case NoticeLevel::ERROR: return 0x3530d5; // danger-darker
case NoticeLevel::WARN: return 0x009ed9; // warning-darker
case NoticeLevel::INFO: return 0x706760; // gray-700
case NoticeLevel::SUCCESS: return 0x008b00; // nice green
default: return 0x606770;
}
}
static ImageID GetOSDIcon(NoticeLevel level) {
switch (level) {
case NoticeLevel::INFO: return ImageID("I_INFO");
case NoticeLevel::ERROR: return ImageID("I_CROSS");
case NoticeLevel::WARN: return ImageID("I_WARNING");
case NoticeLevel::SUCCESS: return ImageID("I_CHECKMARK");
default: return ImageID::invalid();
}
}
static NoticeLevel GetNoticeLevel(OSDType type) {
switch (type) {
case OSDType::MESSAGE_INFO:
return NoticeLevel::INFO;
case OSDType::MESSAGE_ERROR:
case OSDType::MESSAGE_ERROR_DUMP:
case OSDType::MESSAGE_CENTERED_ERROR:
return NoticeLevel::ERROR;
case OSDType::MESSAGE_WARNING:
case OSDType::MESSAGE_CENTERED_WARNING:
return NoticeLevel::WARN;
case OSDType::MESSAGE_SUCCESS:
return NoticeLevel::SUCCESS;
default:
return NoticeLevel::SUCCESS;
}
}
// Align only matters here for the ASCII-only flag.
static void MeasureNotice(const UIContext &dc, NoticeLevel level, const std::string &text, const std::string &details, const std::string &iconName, int align, float maxWidth, float *width, float *height, float *height1) {
float iconW = 0.0f;
float iconH = 0.0f;
if (!iconName.empty() && !startsWith(iconName, "I_")) { // Check for atlas image. Bit hacky, but we choose prefixes for icon IDs anyway in a way that this is safe.
// Normal entry but with a cached icon.
int iconWidth, iconHeight;
if (g_iconCache.GetDimensions(iconName, &iconWidth, &iconHeight)) {
*width += 5.0f + iconWidth;
iconW = iconWidth;
iconH = iconHeight;
}
} else {
ImageID iconID = iconName.empty() ? GetOSDIcon(level) : ImageID(iconName.c_str());
if (iconID.isValid()) {
dc.Draw()->GetAtlas()->measureImage(iconID, &iconW, &iconH);
}
}
float chromeWidth = iconW + 5.0f + 12.0f;
float availableWidth = maxWidth - chromeWidth;
// OK, now that we have figured out how much space we have for the text, we can measure it (with wrapping if needed).
// We currently don't wrap the title.
float titleWidth, titleHeight;
dc.MeasureText(dc.GetTheme().uiFont, 1.0f, 1.0f, text, &titleWidth, &titleHeight, align);
*width = std::min(titleWidth, availableWidth);
*height1 = titleHeight;
float width2 = 0.0f, height2 = 0.0f;
if (!details.empty()) {
dc.MeasureTextRect(dc.GetTheme().uiFont, extraTextScale, extraTextScale, details, availableWidth, &width2, &height2, align | FLAG_WRAP_TEXT);
*width = std::max(*width, width2);
}
*width += chromeWidth;
if (height2 == 0.0f && iconH < 2.0f * *height1) {
// Center vertically using the icon.
*height1 = std::max(*height1, iconH + 2.0f);
}
*height = std::max(*height1 + height2 + 8.0f, iconH + 5.0f);
}
// Align only matters here for the ASCII-only flag.
static void MeasureOSDEntry(const UIContext &dc, const OnScreenDisplay::Entry &entry, int align, float maxWidth, float *width, float *height, float *height1) {
@@ -124,74 +40,6 @@ static void MeasureOSDEntry(const UIContext &dc, const OnScreenDisplay::Entry &e
}
}
static void RenderNotice(UIContext &dc, Bounds bounds, float height1, NoticeLevel level, const std::string &text, const std::string &details, const std::string &iconName, int align, float alpha, OSDMessageFlags flags, float timeVal) {
UI::Drawable background = UI::Drawable(colorAlpha(GetNoticeBackgroundColor(level), alpha));
dc.SetFontStyle(dc.GetTheme().uiFont);
uint32_t foreGround = whiteAlpha(alpha);
if (!(flags & OSDMessageFlags::Transparent)) {
dc.DrawRectDropShadow(bounds, 12.0f, 0.7f * alpha);
dc.FillRect(background, bounds);
}
float iconW = 0.0f;
float iconH = 0.0f;
if (!iconName.empty() && !startsWith(iconName, "I_")) {
dc.Flush();
// Normal entry but with a cached icon.
Draw::Texture *texture = g_iconCache.BindIconTexture(&dc, iconName);
if (texture) {
iconW = texture->Width();
iconH = texture->Height();
dc.Draw()->DrawTexRect(Bounds(bounds.x + 2.5f, bounds.y + 2.5f, iconW, iconH), 0.0f, 0.0f, 1.0f, 1.0f, foreGround);
dc.Flush();
dc.RebindTexture();
}
dc.Begin();
} else {
ImageID iconID = iconName.empty() ? GetOSDIcon(level) : ImageID(iconName.c_str());
if (iconID.isValid()) {
// Atlas icon.
dc.Draw()->GetAtlas()->measureImage(iconID, &iconW, &iconH);
if (!iconName.empty()) {
Bounds iconBounds = Bounds(bounds.x + 2.5f, bounds.y + 2.5f, iconW, iconH);
// If it's not a preset OSD icon, give it some background to blend in. The RA icon for example
// easily melts into the orange of warnings otherwise.
dc.FillRect(UI::Drawable(0x50000000), iconBounds.Expand(2.0f));
}
if (flags & (OSDMessageFlags::SpinLeft | OSDMessageFlags::SpinRight)) {
const float direction = (flags & OSDMessageFlags::SpinLeft) ? -1.5f : 1.5f;
dc.DrawImageRotated(iconID, bounds.x + 2.5f + iconW * 0.5f, bounds.y + 2.5f + iconW * 0.5f, 1.0f, direction * timeVal, foreGround, false);
} else {
dc.DrawImageVGradient(iconID, foreGround, foreGround, Bounds(bounds.x + 2.5f, bounds.y + 2.5f, iconW, iconH));
}
}
}
// Make room
bounds.x += iconW + 5.0f;
bounds.w -= iconW + 5.0f;
Bounds primaryBounds = bounds;
primaryBounds.h = height1;
dc.DrawTextShadowRect(text, primaryBounds.Inset(2.0f, 0.0f, 1.0f, 0.0f), foreGround, (align & FLAG_DYNAMIC_ASCII) | ALIGN_VCENTER | FLAG_ELLIPSIZE_TEXT);
if (!details.empty()) {
Bounds bottomTextBounds = bounds.Inset(3.0f, height1 + 5.0f, 3.0f, 3.0f);
if (!(flags & OSDMessageFlags::Transparent)) {
UI::Drawable backgroundDark = UI::Drawable(colorAlpha(darkenColor(GetNoticeBackgroundColor(level)), alpha));
dc.FillRect(backgroundDark, bottomTextBounds);
}
dc.SetFontScale(extraTextScale, extraTextScale);
dc.DrawTextRect(details, bottomTextBounds.Inset(1.0f, 1.0f), foreGround, (align & FLAG_DYNAMIC_ASCII) | ALIGN_LEFT | FLAG_WRAP_TEXT);
}
dc.SetFontScale(1.0f, 1.0f);
}
static void RenderOSDEntry(UIContext &dc, const OnScreenDisplay::Entry &entry, Bounds bounds, float height1, int align, float alpha, float now) {
if (entry.type == OSDType::ACHIEVEMENT_UNLOCKED) {
const rc_client_achievement_t * achievement = rc_client_get_achievement_info(Achievements::GetClient(), entry.numericID);
-36
View File
@@ -51,39 +51,3 @@ private:
OnScreenMessagesView *osmView_ = nullptr;
};
enum class NoticeLevel {
SUCCESS,
INFO,
WARN,
ERROR,
};
class NoticeView : public UI::InertView {
public:
NoticeView(NoticeLevel level, std::string_view text, std::string_view detailsText, UI::LayoutParams *layoutParams = 0)
: InertView(layoutParams), level_(level), text_(text), detailsText_(detailsText), iconName_("") {}
void SetIconName(std::string_view name) {
iconName_ = name;
}
void SetText(std::string_view text) {
text_ = text;
}
void SetLevel(NoticeLevel level) {
level_ = level;
}
void SetSquishy(bool squishy) {
squishy_ = squishy;
}
void GetContentDimensionsBySpec(const UIContext &dc, UI::MeasureSpec horiz, UI::MeasureSpec vert, float &w, float &h) const override;
void Draw(UIContext &dc) override;
private:
std::string text_;
std::string detailsText_;
std::string iconName_;
NoticeLevel level_;
mutable float height1_ = 0.0f;
bool squishy_ = false;
};
+1
View File
@@ -24,6 +24,7 @@
#include "Common/UI/Context.h"
#include "Common/UI/UIScreen.h"
#include "Common/UI/PopupScreens.h"
#include "Common/UI/Notice.h"
#include "Common/GPU/thin3d.h"
#include "Common/Data/Text/I18n.h"
+1
View File
@@ -36,6 +36,7 @@
#include "Common/File/PathBrowser.h"
#include "Common/UI/PopupScreens.h"
#include "Common/UI/Notice.h"
#include "Common/Data/Format/JSONReader.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Common.h"
+1
View File
@@ -7,6 +7,7 @@
#include "Common/UI/Context.h"
#include "Common/UI/IconCache.h"
#include "Common/UI/PopupScreens.h"
#include "Common/UI/Notice.h"
#include "Common/StringUtils.h"
#include "Core/Config.h"
+1
View File
@@ -18,6 +18,7 @@
#include "Common/Render/Text/draw_text.h"
#include "Common/System/Request.h"
#include "Common/UI/Context.h"
#include "Common/UI/Notice.h"
#include "Core/System.h"
#include "Core/Config.h"
#include "GPU/GPUState.h" // ugh
+2
View File
@@ -217,6 +217,7 @@
<ClInclude Include="..\..\Common\UI\AsyncImageFileView.h" />
<ClInclude Include="..\..\Common\UI\Context.h" />
<ClInclude Include="..\..\Common\UI\IconCache.h" />
<ClInclude Include="..\..\Common\UI\Notice.h" />
<ClInclude Include="..\..\Common\UI\PopupScreens.h" />
<ClInclude Include="..\..\Common\UI\Root.h" />
<ClInclude Include="..\..\Common\UI\Screen.h" />
@@ -385,6 +386,7 @@
<ClCompile Include="..\..\Common\UI\AsyncImageFileView.cpp" />
<ClCompile Include="..\..\Common\UI\Context.cpp" />
<ClCompile Include="..\..\Common\UI\IconCache.cpp" />
<ClCompile Include="..\..\Common\UI\Notice.cpp" />
<ClCompile Include="..\..\Common\UI\PopupScreens.cpp" />
<ClCompile Include="..\..\Common\UI\Root.cpp" />
<ClCompile Include="..\..\Common\UI\Screen.cpp" />
+6
View File
@@ -544,6 +544,9 @@
<ClCompile Include="..\..\ext\aemu_postoffice\client\sock_impl_windows.c">
<Filter>ext\aemu_postoffice</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\UI\Notice.cpp">
<Filter>UI</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h" />
@@ -1041,6 +1044,9 @@
<ClInclude Include="..\..\ext\aemu_postoffice\client\delay_impl.h">
<Filter>ext\aemu_postoffice</Filter>
</ClInclude>
<ClInclude Include="..\..\Common\UI\Notice.h">
<Filter>UI</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Common\Math\fast\fast_matrix_neon.S">
+1
View File
@@ -361,6 +361,7 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Common/UI/Context.cpp \
$(SRC)/Common/UI/UIScreen.cpp \
$(SRC)/Common/UI/Tween.cpp \
$(SRC)/Common/UI/Notice.cpp \
$(SRC)/Common/UI/IconCache.cpp \
$(SRC)/Common/UI/View.cpp \
$(SRC)/Common/UI/ViewGroup.cpp \
+1
View File
@@ -525,6 +525,7 @@ SOURCES_CXX += \
$(COMMONDIR)/UI/UI.cpp \
$(COMMONDIR)/UI/Context.cpp \
$(COMMONDIR)/UI/UIScreen.cpp \
$(COMMONDIR)/UI/Notice.cpp \
$(COMMONDIR)/UI/Tween.cpp \
$(COMMONDIR)/UI/IconCache.cpp \
$(COMMONDIR)/UI/View.cpp \