void AudioHandler::Handle (const Entity&, const NotificationRule& rule) { if (!XmlSettingsManager::Instance () .property ("EnableAudioNots").toBool ()) return; QString fname = rule.GetAudioParams ().Filename_; if (fname.isEmpty ()) return; if (!fname.contains ('/')) { const QString& option = XmlSettingsManager::Instance () .property ("AudioTheme").toString (); const QString& base = option + '/' + fname; QStringList pathVariants; pathVariants << base + ".ogg" << base + ".wav" << base + ".flac" << base + ".mp3"; fname = Core::Instance ().GetAudioThemeLoader ()->GetPath (pathVariants); } const auto& now = QDateTime::currentDateTime (); if (LastNotify_ [fname].msecsTo (now) < 1000) return; LastNotify_ [fname] = now; const Entity& e = Util::MakeEntity (fname, QString (), Internal); Core::Instance ().SendEntity (e); }
void CmdRunHandler::Handle (const Entity& e, const NotificationRule& rule) { if (e.Additional_ ["org.LC.AdvNotifications.EventCategory"].toString () == "org.LC.AdvNotifications.Cancel") return; const CmdParams& params = rule.GetCmdParams (); if (params.Cmd_.isEmpty ()) { qWarning () << Q_FUNC_INFO << "empty command"; return; } QProcess::startDetached (params.Cmd_, params.Args_); }
void AudioHandler::Handle (const Entity&, const NotificationRule& rule) { if (!XmlSettingsManager::Instance () .property ("EnableAudioNots").toBool ()) return; const auto& fname = AudioThemeMgr_->GetAbsoluteFilePath (rule.GetAudioParams ().Filename_); const auto& now = QDateTime::currentDateTime (); if (LastNotify_ [fname].msecsTo (now) < 1000) return; LastNotify_ [fname] = now; const auto& e = Util::MakeEntity (fname, QString (), Internal); GH_->GetProxy ()->GetEntityManager ()->HandleEntity (e); }
void AudioHandler::Handle (const Entity&, const NotificationRule& rule) { if (!XmlSettingsManager::Instance () .property ("EnableAudioNots").toBool ()) return; QString fname = rule.GetAudioParams ().Filename_; if (fname.isEmpty ()) return; if (!fname.contains ('/')) fname = Core::Instance ().GetAbsoluteAudioPath (fname); const auto& now = QDateTime::currentDateTime (); if (LastNotify_ [fname].msecsTo (now) < 1000) return; LastNotify_ [fname] = now; const Entity& e = Util::MakeEntity (fname, QString (), Internal); Core::Instance ().SendEntity (e); }