kalarm

soundpicker.h

00001 /*
00002  *  soundpicker.h  -  widget to select a sound file or a beep
00003  *  Program:  kalarm
00004  *  Copyright (C) 2002, 2004, 2005 by David Jarvie <software@astrojar.org.uk>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef SOUNDPICKER_H
00022 #define SOUNDPICKER_H
00023 
00024 #include <qframe.h>
00025 #include <qstring.h>
00026 #include <kurl.h>
00027 
00028 class ButtonGroup;
00029 class CheckBox;
00030 class PushButton;
00031 class RadioButton;
00032 
00033 
00034 class SoundPicker : public QFrame
00035 {
00036         Q_OBJECT
00037     public:
00043         enum Type { BEEP = 1, SPEAK, PLAY_FILE };
00048         SoundPicker(QWidget* parent, const char* name = 0);
00068         void           set(bool sound, Type defaultType, const QString& filename, float volume, float fadeVolume, int fadeSeconds, bool repeat);
00070         bool           isReadOnly() const          { return mReadOnly; }
00074         void           setReadOnly(bool readOnly);
00078         void           showSpeak(bool show);
00080         bool           sound() const;
00082         Type           type() const;
00084         bool           beep() const;
00086         bool           speak() const;
00090         QString        file() const;
00096         float          volume(float& fadeVolume, int& fadeSeconds) const;
00100         bool           repeat() const;
00102         QString        fileSetting() const   { return mFile; }
00104         bool           repeatSetting() const { return mRepeat; }
00113         static QString browseFile(QString& initialDir, const QString& initialFile = QString::null);
00114 
00115         static QString i18n_Sound();       // plain text of Sound checkbox
00116         static QString i18n_s_Sound();     // text of Sound checkbox, with 'S' shortcut
00117         static QString i18n_Beep();        // plain text of Beep radio button
00118         static QString i18n_b_Beep();      // text of Beep radio button, with 'B' shortcut
00119         static QString i18n_Speak();       // plain text of Speak radio button
00120         static QString i18n_p_Speak();     // text of Speak radio button, with 'P' shortcut
00121         static QString i18n_File();        // plain text of File radio button
00122 
00123 
00124     private slots:
00125         void           slotSoundToggled(bool on);
00126         void           slotTypeChanged(int id);
00127         void           slotPickFile();
00128         void           setLastType();
00129 
00130     private:
00131 
00132         CheckBox*      mCheckbox;
00133         ButtonGroup*   mTypeGroup;
00134         RadioButton*   mBeepRadio;
00135         RadioButton*   mSpeakRadio;
00136         RadioButton*   mFileRadio;
00137         PushButton*    mFilePicker;
00138         QString        mDefaultDir;
00139         QString        mFile;         // sound file to play when alarm is triggered
00140         float          mVolume;       // volume for file, or < 0 to not set volume
00141         float          mFadeVolume;   // initial volume for file, or < 0 for no fading
00142         int            mFadeSeconds;  // fade interval in seconds
00143         Type           mLastType;     // last selected sound option
00144         bool           mRevertType;   // reverting to last selected sound option
00145         bool           mRepeat;       // repeat the sound file
00146         bool           mReadOnly;
00147 };
00148 
00149 #endif // SOUNDPICKER_H
KDE Home | KDE Accessibility Home | Description of Access Keys