2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Slightly refactored include directives in some source files.

This commit is contained in:
23rd
2023-08-28 21:24:09 +03:00
parent aeb593dd77
commit 4b503ad7ed
9 changed files with 9 additions and 44 deletions

View File

@@ -28,8 +28,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/call_delayed.h"
#include "boxes/premium_limits_box.h"
#include "boxes/premium_preview_box.h"
#include "ui/boxes/confirm_box.h"
#include "ui/effects/animations.h"
#include "ui/effects/scroll_content_shadow.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/buttons.h"
@@ -42,9 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/chat/attach/attach_album_preview.h"
#include "ui/chat/attach/attach_single_file_preview.h"
#include "ui/chat/attach/attach_single_media_preview.h"
#include "ui/text/format_values.h"
#include "ui/grouped_layout.h"
#include "ui/text/text_options.h"
#include "ui/toast/toast.h"
#include "ui/controls/emoji_button.h"
#include "ui/painter.h"
@@ -54,16 +50,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_premium_limits.h"
#include "data/stickers/data_stickers.h"
#include "data/stickers/data_custom_emoji.h"
#include "media/clip/media_clip_reader.h"
#include "api/api_common.h"
#include "window/window_session_controller.h"
#include "core/application.h"
#include "core/core_settings.h"
#include "styles/style_chat.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_info.h"
#include "styles/style_menu_icons.h"
#include <QtCore/QMimeData>
@@ -74,10 +67,14 @@ constexpr auto kMaxMessageLength = 4096;
using Ui::SendFilesWay;
inline bool CanAddUrls(const QList<QUrl> &urls) {
[[nodiscard]] inline bool CanAddUrls(const QList<QUrl> &urls) {
return !urls.isEmpty() && ranges::all_of(urls, &QUrl::isLocalFile);
}
[[nodiscard]] bool CanAddFiles(not_null<const QMimeData*> data) {
return data->hasImage() || CanAddUrls(Core::ReadMimeUrls(data));
}
void FileDialogCallback(
FileDialog::OpenResult &&result,
Fn<bool(const Ui::PreparedList&)> checkResult,
@@ -451,7 +448,7 @@ void SendFilesBox::setupDragArea() {
};
const auto areas = DragArea::SetupDragAreaToContainer(
this,
[=](not_null<const QMimeData*> d) { return canAddFiles(d); },
CanAddFiles,
[=](bool f) { _caption->setAcceptDrops(f); },
[=] { updateControlsGeometry(); },
std::move(computeState));
@@ -1046,7 +1043,7 @@ void SendFilesBox::setupCaption() {
not_null<const QMimeData*> data,
Ui::InputField::MimeAction action) {
if (action == Ui::InputField::MimeAction::Check) {
return canAddFiles(data);
return CanAddFiles(data);
} else if (action == Ui::InputField::MimeAction::Insert) {
return addFiles(data);
}
@@ -1142,10 +1139,6 @@ void SendFilesBox::captionResized() {
update();
}
bool SendFilesBox::canAddFiles(not_null<const QMimeData*> data) const {
return data->hasImage() || CanAddUrls(Core::ReadMimeUrls(data));
}
bool SendFilesBox::addFiles(not_null<const QMimeData*> data) {
const auto premium = _show->session().premium();
auto list = [&] {