diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-22 18:23:26 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-22 18:23:26 +0000 |
commit | ae364d9bed0589bf1a22cd5f530c563462379e3e (patch) | |
tree | e32727e2664e7ce68d0d30270afa040320ae35a1 /kradio3/plugins/timecontrol | |
download | tderadio-ae364d9bed0589bf1a22cd5f530c563462379e3e.tar.gz tderadio-ae364d9bed0589bf1a22cd5f530c563462379e3e.zip |
Added old KDE3 version of kradio
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kradio@1094417 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kradio3/plugins/timecontrol')
19 files changed, 1642 insertions, 0 deletions
diff --git a/kradio3/plugins/timecontrol/Makefile.am b/kradio3/plugins/timecontrol/Makefile.am new file mode 100644 index 0000000..0ac954f --- /dev/null +++ b/kradio3/plugins/timecontrol/Makefile.am @@ -0,0 +1,17 @@ +SUBDIRS = po icons . + +INCLUDES = $(all_includes) +METASOURCES = AUTO + +libkradio_LTLIBRARIES = libtimecontrol.la +libtimecontrol_la_SOURCES = timecontrol-configuration.cpp \ + timecontrol-configuration-ui.ui timecontrol.cpp +libtimecontrol_la_LDFLAGS = -module -avoid-version $(KDE_RPATH) $(all_libraries) +noinst_HEADERS = timecontrol-configuration.h timecontrol.h + +#messages: rc.cpp +# $(XGETTEXT) *.cpp *.h -o po/kradio-timecontrol.pot + +messages: rc.cpp + $(EXTRACTRC) *.rc *.ui >> rc.cpp + $(XGETTEXT) rc.cpp *.h *.cpp -o po/kradio-timecontrol.pot diff --git a/kradio3/plugins/timecontrol/icons/Makefile.am b/kradio3/plugins/timecontrol/icons/Makefile.am new file mode 100644 index 0000000..b3f2583 --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/Makefile.am @@ -0,0 +1,2 @@ +icons_ICON = AUTO +iconsdir = $(kde_datadir)/kradio/icons diff --git a/kradio3/plugins/timecontrol/icons/hi16-action-kradio_kalarm.png b/kradio3/plugins/timecontrol/icons/hi16-action-kradio_kalarm.png Binary files differnew file mode 100644 index 0000000..d87e1c4 --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi16-action-kradio_kalarm.png diff --git a/kradio3/plugins/timecontrol/icons/hi16-action-kradio_zzz.png b/kradio3/plugins/timecontrol/icons/hi16-action-kradio_zzz.png Binary files differnew file mode 100644 index 0000000..c7184d5 --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi16-action-kradio_zzz.png diff --git a/kradio3/plugins/timecontrol/icons/hi22-action-kradio_kalarm.png b/kradio3/plugins/timecontrol/icons/hi22-action-kradio_kalarm.png Binary files differnew file mode 100644 index 0000000..874fa0a --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi22-action-kradio_kalarm.png diff --git a/kradio3/plugins/timecontrol/icons/hi22-action-kradio_zzz.png b/kradio3/plugins/timecontrol/icons/hi22-action-kradio_zzz.png Binary files differnew file mode 100644 index 0000000..f2184dd --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi22-action-kradio_zzz.png diff --git a/kradio3/plugins/timecontrol/icons/hi32-action-kradio_kalarm.png b/kradio3/plugins/timecontrol/icons/hi32-action-kradio_kalarm.png Binary files differnew file mode 100644 index 0000000..5547387 --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi32-action-kradio_kalarm.png diff --git a/kradio3/plugins/timecontrol/icons/hi32-action-kradio_zzz.png b/kradio3/plugins/timecontrol/icons/hi32-action-kradio_zzz.png Binary files differnew file mode 100644 index 0000000..5ddb326 --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi32-action-kradio_zzz.png diff --git a/kradio3/plugins/timecontrol/icons/hi330-action-kradio_zzz.png b/kradio3/plugins/timecontrol/icons/hi330-action-kradio_zzz.png Binary files differnew file mode 100644 index 0000000..bb4b6e3 --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi330-action-kradio_zzz.png diff --git a/kradio3/plugins/timecontrol/icons/hi48-action-kradio_kalarm.png b/kradio3/plugins/timecontrol/icons/hi48-action-kradio_kalarm.png Binary files differnew file mode 100644 index 0000000..c3b8dd5 --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi48-action-kradio_kalarm.png diff --git a/kradio3/plugins/timecontrol/icons/hi48-action-kradio_zzz.png b/kradio3/plugins/timecontrol/icons/hi48-action-kradio_zzz.png Binary files differnew file mode 100644 index 0000000..d443b05 --- /dev/null +++ b/kradio3/plugins/timecontrol/icons/hi48-action-kradio_zzz.png diff --git a/kradio3/plugins/timecontrol/po/Makefile.am b/kradio3/plugins/timecontrol/po/Makefile.am new file mode 100644 index 0000000..35fe6fd --- /dev/null +++ b/kradio3/plugins/timecontrol/po/Makefile.am @@ -0,0 +1,2 @@ +PACKAGE = kradio-timecontrol +POFILES = AUTO diff --git a/kradio3/plugins/timecontrol/po/de.po b/kradio3/plugins/timecontrol/po/de.po new file mode 100644 index 0000000..71a84f6 --- /dev/null +++ b/kradio3/plugins/timecontrol/po/de.po @@ -0,0 +1,129 @@ +# translation of de.po to +# translation of kradio-timecontrol.po to +# This file is put in the public domain. +# +# Ernst Martin Witte <emw@nocabal.de>, 2006. +msgid "" +msgstr "" +"Project-Id-Version: de\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2006-11-11 18:43+0100\n" +"PO-Revision-Date: 2006-11-06 01:16+0100\n" +"Last-Translator: Ernst Martin Witte <emw@nocabal.de>\n" +"Language-Team: <de@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. i18n: file timecontrol-configuration-ui.ui line 32 +#: rc.cpp:3 rc.cpp:68 timecontrol-configuration-ui.cpp:189 +#, no-c-format +msgid "sleep countdown" +msgstr "Schlummermodus" + +#. i18n: file timecontrol-configuration-ui.ui line 40 +#: rc.cpp:6 rc.cpp:71 timecontrol-configuration-ui.cpp:190 +#, no-c-format +msgid " min" +msgstr " min" + +#. i18n: file timecontrol-configuration-ui.ui line 117 +#: rc.cpp:9 rc.cpp:74 timecontrol-configuration-ui.cpp:191 timecontrol.cpp:270 +#, no-c-format +msgid "Alarms" +msgstr "Wecker" + +#. i18n: file timecontrol-configuration-ui.ui line 180 +#: rc.cpp:14 rc.cpp:79 timecontrol-configuration-ui.cpp:194 +#, no-c-format +msgid "Date" +msgstr "Datum" + +#. i18n: file timecontrol-configuration-ui.ui line 203 +#: rc.cpp:17 rc.cpp:82 timecontrol-configuration-ui.cpp:195 +#, no-c-format +msgid "Time" +msgstr "Uhrzeit" + +#. i18n: file timecontrol-configuration-ui.ui line 226 +#: rc.cpp:20 rc.cpp:85 timecontrol-configuration-ui.cpp:196 +#, no-c-format +msgid "Volume" +msgstr "Lautstärke" + +#. i18n: file timecontrol-configuration-ui.ui line 234 +#: rc.cpp:23 rc.cpp:88 timecontrol-configuration-ui.cpp:197 +#, no-c-format +msgid " %" +msgstr " %" + +#. i18n: file timecontrol-configuration-ui.ui line 263 +#: rc.cpp:26 rc.cpp:91 timecontrol-configuration-ui.cpp:198 +#, no-c-format +msgid "enabled" +msgstr "aktiv" + +#. i18n: file timecontrol-configuration-ui.ui line 331 +#: rc.cpp:50 rc.cpp:115 timecontrol-configuration-ui.cpp:207 +#, no-c-format +msgid "daily" +msgstr "täglich" + +#. i18n: file timecontrol-configuration-ui.ui line 341 +#: rc.cpp:53 rc.cpp:118 timecontrol-configuration-ui.cpp:208 +#, no-c-format +msgid "Radio Station" +msgstr "Sender" + +#. i18n: file timecontrol-configuration-ui.ui line 393 +#: rc.cpp:56 rc.cpp:121 timecontrol-configuration-ui.cpp:210 +#, no-c-format +msgid "Start Playing" +msgstr "Radio einschalten" + +#. i18n: file timecontrol-configuration-ui.ui line 401 +#: rc.cpp:59 rc.cpp:124 timecontrol-configuration-ui.cpp:211 +#, no-c-format +msgid "Stop Playing" +msgstr "Radio ausschalten" + +#. i18n: file timecontrol-configuration-ui.ui line 409 +#: rc.cpp:62 rc.cpp:127 timecontrol-configuration-ui.cpp:212 +#, no-c-format +msgid "Start Recording" +msgstr "Aufnahme starten" + +#. i18n: file timecontrol-configuration-ui.ui line 417 +#: rc.cpp:65 rc.cpp:130 timecontrol-configuration-ui.cpp:213 +#, no-c-format +msgid "Stop Recording" +msgstr "Aufnahme beenden" + +#: _translatorinfo.cpp:1 +msgid "" +"_: NAME OF TRANSLATORS\n" +"Your names" +msgstr "Ernst Martin Witte" + +#: _translatorinfo.cpp:3 +msgid "" +"_: EMAIL OF TRANSLATORS\n" +"Your emails" +msgstr "emw@nocabal.de" + +#: timecontrol-configuration.cpp:181 +msgid "<don't change>" +msgstr "<nicht verändern>" + +#: timecontrol.cpp:42 +msgid "Time Control and Alarm Functions" +msgstr "Zeitsteurungs- und Weckfunktionen" + +#: timecontrol.cpp:48 +msgid "TimeControl Plugin" +msgstr "Zeitsteuerungs-Plugin" + +#: timecontrol.cpp:270 +msgid "Setup Alarms" +msgstr "Wecker einrichten" diff --git a/kradio3/plugins/timecontrol/po/ru.po b/kradio3/plugins/timecontrol/po/ru.po new file mode 100644 index 0000000..6f95f37 --- /dev/null +++ b/kradio3/plugins/timecontrol/po/ru.po @@ -0,0 +1,129 @@ +# translation of ru.po to +# translation of kradio-timecontrol.po to +# This file is put in the public domain. +# Алексей Кузнецов <Alexey.Kouznetsov@GMail.com>, 2006. +# +msgid "" +msgstr "" +"Project-Id-Version: ru\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2006-11-11 18:43+0100\n" +"PO-Revision-Date: 2006-11-08 12:57+0300\n" +"Last-Translator: Алексей Кузнецов <Alexey.Kouznetsov@GMail.com>\n" +"Language-Team: <ru@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10\n" + +#. i18n: file timecontrol-configuration-ui.ui line 32 +#: rc.cpp:3 rc.cpp:68 timecontrol-configuration-ui.cpp:189 +#, no-c-format +msgid "sleep countdown" +msgstr "Период таймера отключения" + +#. i18n: file timecontrol-configuration-ui.ui line 40 +#: rc.cpp:6 rc.cpp:71 timecontrol-configuration-ui.cpp:190 +#, no-c-format +msgid " min" +msgstr " мин" + +#. i18n: file timecontrol-configuration-ui.ui line 117 +#: rc.cpp:9 rc.cpp:74 timecontrol-configuration-ui.cpp:191 timecontrol.cpp:270 +#, no-c-format +msgid "Alarms" +msgstr "Расписание" + +#. i18n: file timecontrol-configuration-ui.ui line 180 +#: rc.cpp:14 rc.cpp:79 timecontrol-configuration-ui.cpp:194 +#, no-c-format +msgid "Date" +msgstr "Дата" + +#. i18n: file timecontrol-configuration-ui.ui line 203 +#: rc.cpp:17 rc.cpp:82 timecontrol-configuration-ui.cpp:195 +#, no-c-format +msgid "Time" +msgstr "Время" + +#. i18n: file timecontrol-configuration-ui.ui line 226 +#: rc.cpp:20 rc.cpp:85 timecontrol-configuration-ui.cpp:196 +#, no-c-format +msgid "Volume" +msgstr "Громкость" + +#. i18n: file timecontrol-configuration-ui.ui line 234 +#: rc.cpp:23 rc.cpp:88 timecontrol-configuration-ui.cpp:197 +#, no-c-format +msgid " %" +msgstr " %" + +#. i18n: file timecontrol-configuration-ui.ui line 263 +#: rc.cpp:26 rc.cpp:91 timecontrol-configuration-ui.cpp:198 +#, no-c-format +msgid "enabled" +msgstr "Включено" + +#. i18n: file timecontrol-configuration-ui.ui line 331 +#: rc.cpp:50 rc.cpp:115 timecontrol-configuration-ui.cpp:207 +#, no-c-format +msgid "daily" +msgstr "Ежедневно" + +#. i18n: file timecontrol-configuration-ui.ui line 341 +#: rc.cpp:53 rc.cpp:118 timecontrol-configuration-ui.cpp:208 +#, no-c-format +msgid "Radio Station" +msgstr "Радиостанция" + +#. i18n: file timecontrol-configuration-ui.ui line 393 +#: rc.cpp:56 rc.cpp:121 timecontrol-configuration-ui.cpp:210 +#, no-c-format +msgid "Start Playing" +msgstr "Начать воспроизведение" + +#. i18n: file timecontrol-configuration-ui.ui line 401 +#: rc.cpp:59 rc.cpp:124 timecontrol-configuration-ui.cpp:211 +#, no-c-format +msgid "Stop Playing" +msgstr "Остановить воспроизведение" + +#. i18n: file timecontrol-configuration-ui.ui line 409 +#: rc.cpp:62 rc.cpp:127 timecontrol-configuration-ui.cpp:212 +#, no-c-format +msgid "Start Recording" +msgstr "Начать запись" + +#. i18n: file timecontrol-configuration-ui.ui line 417 +#: rc.cpp:65 rc.cpp:130 timecontrol-configuration-ui.cpp:213 +#, no-c-format +msgid "Stop Recording" +msgstr "Остановить запись" + +#: _translatorinfo.cpp:1 +msgid "" +"_: NAME OF TRANSLATORS\n" +"Your names" +msgstr "Алексей Кузнецов" + +#: _translatorinfo.cpp:3 +msgid "" +"_: EMAIL OF TRANSLATORS\n" +"Your emails" +msgstr "Alexey.Kouznetsov@GMail.com" + +#: timecontrol-configuration.cpp:181 +msgid "<don't change>" +msgstr "<не менять>" + +#: timecontrol.cpp:42 +msgid "Time Control and Alarm Functions" +msgstr "Функции таймера и работы по расписанию" + +#: timecontrol.cpp:48 +msgid "TimeControl Plugin" +msgstr "Модуль ремени" + +#: timecontrol.cpp:270 +msgid "Setup Alarms" +msgstr "Расписание" diff --git a/kradio3/plugins/timecontrol/timecontrol-configuration-ui.ui b/kradio3/plugins/timecontrol/timecontrol-configuration-ui.ui new file mode 100644 index 0000000..8b2b768 --- /dev/null +++ b/kradio3/plugins/timecontrol/timecontrol-configuration-ui.ui @@ -0,0 +1,452 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>TimeControlConfigurationUI</class> +<widget class="QWidget"> + <property name="name"> + <cstring>TimeControlConfigurationUI</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>374</width> + <height>261</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelSleep</cstring> + </property> + <property name="text"> + <string>sleep countdown</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>editSleep</cstring> + </property> + <property name="suffix"> + <string> min</string> + </property> + <property name="maxValue"> + <number>200</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="lineStep"> + <number>5</number> + </property> + <property name="value"> + <number>30</number> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer6_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="Line" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelAlarmList</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Alarms</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonAlarmNew</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="iconSet"> + <iconset>"filenew2"</iconset> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonDeleteAlarm</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="iconSet"> + <iconset>"editdelete"</iconset> + </property> + </widget> + </hbox> + </widget> + <widget class="QListBox"> + <property name="name"> + <cstring>listAlarms</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout17</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout28</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout27</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelAlarmDate</cstring> + </property> + <property name="text"> + <string>Date</string> + </property> + </widget> + <widget class="QDateEdit"> + <property name="name"> + <cstring>editAlarmDate</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout28</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelAlarmTime</cstring> + </property> + <property name="text"> + <string>Time</string> + </property> + </widget> + <widget class="QTimeEdit"> + <property name="name"> + <cstring>editAlarmTime</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout29</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelAlarmVolume</cstring> + </property> + <property name="text"> + <string>Volume</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>editAlarmVolume</cstring> + </property> + <property name="suffix"> + <string> %</string> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="minValue"> + <number>-1</number> + </property> + <property name="value"> + <number>-1</number> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout16</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>checkboxAlarmEnable</cstring> + </property> + <property name="text"> + <string>enabled</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>100</height> + </size> + </property> + </spacer> + <widget class="KListBox" row="0" column="1" rowspan="3" colspan="1"> + <item> + <property name="text"> + <string>Monday</string> + </property> + </item> + <item> + <property name="text"> + <string>Tuesday</string> + </property> + </item> + <item> + <property name="text"> + <string>Wednesday</string> + </property> + </item> + <item> + <property name="text"> + <string>Thursday</string> + </property> + </item> + <item> + <property name="text"> + <string>Friday</string> + </property> + </item> + <item> + <property name="text"> + <string>Saturday</string> + </property> + </item> + <item> + <property name="text"> + <string>Sunday</string> + </property> + </item> + <property name="name"> + <cstring>listWeekdays</cstring> + </property> + <property name="selectionMode"> + <enum>Multi</enum> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>checkboxAlarmDaily</cstring> + </property> + <property name="text"> + <string>daily</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>labelStationSelection</cstring> + </property> + <property name="text"> + <string>Radio Station</string> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>comboStationSelection</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout20</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>pixmapAlarmStation</cstring> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>150</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Start Playing</string> + </property> + <property name="pixmap"> + <pixmap>"kradio_muteoff"</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Stop Playing</string> + </property> + <property name="pixmap"> + <pixmap>"kradio_muteon"</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Start Recording</string> + </property> + <property name="pixmap"> + <pixmap>"kradio_record"</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Stop Recording</string> + </property> + <property name="pixmap"> + <pixmap>"kradio_muteon"</pixmap> + </property> + </item> + <property name="name"> + <cstring>comboAlarmType</cstring> + </property> + </widget> + </vbox> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<tabstops> + <tabstop>listAlarms</tabstop> + <tabstop>buttonAlarmNew</tabstop> + <tabstop>buttonDeleteAlarm</tabstop> + <tabstop>editAlarmDate</tabstop> + <tabstop>editAlarmTime</tabstop> + <tabstop>editAlarmVolume</tabstop> + <tabstop>checkboxAlarmDaily</tabstop> + <tabstop>checkboxAlarmEnable</tabstop> + <tabstop>comboStationSelection</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">kiconloader.h</include> +</includes> +<pixmapfunction>SmallIcon</pixmapfunction> +<layoutdefaults spacing="6" margin="0"/> +<includehints> + <includehint>klistbox.h</includehint> +</includehints> +</UI> diff --git a/kradio3/plugins/timecontrol/timecontrol-configuration.cpp b/kradio3/plugins/timecontrol/timecontrol-configuration.cpp new file mode 100644 index 0000000..4ea6bce --- /dev/null +++ b/kradio3/plugins/timecontrol/timecontrol-configuration.cpp @@ -0,0 +1,425 @@ +/*************************************************************************** + timecontrol-configuration.cpp - description + ------------------- + begin : Sam Aug 2 2003 + copyright : (C) 2003 by Martin Witte + email : witte@kawo1.rwth-aachen.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 <math.h> +#include <algorithm> +using std::sort; + +#include <qdatetime.h> +#include <qlistbox.h> +#include <qcombobox.h> +#include <qdatetimeedit.h> +#include <qlabel.h> +#include <qspinbox.h> +#include <qcheckbox.h> +#include <qpushbutton.h> + +#include <klistbox.h> +#include <klocale.h> + +#include "../../src/include/stationlist.h" +#include "../../src/include/alarm.h" +#include "../../src/include/errorlog-interfaces.h" +#include "../../src/include/radiostation.h" + +#include "timecontrol-configuration.h" + +class DateTimeCmp +{ +public: + bool operator() (const Alarm &a, const Alarm &b) { + return a.nextAlarm(true) < b.nextAlarm(true); + } + +}; + +TimeControlConfiguration::TimeControlConfiguration (QWidget *parent) + : TimeControlConfigurationUI(parent), + ITimeControlClient(), + IRadioClient(), + ignoreChanges(false), + m_dirty(false) +{ + + QObject::connect(checkboxAlarmDaily, SIGNAL(toggled(bool)), this, SLOT(slotDailyChanged(bool))); + QObject::connect(listWeekdays, SIGNAL(highlighted(int)), this, SLOT(slotWeekdaysChanged())); + QObject::connect(checkboxAlarmEnable, SIGNAL(toggled(bool)), this, SLOT(slotEnabledChanged(bool))); + QObject::connect(comboStationSelection, SIGNAL(highlighted(int)), this, SLOT(slotStationChanged(int))); + QObject::connect(listAlarms, SIGNAL(highlighted(int)), this, SLOT(slotAlarmSelectChanged(int))); + QObject::connect(editAlarmDate, SIGNAL(valueChanged(const QDate &)), this, SLOT(slotDateChanged(const QDate &))); + QObject::connect(editAlarmTime, SIGNAL(valueChanged(const QTime &)), this, SLOT(slotTimeChanged(const QTime &))); + QObject::connect(editAlarmVolume, SIGNAL(valueChanged(int)), this, SLOT(slotVolumeChanged(int))); + QObject::connect(buttonAlarmNew, SIGNAL(clicked()), this, SLOT(slotNewAlarm())); + QObject::connect(buttonDeleteAlarm, SIGNAL(clicked()), this, SLOT(slotDeleteAlarm())); + QObject::connect(comboAlarmType, SIGNAL(highlighted(int)), this, SLOT(slotAlarmTypeChanged(int))); + + QObject::connect(checkboxAlarmDaily, SIGNAL(toggled(bool)), this, SLOT(slotSetDirty())); + QObject::connect(listWeekdays, SIGNAL(selectionChanged()), this, SLOT(slotSetDirty())); + QObject::connect(checkboxAlarmEnable, SIGNAL(toggled(bool)), this, SLOT(slotSetDirty())); + QObject::connect(comboStationSelection, SIGNAL(activated(int)), this, SLOT(slotSetDirty())); + QObject::connect(editAlarmDate, SIGNAL(valueChanged(const QDate &)), this, SLOT(slotSetDirty())); + QObject::connect(editAlarmTime, SIGNAL(valueChanged(const QTime &)), this, SLOT(slotSetDirty())); + QObject::connect(editAlarmVolume, SIGNAL(valueChanged(int)), this, SLOT(slotSetDirty())); + QObject::connect(buttonAlarmNew, SIGNAL(clicked()), this, SLOT(slotSetDirty())); + QObject::connect(buttonDeleteAlarm, SIGNAL(clicked()), this, SLOT(slotSetDirty())); + QObject::connect(comboAlarmType, SIGNAL(activated(int)), this, SLOT(slotSetDirty())); + QObject::connect(editSleep, SIGNAL(valueChanged(int)), this, SLOT(slotSetDirty())); +} + +TimeControlConfiguration::~TimeControlConfiguration () +{ +} + +bool TimeControlConfiguration::connectI (Interface *i) +{ + bool a = ITimeControlClient::connectI(i); + bool b = IRadioClient::connectI(i); + return a || b; +} + + +bool TimeControlConfiguration::disconnectI (Interface *i) +{ + bool a = ITimeControlClient::disconnectI(i); + bool b = IRadioClient::disconnectI(i); + return a || b; +} + + +// ITimeControlClient + +bool TimeControlConfiguration::noticeAlarmsChanged(const AlarmVector &sl) +{ + int idx = listAlarms->currentItem(); + int currentID = (idx >= 0 && (unsigned)idx < alarms.size()) ? alarms[idx].ID() : -1; + + alarms = sl; + sort(alarms.begin(), alarms.end(), DateTimeCmp()); + + bool oldBlock = listAlarms->signalsBlocked(); + listAlarms->blockSignals(true); + + listAlarms->clear(); + idx = -1; + int k = 0; + for (ciAlarmVector i = alarms.begin(); i != alarms.end(); ++i, ++k) { + listAlarms->insertItem(i->nextAlarm(true).toString()); + if (i->ID() == currentID) + idx = k; + } + listAlarms->setCurrentItem(idx); + + listAlarms->blockSignals(oldBlock); + + slotAlarmSelectChanged(idx); + return true; +} + +bool TimeControlConfiguration::noticeAlarm(const Alarm &) +{ + return false; +} + +bool TimeControlConfiguration::noticeNextAlarmChanged(const Alarm *) +{ + noticeAlarmsChanged(alarms); + return true; +} + +bool TimeControlConfiguration::noticeCountdownStarted(const QDateTime &/*end*/) +{ + return false; +} + +bool TimeControlConfiguration::noticeCountdownStopped() +{ + return false; +} + +bool TimeControlConfiguration::noticeCountdownZero() +{ + return false; +} + +bool TimeControlConfiguration::noticeCountdownSecondsChanged(int n) +{ + editSleep->setValue((int)rint(n / 60)); + return false; +} + + +// IRadioClient + +bool TimeControlConfiguration::noticePowerChanged(bool /*on*/) +{ + return false; +} + +bool TimeControlConfiguration::noticeStationChanged (const RadioStation &, int /*idx*/) +{ + return false; +} + +bool TimeControlConfiguration::noticeStationsChanged(const StationList &sl) +{ + comboStationSelection->clear(); + stationIDs.clear(); + comboStationSelection->insertItem(i18n("<don't change>")); + stationIDs.push_back(QString::null); + + for (RawStationList::Iterator i(sl.all()); i.current(); ++i) { + comboStationSelection->insertItem(i.current()->iconName(), + i.current()->longName()); + stationIDs.push_back(i.current()->stationID()); + } + return true; +} + + +// Slots + + +void TimeControlConfiguration::slotDateChanged( const QDate &d ) +{ + if (ignoreChanges) return; + + int idx = listAlarms->currentItem(); + if (idx >= 0 && (unsigned)idx < alarms.size()) { + Alarm &a = alarms[idx]; + a.setDate(d); + + ignoreChanges = true; + bool oldBlock = listAlarms->signalsBlocked(); + listAlarms->blockSignals(true); + noticeAlarmsChanged(alarms); + listAlarms->blockSignals(oldBlock); + ignoreChanges = false; + } +} + + +void TimeControlConfiguration::slotTimeChanged(const QTime &t) +{ + if (ignoreChanges) return; + + int idx = listAlarms->currentItem(); + if (idx >= 0 && (unsigned)idx < alarms.size()) { + Alarm &a = alarms[idx]; + a.setTime(t); + + ignoreChanges = true; + bool oldBlock = listAlarms->signalsBlocked(); + listAlarms->blockSignals(true); + noticeAlarmsChanged(alarms); + listAlarms->blockSignals(oldBlock); + ignoreChanges = false; + } +} + + +void TimeControlConfiguration::slotDailyChanged (bool b) +{ + if (ignoreChanges) return; + + int idx = listAlarms->currentItem(); + if (idx >= 0 && (unsigned)idx < alarms.size()) { + Alarm &a = alarms[idx]; + a.setDaily(b); + + ignoreChanges = true; + bool oldBlock = listAlarms->signalsBlocked(); + listAlarms->blockSignals(true); + noticeAlarmsChanged(alarms); + listAlarms->blockSignals(oldBlock); + ignoreChanges = false; + + editAlarmDate ->setDisabled(b); + labelAlarmDate->setDisabled(b); + listWeekdays ->setDisabled(!b); + } +} + + +void TimeControlConfiguration::slotWeekdaysChanged () +{ + if (ignoreChanges) return; + + int mask = 0; + for (int i = 0; i < 7; ++i) { + if (listWeekdays->isSelected(i)) { + mask |= (1 << i); + } + } + + int idx = listAlarms->currentItem(); + if (idx >= 0 && (unsigned)idx < alarms.size()) { + Alarm &a = alarms[idx]; + a.setWeekdayMask(mask); + + ignoreChanges = true; + bool oldBlock = listAlarms->signalsBlocked(); + listAlarms->blockSignals(true); + noticeAlarmsChanged(alarms); + listAlarms->blockSignals(oldBlock); + ignoreChanges = false; + } +} + + +void TimeControlConfiguration::slotEnabledChanged( bool b) +{ + int idx = listAlarms->currentItem(); + if (idx >= 0 && (unsigned)idx < alarms.size()) { + alarms[idx].setEnabled(b); + } +} + + +void TimeControlConfiguration::slotStationChanged( int i ) +{ + int idx = listAlarms->currentItem(); + if ( idx >= 0 && (unsigned)idx < alarms.size() + && i >= 0 && (unsigned)i < stationIDs.size()) + { + alarms[idx].setStationID( stationIDs[i] ); + } +} + + +void TimeControlConfiguration::slotVolumeChanged( int v ) +{ + int idx = listAlarms->currentItem(); + if (idx >= 0 && (unsigned)idx < alarms.size()) { + alarms[idx].setVolumePreset(0.01 * (float)v); + } +} + + +void TimeControlConfiguration::slotAlarmTypeChanged(int t) +{ + int idx = listAlarms->currentItem(); + if (idx >= 0 && (unsigned)idx < alarms.size()) { + alarms[idx].setAlarmType((Alarm::AlarmType)t); + } +} + + +void TimeControlConfiguration::slotAlarmSelectChanged(int idx) +{ + if (ignoreChanges) return; + ignoreChanges = true; + + Alarm a; + bool valid = false; + + if (idx >= 0 && (unsigned)idx < alarms.size()) { + + a = alarms[idx]; + valid = true; + + } + + editAlarmDate ->setDisabled(!valid || a.isDaily()); + labelAlarmDate ->setDisabled(!valid || a.isDaily()); + listWeekdays ->setDisabled(!valid ||!a.isDaily()); + editAlarmTime ->setDisabled(!valid); + labelAlarmTime ->setDisabled(!valid); + labelAlarmVolume ->setDisabled(!valid); + editAlarmVolume ->setDisabled(!valid); + checkboxAlarmDaily ->setDisabled(!valid); + checkboxAlarmEnable ->setDisabled(!valid); + comboStationSelection->setDisabled(!valid); + labelStationSelection->setDisabled(!valid); + buttonDeleteAlarm ->setDisabled(!valid); + comboAlarmType ->setDisabled(!valid); + + editAlarmDate ->setDate(a.alarmTime().date()); + editAlarmTime ->setTime(a.alarmTime().time()); + checkboxAlarmDaily ->setChecked(a.isDaily()); + checkboxAlarmEnable ->setChecked(a.isEnabled()); + editAlarmVolume ->setValue((int)rint(a.volumePreset() * 100)); + comboAlarmType ->setCurrentItem(a.alarmType()); + + int k = 0; + const QString &sID = a.stationID(); + for (int i = 0; !k && i < (int)stationIDs.size(); ++i) + if (stationIDs[i] == sID) k = i; + comboStationSelection->setCurrentItem(k); + + int m = a.weekdayMask(); + for (int i = 0; i < 7; ++i) { + listWeekdays->setSelected(i, m & (1 << i)); + } + + ignoreChanges = false; +} + + +void TimeControlConfiguration::slotNewAlarm() +{ + QDateTime dt(QDateTime::currentDateTime()); + Alarm a(dt, false, false); + alarms.push_back(a); + listAlarms->insertItem(a.alarmTime().toString()); + listAlarms->setSelected(listAlarms->count() - 1, true); + noticeAlarmsChanged(alarms); +} + + +void TimeControlConfiguration::slotDeleteAlarm() +{ + int idx = listAlarms->currentItem(); + + if (idx >= 0 && (unsigned)idx < alarms.size()) { + // unfortunately a function vector<>::erase(idx) does not exist + iAlarmVector i = alarms.begin(); + for (int k = 0; k < idx; ++k) + ++i; + if (i != alarms.end()) + alarms.erase(i); + listAlarms->removeItem(idx); + } +} + + +void TimeControlConfiguration::slotOK() +{ + if (m_dirty) { + sendAlarms(alarms); + sendCountdownSeconds(editSleep->value() * 60); + m_dirty = false; + } +} + +void TimeControlConfiguration::slotCancel() +{ + if (m_dirty) { + noticeAlarmsChanged(queryAlarms()); + noticeCountdownSecondsChanged(queryCountdownSeconds()); + m_dirty = false; + } +} + +void TimeControlConfiguration::slotSetDirty() +{ + if (!ignoreChanges) { + m_dirty = true; + } +} + + +#include "timecontrol-configuration.moc" diff --git a/kradio3/plugins/timecontrol/timecontrol-configuration.h b/kradio3/plugins/timecontrol/timecontrol-configuration.h new file mode 100644 index 0000000..ac4570f --- /dev/null +++ b/kradio3/plugins/timecontrol/timecontrol-configuration.h @@ -0,0 +1,90 @@ +/*************************************************************************** + timecontro-configuration.h - description + ------------------- + begin : Sam Aug 2 2003 + copyright : (C) 2003 by Martin Witte + email : witte@kawo1.rwth-aachen.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 KRADIO_TIMECONTROL_CONFIGURATION_H +#define KRADIO_TIMECONTROL_CONFIGURATION_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "../../src/include/radio_interfaces.h" +#include "../../src/include/timecontrol_interfaces.h" +#include "timecontrol-configuration-ui.h" + +class TimeControl; +class QWidget; + +class TimeControlConfiguration : public TimeControlConfigurationUI, + public ITimeControlClient, + public IRadioClient +{ +Q_OBJECT +public : + TimeControlConfiguration (QWidget *parent); + ~TimeControlConfiguration (); + + bool connectI (Interface *i); + bool disconnectI (Interface *i); + +// ITimeControlClient + + bool noticeAlarmsChanged(const AlarmVector &sl); + bool noticeAlarm(const Alarm &); + bool noticeNextAlarmChanged(const Alarm *); + bool noticeCountdownStarted(const QDateTime &end); + bool noticeCountdownStopped(); + bool noticeCountdownZero(); + bool noticeCountdownSecondsChanged(int n); + +// IRadioClient + + bool noticePowerChanged(bool on); + bool noticeStationChanged (const RadioStation &, int idx); + bool noticeStationsChanged(const StationList &sl); + bool noticePresetFileChanged(const QString &/*f*/) { return false; } + + bool noticeCurrentSoundStreamIDChanged(SoundStreamID /*id*/) { return false; } + +protected slots: + + void slotDailyChanged (bool daily); + void slotWeekdaysChanged (); + void slotEnabledChanged (bool enable); + void slotStationChanged (int idx); + void slotAlarmSelectChanged(int idx); + void slotDateChanged(const QDate &d); + void slotTimeChanged(const QTime &d); + void slotVolumeChanged(int v); + void slotAlarmTypeChanged(int idx); + + void slotNewAlarm(); + void slotDeleteAlarm(); + + void slotOK(); + void slotCancel(); + void slotSetDirty(); + +protected: + + AlarmVector alarms; + vector<QString> stationIDs; + + bool ignoreChanges; + bool m_dirty; +}; + +#endif diff --git a/kradio3/plugins/timecontrol/timecontrol.cpp b/kradio3/plugins/timecontrol/timecontrol.cpp new file mode 100644 index 0000000..42441ac --- /dev/null +++ b/kradio3/plugins/timecontrol/timecontrol.cpp @@ -0,0 +1,301 @@ +/*************************************************************************** + timecontrol.cpp - description + ------------------- + begin : Son Jan 12 2003 + copyright : (C) 2003 by Martin Witte + email : witte@kawo1.rwth-aachen.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 <kaboutdata.h> +#include <kconfig.h> + +#include "timecontrol.h" +#include "timecontrol-configuration.h" +#include "../../src/include/pluginmanager.h" +#include "../../src/include/aboutwidget.h" + +//const char *AlarmListElement = "alarmlist"; +//const char *AlarmElement = "alarm"; +const char *AlarmDateElement = "date"; +const char *AlarmTimeElement = "time"; +const char *AlarmDailyElement = "daily"; +const char *AlarmWeekdayMaskElement = "weekdayMask"; +const char *AlarmEnabledElement = "enabled"; +const char *AlarmStationIDElement = "stationID"; +//const char *AlarmFrequencyElement = "frequency"; +const char *AlarmVolumeElement = "volume"; +const char *AlarmTypeElement = "type"; + + +/////////////////////////////////////////////////////////////////////// +//// plugin library functions + +PLUGIN_LIBRARY_FUNCTIONS(TimeControl, "kradio-timecontrol", i18n("Time Control and Alarm Functions")); + +/////////////////////////////////////////////////////////////////////// + + +TimeControl::TimeControl (const QString &n) + : PluginBase(n, i18n("TimeControl Plugin")), + m_waitingFor(NULL), + m_countdownSeconds(0), + m_alarmTimer(this), + m_countdownTimer(this) +{ + QObject::connect(&m_alarmTimer, SIGNAL(timeout()), this, SLOT(slotQTimerAlarmTimeout())); + QObject::connect(&m_countdownTimer, SIGNAL(timeout()), this, SLOT(slotQTimerCountdownTimeout())); +} + + +TimeControl::~TimeControl () +{ + m_waitingFor = NULL; +} + +bool TimeControl::connectI (Interface *i) +{ + bool a = ITimeControl::connectI(i); + bool b = PluginBase::connectI(i); + return a || b; +} + +bool TimeControl::disconnectI (Interface *i) +{ + bool a = ITimeControl::disconnectI(i); + bool b = PluginBase::disconnectI(i); + return a || b; +} + +bool TimeControl::setAlarms (const AlarmVector &al) +{ + if (m_alarms != al) { + m_waitingFor = NULL; + + m_alarms = al; + + slotQTimerAlarmTimeout(); + + notifyAlarmsChanged(m_alarms); + } + return true; +} + + +bool TimeControl::setCountdownSeconds(int n) +{ + int old = m_countdownSeconds; + m_countdownSeconds = n; + if (old != n) + notifyCountdownSecondsChanged(n); + return true; +} + + +bool TimeControl::startCountdown() +{ + m_countdownEnd = QDateTime::currentDateTime().addSecs(m_countdownSeconds); + m_countdownTimer.start(m_countdownSeconds * 1000, true); + + notifyCountdownStarted(getCountdownEnd()); + + return true; +} + + +bool TimeControl::stopCountdown() +{ + m_countdownTimer.stop(); + m_countdownEnd = QDateTime(); + + notifyCountdownStopped(); + + return true; +} + + +QDateTime TimeControl::getNextAlarmTime() const +{ + const Alarm *a = getNextAlarm(); + if (a) + return a->nextAlarm(); + else + return QDateTime(); +} + + +const Alarm *TimeControl::getNextAlarm () const +{ + QDateTime now = QDateTime::currentDateTime(), + next; + + const Alarm *retval = NULL; + + for (ciAlarmVector i = m_alarms.begin(); i != m_alarms.end(); ++i) { + QDateTime n = i->nextAlarm(); + if (n.isValid() && n > now && ( ! next.isValid() || n < next)) { + next = n; + retval = &(*i); + } + } + + QDateTime old = m_nextAlarm_tmp; + m_nextAlarm_tmp = next; + if (old != m_nextAlarm_tmp) { + notifyNextAlarmChanged(retval); + } + + return retval; +} + + +QDateTime TimeControl::getCountdownEnd () const +{ + if (m_countdownTimer.isActive()) + return m_countdownEnd; + else + return QDateTime(); +} + + +void TimeControl::slotQTimerCountdownTimeout() +{ + stopCountdown(); + + notifyCountdownZero(); +} + + +void TimeControl::slotQTimerAlarmTimeout() +{ + if (m_waitingFor) { + notifyAlarm(*m_waitingFor); + } + + QDateTime now = QDateTime::currentDateTime(); + Alarm const *n = getNextAlarm(); + QDateTime na = getNextAlarmTime(); + + m_waitingFor = NULL; + + if (na.isValid()) { + + int days = now.daysTo(na); + int msecs = now.time().msecsTo(na.time()); + + if (days > 1) { + m_alarmTimer.start(24 * 3600 * 1000, true); + + } else if (days >= 0) { + + if (days > 0) + msecs += days * 24 * 3600 * 1000; + + if (msecs > 0) { + m_waitingFor = n; + m_alarmTimer.start(msecs, true); + } + } + } +} + + +void TimeControl::restoreState (KConfig *config) +{ + AlarmVector al; + + config->setGroup(QString("timecontrol-") + name()); + + int nAlarms = config->readNumEntry ("nAlarms", 0); + for (int idx = 1; idx <= nAlarms; ++idx) { + + QString num = QString().setNum(idx); + QDateTime d = config->readDateTimeEntry(AlarmTimeElement + num); + bool enable = config->readBoolEntry(AlarmEnabledElement + num, false); + bool daily = config->readBoolEntry(AlarmDailyElement + num, false); + int weekdayMask = config->readNumEntry(AlarmWeekdayMaskElement + num, 0x7F); + float vol = config->readDoubleNumEntry(AlarmVolumeElement + num, 1); + QString sid = config->readEntry(AlarmStationIDElement + num, QString::null); + int type = config->readNumEntry(AlarmTypeElement + num, 0); + + enable &= d.isValid(); + + Alarm a ( d, daily, enable); + a.setVolumePreset(vol); + a.setWeekdayMask(weekdayMask); + a.setStationID(sid); + a.setAlarmType((Alarm::AlarmType)type); + al.push_back(a); + } + + setAlarms(al); + setCountdownSeconds(config->readNumEntry("countdownSeconds", 30*60)); +} + + +void TimeControl::saveState (KConfig *config) const +{ + config->setGroup(QString("timecontrol-") + name()); + + config->writeEntry("nAlarms", m_alarms.size()); + int idx = 1; + ciAlarmVector end = m_alarms.end(); + for (ciAlarmVector i = m_alarms.begin(); i != end; ++i, ++idx) { + QString num = QString().setNum(idx); + config->writeEntry (AlarmTimeElement + num, i->alarmTime()); + config->writeEntry (AlarmEnabledElement + num, i->isEnabled()); + config->writeEntry (AlarmDailyElement + num, i->isDaily()); + config->writeEntry (AlarmWeekdayMaskElement + num, i->weekdayMask()); + config->writeEntry (AlarmVolumeElement + num, i->volumePreset()); + config->writeEntry (AlarmStationIDElement + num, i->stationID()); + config->writeEntry (AlarmTypeElement + num, i->alarmType()); + } + + config->writeEntry("countdownSeconds", m_countdownSeconds); +} + + +ConfigPageInfo TimeControl::createConfigurationPage() +{ + TimeControlConfiguration *conf = new TimeControlConfiguration(NULL); + connectI(conf); + return ConfigPageInfo (conf, i18n("Alarms"), i18n("Setup Alarms"), "kradio_kalarm"); +} + + +AboutPageInfo TimeControl::createAboutPage() +{ +/* KAboutData aboutData("kradio", + NULL, + NULL, + I18N_NOOP("Time Control Plugin for KRadio." + "<P>" + "Provides Alarms and Sleep Countdown" + "<P>"), + KAboutData::License_GPL, + "(c) 2002-2005 Martin Witte, Klas Kalass", + 0, + "http://sourceforge.net/projects/kradio", + 0); + aboutData.addAuthor("Martin Witte", "", "witte@kawo1.rwth-aachen.de"); + aboutData.addAuthor("Klas Kalass", "", "klas.kalass@gmx.de"); + + return AboutPageInfo( + new KRadioAboutWidget(aboutData, KRadioAboutWidget::AbtTabbed), + i18n("Alarms"), + i18n("Time Control Plugin"), + "kradio_kalarm" + );*/ + return AboutPageInfo(); +} + + +#include "timecontrol.moc" diff --git a/kradio3/plugins/timecontrol/timecontrol.h b/kradio3/plugins/timecontrol/timecontrol.h new file mode 100644 index 0000000..f38bae9 --- /dev/null +++ b/kradio3/plugins/timecontrol/timecontrol.h @@ -0,0 +1,95 @@ +/*************************************************************************** + timecontrol.h - description + ------------------- + begin : Son Jan 12 2003 + copyright : (C) 2003 by Martin Witte + email : witte@kawo1.rwth-aachen.de + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 KRADIO_TIMECONTROL_H +#define KRADIO_TIMECONTROL_H + +#include <qobject.h> +#include <qtimer.h> + +#include "../../src/include/alarm.h" +#include "../../src/include/plugins.h" +#include "../../src/include/timecontrol_interfaces.h" + +// well, it has to be a QObject :( , but only for +// receiving QTimer - timeouts + +class TimeControl : public QObject, + public PluginBase, + public ITimeControl +{ +Q_OBJECT +protected: + AlarmVector m_alarms; + Alarm const * m_waitingFor; // m_alarmTimer is exactly for this date/time + + int m_countdownSeconds; // in seconds + QDateTime m_countdownEnd; + + QTimer m_alarmTimer; + QTimer m_countdownTimer; + + mutable QDateTime m_nextAlarm_tmp; // used to recognize nextAlarm changes + +public: + TimeControl (const QString &name); + ~TimeControl(); + + virtual QString pluginClassName() const { return "TimeControl"; } + + virtual const QString &name() const { return PluginBase::name(); } + virtual QString &name() { return PluginBase::name(); } + + virtual bool connectI (Interface *i); + virtual bool disconnectI (Interface *i); + + // PluginBase + +public: + virtual void saveState (KConfig *) const; + virtual void restoreState (KConfig *); + + virtual ConfigPageInfo createConfigurationPage(); + virtual AboutPageInfo createAboutPage(); + + + // ITimeControl Interface methods + +RECEIVERS: + bool setAlarms(const AlarmVector &sl); + bool setCountdownSeconds(int n); + bool startCountdown(); + bool stopCountdown(); + +ANSWERS: + QDateTime getNextAlarmTime () const; + const Alarm* getNextAlarm () const; + const AlarmVector & getAlarms () const { return m_alarms; } + int getCountdownSeconds () const { return m_countdownSeconds; } + QDateTime getCountdownEnd () const; + + + // slots for receiving timeout messages of timers + +protected slots: + virtual void slotQTimerAlarmTimeout(); + virtual void slotQTimerCountdownTimeout(); + +}; + + +#endif |