diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-02-01 17:25:34 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-02-01 17:25:34 -0600 |
commit | 48906a623383ab5222541ae048e99dd039b62a9a (patch) | |
tree | 1c5f588e90899bb1301f79cf97b8f6ddc0b1c367 /tderadio3/plugins/timecontrol | |
parent | a1e6ce502c334194d31a0b78b11b77e9532da64b (diff) | |
download | tderadio-48906a623383ab5222541ae048e99dd039b62a9a.tar.gz tderadio-48906a623383ab5222541ae048e99dd039b62a9a.zip |
Fix FTBFS
Diffstat (limited to 'tderadio3/plugins/timecontrol')
19 files changed, 1644 insertions, 0 deletions
diff --git a/tderadio3/plugins/timecontrol/Makefile.am b/tderadio3/plugins/timecontrol/Makefile.am new file mode 100644 index 0000000..0ac954f --- /dev/null +++ b/tderadio3/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/tderadio3/plugins/timecontrol/icons/Makefile.am b/tderadio3/plugins/timecontrol/icons/Makefile.am new file mode 100644 index 0000000..b3f2583 --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/Makefile.am @@ -0,0 +1,2 @@ +icons_ICON = AUTO +iconsdir = $(kde_datadir)/kradio/icons diff --git a/tderadio3/plugins/timecontrol/icons/hi16-action-tderadio_kalarm.png b/tderadio3/plugins/timecontrol/icons/hi16-action-tderadio_kalarm.png Binary files differnew file mode 100644 index 0000000..eb5683b --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi16-action-tderadio_kalarm.png diff --git a/tderadio3/plugins/timecontrol/icons/hi16-action-tderadio_zzz.png b/tderadio3/plugins/timecontrol/icons/hi16-action-tderadio_zzz.png Binary files differnew file mode 100644 index 0000000..f832469 --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi16-action-tderadio_zzz.png diff --git a/tderadio3/plugins/timecontrol/icons/hi22-action-tderadio_kalarm.png b/tderadio3/plugins/timecontrol/icons/hi22-action-tderadio_kalarm.png Binary files differnew file mode 100644 index 0000000..a880e8f --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi22-action-tderadio_kalarm.png diff --git a/tderadio3/plugins/timecontrol/icons/hi22-action-tderadio_zzz.png b/tderadio3/plugins/timecontrol/icons/hi22-action-tderadio_zzz.png Binary files differnew file mode 100644 index 0000000..2c69332 --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi22-action-tderadio_zzz.png diff --git a/tderadio3/plugins/timecontrol/icons/hi32-action-tderadio_kalarm.png b/tderadio3/plugins/timecontrol/icons/hi32-action-tderadio_kalarm.png Binary files differnew file mode 100644 index 0000000..f312e3f --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi32-action-tderadio_kalarm.png diff --git a/tderadio3/plugins/timecontrol/icons/hi32-action-tderadio_zzz.png b/tderadio3/plugins/timecontrol/icons/hi32-action-tderadio_zzz.png Binary files differnew file mode 100644 index 0000000..89ce212 --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi32-action-tderadio_zzz.png diff --git a/tderadio3/plugins/timecontrol/icons/hi330-action-tderadio_zzz.png b/tderadio3/plugins/timecontrol/icons/hi330-action-tderadio_zzz.png Binary files differnew file mode 100644 index 0000000..42efc76 --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi330-action-tderadio_zzz.png diff --git a/tderadio3/plugins/timecontrol/icons/hi48-action-tderadio_kalarm.png b/tderadio3/plugins/timecontrol/icons/hi48-action-tderadio_kalarm.png Binary files differnew file mode 100644 index 0000000..476d55a --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi48-action-tderadio_kalarm.png diff --git a/tderadio3/plugins/timecontrol/icons/hi48-action-tderadio_zzz.png b/tderadio3/plugins/timecontrol/icons/hi48-action-tderadio_zzz.png Binary files differnew file mode 100644 index 0000000..a2e0b6c --- /dev/null +++ b/tderadio3/plugins/timecontrol/icons/hi48-action-tderadio_zzz.png diff --git a/tderadio3/plugins/timecontrol/po/Makefile.am b/tderadio3/plugins/timecontrol/po/Makefile.am new file mode 100644 index 0000000..35fe6fd --- /dev/null +++ b/tderadio3/plugins/timecontrol/po/Makefile.am @@ -0,0 +1,2 @@ +PACKAGE = kradio-timecontrol +POFILES = AUTO diff --git a/tderadio3/plugins/timecontrol/po/de.po b/tderadio3/plugins/timecontrol/po/de.po new file mode 100644 index 0000000..71a84f6 --- /dev/null +++ b/tderadio3/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/tderadio3/plugins/timecontrol/po/ru.po b/tderadio3/plugins/timecontrol/po/ru.po new file mode 100644 index 0000000..6f95f37 --- /dev/null +++ b/tderadio3/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/tderadio3/plugins/timecontrol/timecontrol-configuration-ui.ui b/tderadio3/plugins/timecontrol/timecontrol-configuration-ui.ui new file mode 100644 index 0000000..b240218 --- /dev/null +++ b/tderadio3/plugins/timecontrol/timecontrol-configuration-ui.ui @@ -0,0 +1,452 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>TimeControlConfigurationUI</class> +<widget class="TQWidget"> + <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="TQLayoutWidget" 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="TQLabel"> + <property name="name"> + <cstring>labelSleep</cstring> + </property> + <property name="text"> + <string>sleep countdown</string> + </property> + </widget> + <widget class="TQSpinBox"> + <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="TQLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <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="TQPushButton"> + <property name="name"> + <cstring>buttonAlarmNew</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="iconSet"> + <iconset>"filenew2"</iconset> + </property> + </widget> + <widget class="TQPushButton"> + <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="TQListBox"> + <property name="name"> + <cstring>listAlarms</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="TQLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout17</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout28</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout27</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>labelAlarmDate</cstring> + </property> + <property name="text"> + <string>Date</string> + </property> + </widget> + <widget class="TQDateEdit"> + <property name="name"> + <cstring>editAlarmDate</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout28</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>labelAlarmTime</cstring> + </property> + <property name="text"> + <string>Time</string> + </property> + </widget> + <widget class="TQTimeEdit"> + <property name="name"> + <cstring>editAlarmTime</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout29</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>labelAlarmVolume</cstring> + </property> + <property name="text"> + <string>Volume</string> + </property> + </widget> + <widget class="TQSpinBox"> + <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="TQLayoutWidget"> + <property name="name"> + <cstring>layout16</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox" 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="TDEListBox" 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="TQCheckBox" row="1" column="0"> + <property name="name"> + <cstring>checkboxAlarmDaily</cstring> + </property> + <property name="text"> + <string>daily</string> + </property> + </widget> + </grid> + </widget> + <widget class="TQLabel"> + <property name="name"> + <cstring>labelStationSelection</cstring> + </property> + <property name="text"> + <string>Radio Station</string> + </property> + </widget> + <widget class="TQComboBox"> + <property name="name"> + <cstring>comboStationSelection</cstring> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout20</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <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="TQComboBox"> + <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/tderadio3/plugins/timecontrol/timecontrol-configuration.cpp b/tderadio3/plugins/timecontrol/timecontrol-configuration.cpp new file mode 100644 index 0000000..c72aa5e --- /dev/null +++ b/tderadio3/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 <tqdatetime.h> +#include <tqlistbox.h> +#include <tqcombobox.h> +#include <tqdatetimeedit.h> +#include <tqlabel.h> +#include <tqspinbox.h> +#include <tqcheckbox.h> +#include <tqpushbutton.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 (TQWidget *parent) + : TimeControlConfigurationUI(parent), + ITimeControlClient(), + IRadioClient(), + ignoreChanges(false), + m_dirty(false) +{ + + TQObject::connect(checkboxAlarmDaily, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotDailyChanged(bool))); + TQObject::connect(listWeekdays, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(slotWeekdaysChanged())); + TQObject::connect(checkboxAlarmEnable, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotEnabledChanged(bool))); + TQObject::connect(comboStationSelection, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(slotStationChanged(int))); + TQObject::connect(listAlarms, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(slotAlarmSelectChanged(int))); + TQObject::connect(editAlarmDate, TQT_SIGNAL(valueChanged(const TQDate &)), this, TQT_SLOT(slotDateChanged(const TQDate &))); + TQObject::connect(editAlarmTime, TQT_SIGNAL(valueChanged(const TQTime &)), this, TQT_SLOT(slotTimeChanged(const TQTime &))); + TQObject::connect(editAlarmVolume, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotVolumeChanged(int))); + TQObject::connect(buttonAlarmNew, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotNewAlarm())); + TQObject::connect(buttonDeleteAlarm, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotDeleteAlarm())); + TQObject::connect(comboAlarmType, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(slotAlarmTypeChanged(int))); + + TQObject::connect(checkboxAlarmDaily, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(listWeekdays, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(checkboxAlarmEnable, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(comboStationSelection, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(editAlarmDate, TQT_SIGNAL(valueChanged(const TQDate &)), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(editAlarmTime, TQT_SIGNAL(valueChanged(const TQTime &)), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(editAlarmVolume, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(buttonAlarmNew, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(buttonDeleteAlarm, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(comboAlarmType, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotSetDirty())); + TQObject::connect(editSleep, TQT_SIGNAL(valueChanged(int)), this, TQT_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 TQDateTime &/*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(TQString()); + + 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 TQDate &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 TQTime &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 TQString &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() +{ + TQDateTime dt(TQDateTime::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/tderadio3/plugins/timecontrol/timecontrol-configuration.h b/tderadio3/plugins/timecontrol/timecontrol-configuration.h new file mode 100644 index 0000000..b53747e --- /dev/null +++ b/tderadio3/plugins/timecontrol/timecontrol-configuration.h @@ -0,0 +1,91 @@ +/*************************************************************************** + 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 TQWidget; + +class TimeControlConfiguration : public TimeControlConfigurationUI, + public ITimeControlClient, + public IRadioClient +{ +Q_OBJECT + +public : + TimeControlConfiguration (TQWidget *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 TQDateTime &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 TQString &/*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 TQDate &d); + void slotTimeChanged(const TQTime &d); + void slotVolumeChanged(int v); + void slotAlarmTypeChanged(int idx); + + void slotNewAlarm(); + void slotDeleteAlarm(); + + void slotOK(); + void slotCancel(); + void slotSetDirty(); + +protected: + + AlarmVector alarms; + vector<TQString> stationIDs; + + bool ignoreChanges; + bool m_dirty; +}; + +#endif diff --git a/tderadio3/plugins/timecontrol/timecontrol.cpp b/tderadio3/plugins/timecontrol/timecontrol.cpp new file mode 100644 index 0000000..15f0bde --- /dev/null +++ b/tderadio3/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 <tdeconfig.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 TQString &n) + : PluginBase(n, i18n("TimeControl Plugin")), + m_waitingFor(NULL), + m_countdownSeconds(0), + m_alarmTimer(this), + m_countdownTimer(this) +{ + TQObject::connect(&m_alarmTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotQTimerAlarmTimeout())); + TQObject::connect(&m_countdownTimer, TQT_SIGNAL(timeout()), this, TQT_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 = TQDateTime::currentDateTime().addSecs(m_countdownSeconds); + m_countdownTimer.start(m_countdownSeconds * 1000, true); + + notifyCountdownStarted(getCountdownEnd()); + + return true; +} + + +bool TimeControl::stopCountdown() +{ + m_countdownTimer.stop(); + m_countdownEnd = TQDateTime(); + + notifyCountdownStopped(); + + return true; +} + + +TQDateTime TimeControl::getNextAlarmTime() const +{ + const Alarm *a = getNextAlarm(); + if (a) + return a->nextAlarm(); + else + return TQDateTime(); +} + + +const Alarm *TimeControl::getNextAlarm () const +{ + TQDateTime now = TQDateTime::currentDateTime(), + next; + + const Alarm *retval = NULL; + + for (ciAlarmVector i = m_alarms.begin(); i != m_alarms.end(); ++i) { + TQDateTime n = i->nextAlarm(); + if (n.isValid() && n > now && ( ! next.isValid() || n < next)) { + next = n; + retval = &(*i); + } + } + + TQDateTime old = m_nextAlarm_tmp; + m_nextAlarm_tmp = next; + if (old != m_nextAlarm_tmp) { + notifyNextAlarmChanged(retval); + } + + return retval; +} + + +TQDateTime TimeControl::getCountdownEnd () const +{ + if (m_countdownTimer.isActive()) + return m_countdownEnd; + else + return TQDateTime(); +} + + +void TimeControl::slotQTimerCountdownTimeout() +{ + stopCountdown(); + + notifyCountdownZero(); +} + + +void TimeControl::slotQTimerAlarmTimeout() +{ + if (m_waitingFor) { + notifyAlarm(*m_waitingFor); + } + + TQDateTime now = TQDateTime::currentDateTime(); + Alarm const *n = getNextAlarm(); + TQDateTime 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 (TDEConfig *config) +{ + AlarmVector al; + + config->setGroup(TQString("timecontrol-") + name()); + + int nAlarms = config->readNumEntry ("nAlarms", 0); + for (int idx = 1; idx <= nAlarms; ++idx) { + + TQString num = TQString().setNum(idx); + TQDateTime 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); + TQString sid = config->readEntry(AlarmStationIDElement + num, TQString()); + 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 (TDEConfig *config) const +{ + config->setGroup(TQString("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) { + TQString num = TQString().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() +{ +/* TDEAboutData aboutData("kradio", + NULL, + NULL, + I18N_NOOP("Time Control Plugin for TDERadio." + "<P>" + "Provides Alarms and Sleep Countdown" + "<P>"), + TDEAboutData::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 TDERadioAboutWidget(aboutData, TDERadioAboutWidget::AbtTabbed), + i18n("Alarms"), + i18n("Time Control Plugin"), + "kradio_kalarm" + );*/ + return AboutPageInfo(); +} + + +#include "timecontrol.moc" diff --git a/tderadio3/plugins/timecontrol/timecontrol.h b/tderadio3/plugins/timecontrol/timecontrol.h new file mode 100644 index 0000000..933d8f2 --- /dev/null +++ b/tderadio3/plugins/timecontrol/timecontrol.h @@ -0,0 +1,96 @@ +/*************************************************************************** + 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 <tqobject.h> +#include <tqtimer.h> + +#include "../../src/include/alarm.h" +#include "../../src/include/plugins.h" +#include "../../src/include/timecontrol_interfaces.h" + +// well, it has to be a TQObject :( , but only for +// receiving TQTimer - timeouts + +class TimeControl : public TQObject, + 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 + TQDateTime m_countdownEnd; + + TQTimer m_alarmTimer; + TQTimer m_countdownTimer; + + mutable TQDateTime m_nextAlarm_tmp; // used to recognize nextAlarm changes + +public: + TimeControl (const TQString &name); + ~TimeControl(); + + virtual TQString pluginClassName() const { return "TimeControl"; } + + virtual const TQString &name() const { return PluginBase::name(); } + virtual TQString &name() { return PluginBase::name(); } + + virtual bool connectI (Interface *i); + virtual bool disconnectI (Interface *i); + + // PluginBase + +public: + virtual void saveState (TDEConfig *) const; + virtual void restoreState (TDEConfig *); + + virtual ConfigPageInfo createConfigurationPage(); + virtual AboutPageInfo createAboutPage(); + + + // ITimeControl Interface methods + +RECEIVERS: + bool setAlarms(const AlarmVector &sl); + bool setCountdownSeconds(int n); + bool startCountdown(); + bool stopCountdown(); + +ANSWERS: + TQDateTime getNextAlarmTime () const; + const Alarm* getNextAlarm () const; + const AlarmVector & getAlarms () const { return m_alarms; } + int getCountdownSeconds () const { return m_countdownSeconds; } + TQDateTime getCountdownEnd () const; + + + // slots for receiving timeout messages of timers + +protected slots: + virtual void slotQTimerAlarmTimeout(); + virtual void slotQTimerCountdownTimeout(); + +}; + + +#endif |