mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Replaced checking global key modifiers with qt adapters.
This commit is contained in:
parent
0143d22a21
commit
8bea6776f5
8 changed files with 16 additions and 20 deletions
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "api/api_toggling_media.h" // Api::ToggleSavedGif
|
||||
#include "base/const_string.h"
|
||||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
|
@ -437,8 +438,7 @@ void GifsListWidget::selectInlineResult(
|
|||
return;
|
||||
}
|
||||
|
||||
forceSend |= (QGuiApplication::keyboardModifiers()
|
||||
== Qt::ControlModifier);
|
||||
forceSend |= base::IsCtrlPressed();
|
||||
if (const auto photo = item->getPhoto()) {
|
||||
using Data::PhotoSize;
|
||||
const auto media = photo->activeMediaView();
|
||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/text/text_entity.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "base/qthelp_regex.h"
|
||||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "storage/storage_account.h"
|
||||
#include "history/history.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
|
@ -26,8 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_session_controller.h"
|
||||
#include "facades.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
namespace {
|
||||
|
||||
void SearchByHashtag(ClickContext context, const QString &tag) {
|
||||
|
@ -101,8 +100,7 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
|
|||
open();
|
||||
} else {
|
||||
const auto parsedUrl = QUrl::fromUserInput(url);
|
||||
if (UrlRequiresConfirmation(parsedUrl)
|
||||
&& QGuiApplication::keyboardModifiers() != Qt::ControlModifier) {
|
||||
if (UrlRequiresConfirmation(parsedUrl) && !base::IsCtrlPressed()) {
|
||||
Core::App().hideMediaView();
|
||||
const auto displayed = parsedUrl.isValid()
|
||||
? parsedUrl.toDisplayString()
|
||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "history/history_item_components.h"
|
||||
|
||||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/image/image.h"
|
||||
|
@ -53,7 +54,7 @@ void HistoryMessageVia::create(
|
|||
tr::lng_inline_bot_via(tr::now, lt_inline_bot, '@' + bot->username));
|
||||
link = std::make_shared<LambdaClickHandler>([bot = this->bot](
|
||||
ClickContext context) {
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier) {
|
||||
if (base::IsCtrlPressed()) {
|
||||
if (const auto window = App::wnd()) {
|
||||
if (const auto controller = window->sessionController()) {
|
||||
controller->showPeerInfo(bot);
|
||||
|
|
|
@ -47,6 +47,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "inline_bots/inline_bot_result.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "base/qt_signal_producer.h"
|
||||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "data/data_changes.h"
|
||||
|
@ -150,7 +151,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_chat_helpers.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
#include <QGuiApplication> // keyboardModifiers()
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
|
@ -3317,7 +3317,7 @@ void HistoryWidget::windowIsVisibleChanged() {
|
|||
}
|
||||
|
||||
void HistoryWidget::historyDownClicked() {
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier) {
|
||||
if (base::IsCtrlPressed()) {
|
||||
showHistory(_peer->id, ShowAtUnreadMsgId);
|
||||
} else if (_replyReturn && _replyReturn->history() == _history) {
|
||||
showHistory(_peer->id, _replyReturn->id);
|
||||
|
|
|
@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_peer_menu.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "main/main_session.h"
|
||||
#include "data/data_session.h"
|
||||
|
@ -51,7 +52,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_boxes.h"
|
||||
|
||||
#include <QtCore/QMimeData>
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
namespace HistoryView {
|
||||
namespace {
|
||||
|
@ -204,7 +204,7 @@ void PinnedWidget::setupClearButton() {
|
|||
}
|
||||
|
||||
void PinnedWidget::scrollDownClicked() {
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier) {
|
||||
if (base::IsCtrlPressed()) {
|
||||
showAtEnd();
|
||||
//} else if (_replyReturn) {
|
||||
// showAtPosition(_replyReturn->position());
|
||||
|
|
|
@ -46,6 +46,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_peer_menu.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "main/main_session.h"
|
||||
#include "data/data_session.h"
|
||||
|
@ -67,7 +68,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_boxes.h"
|
||||
|
||||
#include <QtCore/QMimeData>
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
||||
namespace HistoryView {
|
||||
namespace {
|
||||
|
@ -1265,7 +1265,7 @@ void RepliesWidget::reloadUnreadCountIfNeeded() {
|
|||
}
|
||||
|
||||
void RepliesWidget::scrollDownClicked() {
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier) {
|
||||
if (base::IsCtrlPressed()) {
|
||||
showAtEnd();
|
||||
} else if (_replyReturn) {
|
||||
showAtPosition(_replyReturn->position());
|
||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_scheduled_messages.h" // kScheduledUntilOnlineTimestamp
|
||||
#include "lang/lang_keys.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
|
@ -26,8 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_chat.h"
|
||||
#include "styles/style_menu_icons.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
|
||||
namespace HistoryView {
|
||||
namespace {
|
||||
|
||||
|
@ -70,11 +69,9 @@ void ScheduleBox(
|
|||
if (!scheduleDate) {
|
||||
return;
|
||||
}
|
||||
// Pro tip: Hold Ctrl key to send a silent scheduled message!
|
||||
auto ctrl =
|
||||
(QGuiApplication::keyboardModifiers() == Qt::ControlModifier);
|
||||
auto result = Api::SendOptions();
|
||||
result.silent = silent || ctrl;
|
||||
// Pro tip: Hold Ctrl key to send a silent scheduled message!
|
||||
result.silent = silent || base::IsCtrlPressed();
|
||||
result.scheduled = scheduleDate;
|
||||
const auto copy = done;
|
||||
box->closeBox();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5abb2ff9b563ef4b12672a96000de7b642060eb3
|
||||
Subproject commit 136d2eb5bc0e26774bcf2611e0a4ac46dfb73388
|
Loading…
Add table
Reference in a new issue