2016-06-16 15:59:54 +03:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-06-16 15:59:54 +03:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-06-16 15:59:54 +03:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-02-28 13:51:00 +03:00
|
|
|
#include "platform/platform_main_window.h"
|
2016-06-16 15:59:54 +03:00
|
|
|
|
2020-01-31 10:34:37 +04:00
|
|
|
#include "ui/widgets/popup_menu.h"
|
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
|
|
|
#include "statusnotifieritem.h"
|
|
|
|
#include <QtCore/QTemporaryFile>
|
|
|
|
#endif
|
2019-09-13 09:06:02 +03:00
|
|
|
|
2016-06-16 15:59:54 +03:00
|
|
|
namespace Platform {
|
|
|
|
|
|
|
|
class MainWindow : public Window::MainWindow {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2019-06-06 14:20:21 +03:00
|
|
|
explicit MainWindow(not_null<Window::Controller*> controller);
|
2016-06-16 15:59:54 +03:00
|
|
|
|
2020-01-31 10:34:37 +04:00
|
|
|
virtual QImage iconWithCounter(
|
|
|
|
int size,
|
|
|
|
int count,
|
|
|
|
style::color bg,
|
|
|
|
style::color fg,
|
|
|
|
bool smallIcon) = 0;
|
2016-06-16 15:59:54 +03:00
|
|
|
|
2016-06-16 20:20:58 +03:00
|
|
|
static void LibsLoaded();
|
|
|
|
|
2016-06-16 15:59:54 +03:00
|
|
|
~MainWindow();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void psShowTrayMenu();
|
|
|
|
|
|
|
|
protected:
|
2020-03-03 05:24:13 +04:00
|
|
|
void initHook() override;
|
2016-11-09 11:34:38 +03:00
|
|
|
void unreadCounterChangedHook() override;
|
2016-06-16 15:59:54 +03:00
|
|
|
|
2020-02-12 12:09:17 +04:00
|
|
|
void initTrayMenuHook() override;
|
2017-01-01 20:45:20 +04:00
|
|
|
bool hasTrayIcon() const override;
|
2016-06-16 15:59:54 +03:00
|
|
|
|
2017-03-04 22:36:59 +03:00
|
|
|
void workmodeUpdated(DBIWorkMode mode) override;
|
|
|
|
|
2016-06-16 20:20:58 +03:00
|
|
|
QSystemTrayIcon *trayIcon = nullptr;
|
|
|
|
QMenu *trayIconMenu = nullptr;
|
2016-06-16 15:59:54 +03:00
|
|
|
|
|
|
|
void psTrayMenuUpdated();
|
|
|
|
void psSetupTrayIcon();
|
|
|
|
|
2020-01-31 10:34:37 +04:00
|
|
|
virtual void placeSmallCounter(
|
|
|
|
QImage &img,
|
|
|
|
int size,
|
|
|
|
int count,
|
|
|
|
style::color bg,
|
|
|
|
const QPoint &shift,
|
|
|
|
style::color color) = 0;
|
2016-06-16 15:59:54 +03:00
|
|
|
|
|
|
|
private:
|
2020-01-31 10:34:37 +04:00
|
|
|
Ui::PopupMenu *_trayIconMenuXEmbed = nullptr;
|
|
|
|
|
2016-11-11 10:51:53 +03:00
|
|
|
void updateIconCounters();
|
2016-06-16 15:59:54 +03:00
|
|
|
|
2020-01-31 10:34:37 +04:00
|
|
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
|
|
|
StatusNotifierItem *_sniTrayIcon = nullptr;
|
|
|
|
std::unique_ptr<QTemporaryFile> _trayIconFile = nullptr;
|
2016-06-16 15:59:54 +03:00
|
|
|
|
2020-03-03 05:24:13 +04:00
|
|
|
void setSNITrayIcon(int counter, bool muted);
|
2020-01-31 10:34:37 +04:00
|
|
|
void attachToSNITrayIcon();
|
|
|
|
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
2016-11-11 10:51:53 +03:00
|
|
|
|
2016-06-16 15:59:54 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Platform
|