checks day and month to reference database now
This commit is contained in:
parent
f7597a8e75
commit
08d97563fb
@ -8,15 +8,13 @@
|
|||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "./ui_mainwindow.h"
|
#include "./ui_mainwindow.h"
|
||||||
|
#include <windows.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <random>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString verse_display();
|
QString verse_display();
|
||||||
std::string verse_grab(int day);
|
std::string verse_grab();
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
@ -33,19 +31,14 @@ MainWindow::~MainWindow()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
//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.
|
//This is the function that will load the verse into the program.
|
||||||
QString verse_display()
|
QString verse_display()
|
||||||
{
|
{
|
||||||
std::string verse_text;
|
std::string verse_text;
|
||||||
int verse_day = random_verse();
|
|
||||||
verse_text = verse_grab(verse_day);
|
verse_text = verse_grab();
|
||||||
|
|
||||||
QString returned_string = QString::fromStdString(verse_text);
|
QString returned_string = QString::fromStdString(verse_text);
|
||||||
|
|
||||||
@ -53,17 +46,22 @@ QString verse_display()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string verse_grab(int day){
|
std::string verse_grab(){
|
||||||
|
|
||||||
|
//Windows way of getting current month and time.
|
||||||
|
SYSTEMTIME st = {0};
|
||||||
|
GetLocalTime(&st);
|
||||||
|
int cur_day = st.wDay;
|
||||||
|
int cur_month = st.wMonth;
|
||||||
|
|
||||||
std::string my_verse;
|
std::string my_verse;
|
||||||
my_verse = "Hello, this is a verse!";
|
|
||||||
return my_verse;
|
return my_verse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_exitButton_clicked()
|
void MainWindow::on_exitButton_clicked()
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
|
Loading…
Reference in New Issue
Block a user