DailyBread/mainwindow.cpp

67 lines
1.1 KiB
C++
Raw Normal View History

/*Author: Daniel Jones
*IDE: QT Creator
*Compiler: MinGW
*OS: Windows 10
*Purpose: QT Widget that displays the verse of the day upon Windows 10 bootup.
* Last edited: 9/1/2023
*/
2023-09-01 19:38:09 +00:00
#include "mainwindow.h"
#include "./ui_mainwindow.h"
2023-09-01 20:40:44 +00:00
#include <iostream>
#include <random>
QString verse_display();
std::string sqlite_func(int day);
2023-09-01 19:38:09 +00:00
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->verse->setText(verse_display());
2023-09-01 19:38:09 +00:00
}
MainWindow::~MainWindow()
{
2023-09-01 20:40:44 +00:00
2023-09-01 19:38:09 +00:00
delete ui;
}
2023-09-01 20:40:44 +00:00
//As name implies, randomly chooses a number between 1 and 100.
int random_verse(){
std::random_device rd;
std:: uniform_int_distribution<int> dist(1, 100);
return dist(rd);
}
//This is the function that will load the verse into the program.
QString verse_display()
2023-09-01 20:40:44 +00:00
{
std::string verse_text;
int verse_day = random_verse();
verse_text = sqlite_func(verse_day);
2023-09-01 20:40:44 +00:00
return "It is receiving text from verse_display()";
2023-09-01 20:40:44 +00:00
}
std::string sqlite_func(int day){
std::string my_verse;
return my_verse;
}
2023-09-01 19:38:09 +00:00
void MainWindow::on_exitButton_clicked()
{
QApplication::quit();
}