added better documentation so that when I return to this I will remember where I left off

This commit is contained in:
Daniel Jones 2024-01-03 15:40:47 -06:00
parent 309b1c7085
commit 47e9e8e7a8

View File

@ -3,7 +3,7 @@
*Compiler: MinGW *Compiler: MinGW
*OS: Windows 10 *OS: Windows 10
*Purpose: QT Widget that displays the verse of the day upon Windows 10 bootup. *Purpose: QT Widget that displays the verse of the day upon Windows 10 bootup.
* Last edited: 9/1/2023 * Last edited: 1/3/2024
*/ */
#include "mainwindow.h" #include "mainwindow.h"
@ -12,9 +12,10 @@
#include <ctime> #include <ctime>
#include <iostream> #include <iostream>
//Function declarations
int current_day(); int current_day();
int current_month(); int current_month();
QString verse_display(); QString verse_display();
std::string verse_grab(); std::string verse_grab();
@ -37,7 +38,13 @@ MainWindow::~MainWindow()
//This is the function that will load the verse into the program. /*
* Function: verse_display
* description: This function asks verse_grab to get the verse from the sqlite3 database, converts it
* to a format that QT can display, and then returns it to MainWindow.
* Return type: QString
* Param: none
*/
QString verse_display() QString verse_display()
{ {
std::string verse_text; std::string verse_text;
@ -50,22 +57,29 @@ QString verse_display()
} }
/*
* Function: verse_grab
* description: selects the verse based on the current day and returns the result
* Return type: string
* Param: none
*/
std::string verse_grab(){ std::string verse_grab(){
std::string my_verse; std::string my_verse;
//gets current month and day and returns the result
int curmonth = current_month(); int curmonth = current_month();
int curday = current_day(); int curday = current_day();
std::string query = "select * from verses where day = " + std::to_string(curday) + " and month = " + std::to_string(curmonth); std::string query = "select * from verses where day = " + std::to_string(curday) + " and month = " + std::to_string(curmonth);
//placeholder until I get the SQLlite3 connection working
my_verse = "hello world!"; my_verse = "hello world!";
return query; return my_verse;
} }
//UI function that exits when the "go in peace" button is pressed.
void MainWindow::on_exitButton_clicked() void MainWindow::on_exitButton_clicked()
{ {
QApplication::quit(); QApplication::quit();
@ -75,10 +89,16 @@ void MainWindow::on_exitButton_clicked()
//Everything below this grabs the day and month. //Everything below this grabs the day and month.
typedef std::chrono::system_clock Clock; typedef std::chrono::system_clock Clock;
/*
* Function: current_day
* description: queries the operating system for the current day
* Return type: integer
* Param: none
*/
int current_day(){ int current_day(){
auto now = Clock::now(); auto now = Clock::now();
@ -91,6 +111,12 @@ int current_day(){
return day; return day;
} }
/*
* Function: current_month
* description: queries the operating system for the current month
* Return type: integer
* Param: none
*/
int current_month(){ int current_month(){
auto now = Clock::now(); auto now = Clock::now();