Ticket #7487: test.cpp

File test.cpp, 647 bytes (added by Robin Hill <myth@…>, 10 years ago)

Simple test script using the same functionality

Line 
1#include <QTextStream>
2#include <QDir>
3
4
5int main()
6{
7  QTextStream out(stdout);
8  QDir dir("/mnt/store/videos/TV Shows/Test");
9
10  QFileInfoList list = dir.entryInfoList();
11
12  for (QFileInfoList::iterator p = list.begin(); p != list.end(); ++p)
13  {
14    if (p->fileName() == "." ||
15        p->fileName() == ".." ||
16        p->fileName() == "Thumbs.db")
17    {
18        continue;
19    }
20
21    QString tmp;
22
23    if (p->isDir())
24        tmp = QString("dir::%1::0").arg(p->fileName());
25    else
26        tmp = QString("file::%1::%2").arg(p->fileName()).arg(p->size());
27
28    out << QString("%1").arg(tmp);
29    out << endl;
30  }
31}