Mailcommon

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

KDE's Doxygen guidelines are available online.