author | tille <tille> | 2002-11-16 16:43:02 (UTC) |
---|---|---|
committer | tille <tille> | 2002-11-16 16:43:02 (UTC) |
commit | 0633fb26123857509c9eb0e0a013b654667ca9ce (patch) (unidiff) | |
tree | 9187213cc22830c65dcba1923be9a8355c673b5a | |
parent | 88435a3192f09453e035a7f1cf73bbc8c24245c9 (diff) | |
download | opie-0633fb26123857509c9eb0e0a013b654667ca9ce.zip opie-0633fb26123857509c9eb0e0a013b654667ca9ce.tar.gz opie-0633fb26123857509c9eb0e0a013b654667ca9ce.tar.bz2 |
usability:
made it a dialog that saves when exiting
clock now running
-rw-r--r-- | noncore/settings/netsystemtime/TODO | 3 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/main.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 56 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.h | 2 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.cpp | 12 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.h | 9 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.ui | 2 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/settime.cpp | 122 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/settime.h | 8 |
9 files changed, 134 insertions, 82 deletions
diff --git a/noncore/settings/netsystemtime/TODO b/noncore/settings/netsystemtime/TODO new file mode 100644 index 0000000..fb003a2 --- a/dev/null +++ b/noncore/settings/netsystemtime/TODO | |||
@@ -0,0 +1,3 @@ | |||
1 | - handle hour > 24 in SetTime::slotClockTick | ||
2 | - improve tz setting | ||
3 | atm the tz gets written to the system as soon as changed... | ||
diff --git a/noncore/settings/netsystemtime/main.cpp b/noncore/settings/netsystemtime/main.cpp index c6d5f9a..80fbcb8 100644 --- a/noncore/settings/netsystemtime/main.cpp +++ b/noncore/settings/netsystemtime/main.cpp | |||
@@ -1,16 +1,16 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include "ntp.h" | 2 | #include "ntp.h" |
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | 4 | ||
5 | int main( int argc, char ** argv ) | 5 | int main( int argc, char ** argv ) |
6 | { | 6 | { |
7 | printf("This is netsystemtime\n"); | 7 | printf("This is netsystemtime "); |
8 | printf("$Id$\n"); | 8 | printf("$Id$\n"); |
9 | 9 | ||
10 | QPEApplication a( argc, argv ); | 10 | QPEApplication a( argc, argv ); |
11 | 11 | ||
12 | Ntp mw; | 12 | Ntp mw; |
13 | a.showMainWidget( &mw ); | 13 | a.showMainWidget( &mw ); |
14 | 14 | ||
15 | return a.exec(); | 15 | return a.exec(); |
16 | } | 16 | } |
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index c7e3b52..53dbe46 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp | |||
@@ -1,420 +1,426 @@ | |||
1 | #include "ntp.h" | 1 | #include "ntp.h" |
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qregexp.h> | 3 | #include <qregexp.h> |
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qtable.h> | 5 | #include <qtable.h> |
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qsocket.h> | 7 | #include <qsocket.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qspinbox.h> | 9 | #include <qspinbox.h> |
10 | #include <qcheckbox.h> | 10 | #include <qcheckbox.h> |
11 | #include <qtabwidget.h> | 11 | #include <qtabwidget.h> |
12 | #include <qlayout.h> | 12 | #include <qlayout.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <qmultilineedit.h> | 14 | #include <qmultilineedit.h> |
15 | #include <opie/oprocess.h> | 15 | #include <opie/oprocess.h> |
16 | #include <qpe/qpeapplication.h> | 16 | #include <qpe/qpeapplication.h> |
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/global.h> | 18 | #include <qpe/global.h> |
19 | #include <qpe/timeconversion.h> | 19 | #include <qpe/timeconversion.h> |
20 | #include <qpe/tzselect.h> | 20 | #include <qpe/tzselect.h> |
21 | #include <qpe/timestring.h> | 21 | #include <qpe/timestring.h> |
22 | #include <qpe/qpedialog.h> | 22 | #include <qpe/qpedialog.h> |
23 | #include <qpe/datebookdb.h> | 23 | #include <qpe/datebookdb.h> |
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <sys/time.h> | 25 | #include <sys/time.h> |
26 | #include <time.h> | 26 | #include <time.h> |
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | 28 | ||
29 | 29 | ||
30 | Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | 30 | Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) |
31 | : SetDateTime( parent, name, fl ) | 31 | : SetDateTime( parent, name, fl ) |
32 | { | 32 | { |
33 | _interactive = false; | 33 | _interactive = false; |
34 | Config ntpSrvs(QPEApplication::qpeDir()+"etc/ntpservers",Config::File); | 34 | Config ntpSrvs(QPEApplication::qpeDir()+"etc/ntpservers",Config::File); |
35 | ntpSrvs.setGroup("servers"); | 35 | ntpSrvs.setGroup("servers"); |
36 | int srvCount = ntpSrvs.readNumEntry("count", 0 ); | 36 | int srvCount = ntpSrvs.readNumEntry("count", 0 ); |
37 | for (int i = 0; i < srvCount; i++) | 37 | for (int i = 0; i < srvCount; i++) |
38 | { | 38 | { |
39 | ntpSrvs.setGroup(QString::number(i)); | 39 | ntpSrvs.setGroup(QString::number(i)); |
40 | ComboNtpSrv->insertItem( ntpSrvs.readEntry("name") ); | 40 | ComboNtpSrv->insertItem( ntpSrvs.readEntry("name") ); |
41 | } | 41 | } |
42 | if ( srvCount==0 ) ComboNtpSrv->insertItem(tr("time.fu-berlin.de")); | 42 | if ( srvCount==0 ) ComboNtpSrv->insertItem(tr("time.fu-berlin.de")); |
43 | 43 | ||
44 | Config cfg("ntp",Config::User); | 44 | Config cfg("ntp",Config::User); |
45 | cfg.setGroup("settings"); | 45 | cfg.setGroup("settings"); |
46 | SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",720) ); | 46 | SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",720) ); |
47 | SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",1440) ); | 47 | SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",1440) ); |
48 | ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); | 48 | ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); |
49 | 49 | ||
50 | //make tab order | 50 | //make tab order |
51 | 51 | ||
52 | TabWidgetMain->removePage( tabMain ); | 52 | TabWidgetMain->removePage( tabMain ); |
53 | TabWidgetMain->removePage( tabManualSetTime ); | 53 | TabWidgetMain->removePage( tabManualSetTime ); |
54 | TabWidgetMain->removePage( TabSettings ); | 54 | TabWidgetMain->removePage( TabSettings ); |
55 | TabWidgetMain->removePage( tabPredict ); | 55 | TabWidgetMain->removePage( tabPredict ); |
56 | TabWidgetMain->removePage( tabNtp ); | 56 | TabWidgetMain->removePage( tabNtp ); |
57 | 57 | ||
58 | TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); | 58 | TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); |
59 | TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); | ||
60 | TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); | 59 | TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); |
61 | TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); | 60 | TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); |
62 | TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); | 61 | TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); |
63 | NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); | 62 | NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); |
64 | 63 | ||
65 | 64 | ||
66 | 65 | ||
67 | bool advMode = cfg.readBoolEntry("advancedFeatures", false ); | 66 | bool advMode = cfg.readBoolEntry("advancedFeatures", false ); |
68 | showAdvancedFeatures(advMode); | 67 | showAdvancedFeatures(advMode); |
69 | CheckBoxAdvSettings->setChecked( advMode ); | 68 | CheckBoxAdvSettings->setChecked( advMode ); |
70 | connect( CheckBoxAdvSettings, SIGNAL( toggled( bool ) ), | 69 | connect( CheckBoxAdvSettings, SIGNAL( toggled( bool ) ), |
71 | SLOT( showAdvancedFeatures( bool ) ) ); | 70 | SLOT( showAdvancedFeatures( bool ) ) ); |
72 | 71 | ||
73 | makeChannel(); | 72 | makeChannel(); |
74 | 73 | ||
75 | ntpTimer = new QTimer(this); | 74 | ntpTimer = new QTimer(this); |
76 | 75 | ||
77 | ntpProcess = new OProcess( ); | 76 | ntpProcess = new OProcess( ); |
78 | connect( SpinBoxNtpDelay, SIGNAL( valueChanged(int) ), | 77 | connect( SpinBoxNtpDelay, SIGNAL( valueChanged(int) ), |
79 | SLOT(slotNtpDelayChanged(int)) ); | 78 | SLOT(slotNtpDelayChanged(int)) ); |
80 | 79 | ||
81 | ntpSock = new QSocket( this ); | 80 | ntpSock = new QSocket( this ); |
82 | connect( ntpSock, SIGNAL( error(int) ),SLOT(slotCheckNtp(int)) ); | 81 | connect( ntpSock, SIGNAL( error(int) ),SLOT(slotCheckNtp(int)) ); |
83 | slotProbeNtpServer(); | 82 | slotProbeNtpServer(); |
84 | 83 | ||
85 | connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), | 84 | connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), |
86 | this, SLOT(getNtpOutput(OProcess*,char*,int))); | 85 | this, SLOT(getNtpOutput(OProcess*,char*,int))); |
87 | connect ( ntpProcess, SIGNAL(processExited(OProcess*)), | 86 | connect ( ntpProcess, SIGNAL(processExited(OProcess*)), |
88 | this, SLOT(ntpFinished(OProcess*))); | 87 | this, SLOT(ntpFinished(OProcess*))); |
89 | connect(runNtp, SIGNAL(clicked()), this, SLOT(slotButtonRunNtp())); | 88 | connect(runNtp, SIGNAL(clicked()), this, SLOT(slotButtonRunNtp())); |
90 | connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); | 89 | connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); |
91 | connect(PushButtonSetPredTime, SIGNAL(clicked()), this, SLOT(setPredictTime())); | 90 | connect(PushButtonSetPredTime, SIGNAL(clicked()), this, SLOT(setPredictTime())); |
92 | slotCheckNtp(-1); | 91 | slotCheckNtp(-1); |
93 | readLookups(); | 92 | readLookups(); |
94 | } | 93 | } |
95 | 94 | ||
96 | Ntp::~Ntp() | 95 | Ntp::~Ntp() |
97 | { | 96 | { |
98 | delete ntpProcess; | 97 | delete ntpProcess; |
98 | } | ||
99 | |||
100 | void Ntp::saveConfig(){ | ||
99 | int srvCount = ComboNtpSrv->count(); | 101 | int srvCount = ComboNtpSrv->count(); |
100 | bool serversChanged = true; | 102 | bool serversChanged = true; |
101 | QString edit = ComboNtpSrv->currentText(); | 103 | QString edit = ComboNtpSrv->currentText(); |
102 | for (int i = 0; i < srvCount; i++){ | 104 | for (int i = 0; i < srvCount; i++){ |
103 | if ( edit == ComboNtpSrv->text(i)) serversChanged = false; | 105 | if ( edit == ComboNtpSrv->text(i)) serversChanged = false; |
104 | } | 106 | } |
105 | if (serversChanged){ | 107 | if (serversChanged){ |
106 | Config ntpSrvs("/etc/ntpservers",Config::File); | 108 | Config ntpSrvs("/etc/ntpservers",Config::File); |
107 | ntpSrvs.setGroup("servers"); | 109 | ntpSrvs.setGroup("servers"); |
108 | ntpSrvs.writeEntry("count", srvCount); | 110 | ntpSrvs.writeEntry("count", srvCount); |
109 | for (int i = 0; i < srvCount; i++){ | 111 | for (int i = 0; i < srvCount; i++){ |
110 | qDebug("ntpSrvs[%i/%i]=%s",i,srvCount,ComboNtpSrv->text(i).latin1()); | 112 | qDebug("ntpSrvs[%i/%i]=%s",i,srvCount,ComboNtpSrv->text(i).latin1()); |
111 | ntpSrvs.setGroup(QString::number(i)); | 113 | ntpSrvs.setGroup(QString::number(i)); |
112 | ntpSrvs.writeEntry( "name", ComboNtpSrv->text(i) ); | 114 | ntpSrvs.writeEntry( "name", ComboNtpSrv->text(i) ); |
113 | } | 115 | } |
114 | } | 116 | } |
115 | Config cfg("ntp",Config::User); | 117 | Config cfg("ntp",Config::User); |
116 | cfg.setGroup("settings"); | 118 | cfg.setGroup("settings"); |
117 | cfg.writeEntry("ntpServer", ComboNtpSrv->currentItem()); | 119 | cfg.writeEntry("ntpServer", ComboNtpSrv->currentItem()); |
118 | cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() ); | 120 | cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() ); |
119 | cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() ); | 121 | cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() ); |
120 | cfg.writeEntry( "advancedFeatures", CheckBoxAdvSettings->isChecked() ); | 122 | cfg.writeEntry( "advancedFeatures", CheckBoxAdvSettings->isChecked() ); |
121 | } | 123 | } |
122 | 124 | ||
123 | bool Ntp::ntpDelayElapsed() | 125 | bool Ntp::ntpDelayElapsed() |
124 | { | 126 | { |
125 | Config cfg("ntp",Config::User); | 127 | Config cfg("ntp",Config::User); |
126 | cfg.setGroup("lookups"); | 128 | cfg.setGroup("lookups"); |
127 | _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0); | 129 | _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0); |
128 | if (_lookupDiff < 0) return true; | 130 | if (_lookupDiff < 0) return true; |
129 | int i =_lookupDiff - (SpinBoxNtpDelay->value()*60); | 131 | int i =_lookupDiff - (SpinBoxNtpDelay->value()*60); |
130 | return i > -60; | 132 | return i > -60; |
131 | } | 133 | } |
132 | 134 | ||
133 | QString Ntp::getNtpServer() | 135 | QString Ntp::getNtpServer() |
134 | { | 136 | { |
135 | return ComboNtpSrv->currentText(); | 137 | return ComboNtpSrv->currentText(); |
136 | } | 138 | } |
137 | 139 | ||
138 | void Ntp::slotButtonRunNtp() | 140 | void Ntp::slotButtonRunNtp() |
139 | { | 141 | { |
140 | _interactive = true; | 142 | _interactive = true; |
141 | slotRunNtp(); | 143 | slotRunNtp(); |
142 | } | 144 | } |
143 | 145 | ||
144 | void Ntp::slotTimerRunNtp() | 146 | void Ntp::slotTimerRunNtp() |
145 | { | 147 | { |
146 | _interactive = false; | 148 | _interactive = false; |
147 | slotRunNtp(); | 149 | slotRunNtp(); |
148 | } | 150 | } |
149 | 151 | ||
150 | 152 | ||
151 | void Ntp::slotRunNtp() | 153 | void Ntp::slotRunNtp() |
152 | { | 154 | { |
153 | if ( !ntpDelayElapsed() && CheckBoxAdvSettings->isChecked() ) | 155 | if ( !ntpDelayElapsed() && CheckBoxAdvSettings->isChecked() ) |
154 | { | 156 | { |
155 | switch ( | 157 | switch ( |
156 | QMessageBox::warning(this, tr("Run NTP?"), | 158 | QMessageBox::warning(this, tr("Run NTP?"), |
157 | tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+ | 159 | tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+ |
158 | QString::number(_lookupDiff/60)+tr(" minutes elapsed since last lookup.")+ | 160 | QString::number(_lookupDiff/60)+tr(" minutes elapsed since last lookup.")+ |
159 | "<br>"+tr("Rerun NTP?"), | 161 | "<br>"+tr("Rerun NTP?"), |
160 | QMessageBox::Ok,QMessageBox::Cancel) | 162 | QMessageBox::Ok,QMessageBox::Cancel) |
161 | ) { | 163 | ) { |
162 | case QMessageBox::Ok: break; | 164 | case QMessageBox::Ok: break; |
163 | case QMessageBox::Cancel: return; | 165 | case QMessageBox::Cancel: return; |
164 | default: return; | 166 | default: return; |
165 | } | 167 | } |
166 | } | 168 | } |
167 | TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); | 169 | TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); |
168 | ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() ); | 170 | ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() ); |
169 | 171 | ||
170 | ntpProcess->clearArguments(); | 172 | ntpProcess->clearArguments(); |
171 | *ntpProcess << "ntpdate" << getNtpServer(); | 173 | *ntpProcess << "ntpdate" << getNtpServer(); |
172 | bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); | 174 | bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); |
173 | if ( !ret ) { | 175 | if ( !ret ) { |
174 | QMessageBox::critical(this, tr("ntp error"), | 176 | QMessageBox::critical(this, tr("ntp error"), |
175 | tr("Error while getting time form network!")); | 177 | tr("Error while getting time form network!")); |
176 | qDebug("Error while executing ntpdate"); | 178 | qDebug("Error while executing ntpdate"); |
177 | ntpOutPut( tr("Error while executing ntpdate")); | 179 | ntpOutPut( tr("Error while executing ntpdate")); |
178 | } | 180 | } |
179 | } | 181 | } |
180 | 182 | ||
181 | void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) | 183 | void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) |
182 | { | 184 | { |
183 | if (! proc ) qDebug("Ntp::getNtpOutput OProcess is null"); | 185 | if (! proc ) qDebug("Ntp::getNtpOutput OProcess is null"); |
184 | QString lineStr, lineStrOld; | 186 | QString lineStr, lineStrOld; |
185 | lineStr = buffer; | 187 | lineStr = buffer; |
186 | lineStr=lineStr.left(buflen); | 188 | lineStr=lineStr.left(buflen); |
187 | if (lineStr!=lineStrOld) | 189 | if (lineStr!=lineStrOld) |
188 | { | 190 | { |
189 | ntpOutPut(lineStr); | 191 | ntpOutPut(lineStr); |
190 | _ntpOutput += lineStr; | 192 | _ntpOutput += lineStr; |
191 | } | 193 | } |
192 | lineStrOld = lineStr; | 194 | lineStrOld = lineStr; |
193 | } | 195 | } |
194 | 196 | ||
195 | void Ntp::ntpFinished(OProcess *p) | 197 | void Ntp::ntpFinished(OProcess *p) |
196 | { | 198 | { |
197 | qDebug("p->exitStatus() %i",p->exitStatus()); | 199 | qDebug("p->exitStatus() %i",p->exitStatus()); |
198 | if (p->exitStatus()!=0 || !p->normalExit()) | 200 | if (p->exitStatus()!=0 || !p->normalExit()) |
199 | { | 201 | { |
200 | if ( isVisible() && _interactive ){ | 202 | if ( isVisible() && _interactive ){ |
201 | QMessageBox::critical(this, tr("ntp error"),tr("Error while getting time form\n server")+getNtpServer()+"\n"+_ntpOutput ); | 203 | QMessageBox::critical(this, tr("ntp error"),tr("Error while getting time form\n server")+getNtpServer()+"\n"+_ntpOutput ); |
202 | TabWidgetMain->showPage( tabManualSetTime ); | ||
203 | } | 204 | } |
204 | 205 | // slotCheckNtp(-1); | |
205 | return; | 206 | return; |
206 | } | 207 | } |
207 | |||
208 | Global::writeHWClock(); | ||
209 | // since time has changed quickly load in the datebookdb | ||
210 | // to allow the alarm server to get a better grip on itself | ||
211 | // (example re-trigger alarms for when we travel back in time) | ||
212 | DateBookDB db; | ||
213 | |||
214 | // QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" ); | ||
215 | // timeApplet << ""; | ||
216 | 208 | ||
217 | Config cfg("ntp",Config::User); | 209 | Config cfg("ntp",Config::User); |
218 | cfg.setGroup("lookups"); | 210 | cfg.setGroup("lookups"); |
219 | int lastLookup = cfg.readNumEntry("time",0); | 211 | int lastLookup = cfg.readNumEntry("time",0); |
220 | int lookupCount = cfg.readNumEntry("count",0); | 212 | int lookupCount = cfg.readNumEntry("count",0); |
221 | bool lastNtp = cfg.readBoolEntry("lastNtp",false); | 213 | bool lastNtp = cfg.readBoolEntry("lastNtp",false); |
222 | int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); | 214 | int time = TimeConversion::toUTC( QDateTime::currentDateTime() ); |
223 | cfg.writeEntry("time", time); | 215 | cfg.writeEntry("time", time); |
224 | 216 | ||
225 | float timeShift = getTimeShift(); | 217 | float timeShift = getTimeShift(); |
226 | if (timeShift == 0.0) return; | 218 | if (timeShift == 0.0) return; |
227 | int secsSinceLast = time - lastLookup; | 219 | int secsSinceLast = time - lastLookup; |
228 | TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); | 220 | TextLabelNewTime->setText(QDateTime::currentDateTime().toString()); |
229 | TextLabelTimeShift->setText(QString::number(timeShift)+tr(" seconds")); | 221 | TextLabelTimeShift->setText(QString::number(timeShift)+tr(" seconds")); |
230 | if ( lastNtp && lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value()) | 222 | if ( lastNtp && lastLookup > 0 && secsSinceLast > 60* SpinBoxMinLookupDelay->value()) |
231 | { | 223 | { |
232 | cfg.setGroup("lookup_"+QString::number(lookupCount)); | 224 | cfg.setGroup("lookup_"+QString::number(lookupCount)); |
233 | lookupCount++; | 225 | lookupCount++; |
234 | _shiftPerSec = timeShift / secsSinceLast; | 226 | _shiftPerSec = timeShift / secsSinceLast; |
235 | qDebug("secs since last lookup %i", secsSinceLast);qDebug("timeshift since last lookup %f", timeShift);qDebug("timeshift since per sec %f", _shiftPerSec); | 227 | qDebug("secs since last lookup %i", secsSinceLast);qDebug("timeshift since last lookup %f", timeShift);qDebug("timeshift since per sec %f", _shiftPerSec); |
236 | cfg.writeEntry("secsSinceLast",secsSinceLast); | 228 | cfg.writeEntry("secsSinceLast",secsSinceLast); |
237 | cfg.writeEntry("timeShift",QString::number(timeShift)); | 229 | cfg.writeEntry("timeShift",QString::number(timeShift)); |
238 | cfg.setGroup("lookups"); | 230 | cfg.setGroup("lookups"); |
239 | cfg.writeEntry("count",lookupCount); | 231 | cfg.writeEntry("count",lookupCount); |
240 | cfg.writeEntry("lastNtp",true); | 232 | cfg.writeEntry("lastNtp",true); |
241 | } | 233 | } |
242 | } | 234 | } |
243 | 235 | ||
244 | 236 | ||
245 | float Ntp::getTimeShift() | 237 | float Ntp::getTimeShift() |
246 | { | 238 | { |
247 | QString _offset = "offset"; | 239 | QString _offset = "offset"; |
248 | QString _sec = "sec"; | 240 | QString _sec = "sec"; |
249 | QRegExp _reOffset = QRegExp(_offset); | 241 | QRegExp _reOffset = QRegExp(_offset); |
250 | QRegExp _reEndOffset = QRegExp(_sec); | 242 | QRegExp _reEndOffset = QRegExp(_sec); |
251 | int posOffset = _reOffset.match( _ntpOutput ); | 243 | int posOffset = _reOffset.match( _ntpOutput ); |
252 | int posEndOffset = _reEndOffset.match( _ntpOutput, posOffset ); | 244 | int posEndOffset = _reEndOffset.match( _ntpOutput, posOffset ); |
253 | posOffset += _offset.length() + 1; | 245 | posOffset += _offset.length() + 1; |
254 | QString diff = _ntpOutput.mid(posOffset, posEndOffset-posOffset-1); | 246 | QString diff = _ntpOutput.mid(posOffset, posEndOffset-posOffset-1); |
255 | qDebug("%s", _ntpOutput.latin1()); | 247 | qDebug("%s", _ntpOutput.latin1()); |
256 | qDebug("diff = >%s<",diff.latin1()); | 248 | qDebug("diff = >%s<",diff.latin1()); |
257 | return diff.toFloat(); | 249 | return diff.toFloat(); |
258 | } | 250 | } |
259 | 251 | ||
260 | void Ntp::readLookups() | 252 | void Ntp::readLookups() |
261 | { | 253 | { |
262 | Config cfg("ntp",Config::User); | 254 | Config cfg("ntp",Config::User); |
263 | cfg.setGroup("lookups"); | 255 | cfg.setGroup("lookups"); |
264 | int lookupCount = cfg.readNumEntry("count",0); | 256 | int lookupCount = cfg.readNumEntry("count",0); |
265 | float last, shift, shiftPerSec; | 257 | float last, shift, shiftPerSec; |
266 | qDebug("lookupCount = %i",lookupCount); | 258 | qDebug("lookupCount = %i",lookupCount); |
267 | TableLookups->setNumCols( 3 ); | 259 | TableLookups->setNumCols( 3 ); |
268 | TableLookups->setNumRows( lookupCount); | 260 | TableLookups->setNumRows( lookupCount); |
269 | TableLookups->horizontalHeader()->setLabel(1,tr("last [h]")); | 261 | TableLookups->horizontalHeader()->setLabel(1,tr("last [h]")); |
270 | TableLookups->horizontalHeader()->setLabel(2,tr("offset [s]")); | 262 | TableLookups->horizontalHeader()->setLabel(2,tr("offset [s]")); |
271 | TableLookups->horizontalHeader()->setLabel(0,tr("shift [s/h]")); | 263 | TableLookups->horizontalHeader()->setLabel(0,tr("shift [s/h]")); |
272 | int cw = TableLookups->width()/4; | 264 | int cw = TableLookups->width()/4; |
273 | qDebug("column width %i",cw); | 265 | qDebug("column width %i",cw); |
274 | cw = 50; | 266 | cw = 50; |
275 | TableLookups->setColumnWidth( 0, cw+30 ); | 267 | TableLookups->setColumnWidth( 0, cw+30 ); |
276 | TableLookups->setColumnWidth( 1, cw ); | 268 | TableLookups->setColumnWidth( 1, cw ); |
277 | TableLookups->setColumnWidth( 2, cw ); | 269 | TableLookups->setColumnWidth( 2, cw ); |
278 | TableLookups->sortColumn(0, false, true ); | 270 | TableLookups->sortColumn(0, false, true ); |
279 | // TableLookups->setSorting( true ); | 271 | // TableLookups->setSorting( true ); |
280 | _shiftPerSec = 0; | 272 | _shiftPerSec = 0; |
281 | for (int i=0; i < lookupCount; i++) | 273 | for (int i=0; i < lookupCount; i++) |
282 | { | 274 | { |
283 | cfg.setGroup("lookup_"+QString::number(i)); | 275 | cfg.setGroup("lookup_"+QString::number(i)); |
284 | last = cfg.readEntry("secsSinceLast",0).toFloat(); | 276 | last = cfg.readEntry("secsSinceLast",0).toFloat(); |
285 | shift = QString(cfg.readEntry("timeShift",0)).toFloat(); | 277 | shift = QString(cfg.readEntry("timeShift",0)).toFloat(); |
286 | shiftPerSec = shift / last; | 278 | shiftPerSec = shift / last; |
287 | qDebug("%i shift %f",i,shiftPerSec); | 279 | qDebug("%i shift %f",i,shiftPerSec); |
288 | _shiftPerSec += shiftPerSec; | 280 | _shiftPerSec += shiftPerSec; |
289 | TableLookups->setText( i,0,QString::number(shiftPerSec*60*60)); | 281 | TableLookups->setText( i,0,QString::number(shiftPerSec*60*60)); |
290 | TableLookups->setText( i,2,QString::number(shift)); | 282 | TableLookups->setText( i,2,QString::number(shift)); |
291 | TableLookups->setText( i,1,QString::number(last/(60*60))); | 283 | TableLookups->setText( i,1,QString::number(last/(60*60))); |
292 | } | 284 | } |
293 | _shiftPerSec /= lookupCount; | 285 | _shiftPerSec /= lookupCount; |
294 | TextLabelShift->setText(QString::number(_shiftPerSec*60*60)+tr(" s/h")); | 286 | TextLabelShift->setText(QString::number(_shiftPerSec*60*60)+tr(" s/h")); |
295 | } | 287 | } |
296 | 288 | ||
297 | void Ntp::preditctTime() | 289 | void Ntp::preditctTime() |
298 | { | 290 | { |
299 | Config cfg("ntp",Config::User); | 291 | Config cfg("ntp",Config::User); |
300 | cfg.setGroup("lookups"); | 292 | cfg.setGroup("lookups"); |
301 | int lastTime = cfg.readNumEntry("time",0); | 293 | int lastTime = cfg.readNumEntry("time",0); |
302 | cfg.writeEntry("lastNtp",true); | 294 | cfg.writeEntry("lastNtp",true); |
303 | setenv( "TZ", tz->currentZone(), 1 ); | 295 | setenv( "TZ", tz->currentZone(), 1 ); |
304 | int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); | 296 | int now = TimeConversion::toUTC( QDateTime::currentDateTime() ); |
305 | int corr = int((now - lastTime) * _shiftPerSec); | 297 | int corr = int((now - lastTime) * _shiftPerSec); |
306 | TextLabelEstimatedShift->setText(QString::number(corr)+tr(" seconds")); | 298 | TextLabelEstimatedShift->setText(QString::number(corr)+tr(" seconds")); |
307 | predictedTime = QDateTime::currentDateTime().addSecs(corr); | 299 | predictedTime = QDateTime::currentDateTime().addSecs(corr); |
308 | TextLabelPredTime->setText(predictedTime.toString()); | 300 | TextLabelPredTime->setText(predictedTime.toString()); |
309 | TextLabelMainPredTime->setText(tr("Predicted time:")+"<br><b>"+predictedTime.toString()+"</b>"); | 301 | // TextLabelMainPredTime->setText(tr("Predicted time:")+"<br><b>"+predictedTime.toString()+"</b>"); |
310 | } | 302 | } |
311 | 303 | ||
312 | void Ntp::setPredictTime() | 304 | void Ntp::setPredictTime() |
313 | { | 305 | { |
306 | qDebug("Ntp::setPredictTime"); | ||
314 | preditctTime(); | 307 | preditctTime(); |
315 | setTime( predictedTime ); | 308 | timeButton->setTime( predictedTime ); |
316 | } | 309 | } |
317 | 310 | ||
318 | void Ntp::slotCheckNtp(int i) | 311 | void Ntp::slotCheckNtp(int i) |
319 | { | 312 | { |
313 | qDebug(" Ntp::slotCheckNtp(%i)",i); | ||
320 | if (i == 0) | 314 | if (i == 0) |
321 | { | 315 | { |
322 | TextLabelMainPredTime->hide(); | 316 | // TextLabelMainPredTime->hide(); |
323 | ButtonSetTime->setText( tr("Get time from network") ); | 317 | ButtonSetTime->setText( tr("Get time from network") ); |
324 | connect( ButtonSetTime, SIGNAL(clicked()), SLOT(slotButtonRunNtp()) ); | 318 | connect( ButtonSetTime, SIGNAL(clicked()), SLOT(slotButtonRunNtp()) ); |
325 | if ( ntpDelayElapsed() ) | 319 | if ( ntpDelayElapsed() ) |
326 | { | 320 | { |
327 | slotRunNtp(); | 321 | slotRunNtp(); |
328 | disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotProbeNtpServer()) ); | 322 | disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotProbeNtpServer()) ); |
329 | connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotTimerRunNtp()) ); | 323 | connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotTimerRunNtp()) ); |
330 | }else{ | 324 | }else{ |
331 | disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotTimerRunNtp()) ); | 325 | disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotTimerRunNtp()) ); |
332 | connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); | 326 | connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); |
333 | } | 327 | } |
334 | }else{ | 328 | }else{ |
335 | preditctTime(); | 329 | preditctTime(); |
336 | ButtonSetTime->setText( tr("Set predicted time: ")+predictedTime.toString() ); | 330 | ButtonSetTime->setText( tr("Set predicted time: ")+predictedTime.toString() ); |
337 | if (i>0)ntpOutPut(tr("Could not connect to server ")+getNtpServer()); | 331 | if (i>0)ntpOutPut(tr("Could not connect to server ")+getNtpServer()); |
338 | connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) ); | 332 | connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) ); |
339 | connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); | 333 | connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); |
340 | } | 334 | } |
341 | } | 335 | } |
342 | 336 | ||
343 | void Ntp::slotProbeNtpServer() | 337 | void Ntp::slotProbeNtpServer() |
344 | { | 338 | { |
345 | ntpSock->connectToHost( getNtpServer() ,123); | 339 | ntpSock->connectToHost( getNtpServer() ,123); |
346 | } | 340 | } |
347 | 341 | ||
348 | void Ntp::slotNtpDelayChanged(int delay) | 342 | void Ntp::slotNtpDelayChanged(int delay) |
349 | { | 343 | { |
350 | ntpTimer->changeInterval( delay*1000*60 ); | 344 | ntpTimer->changeInterval( delay*1000*60 ); |
351 | } | 345 | } |
352 | 346 | ||
353 | void Ntp::ntpOutPut(QString out) | 347 | void Ntp::ntpOutPut(QString out) |
354 | { | 348 | { |
355 | 349 | ||
356 | MultiLineEditntpOutPut->append(out); | 350 | MultiLineEditntpOutPut->append(out); |
357 | MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE); | 351 | MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE); |
358 | } | 352 | } |
359 | 353 | ||
360 | 354 | ||
361 | void Ntp::makeChannel() | 355 | void Ntp::makeChannel() |
362 | { | 356 | { |
363 | channel = new QCopChannel( "QPE/Application/netsystemtime", this ); | 357 | channel = new QCopChannel( "QPE/Application/netsystemtime", this ); |
364 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 358 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
365 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 359 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
366 | } | 360 | } |
367 | 361 | ||
368 | 362 | ||
369 | 363 | ||
370 | void Ntp::receive(const QCString &msg, const QByteArray &arg) | 364 | void Ntp::receive(const QCString &msg, const QByteArray &arg) |
371 | { | 365 | { |
372 | qDebug("QCop(Ntp) "+msg+" "+QCString(arg)); | 366 | qDebug("QCop(Ntp) "+msg+" "+QCString(arg)); |
373 | if ( msg == "ntpLookup(QString)" ) | 367 | if ( msg == "ntpLookup(QString)" ) |
374 | { | 368 | { |
375 | _interactive = false; | 369 | _interactive = false; |
376 | slotRunNtp(); | 370 | slotRunNtp(); |
377 | } | 371 | } |
378 | if ( msg == "setPredictedTime(QString)" ) | 372 | if ( msg == "setPredictedTime(QString)" ) |
379 | { | 373 | { |
380 | setPredictTime(); | 374 | setPredictTime(); |
381 | }else{ | 375 | }else{ |
382 | qDebug("Ntp::receive: Huh what do ya want"); | 376 | qDebug("Ntp::receive: Huh what do ya want"); |
383 | } | 377 | } |
384 | } | 378 | } |
385 | 379 | ||
386 | void Ntp::setDocument(const QString &fileName) | 380 | void Ntp::setDocument(const QString &fileName) |
387 | { | 381 | { |
388 | qDebug("Ntp::setDocument( %s )",fileName.latin1()); | 382 | qDebug("Ntp::setDocument( %s )",fileName.latin1()); |
389 | } | 383 | } |
390 | 384 | ||
391 | void Ntp::showAdvancedFeatures(bool advMode) | 385 | void Ntp::showAdvancedFeatures(bool advMode) |
392 | { | 386 | { |
393 | if (advMode) { | 387 | if (advMode) { |
394 | 388 | ||
395 | TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); | 389 | TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); |
396 | TabWidgetMain->addTab( tabNtp, tr( "NTP" ) ); | 390 | TabWidgetMain->addTab( tabNtp, tr( "NTP" ) ); |
397 | TextLabel1_2_2->show(); | 391 | TextLabel1_2_2->show(); |
398 | TextLabel2_3->show(); | 392 | TextLabel2_3->show(); |
399 | TextLabel3_3_2->show(); | 393 | TextLabel3_3_2->show(); |
400 | TextLabel1_2->show(); | 394 | TextLabel1_2->show(); |
401 | SpinBoxMinLookupDelay->show(); | 395 | SpinBoxMinLookupDelay->show(); |
402 | TextLabel2->show(); | 396 | TextLabel2->show(); |
403 | TextLabel3_3->show(); | 397 | TextLabel3_3->show(); |
404 | SpinBoxNtpDelay->show(); | 398 | SpinBoxNtpDelay->show(); |
405 | Line1->show(); | 399 | Line1->show(); |
406 | }else{ | 400 | }else{ |
407 | TabWidgetMain->removePage( tabPredict ); | 401 | TabWidgetMain->removePage( tabPredict ); |
408 | TabWidgetMain->removePage( tabNtp ); | 402 | TabWidgetMain->removePage( tabNtp ); |
409 | TextLabel1_2_2->hide(); | 403 | TextLabel1_2_2->hide(); |
410 | TextLabel2_3->hide(); | 404 | TextLabel2_3->hide(); |
411 | TextLabel3_3_2->hide(); | 405 | TextLabel3_3_2->hide(); |
412 | TextLabel1_2->hide(); | 406 | TextLabel1_2->hide(); |
413 | SpinBoxMinLookupDelay->hide(); | 407 | SpinBoxMinLookupDelay->hide(); |
414 | TextLabel2->hide(); | 408 | TextLabel2->hide(); |
415 | TextLabel3_3->hide(); | 409 | TextLabel3_3->hide(); |
416 | SpinBoxNtpDelay->hide(); | 410 | SpinBoxNtpDelay->hide(); |
417 | Line1->hide(); | 411 | Line1->hide(); |
418 | }; | 412 | }; |
419 | TabWidgetMain->show(); | 413 | TabWidgetMain->show(); |
420 | } | 414 | } |
415 | |||
416 | |||
417 | void Ntp::accept( ){ | ||
418 | qDebug("accepted"); | ||
419 | //SetTimeDate | ||
420 | commitTime(); | ||
421 | writeSettings(); | ||
422 | updateSystem(); | ||
423 | // Ntp | ||
424 | saveConfig(); | ||
425 | qApp->quit(); | ||
426 | } \ No newline at end of file | ||
diff --git a/noncore/settings/netsystemtime/ntp.h b/noncore/settings/netsystemtime/ntp.h index 15cddbd..a4573f8 100644 --- a/noncore/settings/netsystemtime/ntp.h +++ b/noncore/settings/netsystemtime/ntp.h | |||
@@ -1,55 +1,57 @@ | |||
1 | #ifndef NTP_H | 1 | #ifndef NTP_H |
2 | #define NTP_H | 2 | #define NTP_H |
3 | #include "settime.h" | 3 | #include "settime.h" |
4 | #include <qdatetime.h> | 4 | #include <qdatetime.h> |
5 | 5 | ||
6 | class OProcess; | 6 | class OProcess; |
7 | class QString; | 7 | class QString; |
8 | class QTimer; | 8 | class QTimer; |
9 | class QSocket; | 9 | class QSocket; |
10 | class QCopChannel; | 10 | class QCopChannel; |
11 | 11 | ||
12 | class Ntp : public SetDateTime | 12 | class Ntp : public SetDateTime |
13 | { | 13 | { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 17 | Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
18 | ~Ntp(); | 18 | ~Ntp(); |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | void setDocument (const QString &); | 21 | void setDocument (const QString &); |
22 | protected: | 22 | protected: |
23 | virtual void accept( ); | ||
23 | QDateTime predictedTime; | 24 | QDateTime predictedTime; |
24 | void makeChannel(); | 25 | void makeChannel(); |
25 | protected slots: | 26 | protected slots: |
26 | void receive(const QCString &msg, const QByteArray &arg); | 27 | void receive(const QCString &msg, const QByteArray &arg); |
27 | private: | 28 | private: |
28 | QString _ntpOutput; | 29 | QString _ntpOutput; |
29 | float _shiftPerSec; | 30 | float _shiftPerSec; |
30 | int _lookupDiff; | 31 | int _lookupDiff; |
31 | OProcess *ntpProcess; | 32 | OProcess *ntpProcess; |
32 | QTimer *ntpTimer; | 33 | QTimer *ntpTimer; |
33 | QSocket *ntpSock; | 34 | QSocket *ntpSock; |
34 | QCopChannel *channel; | 35 | QCopChannel *channel; |
35 | bool _interactive; | 36 | bool _interactive; |
36 | float getTimeShift(); | 37 | float getTimeShift(); |
37 | void readLookups(); | 38 | void readLookups(); |
38 | void ntpOutPut(QString); | 39 | void ntpOutPut(QString); |
39 | bool ntpDelayElapsed(); | 40 | bool ntpDelayElapsed(); |
40 | QString getNtpServer(); | 41 | QString getNtpServer(); |
42 | void saveConfig(); | ||
41 | private slots: | 43 | private slots: |
42 | void slotTimerRunNtp(); | 44 | void slotTimerRunNtp(); |
43 | void slotButtonRunNtp(); | 45 | void slotButtonRunNtp(); |
44 | void slotRunNtp(); | 46 | void slotRunNtp(); |
45 | void getNtpOutput(OProcess *proc, char *buffer, int buflen); | 47 | void getNtpOutput(OProcess *proc, char *buffer, int buflen); |
46 | void ntpFinished(OProcess*); | 48 | void ntpFinished(OProcess*); |
47 | void preditctTime(); | 49 | void preditctTime(); |
48 | void slotCheckNtp(int); | 50 | void slotCheckNtp(int); |
49 | void setPredictTime(); | 51 | void setPredictTime(); |
50 | void showAdvancedFeatures(bool); | 52 | void showAdvancedFeatures(bool); |
51 | void slotProbeNtpServer(); | 53 | void slotProbeNtpServer(); |
52 | void slotNtpDelayChanged(int); | 54 | void slotNtpDelayChanged(int); |
53 | }; | 55 | }; |
54 | 56 | ||
55 | #endif | 57 | #endif |
diff --git a/noncore/settings/netsystemtime/ntpbase.cpp b/noncore/settings/netsystemtime/ntpbase.cpp index 0a7a57e..878c158 100644 --- a/noncore/settings/netsystemtime/ntpbase.cpp +++ b/noncore/settings/netsystemtime/ntpbase.cpp | |||
@@ -1,331 +1,335 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form implementation generated from reading ui file 'ntpbase.ui' | 2 | ** Form implementation generated from reading ui file 'ntpbase.ui' |
3 | ** | 3 | ** |
4 | ** Created: Sun Nov 10 17:59:14 2002 | 4 | ** Created: Sat Nov 16 15:49:54 2002 |
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #include "ntpbase.h" | 9 | #include "ntpbase.h" |
10 | 10 | ||
11 | #include <qcheckbox.h> | 11 | #include <qcheckbox.h> |
12 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
13 | #include <qframe.h> | 13 | #include <qframe.h> |
14 | #include <qlabel.h> | 14 | #include <qlabel.h> |
15 | #include <qmultilineedit.h> | 15 | #include <qmultilineedit.h> |
16 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
17 | #include <qspinbox.h> | 17 | #include <qspinbox.h> |
18 | #include <qtable.h> | 18 | #include <qtable.h> |
19 | #include <qtabwidget.h> | 19 | #include <qtabwidget.h> |
20 | #include <qwidget.h> | ||
20 | #include <qlayout.h> | 21 | #include <qlayout.h> |
21 | #include <qvariant.h> | 22 | #include <qvariant.h> |
22 | #include <qtooltip.h> | 23 | #include <qtooltip.h> |
23 | #include <qwhatsthis.h> | 24 | #include <qwhatsthis.h> |
24 | 25 | ||
25 | /* | 26 | /* |
26 | * Constructs a NtpBase which is a child of 'parent', with the | 27 | * Constructs a NtpBase which is a child of 'parent', with the |
27 | * name 'name' and widget flags set to 'f' | 28 | * name 'name' and widget flags set to 'f' |
29 | * | ||
30 | * The dialog will by default be modeless, unless you set 'modal' to | ||
31 | * TRUE to construct a modal dialog. | ||
28 | */ | 32 | */ |
29 | NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) | 33 | NtpBase::NtpBase( QWidget* parent, const char* name, bool modal, WFlags fl ) |
30 | : QWidget( parent, name, fl ) | 34 | : QDialog( parent, name, modal, fl ) |
31 | { | 35 | { |
32 | if ( !name ) | 36 | if ( !name ) |
33 | setName( "NtpBase" ); | 37 | setName( "NtpBase" ); |
34 | resize( 317, 411 ); | 38 | resize( 317, 411 ); |
35 | setCaption( tr( "Network Time" ) ); | 39 | setCaption( tr( "Network Time" ) ); |
36 | NtpBaseLayout = new QGridLayout( this ); | 40 | NtpBaseLayout = new QGridLayout( this ); |
37 | NtpBaseLayout->setSpacing( 2 ); | 41 | NtpBaseLayout->setSpacing( 2 ); |
38 | NtpBaseLayout->setMargin( 2 ); | 42 | NtpBaseLayout->setMargin( 2 ); |
39 | 43 | ||
40 | TabWidgetMain = new QTabWidget( this, "TabWidgetMain" ); | 44 | TabWidgetMain = new QTabWidget( this, "TabWidgetMain" ); |
41 | 45 | ||
42 | tabMain = new QWidget( TabWidgetMain, "tabMain" ); | 46 | tabMain = new QWidget( TabWidgetMain, "tabMain" ); |
43 | tabMainLayout = new QGridLayout( tabMain ); | 47 | tabMainLayout = new QGridLayout( tabMain ); |
44 | tabMainLayout->setSpacing( 2 ); | 48 | tabMainLayout->setSpacing( 2 ); |
45 | tabMainLayout->setMargin( 2 ); | 49 | tabMainLayout->setMargin( 2 ); |
46 | 50 | ||
47 | FrameSystemTime = new QFrame( tabMain, "FrameSystemTime" ); | 51 | FrameSystemTime = new QFrame( tabMain, "FrameSystemTime" ); |
48 | 52 | ||
49 | tabMainLayout->addWidget( FrameSystemTime, 0, 0 ); | 53 | tabMainLayout->addWidget( FrameSystemTime, 0, 0 ); |
50 | TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); | 54 | TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); |
51 | 55 | ||
52 | tabNtp = new QWidget( TabWidgetMain, "tabNtp" ); | 56 | tabNtp = new QWidget( TabWidgetMain, "tabNtp" ); |
53 | tabNtpLayout = new QGridLayout( tabNtp ); | 57 | tabNtpLayout = new QGridLayout( tabNtp ); |
54 | tabNtpLayout->setSpacing( 2 ); | 58 | tabNtpLayout->setSpacing( 2 ); |
55 | tabNtpLayout->setMargin( 1 ); | 59 | tabNtpLayout->setMargin( 1 ); |
56 | 60 | ||
57 | runNtp = new QPushButton( tabNtp, "runNtp" ); | 61 | runNtp = new QPushButton( tabNtp, "runNtp" ); |
58 | runNtp->setText( tr( "Get time from network" ) ); | 62 | runNtp->setText( tr( "Get time from network" ) ); |
59 | 63 | ||
60 | tabNtpLayout->addWidget( runNtp, 1, 0 ); | 64 | tabNtpLayout->addWidget( runNtp, 1, 0 ); |
61 | 65 | ||
62 | FrameNtp = new QWidget( tabNtp, "FrameNtp" ); | 66 | FrameNtp = new QWidget( tabNtp, "FrameNtp" ); |
63 | FrameNtpLayout = new QGridLayout( FrameNtp ); | 67 | FrameNtpLayout = new QGridLayout( FrameNtp ); |
64 | FrameNtpLayout->setSpacing( 2 ); | 68 | FrameNtpLayout->setSpacing( 2 ); |
65 | FrameNtpLayout->setMargin( 2 ); | 69 | FrameNtpLayout->setMargin( 2 ); |
66 | 70 | ||
67 | Layout4 = new QVBoxLayout; | 71 | Layout4 = new QVBoxLayout; |
68 | Layout4->setSpacing( 6 ); | 72 | Layout4->setSpacing( 6 ); |
69 | Layout4->setMargin( 0 ); | 73 | Layout4->setMargin( 0 ); |
70 | 74 | ||
71 | TextLabel1 = new QLabel( FrameNtp, "TextLabel1" ); | 75 | TextLabel1 = new QLabel( FrameNtp, "TextLabel1" ); |
72 | TextLabel1->setAutoMask( FALSE ); | 76 | TextLabel1->setAutoMask( FALSE ); |
73 | TextLabel1->setText( tr( "Start Time:" ) ); | 77 | TextLabel1->setText( tr( "Start Time:" ) ); |
74 | Layout4->addWidget( TextLabel1 ); | 78 | Layout4->addWidget( TextLabel1 ); |
75 | 79 | ||
76 | TextLabelStartTime = new QLabel( FrameNtp, "TextLabelStartTime" ); | 80 | TextLabelStartTime = new QLabel( FrameNtp, "TextLabelStartTime" ); |
77 | TextLabelStartTime->setText( tr( "nan" ) ); | 81 | TextLabelStartTime->setText( tr( "nan" ) ); |
78 | Layout4->addWidget( TextLabelStartTime ); | 82 | Layout4->addWidget( TextLabelStartTime ); |
79 | 83 | ||
80 | TextLabel3 = new QLabel( FrameNtp, "TextLabel3" ); | 84 | TextLabel3 = new QLabel( FrameNtp, "TextLabel3" ); |
81 | TextLabel3->setText( tr( "Time Shift:" ) ); | 85 | TextLabel3->setText( tr( "Time Shift:" ) ); |
82 | Layout4->addWidget( TextLabel3 ); | 86 | Layout4->addWidget( TextLabel3 ); |
83 | 87 | ||
84 | TextLabelTimeShift = new QLabel( FrameNtp, "TextLabelTimeShift" ); | 88 | TextLabelTimeShift = new QLabel( FrameNtp, "TextLabelTimeShift" ); |
85 | TextLabelTimeShift->setText( tr( "nan" ) ); | 89 | TextLabelTimeShift->setText( tr( "nan" ) ); |
86 | Layout4->addWidget( TextLabelTimeShift ); | 90 | Layout4->addWidget( TextLabelTimeShift ); |
87 | 91 | ||
88 | TextLabel5 = new QLabel( FrameNtp, "TextLabel5" ); | 92 | TextLabel5 = new QLabel( FrameNtp, "TextLabel5" ); |
89 | TextLabel5->setText( tr( "New Time:" ) ); | 93 | TextLabel5->setText( tr( "New Time:" ) ); |
90 | Layout4->addWidget( TextLabel5 ); | 94 | Layout4->addWidget( TextLabel5 ); |
91 | 95 | ||
92 | TextLabelNewTime = new QLabel( FrameNtp, "TextLabelNewTime" ); | 96 | TextLabelNewTime = new QLabel( FrameNtp, "TextLabelNewTime" ); |
93 | TextLabelNewTime->setText( tr( "nan" ) ); | 97 | TextLabelNewTime->setText( tr( "nan" ) ); |
94 | Layout4->addWidget( TextLabelNewTime ); | 98 | Layout4->addWidget( TextLabelNewTime ); |
95 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 99 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
96 | Layout4->addItem( spacer ); | 100 | Layout4->addItem( spacer ); |
97 | 101 | ||
98 | FrameNtpLayout->addLayout( Layout4, 0, 0 ); | 102 | FrameNtpLayout->addLayout( Layout4, 0, 0 ); |
99 | 103 | ||
100 | MultiLineEditntpOutPut = new QMultiLineEdit( FrameNtp, "MultiLineEditntpOutPut" ); | 104 | MultiLineEditntpOutPut = new QMultiLineEdit( FrameNtp, "MultiLineEditntpOutPut" ); |
101 | QFont MultiLineEditntpOutPut_font( MultiLineEditntpOutPut->font() ); | 105 | QFont MultiLineEditntpOutPut_font( MultiLineEditntpOutPut->font() ); |
102 | MultiLineEditntpOutPut_font.setPointSize( 7 ); | 106 | MultiLineEditntpOutPut_font.setPointSize( 7 ); |
103 | MultiLineEditntpOutPut->setFont( MultiLineEditntpOutPut_font ); | 107 | MultiLineEditntpOutPut->setFont( MultiLineEditntpOutPut_font ); |
104 | MultiLineEditntpOutPut->setWordWrap( QMultiLineEdit::WidgetWidth ); | 108 | MultiLineEditntpOutPut->setWordWrap( QMultiLineEdit::WidgetWidth ); |
105 | MultiLineEditntpOutPut->setText( tr( "" ) ); | 109 | MultiLineEditntpOutPut->setText( tr( "" ) ); |
106 | 110 | ||
107 | FrameNtpLayout->addWidget( MultiLineEditntpOutPut, 1, 0 ); | 111 | FrameNtpLayout->addWidget( MultiLineEditntpOutPut, 1, 0 ); |
108 | 112 | ||
109 | tabNtpLayout->addWidget( FrameNtp, 0, 0 ); | 113 | tabNtpLayout->addWidget( FrameNtp, 0, 0 ); |
110 | TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); | 114 | TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); |
111 | 115 | ||
112 | tabPredict = new QWidget( TabWidgetMain, "tabPredict" ); | 116 | tabPredict = new QWidget( TabWidgetMain, "tabPredict" ); |
113 | tabPredictLayout = new QGridLayout( tabPredict ); | 117 | tabPredictLayout = new QGridLayout( tabPredict ); |
114 | tabPredictLayout->setSpacing( 6 ); | 118 | tabPredictLayout->setSpacing( 6 ); |
115 | tabPredictLayout->setMargin( 5 ); | 119 | tabPredictLayout->setMargin( 5 ); |
116 | 120 | ||
117 | TableLookups = new QTable( tabPredict, "TableLookups" ); | 121 | TableLookups = new QTable( tabPredict, "TableLookups" ); |
118 | QFont TableLookups_font( TableLookups->font() ); | 122 | QFont TableLookups_font( TableLookups->font() ); |
119 | TableLookups_font.setPointSize( 8 ); | 123 | TableLookups_font.setPointSize( 8 ); |
120 | TableLookups->setFont( TableLookups_font ); | 124 | TableLookups->setFont( TableLookups_font ); |
121 | TableLookups->setNumRows( 2 ); | 125 | TableLookups->setNumRows( 2 ); |
122 | TableLookups->setNumCols( 2 ); | 126 | TableLookups->setNumCols( 2 ); |
123 | 127 | ||
124 | tabPredictLayout->addWidget( TableLookups, 0, 0 ); | 128 | tabPredictLayout->addWidget( TableLookups, 0, 0 ); |
125 | 129 | ||
126 | Layout9 = new QGridLayout; | 130 | Layout9 = new QGridLayout; |
127 | Layout9->setSpacing( 6 ); | 131 | Layout9->setSpacing( 6 ); |
128 | Layout9->setMargin( 0 ); | 132 | Layout9->setMargin( 0 ); |
129 | 133 | ||
130 | TextLabelShift = new QLabel( tabPredict, "TextLabelShift" ); | 134 | TextLabelShift = new QLabel( tabPredict, "TextLabelShift" ); |
131 | TextLabelShift->setText( tr( "nan" ) ); | 135 | TextLabelShift->setText( tr( "nan" ) ); |
132 | 136 | ||
133 | Layout9->addWidget( TextLabelShift, 0, 1 ); | 137 | Layout9->addWidget( TextLabelShift, 0, 1 ); |
134 | 138 | ||
135 | TextLabel4 = new QLabel( tabPredict, "TextLabel4" ); | 139 | TextLabel4 = new QLabel( tabPredict, "TextLabel4" ); |
136 | TextLabel4->setText( tr( "Esimated Shift:" ) ); | 140 | TextLabel4->setText( tr( "Esimated Shift:" ) ); |
137 | 141 | ||
138 | Layout9->addWidget( TextLabel4, 1, 0 ); | 142 | Layout9->addWidget( TextLabel4, 1, 0 ); |
139 | 143 | ||
140 | TextLabelEstimatedShift = new QLabel( tabPredict, "TextLabelEstimatedShift" ); | 144 | TextLabelEstimatedShift = new QLabel( tabPredict, "TextLabelEstimatedShift" ); |
141 | TextLabelEstimatedShift->setText( tr( "nan" ) ); | 145 | TextLabelEstimatedShift->setText( tr( "nan" ) ); |
142 | 146 | ||
143 | Layout9->addWidget( TextLabelEstimatedShift, 1, 1 ); | 147 | Layout9->addWidget( TextLabelEstimatedShift, 1, 1 ); |
144 | 148 | ||
145 | TextLabel3_2 = new QLabel( tabPredict, "TextLabel3_2" ); | 149 | TextLabel3_2 = new QLabel( tabPredict, "TextLabel3_2" ); |
146 | TextLabel3_2->setText( tr( "Predicted Time:" ) ); | 150 | TextLabel3_2->setText( tr( "Predicted Time:" ) ); |
147 | 151 | ||
148 | Layout9->addWidget( TextLabel3_2, 2, 0 ); | 152 | Layout9->addWidget( TextLabel3_2, 2, 0 ); |
149 | 153 | ||
150 | Mean_shift_label = new QLabel( tabPredict, "Mean_shift_label" ); | 154 | Mean_shift_label = new QLabel( tabPredict, "Mean_shift_label" ); |
151 | Mean_shift_label->setText( tr( "Mean shift:" ) ); | 155 | Mean_shift_label->setText( tr( "Mean shift:" ) ); |
152 | 156 | ||
153 | Layout9->addWidget( Mean_shift_label, 0, 0 ); | 157 | Layout9->addWidget( Mean_shift_label, 0, 0 ); |
154 | 158 | ||
155 | TextLabelPredTime = new QLabel( tabPredict, "TextLabelPredTime" ); | 159 | TextLabelPredTime = new QLabel( tabPredict, "TextLabelPredTime" ); |
156 | TextLabelPredTime->setText( tr( "nan" ) ); | 160 | TextLabelPredTime->setText( tr( "nan" ) ); |
157 | 161 | ||
158 | Layout9->addWidget( TextLabelPredTime, 2, 1 ); | 162 | Layout9->addWidget( TextLabelPredTime, 2, 1 ); |
159 | 163 | ||
160 | tabPredictLayout->addLayout( Layout9, 1, 0 ); | 164 | tabPredictLayout->addLayout( Layout9, 1, 0 ); |
161 | 165 | ||
162 | Layout11 = new QHBoxLayout; | 166 | Layout11 = new QHBoxLayout; |
163 | Layout11->setSpacing( 6 ); | 167 | Layout11->setSpacing( 6 ); |
164 | Layout11->setMargin( 0 ); | 168 | Layout11->setMargin( 0 ); |
165 | 169 | ||
166 | PushButtonSetPredTime = new QPushButton( tabPredict, "PushButtonSetPredTime" ); | 170 | PushButtonSetPredTime = new QPushButton( tabPredict, "PushButtonSetPredTime" ); |
167 | PushButtonSetPredTime->setText( tr( "Set predicted time" ) ); | 171 | PushButtonSetPredTime->setText( tr( "Set predicted time" ) ); |
168 | Layout11->addWidget( PushButtonSetPredTime ); | 172 | Layout11->addWidget( PushButtonSetPredTime ); |
169 | 173 | ||
170 | PushButtonPredict = new QPushButton( tabPredict, "PushButtonPredict" ); | 174 | PushButtonPredict = new QPushButton( tabPredict, "PushButtonPredict" ); |
171 | PushButtonPredict->setText( tr( "Predict time" ) ); | 175 | PushButtonPredict->setText( tr( "Predict time" ) ); |
172 | Layout11->addWidget( PushButtonPredict ); | 176 | Layout11->addWidget( PushButtonPredict ); |
173 | 177 | ||
174 | tabPredictLayout->addLayout( Layout11, 2, 0 ); | 178 | tabPredictLayout->addLayout( Layout11, 2, 0 ); |
175 | TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); | 179 | TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); |
176 | 180 | ||
177 | TabSettings = new QWidget( TabWidgetMain, "TabSettings" ); | 181 | TabSettings = new QWidget( TabWidgetMain, "TabSettings" ); |
178 | TabSettingsLayout = new QGridLayout( TabSettings ); | 182 | TabSettingsLayout = new QGridLayout( TabSettings ); |
179 | TabSettingsLayout->setSpacing( 2 ); | 183 | TabSettingsLayout->setSpacing( 2 ); |
180 | TabSettingsLayout->setMargin( 2 ); | 184 | TabSettingsLayout->setMargin( 2 ); |
181 | 185 | ||
182 | FrameSettings = new QWidget( TabSettings, "FrameSettings" ); | 186 | FrameSettings = new QWidget( TabSettings, "FrameSettings" ); |
183 | FrameSettingsLayout = new QVBoxLayout( FrameSettings ); | 187 | FrameSettingsLayout = new QVBoxLayout( FrameSettings ); |
184 | FrameSettingsLayout->setSpacing( 6 ); | 188 | FrameSettingsLayout->setSpacing( 6 ); |
185 | FrameSettingsLayout->setMargin( 11 ); | 189 | FrameSettingsLayout->setMargin( 11 ); |
186 | 190 | ||
187 | Layout6 = new QGridLayout; | 191 | Layout6 = new QGridLayout; |
188 | Layout6->setSpacing( 6 ); | 192 | Layout6->setSpacing( 6 ); |
189 | Layout6->setMargin( 0 ); | 193 | Layout6->setMargin( 0 ); |
190 | 194 | ||
191 | TextLabel7_2 = new QLabel( FrameSettings, "TextLabel7_2" ); | 195 | TextLabel7_2 = new QLabel( FrameSettings, "TextLabel7_2" ); |
192 | TextLabel7_2->setText( tr( "Use" ) ); | 196 | TextLabel7_2->setText( tr( "Use" ) ); |
193 | 197 | ||
194 | Layout6->addWidget( TextLabel7_2, 0, 0 ); | 198 | Layout6->addWidget( TextLabel7_2, 0, 0 ); |
195 | 199 | ||
196 | TextLabel2_2 = new QLabel( FrameSettings, "TextLabel2_2" ); | 200 | TextLabel2_2 = new QLabel( FrameSettings, "TextLabel2_2" ); |
197 | TextLabel2_2->setText( tr( "as" ) ); | 201 | TextLabel2_2->setText( tr( "as" ) ); |
198 | 202 | ||
199 | Layout6->addWidget( TextLabel2_2, 0, 2 ); | 203 | Layout6->addWidget( TextLabel2_2, 0, 2 ); |
200 | 204 | ||
201 | TextLabel1_3 = new QLabel( FrameSettings, "TextLabel1_3" ); | 205 | TextLabel1_3 = new QLabel( FrameSettings, "TextLabel1_3" ); |
202 | TextLabel1_3->setText( tr( "NTP server to get the time from the network." ) ); | 206 | TextLabel1_3->setText( tr( "NTP server to get the time from the network." ) ); |
203 | TextLabel1_3->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); | 207 | TextLabel1_3->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); |
204 | 208 | ||
205 | Layout6->addMultiCellWidget( TextLabel1_3, 1, 1, 0, 1 ); | 209 | Layout6->addMultiCellWidget( TextLabel1_3, 1, 1, 0, 1 ); |
206 | 210 | ||
207 | ComboNtpSrv = new QComboBox( FALSE, FrameSettings, "ComboNtpSrv" ); | 211 | ComboNtpSrv = new QComboBox( FALSE, FrameSettings, "ComboNtpSrv" ); |
208 | ComboNtpSrv->setEditable( TRUE ); | 212 | ComboNtpSrv->setEditable( TRUE ); |
209 | 213 | ||
210 | Layout6->addWidget( ComboNtpSrv, 0, 1 ); | 214 | Layout6->addWidget( ComboNtpSrv, 0, 1 ); |
211 | FrameSettingsLayout->addLayout( Layout6 ); | 215 | FrameSettingsLayout->addLayout( Layout6 ); |
212 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); | 216 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); |
213 | FrameSettingsLayout->addItem( spacer_2 ); | 217 | FrameSettingsLayout->addItem( spacer_2 ); |
214 | 218 | ||
215 | CheckBoxAdvSettings = new QCheckBox( FrameSettings, "CheckBoxAdvSettings" ); | 219 | CheckBoxAdvSettings = new QCheckBox( FrameSettings, "CheckBoxAdvSettings" ); |
216 | CheckBoxAdvSettings->setText( tr( "Advanced settings" ) ); | 220 | CheckBoxAdvSettings->setText( tr( "Advanced settings" ) ); |
217 | FrameSettingsLayout->addWidget( CheckBoxAdvSettings ); | 221 | FrameSettingsLayout->addWidget( CheckBoxAdvSettings ); |
218 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 222 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
219 | FrameSettingsLayout->addItem( spacer_3 ); | 223 | FrameSettingsLayout->addItem( spacer_3 ); |
220 | 224 | ||
221 | Line1 = new QFrame( FrameSettings, "Line1" ); | 225 | Line1 = new QFrame( FrameSettings, "Line1" ); |
222 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 226 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
223 | FrameSettingsLayout->addWidget( Line1 ); | 227 | FrameSettingsLayout->addWidget( Line1 ); |
224 | 228 | ||
225 | Layout7_2 = new QGridLayout; | 229 | Layout7_2 = new QGridLayout; |
226 | Layout7_2->setSpacing( 6 ); | 230 | Layout7_2->setSpacing( 6 ); |
227 | Layout7_2->setMargin( 0 ); | 231 | Layout7_2->setMargin( 0 ); |
228 | 232 | ||
229 | TextLabel1_2_2 = new QLabel( FrameSettings, "TextLabel1_2_2" ); | 233 | TextLabel1_2_2 = new QLabel( FrameSettings, "TextLabel1_2_2" ); |
230 | TextLabel1_2_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, TextLabel1_2_2->sizePolicy().hasHeightForWidth() ) ); | 234 | TextLabel1_2_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, TextLabel1_2_2->sizePolicy().hasHeightForWidth() ) ); |
231 | TextLabel1_2_2->setText( tr( "Wait for " ) ); | 235 | TextLabel1_2_2->setText( tr( "Wait for " ) ); |
232 | 236 | ||
233 | Layout7_2->addWidget( TextLabel1_2_2, 0, 0 ); | 237 | Layout7_2->addWidget( TextLabel1_2_2, 0, 0 ); |
234 | 238 | ||
235 | TextLabel2_3 = new QLabel( FrameSettings, "TextLabel2_3" ); | 239 | TextLabel2_3 = new QLabel( FrameSettings, "TextLabel2_3" ); |
236 | TextLabel2_3->setText( tr( "minutes until" ) ); | 240 | TextLabel2_3->setText( tr( "minutes until" ) ); |
237 | 241 | ||
238 | Layout7_2->addWidget( TextLabel2_3, 0, 2 ); | 242 | Layout7_2->addWidget( TextLabel2_3, 0, 2 ); |
239 | 243 | ||
240 | TextLabel3_3_2 = new QLabel( FrameSettings, "TextLabel3_3_2" ); | 244 | TextLabel3_3_2 = new QLabel( FrameSettings, "TextLabel3_3_2" ); |
241 | TextLabel3_3_2->setText( tr( "NTP tries to syncronises the clock with the network." ) ); | 245 | TextLabel3_3_2->setText( tr( "NTP tries to syncronises the clock with the network." ) ); |
242 | TextLabel3_3_2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); | 246 | TextLabel3_3_2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); |
243 | 247 | ||
244 | Layout7_2->addMultiCellWidget( TextLabel3_3_2, 1, 1, 0, 2 ); | 248 | Layout7_2->addMultiCellWidget( TextLabel3_3_2, 1, 1, 0, 2 ); |
245 | 249 | ||
246 | SpinBoxNtpDelay = new QSpinBox( FrameSettings, "SpinBoxNtpDelay" ); | 250 | SpinBoxNtpDelay = new QSpinBox( FrameSettings, "SpinBoxNtpDelay" ); |
247 | SpinBoxNtpDelay->setWrapping( TRUE ); | 251 | SpinBoxNtpDelay->setWrapping( TRUE ); |
248 | SpinBoxNtpDelay->setMaxValue( 9999999 ); | 252 | SpinBoxNtpDelay->setMaxValue( 9999999 ); |
249 | SpinBoxNtpDelay->setMinValue( 1 ); | 253 | SpinBoxNtpDelay->setMinValue( 1 ); |
250 | SpinBoxNtpDelay->setValue( 1440 ); | 254 | SpinBoxNtpDelay->setValue( 1440 ); |
251 | 255 | ||
252 | Layout7_2->addWidget( SpinBoxNtpDelay, 0, 1 ); | 256 | Layout7_2->addWidget( SpinBoxNtpDelay, 0, 1 ); |
253 | FrameSettingsLayout->addLayout( Layout7_2 ); | 257 | FrameSettingsLayout->addLayout( Layout7_2 ); |
254 | 258 | ||
255 | Layout7 = new QGridLayout; | 259 | Layout7 = new QGridLayout; |
256 | Layout7->setSpacing( 6 ); | 260 | Layout7->setSpacing( 6 ); |
257 | Layout7->setMargin( 0 ); | 261 | Layout7->setMargin( 0 ); |
258 | 262 | ||
259 | TextLabel1_2 = new QLabel( FrameSettings, "TextLabel1_2" ); | 263 | TextLabel1_2 = new QLabel( FrameSettings, "TextLabel1_2" ); |
260 | TextLabel1_2->setText( tr( "Insure a delay of" ) ); | 264 | TextLabel1_2->setText( tr( "Insure a delay of" ) ); |
261 | 265 | ||
262 | Layout7->addWidget( TextLabel1_2, 0, 0 ); | 266 | Layout7->addWidget( TextLabel1_2, 0, 0 ); |
263 | 267 | ||
264 | TextLabel2 = new QLabel( FrameSettings, "TextLabel2" ); | 268 | TextLabel2 = new QLabel( FrameSettings, "TextLabel2" ); |
265 | TextLabel2->setText( tr( "minutes until" ) ); | 269 | TextLabel2->setText( tr( "minutes until" ) ); |
266 | 270 | ||
267 | Layout7->addWidget( TextLabel2, 0, 2 ); | 271 | Layout7->addWidget( TextLabel2, 0, 2 ); |
268 | 272 | ||
269 | TextLabel3_3 = new QLabel( FrameSettings, "TextLabel3_3" ); | 273 | TextLabel3_3 = new QLabel( FrameSettings, "TextLabel3_3" ); |
270 | TextLabel3_3->setText( tr( "a new NTP lookup will be used to predict the time." ) ); | 274 | TextLabel3_3->setText( tr( "a new NTP lookup will be used to predict the time." ) ); |
271 | TextLabel3_3->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); | 275 | TextLabel3_3->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); |
272 | 276 | ||
273 | Layout7->addMultiCellWidget( TextLabel3_3, 1, 1, 0, 2 ); | 277 | Layout7->addMultiCellWidget( TextLabel3_3, 1, 1, 0, 2 ); |
274 | 278 | ||
275 | SpinBoxMinLookupDelay = new QSpinBox( FrameSettings, "SpinBoxMinLookupDelay" ); | 279 | SpinBoxMinLookupDelay = new QSpinBox( FrameSettings, "SpinBoxMinLookupDelay" ); |
276 | SpinBoxMinLookupDelay->setWrapping( TRUE ); | 280 | SpinBoxMinLookupDelay->setWrapping( TRUE ); |
277 | SpinBoxMinLookupDelay->setMaxValue( 9999999 ); | 281 | SpinBoxMinLookupDelay->setMaxValue( 9999999 ); |
278 | SpinBoxMinLookupDelay->setMinValue( 42 ); | 282 | SpinBoxMinLookupDelay->setMinValue( 42 ); |
279 | SpinBoxMinLookupDelay->setValue( 720 ); | 283 | SpinBoxMinLookupDelay->setValue( 720 ); |
280 | 284 | ||
281 | Layout7->addWidget( SpinBoxMinLookupDelay, 0, 1 ); | 285 | Layout7->addWidget( SpinBoxMinLookupDelay, 0, 1 ); |
282 | FrameSettingsLayout->addLayout( Layout7 ); | 286 | FrameSettingsLayout->addLayout( Layout7 ); |
283 | 287 | ||
284 | TabSettingsLayout->addWidget( FrameSettings, 0, 0 ); | 288 | TabSettingsLayout->addWidget( FrameSettings, 0, 0 ); |
285 | TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); | 289 | TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); |
286 | 290 | ||
287 | tabManualSetTime = new QWidget( TabWidgetMain, "tabManualSetTime" ); | 291 | tabManualSetTime = new QWidget( TabWidgetMain, "tabManualSetTime" ); |
288 | tabManualSetTimeLayout = new QVBoxLayout( tabManualSetTime ); | 292 | tabManualSetTimeLayout = new QVBoxLayout( tabManualSetTime ); |
289 | tabManualSetTimeLayout->setSpacing( 6 ); | 293 | tabManualSetTimeLayout->setSpacing( 6 ); |
290 | tabManualSetTimeLayout->setMargin( 11 ); | 294 | tabManualSetTimeLayout->setMargin( 11 ); |
291 | 295 | ||
292 | FrameSetTime = new QWidget( tabManualSetTime, "FrameSetTime" ); | 296 | FrameSetTime = new QWidget( tabManualSetTime, "FrameSetTime" ); |
293 | FrameSetTime->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, FrameSetTime->sizePolicy().hasHeightForWidth() ) ); | 297 | FrameSetTime->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, FrameSetTime->sizePolicy().hasHeightForWidth() ) ); |
294 | tabManualSetTimeLayout->addWidget( FrameSetTime ); | 298 | tabManualSetTimeLayout->addWidget( FrameSetTime ); |
295 | 299 | ||
296 | PushButtonSetManualTime = new QPushButton( tabManualSetTime, "PushButtonSetManualTime" ); | 300 | PushButtonSetManualTime = new QPushButton( tabManualSetTime, "PushButtonSetManualTime" ); |
297 | PushButtonSetManualTime->setText( tr( "Set time" ) ); | 301 | PushButtonSetManualTime->setText( tr( "Set time" ) ); |
298 | tabManualSetTimeLayout->addWidget( PushButtonSetManualTime ); | 302 | tabManualSetTimeLayout->addWidget( PushButtonSetManualTime ); |
299 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 303 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
300 | tabManualSetTimeLayout->addItem( spacer_4 ); | 304 | tabManualSetTimeLayout->addItem( spacer_4 ); |
301 | TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); | 305 | TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); |
302 | 306 | ||
303 | NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); | 307 | NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); |
304 | } | 308 | } |
305 | 309 | ||
306 | /* | 310 | /* |
307 | * Destroys the object and frees any allocated resources | 311 | * Destroys the object and frees any allocated resources |
308 | */ | 312 | */ |
309 | NtpBase::~NtpBase() | 313 | NtpBase::~NtpBase() |
310 | { | 314 | { |
311 | // no need to delete child widgets, Qt does it all for us | 315 | // no need to delete child widgets, Qt does it all for us |
312 | } | 316 | } |
313 | 317 | ||
314 | /* | 318 | /* |
315 | * Main event handler. Reimplemented to handle application | 319 | * Main event handler. Reimplemented to handle application |
316 | * font changes | 320 | * font changes |
317 | */ | 321 | */ |
318 | bool NtpBase::event( QEvent* ev ) | 322 | bool NtpBase::event( QEvent* ev ) |
319 | { | 323 | { |
320 | bool ret = QWidget::event( ev ); | 324 | bool ret = QDialog::event( ev ); |
321 | if ( ev->type() == QEvent::ApplicationFontChange ) { | 325 | if ( ev->type() == QEvent::ApplicationFontChange ) { |
322 | QFont MultiLineEditntpOutPut_font( MultiLineEditntpOutPut->font() ); | 326 | QFont MultiLineEditntpOutPut_font( MultiLineEditntpOutPut->font() ); |
323 | MultiLineEditntpOutPut_font.setPointSize( 7 ); | 327 | MultiLineEditntpOutPut_font.setPointSize( 7 ); |
324 | MultiLineEditntpOutPut->setFont( MultiLineEditntpOutPut_font ); | 328 | MultiLineEditntpOutPut->setFont( MultiLineEditntpOutPut_font ); |
325 | QFont TableLookups_font( TableLookups->font() ); | 329 | QFont TableLookups_font( TableLookups->font() ); |
326 | TableLookups_font.setPointSize( 8 ); | 330 | TableLookups_font.setPointSize( 8 ); |
327 | TableLookups->setFont( TableLookups_font ); | 331 | TableLookups->setFont( TableLookups_font ); |
328 | } | 332 | } |
329 | return ret; | 333 | return ret; |
330 | } | 334 | } |
331 | 335 | ||
diff --git a/noncore/settings/netsystemtime/ntpbase.h b/noncore/settings/netsystemtime/ntpbase.h index 543cac1..68599c9 100644 --- a/noncore/settings/netsystemtime/ntpbase.h +++ b/noncore/settings/netsystemtime/ntpbase.h | |||
@@ -1,96 +1,97 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form interface generated from reading ui file 'ntpbase.ui' | 2 | ** Form interface generated from reading ui file 'ntpbase.ui' |
3 | ** | 3 | ** |
4 | ** Created: Sun Nov 10 17:58:48 2002 | 4 | ** Created: Sat Nov 16 15:49:32 2002 |
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #ifndef NTPBASE_H | 9 | #ifndef NTPBASE_H |
10 | #define NTPBASE_H | 10 | #define NTPBASE_H |
11 | 11 | ||
12 | #include <qvariant.h> | 12 | #include <qvariant.h> |
13 | #include <qwidget.h> | 13 | #include <qdialog.h> |
14 | class QVBoxLayout; | 14 | class QVBoxLayout; |
15 | class QHBoxLayout; | 15 | class QHBoxLayout; |
16 | class QGridLayout; | 16 | class QGridLayout; |
17 | class QCheckBox; | 17 | class QCheckBox; |
18 | class QComboBox; | 18 | class QComboBox; |
19 | class QFrame; | 19 | class QFrame; |
20 | class QLabel; | 20 | class QLabel; |
21 | class QMultiLineEdit; | 21 | class QMultiLineEdit; |
22 | class QPushButton; | 22 | class QPushButton; |
23 | class QSpinBox; | 23 | class QSpinBox; |
24 | class QTabWidget; | 24 | class QTabWidget; |
25 | class QTable; | 25 | class QTable; |
26 | class QWidget; | ||
26 | 27 | ||
27 | class NtpBase : public QWidget | 28 | class NtpBase : public QDialog |
28 | { | 29 | { |
29 | Q_OBJECT | 30 | Q_OBJECT |
30 | 31 | ||
31 | public: | 32 | public: |
32 | NtpBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 33 | NtpBase( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
33 | ~NtpBase(); | 34 | ~NtpBase(); |
34 | 35 | ||
35 | QTabWidget* TabWidgetMain; | 36 | QTabWidget* TabWidgetMain; |
36 | QWidget* tabMain; | 37 | QWidget* tabMain; |
37 | QFrame* FrameSystemTime; | 38 | QFrame* FrameSystemTime; |
38 | QWidget* tabNtp; | 39 | QWidget* tabNtp; |
39 | QPushButton* runNtp; | 40 | QPushButton* runNtp; |
40 | QWidget* FrameNtp; | 41 | QWidget* FrameNtp; |
41 | QLabel* TextLabel1; | 42 | QLabel* TextLabel1; |
42 | QLabel* TextLabelStartTime; | 43 | QLabel* TextLabelStartTime; |
43 | QLabel* TextLabel3; | 44 | QLabel* TextLabel3; |
44 | QLabel* TextLabelTimeShift; | 45 | QLabel* TextLabelTimeShift; |
45 | QLabel* TextLabel5; | 46 | QLabel* TextLabel5; |
46 | QLabel* TextLabelNewTime; | 47 | QLabel* TextLabelNewTime; |
47 | QMultiLineEdit* MultiLineEditntpOutPut; | 48 | QMultiLineEdit* MultiLineEditntpOutPut; |
48 | QWidget* tabPredict; | 49 | QWidget* tabPredict; |
49 | QTable* TableLookups; | 50 | QTable* TableLookups; |
50 | QLabel* TextLabelShift; | 51 | QLabel* TextLabelShift; |
51 | QLabel* TextLabel4; | 52 | QLabel* TextLabel4; |
52 | QLabel* TextLabelEstimatedShift; | 53 | QLabel* TextLabelEstimatedShift; |
53 | QLabel* TextLabel3_2; | 54 | QLabel* TextLabel3_2; |
54 | QLabel* Mean_shift_label; | 55 | QLabel* Mean_shift_label; |
55 | QLabel* TextLabelPredTime; | 56 | QLabel* TextLabelPredTime; |
56 | QPushButton* PushButtonSetPredTime; | 57 | QPushButton* PushButtonSetPredTime; |
57 | QPushButton* PushButtonPredict; | 58 | QPushButton* PushButtonPredict; |
58 | QWidget* TabSettings; | 59 | QWidget* TabSettings; |
59 | QWidget* FrameSettings; | 60 | QWidget* FrameSettings; |
60 | QLabel* TextLabel7_2; | 61 | QLabel* TextLabel7_2; |
61 | QLabel* TextLabel2_2; | 62 | QLabel* TextLabel2_2; |
62 | QLabel* TextLabel1_3; | 63 | QLabel* TextLabel1_3; |
63 | QComboBox* ComboNtpSrv; | 64 | QComboBox* ComboNtpSrv; |
64 | QCheckBox* CheckBoxAdvSettings; | 65 | QCheckBox* CheckBoxAdvSettings; |
65 | QFrame* Line1; | 66 | QFrame* Line1; |
66 | QLabel* TextLabel1_2_2; | 67 | QLabel* TextLabel1_2_2; |
67 | QLabel* TextLabel2_3; | 68 | QLabel* TextLabel2_3; |
68 | QLabel* TextLabel3_3_2; | 69 | QLabel* TextLabel3_3_2; |
69 | QSpinBox* SpinBoxNtpDelay; | 70 | QSpinBox* SpinBoxNtpDelay; |
70 | QLabel* TextLabel1_2; | 71 | QLabel* TextLabel1_2; |
71 | QLabel* TextLabel2; | 72 | QLabel* TextLabel2; |
72 | QLabel* TextLabel3_3; | 73 | QLabel* TextLabel3_3; |
73 | QSpinBox* SpinBoxMinLookupDelay; | 74 | QSpinBox* SpinBoxMinLookupDelay; |
74 | QWidget* tabManualSetTime; | 75 | QWidget* tabManualSetTime; |
75 | QWidget* FrameSetTime; | 76 | QWidget* FrameSetTime; |
76 | QPushButton* PushButtonSetManualTime; | 77 | QPushButton* PushButtonSetManualTime; |
77 | 78 | ||
78 | protected: | 79 | protected: |
79 | QGridLayout* NtpBaseLayout; | 80 | QGridLayout* NtpBaseLayout; |
80 | QGridLayout* tabMainLayout; | 81 | QGridLayout* tabMainLayout; |
81 | QGridLayout* tabNtpLayout; | 82 | QGridLayout* tabNtpLayout; |
82 | QGridLayout* FrameNtpLayout; | 83 | QGridLayout* FrameNtpLayout; |
83 | QVBoxLayout* Layout4; | 84 | QVBoxLayout* Layout4; |
84 | QGridLayout* tabPredictLayout; | 85 | QGridLayout* tabPredictLayout; |
85 | QGridLayout* Layout9; | 86 | QGridLayout* Layout9; |
86 | QHBoxLayout* Layout11; | 87 | QHBoxLayout* Layout11; |
87 | QGridLayout* TabSettingsLayout; | 88 | QGridLayout* TabSettingsLayout; |
88 | QVBoxLayout* FrameSettingsLayout; | 89 | QVBoxLayout* FrameSettingsLayout; |
89 | QGridLayout* Layout6; | 90 | QGridLayout* Layout6; |
90 | QGridLayout* Layout7_2; | 91 | QGridLayout* Layout7_2; |
91 | QGridLayout* Layout7; | 92 | QGridLayout* Layout7; |
92 | QVBoxLayout* tabManualSetTimeLayout; | 93 | QVBoxLayout* tabManualSetTimeLayout; |
93 | bool event( QEvent* ); | 94 | bool event( QEvent* ); |
94 | }; | 95 | }; |
95 | 96 | ||
96 | #endif // NTPBASE_H | 97 | #endif // NTPBASE_H |
diff --git a/noncore/settings/netsystemtime/ntpbase.ui b/noncore/settings/netsystemtime/ntpbase.ui index 6c38588..8c106be 100644 --- a/noncore/settings/netsystemtime/ntpbase.ui +++ b/noncore/settings/netsystemtime/ntpbase.ui | |||
@@ -1,772 +1,772 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>NtpBase</class> | 2 | <class>NtpBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>NtpBase</cstring> | 7 | <cstring>NtpBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>317</width> | 14 | <width>317</width> |
15 | <height>411</height> | 15 | <height>411</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Network Time</string> | 20 | <string>Network Time</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <grid> | 28 | <grid> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>2</number> | 31 | <number>2</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>2</number> |
36 | </property> | 36 | </property> |
37 | <widget row="0" column="0" > | 37 | <widget row="0" column="0" > |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidgetMain</cstring> | 41 | <cstring>TabWidgetMain</cstring> |
42 | </property> | 42 | </property> |
43 | <property> | 43 | <property> |
44 | <name>layoutMargin</name> | 44 | <name>layoutMargin</name> |
45 | </property> | 45 | </property> |
46 | <property> | 46 | <property> |
47 | <name>layoutSpacing</name> | 47 | <name>layoutSpacing</name> |
48 | </property> | 48 | </property> |
49 | <widget> | 49 | <widget> |
50 | <class>QWidget</class> | 50 | <class>QWidget</class> |
51 | <property stdset="1"> | 51 | <property stdset="1"> |
52 | <name>name</name> | 52 | <name>name</name> |
53 | <cstring>tabMain</cstring> | 53 | <cstring>tabMain</cstring> |
54 | </property> | 54 | </property> |
55 | <attribute> | 55 | <attribute> |
56 | <name>title</name> | 56 | <name>title</name> |
57 | <string>Main</string> | 57 | <string>Main</string> |
58 | </attribute> | 58 | </attribute> |
59 | <grid> | 59 | <grid> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
61 | <name>margin</name> | 61 | <name>margin</name> |
62 | <number>2</number> | 62 | <number>2</number> |
63 | </property> | 63 | </property> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>spacing</name> | 65 | <name>spacing</name> |
66 | <number>2</number> | 66 | <number>2</number> |
67 | </property> | 67 | </property> |
68 | <widget row="0" column="0" > | 68 | <widget row="0" column="0" > |
69 | <class>QFrame</class> | 69 | <class>QFrame</class> |
70 | <property stdset="1"> | 70 | <property stdset="1"> |
71 | <name>name</name> | 71 | <name>name</name> |
72 | <cstring>FrameSystemTime</cstring> | 72 | <cstring>FrameSystemTime</cstring> |
73 | </property> | 73 | </property> |
74 | </widget> | 74 | </widget> |
75 | </grid> | 75 | </grid> |
76 | </widget> | 76 | </widget> |
77 | <widget> | 77 | <widget> |
78 | <class>QWidget</class> | 78 | <class>QWidget</class> |
79 | <property stdset="1"> | 79 | <property stdset="1"> |
80 | <name>name</name> | 80 | <name>name</name> |
81 | <cstring>tabNtp</cstring> | 81 | <cstring>tabNtp</cstring> |
82 | </property> | 82 | </property> |
83 | <attribute> | 83 | <attribute> |
84 | <name>title</name> | 84 | <name>title</name> |
85 | <string>NTP</string> | 85 | <string>NTP</string> |
86 | </attribute> | 86 | </attribute> |
87 | <grid> | 87 | <grid> |
88 | <property stdset="1"> | 88 | <property stdset="1"> |
89 | <name>margin</name> | 89 | <name>margin</name> |
90 | <number>1</number> | 90 | <number>1</number> |
91 | </property> | 91 | </property> |
92 | <property stdset="1"> | 92 | <property stdset="1"> |
93 | <name>spacing</name> | 93 | <name>spacing</name> |
94 | <number>2</number> | 94 | <number>2</number> |
95 | </property> | 95 | </property> |
96 | <widget row="1" column="0" > | 96 | <widget row="1" column="0" > |
97 | <class>QPushButton</class> | 97 | <class>QPushButton</class> |
98 | <property stdset="1"> | 98 | <property stdset="1"> |
99 | <name>name</name> | 99 | <name>name</name> |
100 | <cstring>runNtp</cstring> | 100 | <cstring>runNtp</cstring> |
101 | </property> | 101 | </property> |
102 | <property stdset="1"> | 102 | <property stdset="1"> |
103 | <name>text</name> | 103 | <name>text</name> |
104 | <string>Get time from network</string> | 104 | <string>Get time from network</string> |
105 | </property> | 105 | </property> |
106 | </widget> | 106 | </widget> |
107 | <widget row="0" column="0" > | 107 | <widget row="0" column="0" > |
108 | <class>QWidget</class> | 108 | <class>QWidget</class> |
109 | <property stdset="1"> | 109 | <property stdset="1"> |
110 | <name>name</name> | 110 | <name>name</name> |
111 | <cstring>FrameNtp</cstring> | 111 | <cstring>FrameNtp</cstring> |
112 | </property> | 112 | </property> |
113 | <property> | 113 | <property> |
114 | <name>layoutMargin</name> | 114 | <name>layoutMargin</name> |
115 | </property> | 115 | </property> |
116 | <property> | 116 | <property> |
117 | <name>layoutSpacing</name> | 117 | <name>layoutSpacing</name> |
118 | </property> | 118 | </property> |
119 | <grid> | 119 | <grid> |
120 | <property stdset="1"> | 120 | <property stdset="1"> |
121 | <name>margin</name> | 121 | <name>margin</name> |
122 | <number>2</number> | 122 | <number>2</number> |
123 | </property> | 123 | </property> |
124 | <property stdset="1"> | 124 | <property stdset="1"> |
125 | <name>spacing</name> | 125 | <name>spacing</name> |
126 | <number>2</number> | 126 | <number>2</number> |
127 | </property> | 127 | </property> |
128 | <widget row="0" column="0" > | 128 | <widget row="0" column="0" > |
129 | <class>QLayoutWidget</class> | 129 | <class>QLayoutWidget</class> |
130 | <property stdset="1"> | 130 | <property stdset="1"> |
131 | <name>name</name> | 131 | <name>name</name> |
132 | <cstring>Layout4</cstring> | 132 | <cstring>Layout4</cstring> |
133 | </property> | 133 | </property> |
134 | <vbox> | 134 | <vbox> |
135 | <property stdset="1"> | 135 | <property stdset="1"> |
136 | <name>margin</name> | 136 | <name>margin</name> |
137 | <number>0</number> | 137 | <number>0</number> |
138 | </property> | 138 | </property> |
139 | <property stdset="1"> | 139 | <property stdset="1"> |
140 | <name>spacing</name> | 140 | <name>spacing</name> |
141 | <number>6</number> | 141 | <number>6</number> |
142 | </property> | 142 | </property> |
143 | <widget> | 143 | <widget> |
144 | <class>QLabel</class> | 144 | <class>QLabel</class> |
145 | <property stdset="1"> | 145 | <property stdset="1"> |
146 | <name>name</name> | 146 | <name>name</name> |
147 | <cstring>TextLabel1</cstring> | 147 | <cstring>TextLabel1</cstring> |
148 | </property> | 148 | </property> |
149 | <property stdset="1"> | 149 | <property stdset="1"> |
150 | <name>autoMask</name> | 150 | <name>autoMask</name> |
151 | <bool>false</bool> | 151 | <bool>false</bool> |
152 | </property> | 152 | </property> |
153 | <property stdset="1"> | 153 | <property stdset="1"> |
154 | <name>text</name> | 154 | <name>text</name> |
155 | <string>Start Time:</string> | 155 | <string>Start Time:</string> |
156 | </property> | 156 | </property> |
157 | </widget> | 157 | </widget> |
158 | <widget> | 158 | <widget> |
159 | <class>QLabel</class> | 159 | <class>QLabel</class> |
160 | <property stdset="1"> | 160 | <property stdset="1"> |
161 | <name>name</name> | 161 | <name>name</name> |
162 | <cstring>TextLabelStartTime</cstring> | 162 | <cstring>TextLabelStartTime</cstring> |
163 | </property> | 163 | </property> |
164 | <property stdset="1"> | 164 | <property stdset="1"> |
165 | <name>text</name> | 165 | <name>text</name> |
166 | <string>nan</string> | 166 | <string>nan</string> |
167 | </property> | 167 | </property> |
168 | </widget> | 168 | </widget> |
169 | <widget> | 169 | <widget> |
170 | <class>QLabel</class> | 170 | <class>QLabel</class> |
171 | <property stdset="1"> | 171 | <property stdset="1"> |
172 | <name>name</name> | 172 | <name>name</name> |
173 | <cstring>TextLabel3</cstring> | 173 | <cstring>TextLabel3</cstring> |
174 | </property> | 174 | </property> |
175 | <property stdset="1"> | 175 | <property stdset="1"> |
176 | <name>text</name> | 176 | <name>text</name> |
177 | <string>Time Shift:</string> | 177 | <string>Time Shift:</string> |
178 | </property> | 178 | </property> |
179 | </widget> | 179 | </widget> |
180 | <widget> | 180 | <widget> |
181 | <class>QLabel</class> | 181 | <class>QLabel</class> |
182 | <property stdset="1"> | 182 | <property stdset="1"> |
183 | <name>name</name> | 183 | <name>name</name> |
184 | <cstring>TextLabelTimeShift</cstring> | 184 | <cstring>TextLabelTimeShift</cstring> |
185 | </property> | 185 | </property> |
186 | <property stdset="1"> | 186 | <property stdset="1"> |
187 | <name>text</name> | 187 | <name>text</name> |
188 | <string>nan</string> | 188 | <string>nan</string> |
189 | </property> | 189 | </property> |
190 | </widget> | 190 | </widget> |
191 | <widget> | 191 | <widget> |
192 | <class>QLabel</class> | 192 | <class>QLabel</class> |
193 | <property stdset="1"> | 193 | <property stdset="1"> |
194 | <name>name</name> | 194 | <name>name</name> |
195 | <cstring>TextLabel5</cstring> | 195 | <cstring>TextLabel5</cstring> |
196 | </property> | 196 | </property> |
197 | <property stdset="1"> | 197 | <property stdset="1"> |
198 | <name>text</name> | 198 | <name>text</name> |
199 | <string>New Time:</string> | 199 | <string>New Time:</string> |
200 | </property> | 200 | </property> |
201 | </widget> | 201 | </widget> |
202 | <widget> | 202 | <widget> |
203 | <class>QLabel</class> | 203 | <class>QLabel</class> |
204 | <property stdset="1"> | 204 | <property stdset="1"> |
205 | <name>name</name> | 205 | <name>name</name> |
206 | <cstring>TextLabelNewTime</cstring> | 206 | <cstring>TextLabelNewTime</cstring> |
207 | </property> | 207 | </property> |
208 | <property stdset="1"> | 208 | <property stdset="1"> |
209 | <name>text</name> | 209 | <name>text</name> |
210 | <string>nan</string> | 210 | <string>nan</string> |
211 | </property> | 211 | </property> |
212 | </widget> | 212 | </widget> |
213 | <spacer> | 213 | <spacer> |
214 | <property> | 214 | <property> |
215 | <name>name</name> | 215 | <name>name</name> |
216 | <cstring>Spacer1</cstring> | 216 | <cstring>Spacer1</cstring> |
217 | </property> | 217 | </property> |
218 | <property stdset="1"> | 218 | <property stdset="1"> |
219 | <name>orientation</name> | 219 | <name>orientation</name> |
220 | <enum>Vertical</enum> | 220 | <enum>Vertical</enum> |
221 | </property> | 221 | </property> |
222 | <property stdset="1"> | 222 | <property stdset="1"> |
223 | <name>sizeType</name> | 223 | <name>sizeType</name> |
224 | <enum>Expanding</enum> | 224 | <enum>Expanding</enum> |
225 | </property> | 225 | </property> |
226 | <property> | 226 | <property> |
227 | <name>sizeHint</name> | 227 | <name>sizeHint</name> |
228 | <size> | 228 | <size> |
229 | <width>20</width> | 229 | <width>20</width> |
230 | <height>20</height> | 230 | <height>20</height> |
231 | </size> | 231 | </size> |
232 | </property> | 232 | </property> |
233 | </spacer> | 233 | </spacer> |
234 | </vbox> | 234 | </vbox> |
235 | </widget> | 235 | </widget> |
236 | <widget row="1" column="0" > | 236 | <widget row="1" column="0" > |
237 | <class>QMultiLineEdit</class> | 237 | <class>QMultiLineEdit</class> |
238 | <property stdset="1"> | 238 | <property stdset="1"> |
239 | <name>name</name> | 239 | <name>name</name> |
240 | <cstring>MultiLineEditntpOutPut</cstring> | 240 | <cstring>MultiLineEditntpOutPut</cstring> |
241 | </property> | 241 | </property> |
242 | <property stdset="1"> | 242 | <property stdset="1"> |
243 | <name>font</name> | 243 | <name>font</name> |
244 | <font> | 244 | <font> |
245 | <pointsize>7</pointsize> | 245 | <pointsize>7</pointsize> |
246 | </font> | 246 | </font> |
247 | </property> | 247 | </property> |
248 | <property stdset="1"> | 248 | <property stdset="1"> |
249 | <name>wordWrap</name> | 249 | <name>wordWrap</name> |
250 | <enum>WidgetWidth</enum> | 250 | <enum>WidgetWidth</enum> |
251 | </property> | 251 | </property> |
252 | <property stdset="1"> | 252 | <property stdset="1"> |
253 | <name>text</name> | 253 | <name>text</name> |
254 | <string></string> | 254 | <string></string> |
255 | </property> | 255 | </property> |
256 | </widget> | 256 | </widget> |
257 | </grid> | 257 | </grid> |
258 | </widget> | 258 | </widget> |
259 | </grid> | 259 | </grid> |
260 | </widget> | 260 | </widget> |
261 | <widget> | 261 | <widget> |
262 | <class>QWidget</class> | 262 | <class>QWidget</class> |
263 | <property stdset="1"> | 263 | <property stdset="1"> |
264 | <name>name</name> | 264 | <name>name</name> |
265 | <cstring>tabPredict</cstring> | 265 | <cstring>tabPredict</cstring> |
266 | </property> | 266 | </property> |
267 | <attribute> | 267 | <attribute> |
268 | <name>title</name> | 268 | <name>title</name> |
269 | <string>Predict</string> | 269 | <string>Predict</string> |
270 | </attribute> | 270 | </attribute> |
271 | <grid> | 271 | <grid> |
272 | <property stdset="1"> | 272 | <property stdset="1"> |
273 | <name>margin</name> | 273 | <name>margin</name> |
274 | <number>5</number> | 274 | <number>5</number> |
275 | </property> | 275 | </property> |
276 | <property stdset="1"> | 276 | <property stdset="1"> |
277 | <name>spacing</name> | 277 | <name>spacing</name> |
278 | <number>6</number> | 278 | <number>6</number> |
279 | </property> | 279 | </property> |
280 | <widget row="0" column="0" > | 280 | <widget row="0" column="0" > |
281 | <class>QTable</class> | 281 | <class>QTable</class> |
282 | <property stdset="1"> | 282 | <property stdset="1"> |
283 | <name>name</name> | 283 | <name>name</name> |
284 | <cstring>TableLookups</cstring> | 284 | <cstring>TableLookups</cstring> |
285 | </property> | 285 | </property> |
286 | <property stdset="1"> | 286 | <property stdset="1"> |
287 | <name>font</name> | 287 | <name>font</name> |
288 | <font> | 288 | <font> |
289 | <pointsize>8</pointsize> | 289 | <pointsize>8</pointsize> |
290 | </font> | 290 | </font> |
291 | </property> | 291 | </property> |
292 | <property stdset="1"> | 292 | <property stdset="1"> |
293 | <name>numRows</name> | 293 | <name>numRows</name> |
294 | <number>2</number> | 294 | <number>2</number> |
295 | </property> | 295 | </property> |
296 | <property stdset="1"> | 296 | <property stdset="1"> |
297 | <name>numCols</name> | 297 | <name>numCols</name> |
298 | <number>2</number> | 298 | <number>2</number> |
299 | </property> | 299 | </property> |
300 | </widget> | 300 | </widget> |
301 | <widget row="1" column="0" > | 301 | <widget row="1" column="0" > |
302 | <class>QLayoutWidget</class> | 302 | <class>QLayoutWidget</class> |
303 | <property stdset="1"> | 303 | <property stdset="1"> |
304 | <name>name</name> | 304 | <name>name</name> |
305 | <cstring>Layout9</cstring> | 305 | <cstring>Layout9</cstring> |
306 | </property> | 306 | </property> |
307 | <grid> | 307 | <grid> |
308 | <property stdset="1"> | 308 | <property stdset="1"> |
309 | <name>margin</name> | 309 | <name>margin</name> |
310 | <number>0</number> | 310 | <number>0</number> |
311 | </property> | 311 | </property> |
312 | <property stdset="1"> | 312 | <property stdset="1"> |
313 | <name>spacing</name> | 313 | <name>spacing</name> |
314 | <number>6</number> | 314 | <number>6</number> |
315 | </property> | 315 | </property> |
316 | <widget row="0" column="1" > | 316 | <widget row="0" column="1" > |
317 | <class>QLabel</class> | 317 | <class>QLabel</class> |
318 | <property stdset="1"> | 318 | <property stdset="1"> |
319 | <name>name</name> | 319 | <name>name</name> |
320 | <cstring>TextLabelShift</cstring> | 320 | <cstring>TextLabelShift</cstring> |
321 | </property> | 321 | </property> |
322 | <property stdset="1"> | 322 | <property stdset="1"> |
323 | <name>text</name> | 323 | <name>text</name> |
324 | <string>nan</string> | 324 | <string>nan</string> |
325 | </property> | 325 | </property> |
326 | </widget> | 326 | </widget> |
327 | <widget row="1" column="0" > | 327 | <widget row="1" column="0" > |
328 | <class>QLabel</class> | 328 | <class>QLabel</class> |
329 | <property stdset="1"> | 329 | <property stdset="1"> |
330 | <name>name</name> | 330 | <name>name</name> |
331 | <cstring>TextLabel4</cstring> | 331 | <cstring>TextLabel4</cstring> |
332 | </property> | 332 | </property> |
333 | <property stdset="1"> | 333 | <property stdset="1"> |
334 | <name>text</name> | 334 | <name>text</name> |
335 | <string>Esimated Shift:</string> | 335 | <string>Esimated Shift:</string> |
336 | </property> | 336 | </property> |
337 | </widget> | 337 | </widget> |
338 | <widget row="1" column="1" > | 338 | <widget row="1" column="1" > |
339 | <class>QLabel</class> | 339 | <class>QLabel</class> |
340 | <property stdset="1"> | 340 | <property stdset="1"> |
341 | <name>name</name> | 341 | <name>name</name> |
342 | <cstring>TextLabelEstimatedShift</cstring> | 342 | <cstring>TextLabelEstimatedShift</cstring> |
343 | </property> | 343 | </property> |
344 | <property stdset="1"> | 344 | <property stdset="1"> |
345 | <name>text</name> | 345 | <name>text</name> |
346 | <string>nan</string> | 346 | <string>nan</string> |
347 | </property> | 347 | </property> |
348 | </widget> | 348 | </widget> |
349 | <widget row="2" column="0" > | 349 | <widget row="2" column="0" > |
350 | <class>QLabel</class> | 350 | <class>QLabel</class> |
351 | <property stdset="1"> | 351 | <property stdset="1"> |
352 | <name>name</name> | 352 | <name>name</name> |
353 | <cstring>TextLabel3_2</cstring> | 353 | <cstring>TextLabel3_2</cstring> |
354 | </property> | 354 | </property> |
355 | <property stdset="1"> | 355 | <property stdset="1"> |
356 | <name>text</name> | 356 | <name>text</name> |
357 | <string>Predicted Time:</string> | 357 | <string>Predicted Time:</string> |
358 | </property> | 358 | </property> |
359 | </widget> | 359 | </widget> |
360 | <widget row="0" column="0" > | 360 | <widget row="0" column="0" > |
361 | <class>QLabel</class> | 361 | <class>QLabel</class> |
362 | <property stdset="1"> | 362 | <property stdset="1"> |
363 | <name>name</name> | 363 | <name>name</name> |
364 | <cstring>Mean_shift_label</cstring> | 364 | <cstring>Mean_shift_label</cstring> |
365 | </property> | 365 | </property> |
366 | <property stdset="1"> | 366 | <property stdset="1"> |
367 | <name>text</name> | 367 | <name>text</name> |
368 | <string>Mean shift:</string> | 368 | <string>Mean shift:</string> |
369 | </property> | 369 | </property> |
370 | </widget> | 370 | </widget> |
371 | <widget row="2" column="1" > | 371 | <widget row="2" column="1" > |
372 | <class>QLabel</class> | 372 | <class>QLabel</class> |
373 | <property stdset="1"> | 373 | <property stdset="1"> |
374 | <name>name</name> | 374 | <name>name</name> |
375 | <cstring>TextLabelPredTime</cstring> | 375 | <cstring>TextLabelPredTime</cstring> |
376 | </property> | 376 | </property> |
377 | <property stdset="1"> | 377 | <property stdset="1"> |
378 | <name>text</name> | 378 | <name>text</name> |
379 | <string>nan</string> | 379 | <string>nan</string> |
380 | </property> | 380 | </property> |
381 | </widget> | 381 | </widget> |
382 | </grid> | 382 | </grid> |
383 | </widget> | 383 | </widget> |
384 | <widget row="2" column="0" > | 384 | <widget row="2" column="0" > |
385 | <class>QLayoutWidget</class> | 385 | <class>QLayoutWidget</class> |
386 | <property stdset="1"> | 386 | <property stdset="1"> |
387 | <name>name</name> | 387 | <name>name</name> |
388 | <cstring>Layout11</cstring> | 388 | <cstring>Layout11</cstring> |
389 | </property> | 389 | </property> |
390 | <hbox> | 390 | <hbox> |
391 | <property stdset="1"> | 391 | <property stdset="1"> |
392 | <name>margin</name> | 392 | <name>margin</name> |
393 | <number>0</number> | 393 | <number>0</number> |
394 | </property> | 394 | </property> |
395 | <property stdset="1"> | 395 | <property stdset="1"> |
396 | <name>spacing</name> | 396 | <name>spacing</name> |
397 | <number>6</number> | 397 | <number>6</number> |
398 | </property> | 398 | </property> |
399 | <widget> | 399 | <widget> |
400 | <class>QPushButton</class> | 400 | <class>QPushButton</class> |
401 | <property stdset="1"> | 401 | <property stdset="1"> |
402 | <name>name</name> | 402 | <name>name</name> |
403 | <cstring>PushButtonSetPredTime</cstring> | 403 | <cstring>PushButtonSetPredTime</cstring> |
404 | </property> | 404 | </property> |
405 | <property stdset="1"> | 405 | <property stdset="1"> |
406 | <name>text</name> | 406 | <name>text</name> |
407 | <string>Set predicted time</string> | 407 | <string>Set predicted time</string> |
408 | </property> | 408 | </property> |
409 | </widget> | 409 | </widget> |
410 | <widget> | 410 | <widget> |
411 | <class>QPushButton</class> | 411 | <class>QPushButton</class> |
412 | <property stdset="1"> | 412 | <property stdset="1"> |
413 | <name>name</name> | 413 | <name>name</name> |
414 | <cstring>PushButtonPredict</cstring> | 414 | <cstring>PushButtonPredict</cstring> |
415 | </property> | 415 | </property> |
416 | <property stdset="1"> | 416 | <property stdset="1"> |
417 | <name>text</name> | 417 | <name>text</name> |
418 | <string>Predict time</string> | 418 | <string>Predict time</string> |
419 | </property> | 419 | </property> |
420 | </widget> | 420 | </widget> |
421 | </hbox> | 421 | </hbox> |
422 | </widget> | 422 | </widget> |
423 | </grid> | 423 | </grid> |
424 | </widget> | 424 | </widget> |
425 | <widget> | 425 | <widget> |
426 | <class>QWidget</class> | 426 | <class>QWidget</class> |
427 | <property stdset="1"> | 427 | <property stdset="1"> |
428 | <name>name</name> | 428 | <name>name</name> |
429 | <cstring>TabSettings</cstring> | 429 | <cstring>TabSettings</cstring> |
430 | </property> | 430 | </property> |
431 | <attribute> | 431 | <attribute> |
432 | <name>title</name> | 432 | <name>title</name> |
433 | <string>Settings</string> | 433 | <string>Settings</string> |
434 | </attribute> | 434 | </attribute> |
435 | <grid> | 435 | <grid> |
436 | <property stdset="1"> | 436 | <property stdset="1"> |
437 | <name>margin</name> | 437 | <name>margin</name> |
438 | <number>2</number> | 438 | <number>2</number> |
439 | </property> | 439 | </property> |
440 | <property stdset="1"> | 440 | <property stdset="1"> |
441 | <name>spacing</name> | 441 | <name>spacing</name> |
442 | <number>2</number> | 442 | <number>2</number> |
443 | </property> | 443 | </property> |
444 | <widget row="0" column="0" > | 444 | <widget row="0" column="0" > |
445 | <class>QWidget</class> | 445 | <class>QWidget</class> |
446 | <property stdset="1"> | 446 | <property stdset="1"> |
447 | <name>name</name> | 447 | <name>name</name> |
448 | <cstring>FrameSettings</cstring> | 448 | <cstring>FrameSettings</cstring> |
449 | </property> | 449 | </property> |
450 | <property> | 450 | <property> |
451 | <name>layoutMargin</name> | 451 | <name>layoutMargin</name> |
452 | </property> | 452 | </property> |
453 | <property> | 453 | <property> |
454 | <name>layoutSpacing</name> | 454 | <name>layoutSpacing</name> |
455 | </property> | 455 | </property> |
456 | <vbox> | 456 | <vbox> |
457 | <property stdset="1"> | 457 | <property stdset="1"> |
458 | <name>margin</name> | 458 | <name>margin</name> |
459 | <number>11</number> | 459 | <number>11</number> |
460 | </property> | 460 | </property> |
461 | <property stdset="1"> | 461 | <property stdset="1"> |
462 | <name>spacing</name> | 462 | <name>spacing</name> |
463 | <number>6</number> | 463 | <number>6</number> |
464 | </property> | 464 | </property> |
465 | <widget> | 465 | <widget> |
466 | <class>QLayoutWidget</class> | 466 | <class>QLayoutWidget</class> |
467 | <property stdset="1"> | 467 | <property stdset="1"> |
468 | <name>name</name> | 468 | <name>name</name> |
469 | <cstring>Layout6</cstring> | 469 | <cstring>Layout6</cstring> |
470 | </property> | 470 | </property> |
471 | <grid> | 471 | <grid> |
472 | <property stdset="1"> | 472 | <property stdset="1"> |
473 | <name>margin</name> | 473 | <name>margin</name> |
474 | <number>0</number> | 474 | <number>0</number> |
475 | </property> | 475 | </property> |
476 | <property stdset="1"> | 476 | <property stdset="1"> |
477 | <name>spacing</name> | 477 | <name>spacing</name> |
478 | <number>6</number> | 478 | <number>6</number> |
479 | </property> | 479 | </property> |
480 | <widget row="0" column="0" > | 480 | <widget row="0" column="0" > |
481 | <class>QLabel</class> | 481 | <class>QLabel</class> |
482 | <property stdset="1"> | 482 | <property stdset="1"> |
483 | <name>name</name> | 483 | <name>name</name> |
484 | <cstring>TextLabel7_2</cstring> | 484 | <cstring>TextLabel7_2</cstring> |
485 | </property> | 485 | </property> |
486 | <property stdset="1"> | 486 | <property stdset="1"> |
487 | <name>text</name> | 487 | <name>text</name> |
488 | <string>Use</string> | 488 | <string>Use</string> |
489 | </property> | 489 | </property> |
490 | </widget> | 490 | </widget> |
491 | <widget row="0" column="2" > | 491 | <widget row="0" column="2" > |
492 | <class>QLabel</class> | 492 | <class>QLabel</class> |
493 | <property stdset="1"> | 493 | <property stdset="1"> |
494 | <name>name</name> | 494 | <name>name</name> |
495 | <cstring>TextLabel2_2</cstring> | 495 | <cstring>TextLabel2_2</cstring> |
496 | </property> | 496 | </property> |
497 | <property stdset="1"> | 497 | <property stdset="1"> |
498 | <name>text</name> | 498 | <name>text</name> |
499 | <string>as</string> | 499 | <string>as</string> |
500 | </property> | 500 | </property> |
501 | </widget> | 501 | </widget> |
502 | <widget row="1" column="0" rowspan="1" colspan="2" > | 502 | <widget row="1" column="0" rowspan="1" colspan="2" > |
503 | <class>QLabel</class> | 503 | <class>QLabel</class> |
504 | <property stdset="1"> | 504 | <property stdset="1"> |
505 | <name>name</name> | 505 | <name>name</name> |
506 | <cstring>TextLabel1_3</cstring> | 506 | <cstring>TextLabel1_3</cstring> |
507 | </property> | 507 | </property> |
508 | <property stdset="1"> | 508 | <property stdset="1"> |
509 | <name>text</name> | 509 | <name>text</name> |
510 | <string>NTP server to get the time from the network.</string> | 510 | <string>NTP server to get the time from the network.</string> |
511 | </property> | 511 | </property> |
512 | <property stdset="1"> | 512 | <property stdset="1"> |
513 | <name>alignment</name> | 513 | <name>alignment</name> |
514 | <set>WordBreak|AlignVCenter|AlignLeft</set> | 514 | <set>WordBreak|AlignVCenter|AlignLeft</set> |
515 | </property> | 515 | </property> |
516 | <property> | 516 | <property> |
517 | <name>wordwrap</name> | 517 | <name>wordwrap</name> |
518 | </property> | 518 | </property> |
519 | </widget> | 519 | </widget> |
520 | <widget row="0" column="1" > | 520 | <widget row="0" column="1" > |
521 | <class>QComboBox</class> | 521 | <class>QComboBox</class> |
522 | <property stdset="1"> | 522 | <property stdset="1"> |
523 | <name>name</name> | 523 | <name>name</name> |
524 | <cstring>ComboNtpSrv</cstring> | 524 | <cstring>ComboNtpSrv</cstring> |
525 | </property> | 525 | </property> |
526 | <property stdset="1"> | 526 | <property stdset="1"> |
527 | <name>editable</name> | 527 | <name>editable</name> |
528 | <bool>true</bool> | 528 | <bool>true</bool> |
529 | </property> | 529 | </property> |
530 | </widget> | 530 | </widget> |
531 | </grid> | 531 | </grid> |
532 | </widget> | 532 | </widget> |
533 | <spacer> | 533 | <spacer> |
534 | <property> | 534 | <property> |
535 | <name>name</name> | 535 | <name>name</name> |
536 | <cstring>Spacer3</cstring> | 536 | <cstring>Spacer3</cstring> |
537 | </property> | 537 | </property> |
538 | <property stdset="1"> | 538 | <property stdset="1"> |
539 | <name>orientation</name> | 539 | <name>orientation</name> |
540 | <enum>Vertical</enum> | 540 | <enum>Vertical</enum> |
541 | </property> | 541 | </property> |
542 | <property stdset="1"> | 542 | <property stdset="1"> |
543 | <name>sizeType</name> | 543 | <name>sizeType</name> |
544 | <enum>Minimum</enum> | 544 | <enum>Minimum</enum> |
545 | </property> | 545 | </property> |
546 | <property> | 546 | <property> |
547 | <name>sizeHint</name> | 547 | <name>sizeHint</name> |
548 | <size> | 548 | <size> |
549 | <width>20</width> | 549 | <width>20</width> |
550 | <height>20</height> | 550 | <height>20</height> |
551 | </size> | 551 | </size> |
552 | </property> | 552 | </property> |
553 | </spacer> | 553 | </spacer> |
554 | <widget> | 554 | <widget> |
555 | <class>QCheckBox</class> | 555 | <class>QCheckBox</class> |
556 | <property stdset="1"> | 556 | <property stdset="1"> |
557 | <name>name</name> | 557 | <name>name</name> |
558 | <cstring>CheckBoxAdvSettings</cstring> | 558 | <cstring>CheckBoxAdvSettings</cstring> |
559 | </property> | 559 | </property> |
560 | <property stdset="1"> | 560 | <property stdset="1"> |
561 | <name>text</name> | 561 | <name>text</name> |
562 | <string>Advanced settings</string> | 562 | <string>Advanced settings</string> |
563 | </property> | 563 | </property> |
564 | </widget> | 564 | </widget> |
565 | <spacer> | 565 | <spacer> |
566 | <property> | 566 | <property> |
567 | <name>name</name> | 567 | <name>name</name> |
568 | <cstring>Spacer4</cstring> | 568 | <cstring>Spacer4</cstring> |
569 | </property> | 569 | </property> |
570 | <property stdset="1"> | 570 | <property stdset="1"> |
571 | <name>orientation</name> | 571 | <name>orientation</name> |
572 | <enum>Vertical</enum> | 572 | <enum>Vertical</enum> |
573 | </property> | 573 | </property> |
574 | <property stdset="1"> | 574 | <property stdset="1"> |
575 | <name>sizeType</name> | 575 | <name>sizeType</name> |
576 | <enum>Expanding</enum> | 576 | <enum>Expanding</enum> |
577 | </property> | 577 | </property> |
578 | <property> | 578 | <property> |
579 | <name>sizeHint</name> | 579 | <name>sizeHint</name> |
580 | <size> | 580 | <size> |
581 | <width>20</width> | 581 | <width>20</width> |
582 | <height>20</height> | 582 | <height>20</height> |
583 | </size> | 583 | </size> |
584 | </property> | 584 | </property> |
585 | </spacer> | 585 | </spacer> |
586 | <widget> | 586 | <widget> |
587 | <class>Line</class> | 587 | <class>Line</class> |
588 | <property stdset="1"> | 588 | <property stdset="1"> |
589 | <name>name</name> | 589 | <name>name</name> |
590 | <cstring>Line1</cstring> | 590 | <cstring>Line1</cstring> |
591 | </property> | 591 | </property> |
592 | <property stdset="1"> | 592 | <property stdset="1"> |
593 | <name>orientation</name> | 593 | <name>orientation</name> |
594 | <enum>Horizontal</enum> | 594 | <enum>Horizontal</enum> |
595 | </property> | 595 | </property> |
596 | </widget> | 596 | </widget> |
597 | <widget> | 597 | <widget> |
598 | <class>QLayoutWidget</class> | 598 | <class>QLayoutWidget</class> |
599 | <property stdset="1"> | 599 | <property stdset="1"> |
600 | <name>name</name> | 600 | <name>name</name> |
601 | <cstring>Layout7_2</cstring> | 601 | <cstring>Layout7_2</cstring> |
602 | </property> | 602 | </property> |
603 | <grid> | 603 | <grid> |
604 | <property stdset="1"> | 604 | <property stdset="1"> |
605 | <name>margin</name> | 605 | <name>margin</name> |
606 | <number>0</number> | 606 | <number>0</number> |
607 | </property> | 607 | </property> |
608 | <property stdset="1"> | 608 | <property stdset="1"> |
609 | <name>spacing</name> | 609 | <name>spacing</name> |
610 | <number>6</number> | 610 | <number>6</number> |
611 | </property> | 611 | </property> |
612 | <widget row="0" column="0" > | 612 | <widget row="0" column="0" > |
613 | <class>QLabel</class> | 613 | <class>QLabel</class> |
614 | <property stdset="1"> | 614 | <property stdset="1"> |
615 | <name>name</name> | 615 | <name>name</name> |
616 | <cstring>TextLabel1_2_2</cstring> | 616 | <cstring>TextLabel1_2_2</cstring> |
617 | </property> | 617 | </property> |
618 | <property stdset="1"> | 618 | <property stdset="1"> |
619 | <name>sizePolicy</name> | 619 | <name>sizePolicy</name> |
620 | <sizepolicy> | 620 | <sizepolicy> |
621 | <hsizetype>1</hsizetype> | 621 | <hsizetype>1</hsizetype> |
622 | <vsizetype>1</vsizetype> | 622 | <vsizetype>1</vsizetype> |
623 | </sizepolicy> | 623 | </sizepolicy> |
624 | </property> | 624 | </property> |
625 | <property stdset="1"> | 625 | <property stdset="1"> |
626 | <name>text</name> | 626 | <name>text</name> |
627 | <string>Wait for </string> | 627 | <string>Wait for </string> |
628 | </property> | 628 | </property> |
629 | </widget> | 629 | </widget> |
630 | <widget row="0" column="2" > | 630 | <widget row="0" column="2" > |
631 | <class>QLabel</class> | 631 | <class>QLabel</class> |
632 | <property stdset="1"> | 632 | <property stdset="1"> |
633 | <name>name</name> | 633 | <name>name</name> |
634 | <cstring>TextLabel2_3</cstring> | 634 | <cstring>TextLabel2_3</cstring> |
635 | </property> | 635 | </property> |
636 | <property stdset="1"> | 636 | <property stdset="1"> |
637 | <name>text</name> | 637 | <name>text</name> |
638 | <string>minutes until</string> | 638 | <string>minutes until</string> |
639 | </property> | 639 | </property> |
640 | </widget> | 640 | </widget> |
641 | <widget row="1" column="0" rowspan="1" colspan="3" > | 641 | <widget row="1" column="0" rowspan="1" colspan="3" > |
642 | <class>QLabel</class> | 642 | <class>QLabel</class> |
643 | <property stdset="1"> | 643 | <property stdset="1"> |
644 | <name>name</name> | 644 | <name>name</name> |
645 | <cstring>TextLabel3_3_2</cstring> | 645 | <cstring>TextLabel3_3_2</cstring> |
646 | </property> | 646 | </property> |
647 | <property stdset="1"> | 647 | <property stdset="1"> |
648 | <name>text</name> | 648 | <name>text</name> |
649 | <string>NTP tries to syncronises the clock with the network.</string> | 649 | <string>NTP tries to syncronises the clock with the network.</string> |
650 | </property> | 650 | </property> |
651 | <property stdset="1"> | 651 | <property stdset="1"> |
652 | <name>alignment</name> | 652 | <name>alignment</name> |
653 | <set>WordBreak|AlignVCenter|AlignLeft</set> | 653 | <set>WordBreak|AlignVCenter|AlignLeft</set> |
654 | </property> | 654 | </property> |
655 | <property> | 655 | <property> |
656 | <name>wordwrap</name> | 656 | <name>wordwrap</name> |
657 | </property> | 657 | </property> |
658 | </widget> | 658 | </widget> |
659 | <widget row="0" column="1" > | 659 | <widget row="0" column="1" > |
660 | <class>QSpinBox</class> | 660 | <class>QSpinBox</class> |
661 | <property stdset="1"> | 661 | <property stdset="1"> |
662 | <name>name</name> | 662 | <name>name</name> |
663 | <cstring>SpinBoxNtpDelay</cstring> | 663 | <cstring>SpinBoxNtpDelay</cstring> |
664 | </property> | 664 | </property> |
665 | <property stdset="1"> | 665 | <property stdset="1"> |
666 | <name>wrapping</name> | 666 | <name>wrapping</name> |
667 | <bool>true</bool> | 667 | <bool>true</bool> |
668 | </property> | 668 | </property> |
669 | <property stdset="1"> | 669 | <property stdset="1"> |
670 | <name>maxValue</name> | 670 | <name>maxValue</name> |
671 | <number>9999999</number> | 671 | <number>9999999</number> |
672 | </property> | 672 | </property> |
673 | <property stdset="1"> | 673 | <property stdset="1"> |
674 | <name>minValue</name> | 674 | <name>minValue</name> |
675 | <number>1</number> | 675 | <number>1</number> |
676 | </property> | 676 | </property> |
677 | <property stdset="1"> | 677 | <property stdset="1"> |
678 | <name>value</name> | 678 | <name>value</name> |
679 | <number>1440</number> | 679 | <number>1440</number> |
680 | </property> | 680 | </property> |
681 | </widget> | 681 | </widget> |
682 | </grid> | 682 | </grid> |
683 | </widget> | 683 | </widget> |
684 | <widget> | 684 | <widget> |
685 | <class>QLayoutWidget</class> | 685 | <class>QLayoutWidget</class> |
686 | <property stdset="1"> | 686 | <property stdset="1"> |
687 | <name>name</name> | 687 | <name>name</name> |
688 | <cstring>Layout7</cstring> | 688 | <cstring>Layout7</cstring> |
689 | </property> | 689 | </property> |
690 | <grid> | 690 | <grid> |
691 | <property stdset="1"> | 691 | <property stdset="1"> |
692 | <name>margin</name> | 692 | <name>margin</name> |
693 | <number>0</number> | 693 | <number>0</number> |
694 | </property> | 694 | </property> |
695 | <property stdset="1"> | 695 | <property stdset="1"> |
696 | <name>spacing</name> | 696 | <name>spacing</name> |
697 | <number>6</number> | 697 | <number>6</number> |
698 | </property> | 698 | </property> |
699 | <widget row="0" column="0" > | 699 | <widget row="0" column="0" > |
700 | <class>QLabel</class> | 700 | <class>QLabel</class> |
701 | <property stdset="1"> | 701 | <property stdset="1"> |
702 | <name>name</name> | 702 | <name>name</name> |
703 | <cstring>TextLabel1_2</cstring> | 703 | <cstring>TextLabel1_2</cstring> |
704 | </property> | 704 | </property> |
705 | <property stdset="1"> | 705 | <property stdset="1"> |
706 | <name>text</name> | 706 | <name>text</name> |
707 | <string>Insure a delay of</string> | 707 | <string>Insure a delay of</string> |
708 | </property> | 708 | </property> |
709 | </widget> | 709 | </widget> |
710 | <widget row="0" column="2" > | 710 | <widget row="0" column="2" > |
711 | <class>QLabel</class> | 711 | <class>QLabel</class> |
712 | <property stdset="1"> | 712 | <property stdset="1"> |
713 | <name>name</name> | 713 | <name>name</name> |
714 | <cstring>TextLabel2</cstring> | 714 | <cstring>TextLabel2</cstring> |
715 | </property> | 715 | </property> |
716 | <property stdset="1"> | 716 | <property stdset="1"> |
717 | <name>text</name> | 717 | <name>text</name> |
718 | <string>minutes until</string> | 718 | <string>minutes until</string> |
719 | </property> | 719 | </property> |
720 | </widget> | 720 | </widget> |
721 | <widget row="1" column="0" rowspan="1" colspan="3" > | 721 | <widget row="1" column="0" rowspan="1" colspan="3" > |
722 | <class>QLabel</class> | 722 | <class>QLabel</class> |
723 | <property stdset="1"> | 723 | <property stdset="1"> |
724 | <name>name</name> | 724 | <name>name</name> |
725 | <cstring>TextLabel3_3</cstring> | 725 | <cstring>TextLabel3_3</cstring> |
726 | </property> | 726 | </property> |
727 | <property stdset="1"> | 727 | <property stdset="1"> |
728 | <name>text</name> | 728 | <name>text</name> |
729 | <string>a new NTP lookup will be used to predict the time.</string> | 729 | <string>a new NTP lookup will be used to predict the time.</string> |
730 | </property> | 730 | </property> |
731 | <property stdset="1"> | 731 | <property stdset="1"> |
732 | <name>alignment</name> | 732 | <name>alignment</name> |
733 | <set>WordBreak|AlignVCenter|AlignLeft</set> | 733 | <set>WordBreak|AlignVCenter|AlignLeft</set> |
734 | </property> | 734 | </property> |
735 | <property> | 735 | <property> |
736 | <name>wordwrap</name> | 736 | <name>wordwrap</name> |
737 | </property> | 737 | </property> |
738 | </widget> | 738 | </widget> |
739 | <widget row="0" column="1" > | 739 | <widget row="0" column="1" > |
740 | <class>QSpinBox</class> | 740 | <class>QSpinBox</class> |
741 | <property stdset="1"> | 741 | <property stdset="1"> |
742 | <name>name</name> | 742 | <name>name</name> |
743 | <cstring>SpinBoxMinLookupDelay</cstring> | 743 | <cstring>SpinBoxMinLookupDelay</cstring> |
744 | </property> | 744 | </property> |
745 | <property stdset="1"> | 745 | <property stdset="1"> |
746 | <name>wrapping</name> | 746 | <name>wrapping</name> |
747 | <bool>true</bool> | 747 | <bool>true</bool> |
748 | </property> | 748 | </property> |
749 | <property stdset="1"> | 749 | <property stdset="1"> |
750 | <name>maxValue</name> | 750 | <name>maxValue</name> |
751 | <number>9999999</number> | 751 | <number>9999999</number> |
752 | </property> | 752 | </property> |
753 | <property stdset="1"> | 753 | <property stdset="1"> |
754 | <name>minValue</name> | 754 | <name>minValue</name> |
755 | <number>42</number> | 755 | <number>42</number> |
756 | </property> | 756 | </property> |
757 | <property stdset="1"> | 757 | <property stdset="1"> |
758 | <name>value</name> | 758 | <name>value</name> |
759 | <number>720</number> | 759 | <number>720</number> |
760 | </property> | 760 | </property> |
761 | </widget> | 761 | </widget> |
762 | </grid> | 762 | </grid> |
763 | </widget> | 763 | </widget> |
764 | </vbox> | 764 | </vbox> |
765 | </widget> | 765 | </widget> |
766 | </grid> | 766 | </grid> |
767 | </widget> | 767 | </widget> |
768 | <widget> | 768 | <widget> |
769 | <class>QWidget</class> | 769 | <class>QWidget</class> |
770 | <property stdset="1"> | 770 | <property stdset="1"> |
771 | <name>name</name> | 771 | <name>name</name> |
772 | <cstring>tabManualSetTime</cstring> | 772 | <cstring>tabManualSetTime</cstring> |
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp index 949fcb3..36166ae 100644 --- a/noncore/settings/netsystemtime/settime.cpp +++ b/noncore/settings/netsystemtime/settime.cpp | |||
@@ -1,502 +1,534 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "settime.h" | 21 | #include "settime.h" |
22 | 22 | ||
23 | #include <qpe/alarmserver.h> | 23 | #include <qpe/alarmserver.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qpe/datebookdb.h> | 26 | #include <qpe/datebookdb.h> |
27 | #include <qpe/datebookmonth.h> | 27 | #include <qpe/datebookmonth.h> |
28 | #include <qpe/global.h> | 28 | #include <qpe/global.h> |
29 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
30 | #include <qpe/timeconversion.h> | 30 | #include <qpe/timeconversion.h> |
31 | #include <qpe/tzselect.h> | 31 | #include <qpe/tzselect.h> |
32 | #include <qpe/timestring.h> | 32 | #include <qpe/timestring.h> |
33 | #include <qpe/qpedialog.h> | 33 | #include <qpe/qpedialog.h> |
34 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 34 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
35 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <qtimer.h> | ||
38 | #include <qbuttongroup.h> | 39 | #include <qbuttongroup.h> |
39 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
40 | #include <qlabel.h> | 41 | #include <qlabel.h> |
41 | #include <qlayout.h> | 42 | #include <qlayout.h> |
42 | #include <qradiobutton.h> | 43 | #include <qradiobutton.h> |
43 | #include <qspinbox.h> | 44 | #include <qspinbox.h> |
44 | #include <qtoolbutton.h> | 45 | #include <qtoolbutton.h> |
45 | #include <qwindowsystem_qws.h> | 46 | #include <qwindowsystem_qws.h> |
46 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
47 | 48 | ||
48 | #include <sys/time.h> | 49 | #include <sys/time.h> |
49 | #include <time.h> | 50 | #include <time.h> |
50 | #include <stdlib.h> | 51 | #include <stdlib.h> |
51 | #include <stdio.h> | 52 | #include <stdio.h> |
52 | 53 | ||
53 | 54 | ||
54 | SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) | 55 | SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) |
55 | : NtpBase( parent, name, f ) | 56 | : NtpBase( parent, name, true, f ) |
56 | { | 57 | { |
57 | // setCaption( tr("Set System Time") ); | 58 | setCaption( tr("System Time") ); |
58 | 59 | ||
59 | // QVBoxLayout *vb = new QVBoxLayout( this, 5 ); | ||
60 | QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 ); | 60 | QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 ); |
61 | QVBoxLayout *vb2 = new QVBoxLayout( FrameSetTime, 5 ); | ||
62 | 61 | ||
63 | TextLabelMainPredTime = new QLabel( FrameSystemTime ); | 62 | // TextLabelMainPredTime = new QLabel( FrameSystemTime ); |
64 | vb->addWidget( TextLabelMainPredTime, 1, 0 ); | 63 | // vb->addWidget( TextLabelMainPredTime, 1, 0 ); |
65 | 64 | ||
66 | QHBoxLayout *hb = new QHBoxLayout( vb, -1, "timezone layout" ); | 65 | timeButton = new SetTime( FrameSystemTime ); |
66 | vb->addWidget( timeButton ); | ||
67 | |||
68 | QHBoxLayout *db = new QHBoxLayout( vb ); | ||
69 | QLabel *dateLabel = new QLabel( tr("Date"), FrameSystemTime ); | ||
70 | db->addWidget( dateLabel, 1 ); | ||
71 | dateButton = new DateButton( TRUE, FrameSystemTime ); | ||
72 | db->addWidget( dateButton, 2 ); | ||
67 | 73 | ||
74 | ButtonSetTime = new QPushButton( FrameSystemTime ); | ||
75 | vb->addWidget( ButtonSetTime, 1, 0 ); | ||
76 | |||
77 | QFrame *hline = new QFrame( FrameSystemTime ); | ||
78 | hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | ||
79 | vb->addWidget( hline ); | ||
80 | |||
81 | QHBoxLayout *hb = new QHBoxLayout( vb, -1, "timezone layout" ); | ||
82 | |||
68 | QLabel *lblZone = new QLabel( tr( "Time Zone" ), FrameSystemTime, "timezone label" ); | 83 | QLabel *lblZone = new QLabel( tr( "Time Zone" ), FrameSystemTime, "timezone label" ); |
69 | lblZone->setMaximumSize( lblZone->sizeHint() ); | 84 | lblZone->setMaximumSize( lblZone->sizeHint() ); |
70 | hb->addWidget( lblZone ); | 85 | hb->addWidget( lblZone ); |
71 | 86 | ||
72 | tz = new TimeZoneSelector( FrameSystemTime, "Timezone choices" ); | 87 | tz = new TimeZoneSelector( FrameSystemTime, "Timezone choices" ); |
73 | tz->setMinimumSize( tz->sizeHint() ); | 88 | tz->setMinimumSize( tz->sizeHint() ); |
74 | hb->addWidget( tz ); | 89 | hb->addWidget( tz ); |
75 | |||
76 | timeButton = new SetTime( FrameSetTime ); | ||
77 | vb2->addWidget( timeButton ); | ||
78 | |||
79 | QHBoxLayout *db = new QHBoxLayout( vb2 ); | ||
80 | QLabel *dateLabel = new QLabel( tr("Date"), FrameSetTime ); | ||
81 | db->addWidget( dateLabel, 1 ); | ||
82 | dateButton = new DateButton( TRUE, FrameSetTime ); | ||
83 | db->addWidget( dateButton, 2 ); | ||
84 | |||
85 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | ||
86 | vb2->addItem( spacer ); | ||
87 | 90 | ||
88 | QFrame *hline = new QFrame( FrameSystemTime ); | 91 | hline = new QFrame( FrameSystemTime ); |
89 | hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 92 | hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
90 | vb->addWidget( hline ); | 93 | vb->addWidget( hline ); |
94 | |||
95 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | ||
96 | vb->addItem( spacer ); | ||
91 | 97 | ||
92 | Config config("qpe"); | 98 | Config config("qpe"); |
93 | config.setGroup( "Time" ); | 99 | config.setGroup( "Time" ); |
94 | 100 | ||
95 | QHBoxLayout *hb1 = new QHBoxLayout( vb ); | 101 | QHBoxLayout *hb1 = new QHBoxLayout( vb ); |
96 | 102 | ||
97 | QLabel *l = new QLabel( tr("Time format"), FrameSystemTime ); | 103 | QLabel *l = new QLabel( tr("Time format"), FrameSystemTime ); |
98 | hb1->addWidget( l, 1 ); | 104 | hb1->addWidget( l, 1 ); |
99 | 105 | ||
100 | 106 | ||
101 | ampmCombo = new QComboBox( FrameSystemTime ); | 107 | ampmCombo = new QComboBox( FrameSystemTime ); |
102 | ampmCombo->insertItem( tr("24 hour"), 0 ); | 108 | ampmCombo->insertItem( tr("24 hour"), 0 ); |
103 | ampmCombo->insertItem( tr("12 hour"), 1 ); | 109 | ampmCombo->insertItem( tr("12 hour"), 1 ); |
104 | hb1->addWidget( ampmCombo, 2 ); | 110 | hb1->addWidget( ampmCombo, 2 ); |
105 | 111 | ||
106 | int show12hr = config.readBoolEntry("AMPM") ? 1 : 0; | 112 | int show12hr = config.readBoolEntry("AMPM") ? 1 : 0; |
107 | ampmCombo->setCurrentItem( show12hr ); | 113 | ampmCombo->setCurrentItem( show12hr ); |
108 | timeButton->show12hourTime( show12hr ); | 114 | timeButton->show12hourTime( show12hr ); |
109 | 115 | ||
110 | connect(ampmCombo, SIGNAL(activated(int)), | 116 | connect(ampmCombo, SIGNAL(activated(int)), |
111 | timeButton, SLOT(show12hourTime(int))); | 117 | timeButton, SLOT(show12hourTime(int))); |
112 | 118 | ||
113 | 119 | ||
114 | 120 | ||
115 | QHBoxLayout *hb2 = new QHBoxLayout( vb ); | 121 | QHBoxLayout *hb2 = new QHBoxLayout( vb ); |
116 | l = new QLabel( tr("Weeks start on" ), FrameSystemTime ); | 122 | l = new QLabel( tr("Weeks start on" ), FrameSystemTime ); |
117 | //l->setAlignment( AlignRight | AlignVCenter ); | 123 | //l->setAlignment( AlignRight | AlignVCenter ); |
118 | hb2->addWidget( l, 1 ); | 124 | hb2->addWidget( l, 1 ); |
119 | 125 | ||
120 | weekStartCombo = new QComboBox( FrameSystemTime ); | 126 | weekStartCombo = new QComboBox( FrameSystemTime ); |
121 | weekStartCombo->insertItem( tr("Sunday"), 0 ); | 127 | weekStartCombo->insertItem( tr("Sunday"), 0 ); |
122 | weekStartCombo->insertItem( tr("Monday"), 1 ); | 128 | weekStartCombo->insertItem( tr("Monday"), 1 ); |
123 | 129 | ||
124 | hb2->addWidget( weekStartCombo, 2 ); | 130 | hb2->addWidget( weekStartCombo, 2 ); |
125 | int startMonday = config.readBoolEntry("MONDAY") ? 1 : 0; | 131 | int startMonday = config.readBoolEntry("MONDAY") ? 1 : 0; |
126 | dateButton->setWeekStartsMonday( startMonday ); | 132 | dateButton->setWeekStartsMonday( startMonday ); |
127 | weekStartCombo->setCurrentItem( startMonday ); | 133 | weekStartCombo->setCurrentItem( startMonday ); |
128 | 134 | ||
129 | connect( weekStartCombo, SIGNAL( activated(int)), | 135 | connect( weekStartCombo, SIGNAL( activated(int)), |
130 | dateButton, SLOT(setWeekStartsMonday(int))); | 136 | dateButton, SLOT(setWeekStartsMonday(int))); |
131 | 137 | ||
132 | 138 | ||
133 | QHBoxLayout *hb3 = new QHBoxLayout( vb ); | 139 | QHBoxLayout *hb3 = new QHBoxLayout( vb ); |
134 | l = new QLabel( tr("Date format" ), FrameSystemTime ); | 140 | l = new QLabel( tr("Date format" ), FrameSystemTime ); |
135 | hb3->addWidget( l, 1 ); | 141 | hb3->addWidget( l, 1 ); |
136 | dateFormatCombo = new QComboBox( FrameSystemTime ); | 142 | dateFormatCombo = new QComboBox( FrameSystemTime ); |
137 | hb3->addWidget( dateFormatCombo, 2 ); | 143 | hb3->addWidget( dateFormatCombo, 2 ); |
138 | 144 | ||
139 | config.setGroup( "Date" ); | 145 | config.setGroup( "Date" ); |
140 | DateFormat df(QChar(config.readEntry("Separator", "/")[0]), | 146 | DateFormat df(QChar(config.readEntry("Separator", "/")[0]), |
141 | (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), | 147 | (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), |
142 | (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); | 148 | (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); |
143 | 149 | ||
144 | int currentdf = 0; | 150 | int currentdf = 0; |
145 | date_formats[0] = DateFormat('/', DateFormat::MonthDayYear); | 151 | date_formats[0] = DateFormat('/', DateFormat::MonthDayYear); |
146 | dateFormatCombo->insertItem( tr( date_formats[0].toNumberString()) ); | 152 | dateFormatCombo->insertItem( tr( date_formats[0].toNumberString()) ); |
147 | date_formats[1] = DateFormat('.', DateFormat::DayMonthYear); | 153 | date_formats[1] = DateFormat('.', DateFormat::DayMonthYear); |
148 | if (df == date_formats[1]) | 154 | if (df == date_formats[1]) |
149 | currentdf = 1; | 155 | currentdf = 1; |
150 | dateFormatCombo->insertItem( tr( date_formats[1].toNumberString() ) ); | 156 | dateFormatCombo->insertItem( tr( date_formats[1].toNumberString() ) ); |
151 | date_formats[2] = DateFormat('-', DateFormat::YearMonthDay, | 157 | date_formats[2] = DateFormat('-', DateFormat::YearMonthDay, |
152 | DateFormat::DayMonthYear); | 158 | DateFormat::DayMonthYear); |
153 | if (df == date_formats[2]) | 159 | if (df == date_formats[2]) |
154 | currentdf = 2; | 160 | currentdf = 2; |
155 | dateFormatCombo->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601 | 161 | dateFormatCombo->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601 |
156 | date_formats[3] = DateFormat('/', DateFormat::DayMonthYear); | 162 | date_formats[3] = DateFormat('/', DateFormat::DayMonthYear); |
157 | if (df == date_formats[3]) | 163 | if (df == date_formats[3]) |
158 | currentdf = 3; | 164 | currentdf = 3; |
159 | dateFormatCombo->insertItem( tr( date_formats[3].toNumberString() ) ); | 165 | dateFormatCombo->insertItem( tr( date_formats[3].toNumberString() ) ); |
160 | 166 | ||
161 | dateFormatCombo->setCurrentItem( currentdf ); | 167 | dateFormatCombo->setCurrentItem( currentdf ); |
162 | dateButton->setDateFormat( df ); | 168 | dateButton->setDateFormat( df ); |
163 | 169 | ||
164 | connect( dateFormatCombo, SIGNAL( activated(int)), | 170 | connect( dateFormatCombo, SIGNAL( activated(int)), |
165 | SLOT(formatChanged(int))); | 171 | SLOT(formatChanged(int))); |
166 | 172 | ||
167 | QHBoxLayout *hb4 = new QHBoxLayout( vb ); | 173 | QHBoxLayout *hb4 = new QHBoxLayout( vb ); |
168 | l = new QLabel( tr("Applet format" ), FrameSystemTime ); | 174 | l = new QLabel( tr("Applet format" ), FrameSystemTime ); |
169 | hb4->addWidget( l, 1 ); | 175 | hb4->addWidget( l, 1 ); |
170 | 176 | ||
171 | clockAppletCombo = new QComboBox( FrameSystemTime ); | 177 | clockAppletCombo = new QComboBox( FrameSystemTime ); |
172 | clockAppletCombo->insertItem( tr("hh:mm"), 0 ); | 178 | clockAppletCombo->insertItem( tr("hh:mm"), 0 ); |
173 | clockAppletCombo->insertItem( tr("D/M hh:mm"), 1 ); | 179 | clockAppletCombo->insertItem( tr("D/M hh:mm"), 1 ); |
174 | clockAppletCombo->insertItem( tr("M/D hh:mm"), 2 ); | 180 | clockAppletCombo->insertItem( tr("M/D hh:mm"), 2 ); |
175 | 181 | ||
176 | hb4->addWidget( clockAppletCombo, 2 ); | 182 | hb4->addWidget( clockAppletCombo, 2 ); |
177 | int clockApplet = config.readNumEntry("ClockApplet",0); | 183 | int clockApplet = config.readNumEntry("ClockApplet",0); |
178 | clockAppletCombo->setCurrentItem( clockApplet ); | 184 | clockAppletCombo->setCurrentItem( clockApplet ); |
179 | 185 | ||
180 | vb->addStretch( 0 ); | 186 | vb->addStretch( 0 ); |
181 | 187 | ||
182 | hline = new QFrame( FrameSystemTime ); | 188 | // hline = new QFrame( FrameSystemTime ); |
183 | hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 189 | // hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
184 | vb->addWidget( hline ); | 190 | // vb->addWidget( hline ); |
191 | // | ||
192 | // ButtonSetTime = new QPushButton( FrameSystemTime ); | ||
193 | // vb->addWidget( ButtonSetTime, 1, 0 ); | ||
185 | 194 | ||
186 | ButtonSetTime = new QPushButton( FrameSystemTime ); | ||
187 | vb->addWidget( ButtonSetTime, 1, 0 ); | ||
188 | |||
189 | QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()), | ||
190 | this, SLOT(commitTime())); | ||
191 | 195 | ||
192 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), | 196 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), |
193 | timeButton, SLOT( slotTzChange( const QString& ) ) ); | 197 | timeButton, SLOT( slotTzChange( const QString& ) ) ); |
194 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), | 198 | QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), |
195 | SLOT( tzChange( const QString& ) ) ); | 199 | SLOT( tzChange( const QString& ) ) ); |
196 | 200 | ||
197 | QObject::connect( weekStartCombo, SIGNAL( activated ( int )), | 201 | // QObject::connect( weekStartCombo, SIGNAL( activated ( int )), |
198 | SLOT(updateSystem(int ) )); | 202 | // SLOT(updateSystem(int ) )); |
199 | QObject::connect( ampmCombo, SIGNAL( activated ( int )), | 203 | // QObject::connect( ampmCombo, SIGNAL( activated ( int )), |
200 | SLOT(updateSystem(int ) )); | 204 | // SLOT(updateSystem(int ) )); |
201 | QObject::connect( dateFormatCombo, SIGNAL( activated ( int )), | 205 | // QObject::connect( dateFormatCombo, SIGNAL( activated ( int )), |
202 | SLOT(updateSystem(int ) )); | 206 | // SLOT(updateSystem(int ) )); |
203 | QObject::connect( clockAppletCombo, SIGNAL( activated ( int )), | 207 | // QObject::connect( clockAppletCombo, SIGNAL( activated ( int )), |
204 | SLOT(updateSystem(int ) )); | 208 | // SLOT(updateSystem(int ) )); |
205 | } | 209 | } |
206 | 210 | ||
207 | SetDateTime::~SetDateTime() | 211 | SetDateTime::~SetDateTime() |
208 | { | 212 | { |
209 | writeSettings(); | ||
210 | |||
211 | } | 213 | } |
212 | 214 | ||
213 | void SetDateTime::writeSettings() | 215 | void SetDateTime::writeSettings() |
214 | { | 216 | { |
215 | Config config("qpe"); | 217 | Config config("qpe"); |
216 | config.setGroup( "Time" ); | 218 | config.setGroup( "Time" ); |
217 | config.writeEntry( "AMPM", ampmCombo->currentItem() ); | 219 | config.writeEntry( "AMPM", ampmCombo->currentItem() ); |
218 | config.writeEntry( "MONDAY", weekStartCombo->currentItem() ); | 220 | config.writeEntry( "MONDAY", weekStartCombo->currentItem() ); |
219 | config.setGroup( "Date" ); | 221 | config.setGroup( "Date" ); |
220 | DateFormat df = date_formats[dateFormatCombo->currentItem()]; | 222 | DateFormat df = date_formats[dateFormatCombo->currentItem()]; |
221 | config.writeEntry( "Separator", QString(df.separator())); | 223 | config.writeEntry( "Separator", QString(df.separator())); |
222 | config.writeEntry( "ShortOrder", df.shortOrder()); | 224 | config.writeEntry( "ShortOrder", df.shortOrder()); |
223 | config.writeEntry( "LongOrder", df.longOrder()); | 225 | config.writeEntry( "LongOrder", df.longOrder()); |
224 | config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() ); | 226 | config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() ); |
225 | 227 | ||
226 | Config lconfig("locale"); | 228 | Config lconfig("locale"); |
227 | lconfig.setGroup( "Location" ); | 229 | lconfig.setGroup( "Location" ); |
228 | lconfig.writeEntry( "Timezone", tz->currentZone() ); | 230 | lconfig.writeEntry( "Timezone", tz->currentZone() ); |
229 | 231 | ||
230 | } | 232 | } |
231 | 233 | ||
232 | void SetDateTime::commitTime() | 234 | void SetDateTime::commitTime() |
233 | { | 235 | { |
234 | Config cfg("ntp",Config::User); | 236 | Config cfg("ntp",Config::User); |
235 | cfg.setGroup("lookups"); | 237 | cfg.setGroup("lookups"); |
236 | cfg.writeEntry("lastNtp",false); | 238 | cfg.writeEntry("lastNtp",false); |
237 | tz->setFocus(); | 239 | tz->setFocus(); |
238 | // Need to process the QCOP event generated above before proceeding | 240 | // Need to process the QCOP event generated above before proceeding |
239 | qApp->processEvents(); | 241 | qApp->processEvents(); |
240 | 242 | ||
241 | // before we progress further, set our TZ! | 243 | // before we progress further, set our TZ! |
242 | setenv( "TZ", tz->currentZone(), 1 ); | 244 | setenv( "TZ", tz->currentZone(), 1 ); |
243 | // now set the time... | 245 | // now set the time... |
244 | QDateTime dt( dateButton->date(), timeButton->time() ); | 246 | QDateTime dt( dateButton->date(), timeButton->time() ); |
245 | 247 | ||
246 | if ( dt.isValid() ) setTime(dt); | 248 | if ( dt.isValid() ) setTime(dt); |
247 | } | 249 | } |
248 | 250 | ||
249 | void SetDateTime::setTime(QDateTime dt) | 251 | void SetDateTime::setTime(QDateTime dt) |
250 | { | 252 | { |
251 | // really turn off the screensaver before doing anything | 253 | // really turn off the screensaver before doing anything |
252 | { | 254 | { |
253 | // Needs to be encased in { } so that it deconstructs and sends | 255 | // Needs to be encased in { } so that it deconstructs and sends |
254 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 256 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
255 | disableScreenSaver << 0 << 0 << 0; | 257 | disableScreenSaver << 0 << 0 << 0; |
256 | } | 258 | } |
257 | Config cfg("ntp",Config::User); | 259 | Config cfg("ntp",Config::User); |
258 | cfg.setGroup("correction"); | 260 | cfg.setGroup("correction"); |
259 | int t = TimeConversion::toUTC(dt); | 261 | int t = TimeConversion::toUTC(dt); |
260 | struct timeval myTv; | 262 | struct timeval myTv; |
261 | myTv.tv_sec = t; | 263 | myTv.tv_sec = t; |
262 | cfg.writeEntry("time", t ); | 264 | cfg.writeEntry("time", t ); |
263 | myTv.tv_usec = 0; | 265 | myTv.tv_usec = 0; |
264 | 266 | ||
265 | if ( myTv.tv_sec != -1 ) | 267 | if ( myTv.tv_sec != -1 ) |
266 | ::settimeofday( &myTv, 0 ); | 268 | ::settimeofday( &myTv, 0 ); |
267 | Global::writeHWClock(); | 269 | Global::writeHWClock(); |
268 | // since time has changed quickly load in the datebookdb | 270 | // since time has changed quickly load in the datebookdb |
269 | // to allow the alarm server to get a better grip on itself | 271 | // to allow the alarm server to get a better grip on itself |
270 | // (example re-trigger alarms for when we travel back in time) | 272 | // (example re-trigger alarms for when we travel back in time) |
271 | DateBookDB db; | 273 | DateBookDB db; |
272 | //QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" ); | 274 | //QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" ); |
273 | //timeApplet << ""; | 275 | //timeApplet << ""; |
274 | // Restore screensaver | 276 | // Restore screensaver |
275 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 277 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
276 | enableScreenSaver << -1 << -1 << -1; | 278 | enableScreenSaver << -1 << -1 << -1; |
277 | } | 279 | } |
278 | 280 | ||
279 | void SetDateTime::updateSystem(int i) | 281 | void SetDateTime::updateSystem() |
280 | { | 282 | { |
281 | // really turn off the screensaver before doing anything | 283 | // really turn off the screensaver before doing anything |
282 | { | 284 | { |
283 | // Needs to be encased in { } so that it deconstructs and sends | 285 | // Needs to be encased in { } so that it deconstructs and sends |
284 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 286 | QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
285 | disableScreenSaver << 0 << 0 << 0; | 287 | disableScreenSaver << 0 << 0 << 0; |
286 | } | 288 | } |
287 | qDebug("SetDateTime::updateSystem(int %i)",i); | 289 | qDebug("SetDateTime::updateSystem()"); |
288 | writeSettings(); | 290 | writeSettings(); |
289 | 291 | ||
290 | // set the timezone for everyone else... | 292 | // set the timezone for everyone else... |
291 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); | 293 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); |
292 | setTimeZone << tz->currentZone(); | 294 | setTimeZone << tz->currentZone(); |
293 | 295 | ||
294 | // AM/PM setting and notify time changed | 296 | // AM/PM setting and notify time changed |
295 | QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); | 297 | QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); |
296 | setClock << ampmCombo->currentItem(); | 298 | setClock << ampmCombo->currentItem(); |
297 | 299 | ||
298 | // Notify everyone what day we prefer to start the week on. | 300 | // Notify everyone what day we prefer to start the week on. |
299 | QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" ); | 301 | QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" ); |
300 | setWeek << weekStartCombo->currentItem(); | 302 | setWeek << weekStartCombo->currentItem(); |
301 | 303 | ||
302 | // Notify everyone what date format to use | 304 | // Notify everyone what date format to use |
303 | QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" ); | 305 | QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" ); |
304 | setDateFormat << date_formats[dateFormatCombo->currentItem()]; | 306 | setDateFormat << date_formats[dateFormatCombo->currentItem()]; |
305 | 307 | ||
306 | // Restore screensaver | 308 | // Restore screensaver |
307 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); | 309 | QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); |
308 | enableScreenSaver << -1 << -1 << -1; | 310 | enableScreenSaver << -1 << -1 << -1; |
309 | // since time has changed quickly load in the datebookdb | 311 | // since time has changed quickly load in the datebookdb |
310 | // to allow the alarm server to get a better grip on itself | 312 | // to allow the alarm server to get a better grip on itself |
311 | // (example re-trigger alarms for when we travel back in time) | 313 | // (example re-trigger alarms for when we travel back in time) |
312 | DateBookDB db; | 314 | DateBookDB db; |
313 | 315 | ||
314 | } | 316 | } |
315 | 317 | ||
316 | void SetDateTime::tzChange( const QString &tz ) | 318 | void SetDateTime::tzChange( const QString &tz ) |
317 | { | 319 | { |
318 | // set the TZ get the time and leave gracefully... | 320 | // set the TZ get the time and leave gracefully... |
319 | QString strSave; | 321 | QString strSave; |
320 | strSave = getenv( "TZ" ); | 322 | strSave = getenv( "TZ" ); |
321 | setenv( "TZ", tz, 1 ); | 323 | setenv( "TZ", tz, 1 ); |
322 | 324 | ||
323 | QDate d = QDate::currentDate(); | 325 | QDate d = QDate::currentDate(); |
324 | // reset the time. | 326 | // reset the time. |
325 | if ( !strSave.isNull() ) { | 327 | if ( !strSave.isNull() ) { |
326 | setenv( "TZ", strSave, 1 ); | 328 | setenv( "TZ", strSave, 1 ); |
327 | } | 329 | } |
328 | dateButton->setDate( d ); | 330 | dateButton->setDate( d ); |
329 | updateSystem(); | 331 | updateSystem(); |
330 | } | 332 | } |
331 | 333 | ||
332 | void SetDateTime::formatChanged(int i) | 334 | void SetDateTime::formatChanged(int i) |
333 | { | 335 | { |
334 | dateButton->setDateFormat(date_formats[i]); | 336 | dateButton->setDateFormat(date_formats[i]); |
335 | } | 337 | } |
336 | 338 | ||
337 | static const int ValueAM = 0; | 339 | static const int ValueAM = 0; |
338 | static const int ValuePM = 1; | 340 | static const int ValuePM = 1; |
339 | 341 | ||
340 | 342 | ||
341 | 343 | ||
342 | SetTime::SetTime( QWidget *parent, const char *name ) | 344 | SetTime::SetTime( QWidget *parent, const char *name ) |
343 | : QWidget( parent, name ) | 345 | : QWidget( parent, name ) |
344 | { | 346 | { |
347 | clock = new QTimer(this, "clock" ); | ||
348 | connect(clock, SIGNAL( timeout() ), SLOT(slotClockTick()) ); | ||
349 | clock->start( 1000 * 60 ); | ||
350 | |||
345 | use12hourTime = FALSE; | 351 | use12hourTime = FALSE; |
346 | 352 | ||
347 | QTime currTime = QTime::currentTime(); | 353 | _time = QDateTime::currentDateTime(); |
348 | hour = currTime.hour(); | 354 | hour = _time.time().hour(); |
349 | minute = currTime.minute(); | 355 | minute = _time.time().minute(); |
350 | 356 | ||
351 | QHBoxLayout *hb2 = new QHBoxLayout( this ); | 357 | QHBoxLayout *hb2 = new QHBoxLayout( this ); |
352 | hb2->setSpacing( 3 ); | 358 | hb2->setSpacing( 3 ); |
353 | 359 | ||
354 | QLabel *l = new QLabel( tr("Hour"), this ); | 360 | QLabel *l = new QLabel( tr("Hour"), this ); |
355 | // l->setAlignment( AlignRight | AlignVCenter ); | 361 | // l->setAlignment( AlignRight | AlignVCenter ); |
356 | hb2->addWidget( l ); | 362 | hb2->addWidget( l ); |
357 | 363 | ||
358 | sbHour = new QSpinBox( this ); | 364 | sbHour = new QSpinBox( this ); |
359 | sbHour->setMinimumWidth( 30 ); | 365 | sbHour->setMinimumWidth( 30 ); |
360 | if(use12hourTime) { | 366 | if(use12hourTime) { |
361 | sbHour->setMinValue(1); | 367 | sbHour->setMinValue(1); |
362 | sbHour->setMaxValue( 12 ); | 368 | sbHour->setMaxValue( 12 ); |
363 | int show_hour = hour; | 369 | int show_hour = hour; |
364 | if (hour > 12) | 370 | if (hour > 12) |
365 | show_hour -= 12; | 371 | show_hour -= 12; |
366 | if (show_hour == 0) | 372 | if (show_hour == 0) |
367 | show_hour = 12; | 373 | show_hour = 12; |
368 | 374 | ||
369 | sbHour->setValue( show_hour ); | 375 | sbHour->setValue( show_hour ); |
370 | } else { | 376 | } else { |
371 | sbHour->setMinValue( 0 ); | 377 | sbHour->setMinValue( 0 ); |
372 | sbHour->setMaxValue( 23 ); | 378 | sbHour->setMaxValue( 23 ); |
373 | sbHour->setValue( hour ); | 379 | sbHour->setValue( hour ); |
374 | } | 380 | } |
375 | sbHour->setWrapping(TRUE); | 381 | sbHour->setWrapping(TRUE); |
376 | connect( sbHour, SIGNAL(valueChanged(int)), this, SLOT(hourChanged(int)) ); | 382 | connect( sbHour, SIGNAL(valueChanged(int)), this, SLOT(hourChanged(int)) ); |
377 | hb2->addWidget( sbHour ); | 383 | hb2->addWidget( sbHour ); |
378 | 384 | ||
379 | hb2->addStretch( 1 ); | 385 | hb2->addStretch( 1 ); |
380 | 386 | ||
381 | l = new QLabel( tr("Minute"), this ); | 387 | l = new QLabel( tr("Minute"), this ); |
382 | //l->setAlignment( AlignRight | AlignVCenter ); | 388 | //l->setAlignment( AlignRight | AlignVCenter ); |
383 | hb2->addWidget( l ); | 389 | hb2->addWidget( l ); |
384 | 390 | ||
385 | sbMin = new QSpinBox( this ); | 391 | sbMin = new QSpinBox( this ); |
386 | sbMin->setMinValue( 0 ); | 392 | sbMin->setMinValue( 0 ); |
387 | sbMin->setMaxValue( 59 ); | 393 | sbMin->setMaxValue( 59 ); |
388 | sbMin->setWrapping(TRUE); | 394 | sbMin->setWrapping(TRUE); |
389 | sbMin->setValue( minute ); | 395 | sbMin->setValue( minute ); |
390 | sbMin->setMinimumWidth( 30 ); | 396 | sbMin->setMinimumWidth( 30 ); |
391 | connect( sbMin, SIGNAL(valueChanged(int)), this, SLOT(minuteChanged(int)) ); | 397 | connect( sbMin, SIGNAL(valueChanged(int)), this, SLOT(minuteChanged(int)) ); |
392 | hb2->addWidget( sbMin ); | 398 | hb2->addWidget( sbMin ); |
393 | 399 | ||
394 | hb2->addStretch( 1 ); | 400 | hb2->addStretch( 1 ); |
395 | 401 | ||
396 | ampm = new QComboBox( this ); | 402 | ampm = new QComboBox( this ); |
397 | ampm->insertItem( tr("AM"), ValueAM ); | 403 | ampm->insertItem( tr("AM"), ValueAM ); |
398 | ampm->insertItem( tr("PM"), ValuePM ); | 404 | ampm->insertItem( tr("PM"), ValuePM ); |
399 | connect( ampm, SIGNAL(activated(int)), this, SLOT(checkedPM(int)) ); | 405 | connect( ampm, SIGNAL(activated(int)), this, SLOT(checkedPM(int)) ); |
400 | hb2->addWidget( ampm ); | 406 | hb2->addWidget( ampm ); |
401 | 407 | ||
402 | hb2->addStretch( 1 ); | 408 | hb2->addStretch( 1 ); |
403 | 409 | ||
404 | } | 410 | } |
405 | 411 | ||
406 | QTime SetTime::time() const | 412 | QTime SetTime::time() const |
407 | { | 413 | { |
408 | return QTime( hour, minute, 0 ); | 414 | return QTime( hour, minute, 0 ); |
409 | } | 415 | } |
410 | 416 | ||
411 | void SetTime::hourChanged( int value ) | 417 | void SetTime::hourChanged( int value ) |
412 | { | 418 | { |
413 | if(use12hourTime) { | 419 | if(use12hourTime) { |
414 | int realhour = value; | 420 | int realhour = value; |
415 | if (realhour == 12) | 421 | if (realhour == 12) |
416 | realhour = 0; | 422 | realhour = 0; |
417 | if (ampm->currentItem() == ValuePM ) | 423 | if (ampm->currentItem() == ValuePM ) |
418 | realhour += 12; | 424 | realhour += 12; |
419 | hour = realhour; | 425 | hour = realhour; |
420 | } else | 426 | } else |
421 | hour = value; | 427 | hour = value; |
422 | } | 428 | } |
423 | 429 | ||
424 | void SetTime::minuteChanged( int value ) | 430 | void SetTime::minuteChanged( int value ) |
425 | { | 431 | { |
426 | minute = value; | 432 | minute = value; |
427 | } | 433 | } |
428 | 434 | ||
429 | void SetTime::show12hourTime( int on ) | 435 | void SetTime::show12hourTime( int on ) |
430 | { | 436 | { |
431 | use12hourTime = on; | 437 | use12hourTime = on; |
432 | ampm->setEnabled(on); | 438 | ampm->setEnabled(on); |
433 | 439 | ||
434 | int show_hour = hour; | 440 | int show_hour = hour; |
435 | if ( on ) { | 441 | if ( on ) { |
436 | /* this might change the value of hour */ | 442 | /* this might change the value of hour */ |
437 | sbHour->setMinValue(1); | 443 | sbHour->setMinValue(1); |
438 | sbHour->setMaxValue( 12 ); | 444 | sbHour->setMaxValue( 12 ); |
439 | 445 | ||
440 | /* so use one we saved earlier */ | 446 | /* so use one we saved earlier */ |
441 | if (show_hour >= 12) { | 447 | if (show_hour >= 12) { |
442 | show_hour -= 12; | 448 | show_hour -= 12; |
443 | ampm->setCurrentItem( ValuePM ); | 449 | ampm->setCurrentItem( ValuePM ); |
444 | } else { | 450 | } else { |
445 | ampm->setCurrentItem( ValueAM ); | 451 | ampm->setCurrentItem( ValueAM ); |
446 | } | 452 | } |
447 | if (show_hour == 0) | 453 | if (show_hour == 0) |
448 | show_hour = 12; | 454 | show_hour = 12; |
449 | 455 | ||
450 | } else { | 456 | } else { |
451 | sbHour->setMinValue( 0 ); | 457 | sbHour->setMinValue( 0 ); |
452 | sbHour->setMaxValue( 23 ); | 458 | sbHour->setMaxValue( 23 ); |
453 | } | 459 | } |
454 | 460 | ||
455 | 461 | ||
456 | sbHour->setValue( show_hour ); | 462 | sbHour->setValue( show_hour ); |
457 | } | 463 | } |
458 | 464 | ||
459 | void SetTime::checkedPM( int c ) | 465 | void SetTime::checkedPM( int c ) |
460 | { | 466 | { |
461 | int show_hour = sbHour->value(); | 467 | int show_hour = sbHour->value(); |
462 | if (show_hour == 12) | 468 | if (show_hour == 12) |
463 | show_hour = 0; | 469 | show_hour = 0; |
464 | 470 | ||
465 | if ( c == ValuePM ) | 471 | if ( c == ValuePM ) |
466 | show_hour += 12; | 472 | show_hour += 12; |
467 | 473 | ||
468 | hour = show_hour; | 474 | hour = show_hour; |
469 | } | 475 | } |
470 | 476 | ||
471 | void SetTime::slotTzChange( const QString &tz ) | 477 | void SetTime::slotTzChange( const QString &tz ) |
472 | { | 478 | { |
473 | // set the TZ get the time and leave gracefully... | 479 | // set the TZ get the time and leave gracefully... |
474 | QString strSave; | 480 | QString strSave; |
475 | strSave = getenv( "TZ" ); | 481 | strSave = getenv( "TZ" ); |
476 | setenv( "TZ", tz, 1 ); | 482 | setenv( "TZ", tz, 1 ); |
477 | 483 | ||
478 | QTime t = QTime::currentTime(); | 484 | QTime t = QTime::currentTime(); |
479 | // reset the time. | 485 | // reset the time. |
480 | if ( !strSave.isNull() ) { | 486 | if ( !strSave.isNull() ) { |
481 | setenv( "TZ", strSave, 1 ); | 487 | setenv( "TZ", strSave, 1 ); |
482 | } | 488 | } |
483 | 489 | ||
484 | // just set the spinboxes and let it propage through | 490 | // just set the spinboxes and let it propage through |
485 | if(use12hourTime) { | 491 | if(use12hourTime) { |
486 | int show_hour = t.hour(); | 492 | int show_hour = t.hour(); |
487 | if (t.hour() >= 12) { | 493 | if (t.hour() >= 12) { |
488 | show_hour -= 12; | 494 | show_hour -= 12; |
489 | ampm->setCurrentItem( ValuePM ); | 495 | ampm->setCurrentItem( ValuePM ); |
490 | } else { | 496 | } else { |
491 | ampm->setCurrentItem( ValueAM ); | 497 | ampm->setCurrentItem( ValueAM ); |
492 | } | 498 | } |
493 | if (show_hour == 0) | 499 | if (show_hour == 0) |
494 | show_hour = 12; | 500 | show_hour = 12; |
495 | sbHour->setValue( show_hour ); | 501 | sbHour->setValue( show_hour ); |
496 | } else { | 502 | } else { |
497 | sbHour->setValue( t.hour() ); | 503 | sbHour->setValue( t.hour() ); |
498 | } | 504 | } |
499 | sbMin->setValue( t.minute() ); | 505 | sbMin->setValue( t.minute() ); |
500 | } | 506 | } |
501 | 507 | ||
508 | void SetTime::setTime( QDateTime dt ) | ||
509 | { | ||
510 | _time = dt; | ||
511 | QTime t = dt.time(); | ||
512 | // just set the spinboxes and let it propage through | ||
513 | if(use12hourTime) { | ||
514 | int show_hour = t.hour(); | ||
515 | if (t.hour() >= 12) { | ||
516 | show_hour -= 12; | ||
517 | ampm->setCurrentItem( ValuePM ); | ||
518 | } else { | ||
519 | ampm->setCurrentItem( ValueAM ); | ||
520 | } | ||
521 | if (show_hour == 0) | ||
522 | show_hour = 12; | ||
523 | sbHour->setValue( show_hour ); | ||
524 | } else { | ||
525 | sbHour->setValue( t.hour() ); | ||
526 | } | ||
527 | sbMin->setValue( t.minute() ); | ||
528 | } | ||
502 | 529 | ||
530 | void SetTime::slotClockTick() | ||
531 | { | ||
532 | setTime( _time.addSecs(60) ); | ||
533 | qDebug("SetTime::slotClockTick %s",_time.toString().latin1()); | ||
534 | } | ||
diff --git a/noncore/settings/netsystemtime/settime.h b/noncore/settings/netsystemtime/settime.h index 778cb9c..3c3a162 100644 --- a/noncore/settings/netsystemtime/settime.h +++ b/noncore/settings/netsystemtime/settime.h | |||
@@ -1,98 +1,102 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef SYSTEM_TIME_H | 20 | #ifndef SYSTEM_TIME_H |
21 | #define SYSTEM_TIME_H | 21 | #define SYSTEM_TIME_H |
22 | 22 | ||
23 | 23 | ||
24 | #include <qdatetime.h> | 24 | #include <qdatetime.h> |
25 | #include <qdialog.h> | 25 | #include <qdialog.h> |
26 | 26 | ||
27 | #include <qpe/timestring.h> | 27 | #include <qpe/timestring.h> |
28 | #include "ntpbase.h" | 28 | #include "ntpbase.h" |
29 | 29 | ||
30 | class QToolButton; | 30 | class QToolButton; |
31 | class QSpinBox; | 31 | class QSpinBox; |
32 | class QLabel; | 32 | class QLabel; |
33 | class TimeZoneSelector; | 33 | class TimeZoneSelector; |
34 | class DateBookMonth; | 34 | class DateBookMonth; |
35 | class QComboBox; | 35 | class QComboBox; |
36 | 36 | ||
37 | class SetTime : public QWidget | 37 | class SetTime : public QWidget |
38 | { | 38 | { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | public: | 40 | public: |
41 | SetTime( QWidget *parent=0, const char *name=0 ); | 41 | SetTime( QWidget *parent=0, const char *name=0 ); |
42 | 42 | ||
43 | QTime time() const; | 43 | QTime time() const; |
44 | void setTime( QDateTime ); | ||
44 | 45 | ||
45 | public slots: | 46 | public slots: |
46 | void slotTzChange( const QString& tz ); | 47 | void slotTzChange( const QString& tz ); |
47 | void show12hourTime( int ); | 48 | void show12hourTime( int ); |
48 | 49 | ||
49 | protected slots: | 50 | protected slots: |
51 | void slotClockTick(); | ||
50 | void hourChanged( int value ); | 52 | void hourChanged( int value ); |
51 | void minuteChanged( int value ); | 53 | void minuteChanged( int value ); |
52 | 54 | ||
53 | void checkedPM( int ); | 55 | void checkedPM( int ); |
54 | 56 | ||
55 | protected: | 57 | protected: |
56 | int hour; | 58 | int hour; |
57 | int minute; | 59 | int minute; |
58 | bool use12hourTime; | 60 | bool use12hourTime; |
61 | QDateTime _time; | ||
62 | QTimer *clock; | ||
59 | QComboBox *ampm; | 63 | QComboBox *ampm; |
60 | QSpinBox *sbHour; | 64 | QSpinBox *sbHour; |
61 | QSpinBox *sbMin; | 65 | QSpinBox *sbMin; |
62 | }; | 66 | }; |
63 | 67 | ||
64 | class DateButton; | 68 | class DateButton; |
65 | 69 | ||
66 | class SetDateTime : public NtpBase | 70 | class SetDateTime : public NtpBase |
67 | { | 71 | { |
68 | Q_OBJECT | 72 | Q_OBJECT |
69 | public: | 73 | public: |
70 | SetDateTime( QWidget *parent=0, const char *name=0, WFlags f=0 ); | 74 | SetDateTime( QWidget *parent=0, const char *name=0, WFlags f=0 ); |
71 | ~SetDateTime(); | 75 | ~SetDateTime(); |
72 | 76 | ||
73 | protected slots: | 77 | protected slots: |
74 | void commitTime(); | 78 | void commitTime(); |
75 | void tzChange( const QString &tz ); | 79 | void tzChange( const QString &tz ); |
76 | void formatChanged(int); | 80 | void formatChanged(int); |
77 | void updateSystem(int i=0); | 81 | void updateSystem(); |
78 | 82 | ||
79 | protected: | 83 | protected: |
80 | void setTime(QDateTime dt); | 84 | void setTime(QDateTime dt); |
81 | void writeSettings(); | 85 | void writeSettings(); |
82 | 86 | ||
83 | SetTime *timeButton; | 87 | SetTime *timeButton; |
84 | DateButton *dateButton; | 88 | DateButton *dateButton; |
85 | TimeZoneSelector *tz; | 89 | TimeZoneSelector *tz; |
86 | QComboBox *weekStartCombo; | 90 | QComboBox *weekStartCombo; |
87 | QComboBox *ampmCombo; | 91 | QComboBox *ampmCombo; |
88 | QComboBox *dateFormatCombo; | 92 | QComboBox *dateFormatCombo; |
89 | QComboBox *clockAppletCombo; | 93 | QComboBox *clockAppletCombo; |
90 | QPushButton *ButtonSetTime; | 94 | QPushButton *ButtonSetTime; |
91 | QLabel *TextLabelMainPredTime; | 95 | // QLabel *TextLabelMainPredTime; |
92 | 96 | ||
93 | DateFormat date_formats[4]; | 97 | DateFormat date_formats[4]; |
94 | }; | 98 | }; |
95 | 99 | ||
96 | 100 | ||
97 | #endif | 101 | #endif |
98 | 102 | ||