summaryrefslogtreecommitdiff
authortille <tille>2002-11-10 17:01:05 (UTC)
committer tille <tille>2002-11-10 17:01:05 (UTC)
commit8394ee8e5fc0014605256b243909709864afdc9b (patch) (side-by-side diff)
tree02718093edeb4c2df58ef8611fbf3db11abcf574
parent81e63be3c1e21da2a2f97df1fc38417e7ca814e1 (diff)
downloadopie-8394ee8e5fc0014605256b243909709864afdc9b.zip
opie-8394ee8e5fc0014605256b243909709864afdc9b.tar.gz
opie-8394ee8e5fc0014605256b243909709864afdc9b.tar.bz2
usability improvments
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/netsystemtime.pro6
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp36
-rw-r--r--noncore/settings/netsystemtime/ntp.h0
-rw-r--r--noncore/settings/netsystemtime/ntpbase.cpp33
-rw-r--r--noncore/settings/netsystemtime/ntpbase.h4
-rw-r--r--noncore/settings/netsystemtime/ntpbase.ui62
6 files changed, 79 insertions, 62 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
@@ -1,13 +1,13 @@
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
TRANSLATIONS = ../../../i18n/de/systemtime.ts \
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
@@ -45,8 +45,25 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
SpinBoxMinLookupDelay->setValue( cfg.readNumEntry("minLookupDiff",720) );
SpinBoxNtpDelay->setValue( cfg.readNumEntry("ntpRefreshFreq",1440) );
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);
CheckBoxAdvSettings->setChecked( advMode );
connect( CheckBoxAdvSettings, SIGNAL( toggled( bool ) ),
@@ -111,9 +128,9 @@ QString Ntp::getNtpServer()
}
void Ntp::slotRunNtp()
{
- if ( !ntpDelayElapsed() )
+ if ( !ntpDelayElapsed() && CheckBoxAdvSettings->isChecked() )
{
switch (
QMessageBox::warning(this, tr("Run NTP?"),
tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+
@@ -132,15 +149,18 @@ void Ntp::slotRunNtp()
ntpProcess->clearArguments();
*ntpProcess << "ntpdate" << getNtpServer();
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"));
}
}
void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen)
{
+ if (! proc ) qDebug("Ntp::getNtpOutput OProcess is null");
QString lineStr, lineStrOld;
lineStr = buffer;
lineStr=lineStr.left(buflen);
if (lineStr!=lineStrOld)
@@ -152,12 +172,18 @@ 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;
}
Global::writeHWClock();
@@ -306,8 +332,9 @@ void Ntp::slotNtpDelayChanged(int delay)
}
void Ntp::ntpOutPut(QString out)
{
+
MultiLineEditntpOutPut->append(out);
MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE);
}
@@ -337,14 +364,15 @@ void Ntp::receive(const QCString &msg, const QByteArray &arg)
}
void Ntp::setDocument(const QString &fileName)
{
-
+ qDebug("Ntp::setDocument( %s )",fileName.latin1());
}
void Ntp::showAdvancedFeatures(bool advMode)
{
if (advMode) {
+
TabWidgetMain->addTab( tabPredict, tr( "Predict" ) );
TabWidgetMain->addTab( tabNtp, tr( "NTP" ) );
TextLabel1_2_2->show();
TextLabel2_3->show();
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
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
@@ -1,8 +1,8 @@
/****************************************************************************
** 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)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
@@ -30,9 +30,9 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "NtpBase" );
- resize( 320, 411 );
+ resize( 317, 411 );
setCaption( tr( "Network Time" ) );
NtpBaseLayout = new QGridLayout( this );
NtpBaseLayout->setSpacing( 2 );
NtpBaseLayout->setMargin( 2 );
@@ -43,13 +43,12 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
tabMainLayout = new QGridLayout( tabMain );
tabMainLayout->setSpacing( 2 );
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" );
tabNtpLayout = new QGridLayout( tabNtp );
tabNtpLayout->setSpacing( 2 );
@@ -60,10 +59,8 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
tabNtpLayout->addWidget( runNtp, 1, 0 );
FrameNtp = new QWidget( tabNtp, "FrameNtp" );
- // FrameNtp->setFrameShape( QFrame::StyledPanel );
- // FrameNtp->setFrameShadow( QFrame::Raised );
FrameNtpLayout = new QGridLayout( FrameNtp );
FrameNtpLayout->setSpacing( 2 );
FrameNtpLayout->setMargin( 2 );
@@ -109,8 +106,9 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
FrameNtpLayout->addWidget( MultiLineEditntpOutPut, 1, 0 );
tabNtpLayout->addWidget( FrameNtp, 0, 0 );
+ TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) );
tabPredict = new QWidget( TabWidgetMain, "tabPredict" );
tabPredictLayout = new QGridLayout( tabPredict );
tabPredictLayout->setSpacing( 6 );
@@ -173,17 +171,16 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
PushButtonPredict->setText( tr( "Predict time" ) );
Layout11->addWidget( PushButtonPredict );
tabPredictLayout->addLayout( Layout11, 2, 0 );
+ TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) );
TabSettings = new QWidget( TabWidgetMain, "TabSettings" );
TabSettingsLayout = new QGridLayout( TabSettings );
TabSettingsLayout->setSpacing( 2 );
TabSettingsLayout->setMargin( 2 );
FrameSettings = new QWidget( TabSettings, "FrameSettings" );
- // FrameSettings->setFrameShape( QFrame::StyledPanel );
- // FrameSettings->setFrameShadow( QFrame::Raised );
FrameSettingsLayout = new QVBoxLayout( FrameSettings );
FrameSettingsLayout->setSpacing( 6 );
FrameSettingsLayout->setMargin( 11 );
@@ -215,9 +212,9 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum );
FrameSettingsLayout->addItem( spacer_2 );
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 );
FrameSettingsLayout->addItem( spacer_3 );
@@ -284,29 +281,25 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
Layout7->addWidget( SpinBoxMinLookupDelay, 0, 1 );
FrameSettingsLayout->addLayout( Layout7 );
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 );
PushButtonSetManualTime = new QPushButton( tabManualSetTime, "PushButtonSetManualTime" );
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
@@ -1,8 +1,8 @@
/****************************************************************************
** 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)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
@@ -33,9 +33,9 @@ public:
~NtpBase();
QTabWidget* TabWidgetMain;
QWidget* tabMain;
- QWidget* FrameSystemTime;
+ QFrame* FrameSystemTime;
QWidget* tabNtp;
QPushButton* runNtp;
QWidget* FrameNtp;
QLabel* TextLabel1;
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
@@ -10,9 +10,9 @@
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>320</width>
+ <width>317</width>
<height>411</height>
</rect>
</property>
<property stdset="1">
@@ -70,16 +70,8 @@
<property stdset="1">
<name>name</name>
<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>
</widget>
<widget>
@@ -117,16 +109,8 @@
<property stdset="1">
<name>name</name>
<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>
</property>
<property>
@@ -462,16 +446,8 @@
<property stdset="1">
<name>name</name>
<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>
</property>
<property>
@@ -801,27 +777,26 @@
</attribute>
<vbox>
<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>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>FrameSetTime</cstring>
</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>
<widget>
<class>QPushButton</class>
@@ -833,8 +808,29 @@
<name>text</name>
<string>Set time</string>
</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>
</widget>
</grid>