added GPL header into source files
[KFingerManager.git] / src / SensorAnimLabel.cpp
blob84e81c7afb20f21157531a61153fd8ff8d0bbccc
1 /*
3 Copyright (C) 2009 Jaroslav Barton <djaara@djaara.net>
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 2 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, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include <KStandardDirs>
23 #include "SensorAnimLabel.h"
25 /**
26 * SensorAnimLabel - label with swipe/place animation.
27 * @param sensor sensor type for selecting right animation
28 * @param parent parent widget
30 SensorAnimLabel::SensorAnimLabel(QString sensor, QWidget *parent) : QLabel(parent) {
31 if (sensor == "swipe") {
32 movie = new QMovie(KStandardDirs::locate("data", "kfingermanager/pics/swipe.gif"));
33 } else {
34 // TODO get some animation for non-swipe sensors
35 movie = new QMovie(KStandardDirs::locate("data", "kfingermanager/pics/swipe.gif"));
38 movie->start();
39 movie->setPaused(true);
40 setMovie(movie);
41 setFixedSize(minimumSizeHint());
42 clear();
45 /**
46 * SensorAnimLabel destructor.
48 SensorAnimLabel::~SensorAnimLabel() {
49 movie->stop();
50 clear();
51 delete(movie);
54 /**
55 * start - start animation playback.
57 void SensorAnimLabel::start() {
58 setMovie(movie);
59 movie->setPaused(false);
62 /**
63 * stop - stops animation playback
65 void SensorAnimLabel::stop() {
66 movie->setPaused(true);
67 clear();