summaryrefslogtreecommitdiffabout
path: root/kalarmd/alarmdialog.cpp
authorzautrix <zautrix>2005-03-27 13:04:11 (UTC)
committer zautrix <zautrix>2005-03-27 13:04:11 (UTC)
commit9e3e43aaca0986ae224c752d2d3a760661be61b6 (patch) (unidiff)
tree18295c0cc7177be6022a7abec716131f06b2a756 /kalarmd/alarmdialog.cpp
parent1800cf5f3af1f666dddcbfffe3171adcd467ae3d (diff)
downloadkdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.zip
kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.tar.gz
kdepimpi-9e3e43aaca0986ae224c752d2d3a760661be61b6.tar.bz2
fixes
Diffstat (limited to 'kalarmd/alarmdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/alarmdialog.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 7ead3b9..7b888ab 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -1,133 +1,137 @@
1/* 1/*
2 This file is part of the KDE alarm daemon. 2 This file is part of the KDE alarm daemon.
3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// $Id$ 24// $Id$
25 25
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qapp.h> 28#include <qapp.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qlayout.h> 30#include <qlayout.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qsound.h> 33#include <qsound.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#ifndef DESKTOP_VERSION
35#define protected public 36#define protected public
36#include <qspinbox.h> 37#include <qspinbox.h>
37#undef protected 38#undef protected
39#else
40#include <qspinbox.h>
41#endif
38#include <stdlib.h> 42#include <stdlib.h>
39#ifndef _WIN32_ 43#ifndef _WIN32_
40#include <unistd.h> 44#include <unistd.h>
41#include <sys/ioctl.h> 45#include <sys/ioctl.h>
42#endif 46#endif
43#include <stdio.h> 47#include <stdio.h>
44#include <fcntl.h> 48#include <fcntl.h>
45 49
46#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
47#include <qtopia/alarmserver.h> 51#include <qtopia/alarmserver.h>
48#include <qpe/resource.h> 52#include <qpe/resource.h>
49#include <qtopia/sound.h> 53#include <qtopia/sound.h>
50 54
51#endif 55#endif
52 56
53#include "alarmdialog.h" 57#include "alarmdialog.h"
54 58
55 59
56AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 60AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
57 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop ) 61 : QDialog (parent, name, true, Qt::WStyle_StaysOnTop )
58{ 62{
59 setCaption( "KO/Pi Alarm!" ); 63 setCaption( "KO/Pi Alarm!" );
60 QVBoxLayout* layout = new QVBoxLayout( this); 64 QVBoxLayout* layout = new QVBoxLayout( this);
61 QLabel* l = new QLabel("The following event triggered alarm:",this); 65 QLabel* l = new QLabel("The following event triggered alarm:",this);
62 layout->addWidget ( l ); 66 layout->addWidget ( l );
63 l->setAlignment( AlignCenter); 67 l->setAlignment( AlignCenter);
64 mMessage = new QLabel ( " ", this ); 68 mMessage = new QLabel ( " ", this );
65 int fs = 18; 69 int fs = 18;
66 int fs2 = 12; 70 int fs2 = 12;
67 if ( QApplication::desktop()->width() < 480 ) { 71 if ( QApplication::desktop()->width() < 480 ) {
68 setMaximumSize(220, 260); 72 setMaximumSize(220, 260);
69 fs2 = 10; 73 fs2 = 10;
70 } 74 }
71 else { 75 else {
72 setMaximumSize(440, 440); 76 setMaximumSize(440, 440);
73 } 77 }
74 layout->setSpacing( 3 ); 78 layout->setSpacing( 3 );
75 layout->setMargin( 3 ); 79 layout->setMargin( 3 );
76 QFont fo = QApplication::font(); 80 QFont fo = QApplication::font();
77 fo.setBold( true ); 81 fo.setBold( true );
78 fo.setPointSize( fs2 ); 82 fo.setPointSize( fs2 );
79 l->setFont( fo ); 83 l->setFont( fo );
80 fo.setPointSize( fs ); 84 fo.setPointSize( fs );
81 mMessage->setFont(fo ); 85 mMessage->setFont(fo );
82 mMessage->setAlignment( AlignCenter); 86 mMessage->setAlignment( AlignCenter);
83 layout->addWidget ( mMessage ); 87 layout->addWidget ( mMessage );
84 mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); 88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this );
85 mMissedAlarms->setAlignment( AlignCenter); 89 mMissedAlarms->setAlignment( AlignCenter);
86 90
87 playSoundTimer = new QTimer( this ); 91 playSoundTimer = new QTimer( this );
88 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); 92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
89 93
90 playSoundTimer->stop(); 94 playSoundTimer->stop();
91 95
92 layout->addWidget ( mMissedAlarms ); 96 layout->addWidget ( mMissedAlarms );
93 mMissedAlarmsCombo = new QComboBox ( this ); 97 mMissedAlarmsCombo = new QComboBox ( this );
94 layout->addWidget ( mMissedAlarmsCombo ); 98 layout->addWidget ( mMissedAlarmsCombo );
95 99
96 QLabel* labb = new QLabel("Suspend duration (minutes):",this); 100 QLabel* labb = new QLabel("Suspend duration (minutes):",this);
97 labb->setAlignment(AlignCenter); 101 labb->setAlignment(AlignCenter);
98 layout->addWidget ( labb ); 102 layout->addWidget ( labb );
99 fo = font(); 103 fo = font();
100 int pointSize = 36; 104 int pointSize = 36;
101 if ( QApplication::desktop()->width() <= 320 ) 105 if ( QApplication::desktop()->width() <= 320 )
102 pointSize = 24; 106 pointSize = 24;
103 fo.setPointSize( pointSize ); 107 fo.setPointSize( pointSize );
104 mSuspendSpin = new QSpinBox(1,1440,1,this); 108 mSuspendSpin = new QSpinBox(1,1440,1,this);
105 mSuspendSpin->setFont( fo ); 109 mSuspendSpin->setFont( fo );
106 mSuspendSpin->setValue(7); // default suspend duration 110 mSuspendSpin->setValue(7); // default suspend duration
107 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
108 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 112 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
109#if QT_VERSION < 0x030000 113#if QT_VERSION < 0x030000
110 mSuspendSpin->upButton ()->setFixedSize( QSize( 48, 30 )); 114 mSuspendSpin->upButton ()->setFixedSize( QSize( 48, 30 ));
111 mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 )); 115 mSuspendSpin->downButton ()->setFixedSize( QSize( 48, 30 ));
112#endif 116#endif
113 mSuspendSpin->setFixedSize( 100,62 ); 117 mSuspendSpin->setFixedSize( 100,62 );
114 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 118 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
115 QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); 119 QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
116 layoutSpin->addStretch (); 120 layoutSpin->addStretch ();
117 layoutSpin->addWidget ( mSuspendSpin ); 121 layoutSpin->addWidget ( mSuspendSpin );
118 layoutSpin->addStretch (); 122 layoutSpin->addStretch ();
119 123
120 QVBox * bbox = new QVBox ( this ); 124 QVBox * bbox = new QVBox ( this );
121 layout->addWidget ( bbox ); 125 layout->addWidget ( bbox );
122 bbox->layout()->setSpacing( 2 ); 126 bbox->layout()->setSpacing( 2 );
123 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); 127 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
124 labb->setAlignment(AlignCenter); 128 labb->setAlignment(AlignCenter);
125 mSuspendButton = new QPushButton( "Suspend", bbox); 129 mSuspendButton = new QPushButton( "Suspend", bbox);
126 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 130 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
127 QPushButton* okbut = new QPushButton( "Ok", bbox); 131 QPushButton* okbut = new QPushButton( "Ok", bbox);
128 mSuspendButton->setFont( fo ); 132 mSuspendButton->setFont( fo );
129 silen->setFont( fo ); 133 silen->setFont( fo );
130 okbut->setFont( fo ); 134 okbut->setFont( fo );
131 okbut->setDefault( true ); 135 okbut->setDefault( true );
132 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); 136 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
133 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); 137 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );