LeechCraft Azoth  0.6.70-14771-g9d21b0f8ad
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 {
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")
Describes an entry that can have an associated avatar.
Definition: ihaveavatars.h:22
virtual bool HasAvatar() const =0
Returns whether this exact entry has any avatar.
virtual QFuture< QImage > RefreshAvatar(Size size)=0
Requests the avatar of the given size.
Size
The size of the avatar.
Definition: ihaveavatars.h:29
@ Thumbnail
Thumbnail avatar, possibly cropped.
virtual bool SupportsSize(Size size) const =0
Whether this entry has an avatar of the given size.
virtual void avatarChanged(QObject *thisObject)=0
Notifies that the avatar of the entry has been changed.
uint qHash(IHaveAvatars::Size size)
Defines a hashing function for avatar sizes.
Definition: ihaveavatars.h:91