mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Use base::weak_qptr / base::make_weak.
This commit is contained in:
@@ -63,11 +63,11 @@ public:
|
||||
}
|
||||
|
||||
template <typename BoxType>
|
||||
QPointer<BoxType> show(
|
||||
base::weak_qptr<BoxType> show(
|
||||
object_ptr<BoxType> box,
|
||||
Ui::LayerOptions options = Ui::LayerOption::KeepOther,
|
||||
anim::type animated = anim::type::normal) {
|
||||
auto result = QPointer<BoxType>(box.data());
|
||||
auto result = base::weak_qptr<BoxType>(box.data());
|
||||
showBox(std::move(box), options, animated);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -910,7 +910,7 @@ void PanelController::suggestReset(Fn<void()> callback) {
|
||||
.confirmed = [=] { resetPassport(callback); },
|
||||
.cancelled = [=] { cancelReset(); },
|
||||
.confirmText = Lang::Hard::PassportCorruptedReset(),
|
||||
})).data());
|
||||
})).get());
|
||||
}
|
||||
|
||||
void PanelController::resetPassport(Fn<void()> callback) {
|
||||
@@ -921,7 +921,7 @@ void PanelController::resetPassport(Fn<void()> callback) {
|
||||
.confirmText = Lang::Hard::PassportCorruptedReset(),
|
||||
.confirmStyle = &st::attentionBoxButton,
|
||||
}));
|
||||
_resetBox = Ui::BoxPointer(box.data());
|
||||
_resetBox = Ui::BoxPointer(box.get());
|
||||
}
|
||||
|
||||
void PanelController::cancelReset() {
|
||||
@@ -1210,7 +1210,7 @@ void PanelController::startScopeEdit(
|
||||
std::move(scans),
|
||||
std::move(translations),
|
||||
PrepareSpecialFiles(*_editDocument));
|
||||
const auto weak = Ui::MakeWeak(result.data());
|
||||
const auto weak = base::make_weak(result.data());
|
||||
_panelHasUnsavedChanges = [=] {
|
||||
return weak ? weak->hasUnsavedChanges() : false;
|
||||
};
|
||||
@@ -1229,7 +1229,7 @@ void PanelController::startScopeEdit(
|
||||
std::move(preferredLanguage)),
|
||||
_editValue->error,
|
||||
_editValue->data.parsedInEdit);
|
||||
const auto weak = Ui::MakeWeak(result.data());
|
||||
const auto weak = base::make_weak(result.data());
|
||||
_panelHasUnsavedChanges = [=] {
|
||||
return weak ? weak->hasUnsavedChanges() : false;
|
||||
};
|
||||
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
|
||||
std::unique_ptr<Panel> _panel;
|
||||
Fn<bool()> _panelHasUnsavedChanges;
|
||||
QPointer<Ui::BoxContent> _confirmForgetChangesBox;
|
||||
base::weak_qptr<Ui::BoxContent> _confirmForgetChangesBox;
|
||||
std::vector<Ui::BoxPointer> _editScopeBoxes;
|
||||
Scope *_editScope = nullptr;
|
||||
const Value *_editValue = nullptr;
|
||||
|
||||
@@ -571,7 +571,7 @@ DateRow::DateRow(
|
||||
GetYear(value))
|
||||
, _value(valueCurrent()) {
|
||||
const auto focused = [=](const object_ptr<DateInput> &field) {
|
||||
return [this, pointer = MakeWeak(field.data())]{
|
||||
return [this, pointer = base::make_weak(field.data())]{
|
||||
_borderAnimationStart = pointer->borderAnimationStart()
|
||||
+ pointer->x()
|
||||
- _day->x();
|
||||
|
||||
Reference in New Issue
Block a user