From 1f4ab9228e9e7db275e42a3e7fcf9affdd5c447b Mon Sep 17 00:00:00 2001 From: tille Date: Mon, 21 Oct 2002 20:32:05 +0000 Subject: now it has adv features and ntpbase.ui is back since it might be usefull --- diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index fbd65a2..6f6316c 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -39,10 +42,16 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) Config cfg("ntp",Config::User); cfg.setGroup("settings"); - SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",41) ); - SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",42) ); + SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",720) ); + SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",1440) ); ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); + bool advMode = cfg.readBoolEntry("advancedFeatures", false ); + showAdvancedFeatures(advMode); + CheckBoxAdvSettings->setChecked( advMode ); + connect( CheckBoxAdvSettings, SIGNAL( toggled( bool ) ), + SLOT( showAdvancedFeatures( bool ) ) ); + makeChannel(); ntpTimer = new QTimer(this); @@ -142,7 +151,7 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) void Ntp::ntpFinished(OProcess *p) { - qDebug("p->exitStatus() %i",p->exitStatus()); + // qDebug("p->exitStatus() %i",p->exitStatus()); if (p->exitStatus()!=0 || !p->normalExit()) { slotProbeNtpServer(); @@ -277,7 +286,7 @@ void Ntp::slotCheckNtp(int i) } }else{ preditctTime(); - ButtonSetTime->setText( tr("Set predicted time") ); + ButtonSetTime->setText( tr("Set predicted time: ")+predictedTime.toString() ); if (i>0)ntpOutPut(tr("Could not connect to server ")+getNtpServer()); connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) ); connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) ); @@ -286,7 +295,6 @@ void Ntp::slotCheckNtp(int i) void Ntp::slotProbeNtpServer() { - qDebug("Ntp::slotProbeNtpServer()"); ntpSock->connectToHost( getNtpServer() ,123); } @@ -330,3 +338,30 @@ void Ntp::setDocument(const QString &fileName) { } + +void Ntp::showAdvancedFeatures(bool advMode) +{ + if (advMode) { + TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); + TabWidgetMain->addTab( tabNtp, tr( "NTP" ) ); + TextLabel1_2_2->show(); + TextLabel2_3->show(); + TextLabel3_3_2->show(); + TextLabel1_2->show(); + SpinBoxMinLookupDelay->show(); + TextLabel2->show(); + TextLabel3_3->show(); + SpinBoxNtpDelay->show(); + }else{ + TabWidgetMain->removePage( tabPredict ); + TabWidgetMain->removePage( tabNtp ); + TextLabel1_2_2->hide(); + TextLabel2_3->hide(); + TextLabel3_3_2->hide(); + TextLabel1_2->hide(); + SpinBoxMinLookupDelay->hide(); + TextLabel2->hide(); + TextLabel3_3->hide(); + SpinBoxNtpDelay->hide(); + }; +} diff --git a/noncore/settings/netsystemtime/ntp.h b/noncore/settings/netsystemtime/ntp.h index 56e0131..fe0bae6 100644 --- a/noncore/settings/netsystemtime/ntp.h +++ b/noncore/settings/netsystemtime/ntp.h @@ -11,10 +11,10 @@ class QCopChannel; class Ntp : public SetDateTime { - Q_OBJECT + Q_OBJECT public: - Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~Ntp(); public slots: @@ -45,6 +45,7 @@ private slots: void preditctTime(); void slotCheckNtp(int); void setPredictTime(); + void showAdvancedFeatures(bool); void slotProbeNtpServer(); void slotNtpDelayChanged(int); }; diff --git a/noncore/settings/netsystemtime/ntpbase.cpp b/noncore/settings/netsystemtime/ntpbase.cpp index 7762e93..c10c6ae 100644 --- a/noncore/settings/netsystemtime/ntpbase.cpp +++ b/noncore/settings/netsystemtime/ntpbase.cpp @@ -1,13 +1,14 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'ntpbase.ui' ** -** Created: Mon Oct 21 21:06:08 2002 +** Created: Mon Oct 21 21:32:47 2002 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "ntpbase.h" +#include #include #include #include @@ -182,9 +183,9 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) FrameSettings = new QFrame( TabSettings, "FrameSettings" ); FrameSettings->setFrameShape( QFrame::StyledPanel ); FrameSettings->setFrameShadow( QFrame::Raised ); - FrameSettingsLayout = new QGridLayout( FrameSettings ); - FrameSettingsLayout->setSpacing( 11 ); - FrameSettingsLayout->setMargin( 3 ); + FrameSettingsLayout = new QVBoxLayout( FrameSettings ); + FrameSettingsLayout->setSpacing( 6 ); + FrameSettingsLayout->setMargin( 11 ); Layout6 = new QGridLayout; Layout6->setSpacing( 6 ); @@ -210,38 +211,19 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) ComboNtpSrv->setEditable( TRUE ); Layout6->addWidget( ComboNtpSrv, 0, 1 ); + FrameSettingsLayout->addLayout( Layout6 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); + FrameSettingsLayout->addItem( spacer_2 ); - FrameSettingsLayout->addLayout( Layout6, 0, 0 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - FrameSettingsLayout->addItem( spacer_2, 3, 0 ); + CheckBoxAdvSettings = new QCheckBox( FrameSettings, "CheckBoxAdvSettings" ); + CheckBoxAdvSettings->setText( tr( "Advanced features" ) ); + FrameSettingsLayout->addWidget( CheckBoxAdvSettings ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + FrameSettingsLayout->addItem( spacer_3 ); - Layout7 = new QGridLayout; - Layout7->setSpacing( 6 ); - Layout7->setMargin( 0 ); - - TextLabel1_2 = new QLabel( FrameSettings, "TextLabel1_2" ); - TextLabel1_2->setText( tr( "Insure a delay of" ) ); - - Layout7->addWidget( TextLabel1_2, 0, 0 ); - - TextLabel2 = new QLabel( FrameSettings, "TextLabel2" ); - TextLabel2->setText( tr( "minutes until" ) ); - - Layout7->addWidget( TextLabel2, 0, 2 ); - - TextLabel3_3 = new QLabel( FrameSettings, "TextLabel3_3" ); - TextLabel3_3->setText( tr( "a new NTP lookup will be used to predict the time." ) ); - TextLabel3_3->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); - - Layout7->addMultiCellWidget( TextLabel3_3, 1, 1, 0, 2 ); - - SpinBoxMinLookupDelay = new QSpinBox( FrameSettings, "SpinBoxMinLookupDelay" ); - SpinBoxMinLookupDelay->setMaxValue( 9999999 ); - SpinBoxMinLookupDelay->setMinValue( 42 ); - - Layout7->addWidget( SpinBoxMinLookupDelay, 0, 1 ); - - FrameSettingsLayout->addLayout( Layout7, 2, 0 ); + Line1 = new QFrame( FrameSettings, "Line1" ); + Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + FrameSettingsLayout->addWidget( Line1 ); Layout7_2 = new QGridLayout; Layout7_2->setSpacing( 6 ); @@ -265,12 +247,42 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) Layout7_2->addMultiCellWidget( TextLabel3_3_2, 1, 1, 0, 2 ); SpinBoxNtpDelay = new QSpinBox( FrameSettings, "SpinBoxNtpDelay" ); + SpinBoxNtpDelay->setWrapping( TRUE ); SpinBoxNtpDelay->setMaxValue( 9999999 ); - SpinBoxNtpDelay->setMinValue( 0 ); + SpinBoxNtpDelay->setMinValue( 1 ); + SpinBoxNtpDelay->setValue( 1440 ); Layout7_2->addWidget( SpinBoxNtpDelay, 0, 1 ); + FrameSettingsLayout->addLayout( Layout7_2 ); - FrameSettingsLayout->addLayout( Layout7_2, 1, 0 ); + Layout7 = new QGridLayout; + Layout7->setSpacing( 6 ); + Layout7->setMargin( 0 ); + + TextLabel1_2 = new QLabel( FrameSettings, "TextLabel1_2" ); + TextLabel1_2->setText( tr( "Insure a delay of" ) ); + + Layout7->addWidget( TextLabel1_2, 0, 0 ); + + TextLabel2 = new QLabel( FrameSettings, "TextLabel2" ); + TextLabel2->setText( tr( "minutes until" ) ); + + Layout7->addWidget( TextLabel2, 0, 2 ); + + TextLabel3_3 = new QLabel( FrameSettings, "TextLabel3_3" ); + TextLabel3_3->setText( tr( "a new NTP lookup will be used to predict the time." ) ); + TextLabel3_3->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); + + Layout7->addMultiCellWidget( TextLabel3_3, 1, 1, 0, 2 ); + + SpinBoxMinLookupDelay = new QSpinBox( FrameSettings, "SpinBoxMinLookupDelay" ); + SpinBoxMinLookupDelay->setWrapping( TRUE ); + SpinBoxMinLookupDelay->setMaxValue( 9999999 ); + SpinBoxMinLookupDelay->setMinValue( 42 ); + SpinBoxMinLookupDelay->setValue( 720 ); + + Layout7->addWidget( SpinBoxMinLookupDelay, 0, 1 ); + FrameSettingsLayout->addLayout( Layout7 ); TabSettingsLayout->addWidget( FrameSettings, 0, 0 ); @@ -288,14 +300,12 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) PushButtonSetManualTime->setText( tr( "Set time" ) ); tabManualSetTimeLayout->addWidget( PushButtonSetManualTime ); - TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); + TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); - TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); - - TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); + TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); } diff --git a/noncore/settings/netsystemtime/ntpbase.h b/noncore/settings/netsystemtime/ntpbase.h index b337822..a669601 100644 --- a/noncore/settings/netsystemtime/ntpbase.h +++ b/noncore/settings/netsystemtime/ntpbase.h @@ -1,7 +1,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'ntpbase.ui' ** -** Created: Mon Oct 21 21:05:47 2002 +** Created: Mon Oct 21 21:32:43 2002 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! @@ -14,6 +14,7 @@ class QVBoxLayout; class QHBoxLayout; class QGridLayout; +class QCheckBox; class QComboBox; class QFrame; class QLabel; @@ -60,14 +61,16 @@ public: QLabel* TextLabel2_2; QLabel* TextLabel1_3; QComboBox* ComboNtpSrv; - QLabel* TextLabel1_2; - QLabel* TextLabel2; - QLabel* TextLabel3_3; - QSpinBox* SpinBoxMinLookupDelay; + QCheckBox* CheckBoxAdvSettings; + QFrame* Line1; QLabel* TextLabel1_2_2; QLabel* TextLabel2_3; QLabel* TextLabel3_3_2; QSpinBox* SpinBoxNtpDelay; + QLabel* TextLabel1_2; + QLabel* TextLabel2; + QLabel* TextLabel3_3; + QSpinBox* SpinBoxMinLookupDelay; QWidget* tabManualSetTime; QFrame* FrameSetTime; QPushButton* PushButtonSetManualTime; @@ -82,10 +85,10 @@ protected: QGridLayout* Layout9; QHBoxLayout* Layout11; QGridLayout* TabSettingsLayout; - QGridLayout* FrameSettingsLayout; + QVBoxLayout* FrameSettingsLayout; QGridLayout* Layout6; - QGridLayout* Layout7; QGridLayout* Layout7_2; + QGridLayout* Layout7; QVBoxLayout* tabManualSetTimeLayout; bool event( QEvent* ); }; diff --git a/noncore/settings/netsystemtime/ntpbase.ui b/noncore/settings/netsystemtime/ntpbase.ui index be2c8d3..62f736b 100644 --- a/noncore/settings/netsystemtime/ntpbase.ui +++ b/noncore/settings/netsystemtime/ntpbase.ui @@ -1,469 +1,436 @@ - + NtpBase - - + + QWidget + + name NtpBase - + + geometry 0 0 - 324 + 320 411 - - Set Time + + caption + Network Time - + + layoutMargin - + + layoutSpacing - - unnamed - - + + margin 2 - + + spacing 2 - - + + QTabWidget + + name TabWidgetMain - + + layoutMargin - + + layoutSpacing - - + + QWidget + + name tabMain - + + title Main - - unnamed - - + + margin 2 - + + spacing 2 - - + + QFrame + + name FrameSystemTime - + + frameShape StyledPanel - + + frameShadow Raised - - - tabSetTime + + QWidget + + name + tabNtp - - Manual + + title + NTP - - - unnamed - - - 2 + + + margin + 1 - + + spacing 2 - - - FrameSetTime - - - StyledPanel - - - Raised - - - - - PushButtonSetManualTime + + QPushButton + + name + runNtp - - Set time + + text + Get time from network - - - - - TabSettings - - - Settings - - - - unnamed - - - 2 - - - 2 - - - - FrameSettings + + QFrame + + name + FrameNtp - + + frameShape StyledPanel - + + frameShadow Raised - + + layoutMargin - + + layoutSpacing - - unnamed - - - 3 + + margin + 2 - - 11 + + spacing + 2 - - - Layout6 + + QLayoutWidget + + name + Layout4 - - - unnamed - - + + + margin 0 - + + spacing 6 - - - TextLabel7_2 - - - Use + + QLabel + + name + TextLabel1 - - - - TextLabel2_2 + + autoMask + false - - as + + text + Start Time: - - - TextLabel1_3 - - - NTP server to get the time from the network. - - - WordBreak|AlignVCenter|AlignLeft + + QLabel + + name + TextLabelStartTime - + + text + nan - - - ComboNtpSrv + + QLabel + + name + TextLabel3 - - true + + text + Time Shift: - - - - - Spacer2 - - - Vertical - - - Expanding - - - - 0 - 20 - - - - - - Layout7 - - - - unnamed - - - 0 - - - 6 - - - - TextLabel1_2 + + QLabel + + name + TextLabelTimeShift - - Insure a delay of + + text + nan - - - TextLabel2 + + QLabel + + name + TextLabel5 - - minutes until + + text + New Time: - - - TextLabel3_3 - - - a new NTP lookup will be used to predict the time. - - - WordBreak|AlignVCenter|AlignLeft + + QLabel + + name + TextLabelNewTime - + + text + nan - - - SpinBoxMinLookupDelay + + + name + Spacer1 - - 9999999 + + orientation + Vertical - - 42 + + sizeType + Expanding - - + + sizeHint + + 20 + 20 + + + + - - - Layout7_2 + + QMultiLineEdit + + name + MultiLineEditntpOutPut + + + font + + 7 + + + + wordWrap + WidgetWidth + + + text + - - - unnamed - - - 0 - - - 6 - - - - TextLabel1_2_2 - - - - 1 - 1 - 0 - 0 - - - - Wait for - - - - - TextLabel2_3 - - - minutes until - - - - - TextLabel3_3_2 - - - NTP tries to syncronises the clock with the network. - - - WordBreak|AlignVCenter|AlignLeft - - - - - - - SpinBoxNtpDelay - - - 9999999 - - - 0 - - - - - - tab + + QWidget + + name + tabPredict - + + title Predict - - unnamed - - + + margin 5 - + + spacing 6 - - + + QTable + + name TableLookups - + + font 8 - + + numRows 2 - + + numCols 2 - - + + QLayoutWidget + + name Layout9 - - unnamed - - + + margin 0 - + + spacing 6 - - + + QLabel + + name TextLabelShift - + + text nan - - + + QLabel + + name TextLabel4 - + + text Esimated Shift: - - + + QLabel + + name TextLabelEstimatedShift - + + text nan - - + + QLabel + + name TextLabel3_2 - + + text Predicted Time: - - + + QLabel + + name Mean_shift_label - + + text Mean shift: - - + + QLabel + + name TextLabelPredTime - + + text nan - - + + QLayoutWidget + + name Layout11 - - unnamed - - + + margin 0 - + + spacing 6 - - + + QPushButton + + name PushButtonSetPredTime - + + text Set predicted time - - + + QPushButton + + name PushButtonPredict - + + text Predict time @@ -471,161 +438,405 @@ - - - tabNtp + + QWidget + + name + TabSettings - - NTP + + title + Settings - - unnamed - - - 1 + + margin + 2 - + + spacing 2 - - - runNtp - - - Get time from network - - - - - FrameNtp + + QFrame + + name + FrameSettings - + + frameShape StyledPanel - + + frameShadow Raised - + + layoutMargin - + + layoutSpacing - - - unnamed - - - 2 + + + margin + 11 - - 2 + + spacing + 6 - - - Layout4 + + QLayoutWidget + + name + Layout6 - - - unnamed - - + + + margin 0 - + + spacing 6 - - - TextLabel1 + + QLabel + + name + TextLabel7_2 - - false + + text + Use - - Start Time: + + + QLabel + + name + TextLabel2_2 + + + text + as - - - TextLabelStartTime + + QLabel + + name + TextLabel1_3 - - nan + + text + NTP server to get the time from the network. + + + alignment + WordBreak|AlignVCenter|AlignLeft + + + wordwrap - - - TextLabel3 + + QComboBox + + name + ComboNtpSrv - - Time Shift: + + editable + true - - - TextLabelTimeShift + + + + + name + Spacer3 + + + orientation + Vertical + + + sizeType + Minimum + + + sizeHint + + 20 + 20 + + + + + QCheckBox + + name + CheckBoxAdvSettings + + + text + Advanced settings + + + + + name + Spacer4 + + + orientation + Vertical + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + Line + + name + Line1 + + + orientation + Horizontal + + + + QLayoutWidget + + name + Layout7_2 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel1_2_2 - - nan + + sizePolicy + + 1 + 1 + + + + text + Wait for - - - TextLabel5 + + QLabel + + name + TextLabel2_3 - - New Time: + + text + minutes until - - - TextLabelNewTime + + QLabel + + name + TextLabel3_3_2 - - nan + + text + NTP tries to syncronises the clock with the network. + + + alignment + WordBreak|AlignVCenter|AlignLeft + + + wordwrap - - - Spacer1 + + QSpinBox + + name + SpinBoxNtpDelay - - Vertical + + wrapping + true - - Expanding + + maxValue + 9999999 - - - 0 - 20 - + + minValue + 1 - - + + value + 1440 + + + - - - MultiLineEditntpOutPut - - - - 7 - - - - - - - WidgetWidth + + QLayoutWidget + + name + Layout7 + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel1_2 + + + text + Insure a delay of + + + + QLabel + + name + TextLabel2 + + + text + minutes until + + + + QLabel + + name + TextLabel3_3 + + + text + a new NTP lookup will be used to predict the time. + + + alignment + WordBreak|AlignVCenter|AlignLeft + + + wordwrap + + + + QSpinBox + + name + SpinBoxMinLookupDelay + + + wrapping + true + + + maxValue + 9999999 + + + minValue + 42 + + + value + 720 + + + - + + + QWidget + + name + tabManualSetTime + + + title + Manual + + + + margin + 2 + + + spacing + 2 + + + QFrame + + name + FrameSetTime + + + frameShape + StyledPanel + + + frameShadow + Raised + + + + QPushButton + + name + PushButtonSetManualTime + + + text + Set time + + + + - -- cgit v0.9.0.2