matrixion/src/dialogs/PreviewUploadOverlay.h

53 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-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
{
Q_OBJECT
public:
PreviewUploadOverlay(QWidget *parent = nullptr);
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:
void confirmUpload(const QByteArray data, const QString &media, const QString &filename);
2020-11-15 06:52:49 +03:00
void aborted();
private:
void init();
2018-02-19 23:09:21 +03:00
void setLabels(const QString &type, const QString &mime, uint64_t upload_size);
bool isImage_;
QPixmap image_;
QByteArray data_;
QString filePath_;
QString mediaType_;
QLabel titleLabel_;
QLabel infoLabel_;
QLineEdit fileName_;
2018-09-25 14:41:47 +03:00
QPushButton upload_;
QPushButton cancel_;
};
} // dialogs