init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
98
Telegram/SourceFiles/window/window_connecting_widget.h
Normal file
98
Telegram/SourceFiles/window/window_connecting_widget.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
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/timer.h"
|
||||
#include "base/unique_qptr.h"
|
||||
#include "ui/effects/animations.h"
|
||||
|
||||
namespace Ui {
|
||||
class RpWidget;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Main {
|
||||
class Account;
|
||||
} // namespace Main
|
||||
|
||||
namespace Window {
|
||||
|
||||
class ConnectionState {
|
||||
public:
|
||||
ConnectionState(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Main::Account*> account,
|
||||
rpl::producer<bool> shown);
|
||||
|
||||
void raise();
|
||||
void setForceHidden(bool hidden);
|
||||
void setBottomSkip(int skip);
|
||||
|
||||
rpl::lifetime &lifetime() {
|
||||
return _lifetime;
|
||||
}
|
||||
|
||||
private:
|
||||
class Widget;
|
||||
struct State {
|
||||
enum class Type {
|
||||
Connected,
|
||||
Connecting,
|
||||
Waiting,
|
||||
};
|
||||
Type type = Type::Connected;
|
||||
bool useProxy = false;
|
||||
bool exposed = false;
|
||||
bool underCursor = false;
|
||||
bool updateReady = false;
|
||||
int waitTillRetry = 0;
|
||||
|
||||
bool operator==(const State &other) const;
|
||||
|
||||
};
|
||||
struct Layout {
|
||||
bool visible = false;
|
||||
bool hasRetry = false;
|
||||
bool proxyEnabled = false;
|
||||
bool progressShown = false;
|
||||
int contentWidth = 0;
|
||||
QString text;
|
||||
int textWidth = 0;
|
||||
|
||||
};
|
||||
|
||||
void createWidget();
|
||||
void finishAnimating();
|
||||
void refreshState();
|
||||
void applyState(const State &state);
|
||||
void changeVisibilityWithLayout(const Layout &layout);
|
||||
Layout computeLayout(const State &state) const;
|
||||
void setLayout(const Layout &layout);
|
||||
float64 currentVisibility() const;
|
||||
rpl::producer<float64> visibility() const;
|
||||
void updateWidth();
|
||||
void updateVisibility();
|
||||
void refreshProgressVisibility();
|
||||
|
||||
const not_null<Main::Account*> _account;
|
||||
not_null<Ui::RpWidget*> _parent;
|
||||
rpl::variable<int> _bottomSkip;
|
||||
base::unique_qptr<Widget> _widget;
|
||||
bool _forceHidden = false;
|
||||
base::Timer _refreshTimer;
|
||||
State _state;
|
||||
Layout _currentLayout;
|
||||
crl::time _connectingStartedAt = 0;
|
||||
Ui::Animations::Simple _contentWidth;
|
||||
Ui::Animations::Simple _visibility;
|
||||
|
||||
rpl::event_stream<float64> _visibilityValues;
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Window
|
||||
Reference in New Issue
Block a user