photoboothwidget.h 2.38 KB
Newer Older
1
/***************************************************************************
Andreas Traczyk's avatar
Andreas Traczyk committed
2
 * Copyright (C) 2015-2019 by Savoir-faire Linux                           *
3
 * Author: Olivier Soldano <olivier.soldano@savoirfairelinux.com>          *
Andreas Traczyk's avatar
Andreas Traczyk committed
4
 * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>          *
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *                                                                         *
 * This program is free software; you can redistribute it and/or modify    *
 * it under the terms of the GNU General Public License as published by    *
 * the Free Software Foundation; either version 3 of the License, or       *
 * (at your option) any later version.                                     *
 *                                                                         *
 * This program is distributed in the hope that it will be useful,         *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
 * GNU General Public License for more details.                            *
 *                                                                         *
 * You should have received a copy of the GNU General Public License       *
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 **************************************************************************/

Andreas Traczyk's avatar
Andreas Traczyk committed
20
#pragma once
21

22
#include "utils.h"
23
#include "previewwidget.h"
24

25
#include <QWidget>
Andreas Traczyk's avatar
Andreas Traczyk committed
26 27
#include <QLabel>
#include <QPropertyAnimation>
28 29 30 31 32 33 34 35 36 37 38 39

namespace Ui {
class PhotoboothWidget;
}

class PhotoboothWidget : public QWidget
{
    Q_OBJECT

public:
    explicit PhotoboothWidget(QWidget *parent = 0);
    ~PhotoboothWidget();
Andreas Traczyk's avatar
Andreas Traczyk committed
40

41
    void startBooth(bool force = false);
42
    void stopBooth();
43
    void setAvatarPixmap(const QPixmap& avatarPixmap, bool default = false);
44 45
    const QPixmap& getAvatarPixmap();
    bool hasAvatar();
46 47
    bool isPhotoBoothOpened() { return takePhotoState_; }
    void resetTakePhotoState(bool state) { takePhotoState_ = state; }
48 49 50 51 52 53

private slots:
    void on_importButton_clicked();
    void on_takePhotoButton_clicked();

private:
54 55
    void resetToAvatarLabel();

56 57 58
    QString fileName_;
    Ui::PhotoboothWidget *ui;

Andreas Traczyk's avatar
Andreas Traczyk committed
59 60
    QLabel* flashOverlay_;
    QPropertyAnimation *flashAnimation_;
61 62
    QPixmap avatarPixmap_;
    bool hasAvatar_;
Andreas Traczyk's avatar
Andreas Traczyk committed
63

64
    bool takePhotoState_ { false };
Andreas Traczyk's avatar
Andreas Traczyk committed
65

66
signals:
67 68
    void imageAcquired();
    void imageCleared();
69
};