tdesktop/Telegram/SourceFiles/boxes/sessions_box.h

74 lines
1.5 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
2017-04-06 14:38:10 +00:00
#include "boxes/abstract_box.h"
#include "mtproto/sender.h"
#include "base/timer.h"
class ConfirmBox;
namespace Ui {
class IconButton;
class LinkButton;
} // namespace Ui
2019-07-25 18:55:11 +00:00
namespace Main {
class Session;
} // namespace Main
2019-09-18 11:19:05 +00:00
class SessionsBox : public Ui::BoxContent, private MTP::Sender {
public:
2019-07-25 18:55:11 +00:00
SessionsBox(QWidget*, not_null<Main::Session*> session);
protected:
void prepare() override;
void resizeEvent(QResizeEvent *e) override;
void paintEvent(QPaintEvent *e) override;
private:
struct Entry {
uint64 hash = 0;
bool incomplete = false;
TimeId activeTime = 0;
int nameWidth, activeWidth, infoWidth, ipWidth;
QString name, active, info, ip;
};
struct Full {
Entry current;
std::vector<Entry> incomplete;
std::vector<Entry> list;
};
class Inner;
class List;
static Entry ParseEntry(const MTPDauthorization &data);
static void ResizeEntry(Entry &entry);
void setLoading(bool loading);
void shortPollSessions();
void got(const MTPaccount_Authorizations &result);
void terminateOne(uint64 hash);
2015-10-12 21:02:10 +00:00
void terminateAll();
2019-07-25 18:55:11 +00:00
const not_null<Main::Session*> _session;
bool _loading = false;
Full _data;
QPointer<Inner> _inner;
QPointer<ConfirmBox> _terminateBox;
base::Timer _shortPollTimer;
mtpRequestId _shortPollRequest = 0;
};