mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added more playsound stuff
This commit is contained in:
parent
8d5b93fe82
commit
e58e76ef1e
5 changed files with 43 additions and 22 deletions
|
@ -81,9 +81,9 @@ void NotificationController::playSound()
|
||||||
static QUrl currentPlayerUrl;
|
static QUrl currentPlayerUrl;
|
||||||
|
|
||||||
QUrl highlightSoundUrl;
|
QUrl highlightSoundUrl;
|
||||||
if (getApp()->settings->customHighlightSound) {
|
if (getApp()->settings->notificationCustomSound) {
|
||||||
highlightSoundUrl = QUrl::fromLocalFile(
|
highlightSoundUrl = QUrl::fromLocalFile(
|
||||||
getApp()->settings->pathHighlightSound.getValue());
|
getApp()->settings->notificationPathSound.getValue());
|
||||||
} else {
|
} else {
|
||||||
highlightSoundUrl = QUrl("qrc:/sounds/ping2.wav");
|
highlightSoundUrl = QUrl("qrc:/sounds/ping2.wav");
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,10 +144,13 @@ public:
|
||||||
false};
|
false};
|
||||||
BoolSetting notificationPlaySound = {"/notifications/enablePlaySound",
|
BoolSetting notificationPlaySound = {"/notifications/enablePlaySound",
|
||||||
false};
|
false};
|
||||||
|
BoolSetting notificationCustomSound = {"/notifications/customPlaySound",
|
||||||
|
false};
|
||||||
|
QStringSetting notificationPathSound = {"/notifications/highlightSoundPath",
|
||||||
|
"qrc:/sounds/ping3.wav"};
|
||||||
|
|
||||||
BoolSetting notificationToast = {"/notifications/enableToast", false};
|
BoolSetting notificationToast = {"/notifications/enableToast", false};
|
||||||
BoolSetting notificationDot = {"/notifications/enableDot", false};
|
BoolSetting notificationDot = {"/notifications/enableDot", false};
|
||||||
BoolSetting notificationSplitheaderHighlight = {
|
|
||||||
"/notifications/enableSplitheaderHighlight", false};
|
|
||||||
|
|
||||||
/// External tools
|
/// External tools
|
||||||
// Streamlink
|
// Streamlink
|
||||||
|
|
|
@ -559,6 +559,18 @@ void ChannelView::setChannel(ChannelPtr newChannel)
|
||||||
if (tc != nullptr) {
|
if (tc != nullptr) {
|
||||||
tc->tabHighlightRequested.connect([this](HighlightState state) {
|
tc->tabHighlightRequested.connect([this](HighlightState state) {
|
||||||
this->tabHighlightRequested.invoke(HighlightState::Notification);
|
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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,12 @@
|
||||||
#include "widgets/helper/EditableModelView.hpp"
|
#include "widgets/helper/EditableModelView.hpp"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QFileDialog>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
@ -35,15 +37,32 @@ NotificationPage::NotificationPage()
|
||||||
settings.append(this->createCheckBox(
|
settings.append(this->createCheckBox(
|
||||||
"Playsound (doesn't mute the Windows 8.x sound of toasts)",
|
"Playsound (doesn't mute the Windows 8.x sound of toasts)",
|
||||||
getApp()->settings->notificationPlaySound));
|
getApp()->settings->notificationPlaySound));
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
settings.append(this->createCheckBox(
|
settings.append(this->createCheckBox(
|
||||||
"Enable toasts (currently only for windows 8.x or 10)",
|
"Enable toasts (currently only for windows 8.x or 10)",
|
||||||
getApp()->settings->notificationToast));
|
getApp()->settings->notificationToast));
|
||||||
|
#endif
|
||||||
settings.append(
|
settings.append(
|
||||||
this->createCheckBox("Red dot next to live splits",
|
this->createCheckBox("Red dot next to live splits",
|
||||||
getApp()->settings->notificationDot));
|
getApp()->settings->notificationDot));
|
||||||
settings.append(this->createCheckBox(
|
auto customSound =
|
||||||
"Change color of Splitheader (click to remove)",
|
layout.emplace<QHBoxLayout>().withoutMargin();
|
||||||
getApp()->settings->notificationSplitheaderHighlight));
|
{
|
||||||
|
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);
|
settings->addStretch(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,7 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||||
getApp()->notifications->updateChannelNotification(
|
getApp()->notifications->updateChannelNotification(
|
||||||
this->split_->getChannel()->getName(), Platform::Twitch);
|
this->split_->getChannel()->getName(), Platform::Twitch);
|
||||||
});
|
});
|
||||||
|
|
||||||
menu->addAction(action);
|
menu->addAction(action);
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
@ -549,21 +550,7 @@ void SplitHeader::themeChangedEvent()
|
||||||
getApp()->resources->buttons.menuLight);
|
getApp()->resources->buttons.menuLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this->titleLabel->setPalette(palette);
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitHeader::menuMoveSplit()
|
void SplitHeader::menuMoveSplit()
|
||||||
|
|
Loading…
Reference in a new issue