mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Moved ActivateWindow from HistoryWidget to single place.
This commit is contained in:
parent
42a2286230
commit
6ac9ef34eb
4 changed files with 14 additions and 16 deletions
|
@ -89,7 +89,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "ui/delayed_activation.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_session_settings.h"
|
||||
#include "window/themes/window_theme.h"
|
||||
|
@ -138,12 +137,6 @@ constexpr auto kCommonModifiers = 0
|
|||
| Qt::ControlModifier;
|
||||
const auto kPsaAboutPrefix = "cloud_lng_about_psa_";
|
||||
|
||||
void ActivateWindow(not_null<Window::SessionController*> controller) {
|
||||
const auto window = controller->widget();
|
||||
window->activateWindow();
|
||||
Ui::ActivateWindowDelayed(window);
|
||||
}
|
||||
|
||||
object_ptr<Ui::FlatButton> SetupDiscussButton(
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Window::SessionController*> controller) {
|
||||
|
@ -461,11 +454,11 @@ HistoryWidget::HistoryWidget(
|
|||
crl::guard(this, [=] { updateControlsGeometry(); }));
|
||||
_attachDragAreas.document->setDroppedCallback([=](const QMimeData *data) {
|
||||
confirmSendingFiles(data, CompressConfirm::No);
|
||||
ActivateWindow(controller);
|
||||
Window::ActivateWindow(controller);
|
||||
});
|
||||
_attachDragAreas.photo->setDroppedCallback([=](const QMimeData *data) {
|
||||
confirmSendingFiles(data, CompressConfirm::Yes);
|
||||
ActivateWindow(controller);
|
||||
Window::ActivateWindow(controller);
|
||||
});
|
||||
|
||||
subscribe(Adaptive::Changed(), [=] {
|
||||
|
@ -1452,7 +1445,7 @@ void HistoryWidget::onRecordDone(
|
|||
qint32 samples) {
|
||||
if (!canWriteMessage() || result.isEmpty()) return;
|
||||
|
||||
ActivateWindow(controller());
|
||||
Window::ActivateWindow(controller());
|
||||
const auto duration = samples / Media::Player::kDefaultFrequency;
|
||||
auto action = Api::SendAction(_history);
|
||||
action.replyTo = replyToId();
|
||||
|
@ -4295,7 +4288,7 @@ bool HistoryWidget::confirmSendingFiles(
|
|||
}
|
||||
}));
|
||||
|
||||
ActivateWindow(controller());
|
||||
Window::ActivateWindow(controller());
|
||||
const auto shown = Ui::show(std::move(box));
|
||||
shown->setCloseByOutsideClick(false);
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_drag_area.h"
|
||||
#include "history/history_item.h"
|
||||
#include "chat_helpers/message_field.h" // SendMenuType.
|
||||
#include "ui/delayed_activation.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
|
@ -36,7 +35,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/call_delayed.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "main/main_session.h"
|
||||
#include "mainwindow.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_scheduled_messages.h"
|
||||
|
@ -1190,9 +1188,7 @@ void ScheduledWidget::setupDragArea() {
|
|||
const auto droppedCallback = [=](CompressConfirm compressed) {
|
||||
return [=](const QMimeData *data) {
|
||||
confirmSendingFiles(data, compressed);
|
||||
const auto window = controller()->widget();
|
||||
window->activateWindow();
|
||||
Ui::ActivateWindowDelayed(window);
|
||||
Window::ActivateWindow(controller());
|
||||
};
|
||||
};
|
||||
areas.document->setDroppedCallback(droppedCallback(CompressConfirm::No));
|
||||
|
|
|
@ -45,6 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "facades.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "ui/delayed_activation.h"
|
||||
|
||||
namespace Window {
|
||||
namespace {
|
||||
|
@ -53,6 +54,12 @@ constexpr auto kMaxChatEntryHistorySize = 50;
|
|||
|
||||
} // namespace
|
||||
|
||||
void ActivateWindow(not_null<SessionController*> controller) {
|
||||
const auto window = controller->widget();
|
||||
window->activateWindow();
|
||||
Ui::ActivateWindowDelayed(window);
|
||||
}
|
||||
|
||||
DateClickHandler::DateClickHandler(Dialogs::Key chat, QDate date)
|
||||
: _chat(chat)
|
||||
, _date(date) {
|
||||
|
|
|
@ -355,4 +355,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
void ActivateWindow(not_null<SessionController*> controller);
|
||||
|
||||
} // namespace Window
|
||||
|
|
Loading…
Add table
Reference in a new issue