add more sounds, more pleasant UI for sound choice

This commit is contained in:
Martin Rotter 2021-08-20 06:42:24 +02:00
parent 88c75da532
commit f3287421fe
11 changed files with 32 additions and 11 deletions

View File

@ -30,7 +30,7 @@
<url type="donation">https://martinrotter.github.io/donate/</url>
<content_rating type="oars-1.1" />
<releases>
<release version="4.0.0" date="2021-08-19"/>
<release version="4.0.0" date="2021-08-20"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -10,6 +10,9 @@
<file>sounds/sheep.wav</file>
<file>sounds/doorbell.wav</file>
<file>sounds/notify.wav</file>
<file>sounds/fanfare.wav</file>
<file>sounds/fanfare2.wav</file>
<file>sounds/goodresult.wav</file>
<file>scripts/adblock/adblock-server.js</file>
<file>scripts/public_suffix_list.dat</file>

BIN
resources/sounds/fanfare.wav Executable file

Binary file not shown.

BIN
resources/sounds/fanfare2.wav Executable file

Binary file not shown.

BIN
resources/sounds/goodresult.wav Executable file

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,9 @@
#include "miscellaneous/application.h"
#include "miscellaneous/iconfactory.h"
#include <QCompleter>
#include <QFileDialog>
#include <QFileSystemModel>
SingleNotificationEditor::SingleNotificationEditor(const Notification& notification, QWidget* parent)
: QGroupBox(parent), m_notificationEvent(Notification::Event::NoEvent) {
@ -25,6 +27,9 @@ SingleNotificationEditor::SingleNotificationEditor(const Notification& notificat
connect(m_ui.m_txtSound, &QLineEdit::textChanged, this, &SingleNotificationEditor::notificationChanged);
connect(m_ui.m_cbBalloon, &QCheckBox::toggled, this, &SingleNotificationEditor::notificationChanged);
QCompleter* completer = new QCompleter(qApp->builtinSounds(), this);
m_ui.m_txtSound->setCompleter(completer);
setFixedHeight(sizeHint().height());
}

View File

@ -24,15 +24,6 @@ SettingsNotifications::SettingsNotifications(Settings* settings, QWidget* parent
void SettingsNotifications::loadSettings() {
onBeginLoadSettings();
auto builtin_sounds = QDir(SOUNDS_BUILTIN_DIRECTORY).entryInfoList(QDir::Filter::Files,
QDir::SortFlag::Name);
auto iter = boolinq::from(builtin_sounds).select([](const QFileInfo& i) {
return QSL(" %1").arg(i.absoluteFilePath());
}).toStdList();
auto descs = FROM_STD_LIST(QStringList, iter).join(QSL("\n"));
m_ui.m_lblAvailableSounds->setText(QSL("Built-in sounds:\n%1").arg(descs));
// Load fancy notification settings.
m_ui.m_checkEnableNotifications->setChecked(settings()->value(GROUP(GUI), SETTING(GUI::EnableNotifications)).toBool());
m_ui.m_editor->loadNotifications(qApp->notifications()->allNotifications());

View File

@ -47,13 +47,23 @@
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="m_lblAvailableSounds"/>
<widget class="QLabel" name="m_lblAvailableSounds">
<property name="text">
<string>There are some built-in sounds. Just start typing &quot;:&quot; and they will show up.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="m_lblInfo">
<property name="text">
<string>You must have &quot;tray icon&quot; activated to have balloon notifications working.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

View File

@ -199,6 +199,16 @@ bool Application::isAlreadyRunning() {
<< Application::arguments().mid(1)).join(ARGUMENTS_LIST_SEPARATOR));
}
QStringList Application::builtinSounds() const {
auto builtin_sounds = QDir(SOUNDS_BUILTIN_DIRECTORY).entryInfoList(QDir::Filter::Files, QDir::SortFlag::Name);
auto iter = boolinq::from(builtin_sounds).select([](const QFileInfo& i) {
return i.absoluteFilePath();
}).toStdList();
auto descs = FROM_STD_LIST(QStringList, iter);
return descs;
}
FeedReader* Application::feedReader() {
return m_feedReader;
}

View File

@ -52,6 +52,8 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
bool isAlreadyRunning();
QStringList builtinSounds() const;
FeedReader* feedReader();
void setFeedReader(FeedReader* feed_reader);