tdesktop/Telegram/SourceFiles/passport/passport_panel_edit_scans.h

103 lines
2.6 KiB
C
Raw Normal View History

/*
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 "ui/rp_widget.h"
class BoxContentDivider;
namespace Ui {
class VerticalLayout;
class FlatLabel;
template <typename Widget>
class SlideWrap;
} // namespace Ui
namespace Info {
namespace Profile {
class Button;
} // namespace Profile
} // namespace Info
namespace Passport {
class PanelController;
class ScanButton;
struct ScanInfo;
class EditScans : public Ui::RpWidget {
public:
EditScans(
QWidget *parent,
not_null<PanelController*> controller,
2018-04-10 11:51:19 +04:00
const QString &header,
2018-04-17 21:54:52 +04:00
const QString &errorMissing,
2018-04-10 23:00:52 +04:00
std::vector<ScanInfo> &&files,
std::unique_ptr<ScanInfo> &&selfie);
2018-04-13 14:54:17 +04:00
base::optional<int> validateGetErrorTop();
static void ChooseScan(
QPointer<QWidget> parent,
base::lambda<void(QByteArray&&)> callback);
2018-04-10 11:51:19 +04:00
private:
2018-04-10 11:51:19 +04:00
void setupContent(const QString &header);
void chooseScan();
2018-04-10 23:00:52 +04:00
void chooseSelfie();
void updateScan(ScanInfo &&info);
2018-04-18 21:23:37 +04:00
void updateSelfie(ScanInfo &&info);
void updateFileRow(
not_null<ScanButton*> button,
const ScanInfo &info);
void pushScan(const ScanInfo &info);
2018-04-10 23:00:52 +04:00
void createSelfieRow(const ScanInfo &info);
base::unique_qptr<Ui::SlideWrap<ScanButton>> createScan(
not_null<Ui::VerticalLayout*> parent,
const ScanInfo &info,
const QString &name);
rpl::producer<QString> uploadButtonText() const;
2018-04-13 14:54:17 +04:00
void toggleError(bool shown);
void hideError();
void errorAnimationCallback();
2018-04-17 21:54:52 +04:00
bool uploadedSomeMore() const;
2018-04-13 14:54:17 +04:00
void toggleSelfieError(bool shown);
void hideSelfieError();
void selfieErrorAnimationCallback();
not_null<PanelController*> _controller;
std::vector<ScanInfo> _files;
2018-04-10 23:00:52 +04:00
std::unique_ptr<ScanInfo> _selfie;
2018-04-17 21:54:52 +04:00
int _initialCount = 0;
QString _errorMissing;
object_ptr<Ui::VerticalLayout> _content;
QPointer<Ui::SlideWrap<BoxContentDivider>> _divider;
QPointer<Ui::SlideWrap<Ui::FlatLabel>> _header;
2018-04-17 21:54:52 +04:00
QPointer<Ui::SlideWrap<Ui::FlatLabel>> _uploadMoreError;
QPointer<Ui::VerticalLayout> _wrap;
std::vector<base::unique_qptr<Ui::SlideWrap<ScanButton>>> _rows;
QPointer<Info::Profile::Button> _upload;
rpl::event_stream<rpl::producer<QString>> _uploadTexts;
2018-04-13 14:54:17 +04:00
bool _errorShown = false;
Animation _errorAnimation;
2018-04-10 23:00:52 +04:00
QPointer<Ui::SlideWrap<Ui::FlatLabel>> _selfieHeader;
QPointer<Ui::VerticalLayout> _selfieWrap;
base::unique_qptr<Ui::SlideWrap<ScanButton>> _selfieRow;
QPointer<Info::Profile::Button> _selfieUpload;
2018-04-13 14:54:17 +04:00
bool _selfieErrorShown = false;
Animation _selfieErrorAnimation;
2018-04-10 23:00:52 +04:00
};
} // namespace Passport