2017-12-19 16:57:42 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-12-19 16:57:42 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-12-19 16:57:42 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2020-01-03 21:01:09 +00:00
|
|
|
#include "core/file_utilities.h"
|
2020-01-21 20:31:34 +00:00
|
|
|
#include "lang/lang_keys.h"
|
2020-01-03 21:01:09 +00:00
|
|
|
|
2020-10-13 12:07:53 +00:00
|
|
|
namespace Ui {
|
|
|
|
struct PreparedFileInformation;
|
|
|
|
struct PreparedFile;
|
|
|
|
struct PreparedList;
|
2020-10-20 08:19:48 +00:00
|
|
|
enum class AlbumType;
|
2020-10-13 12:07:53 +00:00
|
|
|
} // namespace Ui
|
2017-12-19 16:57:42 +00:00
|
|
|
|
|
|
|
namespace Storage {
|
|
|
|
|
|
|
|
enum class MimeDataState {
|
|
|
|
None,
|
|
|
|
Files,
|
|
|
|
PhotoFiles,
|
2022-05-10 14:22:28 +00:00
|
|
|
PremiumFile,
|
2017-12-19 16:57:42 +00:00
|
|
|
Image,
|
|
|
|
};
|
|
|
|
|
2021-05-06 21:47:49 +00:00
|
|
|
[[nodiscard]] std::optional<Ui::PreparedList> PreparedFileFromFilesDialog(
|
2020-10-13 12:07:53 +00:00
|
|
|
FileDialog::OpenResult &&result,
|
2020-10-16 14:11:23 +00:00
|
|
|
Fn<bool(const Ui::PreparedList&)> checkResult,
|
2020-10-13 12:07:53 +00:00
|
|
|
Fn<void(tr::phrase<>)> errorCallback,
|
2022-05-10 14:22:28 +00:00
|
|
|
int previewWidth,
|
|
|
|
bool premium);
|
2021-05-06 21:47:49 +00:00
|
|
|
[[nodiscard]] MimeDataState ComputeMimeDataState(const QMimeData *data);
|
|
|
|
[[nodiscard]] bool ValidatePhotoEditorMediaDragData(
|
|
|
|
not_null<const QMimeData*> data);
|
|
|
|
[[nodiscard]] bool ValidateEditMediaDragData(
|
2020-10-20 08:19:48 +00:00
|
|
|
not_null<const QMimeData*> data,
|
|
|
|
Ui::AlbumType albumType);
|
2021-05-06 21:47:49 +00:00
|
|
|
[[nodiscard]] Ui::PreparedList PrepareMediaList(
|
|
|
|
const QList<QUrl> &files,
|
2022-05-10 14:22:28 +00:00
|
|
|
int previewWidth,
|
|
|
|
bool premium);
|
2021-05-06 21:47:49 +00:00
|
|
|
[[nodiscard]] Ui::PreparedList PrepareMediaList(
|
|
|
|
const QStringList &files,
|
2022-05-10 14:22:28 +00:00
|
|
|
int previewWidth,
|
|
|
|
bool premium);
|
2021-05-06 21:47:49 +00:00
|
|
|
[[nodiscard]] Ui::PreparedList PrepareMediaFromImage(
|
2017-12-21 16:15:37 +00:00
|
|
|
QImage &&image,
|
|
|
|
QByteArray &&content,
|
|
|
|
int previewWidth);
|
2020-10-16 14:11:23 +00:00
|
|
|
void PrepareDetails(Ui::PreparedFile &file, int previewWidth);
|
2021-02-08 03:13:40 +00:00
|
|
|
void UpdateImageDetails(Ui::PreparedFile &file, int previewWidth);
|
|
|
|
|
2021-09-05 09:37:30 +00:00
|
|
|
bool ApplyModifications(Ui::PreparedList &list);
|
2017-12-19 16:57:42 +00:00
|
|
|
|
|
|
|
} // namespace Storage
|