tdesktop/Telegram/SourceFiles/ui/toast/toast_manager.h

55 lines
1.1 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/toast/toast.h"
2019-01-18 11:26:43 +00:00
#include "base/timer.h"
namespace Ui {
namespace Toast {
namespace internal {
class Widget;
class Manager : public QObject {
Q_OBJECT
public:
Manager(const Manager &other) = delete;
Manager &operator=(const Manager &other) = delete;
static Manager *instance(QWidget *parent);
void addToast(std::unique_ptr<Instance> &&toast);
~Manager();
protected:
bool eventFilter(QObject *o, QEvent *e);
private slots:
void onToastWidgetDestroyed(QObject *widget);
private:
Manager(QWidget *parent);
void startNextHideTimer();
2019-01-18 11:26:43 +00:00
void hideByTimer();
2019-01-18 11:26:43 +00:00
base::Timer _hideTimer;
2016-12-01 19:20:33 +00:00
TimeMs _nextHide = 0;
2016-12-01 19:20:33 +00:00
QMultiMap<TimeMs, Instance*> _toastByHideTime;
QMap<Widget*, Instance*> _toastByWidget;
QList<Instance*> _toasts;
OrderedSet<QPointer<QWidget>> _toastParents;
};
} // namespace internal
} // namespace Toast
} // namespace Ui