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

Delete messages box labels fix and confirm by Enter key.

Also context menu fixed in case of non-transparent windows.
Also pausing GIFs when the window is not active.
This commit is contained in:
John Preston
2017-01-02 21:11:49 +04:00
parent 72e34dc5b1
commit d0a7e6be73
14 changed files with 66 additions and 38 deletions

View File

@@ -159,30 +159,25 @@ void FlatLabel::init() {
connect(&_touchSelectTimer, SIGNAL(timeout()), this, SLOT(onTouchSelect()));
}
template <typename SetCallback>
void FlatLabel::setTextByCallback(SetCallback callback) {
callback();
void FlatLabel::textUpdated() {
refreshSize();
setMouseTracking(_selectable || _text.hasLinks());
update();
}
void FlatLabel::setText(const QString &text) {
setTextByCallback([this, &text]() {
_text.setText(_st.style, text, _labelOptions);
});
_text.setText(_st.style, text, _labelOptions);
textUpdated();
}
void FlatLabel::setRichText(const QString &text) {
setTextByCallback([this, &text]() {
_text.setRichText(_st.style, text, _labelOptions);
});
_text.setRichText(_st.style, text, _labelOptions);
textUpdated();
}
void FlatLabel::setMarkedText(const TextWithEntities &textWithEntities) {
setTextByCallback([this, &textWithEntities]() {
_text.setMarkedText(_st.style, textWithEntities, _labelMarkedOptions);
});
_text.setMarkedText(_st.style, textWithEntities, _labelMarkedOptions);
textUpdated();
}
void FlatLabel::setSelectable(bool selectable) {

View File

@@ -143,9 +143,7 @@ private slots:
private:
void init();
template <typename SetCallback>
void setTextByCallback(SetCallback callback);
void textUpdated();
Text::StateResult dragActionUpdate();
Text::StateResult dragActionStart(const QPoint &p, Qt::MouseButton button);

View File

@@ -151,8 +151,8 @@ void PopupMenu::handleActivated(QAction *action, int actionTop, TriggeredSource
void PopupMenu::handleTriggered(QAction *action, int actionTop, TriggeredSource source) {
if (!popupSubmenuFromAction(action, actionTop, source)) {
hideMenu();
_triggering = true;
hideMenu();
emit action->trigger();
_triggering = false;
if (_deleteLater) {