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:
86
Telegram/SourceFiles/window/window_chat_switch_process.h
Normal file
86
Telegram/SourceFiles/window/window_chat_switch_process.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
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/round_rect.h"
|
||||
#include "ui/userpic_view.h"
|
||||
|
||||
namespace Data {
|
||||
class Thread;
|
||||
} // namespace Data
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Shortcuts {
|
||||
struct ChatSwitchRequest;
|
||||
} // namespace Shortcuts
|
||||
|
||||
namespace Ui {
|
||||
class AbstractButton;
|
||||
class RpWidget;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Window {
|
||||
|
||||
class ChatSwitchProcess final {
|
||||
public:
|
||||
// Create widget in geometry->parentWidget() and geometry->geometry().
|
||||
ChatSwitchProcess(
|
||||
not_null<Ui::RpWidget*> geometry,
|
||||
not_null<Main::Session*> session,
|
||||
Data::Thread *opened);
|
||||
~ChatSwitchProcess();
|
||||
|
||||
[[nodiscard]] rpl::producer<not_null<Data::Thread*>> chosen() const;
|
||||
[[nodiscard]] rpl::producer<> closeRequests() const;
|
||||
|
||||
using Request = Shortcuts::ChatSwitchRequest;
|
||||
void process(const Request &request);
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime();
|
||||
|
||||
private:
|
||||
struct Entry;
|
||||
|
||||
void setupWidget(not_null<Ui::RpWidget*> geometry);
|
||||
void setupContent(Data::Thread *opened);
|
||||
void setupView();
|
||||
|
||||
void layout(QSize size);
|
||||
void remove(not_null<Data::Thread*> thread);
|
||||
|
||||
void setSelected(int index);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
const std::unique_ptr<Ui::RpWidget> _widget;
|
||||
const not_null<Ui::RpWidget*> _view;
|
||||
|
||||
QRect _shadowed;
|
||||
QRect _outer;
|
||||
QRect _inner;
|
||||
Ui::RoundRect _bg;
|
||||
|
||||
base::flat_map<not_null<PeerData*>, Ui::PeerUserpicView> _userpics;
|
||||
std::vector<not_null<Data::Thread*>> _list;
|
||||
std::vector<Entry> _entries;
|
||||
|
||||
int _selected = -1;
|
||||
int _shownRows = 0;
|
||||
int _shownCount = 0;
|
||||
int _shownPerRow = 0;
|
||||
|
||||
rpl::event_stream<not_null<Data::Thread*>> _chosen;
|
||||
rpl::event_stream<> _closeRequests;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Window
|
||||
Reference in New Issue
Block a user