• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.14
  • kdepim
  • kalarm
sounddlg.h
Go to the documentation of this file.
1 /*
2  * sounddlg.h - sound file selection and configuration dialog and widget
3  * Program: kalarm
4  * Copyright © 2005-2007,2009-2012 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef SOUNDDLG_H
22 #define SOUNDDLG_H
23 
24 #include <kurl.h>
25 #include <kdialog.h>
26 #include <QString>
27 
28 class QPushButton;
29 class QShowEvent;
30 class QResizeEvent;
31 class KHBox;
32 namespace Phonon { class MediaObject; }
33 class GroupBox;
34 class PushButton;
35 class CheckBox;
36 class SpinBox;
37 class Slider;
38 class LineEdit;
39 
40 
41 class SoundWidget : public QWidget
42 {
43  Q_OBJECT
44  public:
45  SoundWidget(bool showPlay, bool showRepeat, QWidget* parent);
46  ~SoundWidget();
47  void set(const QString& file, float volume, float fadeVolume = -1, int fadeSeconds = 0, int repeatPause = -1);
48  void setReadOnly(bool);
49  bool isReadOnly() const { return mReadOnly; }
50  void setAllowEmptyFile() { mEmptyFileAllowed = true; }
51  QString fileName() const;
52  bool file(KUrl&, bool showErrorMessage = true) const;
53  void getVolume(float& volume, float& fadeVolume, int& fadeSeconds) const;
54  int repeatPause() const; // -1 if none, else seconds between repeats
55  QString defaultDir() const { return mDefaultDir; }
56  bool validate(bool showErrorMessage) const;
57 
58  static QString i18n_chk_Repeat(); // text of Repeat checkbox
59 
60  signals:
61  void changed(); // emitted whenever any contents change
62 
63  protected:
64  virtual void showEvent(QShowEvent*);
65  virtual void resizeEvent(QResizeEvent*);
66 
67  private slots:
68  void slotPickFile();
69  void slotVolumeToggled(bool on);
70  void slotFadeToggled(bool on);
71  void playSound();
72  void playFinished();
73 
74  private:
75  static QString mDefaultDir; // current default directory for mFileEdit
76  QPushButton* mFilePlay;
77  LineEdit* mFileEdit;
78  PushButton* mFileBrowseButton;
79  GroupBox* mRepeatGroupBox;
80  SpinBox* mRepeatPause;
81  CheckBox* mVolumeCheckbox;
82  Slider* mVolumeSlider;
83  CheckBox* mFadeCheckbox;
84  KHBox* mFadeBox;
85  SpinBox* mFadeTime;
86  KHBox* mFadeVolumeBox;
87  Slider* mFadeSlider;
88  mutable KUrl mUrl;
89  mutable QString mValidatedFile;
90  Phonon::MediaObject* mPlayer;
91  bool mReadOnly;
92  bool mEmptyFileAllowed;
93 };
94 
95 
96 class SoundDlg : public KDialog
97 {
98  Q_OBJECT
99  public:
100  SoundDlg(const QString& file, float volume, float fadeVolume, int fadeSeconds, int repeatPause,
101  const QString& caption, QWidget* parent);
102  void setReadOnly(bool);
103  bool isReadOnly() const { return mReadOnly; }
104  KUrl getFile() const;
105  void getVolume(float& volume, float& fadeVolume, int& fadeSeconds) const
106  { mSoundWidget->getVolume(volume, fadeVolume, fadeSeconds); }
107  int repeatPause() const { return mSoundWidget->repeatPause(); }
108  QString defaultDir() const { return mSoundWidget->defaultDir(); }
109 
110  protected:
111  virtual void resizeEvent(QResizeEvent*);
112 
113  protected slots:
114  virtual void slotButtonClicked(int button);
115 
116  private:
117  SoundWidget* mSoundWidget;
118  bool mReadOnly;
119 };
120 
121 #endif
122 
123 // vim: et sw=4:
SoundWidget::changed
void changed()
QResizeEvent
QWidget
SoundWidget::repeatPause
int repeatPause() const
Definition: sounddlg.cpp:385
SoundWidget::validate
bool validate(bool showErrorMessage) const
Definition: sounddlg.cpp:461
SoundWidget::getVolume
void getVolume(float &volume, float &fadeVolume, int &fadeSeconds) const
Definition: sounddlg.cpp:366
SoundDlg::isReadOnly
bool isReadOnly() const
Definition: sounddlg.h:103
SoundWidget::showEvent
virtual void showEvent(QShowEvent *)
Definition: sounddlg.cpp:400
SoundDlg::resizeEvent
virtual void resizeEvent(QResizeEvent *)
Definition: sounddlg.cpp:111
SoundWidget::defaultDir
QString defaultDir() const
Definition: sounddlg.h:55
SoundDlg::getFile
KUrl getFile() const
Definition: sounddlg.cpp:100
SoundDlg::defaultDir
QString defaultDir() const
Definition: sounddlg.h:108
SoundWidget::file
bool file(KUrl &, bool showErrorMessage=true) const
Definition: sounddlg.cpp:354
SoundWidget::resizeEvent
virtual void resizeEvent(QResizeEvent *)
Definition: sounddlg.cpp:394
KDialog
SoundWidget::i18n_chk_Repeat
static QString i18n_chk_Repeat()
Definition: sounddlg.cpp:53
SoundWidget::setAllowEmptyFile
void setAllowEmptyFile()
Definition: sounddlg.h:50
SoundDlg::getVolume
void getVolume(float &volume, float &fadeVolume, int &fadeSeconds) const
Definition: sounddlg.h:105
PushButton
SoundDlg::SoundDlg
SoundDlg(const QString &file, float volume, float fadeVolume, int fadeSeconds, int repeatPause, const QString &caption, QWidget *parent)
Definition: sounddlg.cpp:58
SoundWidget::SoundWidget
SoundWidget(bool showPlay, bool showRepeat, QWidget *parent)
Definition: sounddlg.cpp:141
SoundWidget::set
void set(const QString &file, float volume, float fadeVolume=-1, int fadeSeconds=0, int repeatPause=-1)
Definition: sounddlg.cpp:306
SoundDlg::repeatPause
int repeatPause() const
Definition: sounddlg.h:107
LineEdit
CheckBox
QShowEvent
Phonon::MediaObject
SoundWidget::~SoundWidget
~SoundWidget()
Definition: sounddlg.cpp:297
SoundWidget
Definition: sounddlg.h:41
SoundDlg::setReadOnly
void setReadOnly(bool)
Definition: sounddlg.cpp:81
QString
SoundWidget::fileName
QString fileName() const
Definition: sounddlg.cpp:346
SoundDlg
Definition: sounddlg.h:96
SpinBox
GroupBox
SoundWidget::setReadOnly
void setReadOnly(bool)
Definition: sounddlg.cpp:326
QPushButton
KHBox
Slider
QObject::parent
QObject * parent() const
SoundWidget::isReadOnly
bool isReadOnly() const
Definition: sounddlg.h:49
SoundDlg::slotButtonClicked
virtual void slotButtonClicked(int button)
Definition: sounddlg.cpp:121
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal