2 Image Puzzle - A set your pieces straight game
3 Copyright (C) 2009 Timo Härkönen
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "trackerfiles.h"
23 TrackerFiles::TrackerFiles(QObject *parent) :
26 tracker_ = new QProcess(this);
28 connect(tracker_, SIGNAL(finished(int,QProcess::ExitStatus)),
29 this, SLOT(processFinished(int,QProcess::ExitStatus)));
32 void TrackerFiles::readFiles()
34 QString program("tracker-files");
36 args << "-m" << "image/png" << "-m" << "image/jpeg";
37 tracker_->start(program, args);
38 // FIXME: this blocks execution
39 tracker_->waitForFinished();
42 void TrackerFiles::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
46 if(exitCode == 0 && exitStatus == QProcess::NormalExit) {
47 QString stdOut = tracker_->readAllStandardOutput();
48 files = stdOut.split("\n");
49 // first row is not a path
50 if(!files.isEmpty()) {
55 qDebug() << QString("Found %1 images").arg(files.count());
58 qDebug() << tracker_->errorString();
61 emit filesRead(files);