summaryrefslogtreecommitdiffabout
path: root/kalarmd
authorzautrix <zautrix>2005-07-01 17:57:30 (UTC)
committer zautrix <zautrix>2005-07-01 17:57:30 (UTC)
commit98d29d15275c4b8e9a3348742925f6e6d03f7a07 (patch) (unidiff)
treeea0af6d2100287c696bb00e1197d6c99f29f41e8 /kalarmd
parentf330b9d0a7f755660ddd59739e3ab9b98d60bc18 (diff)
downloadkdepimpi-98d29d15275c4b8e9a3348742925f6e6d03f7a07.zip
kdepimpi-98d29d15275c4b8e9a3348742925f6e6d03f7a07.tar.gz
kdepimpi-98d29d15275c4b8e9a3348742925f6e6d03f7a07.tar.bz2
fixx
Diffstat (limited to 'kalarmd') (more/less context) (ignore whitespace changes)
-rw-r--r--kalarmd/alarmdialog.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 17d4afa..ddb125a 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -37,128 +37,133 @@
37#define protected public 37#define protected public
38#include <qspinbox.h> 38#include <qspinbox.h>
39#undef protected 39#undef protected
40#else 40#else
41#include <qspinbox.h> 41#include <qspinbox.h>
42#endif 42#endif
43#include <stdlib.h> 43#include <stdlib.h>
44#ifndef _WIN32_ 44#ifndef _WIN32_
45#include <unistd.h> 45#include <unistd.h>
46#include <sys/ioctl.h> 46#include <sys/ioctl.h>
47#endif 47#endif
48#include <stdio.h> 48#include <stdio.h>
49#include <fcntl.h> 49#include <fcntl.h>
50 50
51#ifndef DESKTOP_VERSION 51#ifndef DESKTOP_VERSION
52#include <qtopia/alarmserver.h> 52#include <qtopia/alarmserver.h>
53#include <qpe/resource.h> 53#include <qpe/resource.h>
54#include <qtopia/sound.h> 54#include <qtopia/sound.h>
55 55
56#endif 56#endif
57 57
58#include "alarmdialog.h" 58#include "alarmdialog.h"
59 59
60 60
61AlarmDialog::AlarmDialog(QWidget *parent,const char *name) 61AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
62 : QDialog (parent, name ,false, Qt::WStyle_StaysOnTop ) 62 : QDialog (parent, name ,false, Qt::WStyle_StaysOnTop )
63{ 63{
64 setCaption( "KO/Pi Alarm!" ); 64 setCaption( "KO/Pi Alarm!" );
65 QVBoxLayout* layout = new QVBoxLayout( this); 65 QVBoxLayout* layout = new QVBoxLayout( this);
66 QLabel* l = new QLabel("The following event triggered alarm:",this); 66 QLabel* l = new QLabel("The following event triggered alarm:",this);
67 layout->addWidget ( l ); 67 layout->addWidget ( l );
68 l->setAlignment( AlignCenter); 68 l->setAlignment( AlignCenter);
69 mMessage = new QLabel ( " ", this ); 69 mMessage = new QLabel ( " ", this );
70 int fs = 18; 70 int fs = 18;
71 int fs2 = 12; 71 int fs2 = 12;
72 int baseSize = 6; 72 int baseSize = 6;
73 if ( QApplication::desktop()->width() < 480 ) { 73 if ( QApplication::desktop()->width() < 480 ) {
74 fs2 = 10; 74 fs2 = 10;
75 fs = 12; 75 fs = 12;
76 baseSize = 4; 76 baseSize = 4;
77 } 77 }
78 layout->setSpacing( 3 ); 78 layout->setSpacing( 3 );
79 layout->setMargin( 3 ); 79 layout->setMargin( 3 );
80 QFont fo = QApplication::font(); 80 QFont fo = QApplication::font();
81 fo.setBold( true ); 81 fo.setBold( true );
82 fo.setPointSize( fs2 ); 82 fo.setPointSize( fs2 );
83 l->setFont( fo ); 83 l->setFont( fo );
84 fo.setPointSize( fs ); 84 fo.setPointSize( fs );
85 mMessage->setFont(fo ); 85 mMessage->setFont(fo );
86 mMessage->setAlignment( AlignCenter); 86 mMessage->setAlignment( AlignCenter);
87 layout->addWidget ( mMessage ); 87 layout->addWidget ( mMessage );
88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this ); 88 mMissedAlarms= new QLabel ( "(No missed Alarms)", this );
89 mMissedAlarms->setAlignment( AlignCenter); 89 mMissedAlarms->setAlignment( AlignCenter);
90 90
91 playSoundTimer = new QTimer( this ); 91 playSoundTimer = new QTimer( this );
92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) ); 92 connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
93 93
94 playSoundTimer->stop(); 94 playSoundTimer->stop();
95 95
96 layout->addWidget ( mMissedAlarms ); 96 layout->addWidget ( mMissedAlarms );
97 mMissedAlarmsCombo = new QComboBox ( this ); 97 mMissedAlarmsCombo = new QComboBox ( this );
98 layout->addWidget ( mMissedAlarmsCombo ); 98 layout->addWidget ( mMissedAlarmsCombo );
99 99
100 QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this); 100 QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this);
101#ifdef DESKTOP_VERSION
102 fo = font();
103 fo.setPointSize( 12 );
104 labb->setFont ( fo );
105#endif
101 labb->setAlignment(AlignCenter); 106 labb->setAlignment(AlignCenter);
102 //layout->addWidget ( labb ); 107 //layout->addWidget ( labb );
103 fo = font(); 108 fo = font();
104 int pointSize = 36; 109 int pointSize = 36;
105 if ( QApplication::desktop()->width() <= 320 ) 110 if ( QApplication::desktop()->width() <= 320 )
106 pointSize = 18; 111 pointSize = 18;
107 fo.setPointSize( pointSize ); 112 fo.setPointSize( pointSize );
108 mSuspendSpin = new QSpinBox(1,1440,1,this); 113 mSuspendSpin = new QSpinBox(1,1440,1,this);
109 mSuspendSpin->setFont( fo ); 114 mSuspendSpin->setFont( fo );
110 mSuspendSpin->setValue(7); // default suspend duration 115 mSuspendSpin->setValue(7); // default suspend duration
111 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 116 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
112 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 117 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
113 118
114#if QT_VERSION < 0x030000 119#if QT_VERSION < 0x030000
115 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); 120 mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
116 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize )); 121 mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
117#endif 122#endif
118 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 ); 123 mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 );
119 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus ); 124 mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
120 QHBoxLayout* layoutSpin = new QHBoxLayout( layout ); 125 QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
121 layoutSpin->addStretch (); 126 layoutSpin->addStretch ();
122 layoutSpin->addWidget ( labb ); 127 layoutSpin->addWidget ( labb );
123 layoutSpin->addWidget ( mSuspendSpin ); 128 layoutSpin->addWidget ( mSuspendSpin );
124 layoutSpin->addStretch (); 129 layoutSpin->addStretch ();
125 130
126 QVBox * bbox = new QVBox ( this ); 131 QVBox * bbox = new QVBox ( this );
127 layout->addWidget ( bbox ); 132 layout->addWidget ( bbox );
128 bbox->layout()->setSpacing( 2 ); 133 bbox->layout()->setSpacing( 2 );
129 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox); 134 labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
130 labb->setAlignment(AlignCenter); 135 labb->setAlignment(AlignCenter);
131 mSuspendButton = new QPushButton( "Suspend", bbox); 136 mSuspendButton = new QPushButton( "Suspend", bbox);
132 QPushButton* silen = new QPushButton( " Stop sound ", bbox); 137 QPushButton* silen = new QPushButton( " Stop sound ", bbox);
133 okbut = new QPushButton( "Ok", bbox); 138 okbut = new QPushButton( "Ok", bbox);
134 mSuspendButton->setFont( fo ); 139 mSuspendButton->setFont( fo );
135 silen->setFont( fo ); 140 silen->setFont( fo );
136 okbut->setFont( fo ); 141 okbut->setFont( fo );
137 okbut->setDefault( true ); 142 okbut->setDefault( true );
138 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) ); 143 connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
139 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) ); 144 connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );
140 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) ); 145 connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) );
141 connect (mSuspendSpin , SIGNAL( valueChanged ( int ) ), this, SLOT ( spinBoxChanged( int ) ) ); 146 connect (mSuspendSpin , SIGNAL( valueChanged ( int ) ), this, SLOT ( spinBoxChanged( int ) ) );
142#ifndef _WIN32_ 147#ifndef _WIN32_
143 if ( QFile::exists ( "/dev/sharp_led" ) ) 148 if ( QFile::exists ( "/dev/sharp_led" ) )
144 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 149 fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
145 else 150 else
146#endif 151#endif
147 fd_led = 0; 152 fd_led = 0;
148 statusLED.which = SHARP_LED_SALARM; 153 statusLED.which = SHARP_LED_SALARM;
149 mSilent = false; 154 mSilent = false;
150 mSuspendCounter = 0; 155 mSuspendCounter = 0;
151 setServerNotification( true ); 156 setServerNotification( true );
152} 157}
153void AlarmDialog::reject () 158void AlarmDialog::reject ()
154{ 159{
155 QTimer::singleShot ( 3000, this, SLOT (suspend()) ); 160 QTimer::singleShot ( 3000, this, SLOT (suspend()) );
156 slotSuspend(); 161 slotSuspend();
157} 162}
158AlarmDialog::~AlarmDialog() 163AlarmDialog::~AlarmDialog()
159{ 164{
160} 165}
161void AlarmDialog::silent () 166void AlarmDialog::silent ()
162{ 167{
163 mSilent = true; 168 mSilent = true;
164} 169}