File indexing completed on 2024-05-12 16:27:15
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "playsounddialog.h" 0008 #include "playsoundwidget.h" 0009 #include <KLocalizedString> 0010 #include <QDialogButtonBox> 0011 #include <QVBoxLayout> 0012 0013 PlaySoundDialog::PlaySoundDialog(RocketChatAccount *account, QWidget *parent) 0014 : QDialog(parent) 0015 , mSoundWidget(new PlaySoundWidget(account, this)) 0016 { 0017 setWindowTitle(i18nc("@title:window", "Play Sound")); 0018 auto mainLayout = new QVBoxLayout(this); 0019 mainLayout->setObjectName(QStringLiteral("mainLayout")); 0020 0021 mSoundWidget->setObjectName(QStringLiteral("mSoundWidget")); 0022 mainLayout->addWidget(mSoundWidget); 0023 connect(mSoundWidget, &PlaySoundWidget::updateTitle, this, &PlaySoundDialog::slotUpdateTitle); 0024 0025 auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); 0026 buttonBox->setObjectName(QStringLiteral("button")); 0027 connect(buttonBox, &QDialogButtonBox::rejected, this, &PlaySoundDialog::reject); 0028 mainLayout->addWidget(buttonBox); 0029 } 0030 0031 PlaySoundDialog::~PlaySoundDialog() = default; 0032 0033 void PlaySoundDialog::setAudioPath(const QString &url) 0034 { 0035 mSoundWidget->setAudioPath(url); 0036 } 0037 0038 void PlaySoundDialog::slotUpdateTitle(const QUrl &url) 0039 { 0040 setWindowTitle(i18nc("@title:window", "Sound: %1", url.fileName())); 0041 } 0042 0043 #include "moc_playsounddialog.cpp"