File indexing completed on 2024-09-22 04:50:06
0001 /* 0002 kmfawidgets.h - KMFilterAction parameter widgets 0003 SPDX-FileCopyrightText: 2001 Marc Mutz <mutz@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <QWidget> 0011 0012 namespace Phonon 0013 { 0014 class MediaObject; 0015 } 0016 0017 class QPushButton; 0018 class KUrlRequester; 0019 0020 namespace MailCommon 0021 { 0022 /** 0023 * @short A widget to play a sound from a given URL. 0024 */ 0025 class SoundTestWidget : public QWidget 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 /** 0031 * Creates a new sound test widget. 0032 * 0033 * @param parent The parent widget. 0034 */ 0035 explicit SoundTestWidget(QWidget *parent = nullptr); 0036 0037 /** 0038 * Destroys the sound test widget. 0039 */ 0040 ~SoundTestWidget() override; 0041 0042 /** 0043 * Sets the @p url of the sound file to play. 0044 */ 0045 void setUrl(const QString &url); 0046 0047 /** 0048 * Returns the url of the sound file to play. 0049 */ 0050 [[nodiscard]] QString url() const; 0051 0052 /** 0053 * Clears the url of the sound file to play. 0054 */ 0055 void clear(); 0056 0057 Q_SIGNALS: 0058 /** 0059 * This signal is emitted when the user 0060 * enters a new URL. 0061 */ 0062 void textChanged(const QString &); 0063 0064 private: 0065 void playSound(); 0066 void openSoundDialog(KUrlRequester *); 0067 void slotUrlChanged(const QString &); 0068 KUrlRequester *const m_urlRequester; 0069 QPushButton *const m_playButton; 0070 Phonon::MediaObject *m_player = nullptr; 0071 }; 0072 }