📝 Added documentation and todo's to MainWindow class

main
Isabell Pflug 1 year ago
parent 8749c1d82a
commit ada3c5cf0b

@ -30,7 +30,7 @@ QT_END_NAMESPACE
/*!
* \todo
* - add documentation page (group) for #highscore functions!
* - add documentation to #MainWindow class
* - finish documentation for #MainWindow class
*/
/*!
@ -44,10 +44,26 @@ public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
/*!
* \name Initialisation functions
* \{
*/
void initialiseGame();
void initialiseGameGrid();
void initialiseWindow();
void initialiseMenuBar();
/*!
* \brief setPalettes
* Makes the application itself pink (outside of the game colors that are changeable by user configuration
*/
void setPalettes();
/*! \} */
/*!
* \name SameGame functionality
* \{
*/
void clearConnected(std::set<std::vector<int>> *connected);
void refreshButtonGrid();
void refreshSizes();
@ -56,31 +72,102 @@ public:
void bubbleRight(int column);
void bubbleUp(int row, int column);
void bubbleBoxes(std::set<std::vector<int>> *connected);
void setPalettes();
/*!
* \brief gameOver
* Opts the user to create a #newEntry in case their score was high enough to list under top 10,
* then shows (updated) highscores with #showHighscore_triggered.
*/
void gameOver();
/*! \} */
/*!
* \name Highscore functionality
* \{
*/
void processHighscore();
void readHighscore();
QMap<QPair<QString, QDateTime>, int> newEntry();
/*! \} */
private slots:
/*!
* \name SameGame functionality
* \todo Refactor this by moving everything that makes sense from #MainWindow to #SameGame as these are the
* game core functionalities so therefore it does not make any sense for them to be here!
* \{
*/
void button_clicked(int row, int column);
/*! \} */
/*!
* \brief newGame_triggered
* Slot that first creates a #QDialog asking the user if they're sure about starting a new game,
* then, if the user confirms, refreshes the #SameGame #SameGame::gameMatrix and updates the #buttonGrid.
*/
void newGame_triggered();
/*!
* \name Highscore functionality
* \{
*/
/*!
* \brief showHighscore_triggered
* Slot that creates a #QDialog showing all the highscores stored inside of the csv file specified at #csv_name.
* Gets triggered when the user clicks the "Highscore" menu option at the "Play" (menubar)[#QMenuBar].
*/
void showHighscore_triggered();
/*! \} */
private:
Ui::MainWindow *ui;
/*!
* \brief stores the parameters read from #QSettings
*
* \{
*/
const int rows;
const int columns;
/*! \} */
/*!
* \brief csv_name specifies the file name of the csv file for the highscores.
* required for #readHighscore (reading from) and #processHighscore (writing to)
*/
const QString csv_name = "highscore.csv";
/*!
* \brief saves the ui's space for the button grid.
* \todo check this. does this even still get used? I thought we were responsive.
*
* \{
*/
double max_width;
double max_height;
/*! \} */
/*!
* \brief pointer to the #SameGame instance for the current game execution.
*/
SameGame *game;
/*!
* \brief mirrors the #SameGame::gameMatrix inside of the #game, but instead of storing the colors, it stores pointers to the buttons that represent each color cell in the ui.
*/
std::vector<std::vector<QPushButton *>> buttonGrid;
/*!
* \name Highscore functionality
* \{
*/
/*!
* \brief highscore
* \brief the highscore list, stores all numerical scores paired with the name and date that they got achieved.
* gets read in #readHighscore from the highscore csv file #csv_name .
*/
QMap<QPair<QString, QDateTime>, int> highscore;
/*! \} */
};
#endif // MAINWINDOW_H

@ -31,6 +31,7 @@
* A list of all colors that can get picked for the initial game grid. You can edit the list to have as many or as few colors as you want, using the hexadecimal color values.
* \section Default Default configuration file
* \verbinclude{doc} ThinkPink.ini
* \todo document config file location
*/
/*!
@ -38,7 +39,8 @@
* \ingroup Settings
* \brief Overview of all sources that initialise and declare the `std::unique_ptr<QSettings>` #settings.
* \details Initialising the QSettings using a std::unique_ptr enables usage of user configuration at load time. \n
* This means that we can have the grid size of \ref SameGame::gameMatrix and color list \ref SameGame::colors as constants.
* This means that we can have the grid size of \ref SameGame::gameMatrix and color list \ref SameGame::colors as constants. \n
* To see the settings stored and loaded in #settings, see \sa ini_config the Configuration documentation for the `ThinkPink.ini`.
*/
/*!

Loading…
Cancel
Save