Diffstat (limited to 'noncore/settings/netsystemtime/ntpbase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.cpp | 328 |
1 files changed, 328 insertions, 0 deletions
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 | */ | ||
28 | NtpBase::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 | */ | ||
306 | NtpBase::~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 | */ | ||
315 | bool 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 | |||