~ubuntu-branches/ubuntu/edgy/psi/edgy

« back to all changes in this revision

Viewing changes to cutestuff/dwtest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2006-03-28 11:11:02 UTC
  • mfrom: (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20060328111102-v1diqpbwqr4yijoy
Tags: 0.10-2build1
Manual sync from Debian. No Ubuntu-specific changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include"dwtest.h"
2
 
 
3
 
#include<qapplication.h>
4
 
#include<qfile.h>
5
 
 
6
 
DwTest::DwTest(const QStringList &dirs)
7
 
{
8
 
        for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
9
 
                DirWatch *dw = new DirWatch(*it, this);
10
 
                connect(dw, SIGNAL(changed()), SLOT(dw_changed()));
11
 
        }
12
 
}
13
 
 
14
 
void DwTest::dw_changed()
15
 
{
16
 
        DirWatch *dw = (DirWatch *)sender();
17
 
        printf("[%s] changed\n", dw->dir().latin1());
18
 
}
19
 
 
20
 
 
21
 
int main(int argc, char **argv)
22
 
{
23
 
        QApplication app(argc, argv);
24
 
 
25
 
        if(argc < 2) {
26
 
                printf("usage: dwtest dir1 dir2 ...\n\n");
27
 
                return 0;
28
 
        }
29
 
 
30
 
        QStringList dirList;
31
 
        for(int n = 1; n < argc; ++n) {
32
 
                QString dir = QFile::decodeName(argv[n]);
33
 
                dirList += dir;
34
 
        }
35
 
 
36
 
        DwTest *test = new DwTest(dirList);
37
 
        app.exec();
38
 
        delete test;
39
 
 
40
 
        return 0;
41
 
}
42