PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/src/sip/jabber/avatarmanager.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 62 lines | 32 code | 13 blank | 17 comment | 0 complexity | 634ca8ba71be8897098853656056e78b MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
 4 *
 5 *   Tomahawk 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 *   Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef AVATARMANAGER_H
20#define AVATARMANAGER_H
21
22#include <jreen/client.h>
23
24#include <QObject>
25#include <QDir>
26
27#include "../sipdllmacro.h"
28
29class SIPDLLEXPORT AvatarManager : public QObject
30{
31Q_OBJECT
32
33public:
34    AvatarManager(Jreen::Client *client);
35    virtual ~AvatarManager();
36
37    QPixmap avatar(const QString &jid) const;
38
39signals:
40    void newAvatar( const QString &jid );
41
42private slots:
43    void onNewPresence( const Jreen::Presence& presence );
44    void onNewIq(const Jreen::IQ &iq);
45    void onNewConnection();
46    void onNewAvatar( const QString &jid );
47
48private:
49    void fetchVCard( const QString &jid);
50    QString avatarHash(const QString &jid) const;
51    QString avatarPath(const QString &avatarHash) const;
52
53    QDir avatarDir(const QString &avatarHash) const;
54    bool isCached(const QString &avatarHash) const;
55
56    Jreen::Client *m_client;
57    QStringList m_cachedAvatars;
58    QDir m_cacheDir;
59    QMap<QString, QString> m_JidsAvatarHashes;
60};
61
62#endif // AVATARMANAGER_H