#ifndef FRMIMGSHOW_H
#define FRMIMGSHOW_H

#include <QWidget>
#include <QPushButton>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QToolButton>
#include <QSpacerItem>
#include <QUrl>
#include <QCheckBox>
#include <QGuiApplication>
#include "tchttpservice.h"

class FrmImgShow : public QWidget
{
    Q_OBJECT
public:
    explicit FrmImgShow(QWidget *parent = nullptr);

    void loadImage(const QUrl& imageUrl);
    void setImage(const QPixmap& pixmap);
    void setLoadingState(bool loading);

    QSize sizeHint();
private:
    QLabel* labImg;
    // QLabel* labLoading;
    // QMovie* movieLoading;

    QPushButton* btnCopy;
    QPushButton* btnDelete;
    QSpacerItem* horizenSpacer;
    QHBoxLayout* hLayout;
    QCheckBox* ckbSelect;
    QVBoxLayout* vLayout;

protected:
    // virtual bool eventFilter(QObject* watched, QEvent* event);

private slots:
    void onFinished(QNetworkReply *reply);

private:
    void initForm();
    void initWidget();

    QString m_requestId;
    QUrl m_currentUrl;
};

#endif // FRMIMGSHOW_H
