author | tille <tille> | 2002-11-10 17:01:05 (UTC) |
---|---|---|
committer | tille <tille> | 2002-11-10 17:01:05 (UTC) |
commit | 8394ee8e5fc0014605256b243909709864afdc9b (patch) (side-by-side diff) | |
tree | 02718093edeb4c2df58ef8611fbf3db11abcf574 | |
parent | 81e63be3c1e21da2a2f97df1fc38417e7ca814e1 (diff) | |
download | opie-8394ee8e5fc0014605256b243909709864afdc9b.zip opie-8394ee8e5fc0014605256b243909709864afdc9b.tar.gz opie-8394ee8e5fc0014605256b243909709864afdc9b.tar.bz2 |
usability improvments
-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 @@ -2,10 +2,10 @@ TEMPLATE = app 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 DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -INTERFACES = +INTERFACES = ntpbase.ui DESTDIR = $(OPIEDIR)/bin TARGET = systemtime 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 @@ -47,4 +47,21 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); + //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 ); showAdvancedFeatures(advMode); @@ -113,5 +130,5 @@ QString Ntp::getNtpServer() void Ntp::slotRunNtp() { - if ( !ntpDelayElapsed() ) + if ( !ntpDelayElapsed() && CheckBoxAdvSettings->isChecked() ) { switch ( @@ -134,4 +151,6 @@ void Ntp::slotRunNtp() bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); if ( !ret ) { + QMessageBox::critical(this, tr("ntp error"), + tr("Error while getting time form network!")); qDebug("Error while executing ntpdate"); ntpOutPut( tr("Error while executing ntpdate")); @@ -141,4 +160,5 @@ void Ntp::slotRunNtp() void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) { + if (! proc ) qDebug("Ntp::getNtpOutput OProcess is null"); QString lineStr, lineStrOld; lineStr = buffer; @@ -154,8 +174,14 @@ 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(); + { + QMessageBox::critical(this, tr("ntp error"), + tr("Error while getting time form\n server")+ + getNtpServer()+"\n"+ + _ntpOutput ); + // TabWidgetMain->setCurrentPage( 1 ); + TabWidgetMain->showPage( tabManualSetTime ); + return; } @@ -308,4 +334,5 @@ void Ntp::slotNtpDelayChanged(int delay) void Ntp::ntpOutPut(QString out) { + MultiLineEditntpOutPut->append(out); MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE); @@ -339,5 +366,5 @@ void Ntp::receive(const QCString &msg, const QByteArray &arg) void Ntp::setDocument(const QString &fileName) { - + qDebug("Ntp::setDocument( %s )",fileName.latin1()); } @@ -345,4 +372,5 @@ void Ntp::showAdvancedFeatures(bool advMode) { if (advMode) { + TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); TabWidgetMain->addTab( tabNtp, tr( "NTP" ) ); 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 @@ -16,37 +16,37 @@ class Ntp : public SetDateTime 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 @@ -2,5 +2,5 @@ ** Form implementation generated from reading ui file 'ntpbase.ui' ** -** Created: Mon Oct 21 21:32:47 2002 +** Created: Sun Nov 10 17:59:14 2002 ** by: The User Interface Compiler (uic) ** @@ -32,5 +32,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) if ( !name ) setName( "NtpBase" ); - resize( 320, 411 ); + resize( 317, 411 ); setCaption( tr( "Network Time" ) ); NtpBaseLayout = new QGridLayout( this ); @@ -45,9 +45,8 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) tabMainLayout->setMargin( 2 ); - 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" ) ); tabNtp = new QWidget( TabWidgetMain, "tabNtp" ); @@ -62,6 +61,4 @@ 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 ); FrameNtpLayout->setSpacing( 2 ); @@ -111,4 +108,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) tabNtpLayout->addWidget( FrameNtp, 0, 0 ); + TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) ); tabPredict = new QWidget( TabWidgetMain, "tabPredict" ); @@ -175,4 +173,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) tabPredictLayout->addLayout( Layout11, 2, 0 ); + TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) ); TabSettings = new QWidget( TabWidgetMain, "TabSettings" ); @@ -182,6 +181,4 @@ 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 ); FrameSettingsLayout->setSpacing( 6 ); @@ -217,5 +214,5 @@ 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 ); QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); @@ -286,13 +283,13 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) TabSettingsLayout->addWidget( FrameSettings, 0, 0 ); + TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) ); tabManualSetTime = new QWidget( TabWidgetMain, "tabManualSetTime" ); 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 ); @@ -300,11 +297,7 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl ) PushButtonSetManualTime->setText( tr( "Set time" ) ); 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" ) ); NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); 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 @@ -2,5 +2,5 @@ ** Form interface generated from reading ui file 'ntpbase.ui' ** -** Created: Mon Oct 21 21:32:43 2002 +** Created: Sun Nov 10 17:58:48 2002 ** by: The User Interface Compiler (uic) ** @@ -35,5 +35,5 @@ public: QTabWidget* TabWidgetMain; QWidget* tabMain; - QWidget* FrameSystemTime; + QFrame* FrameSystemTime; QWidget* tabNtp; QPushButton* runNtp; 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 @@ -12,5 +12,5 @@ <x>0</x> <y>0</y> - <width>320</width> + <width>317</width> <height>411</height> </rect> @@ -72,12 +72,4 @@ <cstring>FrameSystemTime</cstring> </property> - <property stdset="1"> - <name>frameShape</name> - <enum>StyledPanel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Raised</enum> - </property> </widget> </grid> @@ -119,12 +111,4 @@ <cstring>FrameNtp</cstring> </property> - <property stdset="1"> - <name>frameShape</name> - <enum>StyledPanel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Raised</enum> - </property> <property> <name>layoutMargin</name> @@ -464,12 +448,4 @@ <cstring>FrameSettings</cstring> </property> - <property stdset="1"> - <name>frameShape</name> - <enum>StyledPanel</enum> - </property> - <property stdset="1"> - <name>frameShadow</name> - <enum>Raised</enum> - </property> <property> <name>layoutMargin</name> @@ -803,9 +779,9 @@ <property stdset="1"> <name>margin</name> - <number>2</number> + <number>11</number> </property> <property stdset="1"> <name>spacing</name> - <number>2</number> + <number>6</number> </property> <widget> @@ -816,10 +792,9 @@ </property> <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> </widget> @@ -835,4 +810,25 @@ </property> </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> </widget> |