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  Q_REQUIRED_RESULT 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 clicked
60  * the Play button.
61  */
62  void testPressed();
63 
64  /**
65  * This signal is emitted when the user
66  * enters a new URL.
67  */
68  void textChanged(const QString &);
69 
70 private:
71  void playSound();
72  void openSoundDialog(KUrlRequester *);
73  void slotUrlChanged(const QString &);
74  KUrlRequester *const m_urlRequester;
75  QPushButton *const m_playButton;
76  Phonon::MediaObject *m_player = nullptr;
77 };
78 }
Q_OBJECTQ_OBJECT
void clear()
Clears the url of the sound file to play.
A widget to play a sound from a given URL.
void testPressed()
This signal is emitted when the user clicked the Play button.
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-2022 The KDE developers.
Generated on Sat Sep 24 2022 03:58:15 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.