kalarm
soundpicker.h
Go to the documentation of this file.00001 /* 00002 * soundpicker.h - widget to select a sound file or a beep 00003 * Program: kalarm 00004 * Copyright © 2002,2004-2007 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> 00025 #include <QString> 00026 #include <kurl.h> 00027 00028 #include "preferences.h" 00029 00030 class KHBox; 00031 class ComboBox; 00032 class PushButton; 00033 00034 00035 class SoundPicker : public QFrame 00036 { 00037 Q_OBJECT 00038 public: 00042 explicit SoundPicker(QWidget* parent); 00061 void set(Preferences::SoundType type, const QString& filename, float volume, float fadeVolume, int fadeSeconds, bool repeat); 00063 bool isReadOnly() const { return mReadOnly; } 00067 void setReadOnly(bool readOnly); 00071 void showSpeak(bool show); 00073 Preferences::SoundType sound() const; 00077 KUrl file() const; 00083 float volume(float& fadeVolume, int& fadeSeconds) const; 00087 bool repeat() const; 00089 KUrl fileSetting() const { return mFile; } 00091 bool repeatSetting() const { return mRepeat; } 00100 static QString browseFile(QString& initialDir, const QString& initialFile = QString()); 00101 00102 static QString i18n_label_Sound(); // text of Sound label 00103 static QString i18n_combo_None(); // text of Beep combo box item 00104 static QString i18n_combo_Beep(); // text of Beep combo box item 00105 static QString i18n_combo_Speak(); // text of Speak combo box item 00106 static QString i18n_combo_File(); // text of File combo box item 00107 00108 00109 private slots: 00110 void slotTypeSelected(int id); 00111 void slotPickFile(); 00112 void setLastType(); 00113 00114 private: 00115 ComboBox* mTypeCombo; 00116 KHBox* mTypeBox; 00117 PushButton* mFilePicker; 00118 QString mDefaultDir; 00119 KUrl mFile; // sound file to play when alarm is triggered 00120 float mVolume; // volume for file, or < 0 to not set volume 00121 float mFadeVolume; // initial volume for file, or < 0 for no fading 00122 int mFadeSeconds; // fade interval in seconds 00123 Preferences::SoundType mLastType; // last selected sound option 00124 bool mSpeakShowing; // Speak option is shown in combo box 00125 bool mRevertType; // reverting to last selected sound option 00126 bool mRepeat; // repeat the sound file 00127 bool mReadOnly; 00128 }; 00129 00130 #endif // SOUNDPICKER_H
KDE 4.2 API Reference