Add Settings::ui_notification_position.

This commit is contained in:
redpolline 2024-12-21 05:29:33 -05:00
parent ba49e5618c
commit 816479259b
3 changed files with 30 additions and 1 deletions

View File

@ -219,6 +219,8 @@ inline std::string ascii_to_lowercase(std::string data) {
#define DEFAULT_LANGUAGE "english"
#define DEFAULT_UI_NOTIFICATION_POSITION "top right"
#define LOBBY_CONNECT_APPID ((uint32)-2)
#define FRIEND_AVATAR_MAX_IMAGE_LENGTH (5 * 1024 * 1024)

View File

@ -45,6 +45,8 @@ Settings::Settings(CSteamID steam_id, CGameID game_id, std::string name, std::st
this->name = this->name + " ";
}
this->ui_notification_position = "";
auto lang = sanitize(language);
std::transform(lang.begin(), lang.end(), lang.begin(), ::tolower);
lang.erase(std::remove(lang.begin(), lang.end(), ' '), lang.end());
@ -476,3 +478,24 @@ void Settings::set_preferred_network_image_type(int new_type)
};
return;
}
std::string Settings::get_ui_notification_position()
{
return this->ui_notification_position;
}
void Settings::set_ui_notification_position(char * pos)
{
PRINT_DEBUG("%s 0x%p.\n",
"Settings::set_ui_notification_position",
pos);
if (pos != NULL) {
size_t len = strlen(pos);
if (len > 0) {
this->ui_notification_position = "";
for (size_t x = 0; x < len && pos[x] != '\0'; x++) {
this->ui_notification_position += pos[x];
}
}
}
}

View File

@ -77,7 +77,7 @@ struct Settings_Background_Task {
class Settings {
CSteamID steam_id;
CGameID game_id;
std::string name, language;
std::string name, language, ui_notification_position;
CSteamID lobby_id;
uint32 preferred_network_image_type;
bool background_thread_exit;
@ -209,6 +209,10 @@ public:
void set_show_achievement_desc_on_unlock(bool set) { this->showAchievementDescOnUnlock = set; }
bool get_show_achievement_hidden_unearned() { return showAchievementHiddenUnearned; }
void set_show_achievement_hidden_unearned(bool set) { this->showAchievementHiddenUnearned = set; }
//UI
std::string get_ui_notification_position();
void set_ui_notification_position(char * pos);
};
#endif