-rw-r--r-- | noncore/settings/netsystemtime/netsystemtime.pro | 6 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 38 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntp.h | 52 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.cpp | 33 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.h | 4 | ||||
-rw-r--r-- | noncore/settings/netsystemtime/ntpbase.ui | 62 |
6 files changed, 106 insertions, 89 deletions
diff --git a/noncore/settings/netsystemtime/netsystemtime.pro b/noncore/settings/netsystemtime/netsystemtime.pro index 898e400..a849431 100644 --- a/noncore/settings/netsystemtime/netsystemtime.pro +++ b/noncore/settings/netsystemtime/netsystemtime.pro @@ -3,4 +3,4 @@ CONFIG = qt warn_on debug #CONFIG = qt warn_on release -HEADERS = ntp.h settime.h ntpbase.h -SOURCES = main.cpp ntp.cpp settime.cpp ntpbase.cpp +HEADERS = ntp.h settime.h +SOURCES = main.cpp ntp.cpp settime.cpp INCLUDEPATH += $(OPIEDIR)/include @@ -8,3 +8,3 @@ DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -INTERFACES = +INTERFACES = ntpbase.ui DESTDIR = $(OPIEDIR)/bin diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 40805a0..111f7d4 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp @@ -48,2 +48,19 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) + //make tab order + + TabWidgetMain->removePage( tabMain ); + TabWidgetMain->removePage( tabManualSetTime ); + TabWidgetMain->removePage( TabSettings ); + TabWidgetMain->removePage( tabPredict ); + TabWidgetMain->removePage( tabNtp ); + + TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); + TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); + TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); + TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); + TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); + NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); + + + bool advMode = cfg.readBoolEntry("advancedFeatures", false ); @@ -114,3 +131,3 @@ void Ntp::slotRunNtp() { - if ( !ntpDelayElapsed() ) + if ( !ntpDelayElapsed() && CheckBoxAdvSettings->isChecked() ) { @@ -135,2 +152,4 @@ void Ntp::slotRunNtp() if ( !ret ) { + QMessageBox::critical(this, tr("ntp error"), + tr("Error while getting time form network!")); qDebug("Error while executing ntpdate"); @@ -142,2 +161,3 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) { + if (! proc ) qDebug("Ntp::getNtpOutput OProcess is null"); QString lineStr, lineStrOld; @@ -155,6 +175,12 @@ void Ntp::ntpFinished(OProcess *p) { - // qDebug("p->exitStatus() %i",p->exitStatus()); + qDebug("p->exitStatus() %i",p->exitStatus()); if (p->exitStatus()!=0 || !p->normalExit()) - { - slotProbeNtpServer(); + { + QMessageBox::critical(this, tr("ntp error"), + tr("Error while getting time form\n server")+ + getNtpServer()+"\n"+ + _ntpOutput ); + // TabWidgetMain->setCurrentPage( 1 ); + TabWidgetMain->showPage( tabManualSetTime ); + return; @@ -309,2 +335,3 @@ void Ntp::ntpOutPut(QString out) { + MultiLineEditntpOutPut->append(out); @@ -340,3 +367,3 @@ void Ntp::setDocument(const QString &fileName) { - + qDebug("Ntp::setDocument( %s )",fileName.latin1()); } @@ -346,2 +373,3 @@ void Ntp::showAdvancedFeatures(bool advMode) if (advMode) { + TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); diff --git a/noncore/settings/netsystemtime/ntp.h b/noncore/settings/netsystemtime/ntp.h index fe0bae6..f6694c9 100644 --- a/noncore/settings/netsystemtime/ntp.h +++ b/noncore/settings/netsystemtime/ntp.h @@ -17,35 +17,35 @@ public: Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~Ntp(); + ~Ntp(); public slots: - void setDocument (const QString &); + void setDocument (const QString &); protected: - QDateTime predictedTime; - void makeChannel(); + QDateTime predictedTime; + void makeChannel(); protected slots: - void receive(const QCString &msg, const QByteArray &arg); + void receive(const QCString &msg, const QByteArray &arg); private: - QString _ntpOutput; - float _shiftPerSec; - int _lookupDiff; - OProcess *ntpProcess; - QTimer *ntpTimer; - QSocket *ntpSock; - QCopChannel *channel; + QString _ntpOutput; + float _shiftPerSec; + int _lookupDiff; + OProcess *ntpProcess; + QTimer *ntpTimer; + QSocket *ntpSock; + QCopChannel *channel; - float getTimeShift(); - void readLookups(); - void ntpOutPut(QString); - bool ntpDelayElapsed(); - QString getNtpServer(); + float getTimeShift(); + void readLookups(); + void ntpOutPut(QString); + bool ntpDelayElapsed(); + QString getNtpServer(); private slots: - void slotRunNtp(); - void getNtpOutput(OProcess *proc, char *buffer, int buflen); - void ntpFinished(OProcess*); - void preditctTime(); - void slotCheckNtp(int); - void setPredictTime(); - void showAdvancedFeatures(bool); - void slotProbeNtpServer(); - void slotNtpDelayChanged(int); + void slotRunNtp(); + void getNtpOutput(OProcess *proc, char *buffer, int buflen); + void ntpFinished(OProcess*); + 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 8d44f17..0a7a57e 100644 --- a/noncore/settings/netsystemtime/ntpbase.cpp +++ b/noncore/settings/netsystemtime/ntpbase.cpp @@ -3,3 +3,3 @@ ** -** Created: Mon Oct 21 21:32:47 2002 +** Created: Sun Nov 10 17:59:14 2002 ** by: The User Interface Compiler (uic) @@ -33,3 +33,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) setName( "NtpBase" ); - resize( 320, 411 ); + resize( 317, 411 ); setCaption( tr( "Network Time" ) ); @@ -46,7 +46,6 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) - FrameSystemTime = new QWidget( tabMain, "FrameSystemTime" ); - // FrameSystemTime->setFrameShape( QFrame::StyledPanel ); - //FrameSystemTime->setFrameShadow( QFrame::Raised ); + FrameSystemTime = new QFrame( tabMain, "FrameSystemTime" ); tabMainLayout->addWidget( FrameSystemTime, 0, 0 ); + TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); @@ -63,4 +62,2 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) FrameNtp = new QWidget( tabNtp, "FrameNtp" ); - // FrameNtp->setFrameShape( QFrame::StyledPanel ); - // FrameNtp->setFrameShadow( QFrame::Raised ); FrameNtpLayout = new QGridLayout( FrameNtp ); @@ -112,2 +109,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) tabNtpLayout->addWidget( FrameNtp, 0, 0 ); + TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); @@ -176,2 +174,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) tabPredictLayout->addLayout( Layout11, 2, 0 ); + TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); @@ -183,4 +182,2 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) FrameSettings = new QWidget( TabSettings, "FrameSettings" ); - // FrameSettings->setFrameShape( QFrame::StyledPanel ); - // FrameSettings->setFrameShadow( QFrame::Raised ); FrameSettingsLayout = new QVBoxLayout( FrameSettings ); @@ -218,3 +215,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) CheckBoxAdvSettings = new QCheckBox( FrameSettings, "CheckBoxAdvSettings" ); - CheckBoxAdvSettings->setText( tr( "Advanced features" ) ); + CheckBoxAdvSettings->setText( tr( "Advanced settings" ) ); FrameSettingsLayout->addWidget( CheckBoxAdvSettings ); @@ -287,2 +284,3 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) TabSettingsLayout->addWidget( FrameSettings, 0, 0 ); + TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); @@ -290,8 +288,7 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) tabManualSetTimeLayout = new QVBoxLayout( tabManualSetTime ); - tabManualSetTimeLayout->setSpacing( 2 ); - tabManualSetTimeLayout->setMargin( 2 ); + tabManualSetTimeLayout->setSpacing( 6 ); + tabManualSetTimeLayout->setMargin( 11 ); FrameSetTime = new QWidget( tabManualSetTime, "FrameSetTime" ); - // FrameSetTime->setFrameShape( QFrame::StyledPanel ); - // FrameSetTime->setFrameShadow( QFrame::Raised ); + FrameSetTime->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, FrameSetTime->sizePolicy().hasHeightForWidth() ) ); tabManualSetTimeLayout->addWidget( FrameSetTime ); @@ -301,9 +298,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) tabManualSetTimeLayout->addWidget( PushButtonSetManualTime ); - - - TabWidgetMain->insertTab( tabMain, tr( "Main" ) ); + QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + tabManualSetTimeLayout->addItem( spacer_4 ); TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); - TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); - TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); - TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); diff --git a/noncore/settings/netsystemtime/ntpbase.h b/noncore/settings/netsystemtime/ntpbase.h index a443495..543cac1 100644 --- a/noncore/settings/netsystemtime/ntpbase.h +++ b/noncore/settings/netsystemtime/ntpbase.h @@ -3,3 +3,3 @@ ** -** Created: Mon Oct 21 21:32:43 2002 +** Created: Sun Nov 10 17:58:48 2002 ** by: The User Interface Compiler (uic) @@ -36,3 +36,3 @@ public: QWidget* tabMain; - QWidget* FrameSystemTime; + QFrame* FrameSystemTime; QWidget* tabNtp; diff --git a/noncore/settings/netsystemtime/ntpbase.ui b/noncore/settings/netsystemtime/ntpbase.ui index 465bba0..6c38588 100644 --- a/noncore/settings/netsystemtime/ntpbase.ui +++ b/noncore/settings/netsystemtime/ntpbase.ui @@ -13,3 +13,3 @@ <y>0</y> - <width>320</width> + <width>317</width> <height>411</height> @@ -73,10 +73,2 @@ </property> - <property stdset="1"> - <name>frameShape</name> - <enum>StyledPanel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Raised</enum> - </property> </widget> @@ -120,10 +112,2 @@ </property> - <property stdset="1"> - <name>frameShape</name> - <enum>StyledPanel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Raised</enum> - </property> <property> @@ -465,10 +449,2 @@ </property> - <property stdset="1"> - <name>frameShape</name> - <enum>StyledPanel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Raised</enum> - </property> <property> @@ -804,3 +780,3 @@ <name>margin</name> - <number>2</number> + <number>11</number> </property> @@ -808,3 +784,3 @@ <name>spacing</name> - <number>2</number> + <number>6</number> </property> @@ -817,8 +793,7 @@ <property stdset="1"> - <name>frameShape</name> - <enum>StyledPanel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Raised</enum> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>3</vsizetype> + </sizepolicy> </property> @@ -836,2 +811,23 @@ </widget> + <spacer> + <property> + <name>name</name> + <cstring>Spacer4_2</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> </vbox> |