blob: 30970439f300e8bf61c180a231738912f8f0c71b [file] [log] [blame]
Edric Milareta0ebd062016-01-13 12:18:23 -05001/***************************************************************************
Sébastien Blin68abac92019-01-02 17:41:31 -05002 * Copyright (C) 2017-2019 by Savoir-faire Linux *
Edric Milareta0ebd062016-01-13 12:18:23 -05003 * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
4 * *
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. *
9 * *
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. *
14 * *
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/>. *
17 **************************************************************************/
18
19#pragma once
20
21#include <QImage>
22
23#include <memory>
24#include <interfaces/pixmapmanipulatori.h>
25
26Q_DECLARE_METATYPE(QImage);
27
28class Person;
29
Edric Milaret25236d92016-03-28 09:40:58 -040030QByteArray QImageToByteArray(QImage image);
31
Olivier SOLDANO41e61ab2017-08-04 16:47:16 -040032class PixbufManipulator : public Interfaces::PixmapManipulatorI {
Edric Milareta0ebd062016-01-13 12:18:23 -050033public:
Edric Milareta0ebd062016-01-13 12:18:23 -050034 QVariant callPhoto(Call* c, const QSize& size, bool displayPresence = true) override;
35 QVariant callPhoto(const ContactMethod* n, const QSize& size, bool displayPresence = true) override;
36 QVariant contactPhoto(Person* c, const QSize& size, bool displayPresence = true) override;
37 QVariant personPhoto(const QByteArray& data, const QString& type = "PNG") override;
38
39 /* TODO: the following methods return an empty QVariant/QByteArray */
40 QVariant numberCategoryIcon(const QVariant& p, const QSize& size, bool displayPresence = false, bool isPresent = false) override;
41 QVariant securityIssueIcon(const QModelIndex& index) override;
42 QByteArray toByteArray(const QVariant& pxm) override;
Olivier SOLDANO41e61ab2017-08-04 16:47:16 -040043 QVariant collectionIcon(const CollectionInterface* colItf,
44 Interfaces::PixmapManipulatorI::CollectionIconHint hint =
45 Interfaces::PixmapManipulatorI::CollectionIconHint::NONE) const override;
Edric Milareta0ebd062016-01-13 12:18:23 -050046 QVariant securityLevelIcon(const SecurityEvaluationModel::SecurityLevel level) const override;
47 QVariant historySortingCategoryIcon(const CategorizedHistoryModel::SortedProxy::Categories cat) const override;
48 QVariant contactSortingCategoryIcon(const CategorizedContactModel::SortedProxy::Categories cat) const override;
49 QVariant userActionIcon(const UserActionElement& state) const override;
50 QVariant decorationRole(const QModelIndex& index) override;
51 QVariant decorationRole(const Call* c) override;
52 QVariant decorationRole(const ContactMethod* cm) override;
53 QVariant decorationRole(const Person* p) override;
Edric Milareta7cf8652016-04-19 15:37:51 -040054 QVariant decorationRole(const Account* acc) override;
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040055 QVariant decorationRole(const lrc::api::conversation::Info& conversation,
56 const lrc::api::account::Info& accountInfo) override;
Olivier SOLDANO41e61ab2017-08-04 16:47:16 -040057 static QImage scaleAndFrame(const QImage photo, const QSize& size);
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040058 static QVariant accountPhoto(const lrc::api::account::Info& accountInfo);
Edric Milareta0ebd062016-01-13 12:18:23 -050059};
60