Study Dungeon  1.0.0
A group project for COSC345
settings_scene.h
Go to the documentation of this file.
1 
11 #pragma once
12 #ifndef SETTINGS_SCENE_H
13 #define SETTINGS_SCENE_H
14 
15 #include "menu.h"
16 #include "util.h"
17 #include <functional>
18 #include <iostream>
19 #include <sstream>
20 #include <string>
21 
27 {
28 public:
33  StudySettings();
40  StudySettings(const int &n_cards, const int &mins);
41 
47  int getFlashCardLimit();
48 
54  int getStudyDurationMin();
55 
61  void setFlashCardLimit(const int &n_cards);
62 
68  void setStudyDurationMin(const int &mins);
69 
74  void incStudyDuration();
75 
80  void decStudyDuration();
81 
86  void incFCLimit();
87 
92  void decFCLimit();
93 
98  void reset();
99 
104  void startSession();
105 
111  boolean sessionUnderway();
112 
117  void endSession();
118 
124  std::chrono::steady_clock::time_point getSessionStart();
125 
131  std::filesystem::path getDeckDir();
132 
133 
134 private:
136  int m_flashcard_limit;
138  int m_study_duration_mins;
140  std::chrono::steady_clock::time_point m_session_start = std::chrono::steady_clock::now();
142  boolean m_session_underway{false};
144  std::filesystem::path m_deck_dir = getAppPath().append("Decks/");
145 };
146 
147 
154 {
155 public:
162  SettingsScene(ConsoleUI::UIManager &uiManager, std::function<void()> goBack, StudySettings &studySettings);
163 
168  void update() override;
176  void render(std::shared_ptr<ConsoleUI::ConsoleWindow> window) override;
177 
182  void init();
183 
188  void incrementCards();
189 
194  void decrementCards();
195 
200  void incrementStudyMins();
201 
206  void decrementStudyMins();
207 
212  void resetDefault();
213 
218  void handleInput() override;
219 
224  void setStaticDrawn(bool staticDrawn) override
225  {
226  m_staticDrawn = staticDrawn;
227  }
228 
229 private:
230  ConsoleUI::UIManager &m_uiManager;
231  StudySettings &m_settings;
232  std::function<void()> m_goBack;
233  bool m_staticDrawn = false;
234 };
235 
236 #endif // SETTINGS_SCENE_H
Defines a UI scene.
Definition: menu.h:629
Defines the UI manager.
Definition: menu.h:675
Class for a scene to show the program instructions.
Definition: settings_scene.h:154
void incrementCards()
Increment flashcard card limit by 1.
Definition: settings_scene.cpp:174
SettingsScene(ConsoleUI::UIManager &uiManager, std::function< void()> goBack, StudySettings &studySettings)
Construct a new HowTo Scene object.
Definition: settings_scene.cpp:118
void handleInput() override
Handle user input for the scene.
Definition: settings_scene.cpp:168
void decrementStudyMins()
Decrement study duration by 1 minute.
Definition: settings_scene.cpp:192
void update() override
function for continuous updates to the program state seperate from rendering and input handling
Definition: settings_scene.cpp:138
void decrementCards()
Decrement flashcard card limit by 1.
Definition: settings_scene.cpp:180
void resetDefault()
Reset to default settings.
Definition: settings_scene.cpp:197
void render(std::shared_ptr< ConsoleUI::ConsoleWindow > window) override
renders the scene on the console window
Definition: settings_scene.cpp:144
void setStaticDrawn(bool staticDrawn) override
Sets the static drawn state of the scene.
Definition: settings_scene.h:224
void init()
Initialise the scene.
Definition: settings_scene.cpp:133
void incrementStudyMins()
Increment study duration by 1 miunute.
Definition: settings_scene.cpp:186
Object for the settings relating to the study sessions component.
Definition: settings_scene.h:27
void endSession()
sets the end of the session
std::chrono::steady_clock::time_point getSessionStart()
Get the Session Start time point.
Definition: settings_scene.cpp:112
void setStudyDurationMin(const int &mins)
Set the Study Duration.
Definition: settings_scene.cpp:88
std::filesystem::path getDeckDir()
Get the directory the Deck files are stored in.
Definition: settings_scene.cpp:19
int getFlashCardLimit()
Get the round limit for flashcards.
Definition: settings_scene.cpp:66
boolean sessionUnderway()
Determines if the study session is underway.
Definition: settings_scene.cpp:107
int getStudyDurationMin()
Get the Study Duration.
Definition: settings_scene.cpp:71
void setFlashCardLimit(const int &n_cards)
Set the maximum number of flashcards per round.
Definition: settings_scene.cpp:76
StudySettings()
Construct a new Study Settings object.
Definition: settings_scene.cpp:15
void decFCLimit()
decrement the flashcard card round limit by 1
Definition: settings_scene.cpp:41
void incFCLimit()
increment the flashcard card round limit by 1
Definition: settings_scene.cpp:32
void startSession()
Set the start time for the study session.
Definition: settings_scene.cpp:101
void reset()
Reset the settings back to the defaults.
Definition: settings_scene.cpp:24
StudySettings(const int &n_cards, const int &mins)
Construct a new Study Settings object.
void incStudyDuration()
increment the study duration by 1 minute
Definition: settings_scene.cpp:49
void decStudyDuration()
decrement the study duration by 1 minute
Definition: settings_scene.cpp:57
Classes and functions for the UI system.
Contains useful helper functions.