matrixion/src/dialogs/PreviewUploadOverlay.h

54 lines
1.2 KiB
C
Raw Normal View History

2021-03-05 02:35:15 +03:00
// SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr>
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
2021-03-05 02:35:15 +03:00
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QImage>
#include <QLabel>
#include <QLineEdit>
#include <QPixmap>
2018-09-25 14:41:47 +03:00
#include <QPushButton>
#include <QWidget>
class QMimeData;
namespace dialogs {
class PreviewUploadOverlay : public QWidget
{
2021-09-18 01:22:33 +03:00
Q_OBJECT
public:
2021-09-18 01:22:33 +03:00
PreviewUploadOverlay(QWidget *parent = nullptr);
2021-09-18 01:22:33 +03:00
void setPreview(const QImage &src, const QString &mime);
void setPreview(const QByteArray data, const QString &mime);
void setPreview(const QString &path);
void keyPressEvent(QKeyEvent *event);
signals:
2021-09-18 01:22:33 +03:00
void confirmUpload(const QByteArray data, const QString &media, const QString &filename);
void aborted();
private:
2021-09-18 01:22:33 +03:00
void init();
void setLabels(const QString &type, const QString &mime, uint64_t upload_size);
2021-09-18 01:22:33 +03:00
bool isImage_;
QPixmap image_;
2021-09-18 01:22:33 +03:00
QByteArray data_;
QString filePath_;
QString mediaType_;
2021-09-18 01:22:33 +03:00
QLabel titleLabel_;
QLabel infoLabel_;
QLineEdit fileName_;
2021-09-18 01:22:33 +03:00
QPushButton upload_;
QPushButton cancel_;
};
} // dialogs