mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Removed App::wnd from classes that have pointer to Window::Controller.
This commit is contained in:
parent
0783a682dc
commit
0b4d0b83c2
12 changed files with 71 additions and 79 deletions
|
@ -473,11 +473,9 @@ void StickerSetBox::Inner::mouseMoveEvent(QMouseEvent *e) {
|
|||
int index = stickerFromGlobalPos(e->globalPos());
|
||||
if (index >= 0 && index < _pack.size() && index != _previewShown) {
|
||||
_previewShown = index;
|
||||
if (const auto w = App::wnd()) {
|
||||
w->showMediaPreview(
|
||||
Data::FileOriginStickerSet(_setId, _setAccess),
|
||||
_pack[_previewShown]);
|
||||
}
|
||||
_controller->widget()->showMediaPreview(
|
||||
Data::FileOriginStickerSet(_setId, _setAccess),
|
||||
_pack[_previewShown]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -536,11 +534,9 @@ void StickerSetBox::Inner::showPreview() {
|
|||
int index = stickerFromGlobalPos(QCursor::pos());
|
||||
if (index >= 0 && index < _pack.size()) {
|
||||
_previewShown = index;
|
||||
if (const auto w = App::wnd()) {
|
||||
w->showMediaPreview(
|
||||
Data::FileOriginStickerSet(_setId, _setAccess),
|
||||
_pack[_previewShown]);
|
||||
}
|
||||
_controller->widget()->showMediaPreview(
|
||||
Data::FileOriginStickerSet(_setId, _setAccess),
|
||||
_pack[_previewShown]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1280,11 +1280,9 @@ void FieldAutocomplete::Inner::selectByMouse(QPoint globalPosition) {
|
|||
if (_down >= 0 && _sel >= 0 && _down != _sel) {
|
||||
_down = _sel;
|
||||
if (_down >= 0 && _down < _srows->size()) {
|
||||
if (const auto w = App::wnd()) {
|
||||
w->showMediaPreview(
|
||||
(*_srows)[_down].document->stickerSetOrigin(),
|
||||
(*_srows)[_down].document);
|
||||
}
|
||||
_controller->widget()->showMediaPreview(
|
||||
(*_srows)[_down].document->stickerSetOrigin(),
|
||||
(*_srows)[_down].document);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1302,12 +1300,10 @@ void FieldAutocomplete::Inner::onParentGeometryChanged() {
|
|||
|
||||
void FieldAutocomplete::Inner::showPreview() {
|
||||
if (_down >= 0 && _down < _srows->size()) {
|
||||
if (const auto w = App::wnd()) {
|
||||
w->showMediaPreview(
|
||||
(*_srows)[_down].document->stickerSetOrigin(),
|
||||
(*_srows)[_down].document);
|
||||
_previewShown = true;
|
||||
}
|
||||
_controller->widget()->showMediaPreview(
|
||||
(*_srows)[_down].document->stickerSetOrigin(),
|
||||
(*_srows)[_down].document);
|
||||
_previewShown = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1078,16 +1078,14 @@ void GifsListWidget::updateSelected() {
|
|||
_pressed = _selected;
|
||||
if (row >= 0 && col >= 0) {
|
||||
auto layout = _rows[row].items[col];
|
||||
if (const auto w = App::wnd()) {
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
w->showMediaPreview(
|
||||
Data::FileOriginSavedGifs(),
|
||||
previewDocument);
|
||||
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
w->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewPhoto);
|
||||
}
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
controller()->widget()->showMediaPreview(
|
||||
Data::FileOriginSavedGifs(),
|
||||
previewDocument);
|
||||
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
controller()->widget()->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewPhoto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1104,16 +1102,14 @@ void GifsListWidget::showPreview() {
|
|||
int row = _pressed / MatrixRowShift, col = _pressed % MatrixRowShift;
|
||||
if (row < _rows.size() && col < _rows[row].items.size()) {
|
||||
auto layout = _rows[row].items[col];
|
||||
if (const auto w = App::wnd()) {
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
_previewShown = w->showMediaPreview(
|
||||
Data::FileOriginSavedGifs(),
|
||||
previewDocument);
|
||||
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
_previewShown = w->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewPhoto);
|
||||
}
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
_previewShown = controller()->widget()->showMediaPreview(
|
||||
Data::FileOriginSavedGifs(),
|
||||
previewDocument);
|
||||
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
_previewShown = controller()->widget()->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewPhoto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2883,9 +2883,9 @@ void StickersListWidget::setSelected(OverState newSelected) {
|
|||
const auto &set = sets[sticker->section];
|
||||
Assert(sticker->index >= 0 && sticker->index < set.stickers.size());
|
||||
const auto document = set.stickers[sticker->index].document;
|
||||
if (const auto w = App::wnd()) {
|
||||
w->showMediaPreview(document->stickerSetOrigin(), document);
|
||||
}
|
||||
controller()->widget()->showMediaPreview(
|
||||
document->stickerSetOrigin(),
|
||||
document);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2898,10 +2898,10 @@ void StickersListWidget::showPreview() {
|
|||
const auto &set = sets[sticker->section];
|
||||
Assert(sticker->index >= 0 && sticker->index < set.stickers.size());
|
||||
const auto document = set.stickers[sticker->index].document;
|
||||
if (const auto w = App::wnd()) {
|
||||
w->showMediaPreview(document->stickerSetOrigin(), document);
|
||||
_previewShown = true;
|
||||
}
|
||||
controller()->widget()->showMediaPreview(
|
||||
document->stickerSetOrigin(),
|
||||
document);
|
||||
_previewShown = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -414,7 +414,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
|||
Painter p(this);
|
||||
|
||||
const auto r = e->rect();
|
||||
if (App::wnd()->contentOverlapped(this, r)) {
|
||||
if (_controller->widget()->contentOverlapped(this, r)) {
|
||||
return;
|
||||
}
|
||||
const auto activeEntry = _controller->activeChatEntryCurrent();
|
||||
|
|
|
@ -711,7 +711,7 @@ void Widget::animationCallback() {
|
|||
updateControlsVisibility(true);
|
||||
|
||||
if (!_filter->hasFocus()) {
|
||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||
controller()->widget()->setInnerFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -957,7 +957,7 @@ void Widget::onChooseByDrag() {
|
|||
}
|
||||
|
||||
void Widget::showMainMenu() {
|
||||
App::wnd()->showMainMenu();
|
||||
controller()->widget()->showMainMenu();
|
||||
}
|
||||
|
||||
void Widget::searchMessages(
|
||||
|
@ -1704,7 +1704,9 @@ void Widget::keyPressEvent(QKeyEvent *e) {
|
|||
}
|
||||
|
||||
void Widget::paintEvent(QPaintEvent *e) {
|
||||
if (App::wnd() && App::wnd()->contentOverlapped(this, e)) return;
|
||||
if (controller()->widget()->contentOverlapped(this, e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Painter p(this);
|
||||
QRect r(e->rect());
|
||||
|
|
|
@ -1515,7 +1515,7 @@ void InnerWidget::mouseActionFinish(const QPoint &screenPos, Qt::MouseButton but
|
|||
if (_selectedItem && !_pressWasInactive) {
|
||||
if (_selectedText.from == _selectedText.to) {
|
||||
_selectedItem = nullptr;
|
||||
App::wnd()->setInnerFocus();
|
||||
_controller->widget()->setInnerFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1392,7 +1392,7 @@ void HistoryInner::mouseActionFinish(
|
|||
auto sel = _selected.cbegin()->second;
|
||||
if (sel != FullSelection && sel.from == sel.to) {
|
||||
_selected.clear();
|
||||
App::wnd()->setInnerFocus();
|
||||
_controller->widget()->setInnerFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,9 +260,11 @@ HistoryWidget::HistoryWidget(
|
|||
connect(_field, &Ui::InputField::changed, [=] {
|
||||
fieldChanged();
|
||||
});
|
||||
connect(App::wnd()->windowHandle(), &QWindow::visibleChanged, this, [=] {
|
||||
windowIsVisibleChanged();
|
||||
});
|
||||
connect(
|
||||
controller->widget()->windowHandle(),
|
||||
&QWindow::visibleChanged,
|
||||
this,
|
||||
[=] { windowIsVisibleChanged(); });
|
||||
|
||||
initTabbedSelector();
|
||||
|
||||
|
@ -2006,7 +2008,7 @@ void HistoryWidget::showHistory(
|
|||
update();
|
||||
controller()->floatPlayerAreaUpdated();
|
||||
|
||||
crl::on_main(App::wnd(), [] { App::wnd()->setInnerFocus(); });
|
||||
crl::on_main(this, [=] { controller()->widget()->setInnerFocus(); });
|
||||
}
|
||||
|
||||
void HistoryWidget::clearDelayedShowAt() {
|
||||
|
|
|
@ -2254,7 +2254,7 @@ void ListWidget::mouseActionFinish(
|
|||
} else if (_selectedTextItem && !_pressWasInactive) {
|
||||
if (_selectedTextRange.from == _selectedTextRange.to) {
|
||||
clearTextSelection();
|
||||
App::wnd()->setInnerFocus();
|
||||
_controller->widget()->setInnerFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -713,14 +713,14 @@ void Inner::updateSelected() {
|
|||
_pressed = _selected;
|
||||
if (row >= 0 && col >= 0) {
|
||||
auto layout = _rows.at(row).items.at(col);
|
||||
if (const auto w = App::wnd()) {
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
w->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewDocument);
|
||||
} else if (auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
w->showMediaPreview(Data::FileOrigin(), previewPhoto);
|
||||
}
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
_controller->widget()->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewDocument);
|
||||
} else if (auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
_controller->widget()->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewPhoto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -740,12 +740,14 @@ void Inner::showPreview() {
|
|||
int row = _pressed / MatrixRowShift, col = _pressed % MatrixRowShift;
|
||||
if (row < _rows.size() && col < _rows.at(row).items.size()) {
|
||||
auto layout = _rows.at(row).items.at(col);
|
||||
if (const auto w = App::wnd()) {
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
_previewShown = w->showMediaPreview(Data::FileOrigin(), previewDocument);
|
||||
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
_previewShown = w->showMediaPreview(Data::FileOrigin(), previewPhoto);
|
||||
}
|
||||
if (const auto previewDocument = layout->getPreviewDocument()) {
|
||||
_previewShown = _controller->widget()->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewDocument);
|
||||
} else if (const auto previewPhoto = layout->getPreviewPhoto()) {
|
||||
_previewShown = _controller->widget()->showMediaPreview(
|
||||
Data::FileOrigin(),
|
||||
previewPhoto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -858,8 +858,8 @@ void Editor::keyPressEvent(QKeyEvent *e) {
|
|||
if (e->key() == Qt::Key_Escape) {
|
||||
if (!_select->getQuery().isEmpty()) {
|
||||
_select->clearQuery();
|
||||
} else if (auto window = App::wnd()) {
|
||||
window->setInnerFocus();
|
||||
} else {
|
||||
_window->widget()->setInnerFocus();
|
||||
}
|
||||
} else if (e->key() == Qt::Key_Down) {
|
||||
_inner->selectSkip(1);
|
||||
|
@ -904,10 +904,8 @@ void Editor::closeWithConfirmation() {
|
|||
}
|
||||
|
||||
void Editor::closeEditor() {
|
||||
if (const auto window = App::wnd()) {
|
||||
window->showRightColumn(nullptr);
|
||||
Background()->clearEditingTheme();
|
||||
}
|
||||
_window->widget()->showRightColumn(nullptr);
|
||||
Background()->clearEditingTheme();
|
||||
}
|
||||
|
||||
} // namespace Theme
|
||||
|
|
Loading…
Add table
Reference in a new issue