-rw-r--r-- | noncore/tools/clock/clock.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index ad422a6..e681650 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp | |||
@@ -40,129 +40,129 @@ | |||
40 | 40 | ||
41 | 41 | ||
42 | 42 | ||
43 | #include <qlcdnumber.h> | 43 | #include <qlcdnumber.h> |
44 | #include <qslider.h> | 44 | #include <qslider.h> |
45 | #include <qlabel.h> | 45 | #include <qlabel.h> |
46 | #include <qtimer.h> | 46 | #include <qtimer.h> |
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | #include <qtoolbutton.h> | 48 | #include <qtoolbutton.h> |
49 | #include <qpainter.h> | 49 | #include <qpainter.h> |
50 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
51 | #include <qdatetime.h> | 51 | #include <qdatetime.h> |
52 | #include <qspinbox.h> | 52 | #include <qspinbox.h> |
53 | #include <qcombobox.h> | 53 | #include <qcombobox.h> |
54 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
55 | #include <qgroupbox.h> | 55 | #include <qgroupbox.h> |
56 | #include <qlayout.h> | 56 | #include <qlayout.h> |
57 | #include <qhbox.h> | 57 | #include <qhbox.h> |
58 | #include <qlineedit.h> | 58 | #include <qlineedit.h> |
59 | 59 | ||
60 | static const int sw_prec = 2; | 60 | static const int sw_prec = 2; |
61 | static const int magic_daily = 2292922; | 61 | static const int magic_daily = 2292922; |
62 | static const int magic_countdown = 2292923; | 62 | static const int magic_countdown = 2292923; |
63 | static const int magic_snooze = 2292924; | 63 | static const int magic_snooze = 2292924; |
64 | static const int magic_playmp = 2292925; | 64 | static const int magic_playmp = 2292925; |
65 | 65 | ||
66 | #include <math.h> | 66 | #include <math.h> |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #include <sys/types.h> | 68 | #include <sys/types.h> |
69 | 69 | ||
70 | #include <pthread.h> | 70 | #include <pthread.h> |
71 | 71 | ||
72 | 72 | ||
73 | static void toggleScreenSaver( bool on ) | 73 | static void toggleScreenSaver( bool on ) |
74 | { | 74 | { |
75 | QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); | 75 | QCopEnvelope e( "QPE/System", "setScreenSaverMode(int)" ); |
76 | e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); | 76 | e << ( on ? QPEApplication::Enable : QPEApplication::DisableSuspend ); |
77 | } | 77 | } |
78 | 78 | ||
79 | static void startPlayer() | 79 | static void startPlayer() |
80 | { | 80 | { |
81 | Config config( "qpe" ); | 81 | Config config( "qpe" ); |
82 | config.setGroup( "Time" ); | 82 | config.setGroup( "Time" ); |
83 | sleep(15); | 83 | sleep(15); |
84 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); | 84 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); |
85 | e << config.readEntry( "mp3File", "" ); | 85 | e << config.readEntry( "mp3File", "" ); |
86 | } | 86 | } |
87 | 87 | ||
88 | class MySpinBox : public QSpinBox | 88 | class MySpinBox : public QSpinBox |
89 | { | 89 | { |
90 | public: | 90 | public: |
91 | QLineEdit *lineEdit() const { | 91 | QLineEdit *lineEdit() const { |
92 | return editor(); | 92 | return editor(); |
93 | } | 93 | } |
94 | }; | 94 | }; |
95 | 95 | ||
96 | // | 96 | // |
97 | // | 97 | // |
98 | // | 98 | // |
99 | AlarmDlg::AlarmDlg(QWidget *parent, const char *name, bool modal, | 99 | AlarmDlg::AlarmDlg(QWidget *parent, const char *name, bool modal, |
100 | const QString &txt) : | 100 | const QString &txt) : |
101 | AlarmDlgBase(parent, name, modal) | 101 | AlarmDlgBase(parent, name, modal) |
102 | { | 102 | { |
103 | setCaption( tr("Clock") ); | 103 | setCaption( tr("Clock") ); |
104 | pixmap->setPixmap( Resource::loadPixmap("alarmbell") ); | 104 | pixmap->setPixmap( Resource::loadPixmap("clock/alarmbell") ); |
105 | alarmDlgLabel->setText(txt); | 105 | alarmDlgLabel->setText(txt); |
106 | 106 | ||
107 | connect(snoozeTime, SIGNAL(valueChanged(int)), this, | 107 | connect(snoozeTime, SIGNAL(valueChanged(int)), this, |
108 | SLOT(changePrompt(int))); | 108 | SLOT(changePrompt(int))); |
109 | connect(cmdOk, SIGNAL(clicked()), this, SLOT(checkSnooze())); | 109 | connect(cmdOk, SIGNAL(clicked()), this, SLOT(checkSnooze())); |
110 | } | 110 | } |
111 | 111 | ||
112 | // | 112 | // |
113 | // | 113 | // |
114 | // | 114 | // |
115 | void | 115 | void |
116 | AlarmDlg::setText(const QString &txt) | 116 | AlarmDlg::setText(const QString &txt) |
117 | { | 117 | { |
118 | alarmDlgLabel->setText(txt); | 118 | alarmDlgLabel->setText(txt); |
119 | } | 119 | } |
120 | 120 | ||
121 | // | 121 | // |
122 | // | 122 | // |
123 | // | 123 | // |
124 | void | 124 | void |
125 | AlarmDlg::checkSnooze(void) | 125 | AlarmDlg::checkSnooze(void) |
126 | { | 126 | { |
127 | // | 127 | // |
128 | // Ensure we have only one snooze alarm. | 128 | // Ensure we have only one snooze alarm. |
129 | // | 129 | // |
130 | AlarmServer::deleteAlarm(QDateTime(), "QPE/Application/clock", | 130 | AlarmServer::deleteAlarm(QDateTime(), "QPE/Application/clock", |
131 | "alarm(QDateTime,int)", magic_snooze); | 131 | "alarm(QDateTime,int)", magic_snooze); |
132 | 132 | ||
133 | if (snoozeTime->value() > 0) { | 133 | if (snoozeTime->value() > 0) { |
134 | QDateTime wake = QDateTime::currentDateTime(); | 134 | QDateTime wake = QDateTime::currentDateTime(); |
135 | wake = wake.addSecs(snoozeTime->value() * 60); // snoozeTime in minutes | 135 | wake = wake.addSecs(snoozeTime->value() * 60); // snoozeTime in minutes |
136 | 136 | ||
137 | AlarmServer::addAlarm(wake, "QPE/Application/clock", | 137 | AlarmServer::addAlarm(wake, "QPE/Application/clock", |
138 | "alarm(QDateTime,int)", magic_snooze); | 138 | "alarm(QDateTime,int)", magic_snooze); |
139 | } | 139 | } |
140 | accept(); | 140 | accept(); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | void | 145 | void |
146 | AlarmDlg::changePrompt(int mins) | 146 | AlarmDlg::changePrompt(int mins) |
147 | { | 147 | { |
148 | cmdOk->setText(mins > 0 ? tr("Snooze") : tr("Close") ); | 148 | cmdOk->setText(mins > 0 ? tr("Snooze") : tr("Close") ); |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | 152 | ||
153 | Clock::Clock( QWidget * parent, const char *, WFlags f ) | 153 | Clock::Clock( QWidget * parent, const char *, WFlags f ) |
154 | : ClockBase( parent, "clock", f ), swatch_splitms(99), init(FALSE) // No tr | 154 | : ClockBase( parent, "clock", f ), swatch_splitms(99), init(FALSE) // No tr |
155 | { | 155 | { |
156 | alarmDlg = 0; | 156 | alarmDlg = 0; |
157 | swLayout = 0; | 157 | swLayout = 0; |
158 | dayBtn = new QToolButton * [7]; | 158 | dayBtn = new QToolButton * [7]; |
159 | 159 | ||
160 | Config config( "qpe" ); | 160 | Config config( "qpe" ); |
161 | config.setGroup("Time"); | 161 | config.setGroup("Time"); |
162 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 162 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
163 | onMonday = config.readBoolEntry( "MONDAY" ); | 163 | onMonday = config.readBoolEntry( "MONDAY" ); |
164 | 164 | ||
165 | connect( tabs, SIGNAL(currentChanged(QWidget*)), | 165 | connect( tabs, SIGNAL(currentChanged(QWidget*)), |
166 | this, SLOT(tabChanged(QWidget*)) ); | 166 | this, SLOT(tabChanged(QWidget*)) ); |
167 | 167 | ||
168 | analogStopwatch = new AnalogClock( swFrame ); | 168 | analogStopwatch = new AnalogClock( swFrame ); |