Skip to content

Commit

Permalink
added option to hide unofficial extras message permanently
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxfighter committed Sep 17, 2021
1 parent 1153989 commit 4f6cf5e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion KillproofUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void KillproofUI::draw(bool* p_open, ImGuiWindowFlags flags) {
/**
* Unofficial Extras message
*/
if (!extrasLoaded) {
if (!extrasLoaded && !settings.getHideExtrasMessage()) {
ImGui::TextUnformatted(lang.translate(LangKey::UnofficialExtrasNotInstalled).c_str());

ImGui::SameLine();
Expand Down
1 change: 1 addition & 0 deletions Lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ BUILD_ENUM_SERIALIZED(
SettingsToThisPanelCorner, "to this panel corner",
SettingsFromWindowName, "from window",
SettingsCofferValue, "Killproofs per coffer",
SettingsHideExtrasMessage, "Hide Unofficial Extras Message",

Alignment, "Alignment",
HeaderAlignment, "Header alignment",
Expand Down
4 changes: 4 additions & 0 deletions Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ uint8_t Settings::getCofferValue() const {
return settings.cofferValue;
}

bool Settings::getHideExtrasMessage() const {
return settings.hideExtrasMessage;
}

void Settings::load() {
// according to standard, this constructor is completely thread-safe
// read settings from file
Expand Down
4 changes: 3 additions & 1 deletion Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ class Settings {
ImGuiID fromWindowID;
bool showCommander = false;
uint8_t cofferValue = 3;
bool hideExtrasMessage = false;

NLOHMANN_DEFINE_TYPE_INTRUSIVE_NON_THROWING(SettingsObject, killproofKey, hidePrivateAccount, showKillproof, blockedDataText, disableEscClose,
alignment, headerAlignment, showHeaderText, hideControls, showOverallByDefault, showHeader, position,
cornerPosition, cornerVector, anchorPanelCornerPosition, selfPanelCornerPosition, fromWindowID,
showCommander, cofferValue)
showCommander, cofferValue, hideExtrasMessage)
};

Settings() = default;
Expand Down Expand Up @@ -80,6 +81,7 @@ class Settings {
[[nodiscard]] ImGuiID getFromWindowID() const;
[[nodiscard]] bool getShowCommander() const;
[[nodiscard]] uint8_t getCofferValue() const;
[[nodiscard]] bool getHideExtrasMessage() const;

// delete copy/move
Settings(const Settings& other) = delete;
Expand Down
2 changes: 2 additions & 0 deletions SettingsUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ void SettingsUI::draw() {
settings.settings.cofferValue = cofferValue;
}

ImGui::Checkbox(lang.translate(LangKey::SettingsHideExtrasMessage).c_str(), &settings.settings.hideExtrasMessage);

if (ImGui::Button(lang.translate(LangKey::SettingsClearCacheText).c_str())) {
std::scoped_lock<std::mutex, std::mutex> guard(cachedPlayersMutex, trackedPlayersMutex);

Expand Down

0 comments on commit 4f6cf5e

Please sign in to comment.