kalarm

soundpicker.h

00001 /*
00002  *  soundpicker.h  -  widget to select a sound file or a beep
00003  *  Program:  kalarm
00004  *  Copyright © 2002,2004-2006 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 QHBox;
00029 class ComboBox;
00030 class PushButton;
00031 
00032 
00033 class SoundPicker : public QFrame
00034 {
00035         Q_OBJECT
00036     public:
00043         enum Type { NONE = 0, BEEP, PLAY_FILE, SPEAK };
00048         SoundPicker(QWidget* parent, const char* name = 0);
00067         void           set(Type type, const QString& filename, float volume, float fadeVolume, int fadeSeconds, bool repeat);
00069         bool           isReadOnly() const          { return mReadOnly; }
00073         void           setReadOnly(bool readOnly);
00077         void           showSpeak(bool show);
00079         Type           sound() const;
00083         QString        file() const;
00089         float          volume(float& fadeVolume, int& fadeSeconds) const;
00093         bool           repeat() const;
00095         QString        fileSetting() const   { return mFile; }
00097         bool           repeatSetting() const { return mRepeat; }
00106         static QString browseFile(QString& initialDir, const QString& initialFile = QString::null);
00107 
00108         static QString i18n_Sound();       // plain text of Sound label
00109         static QString i18n_None();        // plain text of None combo box item
00110         static QString i18n_Beep();        // plain text of Beep combo box item
00111         static QString i18n_Speak();       // plain text of Speak combo box item
00112         static QString i18n_File();        // plain text of File combo box item
00113 
00114 
00115     private slots:
00116         void           slotTypeSelected(int id);
00117         void           slotPickFile();
00118 
00119     private:
00120 
00121         ComboBox*      mTypeCombo;
00122         QHBox*         mTypeBox;
00123         PushButton*    mFilePicker;
00124         QString        mDefaultDir;
00125         QString        mFile;         // sound file to play when alarm is triggered
00126         float          mVolume;       // volume for file, or < 0 to not set volume
00127         float          mFadeVolume;   // initial volume for file, or < 0 for no fading
00128         int            mFadeSeconds;  // fade interval in seconds
00129         Type           mLastType;     // last selected sound option
00130         bool           mSpeakShowing; // Speak option is shown in combo box
00131         bool           mRepeat;       // repeat the sound file
00132         bool           mReadOnly;
00133 };
00134 
00135 #endif // SOUNDPICKER_H
KDE Home | KDE Accessibility Home | Description of Access Keys