Advertisement
BeamNG_IRC

Untitled

Feb 4th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.80 KB | None | 0 0
  1. #include <QDate>
  2. #include <QString>
  3. #include <QDebug>
  4. #include <QDir>
  5. #include <QStandardItem>
  6. #include "maindiary.h"
  7. #include "ui_maindiary.h"
  8. #include "editdiaryentry.h"
  9. #include "newentry.h"
  10.  
  11. MainDiary::MainDiary(QWidget *parent) :
  12.     QMainWindow(parent),
  13.     ui(new Ui::MainDiary) {
  14.     ui->setupUi(this);
  15.     // add our date to the main window
  16.     QDate date = QDate::currentDate();
  17.     QString dateString = date.toString();
  18.     ui->DateLabel->setText(dateString);
  19.     // at this point we want to check to see if %userprofile%\diary exists, if not, we will create it
  20.     char *szBuff;
  21.     QString user = szBuff=std::getenv("USERPROFILE"); // this will get the users %userprofile% location
  22.     QDir dir(user + "/diary");
  23.     if (!dir.exists()) { // if the diary directory does not exist
  24.         dir.mkpath(user + "/diary");
  25.     }
  26. }
  27.  
  28. MainDiary::~MainDiary() {
  29.     delete ui;
  30. }
  31.  
  32. /*
  33.  * The idea of this program is simple:
  34.  * The user can create a diary entry, save it and later edit it.
  35.  * It will use a foreign file format that will be structured simply, for example (subject to change):
  36.  * date: <date here>
  37.  * title: <title here>
  38.  * entry: <entry here>
  39.  */
  40.  
  41. void MainDiary::on_EditButton_clicked() { // here we will control what the edit button does
  42.     /* in this function we will do the following:
  43.      * - show the edit dialog
  44.      * - retrieve all local entries (they will be stored in %userprofile%\diary)
  45.      * - display all these entries in a formated matter
  46.      */
  47.     EditDiaryEntry Edit;
  48.     QWidget* EditUI = new EditDiaryEntry; // set an object for our new window
  49.     EditUI->show();
  50.     Edit.ParseFile(); // retrieve each local file
  51.  
  52. }
  53.  
  54. void MainDiary::on_NewButton_clicked() { // this function will control the new button
  55.     NewEntry Entry;
  56.     Entry.exec();
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement