mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Create tray icon without a parent.
This commit is contained in:
parent
3e332ad8e7
commit
e4c16ccba4
3 changed files with 4 additions and 26 deletions
|
@ -23,16 +23,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace Platform {
|
||||
|
||||
namespace {
|
||||
|
||||
[[nodiscard]] QWidget *Parent() {
|
||||
Expects(Core::App().activePrimaryWindow() != nullptr);
|
||||
|
||||
return Core::App().activePrimaryWindow()->widget();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class IconGraphic final {
|
||||
public:
|
||||
explicit IconGraphic();
|
||||
|
@ -335,7 +325,7 @@ void Tray::createIcon() {
|
|||
const auto counter = Core::App().unreadBadge();
|
||||
const auto muted = Core::App().unreadBadgeMuted();
|
||||
|
||||
_icon = base::make_unique_q<QSystemTrayIcon>(Parent());
|
||||
_icon = base::make_unique_q<QSystemTrayIcon>(nullptr);
|
||||
_icon->setIcon(_iconGraphic->trayIcon(
|
||||
_iconGraphic->systemIcon(
|
||||
iconThemeName,
|
||||
|
@ -405,7 +395,7 @@ void Tray::updateIcon() {
|
|||
|
||||
void Tray::createMenu() {
|
||||
if (!_menu) {
|
||||
_menu = base::make_unique_q<QMenu>(Parent());
|
||||
_menu = base::make_unique_q<QMenu>(nullptr);
|
||||
}
|
||||
if (!_menuXEmbed) {
|
||||
_menuXEmbed = base::make_unique_q<Ui::PopupMenu>(nullptr);
|
||||
|
|
|
@ -222,12 +222,6 @@ void UpdateIcon(const NSStatusItem *status) {
|
|||
status.button.imageScaling = NSImageScaleProportionallyDown;
|
||||
}
|
||||
|
||||
[[nodiscard]] QWidget *Parent() {
|
||||
Expects(Core::App().activePrimaryWindow() != nullptr);
|
||||
|
||||
return Core::App().activePrimaryWindow()->widget();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class NativeIcon final {
|
||||
|
@ -366,7 +360,7 @@ void Tray::updateIcon() {
|
|||
|
||||
void Tray::createMenu() {
|
||||
if (!_menu) {
|
||||
_menu = base::make_unique_q<QMenu>(Parent());
|
||||
_menu = base::make_unique_q<QMenu>(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,12 +89,6 @@ constexpr auto kTooltipDelay = crl::time(10000);
|
|||
return result;
|
||||
}
|
||||
|
||||
[[nodiscard]] QWidget *Parent() {
|
||||
Expects(Core::App().activePrimaryWindow() != nullptr);
|
||||
|
||||
return Core::App().activePrimaryWindow()->widget();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Tray::Tray() {
|
||||
|
@ -102,7 +96,7 @@ Tray::Tray() {
|
|||
|
||||
void Tray::createIcon() {
|
||||
if (!_icon) {
|
||||
_icon = base::make_unique_q<QSystemTrayIcon>(Parent());
|
||||
_icon = base::make_unique_q<QSystemTrayIcon>(nullptr);
|
||||
updateIcon();
|
||||
_icon->setToolTip(AppName.utf16());
|
||||
using Reason = QSystemTrayIcon::ActivationReason;
|
||||
|
|
Loading…
Add table
Reference in a new issue