diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch) | |
tree | 2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /noatun-plugins/alarm | |
download | tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun-plugins/alarm')
-rw-r--r-- | noatun-plugins/alarm/Makefile.am | 21 | ||||
-rw-r--r-- | noatun-plugins/alarm/kminutespinbox.cpp | 41 | ||||
-rw-r--r-- | noatun-plugins/alarm/kminutespinbox.h | 38 | ||||
-rw-r--r-- | noatun-plugins/alarm/kpercentspinbox.cpp | 38 | ||||
-rw-r--r-- | noatun-plugins/alarm/kpercentspinbox.h | 33 | ||||
-rw-r--r-- | noatun-plugins/alarm/wakeup.cpp | 373 | ||||
-rw-r--r-- | noatun-plugins/alarm/wakeup.h | 103 | ||||
-rw-r--r-- | noatun-plugins/alarm/wakeup.plugin | 115 |
8 files changed, 762 insertions, 0 deletions
diff --git a/noatun-plugins/alarm/Makefile.am b/noatun-plugins/alarm/Makefile.am new file mode 100644 index 0000000..8d2a928 --- /dev/null +++ b/noatun-plugins/alarm/Makefile.am @@ -0,0 +1,21 @@ +INCLUDES= -I$(kde_includes)/arts $(all_includes) +kde_module_LTLIBRARIES = noatunwakeup.la + +noatunwakeup_la_SOURCES = wakeup.cpp \ + kminutespinbox.cpp \ + kpercentspinbox.cpp + +noatunwakeup_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +noatunwakeup_la_LIBADD = $(LIB_KFILE) -lnoatun -lm + +noatunwakeup_la_METASOURCES = AUTO + +noinst_HEADERS = wakeup.h \ + kminutespinbox.h \ + kpercentspinbox.h + +noatun_DATA = wakeup.plugin +noatundir = $(kde_datadir)/noatun + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/wakeup.pot diff --git a/noatun-plugins/alarm/kminutespinbox.cpp b/noatun-plugins/alarm/kminutespinbox.cpp new file mode 100644 index 0000000..3eac84d --- /dev/null +++ b/noatun-plugins/alarm/kminutespinbox.cpp @@ -0,0 +1,41 @@ +// Copyright (C) 2001 Neil Stevens <[email protected]> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Except as contained in this notice, the name(s) of the author(s) shall not be +// used in advertising or otherwise to promote the sale, use or other dealings +// in this Software without prior written authorization from the author(s). + +#include "kminutespinbox.h" + +KMinuteSpinBox::KMinuteSpinBox(int _step, QWidget *_parent, const char *_name) + : QSpinBox(0, 59, _step, _parent, _name) +{ + setButtonSymbols(PlusMinus); + setWrapping(true); +} + +QString KMinuteSpinBox::mapValueToText(int v) +{ + if(v < 10) + return QString("0%1").arg(v); + else + return QString::number(v); +} + +#include "kminutespinbox.moc" diff --git a/noatun-plugins/alarm/kminutespinbox.h b/noatun-plugins/alarm/kminutespinbox.h new file mode 100644 index 0000000..14e2c4f --- /dev/null +++ b/noatun-plugins/alarm/kminutespinbox.h @@ -0,0 +1,38 @@ +// Copyright (C) 2001 Neil Stevens <[email protected]> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Except as contained in this notice, the name(s) of the author(s) shall not be +// used in advertising or otherwise to promote the sale, use or other dealings +// in this Software without prior written authorization from the author(s). + +#ifndef KMINUTESPINBOX_H +#define KMINUTESPINBOX_H + +#include <qspinbox.h> + +class KMinuteSpinBox : public QSpinBox +{ +Q_OBJECT +public: + KMinuteSpinBox(int _step = 1, QWidget *_parent = 0, const char *_name = 0); +protected: + virtual QString mapValueToText(int v); +}; + +#endif diff --git a/noatun-plugins/alarm/kpercentspinbox.cpp b/noatun-plugins/alarm/kpercentspinbox.cpp new file mode 100644 index 0000000..32b5820 --- /dev/null +++ b/noatun-plugins/alarm/kpercentspinbox.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + kpercentspinbox.cpp - QSpinbox with % + ------------------- + begin : Sun Apr 15 CEST 2001 + copyright: (C) 2001 by Mickael Marchand <[email protected]> + + ***************************************************************************/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "kpercentspinbox.h" + +KPercentSpinBox::KPercentSpinBox(int _step, QWidget *_parent, const char *_name) + : QSpinBox(0, 100, _step, _parent, _name) +{ + setButtonSymbols(PlusMinus); +} + +QString KPercentSpinBox::mapValueToText(int v) +{ + return QString::number(v)+'%'; +} +#if 0 +int KPercentSpinBox::mapTextToValue(bool *ok) +{ + QString mapText= text(); +// mapText.truncate(mapText.length()-1); + + return mapText.toInt(ok); +} +#endif +#include "kpercentspinbox.moc" diff --git a/noatun-plugins/alarm/kpercentspinbox.h b/noatun-plugins/alarm/kpercentspinbox.h new file mode 100644 index 0000000..abcdd49 --- /dev/null +++ b/noatun-plugins/alarm/kpercentspinbox.h @@ -0,0 +1,33 @@ +/*************************************************************************** + kpercentspinbox.h - QSpinbox with % + ------------------- + begin : Sun Apr 15 CEST 2001 + copyright: (C) 2001 by Mickael Marchand <[email protected]> + + ***************************************************************************/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KPERCENT_SPINBOX_H +#define KPERCENT_SPINBOX_H + +#include <qspinbox.h> + +class KPercentSpinBox : public QSpinBox +{ + Q_OBJECT + public: + KPercentSpinBox (int _step=1, QWidget *_parent=0, const char *name=0); + + protected: + virtual QString mapValueToText(int v); +// virtual int mapTextToValue(bool *ok); +}; + +#endif diff --git a/noatun-plugins/alarm/wakeup.cpp b/noatun-plugins/alarm/wakeup.cpp new file mode 100644 index 0000000..648d3e3 --- /dev/null +++ b/noatun-plugins/alarm/wakeup.cpp @@ -0,0 +1,373 @@ +/************************************************************************** + wakeup.cpp - alarm plugin for noatun + ------------------ + begin : Wed Apr 11 CEST 2001 + copyright: (C) 2001 by Mickael Marchand <[email protected]> + + ***************************************************************************/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include <noatun/engine.h> +#include <noatun/player.h> +#include <noatun/app.h> + +#include <klocale.h> +#include <qcheckbox.h> +#include <qlabel.h> +#include <qspinbox.h> +#include <qtimer.h> +#include <qdatetime.h> +#include <qlayout.h> +#include <qvbox.h> +#include <qhbox.h> +#include <qbuttongroup.h> +#include <qradiobutton.h> +#include <qwhatsthis.h> +#include <kiconloader.h> + +#include <kconfig.h> +#include <kglobal.h> +#include "wakeup.h" +#include "kminutespinbox.h" +#include "kpercentspinbox.h" + +extern "C" Plugin *create_plugin() +{ + KGlobal::locale()->insertCatalogue("wakeup"); + return new Wakeup(); +} + +Wakeup *Wakeup::wakeme = 0; + +Wakeup::Wakeup() : QObject(), Plugin() +{ + wakeme = this; + + NOATUNPLUGINC(Wakeup); + new WakeupPrefs(this); + + update(); + + QTimer *timer=new QTimer(this); + connect (timer,SIGNAL(timeout()),SLOT(slotCheckTime())); + timer->start(60000,false); +} + +Wakeup::~Wakeup() +{ +} + +void Wakeup::update() +{ + KConfig *config=KGlobal::config(); + config->setGroup("Noatun Alarm"); + + hour[0]=config->readNumEntry("Hour1",7); + minute[0]=config->readNumEntry("Minute1",0); + hour[1]=config->readNumEntry("Hour2",7); + minute[1]=config->readNumEntry("Minute2",0); + hour[2]=config->readNumEntry("Hour3",7); + minute[2]=config->readNumEntry("Minute3",0); + hour[3]=config->readNumEntry("Hour4",7); + minute[3]=config->readNumEntry("Minute4",0); + hour[4]=config->readNumEntry("Hour5",7); + minute[4]=config->readNumEntry("Minute5",0); + hour[5]=config->readNumEntry("Hour6",7); + minute[5]=config->readNumEntry("Minute6",0); + hour[6]=config->readNumEntry("Hour7",7); + minute[6]=config->readNumEntry("Minute7",0); + + days[0]=config->readBoolEntry("Monday",false); + days[1]=config->readBoolEntry("Tuesday",false); + days[2]=config->readBoolEntry("Wednesday",false); + days[3]=config->readBoolEntry("Thursday",false); + days[4]=config->readBoolEntry("Friday",false); + days[5]=config->readBoolEntry("Saturday",false); + days[6]=config->readBoolEntry("Sunday",false); + + volEndVal=config->readNumEntry("VolumeEnd",80); + modeAlarm=config->readNumEntry("ModeAlarm",0); +// songlist=config->readEntry("List",""); +} + +void Wakeup::slotCheckTime() +{ + QTime t; + QDate d; + + t=QTime::currentTime(); + d=QDate::currentDate(); + + if (t.minute()!=minute[d.dayOfWeek()-1] || t.hour()!=hour[d.dayOfWeek()-1]) return; + + if (days[d.dayOfWeek()-1]) + { + //napp->player()->play(); + PlayerAct(); + } +} + +void Wakeup::PlayerAct() +{ + if (modeAlarm==1 && !napp->player()->isPlaying()) + { + napp->player()->setVolume(0); + } + + if (!napp->player()->isPlaying() && modeAlarm!=2) napp->player()->play(); + + // timer for volume (up/down) according to prefs :-) + volTimer = new QTimer (this); + connect (volTimer,SIGNAL(timeout()), SLOT(slotVolumeChange())); + + volTimer->start(1000,false); // updates volume every seconds + +} + +void Wakeup::slotVolumeChange() +{ + int vol = napp->player()->volume(); + if ( vol >= volEndVal && modeAlarm==1) + { + volTimer->stop(); + return; + } + else if (vol <= 0 && modeAlarm==2) + { + volTimer->stop(); + napp->player()->stop(); + return; + } + else if (modeAlarm==0) + { + volTimer->stop(); + return; + } + + if (modeAlarm==1) + { + napp->player()->setVolume( vol + 1 ); + } + else if (modeAlarm==2) + { + napp->player()->setVolume( vol - 1 ); + } +} + +/////////////////////////////////////////////////////////////////// +// Prefs CModule +/////////////////////////////////////////////////////////////////// +WakeupPrefs::WakeupPrefs( QObject *parent ) : + CModule( i18n("Wakeup"), i18n("Alarm Configuration"), "date", parent ) +{ + QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + QGridLayout *grid = new QGridLayout (layout,8,4); + + monday=new QCheckBox(i18n("Monday"),this); + tuesday=new QCheckBox(i18n("Tuesday"),this); + wednesday=new QCheckBox(i18n("Wednesday"),this); + thursday=new QCheckBox(i18n("Thursday"),this); + friday=new QCheckBox(i18n("Friday"),this); + saturday=new QCheckBox(i18n("Saturday"),this); + sunday=new QCheckBox(i18n("Sunday"),this); + hour1 = new QSpinBox(0, 23, 1, this , "Hour1"); + hour1->setButtonSymbols(QSpinBox::PlusMinus); + minute1 = new KMinuteSpinBox(1, this , "Minute1"); + hour2 = new QSpinBox(0, 23, 1, this, "Hour2"); + hour2->setButtonSymbols(QSpinBox::PlusMinus); + minute2 = new KMinuteSpinBox(1, this, "Minute2"); + hour3 = new QSpinBox(0, 23, 1, this, "Hour3"); + hour3->setButtonSymbols(QSpinBox::PlusMinus); + minute3 = new KMinuteSpinBox(1, this, "Minute3"); + hour4 = new QSpinBox(0, 23, 1, this, "Hour4"); + hour4->setButtonSymbols(QSpinBox::PlusMinus); + minute4 = new KMinuteSpinBox(1, this, "Minute4"); + hour5 = new QSpinBox(0, 23, 1, this, "Hour5"); + hour5->setButtonSymbols(QSpinBox::PlusMinus); + minute5 = new KMinuteSpinBox(1, this, "Minute5"); + hour6 = new QSpinBox(0, 23, 1, this, "Hour6"); + hour6->setButtonSymbols(QSpinBox::PlusMinus); + minute6 = new KMinuteSpinBox(1, this, "Minute6"); + hour7 = new QSpinBox(0, 23, 1, this, "Hour7"); + hour7->setButtonSymbols(QSpinBox::PlusMinus); + minute7 = new KMinuteSpinBox(1, this, "Minute7"); + + QLabel *selectday = new QLabel (i18n("Select days:"),this); + QLabel *choosehour = new QLabel (i18n("Hour"),this); + QLabel *choosemin = new QLabel (i18n("Minute"),this); + grid->addWidget (selectday,0,0,Qt::AlignLeft); + grid->addWidget (choosehour,0,1,Qt::AlignLeft); + grid->addWidget (choosemin,0,2,Qt::AlignLeft); + + applyall = new QPushButton (this,"applyall"); + applyall->setPixmap( BarIcon("down", KIcon::SizeSmall) ); + applyall->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, + QSizePolicy::Fixed, + applyall->sizePolicy().hasHeightForWidth()) ); + grid->addWidget (applyall,1,3,Qt::AlignLeft); + + grid->addWidget (monday,1,0,Qt::AlignLeft); + grid->addWidget (tuesday,2,0,Qt::AlignLeft); + grid->addWidget (wednesday,3,0,Qt::AlignLeft); + grid->addWidget (thursday,4,0,Qt::AlignLeft); + grid->addWidget (friday,5,0,Qt::AlignLeft); + grid->addWidget (saturday,6,0,Qt::AlignLeft); + grid->addWidget (sunday,7,0,Qt::AlignLeft); + grid->addWidget (hour1,1,1,Qt::AlignLeft); + grid->addWidget (hour2,2,1,Qt::AlignLeft); + grid->addWidget (hour3,3,1,Qt::AlignLeft); + grid->addWidget (hour4,4,1,Qt::AlignLeft); + grid->addWidget (hour5,5,1,Qt::AlignLeft); + grid->addWidget (hour6,6,1,Qt::AlignLeft); + grid->addWidget (hour7,7,1,Qt::AlignLeft); + grid->addWidget (minute1,1,2,Qt::AlignLeft); + grid->addWidget (minute2,2,2,Qt::AlignLeft); + grid->addWidget (minute3,3,2,Qt::AlignLeft); + grid->addWidget (minute4,4,2,Qt::AlignLeft); + grid->addWidget (minute5,5,2,Qt::AlignLeft); + grid->addWidget (minute6,6,2,Qt::AlignLeft); + grid->addWidget (minute7,7,2,Qt::AlignLeft); + grid->setColStretch (0,3); + + QButtonGroup *modeGroup = new QButtonGroup (3, Qt::Vertical, i18n ("Volume Control"),this); + alarmmode = new QRadioButton (i18n("No change to volume, just starts the player"),modeGroup); + nightmode = new QRadioButton (i18n("The volume decreases slowly and finally stops the player"),modeGroup); + morningmode = new QRadioButton (i18n("The player starts and the volume increases to the chosen value"),modeGroup); + modeGroup->setExclusive(true); + morningmode->setChecked(true); + + volFrame = new QFrame (this); + QLabel *volEndLabel = new QLabel (i18n("Volume increases to:"), volFrame); + volEndValue = new KPercentSpinBox (1 ,volFrame,"volendvalue"); + + layout->addWidget(modeGroup); + layout->addWidget(volFrame); + layout->addStretch(); + + QHBoxLayout *volLayout = new QHBoxLayout(volFrame, KDialog::marginHint(), KDialog::spacingHint()); + volLayout->addWidget(volEndLabel); + volLayout->addWidget(volEndValue); + volLayout->addStretch(); + + connect (morningmode,SIGNAL(stateChanged(int)),SLOT(slotViewFrame(int))); + connect (applyall,SIGNAL(clicked()),SLOT(slotApplyAll())); + + load(); +} + +void WakeupPrefs::slotApplyAll() +{ + hour2->setValue(hour1->text().toInt()); + hour3->setValue(hour1->text().toInt()); + hour4->setValue(hour1->text().toInt()); + hour5->setValue(hour1->text().toInt()); + hour6->setValue(hour1->text().toInt()); + hour7->setValue(hour1->text().toInt()); + minute2->setValue(minute1->text().toInt()); + minute3->setValue(minute1->text().toInt()); + minute4->setValue(minute1->text().toInt()); + minute5->setValue(minute1->text().toInt()); + minute6->setValue(minute1->text().toInt()); + minute7->setValue(minute1->text().toInt()); +} + +void WakeupPrefs::slotViewFrame(int state) +{ + if (state==2) volFrame->show(); + else volFrame->hide(); +} + +void WakeupPrefs::save() +{ + KConfig *config=KGlobal::config(); + config->setGroup("Noatun Alarm"); + config->writeEntry("Monday",monday->isChecked()); + config->writeEntry("Tuesday",tuesday->isChecked()); + config->writeEntry("Wednesday",wednesday->isChecked()); + config->writeEntry("Thursday",thursday->isChecked()); + config->writeEntry("Friday",friday->isChecked()); + config->writeEntry("Saturday",saturday->isChecked()); + config->writeEntry("Sunday",sunday->isChecked()); + config->writeEntry("Hour1",hour1->text()); + config->writeEntry("Minute1",minute1->text()); + config->writeEntry("Hour2",hour2->text()); + config->writeEntry("Minute2",minute2->text()); + config->writeEntry("Hour3",hour3->text()); + config->writeEntry("Minute3",minute3->text()); + config->writeEntry("Hour4",hour4->text()); + config->writeEntry("Minute4",minute4->text()); + config->writeEntry("Hour5",hour5->text()); + config->writeEntry("Minute5",minute5->text()); + config->writeEntry("Hour6",hour6->text()); + config->writeEntry("Minute6",minute6->text()); + config->writeEntry("Hour7",hour7->text()); + config->writeEntry("Minute7",minute7->text()); + QString val(volEndValue->text()); + config->writeEntry("VolumeEnd",val); + + if (nightmode->isChecked()) config->writeEntry("ModeAlarm",2); + else if (morningmode->isChecked()) config->writeEntry("ModeAlarm",1); + else config->writeEntry("ModeAlarm", 0); + + config->sync(); + + Wakeup *wake = Wakeup::wakeme; + if (wake) wake->update(); +} + +void WakeupPrefs::load() +{ + KGlobal::config()->setGroup("Noatun Alarm"); + monday->setChecked(KGlobal::config()->readBoolEntry("Monday",false)); + tuesday->setChecked(KGlobal::config()->readBoolEntry("Tuesday",false)); + wednesday->setChecked(KGlobal::config()->readBoolEntry("Wednesday",false)); + thursday->setChecked(KGlobal::config()->readBoolEntry("Thursday",false)); + friday->setChecked(KGlobal::config()->readBoolEntry("Friday",false)); + saturday->setChecked(KGlobal::config()->readBoolEntry("Saturday",false)); + sunday->setChecked(KGlobal::config()->readBoolEntry("Sunday",false)); + + hour1->setValue(KGlobal::config()->readNumEntry("Hour1",7)); + minute1->setValue(KGlobal::config()->readNumEntry("Minute1",0)); + hour2->setValue(KGlobal::config()->readNumEntry("Hour2",7)); + minute2->setValue(KGlobal::config()->readNumEntry("Minute2",0)); + hour3->setValue(KGlobal::config()->readNumEntry("Hour3",7)); + minute3->setValue(KGlobal::config()->readNumEntry("Minute3",0)); + hour4->setValue(KGlobal::config()->readNumEntry("Hour4",7)); + minute4->setValue(KGlobal::config()->readNumEntry("Minute4",0)); + hour5->setValue(KGlobal::config()->readNumEntry("Hour5",7)); + minute5->setValue(KGlobal::config()->readNumEntry("Minute5",0)); + hour6->setValue(KGlobal::config()->readNumEntry("Hour6",7)); + minute6->setValue(KGlobal::config()->readNumEntry("Minute6",0)); + hour7->setValue(KGlobal::config()->readNumEntry("Hour7",7)); + minute7->setValue(KGlobal::config()->readNumEntry("Minute7",0)); + + QString volend(KGlobal::config()->readEntry("VolumeEnd","80%")); + volend.truncate(volend.length()-1); + + volEndValue->setValue(volend.toInt()); + + switch (KGlobal::config()->readNumEntry("ModeAlarm",0)) + { + case 0: + alarmmode->setChecked(true); + break; + case 1: + morningmode->setChecked(true); + break; + case 2: + nightmode->setChecked(true); + break; + default: + alarmmode->setChecked(true); + } +} + +#include "wakeup.moc" diff --git a/noatun-plugins/alarm/wakeup.h b/noatun-plugins/alarm/wakeup.h new file mode 100644 index 0000000..e2992a8 --- /dev/null +++ b/noatun-plugins/alarm/wakeup.h @@ -0,0 +1,103 @@ +/*************************************************************************** + wakeup.h - alarm plugin for noatun + ------------------- + begin : Wed Apr 11 CEST 2000 + copyright: (C) 2001 by Mickael Marchand <[email protected]> + + ***************************************************************************/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef WAKEUP_H +#define WAKEUP_H + +#include <noatun/pref.h> +#include <noatun/plugin.h> +#include <qradiobutton.h> +#include <qbuttongroup.h> +#include <qpushbutton.h> + +class QSpinBox; +class QCheckBox; +class KMinuteSpinBox; +class KPercentSpinBox; + +class Wakeup : public QObject, public Plugin +{ + Q_OBJECT + NOATUNPLUGIND + +public: + Wakeup(); + ~Wakeup(); + static Wakeup *wakeme; + void PlayerAct(); + void update(); + +public slots: + void slotVolumeChange(); + void slotCheckTime(); + +private: + QStringList *day_list; +// QString songlist; + int hour[7]; + int minute[7]; + bool days[7]; + QTimer *volTimer; + int volEndVal; + int modeAlarm; +}; + + +class WakeupPrefs : public CModule +{ + Q_OBJECT + +public: + WakeupPrefs( QObject *parent ); + virtual void save(); + virtual void load(); +public slots: + void slotViewFrame(int); + void slotApplyAll(); + +private: + QCheckBox *monday; + QCheckBox *tuesday; + QCheckBox *wednesday; + QCheckBox *thursday; + QCheckBox *friday; + QCheckBox *saturday; + QCheckBox *sunday; + KMinuteSpinBox *minute1; + KMinuteSpinBox *minute2; + KMinuteSpinBox *minute3; + KMinuteSpinBox *minute4; + KMinuteSpinBox *minute5; + KMinuteSpinBox *minute6; + KMinuteSpinBox *minute7; + QSpinBox *hour1; + QSpinBox *hour2; + QSpinBox *hour3; + QSpinBox *hour4; + QSpinBox *hour5; + QSpinBox *hour6; + QSpinBox *hour7; + + KPercentSpinBox *volEndValue; + QRadioButton *alarmmode; + QRadioButton *morningmode; + QRadioButton *nightmode; + QFrame *volFrame; + QPushButton *applyall; +}; + +#endif // WAKEUP_H diff --git a/noatun-plugins/alarm/wakeup.plugin b/noatun-plugins/alarm/wakeup.plugin new file mode 100644 index 0000000..8a851c5 --- /dev/null +++ b/noatun-plugins/alarm/wakeup.plugin @@ -0,0 +1,115 @@ +Filename=noatunwakeup.la +Author=Mickael Marchand +Site=http://www.freenux.org/ +Type=other +License=GPL +Name=WakeUp +Name[af]=Word wakker +Name[ar]=استيقظ +Name[az]=Oyan +Name[cs]=Budíček +Name[cy]=Deffro +Name[da]=VågnOp +Name[de]=Wecker +Name[el]=Ξύπνησε +Name[eo]=Vekilo +Name[es]=Despertador +Name[et]=Ärataja +Name[fa]=بیدار شدن +Name[fi]=Herätys +Name[fr]=Réveil +Name[fy]=Wekker +Name[he]=התעורר +Name[hi]=वेक-अप +Name[hr]=Buđenje +Name[it]=Sveglia +Name[ka]=გაღვიძება +Name[kk]=Ояту +Name[km]=ភ្ញាក់ឡើង +Name[lt]=Žadintuvas +Name[mk]=РазбудиСе +Name[nb]=Våknopp +Name[nds]=Weckklock +Name[ne]=जगाउनु +Name[nl]=Wekker +Name[nn]=Vakn-opp +Name[nso]=Tsoga +Name[pa]=ਜਗਾਉ +Name[pl]=Budzenie +Name[ro]=Deşteptător +Name[ru]=Пробуждение +Name[sl]=Zbudi se +Name[sv]=Väckarklocka +Name[ta]=எழுந்திருத்தல் +Name[tg]=Бедоршавӣ +Name[tr]=Uyan +Name[uk]=Пробудження +Name[uz]=Uygʻotish +Name[uz@cyrillic]=Уйғотиш +Name[vi]=Dậy đi +Name[xh]=Vuka +Name[zh_CN]=醒来 +Comment=A simple, customizable alarm +Comment[af]='n eenvoudige, pakmaakbaar alarm +Comment[ar]=منبه بسيط قابل للتخصيص +Comment[az]=Bəsit bir alarm +Comment[bg]=Проста и лесна за настройване аларма за събуждане сутрин +Comment[bs]=Jednostavan, lagan za podešavanje alarm +Comment[ca]=Una alarma senzilla i personalitzable +Comment[cs]=Jednoduchý, přizpůsobitelný alarm +Comment[cy]=Alarwm syml addasadwy +Comment[da]=En simpel, brugerdefinérbar alarm +Comment[de]=Ein einfacher, anpassbarer Wecker +Comment[el]=Ένα απλό, ρυθμιζόμενο ξυπνητήρι +Comment[en_GB]=A simple, customisable alarm +Comment[eo]=Simpla, proprebla alarmilo +Comment[es]=Una alarma sencilla y personalizable +Comment[et]=Lihtne kohandatav ärataja +Comment[eu]=Alarma erraz eta pertsonalizatua +Comment[fa]=یک هشدار قابل سفارش و ساده +Comment[fi]=Yksinkertainen herätysohjelma +Comment[fr]=Une alarme simple personnalisable +Comment[fy]=In ienfâldich yn te stellen alaarm +Comment[ga]=Aláram simplí, in-saincheaptha +Comment[gl]=Unha alarma simples e configurábel +Comment[he]=תזכורת פשוטה הניתנת להתאמה אישית +Comment[hi]=एक साधारण, कस्टमाइजेबल अलार्म +Comment[hr]=Jednostavan i prilagodljiv alarm +Comment[hu]=Egyszerű, testreszabható emlékeztetés +Comment[is]=Einfaldur og stillanlegur vekjari +Comment[it]=Un allarme semplice e personalizzabile +Comment[ja]=シンプルでカスタマイズ可能なアラーム +Comment[ka]=მარტივი მორგებადი მაღვიძარა +Comment[kk]=Қарапайым, бапталатын оятқыш +Comment[km]=សំឡេងរោទ៍ដែលអាចប្ដូរតាមបំណងធម្មតាមួយ +Comment[lt]=Paprastas, derinamas, žadintuvas +Comment[mk]=Едноставен приспособлив аларм +Comment[ms]=Jam loceng mudah selenggara +Comment[nb]=En enkel vekkeklokke som kan tilpasses +Comment[nds]=En eenfache Weckklock mit mennige Instellen +Comment[ne]=एउटा सामान्य, अनुकूलनयोग्य संसूचक +Comment[nl]=Een eenvoudig in te stellen alarm +Comment[nn]=Ei enkel vekkjarklokke som kan tilpassast +Comment[nso]=Alamo ye bonolo, yago amanyega +Comment[pa]=ਛੋਟਾ ਜਿਹਾ, ਆਸਾਨ ਅਲਾਰਮ +Comment[pl]=Prosty budzik +Comment[pt]=Um alarme simples e configurável +Comment[pt_BR]=Um alarme simples e personalizável +Comment[ro]=O aplicaţie de alarmare simplă şi personalizabilă +Comment[ru]=Простой будильник с различными настройками +Comment[sk]=Jednoduchý, nastaviteľný alarm +Comment[sl]=Preprost prilagodljiv alarm +Comment[sr]=Једноставан, прилагодљив аларм +Comment[sr@Latn]=Jednostavan, prilagodljiv alarm +Comment[sv]=Enkel anpassningsbar väckarklocka +Comment[ta]=எளிய, தனிப்பயனாக்கு எச்சரிக்கை மணி +Comment[tg]=Огоҳкунаки оддӣ бо танзимотҳои гуногун +Comment[tr]=Basit, ayarlanabilir bir alarm +Comment[uk]=Простий будильник з різноманітними параметрами +Comment[uz]=Oddiy ogohlantirgich +Comment[uz@cyrillic]=Оддий огоҳлантиргич +Comment[vi]=Đồng hồ báo thức đơn giản có thể tùy chỉnh +Comment[xh]=I alamu elula, yokwenza into ngokwemfuneko +Comment[zh_CN]=一个简单的可定制的闹钟 +Comment[zh_TW]=一個簡單可調整的鬧鐘 |