File indexing completed on 2024-04-28 16:08:28

0001 // SPDX-FileCopyrightText: 2023 Mathis BrĂ¼chert <mbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #include "note.h"
0006 
0007 #include <QDebug>
0008 
0009 Note::Note(QObject *parent)
0010     : QObject(parent)
0011     , m_sound(0)
0012     , m_volume(50)
0013 {
0014 
0015 }
0016 
0017 int Note::sound() const
0018 {
0019     return m_sound;
0020 }
0021 
0022 void Note::setSound(const int sound)
0023 {
0024     m_sound = sound;
0025     Q_EMIT soundChanged();
0026 
0027     setSoundFile(QUrl(QStringLiteral("qrc:/media/sounds/clicker%1.ogg").arg(sound + 1)));
0028     qDebug() << soundFile();
0029 }
0030 
0031 QUrl Note::soundFile() const
0032 {
0033     return m_soundFile;
0034 }
0035 
0036 void Note::setSoundFile(const QUrl &soundFile)
0037 {
0038     m_soundFile = soundFile;
0039 }
0040 
0041 int Note::volume() const
0042 {
0043     return m_volume;
0044 }
0045 
0046 void Note::setVolume(int volume)
0047 {
0048     m_volume = volume;
0049     Q_EMIT volumeChanged();
0050 }