File indexing completed on 2023-11-26 04:55:35
0001 /* 0002 * Button representing user's Avatar 0003 * 0004 * Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com> 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Lesser General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2.1 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Lesser General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Lesser General Public 0017 * License along with this library; if not, write to the Free Software 0018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0019 */ 0020 0021 #ifndef AVATAR_BUTTON_H 0022 #define AVATAR_BUTTON_H 0023 0024 #include <QtGui/QToolButton> 0025 0026 #include <TelepathyQt/Types> 0027 0028 class AccountsModel; 0029 class KJob; 0030 class KMenu; 0031 0032 class AvatarButton : public QToolButton 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 AvatarButton(QWidget* parent = 0); 0038 ~AvatarButton(); 0039 0040 void setAccount(const Tp::AccountPtr &account); 0041 0042 void setAvatar(const Tp::Avatar &avatar); 0043 Tp::Avatar avatar() const; 0044 0045 Q_SIGNALS: 0046 void avatarChanged(); 0047 0048 private Q_SLOTS: 0049 void onLoadAvatarFromFile(); 0050 void onClearAvatar(); 0051 0052 private: 0053 QPixmap cropPixmap(const QPixmap &pixmap, int maxWidth, int maxHeight, 0054 int minWidth, int minHeight) const; 0055 0056 Tp::Avatar m_avatar; 0057 Tp::AccountPtr m_account; 0058 0059 }; 0060 0061 #endif //AVATAR_BUTTON_H