mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
fix: crash in channels
fix: remove useless button
This commit is contained in:
parent
0c50d6d7e7
commit
235e0ae713
4 changed files with 13 additions and 111 deletions
|
@ -1424,7 +1424,6 @@ void InnerWidget::mouseActionCancel()
|
|||
_mouseAction = MouseAction::None;
|
||||
_dragStartPosition = QPoint(0, 0);
|
||||
_wasSelectedText = false;
|
||||
//_widget->noSelectingScroll(); // TODO
|
||||
}
|
||||
|
||||
void InnerWidget::mouseActionFinish(const QPoint &screenPos, Qt::MouseButton button)
|
||||
|
@ -1640,99 +1639,6 @@ void InnerWidget::updateSelected()
|
|||
void InnerWidget::performDrag()
|
||||
{
|
||||
if (_mouseAction != MouseAction::Dragging) return;
|
||||
|
||||
//auto uponSelected = false;
|
||||
//if (_mouseActionItem) {
|
||||
// if (!_selected.isEmpty() && _selected.cbegin().value() == FullSelection) {
|
||||
// uponSelected = _selected.contains(_mouseActionItem);
|
||||
// } else {
|
||||
// StateRequest request;
|
||||
// request.flags |= Ui::Text::StateRequest::Flag::LookupSymbol;
|
||||
// auto dragState = _mouseActionItem->textState(_dragStartPosition.x(), _dragStartPosition.y(), request);
|
||||
// uponSelected = (dragState.cursor == CursorState::Text);
|
||||
// if (uponSelected) {
|
||||
// if (_selected.isEmpty() ||
|
||||
// _selected.cbegin().value() == FullSelection ||
|
||||
// _selected.cbegin().key() != _mouseActionItem
|
||||
// ) {
|
||||
// uponSelected = false;
|
||||
// } else {
|
||||
// uint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
// if (dragState.symbol < selFrom || dragState.symbol >= selTo) {
|
||||
// uponSelected = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//auto pressedHandler = ClickHandler::getPressed();
|
||||
|
||||
//if (dynamic_cast<VoiceSeekClickHandler*>(pressedHandler.data())) {
|
||||
// return;
|
||||
//}
|
||||
|
||||
//TextWithEntities sel;
|
||||
//QList<QUrl> urls;
|
||||
//if (uponSelected) {
|
||||
// sel = getSelectedText();
|
||||
//} else if (pressedHandler) {
|
||||
// sel = { pressedHandler->dragText(), EntitiesInText() };
|
||||
// //if (!sel.isEmpty() && sel.at(0) != '/' && sel.at(0) != '@' && sel.at(0) != '#') {
|
||||
// // urls.push_back(QUrl::fromEncoded(sel.toUtf8())); // Google Chrome crashes in Mac OS X O_o
|
||||
// //}
|
||||
//}
|
||||
//if (auto mimeData = mimeDataFromTextWithEntities(sel)) {
|
||||
// updateDragSelection(0, 0, false);
|
||||
// _widget->noSelectingScroll();
|
||||
|
||||
// if (!urls.isEmpty()) mimeData->setUrls(urls);
|
||||
// if (uponSelected && !Adaptive::OneColumn()) {
|
||||
// auto selectedState = getSelectionState();
|
||||
// if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
|
||||
// session().data().setMimeForwardIds(getSelectedItems());
|
||||
// mimeData->setData(u"application/x-td-forward"_q, "1");
|
||||
// }
|
||||
// }
|
||||
// _controller->window()->launchDrag(std::move(mimeData));
|
||||
// return;
|
||||
//} else {
|
||||
// auto forwardMimeType = QString();
|
||||
// auto pressedMedia = static_cast<HistoryView::Media*>(nullptr);
|
||||
// if (auto pressedItem = Element::Pressed()) {
|
||||
// pressedMedia = pressedItem->media();
|
||||
// if (_mouseCursorState == CursorState::Date) {
|
||||
// forwardMimeType = u"application/x-td-forward"_q;
|
||||
// session().data().setMimeForwardIds(
|
||||
// session().data().itemOrItsGroup(pressedItem->data()));
|
||||
// }
|
||||
// }
|
||||
// if (auto pressedLnkItem = Element::PressedLink()) {
|
||||
// if ((pressedMedia = pressedLnkItem->media())) {
|
||||
// if (forwardMimeType.isEmpty()
|
||||
// && pressedMedia->dragItemByHandler(pressedHandler)) {
|
||||
// forwardMimeType = u"application/x-td-forward"_q;
|
||||
// session().data().setMimeForwardIds(
|
||||
// { 1, pressedLnkItem->fullId() });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!forwardMimeType.isEmpty()) {
|
||||
// auto mimeData = std::make_unique<QMimeData>();
|
||||
// mimeData->setData(forwardMimeType, "1");
|
||||
// if (auto document = (pressedMedia ? pressedMedia->getDocument() : nullptr)) {
|
||||
// auto filepath = document->filepath(true);
|
||||
// if (!filepath.isEmpty()) {
|
||||
// QList<QUrl> urls;
|
||||
// urls.push_back(QUrl::fromLocalFile(filepath));
|
||||
// mimeData->setUrls(urls);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // This call enters event loop and can destroy any QObject.
|
||||
// _controller->window()->launchDrag(std::move(mimeData));
|
||||
// return;
|
||||
// }
|
||||
//} // TODO
|
||||
}
|
||||
|
||||
int InnerWidget::itemTop(not_null<const Element *> view) const
|
||||
|
@ -1758,6 +1664,7 @@ void InnerWidget::resizeItem(not_null<Element *> view)
|
|||
void InnerWidget::refreshItem(not_null<const Element *> view)
|
||||
{
|
||||
// No need to refresh views in admin log.
|
||||
// sogl
|
||||
}
|
||||
|
||||
QPoint InnerWidget::mapPointToItem(QPoint point, const Element *view) const
|
||||
|
|
|
@ -791,7 +791,16 @@ void GenerateItems(
|
|||
{
|
||||
const auto session = &history->session();
|
||||
const auto id = message.fakeId;
|
||||
const auto from = history->owner().user(message.fromId);
|
||||
PeerData* from = history->owner().userLoaded(message.fromId);
|
||||
if (!from) {
|
||||
from = history->owner().channelLoaded(message.fromId);
|
||||
}
|
||||
if (!from) {
|
||||
from = reinterpret_cast<PeerData *>(history->owner().chatLoaded(message.fromId));
|
||||
}
|
||||
if (!from) {
|
||||
return;
|
||||
}
|
||||
const auto date = message.entityCreateDate;
|
||||
const auto addPart = [&](
|
||||
not_null<HistoryItem *> item,
|
||||
|
|
|
@ -82,7 +82,7 @@ FixedBar::FixedBar(
|
|||
: TWidget(parent), _controller(controller), _peer(peer), _backButton(
|
||||
this,
|
||||
&controller->session(),
|
||||
tr::lng_admin_log_title_all(tr::now),
|
||||
tr::lng_terms_back(tr::now),
|
||||
controller->adaptive().oneColumnValue()), _cancel(this, st::historyAdminLogCancelSearch)
|
||||
{
|
||||
_backButton->moveToLeft(0, 0);
|
||||
|
@ -160,10 +160,6 @@ Widget::Widget(
|
|||
_scroll(this, st::historyScroll, false),
|
||||
_fixedBar(this, controller, peer),
|
||||
_fixedBarShadow(this),
|
||||
_whatIsThis(
|
||||
this,
|
||||
tr::lng_admin_log_about(tr::now),
|
||||
st::historyComposeButton),
|
||||
_item(item)
|
||||
{
|
||||
_fixedBar->move(0, 0);
|
||||
|
@ -193,13 +189,6 @@ Widget::Widget(
|
|||
onScroll();
|
||||
}, lifetime());
|
||||
|
||||
_whatIsThis->setClickedCallback([=]
|
||||
{
|
||||
controller->show(Ui::MakeInformBox(peer->isMegagroup()
|
||||
? tr::lng_admin_log_about_text()
|
||||
: tr::lng_admin_log_about_text_channel()));
|
||||
});
|
||||
|
||||
setupShortcuts();
|
||||
}
|
||||
|
||||
|
@ -297,7 +286,7 @@ void Widget::resizeEvent(QResizeEvent *e)
|
|||
_fixedBarShadow->resize(contentWidth, st::lineWidth);
|
||||
|
||||
auto bottom = height();
|
||||
auto scrollHeight = bottom - _fixedBar->height() - _whatIsThis->height();
|
||||
auto scrollHeight = bottom - _fixedBar->height();
|
||||
auto scrollSize = QSize(contentWidth, scrollHeight);
|
||||
if (_scroll->size() != scrollSize) {
|
||||
_scroll->resize(scrollSize);
|
||||
|
@ -312,8 +301,6 @@ void Widget::resizeEvent(QResizeEvent *e)
|
|||
auto scrollTop = _scroll->scrollTop();
|
||||
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
|
||||
}
|
||||
auto fullWidthButtonRect = myrtlrect(0, bottom - _whatIsThis->height(), contentWidth, _whatIsThis->height());
|
||||
_whatIsThis->setGeometry(fullWidthButtonRect);
|
||||
}
|
||||
|
||||
void Widget::paintEvent(QPaintEvent *e)
|
||||
|
|
|
@ -80,7 +80,6 @@ private:
|
|||
QPointer<InnerWidget> _inner;
|
||||
object_ptr<FixedBar> _fixedBar;
|
||||
object_ptr<Ui::PlainShadow> _fixedBarShadow;
|
||||
object_ptr<Ui::FlatButton> _whatIsThis;
|
||||
not_null<HistoryItem *> _item;
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue