Utils(GetTrayIcon): refactor with frontend API function

This commit is contained in:
Stéphane Lepin 2020-07-28 02:23:31 +02:00
parent 6734c928a2
commit d91b3f8dd9

View File

@ -485,11 +485,8 @@ QString Utils::OBSVersionString() {
} }
QSystemTrayIcon* Utils::GetTrayIcon() { QSystemTrayIcon* Utils::GetTrayIcon() {
QMainWindow* main = (QMainWindow*)obs_frontend_get_main_window(); void* systemTray = obs_frontend_get_system_tray();
if (!main) return nullptr; return reinterpret_cast<QSystemTrayIcon*>(systemTray);
QList<QSystemTrayIcon*> trays = main->findChildren<QSystemTrayIcon*>();
return trays.isEmpty() ? nullptr : trays.first();
} }
void Utils::SysTrayNotify(QString text, void Utils::SysTrayNotify(QString text,