Mailcommon

soundtestwidget.h
1/*
2 kmfawidgets.h - KMFilterAction parameter widgets
3 SPDX-FileCopyrightText: 2001 Marc Mutz <mutz@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "mailcommon_private_export.h"
11#include <QWidget>
12
13class QMediaPlayer;
14class QPushButton;
15class KUrlRequester;
16
17namespace MailCommon
18{
19/**
20 * @short A widget to play a sound from a given URL.
21 */
22class MAILCOMMON_TESTS_EXPORT SoundTestWidget : public QWidget
23{
25
26public:
27 /**
28 * Creates a new sound test widget.
29 *
30 * @param parent The parent widget.
31 */
32 explicit SoundTestWidget(QWidget *parent = nullptr);
33
34 /**
35 * Destroys the sound test widget.
36 */
37 ~SoundTestWidget() override;
38
39 /**
40 * Sets the @p url of the sound file to play.
41 */
42 void setUrl(const QString &url);
43
44 /**
45 * Returns the url of the sound file to play.
46 */
47 [[nodiscard]] QString url() const;
48
49 /**
50 * Clears the url of the sound file to play.
51 */
52 void clear();
53
55 /**
56 * This signal is emitted when the user
57 * enters a new URL.
58 */
59 void textChanged(const QString &);
60
61private:
62 void playSound();
63 void openSoundDialog(KUrlRequester *);
64 void slotUrlChanged(const QString &);
65 KUrlRequester *const m_urlRequester;
66 QPushButton *const m_playButton;
67 QMediaPlayer *m_player = nullptr;
68};
69}
SoundTestWidget(QWidget *parent=nullptr)
Creates a new sound test widget.
void setUrl(const QString &url)
Sets the url of the sound file to play.
void textChanged(const QString &)
This signal is emitted when the user enters a new URL.
~SoundTestWidget() override
Destroys the sound test widget.
void clear()
Clears the url of the sound file to play.
QString url() const
Returns the url of the sound file to play.
The filter dialog.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:56:35 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.