BeamNG_IRC

Untitled

Feb 5th, 2015
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. void NewDiaryEntry::on_SaveButton_clicked() {
  2.     char *szBuff;
  3.     User = szBuff = std::getenv("USERPROFILE"); // this will get the users %userprofile% location
  4.     QString FileName = User + "/" + ui->FileLabel->text() + ".diary";
  5.     QDir dir(FileName); // our final directory to look in
  6.     QFile file(dir);
  7.     file.open(QIODevice::WriteOnly | QIODevice::Text);
  8.     QTextStream out(&file);
  9.     out << "Title: " << ui->TitleLine->text() + "\n";
  10.     out << "Date: " << ui->DateLabel->text() + "\n";
  11.     out << "Comment: " << ui->CommentLine->text() + "\n";
  12.     out << "Entry: " << ui->EntryText->toPlainText();
  13.     MainDiary* MainUI = new MainDiary;
  14.     MainUI->show();
  15.     delete this; // close this instance
  16. }
Advertisement
Add Comment
Please, Sign In to add comment