added more playsound stuff

This commit is contained in:
apa420 2018-08-24 18:05:36 +02:00
parent 8d5b93fe82
commit e58e76ef1e
5 changed files with 43 additions and 22 deletions

View file

@ -81,9 +81,9 @@ void NotificationController::playSound()
static QUrl currentPlayerUrl;
QUrl highlightSoundUrl;
if (getApp()->settings->customHighlightSound) {
if (getApp()->settings->notificationCustomSound) {
highlightSoundUrl = QUrl::fromLocalFile(
getApp()->settings->pathHighlightSound.getValue());
getApp()->settings->notificationPathSound.getValue());
} else {
highlightSoundUrl = QUrl("qrc:/sounds/ping2.wav");
}

View file

@ -144,10 +144,13 @@ public:
false};
BoolSetting notificationPlaySound = {"/notifications/enablePlaySound",
false};
BoolSetting notificationCustomSound = {"/notifications/customPlaySound",
false};
QStringSetting notificationPathSound = {"/notifications/highlightSoundPath",
"qrc:/sounds/ping3.wav"};
BoolSetting notificationToast = {"/notifications/enableToast", false};
BoolSetting notificationDot = {"/notifications/enableDot", false};
BoolSetting notificationSplitheaderHighlight = {
"/notifications/enableSplitheaderHighlight", false};
/// External tools
// Streamlink

View file

@ -559,6 +559,18 @@ void ChannelView::setChannel(ChannelPtr newChannel)
if (tc != nullptr) {
tc->tabHighlightRequested.connect([this](HighlightState state) {
this->tabHighlightRequested.invoke(HighlightState::Notification);
/*
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.translate(2, 2);
painter.setPen(QColor("#6441A4"));
painter.drawEllipse(QRectF(10, 10, 5, 5));
*/
QPainter painter(this);
auto radius = 10;
painter.setPen(QColor("#6441A4"));
painter.drawEllipse(this->rect().center(), radius, radius);
});
}
}

View file

@ -8,10 +8,12 @@
#include "widgets/helper/EditableModelView.hpp"
#include <QCheckBox>
#include <QFileDialog>
#include <QGroupBox>
#include <QHeaderView>
#include <QLabel>
#include <QListView>
#include <QPushButton>
#include <QTableView>
#include <QTimer>
@ -35,15 +37,32 @@ NotificationPage::NotificationPage()
settings.append(this->createCheckBox(
"Playsound (doesn't mute the Windows 8.x sound of toasts)",
getApp()->settings->notificationPlaySound));
#ifdef Q_OS_WIN
settings.append(this->createCheckBox(
"Enable toasts (currently only for windows 8.x or 10)",
getApp()->settings->notificationToast));
#endif
settings.append(
this->createCheckBox("Red dot next to live splits",
getApp()->settings->notificationDot));
settings.append(this->createCheckBox(
"Change color of Splitheader (click to remove)",
getApp()->settings->notificationSplitheaderHighlight));
auto customSound =
layout.emplace<QHBoxLayout>().withoutMargin();
{
customSound.append(this->createCheckBox(
"Custom sound",
getApp()->settings->notificationCustomSound));
auto selectFile = customSound.emplace<QPushButton>(
"Select custom sound file");
QObject::connect(
selectFile.getElement(), &QPushButton::clicked, this,
[this] {
auto fileName = QFileDialog::getOpenFileName(
this, tr("Open Sound"), "",
tr("Audio Files (*.mp3 *.wav)"));
getApp()->settings->notificationPathSound =
fileName;
});
}
settings->addStretch(1);
}

View file

@ -168,6 +168,7 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
getApp()->notifications->updateChannelNotification(
this->split_->getChannel()->getName(), Platform::Twitch);
});
menu->addAction(action);
menu->addSeparator();
@ -549,21 +550,7 @@ void SplitHeader::themeChangedEvent()
getApp()->resources->buttons.menuLight);
}
// this->titleLabel->setPalette(palette);
auto darkPalette = palette;
darkPalette.setColor(QPalette::Window, QColor(53, 53, 53));
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, QColor(25, 25, 25));
darkPalette.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
darkPalette.setColor(QPalette::Button, QColor(53, 53, 53));
darkPalette.setColor(QPalette::ButtonText, Qt::white);
darkPalette.setColor(QPalette::BrightText, Qt::red);
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
this->titleLabel->setPalette(darkPalette);
this->titleLabel->setPalette(palette);
}
void SplitHeader::menuMoveSplit()