File: dwtest.cpp

package info (click to toggle)
psi 0.9.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,524 kB
  • ctags: 10,934
  • sloc: cpp: 81,408; ansic: 18,998; sh: 1,555; xml: 1,304; makefile: 165
file content (42 lines) | stat: -rw-r--r-- 745 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include"dwtest.h"

#include<qapplication.h>
#include<qfile.h>

DwTest::DwTest(const QStringList &dirs)
{
	for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
		DirWatch *dw = new DirWatch(*it, this);
		connect(dw, SIGNAL(changed()), SLOT(dw_changed()));
	}
}

void DwTest::dw_changed()
{
	DirWatch *dw = (DirWatch *)sender();
	printf("[%s] changed\n", dw->dir().latin1());
}


int main(int argc, char **argv)
{
	QApplication app(argc, argv);

	if(argc < 2) {
		printf("usage: dwtest dir1 dir2 ...\n\n");
		return 0;
	}

	QStringList dirList;
	for(int n = 1; n < argc; ++n) {
		QString dir = QFile::decodeName(argv[n]);
		dirList += dir;
	}

	DwTest *test = new DwTest(dirList);
	app.exec();
	delete test;

	return 0;
}