author | zautrix <zautrix> | 2005-10-29 00:21:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-29 00:21:37 (UTC) |
commit | acd1c021e6ddef4285b3220d7515a3917416b92f (patch) (unidiff) | |
tree | 3409f47cc4a9a0b6ffb53313e9a3b4a1d82f70ce /kalarmd | |
parent | 7a90e619147e06e5f4d4facef98364f78a4a04ef (diff) | |
download | kdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.zip kdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.tar.gz kdepimpi-acd1c021e6ddef4285b3220d7515a3917416b92f.tar.bz2 |
fix
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.cpp | 52 | ||||
-rw-r--r-- | kalarmd/simplealarmdaemonimpl.h | 4 |
2 files changed, 42 insertions, 14 deletions
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp index 82873e1..2742610 100644 --- a/kalarmd/simplealarmdaemonimpl.cpp +++ b/kalarmd/simplealarmdaemonimpl.cpp | |||
@@ -66,16 +66,19 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) | |||
66 | mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); | 66 | mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) ); |
67 | mPopUp->insertSeparator(); | 67 | mPopUp->insertSeparator(); |
68 | mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); | 68 | mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) ); |
69 | mTimerPopUp = new QPopupMenu( this ); | 69 | mTimerPopUp = new QPopupMenu( this ); |
70 | QFont fon = mTimerPopUp->font(); | 70 | |
71 | int points = (fon.pointSize()*4)/3; | ||
72 | fon.setPointSize( points ); | ||
73 | mTimerPopUp->setFont( fon ); | ||
74 | mPopUp->setFont( fon ); | ||
75 | mBeepPopUp = new QPopupMenu( this ); | 71 | mBeepPopUp = new QPopupMenu( this ); |
76 | mSoundPopUp = new QPopupMenu( this ); | 72 | mSoundPopUp = new QPopupMenu( this ); |
77 | mPausePopUp = new QPopupMenu( this ); | 73 | mPausePopUp = new QPopupMenu( this ); |
74 | mFontsizePopup = new QPopupMenu( this ); | ||
75 | mFontsizePopup->insertItem( "10", 10 ); | ||
76 | mFontsizePopup->insertItem( "12", 12 ); | ||
77 | mFontsizePopup->insertItem( "14", 14 ); | ||
78 | mFontsizePopup->insertItem( "16", 16 ); | ||
79 | mFontsizePopup->insertItem( "18", 18 ); | ||
80 | mFontsizePopup->insertItem( "24", 24 ); | ||
78 | QPopupMenu* savePopUp = new QPopupMenu( this ); | 81 | QPopupMenu* savePopUp = new QPopupMenu( this ); |
79 | savePopUp->insertItem( "Save", 0 ); | 82 | savePopUp->insertItem( "Save", 0 ); |
80 | savePopUp->insertItem( "Load", 1 ); | 83 | savePopUp->insertItem( "Load", 1 ); |
81 | mSoundPopUp->insertItem( "Buzzer", 0 ); | 84 | mSoundPopUp->insertItem( "Buzzer", 0 ); |
@@ -100,8 +103,9 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) | |||
100 | mSuspendPopUp->insertItem( "30x", 30 ); | 103 | mSuspendPopUp->insertItem( "30x", 30 ); |
101 | mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); | 104 | mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp ); |
102 | mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); | 105 | mBeepPopUp->insertItem( "Beep interval",mPausePopUp ); |
103 | mBeepPopUp->insertItem( "Replay",mSoundPopUp ); | 106 | mBeepPopUp->insertItem( "Replay",mSoundPopUp ); |
107 | mBeepPopUp->insertItem( "Font Size",mFontsizePopup ); | ||
104 | mBeepPopUp->insertItem( "Config",savePopUp ); | 108 | mBeepPopUp->insertItem( "Config",savePopUp ); |
105 | mBeepPopUp->insertItem( "300", 300 ); | 109 | mBeepPopUp->insertItem( "300", 300 ); |
106 | mBeepPopUp->insertItem( "180", 180 ); | 110 | mBeepPopUp->insertItem( "180", 180 ); |
107 | mBeepPopUp->insertItem( "60", 60 ); | 111 | mBeepPopUp->insertItem( "60", 60 ); |
@@ -128,9 +132,10 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) | |||
128 | connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); | 132 | connect ( mTimerPopUp, SIGNAL(aboutToShow() ), this, SLOT ( showTimer( ) ) ); |
129 | connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); | 133 | connect ( mSoundPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSound( int ) ) ); |
130 | connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); | 134 | connect ( mPausePopUp, SIGNAL( activated ( int ) ), this, SLOT (confPause( int ) ) ); |
131 | connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); | 135 | connect ( mSuspendPopUp, SIGNAL( activated ( int ) ), this, SLOT (confSuspend( int ) ) ); |
132 | connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); | 136 | connect ( savePopUp, SIGNAL( activated ( int ) ), this, SLOT (saveSlot( int ) ) ); |
137 | connect ( mFontsizePopup, SIGNAL( activated ( int ) ), this, SLOT (confFontSize( int ) ) ); | ||
133 | mTimerTime = 0; | 138 | mTimerTime = 0; |
134 | mCustomText = "Custom Text"; | 139 | mCustomText = "Custom Text"; |
135 | mCustomMinutes = 7; | 140 | mCustomMinutes = 7; |
136 | mTimerPopupConf = 1; | 141 | mTimerPopupConf = 1; |
@@ -146,17 +151,15 @@ SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent ) | |||
146 | else { | 151 | else { |
147 | wavAlarm = true; | 152 | wavAlarm = true; |
148 | mSoundPopUp->setItemChecked ( 1, true ); | 153 | mSoundPopUp->setItemChecked ( 1, true ); |
149 | } | 154 | } |
150 | saveSlot( 1 ); | ||
151 | mTimerStartLabel = new QLabel( 0, 0, WType_Popup ); | 155 | mTimerStartLabel = new QLabel( 0, 0, WType_Popup ); |
152 | //mTimerStartLabel->setCaption( "Timer started!"); | 156 | //mTimerStartLabel->setCaption( "Timer started!"); |
153 | mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ; | 157 | mTimerStartLabel->setAlignment ( Qt::AlignCenter ) ; |
154 | fon = mTimerPopUp->font(); | 158 | saveSlot( 1 ); |
155 | fon.setBold( true ); | 159 | |
156 | points = (fon.pointSize()*2); | 160 | |
157 | fon.setPointSize( points ); | 161 | |
158 | mTimerStartLabel->setFont( fon ); | ||
159 | } | 162 | } |
160 | 163 | ||
161 | SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() | 164 | SimpleAlarmDaemonImpl::~SimpleAlarmDaemonImpl() |
162 | { | 165 | { |
@@ -170,8 +173,10 @@ void SimpleAlarmDaemonImpl::saveSlot( int load ) | |||
170 | QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; | 173 | QString fileName = QDir::homeDirPath() +"/.kopialarmrc"; |
171 | //qDebug("save %d ", load ); | 174 | //qDebug("save %d ", load ); |
172 | QFile file( fileName ); | 175 | QFile file( fileName ); |
173 | if ( load ) { | 176 | if ( load ) { |
177 | mPopupFontSize = mTimerPopUp->font().pointSize(); | ||
178 | confFontSize( mPopupFontSize ); | ||
174 | if( !QFile::exists( fileName) ) | 179 | if( !QFile::exists( fileName) ) |
175 | return; | 180 | return; |
176 | if (!file.open( IO_ReadOnly ) ) { | 181 | if (!file.open( IO_ReadOnly ) ) { |
177 | return ; | 182 | return ; |
@@ -188,8 +193,14 @@ void SimpleAlarmDaemonImpl::saveSlot( int load ) | |||
188 | if ( ok ) { | 193 | if ( ok ) { |
189 | confPause( val ); | 194 | confPause( val ); |
190 | } | 195 | } |
191 | } | 196 | } |
197 | if ( line.left(4 ) == "POFO" ) { | ||
198 | val = line.mid( 4,len-5).toInt( &ok ); | ||
199 | if ( ok ) { | ||
200 | confFontSize( val ); | ||
201 | } | ||
202 | } | ||
192 | if ( line.left(4 ) == "SUCO" ) { | 203 | if ( line.left(4 ) == "SUCO" ) { |
193 | val = line.mid( 4,len-5).toInt( &ok ); | 204 | val = line.mid( 4,len-5).toInt( &ok ); |
194 | if ( ok ) | 205 | if ( ok ) |
195 | confSuspend ( val ); | 206 | confSuspend ( val ); |
@@ -231,8 +242,9 @@ void SimpleAlarmDaemonImpl::saveSlot( int load ) | |||
231 | } | 242 | } |
232 | QString configString ; | 243 | QString configString ; |
233 | configString += "PPAU " + QString::number( mPausePlay ) + "\n"; | 244 | configString += "PPAU " + QString::number( mPausePlay ) + "\n"; |
234 | configString += "SUCO " + QString::number( mSuspend ) + "\n"; | 245 | configString += "SUCO " + QString::number( mSuspend ) + "\n"; |
246 | configString += "POFO " + QString::number( mPopupFontSize ) + "\n"; | ||
235 | configString += "WAAL " + QString::number( wavAlarm ) + "\n"; | 247 | configString += "WAAL " + QString::number( wavAlarm ) + "\n"; |
236 | configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; | 248 | configString += "PLBE " + QString::number( mPlayBeeps ) + "\n"; |
237 | configString += "CUTE " + mCustomText + "\n"; | 249 | configString += "CUTE " + mCustomText + "\n"; |
238 | configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; | 250 | configString += "CUMI " + QString::number( mCustomMinutes ) + "\n"; |
@@ -630,8 +642,22 @@ void SimpleAlarmDaemonImpl::confTimer( int time ) | |||
630 | QTimer::singleShot( 5000, mTimerStartLabel, SLOT ( hide() ) ); | 642 | QTimer::singleShot( 5000, mTimerStartLabel, SLOT ( hide() ) ); |
631 | mTimerTime = 1; | 643 | mTimerTime = 1; |
632 | } | 644 | } |
633 | 645 | ||
646 | void SimpleAlarmDaemonImpl::confFontSize( int size ) | ||
647 | { | ||
648 | |||
649 | mFontsizePopup->setItemChecked( mPopupFontSize, false ); | ||
650 | mPopupFontSize = size; | ||
651 | mFontsizePopup->setItemChecked( mPopupFontSize, true ); | ||
652 | QFont fon = mTimerPopUp->font(); | ||
653 | fon.setPointSize( mPopupFontSize ); | ||
654 | mTimerPopUp->setFont( fon ); | ||
655 | mPopUp->setFont( fon ); | ||
656 | fon.setBold( true ); | ||
657 | fon.setPointSize( mPopupFontSize * 2 ); | ||
658 | mTimerStartLabel->setFont( fon ); | ||
659 | } | ||
634 | void SimpleAlarmDaemonImpl::writeFile() | 660 | void SimpleAlarmDaemonImpl::writeFile() |
635 | { | 661 | { |
636 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 662 | QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
637 | //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); | 663 | //QCopEnvelope e("QPE/Application/kopi", "-writeFile"); |
diff --git a/kalarmd/simplealarmdaemonimpl.h b/kalarmd/simplealarmdaemonimpl.h index 9b7de94..06ef91b 100644 --- a/kalarmd/simplealarmdaemonimpl.h +++ b/kalarmd/simplealarmdaemonimpl.h | |||
@@ -56,8 +56,9 @@ class SimpleAlarmDaemonImpl : public QLabel | |||
56 | void writeJournal(); | 56 | void writeJournal(); |
57 | void slotPlayBeep( int ); | 57 | void slotPlayBeep( int ); |
58 | void showTimer( ); | 58 | void showTimer( ); |
59 | void confPause( int ); | 59 | void confPause( int ); |
60 | void confFontSize( int ); | ||
60 | void confTimer( int ); | 61 | void confTimer( int ); |
61 | void saveSlot( int ); | 62 | void saveSlot( int ); |
62 | void confSuspend( int ); | 63 | void confSuspend( int ); |
63 | void confSound( int num ); | 64 | void confSound( int num ); |
@@ -74,16 +75,17 @@ class SimpleAlarmDaemonImpl : public QLabel | |||
74 | int mSuspend; | 75 | int mSuspend; |
75 | QString mAlarmMessage; | 76 | QString mAlarmMessage; |
76 | int mTimerTime; | 77 | int mTimerTime; |
77 | int getFileNameLen( QString ); | 78 | int getFileNameLen( QString ); |
78 | QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp; | 79 | QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp, *mFontsizePopup; |
79 | QDateTime mRunningTimer; | 80 | QDateTime mRunningTimer; |
80 | void fillTimerPopUp(); | 81 | void fillTimerPopUp(); |
81 | QString timerMesssage; | 82 | QString timerMesssage; |
82 | QString mCustomText; | 83 | QString mCustomText; |
83 | QString mRunningTimerText; | 84 | QString mRunningTimerText; |
84 | int mCustomMinutes; | 85 | int mCustomMinutes; |
85 | int mTimerPopupConf; | 86 | int mTimerPopupConf; |
87 | int mPopupFontSize; | ||
86 | bool wavAlarm; | 88 | bool wavAlarm; |
87 | }; | 89 | }; |
88 | class KODateLabel : public QLabel | 90 | class KODateLabel : public QLabel |
89 | { | 91 | { |