Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QDate>
- #include <QString>
- #include <QDebug>
- #include <QDir>
- #include <QStandardItem>
- #include "maindiary.h"
- #include "ui_maindiary.h"
- #include "editdiaryentry.h"
- #include "newentry.h"
- MainDiary::MainDiary(QWidget *parent) :
- QMainWindow(parent),
- ui(new Ui::MainDiary) {
- ui->setupUi(this);
- // add our date to the main window
- QDate date = QDate::currentDate();
- QString dateString = date.toString();
- ui->DateLabel->setText(dateString);
- // at this point we want to check to see if %userprofile%\diary exists, if not, we will create it
- char *szBuff;
- QString user = szBuff=std::getenv("USERPROFILE"); // this will get the users %userprofile% location
- QDir dir(user + "/diary");
- if (!dir.exists()) { // if the diary directory does not exist
- dir.mkpath(user + "/diary");
- }
- }
- MainDiary::~MainDiary() {
- delete ui;
- }
- /*
- * The idea of this program is simple:
- * The user can create a diary entry, save it and later edit it.
- * It will use a foreign file format that will be structured simply, for example (subject to change):
- * date: <date here>
- * title: <title here>
- * entry: <entry here>
- */
- void MainDiary::on_EditButton_clicked() { // here we will control what the edit button does
- /* in this function we will do the following:
- * - show the edit dialog
- * - retrieve all local entries (they will be stored in %userprofile%\diary)
- * - display all these entries in a formated matter
- */
- EditDiaryEntry Edit;
- QWidget* EditUI = new EditDiaryEntry; // set an object for our new window
- EditUI->show();
- Edit.ParseFile(); // retrieve each local file
- }
- void MainDiary::on_NewButton_clicked() { // this function will control the new button
- NewEntry Entry;
- Entry.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement