summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/netsystemtime.pro6
-rw-r--r--noncore/settings/netsystemtime/ntpbase.cpp328
-rw-r--r--noncore/settings/netsystemtime/ntpbase.h93
-rw-r--r--noncore/settings/netsystemtime/settime.cpp8
4 files changed, 428 insertions, 7 deletions
diff --git a/noncore/settings/netsystemtime/netsystemtime.pro b/noncore/settings/netsystemtime/netsystemtime.pro
index 026b8da..0530ea5 100644
--- a/noncore/settings/netsystemtime/netsystemtime.pro
+++ b/noncore/settings/netsystemtime/netsystemtime.pro
@@ -1,12 +1,12 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on debug 2 CONFIG = qt warn_on debug
3 #CONFIG = qt warn_on release 3 #CONFIG = qt warn_on release
4 HEADERS = ntp.h settime.h 4 HEADERS = ntp.h settime.h ntpbase.h
5 SOURCES = main.cpp ntp.cpp settime.cpp 5 SOURCES = main.cpp ntp.cpp settime.cpp ntpbase.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include 6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include 7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe -lopie 8LIBS += -lqpe -lopie
9 INTERFACES= ntpbase.ui 9 INTERFACES=
10DESTDIR = $(OPIEDIR)/bin 10DESTDIR = $(OPIEDIR)/bin
11 TARGET = netsystemtime 11 TARGET = netsystemtime
12 12
diff --git a/noncore/settings/netsystemtime/ntpbase.cpp b/noncore/settings/netsystemtime/ntpbase.cpp
new file mode 100644
index 0000000..7762e93
--- a/dev/null
+++ b/noncore/settings/netsystemtime/ntpbase.cpp
@@ -0,0 +1,328 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'ntpbase.ui'
3**
4** Created: Mon Oct 21 21:06:08 2002
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "ntpbase.h"
10
11#include <qcombobox.h>
12#include <qframe.h>
13#include <qlabel.h>
14#include <qmultilineedit.h>
15#include <qpushbutton.h>
16#include <qspinbox.h>
17#include <qtable.h>
18#include <qtabwidget.h>
19#include <qlayout.h>
20#include <qvariant.h>
21#include <qtooltip.h>
22#include <qwhatsthis.h>
23
24/*
25 * Constructs a NtpBase which is a child of 'parent', with the
26 * name 'name' and widget flags set to 'f'
27 */
28NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
29 : QWidget( parent, name, fl )
30{
31 if ( !name )
32 setName( "NtpBase" );
33 resize( 320, 411 );
34 setCaption( tr( "Network Time" ) );
35 NtpBaseLayout = new QGridLayout( this );
36 NtpBaseLayout->setSpacing( 2 );
37 NtpBaseLayout->setMargin( 2 );
38
39 TabWidgetMain = new QTabWidget( this, "TabWidgetMain" );
40
41 tabMain = new QWidget( TabWidgetMain, "tabMain" );
42 tabMainLayout = new QGridLayout( tabMain );
43 tabMainLayout->setSpacing( 2 );
44 tabMainLayout->setMargin( 2 );
45
46 FrameSystemTime = new QFrame( tabMain, "FrameSystemTime" );
47 FrameSystemTime->setFrameShape( QFrame::StyledPanel );
48 FrameSystemTime->setFrameShadow( QFrame::Raised );
49
50 tabMainLayout->addWidget( FrameSystemTime, 0, 0 );
51
52 tabNtp = new QWidget( TabWidgetMain, "tabNtp" );
53 tabNtpLayout = new QGridLayout( tabNtp );
54 tabNtpLayout->setSpacing( 2 );
55 tabNtpLayout->setMargin( 1 );
56
57 runNtp = new QPushButton( tabNtp, "runNtp" );
58 runNtp->setText( tr( "Get time from network" ) );
59
60 tabNtpLayout->addWidget( runNtp, 1, 0 );
61
62 FrameNtp = new QFrame( tabNtp, "FrameNtp" );
63 FrameNtp->setFrameShape( QFrame::StyledPanel );
64 FrameNtp->setFrameShadow( QFrame::Raised );
65 FrameNtpLayout = new QGridLayout( FrameNtp );
66 FrameNtpLayout->setSpacing( 2 );
67 FrameNtpLayout->setMargin( 2 );
68
69 Layout4 = new QVBoxLayout;
70 Layout4->setSpacing( 6 );
71 Layout4->setMargin( 0 );
72
73 TextLabel1 = new QLabel( FrameNtp, "TextLabel1" );
74 TextLabel1->setAutoMask( FALSE );
75 TextLabel1->setText( tr( "Start Time:" ) );
76 Layout4->addWidget( TextLabel1 );
77
78 TextLabelStartTime = new QLabel( FrameNtp, "TextLabelStartTime" );
79 TextLabelStartTime->setText( tr( "nan" ) );
80 Layout4->addWidget( TextLabelStartTime );
81
82 TextLabel3 = new QLabel( FrameNtp, "TextLabel3" );
83 TextLabel3->setText( tr( "Time Shift:" ) );
84 Layout4->addWidget( TextLabel3 );
85
86 TextLabelTimeShift = new QLabel( FrameNtp, "TextLabelTimeShift" );
87 TextLabelTimeShift->setText( tr( "nan" ) );
88 Layout4->addWidget( TextLabelTimeShift );
89
90 TextLabel5 = new QLabel( FrameNtp, "TextLabel5" );
91 TextLabel5->setText( tr( "New Time:" ) );
92 Layout4->addWidget( TextLabel5 );
93
94 TextLabelNewTime = new QLabel( FrameNtp, "TextLabelNewTime" );
95 TextLabelNewTime->setText( tr( "nan" ) );
96 Layout4->addWidget( TextLabelNewTime );
97 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
98 Layout4->addItem( spacer );
99
100 FrameNtpLayout->addLayout( Layout4, 0, 0 );
101
102 MultiLineEditntpOutPut = new QMultiLineEdit( FrameNtp, "MultiLineEditntpOutPut" );
103 QFont MultiLineEditntpOutPut_font( MultiLineEditntpOutPut->font() );
104 MultiLineEditntpOutPut_font.setPointSize( 7 );
105 MultiLineEditntpOutPut->setFont( MultiLineEditntpOutPut_font );
106 MultiLineEditntpOutPut->setWordWrap( QMultiLineEdit::WidgetWidth );
107 MultiLineEditntpOutPut->setText( tr( "" ) );
108
109 FrameNtpLayout->addWidget( MultiLineEditntpOutPut, 1, 0 );
110
111 tabNtpLayout->addWidget( FrameNtp, 0, 0 );
112
113 tabPredict = new QWidget( TabWidgetMain, "tabPredict" );
114 tabPredictLayout = new QGridLayout( tabPredict );
115 tabPredictLayout->setSpacing( 6 );
116 tabPredictLayout->setMargin( 5 );
117
118 TableLookups = new QTable( tabPredict, "TableLookups" );
119 QFont TableLookups_font( TableLookups->font() );
120 TableLookups_font.setPointSize( 8 );
121 TableLookups->setFont( TableLookups_font );
122 TableLookups->setNumRows( 2 );
123 TableLookups->setNumCols( 2 );
124
125 tabPredictLayout->addWidget( TableLookups, 0, 0 );
126
127 Layout9 = new QGridLayout;
128 Layout9->setSpacing( 6 );
129 Layout9->setMargin( 0 );
130
131 TextLabelShift = new QLabel( tabPredict, "TextLabelShift" );
132 TextLabelShift->setText( tr( "nan" ) );
133
134 Layout9->addWidget( TextLabelShift, 0, 1 );
135
136 TextLabel4 = new QLabel( tabPredict, "TextLabel4" );
137 TextLabel4->setText( tr( "Esimated Shift:" ) );
138
139 Layout9->addWidget( TextLabel4, 1, 0 );
140
141 TextLabelEstimatedShift = new QLabel( tabPredict, "TextLabelEstimatedShift" );
142 TextLabelEstimatedShift->setText( tr( "nan" ) );
143
144 Layout9->addWidget( TextLabelEstimatedShift, 1, 1 );
145
146 TextLabel3_2 = new QLabel( tabPredict, "TextLabel3_2" );
147 TextLabel3_2->setText( tr( "Predicted Time:" ) );
148
149 Layout9->addWidget( TextLabel3_2, 2, 0 );
150
151 Mean_shift_label = new QLabel( tabPredict, "Mean_shift_label" );
152 Mean_shift_label->setText( tr( "Mean shift:" ) );
153
154 Layout9->addWidget( Mean_shift_label, 0, 0 );
155
156 TextLabelPredTime = new QLabel( tabPredict, "TextLabelPredTime" );
157 TextLabelPredTime->setText( tr( "nan" ) );
158
159 Layout9->addWidget( TextLabelPredTime, 2, 1 );
160
161 tabPredictLayout->addLayout( Layout9, 1, 0 );
162
163 Layout11 = new QHBoxLayout;
164 Layout11->setSpacing( 6 );
165 Layout11->setMargin( 0 );
166
167 PushButtonSetPredTime = new QPushButton( tabPredict, "PushButtonSetPredTime" );
168 PushButtonSetPredTime->setText( tr( "Set predicted time" ) );
169 Layout11->addWidget( PushButtonSetPredTime );
170
171 PushButtonPredict = new QPushButton( tabPredict, "PushButtonPredict" );
172 PushButtonPredict->setText( tr( "Predict time" ) );
173 Layout11->addWidget( PushButtonPredict );
174
175 tabPredictLayout->addLayout( Layout11, 2, 0 );
176
177 TabSettings = new QWidget( TabWidgetMain, "TabSettings" );
178 TabSettingsLayout = new QGridLayout( TabSettings );
179 TabSettingsLayout->setSpacing( 2 );
180 TabSettingsLayout->setMargin( 2 );
181
182 FrameSettings = new QFrame( TabSettings, "FrameSettings" );
183 FrameSettings->setFrameShape( QFrame::StyledPanel );
184 FrameSettings->setFrameShadow( QFrame::Raised );
185 FrameSettingsLayout = new QGridLayout( FrameSettings );
186 FrameSettingsLayout->setSpacing( 11 );
187 FrameSettingsLayout->setMargin( 3 );
188
189 Layout6 = new QGridLayout;
190 Layout6->setSpacing( 6 );
191 Layout6->setMargin( 0 );
192
193 TextLabel7_2 = new QLabel( FrameSettings, "TextLabel7_2" );
194 TextLabel7_2->setText( tr( "Use" ) );
195
196 Layout6->addWidget( TextLabel7_2, 0, 0 );
197
198 TextLabel2_2 = new QLabel( FrameSettings, "TextLabel2_2" );
199 TextLabel2_2->setText( tr( "as" ) );
200
201 Layout6->addWidget( TextLabel2_2, 0, 2 );
202
203 TextLabel1_3 = new QLabel( FrameSettings, "TextLabel1_3" );
204 TextLabel1_3->setText( tr( "NTP server to get the time from the network." ) );
205 TextLabel1_3->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) );
206
207 Layout6->addMultiCellWidget( TextLabel1_3, 1, 1, 0, 1 );
208
209 ComboNtpSrv = new QComboBox( FALSE, FrameSettings, "ComboNtpSrv" );
210 ComboNtpSrv->setEditable( TRUE );
211
212 Layout6->addWidget( ComboNtpSrv, 0, 1 );
213
214 FrameSettingsLayout->addLayout( Layout6, 0, 0 );
215 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
216 FrameSettingsLayout->addItem( spacer_2, 3, 0 );
217
218 Layout7 = new QGridLayout;
219 Layout7->setSpacing( 6 );
220 Layout7->setMargin( 0 );
221
222 TextLabel1_2 = new QLabel( FrameSettings, "TextLabel1_2" );
223 TextLabel1_2->setText( tr( "Insure a delay of" ) );
224
225 Layout7->addWidget( TextLabel1_2, 0, 0 );
226
227 TextLabel2 = new QLabel( FrameSettings, "TextLabel2" );
228 TextLabel2->setText( tr( "minutes until" ) );
229
230 Layout7->addWidget( TextLabel2, 0, 2 );
231
232 TextLabel3_3 = new QLabel( FrameSettings, "TextLabel3_3" );
233 TextLabel3_3->setText( tr( "a new NTP lookup will be used to predict the time." ) );
234 TextLabel3_3->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) );
235
236 Layout7->addMultiCellWidget( TextLabel3_3, 1, 1, 0, 2 );
237
238 SpinBoxMinLookupDelay = new QSpinBox( FrameSettings, "SpinBoxMinLookupDelay" );
239 SpinBoxMinLookupDelay->setMaxValue( 9999999 );
240 SpinBoxMinLookupDelay->setMinValue( 42 );
241
242 Layout7->addWidget( SpinBoxMinLookupDelay, 0, 1 );
243
244 FrameSettingsLayout->addLayout( Layout7, 2, 0 );
245
246 Layout7_2 = new QGridLayout;
247 Layout7_2->setSpacing( 6 );
248 Layout7_2->setMargin( 0 );
249
250 TextLabel1_2_2 = new QLabel( FrameSettings, "TextLabel1_2_2" );
251 TextLabel1_2_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, TextLabel1_2_2->sizePolicy().hasHeightForWidth() ) );
252 TextLabel1_2_2->setText( tr( "Wait for " ) );
253
254 Layout7_2->addWidget( TextLabel1_2_2, 0, 0 );
255
256 TextLabel2_3 = new QLabel( FrameSettings, "TextLabel2_3" );
257 TextLabel2_3->setText( tr( "minutes until" ) );
258
259 Layout7_2->addWidget( TextLabel2_3, 0, 2 );
260
261 TextLabel3_3_2 = new QLabel( FrameSettings, "TextLabel3_3_2" );
262 TextLabel3_3_2->setText( tr( "NTP tries to syncronises the clock with the network." ) );
263 TextLabel3_3_2->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) );
264
265 Layout7_2->addMultiCellWidget( TextLabel3_3_2, 1, 1, 0, 2 );
266
267 SpinBoxNtpDelay = new QSpinBox( FrameSettings, "SpinBoxNtpDelay" );
268 SpinBoxNtpDelay->setMaxValue( 9999999 );
269 SpinBoxNtpDelay->setMinValue( 0 );
270
271 Layout7_2->addWidget( SpinBoxNtpDelay, 0, 1 );
272
273 FrameSettingsLayout->addLayout( Layout7_2, 1, 0 );
274
275 TabSettingsLayout->addWidget( FrameSettings, 0, 0 );
276
277 tabManualSetTime = new QWidget( TabWidgetMain, "tabManualSetTime" );
278 tabManualSetTimeLayout = new QVBoxLayout( tabManualSetTime );
279 tabManualSetTimeLayout->setSpacing( 2 );
280 tabManualSetTimeLayout->setMargin( 2 );
281
282 FrameSetTime = new QFrame( tabManualSetTime, "FrameSetTime" );
283 FrameSetTime->setFrameShape( QFrame::StyledPanel );
284 FrameSetTime->setFrameShadow( QFrame::Raised );
285 tabManualSetTimeLayout->addWidget( FrameSetTime );
286
287 PushButtonSetManualTime = new QPushButton( tabManualSetTime, "PushButtonSetManualTime" );
288 PushButtonSetManualTime->setText( tr( "Set time" ) );
289 tabManualSetTimeLayout->addWidget( PushButtonSetManualTime );
290
291 TabWidgetMain->insertTab( tabMain, tr( "Main" ) );
292
293 TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) );
294
295 TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) );
296
297 TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) );
298 TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) );
299
300 NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 );
301}
302
303/*
304 * Destroys the object and frees any allocated resources
305 */
306NtpBase::~NtpBase()
307{
308 // no need to delete child widgets, Qt does it all for us
309}
310
311/*
312 * Main event handler. Reimplemented to handle application
313 * font changes
314 */
315bool NtpBase::event( QEvent* ev )
316{
317 bool ret = QWidget::event( ev );
318 if ( ev->type() == QEvent::ApplicationFontChange ) {
319 QFont MultiLineEditntpOutPut_font( MultiLineEditntpOutPut->font() );
320 MultiLineEditntpOutPut_font.setPointSize( 7 );
321 MultiLineEditntpOutPut->setFont( MultiLineEditntpOutPut_font );
322 QFont TableLookups_font( TableLookups->font() );
323 TableLookups_font.setPointSize( 8 );
324 TableLookups->setFont( TableLookups_font );
325 }
326 return ret;
327}
328
diff --git a/noncore/settings/netsystemtime/ntpbase.h b/noncore/settings/netsystemtime/ntpbase.h
new file mode 100644
index 0000000..b337822
--- a/dev/null
+++ b/noncore/settings/netsystemtime/ntpbase.h
@@ -0,0 +1,93 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'ntpbase.ui'
3**
4** Created: Mon Oct 21 21:05:47 2002
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef NTPBASE_H
10#define NTPBASE_H
11
12#include <qvariant.h>
13#include <qwidget.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class QComboBox;
18class QFrame;
19class QLabel;
20class QMultiLineEdit;
21class QPushButton;
22class QSpinBox;
23class QTabWidget;
24class QTable;
25
26class NtpBase : public QWidget
27{
28 Q_OBJECT
29
30public:
31 NtpBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
32 ~NtpBase();
33
34 QTabWidget* TabWidgetMain;
35 QWidget* tabMain;
36 QFrame* FrameSystemTime;
37 QWidget* tabNtp;
38 QPushButton* runNtp;
39 QFrame* FrameNtp;
40 QLabel* TextLabel1;
41 QLabel* TextLabelStartTime;
42 QLabel* TextLabel3;
43 QLabel* TextLabelTimeShift;
44 QLabel* TextLabel5;
45 QLabel* TextLabelNewTime;
46 QMultiLineEdit* MultiLineEditntpOutPut;
47 QWidget* tabPredict;
48 QTable* TableLookups;
49 QLabel* TextLabelShift;
50 QLabel* TextLabel4;
51 QLabel* TextLabelEstimatedShift;
52 QLabel* TextLabel3_2;
53 QLabel* Mean_shift_label;
54 QLabel* TextLabelPredTime;
55 QPushButton* PushButtonSetPredTime;
56 QPushButton* PushButtonPredict;
57 QWidget* TabSettings;
58 QFrame* FrameSettings;
59 QLabel* TextLabel7_2;
60 QLabel* TextLabel2_2;
61 QLabel* TextLabel1_3;
62 QComboBox* ComboNtpSrv;
63 QLabel* TextLabel1_2;
64 QLabel* TextLabel2;
65 QLabel* TextLabel3_3;
66 QSpinBox* SpinBoxMinLookupDelay;
67 QLabel* TextLabel1_2_2;
68 QLabel* TextLabel2_3;
69 QLabel* TextLabel3_3_2;
70 QSpinBox* SpinBoxNtpDelay;
71 QWidget* tabManualSetTime;
72 QFrame* FrameSetTime;
73 QPushButton* PushButtonSetManualTime;
74
75protected:
76 QGridLayout* NtpBaseLayout;
77 QGridLayout* tabMainLayout;
78 QGridLayout* tabNtpLayout;
79 QGridLayout* FrameNtpLayout;
80 QVBoxLayout* Layout4;
81 QGridLayout* tabPredictLayout;
82 QGridLayout* Layout9;
83 QHBoxLayout* Layout11;
84 QGridLayout* TabSettingsLayout;
85 QGridLayout* FrameSettingsLayout;
86 QGridLayout* Layout6;
87 QGridLayout* Layout7;
88 QGridLayout* Layout7_2;
89 QVBoxLayout* tabManualSetTimeLayout;
90 bool event( QEvent* );
91};
92
93#endif // NTPBASE_H
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index f6e02d5..949fcb3 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -60,8 +60,8 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f )
60 QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 ); 60 QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 );
61 QVBoxLayout *vb2 = new QVBoxLayout( FrameSetTime, 5 ); 61 QVBoxLayout *vb2 = new QVBoxLayout( FrameSetTime, 5 );
62 62
63# TextLabelMainPredTime = new QLabel( FrameSystemTime ); 63 TextLabelMainPredTime = new QLabel( FrameSystemTime );
64# vb->addWidget( TextLabelMainPredTime, 1, 0 ); 64 vb->addWidget( TextLabelMainPredTime, 1, 0 );
65 65
66 QHBoxLayout *hb = new QHBoxLayout( vb, -1, "timezone layout" ); 66 QHBoxLayout *hb = new QHBoxLayout( vb, -1, "timezone layout" );
67 67
@@ -85,7 +85,7 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f )
85 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 85 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
86 vb2->addItem( spacer ); 86 vb2->addItem( spacer );
87 87
88 hline = new QFrame( FrameSystemTime ); 88 QFrame *hline = new QFrame( FrameSystemTime );
89 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 89 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
90 vb->addWidget( hline ); 90 vb->addWidget( hline );
91 91
@@ -179,7 +179,7 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f )
179 179
180 vb->addStretch( 0 ); 180 vb->addStretch( 0 );
181 181
182 QFrame *hline = new QFrame( FrameSystemTime ); 182 hline = new QFrame( FrameSystemTime );
183 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 183 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
184 vb->addWidget( hline ); 184 vb->addWidget( hline );
185 185