Skip to content

Commit

Permalink
Fix #5226 and some other GUI issues
Browse files Browse the repository at this point in the history
- Ensure the back button will always work when clicked in the arena screen
- Fix the back button not working in the online track selection screen by removing the ability to edit favorites in the network track selection screen (it was poor UX anyway). The ability to see previously picked favorites remains.
- Avoid the spinners of the random GP screen overflowing with big fonts in non-lap-trial mode
  • Loading branch information
Alayan-stk-2 committed Jan 8, 2025
1 parent 05f3452 commit ac3bf83
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 52 deletions.
23 changes: 11 additions & 12 deletions data/gui/screens/arenas.stkgui
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<icon-button id="back" x="1%" y="0" height="9%" icon="gui/icons/back.png"/>

<div x="2%" y="1%" width="96%" height="99%" layout="vertical-row" >
<div width="100%" height="8%" layout="horizontal-row" >
<header width="30%" height="100%" I18N="Section in arena tracks selection screen" text="Arenas"
align="center" text_align="center" />
<textbox width="40%" id="search" align="center"/>
<div x="1%" y="1%" width="98%" height="8%" layout="horizontal-row" >
<icon-button id="back" width="8%" height="100%" icon="gui/icons/back.png"/>
<header width="30%" height="100%" I18N="Section in arena tracks selection screen" text="Arenas"
align="center" text_align="center" />
<textbox width="30%" id="search" align="center"/>
<spacer width="5%" height="100%" />
<div width="fit" height="100%" layout="horizontal-row" align="center">
<checkbox id="favorite" align="center"/>
<spacer width="5%" height="100%" />
<div width="fit" height="100%" layout="horizontal-row" align="center">
<checkbox id="favorite" align="center"/>
<spacer width="5%" height="100%" />
<tiny-header width="fit" height="100%" I18N="Section in arena tracks selection screen" text="Edit favorite arenas"/>
</div>
<tiny-header width="fit" height="100%" I18N="Section in arena tracks selection screen" text="Edit favorite arenas"/>
</div>
</div>

<div x="2%" y="9%" width="96%" height="90%" layout="vertical-row" >
<box proportion="1" width="100%" layout="vertical-row" padding="2">
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true"
label_location="bottom" align="center" child_width="160" child_height="120" />
Expand Down
16 changes: 8 additions & 8 deletions data/gui/screens/gp_info.stkgui
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@
<label id="reverse-text" width="52%" height="fit" I18N="In the grand prix info screen" text="Reverse" text_align="left"/>
</div>
<spacer width="1" height="1%"/>
<div width="100%" height="fit" layout="horizontal-row">
<div width="45%" height="fit" layout="horizontal-row">
<spinner id="time-target-spinner" width="100%" min_value="1" max_value="20" align="center" wrap_around="true" />
</div>
<spacer width="3%"/>
<label id="time-target-text" width="52%" height="fit" I18N="In the grand prix info screen" text="Maximum time (min.)" text_align="left"/>
</div>
<spacer width="1" height="1%"/>
<div width="100%" height="fit" layout="horizontal-row">
<div width="45%" height="fit" layout="horizontal-row">
<spinner id="track-spinner" width="100%" min_value="1" max_value="20" align="center" wrap_around="true" />
Expand All @@ -54,6 +46,14 @@
<spacer width="3%"/>
<label id="group-text" width="52%" height="fit" I18N="In the grand prix info screen" text="Track group" text_align="left"/>
</div>
<spacer width="1" height="1%"/>
<div width="100%" height="fit" layout="horizontal-row">
<div width="45%" height="fit" layout="horizontal-row">
<spinner id="time-target-spinner" width="100%" min_value="1" max_value="20" align="center" wrap_around="true" />
</div>
<spacer width="3%"/>
<label id="time-target-text" width="52%" height="fit" I18N="In the grand prix info screen" text="Maximum time (min.)" text_align="left"/>
</div>
</div>
</box>
<spacer width="2%" height="1"/>
Expand Down
12 changes: 2 additions & 10 deletions data/gui/screens/tracks.stkgui
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@

<div id="all-track" x="1%" y="1%" width="60%" height="88%" layout="vertical-row" >

<div width="100%" height="8%" layout="horizontal-row" >
<header height="100%" width="60%" I18N="In the track selection screen" text="All Tracks"
align="center" text_align="center" />
<div width="fit" height="100%" layout="horizontal-row" align="center">
<checkbox id="favorite" align="center"/>
<spacer width="5%"/>
<tiny-header width="fit" height="100%" I18N="In the track and grand prix selection screen" text="Edit favorite tracks"/>
</div>
</div>

<header height="8%" width="80%" I18N="In the track selection screen" text="All Tracks"
align="center" text_align="center" />
<spacer width="100%" height="1%" />
<box proportion="1" width="100%" layout="vertical-row" padding="1">
<ribbon_grid id="tracks" proportion="1" width="100%" square_items="true"
Expand Down
23 changes: 1 addition & 22 deletions src/states_screens/online/tracks_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
m_laps->setValue(host_vote->m_num_laps);
m_reversed->setState(host_vote->m_reverse);
voteForPlayer();

// If editing favorite, also favorite that track
if (getWidget<CheckBoxWidget>("favorite")->getState()
&& !PlayerManager::getCurrentPlayer()->isFavoriteTrack(host_vote->m_track_name))
{
PlayerManager::getCurrentPlayer()->addFavoriteTrack(host_vote->m_track_name);
buildTrackList();
}
}
}
}
Expand Down Expand Up @@ -138,16 +130,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,

if (m_selected_track)
{
if (getWidget<CheckBoxWidget>("favorite")->getState())
{
if(PlayerManager::getCurrentPlayer()->isFavoriteTrack(m_selected_track->getIdent()))
PlayerManager::getCurrentPlayer()->removeFavoriteTrack(m_selected_track->getIdent());
else
PlayerManager::getCurrentPlayer()->addFavoriteTrack(m_selected_track->getIdent());

buildTrackList();
}
else if (STKHost::existHost())
if (STKHost::existHost())
{
w2->setBadge(selection, OK_BADGE);
voteForPlayer();
Expand Down Expand Up @@ -361,10 +344,6 @@ void TracksScreen::beforeAddingWidget()
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
tabs->clearAllChildren();

CheckBoxWidget* favorite_cb = getWidget<CheckBoxWidget>("favorite");
assert( favorite_cb != NULL );
favorite_cb->setState(false);

RaceManager::MinorRaceModeType minor_mode = RaceManager::get()->getMinorMode();
bool is_soccer = minor_mode == RaceManager::MINOR_MODE_SOCCER;
bool is_arena = is_soccer || RaceManager::get()->isBattleMode();
Expand Down

0 comments on commit ac3bf83

Please sign in to comment.