Advertisement
Glenpl

Untitled

Jun 28th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. void AppEngine::readTasklistFromFile(QString filename)
  2. {
  3.   tasklist.clear();
  4.  
  5.   filename = ( filename == "" ? "tasklist_db.txt" : filename );
  6.   QFile tasklistDB( filename );
  7.   tasklistDB.open(QIODevice::ReadOnly);
  8.  
  9.   QTextStream textStream( &tasklistDB );
  10.  
  11.   while( !textStream.atEnd() )
  12.     {
  13.       int ID = textStream.readLine().trimmed().toInt();
  14.       QString dateOfCreation = textStream.readLine();
  15.       QString dateTaskFinished = textStream.readLine();
  16.       QString name = textStream.readLine();
  17.       QString content = textStream.readLine();
  18.       bool done = ( textStream.readLine().trimmed() == "1" ? true : false );
  19.       int priority = textStream.readLine().trimmed().toInt();
  20.      
  21.       tasklist.add( Task( ID, dateOfCreation, dateTaskFinished,
  22.                           name, content, done, priority ) );
  23.     }
  24.  
  25.   tasklistDB.close();
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement