File indexing completed on 2024-12-01 04:36:53

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolawidgets_private_export.h"
0010 #include <QPushButton>
0011 #include <QWidget>
0012 class RocketChatAccount;
0013 class LIBRUQOLAWIDGETS_TESTS_EXPORT AvatarImage : public QPushButton
0014 {
0015     Q_OBJECT
0016 public:
0017     explicit AvatarImage(RocketChatAccount *account, QWidget *parent = nullptr);
0018     ~AvatarImage() override;
0019 
0020     void setCurrentIconPath(const QString &currentPath);
0021 
0022 protected:
0023     void contextMenuEvent(QContextMenuEvent *event) override;
0024 
0025 private:
0026     LIBRUQOLAWIDGETS_NO_EXPORT void changeUrl();
0027     LIBRUQOLAWIDGETS_NO_EXPORT void changeImage();
0028     LIBRUQOLAWIDGETS_NO_EXPORT void resetAvatar();
0029     LIBRUQOLAWIDGETS_NO_EXPORT void slotFileDownloaded(const QString &filePath, const QUrl &cacheImageUrl);
0030     QString mCurrentIconPath;
0031     RocketChatAccount *const mRocketChatAccount;
0032 };
0033 
0034 class LIBRUQOLAWIDGETS_TESTS_EXPORT MyAccountProfileConfigureAvatarWidget : public QWidget
0035 {
0036     Q_OBJECT
0037 public:
0038     explicit MyAccountProfileConfigureAvatarWidget(RocketChatAccount *account, QWidget *parent = nullptr);
0039     ~MyAccountProfileConfigureAvatarWidget() override;
0040     void setCurrentIconPath(const QString &currentPath);
0041 
0042 private:
0043     AvatarImage *const mAvatarImage;
0044 };