Skip to content

Commit

Permalink
Show help text when resources unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
ljahn committed Dec 31, 2024
1 parent 3d56413 commit cd49e1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/displayapp/screens/settings/SettingWatchFace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using namespace Pinetime::Applications::Screens;

constexpr const char* SettingWatchFace::title;
constexpr const char* SettingWatchFace::symbol;
constexpr const char* SettingWatchFace::helptext;

namespace {
uint32_t IndexOf(const std::array<Pinetime::Applications::Screens::SettingWatchFace::Item,
Expand Down Expand Up @@ -70,12 +71,14 @@ bool SettingWatchFace::OnTouchEvent(Pinetime::Applications::TouchEvents event) {

std::unique_ptr<Screen> SettingWatchFace::CreateScreen(unsigned int screenNum) const {
std::array<Screens::CheckboxList::Item, settingsPerScreen> watchfacesOnThisScreen;
bool needsHelptext = false;
for (int i = 0; i < settingsPerScreen; i++) {
if (i + (screenNum * settingsPerScreen) >= watchfaceItems.size()) {
watchfacesOnThisScreen[i] = {"", false};
} else {
auto& item = watchfaceItems[i + (screenNum * settingsPerScreen)];
watchfacesOnThisScreen[i] = Screens::CheckboxList::Item {item.name, item.enabled};
needsHelptext |= !item.enabled;
}
}

Expand All @@ -89,5 +92,6 @@ std::unique_ptr<Screen> SettingWatchFace::CreateScreen(unsigned int screenNum) c
settings.SetWatchFace(IndexToWatchFace(watchfaceItems, index));
settings.SaveSettings();
},
watchfacesOnThisScreen);
watchfacesOnThisScreen,
needsHelptext ? helptext : nullptr);
}
1 change: 1 addition & 0 deletions src/displayapp/screens/settings/SettingWatchFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace Pinetime {

static constexpr const char* title = "Watch face";
static constexpr const char* symbol = Symbols::home;
static constexpr const char* helptext = " Resources missing! Install resource pack to use greyed out watch faces.";

ScreenList<nScreens> screens;
};
Expand Down

0 comments on commit cd49e1d

Please sign in to comment.