Clear up Highlight sound settings (#4194)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
Closes https://github.com/Chatterino/chatterino2/issues/1540
This commit is contained in:
nerix
2022-12-03 17:01:49 +01:00
committed by GitHub
parent 8d4ee72478
commit 2aa8af47e7
8 changed files with 99 additions and 88 deletions
+7 -4
View File
@@ -19,14 +19,17 @@ namespace chatterino {
namespace {
/**
* Gets the default sound url if the user set one,
* or the chatterino default ping sound if no url is set.
*/
QUrl getFallbackHighlightSound()
{
QString path = getSettings()->pathHighlightSound;
bool fileExists = QFileInfo::exists(path) && QFileInfo(path).isFile();
bool fileExists = !path.isEmpty() && QFileInfo::exists(path) &&
QFileInfo(path).isFile();
// Use fallback sound when checkbox is not checked
// or custom file doesn't exist
if (getSettings()->customHighlightSound && fileExists)
if (fileExists)
{
return QUrl::fromLocalFile(path);
}