ZaStoGram_desktop/Telegram/SourceFiles/ui/controls/location_picker.h
loop-uh 33b81db99d Merge upstream Telegram Desktop v7.3.5
Слияние сделал модуль upstream-sync, конфликты разобраны вручную основным
агентом 2026-11-05: фоновый Claude модуля не смог войти в аккаунт
("Not logged in"), поэтому разбор не состоялся.

Решения:
- 15 файлов, которые форк убрал из системы контроля версий (AGENTS.md,
  .agents/, .claude/, .github/workflows/): остаются удалёнными, как в
  коммите a00235d71e и в слиянии 7.3.4.
- версии: 7.3.5 (7003005) из оригинала; название ZaStoGram в Telegram.rc,
  AppBetaVersion = false и BetaChannel 0 сохранены; changelog.txt получает
  блок 7.3.5, заголовок 7.3.4 остаётся форковым.
- file_upload.cpp: наша сигнатура sendPreparedRequest с FileTransferRpcKind
  плюс .part = index из оригинала.
- wallet_session.h, location_picker.*: оставлены наши пути заголовков
  (mtproto/instance/sender.h, mtproto/config/mtproto_config.h).
- iv_editor_widget.cpp: оставлена наша реализация на fieldTextWithSelection();
  вспомогательная CaptureCommittedFieldSelection из оригинала убрана: она
  ссылалась на отсутствующий у нас Widget::richOffsetForFieldOffset и осталась
  бы неиспользуемой.

Конфликты разбирал ИИ: да.
2026-11-05 10:02:07 -05:00

96 lines
2.4 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "base/invoke_queued.h"
#include "base/timer.h"
#include "base/weak_ptr.h"
#include "core/current_geo_location.h"
#include "mtproto/instance/sender.h"
#include "webview/webview_common.h"
namespace Data {
class LocationPoint;
} // namespace Data
namespace Webview {
class Window;
} // namespace Webview
namespace Ui {
class AbstractButton;
class SeparatePanel;
class RpWidget;
struct LocationPickerConfig {
QString mapsToken;
QString geoToken;
};
class LocationPicker final : public base::has_weak_ptr {
public:
struct Descriptor {
RpWidget *parent = nullptr;
LocationPickerConfig config;
rpl::producer<QString> chooseLabel;
Core::GeoLocation initial;
Fn<void(Data::LocationPoint point, QString address)> callback;
Fn<void()> quit;
Webview::StorageId storageId;
rpl::producer<> closeRequests;
};
[[nodiscard]] static bool Available(const LocationPickerConfig &config);
static not_null<LocationPicker*> Show(Descriptor &&descriptor);
void activate();
void close();
void minimize();
void quit();
private:
explicit LocationPicker(Descriptor &&descriptor);
void setup(const Descriptor &descriptor);
void setupWindow(const Descriptor &descriptor);
void setupWebview();
void showWebviewError();
void processKey(const QString &key, const QString &modifier);
void resolveCurrentLocation();
void resolveAddressByTimer();
void resolveAddress(Core::GeoLocation location);
void mapReady();
LocationPickerConfig _config;
Fn<void(Data::LocationPoint, QString)> _callback;
Fn<void()> _quit;
std::unique_ptr<SeparatePanel> _window;
not_null<RpWidget*> _body;
RpWidget *_container = nullptr;
RpWidget *_mapPlaceholder = nullptr;
RpWidget *_mapLoading = nullptr;
AbstractButton *_mapButton = nullptr;
rpl::variable<QString> _chooseButtonLabel;
Webview::StorageId _webviewStorageId;
std::unique_ptr<Webview::Window> _webview;
SingleQueuedInvokation _updateStyles;
Core::GeoLocation _initialProvided;
bool _subscribedToColors = false;
base::Timer _geocoderResolveTimer;
Core::GeoLocation _geocoderResolvePostponed;
Core::GeoLocation _geocoderResolvingFor;
QString _geocoderSavedAddress;
rpl::variable<QString> _geocoderAddress;
rpl::lifetime _lifetime;
};
} // namespace Ui