summaryrefslogtreecommitdiffstats
path: root/plugins/timecontrol
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/timecontrol')
-rw-r--r--plugins/timecontrol/CMakeL10n.txt6
-rw-r--r--plugins/timecontrol/Makefile.am17
-rw-r--r--plugins/timecontrol/icons/Makefile.am7
-rw-r--r--plugins/timecontrol/icons/hi16-action-tderadio_kalarm.pngbin0 -> 430 bytes
-rw-r--r--plugins/timecontrol/icons/hi16-action-tderadio_zzz.pngbin0 -> 295 bytes
-rw-r--r--plugins/timecontrol/icons/hi22-action-tderadio_kalarm.pngbin0 -> 823 bytes
-rw-r--r--plugins/timecontrol/icons/hi22-action-tderadio_zzz.pngbin0 -> 770 bytes
-rw-r--r--plugins/timecontrol/icons/hi32-action-tderadio_kalarm.pngbin0 -> 1544 bytes
-rw-r--r--plugins/timecontrol/icons/hi32-action-tderadio_zzz.pngbin0 -> 1304 bytes
-rw-r--r--plugins/timecontrol/icons/hi48-action-tderadio_kalarm.pngbin0 -> 1927 bytes
-rw-r--r--plugins/timecontrol/icons/hi48-action-tderadio_zzz.pngbin0 -> 2018 bytes
-rw-r--r--plugins/timecontrol/icons/tderadio_zzz.pngbin0 -> 14219 bytes
-rw-r--r--plugins/timecontrol/po/Makefile.am2
-rw-r--r--plugins/timecontrol/po/de.po116
-rw-r--r--plugins/timecontrol/po/pt.po111
-rw-r--r--plugins/timecontrol/po/ru.po116
-rw-r--r--plugins/timecontrol/po/tderadio-timecontrol.pot114
-rw-r--r--plugins/timecontrol/timecontrol-configuration-ui.ui450
-rw-r--r--plugins/timecontrol/timecontrol-configuration.cpp425
-rw-r--r--plugins/timecontrol/timecontrol-configuration.h91
-rw-r--r--plugins/timecontrol/timecontrol.cpp301
-rw-r--r--plugins/timecontrol/timecontrol.h96
22 files changed, 1852 insertions, 0 deletions
diff --git a/plugins/timecontrol/CMakeL10n.txt b/plugins/timecontrol/CMakeL10n.txt
new file mode 100644
index 0000000..1b6cf40
--- /dev/null
+++ b/plugins/timecontrol/CMakeL10n.txt
@@ -0,0 +1,6 @@
+##### create translation templates ##############
+
+tde_l10n_create_template(
+ CATALOG "tderadio-timecontrol"
+ DESTINATION "po"
+)
diff --git a/plugins/timecontrol/Makefile.am b/plugins/timecontrol/Makefile.am
new file mode 100644
index 0000000..edcda42
--- /dev/null
+++ b/plugins/timecontrol/Makefile.am
@@ -0,0 +1,17 @@
+SUBDIRS = po icons .
+
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+libtderadio_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/tderadio-timecontrol.pot
+
+messages: rc.cpp
+ $(EXTRACTRC) *.rc *.ui >> rc.cpp
+ $(XGETTEXT) rc.cpp *.h *.cpp -o po/tderadio-timecontrol.pot
diff --git a/plugins/timecontrol/icons/Makefile.am b/plugins/timecontrol/icons/Makefile.am
new file mode 100644
index 0000000..a594625
--- /dev/null
+++ b/plugins/timecontrol/icons/Makefile.am
@@ -0,0 +1,7 @@
+#icons_ICON = tderadio_*
+#iconsdir = $(datadir)/icons
+
+KDE_ICON = tderadio_zzz
+
+icons_ICON = tderadio_kalarm tderadio_zzz
+iconsdir = $(datadir)/icons
diff --git a/plugins/timecontrol/icons/hi16-action-tderadio_kalarm.png b/plugins/timecontrol/icons/hi16-action-tderadio_kalarm.png
new file mode 100644
index 0000000..3009d55
--- /dev/null
+++ b/plugins/timecontrol/icons/hi16-action-tderadio_kalarm.png
Binary files differ
diff --git a/plugins/timecontrol/icons/hi16-action-tderadio_zzz.png b/plugins/timecontrol/icons/hi16-action-tderadio_zzz.png
new file mode 100644
index 0000000..0d677f4
--- /dev/null
+++ b/plugins/timecontrol/icons/hi16-action-tderadio_zzz.png
Binary files differ
diff --git a/plugins/timecontrol/icons/hi22-action-tderadio_kalarm.png b/plugins/timecontrol/icons/hi22-action-tderadio_kalarm.png
new file mode 100644
index 0000000..e4273d6
--- /dev/null
+++ b/plugins/timecontrol/icons/hi22-action-tderadio_kalarm.png
Binary files differ
diff --git a/plugins/timecontrol/icons/hi22-action-tderadio_zzz.png b/plugins/timecontrol/icons/hi22-action-tderadio_zzz.png
new file mode 100644
index 0000000..2a5ad8d
--- /dev/null
+++ b/plugins/timecontrol/icons/hi22-action-tderadio_zzz.png
Binary files differ
diff --git a/plugins/timecontrol/icons/hi32-action-tderadio_kalarm.png b/plugins/timecontrol/icons/hi32-action-tderadio_kalarm.png
new file mode 100644
index 0000000..2ae2809
--- /dev/null
+++ b/plugins/timecontrol/icons/hi32-action-tderadio_kalarm.png
Binary files differ
diff --git a/plugins/timecontrol/icons/hi32-action-tderadio_zzz.png b/plugins/timecontrol/icons/hi32-action-tderadio_zzz.png
new file mode 100644
index 0000000..4089298
--- /dev/null
+++ b/plugins/timecontrol/icons/hi32-action-tderadio_zzz.png
Binary files differ
diff --git a/plugins/timecontrol/icons/hi48-action-tderadio_kalarm.png b/plugins/timecontrol/icons/hi48-action-tderadio_kalarm.png
new file mode 100644
index 0000000..e88778d
--- /dev/null
+++ b/plugins/timecontrol/icons/hi48-action-tderadio_kalarm.png
Binary files differ
diff --git a/plugins/timecontrol/icons/hi48-action-tderadio_zzz.png b/plugins/timecontrol/icons/hi48-action-tderadio_zzz.png
new file mode 100644
index 0000000..a131574
--- /dev/null
+++ b/plugins/timecontrol/icons/hi48-action-tderadio_zzz.png
Binary files differ
diff --git a/plugins/timecontrol/icons/tderadio_zzz.png b/plugins/timecontrol/icons/tderadio_zzz.png
new file mode 100644
index 0000000..063e502
--- /dev/null
+++ b/plugins/timecontrol/icons/tderadio_zzz.png
Binary files differ
diff --git a/plugins/timecontrol/po/Makefile.am b/plugins/timecontrol/po/Makefile.am
new file mode 100644
index 0000000..26d490c
--- /dev/null
+++ b/plugins/timecontrol/po/Makefile.am
@@ -0,0 +1,2 @@
+PACKAGE = tderadio-timecontrol
+POFILES = AUTO
diff --git a/plugins/timecontrol/po/de.po b/plugins/timecontrol/po/de.po
new file mode 100644
index 0000000..b84f50f
--- /dev/null
+++ b/plugins/timecontrol/po/de.po
@@ -0,0 +1,116 @@
+# translation of de.po to
+# translation of tderadio-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: 2020-05-11 04:30+0200\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"
+"Language: \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"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr "Ernst Martin Witte"
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+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-configuration-ui.ui:117 timecontrol.cpp:270
+#, no-c-format
+msgid "Alarms"
+msgstr "Wecker"
+
+#: timecontrol.cpp:270
+msgid "Setup Alarms"
+msgstr "Wecker einrichten"
+
+#: timecontrol-configuration-ui.ui:32
+#, no-c-format
+msgid "sleep countdown"
+msgstr "Schlummermodus"
+
+#: timecontrol-configuration-ui.ui:40
+#, no-c-format
+msgid " min"
+msgstr " min"
+
+#: timecontrol-configuration-ui.ui:180
+#, no-c-format
+msgid "Date"
+msgstr "Datum"
+
+#: timecontrol-configuration-ui.ui:203
+#, no-c-format
+msgid "Time"
+msgstr "Uhrzeit"
+
+#: timecontrol-configuration-ui.ui:226
+#, no-c-format
+msgid "Volume"
+msgstr "Lautstärke"
+
+#: timecontrol-configuration-ui.ui:234
+#, no-c-format
+msgid " %"
+msgstr " %"
+
+#: timecontrol-configuration-ui.ui:263
+#, no-c-format
+msgid "enabled"
+msgstr "aktiv"
+
+#: timecontrol-configuration-ui.ui:331
+#, no-c-format
+msgid "daily"
+msgstr "täglich"
+
+#: timecontrol-configuration-ui.ui:341
+#, no-c-format
+msgid "Radio Station"
+msgstr "Sender"
+
+#: timecontrol-configuration-ui.ui:393
+#, no-c-format
+msgid "Start Playing"
+msgstr "Radio einschalten"
+
+#: timecontrol-configuration-ui.ui:401
+#, no-c-format
+msgid "Stop Playing"
+msgstr "Radio ausschalten"
+
+#: timecontrol-configuration-ui.ui:409
+#, no-c-format
+msgid "Start Recording"
+msgstr "Aufnahme starten"
+
+#: timecontrol-configuration-ui.ui:417
+#, no-c-format
+msgid "Stop Recording"
+msgstr "Aufnahme beenden"
diff --git a/plugins/timecontrol/po/pt.po b/plugins/timecontrol/po/pt.po
new file mode 100644
index 0000000..30d85af
--- /dev/null
+++ b/plugins/timecontrol/po/pt.po
@@ -0,0 +1,111 @@
+# SOME DESCRIPTIVE TITLE.
+# Hugo Carvalho <hugokarvalho@hotmail.com>, 2020.
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2020-05-11 04:30+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: pt\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr ""
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr ""
+
+#: 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-configuration-ui.ui:117 timecontrol.cpp:270
+#, no-c-format
+msgid "Alarms"
+msgstr ""
+
+#: timecontrol.cpp:270
+msgid "Setup Alarms"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:32
+#, no-c-format
+msgid "sleep countdown"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:40
+#, no-c-format
+msgid " min"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:180
+#, no-c-format
+msgid "Date"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:203
+#, no-c-format
+msgid "Time"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:226
+#, no-c-format
+msgid "Volume"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:234
+#, no-c-format
+msgid " %"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:263
+#, no-c-format
+msgid "enabled"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:331
+#, no-c-format
+msgid "daily"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:341
+#, no-c-format
+msgid "Radio Station"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:393
+#, no-c-format
+msgid "Start Playing"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:401
+#, no-c-format
+msgid "Stop Playing"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:409
+#, no-c-format
+msgid "Start Recording"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:417
+#, no-c-format
+msgid "Stop Recording"
+msgstr ""
diff --git a/plugins/timecontrol/po/ru.po b/plugins/timecontrol/po/ru.po
new file mode 100644
index 0000000..50bd8a9
--- /dev/null
+++ b/plugins/timecontrol/po/ru.po
@@ -0,0 +1,116 @@
+# translation of ru.po to
+# translation of tderadio-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: 2020-05-11 04:30+0200\n"
+"PO-Revision-Date: 2006-11-08 12:57+0300\n"
+"Last-Translator: Алексей Кузнецов <Alexey.Kouznetsov@GMail.com>\n"
+"Language-Team: <ru@li.org>\n"
+"Language: \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"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr "Алексей Кузнецов"
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+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-configuration-ui.ui:117 timecontrol.cpp:270
+#, no-c-format
+msgid "Alarms"
+msgstr "Расписание"
+
+#: timecontrol.cpp:270
+msgid "Setup Alarms"
+msgstr "Расписание"
+
+#: timecontrol-configuration-ui.ui:32
+#, no-c-format
+msgid "sleep countdown"
+msgstr "Период таймера отключения"
+
+#: timecontrol-configuration-ui.ui:40
+#, no-c-format
+msgid " min"
+msgstr " мин"
+
+#: timecontrol-configuration-ui.ui:180
+#, no-c-format
+msgid "Date"
+msgstr "Дата"
+
+#: timecontrol-configuration-ui.ui:203
+#, no-c-format
+msgid "Time"
+msgstr "Время"
+
+#: timecontrol-configuration-ui.ui:226
+#, no-c-format
+msgid "Volume"
+msgstr "Громкость"
+
+#: timecontrol-configuration-ui.ui:234
+#, no-c-format
+msgid " %"
+msgstr " %"
+
+#: timecontrol-configuration-ui.ui:263
+#, no-c-format
+msgid "enabled"
+msgstr "Включено"
+
+#: timecontrol-configuration-ui.ui:331
+#, no-c-format
+msgid "daily"
+msgstr "Ежедневно"
+
+#: timecontrol-configuration-ui.ui:341
+#, no-c-format
+msgid "Radio Station"
+msgstr "Радиостанция"
+
+#: timecontrol-configuration-ui.ui:393
+#, no-c-format
+msgid "Start Playing"
+msgstr "Начать воспроизведение"
+
+#: timecontrol-configuration-ui.ui:401
+#, no-c-format
+msgid "Stop Playing"
+msgstr "Остановить воспроизведение"
+
+#: timecontrol-configuration-ui.ui:409
+#, no-c-format
+msgid "Start Recording"
+msgstr "Начать запись"
+
+#: timecontrol-configuration-ui.ui:417
+#, no-c-format
+msgid "Stop Recording"
+msgstr "Остановить запись"
diff --git a/plugins/timecontrol/po/tderadio-timecontrol.pot b/plugins/timecontrol/po/tderadio-timecontrol.pot
new file mode 100644
index 0000000..a8b0c40
--- /dev/null
+++ b/plugins/timecontrol/po/tderadio-timecontrol.pot
@@ -0,0 +1,114 @@
+# SOME DESCRIPTIVE TITLE.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2020-05-11 04:30+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Instead of a literal translation, add your name to the end of the list (separated by a comma).
+#, ignore-inconsistent
+msgid ""
+"_: NAME OF TRANSLATORS\n"
+"Your names"
+msgstr ""
+
+#. Instead of a literal translation, add your email to the end of the list (separated by a comma).
+#, ignore-inconsistent
+msgid ""
+"_: EMAIL OF TRANSLATORS\n"
+"Your emails"
+msgstr ""
+
+#: 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-configuration-ui.ui:117 timecontrol.cpp:270
+#, no-c-format
+msgid "Alarms"
+msgstr ""
+
+#: timecontrol.cpp:270
+msgid "Setup Alarms"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:32
+#, no-c-format
+msgid "sleep countdown"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:40
+#, no-c-format
+msgid " min"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:180
+#, no-c-format
+msgid "Date"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:203
+#, no-c-format
+msgid "Time"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:226
+#, no-c-format
+msgid "Volume"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:234
+#, no-c-format
+msgid " %"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:263
+#, no-c-format
+msgid "enabled"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:331
+#, no-c-format
+msgid "daily"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:341
+#, no-c-format
+msgid "Radio Station"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:393
+#, no-c-format
+msgid "Start Playing"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:401
+#, no-c-format
+msgid "Stop Playing"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:409
+#, no-c-format
+msgid "Start Recording"
+msgstr ""
+
+#: timecontrol-configuration-ui.ui:417
+#, no-c-format
+msgid "Stop Recording"
+msgstr ""
diff --git a/plugins/timecontrol/timecontrol-configuration-ui.ui b/plugins/timecontrol/timecontrol-configuration-ui.ui
new file mode 100644
index 0000000..f528418
--- /dev/null
+++ b/plugins/timecontrol/timecontrol-configuration-ui.ui
@@ -0,0 +1,450 @@
+<!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>"edit-delete"</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>"tderadio_muteoff"</pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Stop Playing</string>
+ </property>
+ <property name="pixmap">
+ <pixmap>"tderadio_muteon"</pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Start Recording</string>
+ </property>
+ <property name="pixmap">
+ <pixmap>"tderadio_record"</pixmap>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Stop Recording</string>
+ </property>
+ <property name="pixmap">
+ <pixmap>"tderadio_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>
+<pixmapfunction>SmallIcon</pixmapfunction>
+<layoutdefaults spacing="6" margin="0"/>
+<includes>
+ <include location="global" impldecl="in implementation">kiconloader.h</include>
+ <include location="global" impldecl="in implementation">tdelistbox.h</include>
+</includes>
+</UI>
diff --git a/plugins/timecontrol/timecontrol-configuration.cpp b/plugins/timecontrol/timecontrol-configuration.cpp
new file mode 100644
index 0000000..db3a760
--- /dev/null
+++ b/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 <tdelistbox.h>
+#include <tdelocale.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/plugins/timecontrol/timecontrol-configuration.h b/plugins/timecontrol/timecontrol-configuration.h
new file mode 100644
index 0000000..b53747e
--- /dev/null
+++ b/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/plugins/timecontrol/timecontrol.cpp b/plugins/timecontrol/timecontrol.cpp
new file mode 100644
index 0000000..1b56ff0
--- /dev/null
+++ b/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 <tdeaboutdata.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, "tderadio-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"), "tderadio_kalarm");
+}
+
+
+AboutPageInfo TimeControl::createAboutPage()
+{
+/* TDEAboutData aboutData("tderadio",
+ 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/tderadio",
+ 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"),
+ "tderadio_kalarm"
+ );*/
+ return AboutPageInfo();
+}
+
+
+#include "timecontrol.moc"
diff --git a/plugins/timecontrol/timecontrol.h b/plugins/timecontrol/timecontrol.h
new file mode 100644
index 0000000..933d8f2
--- /dev/null
+++ b/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