summaryrefslogtreecommitdiffstats
blob: 3f8b72bc470735fb8dff9cdfa49b858631b2a7e4 (plain)
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
/*
 * Copyright (c) 2018 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#pragma once

#include <QStyledItemDelegate>

#include <Swiften/Elements/StatusShow.h>

#include <Swift/QtUI/Roster/DelegateCommons.h>

namespace Swift {

    class ServerListDelegate : public QStyledItemDelegate {
    public:
        ServerListDelegate();
        ~ServerListDelegate() override;
        QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
        void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
    private:
        void paintServerAvatar(QPainter* painter, const QStyleOptionViewItem& option, const QString& avatarPath, const StatusShow& presence, bool isIdle, size_t unreadCount) const;
    private:
        DelegateCommons common_;
        static const int presenceIconHeight = 12;
        static const int presenceIconWidth = 12;
    };

}