Player12
An open source football management simulator
Loading...
Searching...
No Matches
inbox_scene.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <array>
12#include <cstdint>
13#include <optional>
14#include <string>
15#include <utility>
16#include <vector>
17
22#include "model/inbox.h"
23
44{
45 public:
46 explicit InboxScene(GUIView* parent);
47
48 void update(float deltaTime) override;
49 [[nodiscard]] SceneID getID() const override { return SceneID::INBOX; }
50
51 protected:
52 void renderContent() override;
53 [[nodiscard]] NavSection navSection() const override
54 {
55 return NavSection::INBOX;
56 }
57 void refresh() override;
58
59 private:
61
63 struct Thread
64 {
65 std::vector<size_t> messages;
66 std::string title;
67 std::string detail;
68 std::string date_text;
69 std::vector<std::string> message_titles;
71 size_t unread = 0;
72 };
73
75 struct Decision
76 {
77 size_t message = 0;
80 std::string title;
81 std::string body;
82 std::string date_text;
83 struct Option
84 {
85 uint32_t id = 0;
86 std::string text;
87 bool negotiable = false;
88 bool awaiting = false;
89 };
90 std::vector<Option> options;
91 };
92
93 void rebuildThreads();
94 void rebuildDecisions();
95 void renderDecisions();
96 void renderDecision(const Decision& decision);
97 void renderFilters(float width, float height);
98 void renderThreads(float width, float height);
99 void renderReader(float height);
100 void openMessage(size_t messageIndex);
101 void renderReaderActions(const InboxMessage& message);
103 void renderDrawAction(const InboxMessage& message);
104 void renderEntityFilter();
106 InboxView currentView() const;
107 void applyView(const InboxView& view);
109 void storeView();
110
111 static constexpr size_t CATEGORY_COUNT =
112 static_cast<size_t>(std::to_underlying(InboxCategory::COUNT));
113
114 std::vector<Thread> threads;
115 std::array<size_t, CATEGORY_COUNT> unread_by_category{};
116 std::array<size_t, CATEGORY_COUNT> total_by_category{};
118 bool unread_only = false;
119 int tab = -1;
120 bool followed_only = false;
121 std::optional<PlayerID> filter_player;
122 std::optional<TeamID> filter_team;
123 std::string filter_label;
125 std::vector<PlayerID> followed;
126 size_t followed_unread = 0;
127 size_t followed_total = 0;
128 bool show_archived = false;
129 size_t archived_count = 0;
130 std::vector<Decision> decisions;
132 std::vector<bool> hidden;
135 size_t selected_message = SIZE_MAX;
136 std::uint32_t selected_message_id = 0;
137 std::string selected_title;
138 std::string selected_body;
142};
Modal that reveals a draw already made, one tie at a time.
Definition draw_ceremony_dialog.h:32
Main view manager for the GUI. Handles scenes and overlays.
Definition gui_view.h:29
Club inbox: pinned decisions with their actions in place, and the information feed with category filt...
Definition inbox_scene.h:44
std::array< size_t, CATEGORY_COUNT > total_by_category
Definition inbox_scene.h:116
size_t selected_message
Definition inbox_scene.h:135
std::vector< Thread > threads
Definition inbox_scene.h:114
int expanded_thread
Definition inbox_scene.h:134
void refresh() override
Rebuilds cached view models from the game state.
Definition inbox_scene.cpp:142
size_t followed_unread
Definition inbox_scene.h:126
std::vector< Decision > decisions
Definition inbox_scene.h:130
void storeView()
Definition inbox_scene.cpp:125
void renderThreads(float width, float height)
Definition inbox_scene.cpp:539
int selected_thread
Definition inbox_scene.h:133
void renderContent() override
Draws the page body inside the content region.
Definition inbox_scene.cpp:330
bool unread_only
Definition inbox_scene.h:118
size_t followed_total
Definition inbox_scene.h:127
void renderFilters(float width, float height)
Definition inbox_scene.cpp:385
void rebuildDecisions()
Definition inbox_scene.cpp:163
void renderDecisions()
Definition inbox_scene.cpp:683
void renderDrawAction(const InboxMessage &message)
Definition inbox_scene.cpp:521
bool show_archived
Definition inbox_scene.h:128
SceneID getID() const override
Gets the ID of the scene.
Definition inbox_scene.h:49
size_t archived_count
Definition inbox_scene.h:129
static constexpr size_t CATEGORY_COUNT
Definition inbox_scene.h:111
void renderEntityFilter()
Definition inbox_scene.cpp:443
std::string filter_label
Definition inbox_scene.h:123
InboxView currentView() const
Definition inbox_scene.cpp:98
int category_filter
Definition inbox_scene.h:117
std::optional< PlayerID > filter_player
Definition inbox_scene.h:121
std::array< size_t, CATEGORY_COUNT > unread_by_category
Definition inbox_scene.h:115
DrawCeremonyDialog draw_dialog
Definition inbox_scene.h:141
std::string selected_body
Definition inbox_scene.h:138
NavSection navSection() const override
Sidebar entry highlighted for this screen.
Definition inbox_scene.h:53
void update(float deltaTime) override
Updates scene logic.
Definition inbox_scene.cpp:136
void rebuildThreads()
Definition inbox_scene.cpp:238
void renderReaderActions(const InboxMessage &message)
Definition inbox_scene.cpp:461
std::uint32_t selected_message_id
Definition inbox_scene.h:136
std::optional< TeamID > filter_team
Definition inbox_scene.h:122
std::vector< PlayerID > followed
Definition inbox_scene.h:125
void applyView(const InboxView &view)
Definition inbox_scene.cpp:110
void renderReader(float height)
Definition inbox_scene.cpp:622
void renderDecision(const Decision &decision)
Definition inbox_scene.cpp:706
std::vector< bool > hidden
Definition inbox_scene.h:132
InboxView stored_view
Definition inbox_scene.h:124
bool followed_only
Definition inbox_scene.h:120
void openMessage(size_t messageIndex)
Definition inbox_scene.cpp:313
int tab
Definition inbox_scene.h:119
OfferNegotiationDialog offer_dialog
Definition inbox_scene.h:140
std::string selected_title
Definition inbox_scene.h:137
friend class GameFlowTest_GUIFlowLifecycle_Test
Definition inbox_scene.h:60
PlayerTalkDialog talk_dialog
Definition inbox_scene.h:139
Base class for every in-career screen.
Definition management_scene.h:93
Modal talks over an AI club's bid for one of the managed players, or its offer to borrow him.
Definition offer_negotiation_dialog.h:43
Modal one-to-one conversation with a managed player.
Definition player_talk_dialog.h:36
SceneID
Identifiers for different GUI scenes.
Definition gui_scene.h:24
InboxAction
What the manager can do straight from a message. Derived from the title key (see Inbox::actionFor()),...
Definition inbox.h:48
InboxCategory
Message categories (values are persisted).
Definition inbox.h:26
NavSection
Screens of the management shell. The sidebar groups them into a few hubs (Home, Inbox,...
Definition nav_history.h:26
A news item for the managed club.
Definition inbox.h:84
Definition inbox_scene.h:84
bool negotiable
Definition inbox_scene.h:87
std::string text
Definition inbox_scene.h:86
bool awaiting
Definition inbox_scene.h:88
A pending decision with what can be done about it.
Definition inbox_scene.h:76
size_t message
Definition inbox_scene.h:77
InboxAction action
Definition inbox_scene.h:78
PlayerID player
Definition inbox_scene.h:79
std::string date_text
Definition inbox_scene.h:82
std::vector< Option > options
Definition inbox_scene.h:90
std::string title
Definition inbox_scene.h:80
std::string body
Definition inbox_scene.h:81
One visible row: a single message or a folded digest.
Definition inbox_scene.h:64
size_t unread
Definition inbox_scene.h:71
InboxCategory category
Definition inbox_scene.h:70
std::vector< std::string > message_titles
Definition inbox_scene.h:69
std::string detail
Definition inbox_scene.h:67
std::string title
Definition inbox_scene.h:66
std::string date_text
Definition inbox_scene.h:68
std::vector< size_t > messages
Definition inbox_scene.h:65
Filters of the inbox screen, kept with the career (table InboxView) so they survive a scene change an...
Definition inbox.h:63
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21