LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
ihaveavatars.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <QImage>
12 #include <QFuture>
13 #include <QtPlugin>
14 
15 namespace LC
16 {
17 namespace Azoth
18 {
21  class IHaveAvatars
22  {
23  protected:
24  virtual ~IHaveAvatars () {}
25  public:
28  enum class Size
29  {
32  Full,
33 
36  Thumbnail
37  };
38 
56  virtual QFuture<QImage> RefreshAvatar (Size size) = 0;
57 
62  virtual bool HasAvatar () const = 0;
63 
69  virtual bool SupportsSize (Size size) const = 0;
70  protected:
83  virtual void avatarChanged (QObject *thisObject) = 0;
84  };
85 
91  inline uint qHash (IHaveAvatars::Size size)
92  {
93  return static_cast<uint> (size);
94  }
95 }
96 }
97 
98 Q_DECLARE_INTERFACE (LC::Azoth::IHaveAvatars,
99  "org.LeechCraft.Azoth.IHaveAvatars/1.0")
LC::Azoth::IHaveAvatars::SupportsSize
virtual bool SupportsSize(Size size) const =0
Whether this entry has an avatar of the given size.
LC::Azoth::IHaveAvatars
Describes an entry that can have an associated avatar.
Definition: ihaveavatars.h:33
LC::Azoth::IHaveAvatars::Size
Size
The size of the avatar.
Definition: ihaveavatars.h:46
LC::Azoth::IHaveAvatars::HasAvatar
virtual bool HasAvatar() const =0
Returns whether this exact entry has any avatar.
LC::Azoth::qHash
uint qHash(IHaveAvatars::Size size)
Defines a hashing function for avatar sizes.
Definition: ihaveavatars.h:103
LC
Definition: activityinfo.h:13
LC::Azoth::IHaveAvatars::RefreshAvatar
virtual QFuture< QImage > RefreshAvatar(Size size)=0
Requests the avatar of the given size.
QFuture
Definition: ihaveserverhistory.h:21
LC::Azoth::IHaveAvatars::~IHaveAvatars
virtual ~IHaveAvatars()
Definition: ihaveavatars.h:42
LC::Azoth::IHaveAvatars::Size::Full
@ Full
Full-size avatar.
LC::Azoth::IHaveAvatars::Size::Thumbnail
@ Thumbnail
Thumbnail avatar, possibly cropped.
LC::Azoth::IHaveAvatars::avatarChanged
virtual void avatarChanged(QObject *thisObject)=0
Notifies that the avatar of the entry has been changed.