2023-09-19 15:33:33 +00:00
|
|
|
/*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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "./ui_mainwindow.h"
|
2023-09-19 19:39:25 +00:00
|
|
|
#include <windows.h>
|
2023-09-19 15:33:33 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString verse_display();
|
2023-09-19 19:39:25 +00:00
|
|
|
std::string verse_grab();
|
2023-09-19 15:33:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
: QMainWindow(parent)
|
|
|
|
, ui(new Ui::MainWindow)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->verse->setText(verse_display());
|
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2023-09-19 19:39:25 +00:00
|
|
|
|
2023-09-19 15:33:33 +00:00
|
|
|
|
|
|
|
//This is the function that will load the verse into the program.
|
|
|
|
QString verse_display()
|
|
|
|
{
|
|
|
|
std::string verse_text;
|
2023-09-19 19:39:25 +00:00
|
|
|
|
|
|
|
verse_text = verse_grab();
|
2023-09-19 15:33:33 +00:00
|
|
|
|
|
|
|
QString returned_string = QString::fromStdString(verse_text);
|
|
|
|
|
|
|
|
return returned_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-19 19:39:25 +00:00
|
|
|
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;
|
2023-09-19 15:33:33 +00:00
|
|
|
|
|
|
|
std::string my_verse;
|
2023-09-19 19:39:25 +00:00
|
|
|
|
2023-09-19 15:33:33 +00:00
|
|
|
return my_verse;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_exitButton_clicked()
|
|
|
|
{
|
|
|
|
QApplication::quit();
|
|
|
|
}
|
|
|
|
|