summaryrefslogtreecommitdiff
path: root/noncore
authortille <tille>2002-11-10 17:01:05 (UTC)
committer tille <tille>2002-11-10 17:01:05 (UTC)
commit8394ee8e5fc0014605256b243909709864afdc9b (patch) (unidiff)
tree02718093edeb4c2df58ef8611fbf3db11abcf574 /noncore
parent81e63be3c1e21da2a2f97df1fc38417e7ca814e1 (diff)
downloadopie-8394ee8e5fc0014605256b243909709864afdc9b.zip
opie-8394ee8e5fc0014605256b243909709864afdc9b.tar.gz
opie-8394ee8e5fc0014605256b243909709864afdc9b.tar.bz2
usability improvments
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/netsystemtime.pro6
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp38
-rw-r--r--noncore/settings/netsystemtime/ntp.h52
-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, 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
2 CONFIG = qt warn_on debug 2 CONFIG = qt warn_on debug
3 #CONFIG = qt warn_on release 3 #CONFIG = qt warn_on release
4 HEADERS = ntp.h settime.h ntpbase.h 4 HEADERS = ntp.h settime.h
5 SOURCES = main.cpp ntp.cpp settime.cpp ntpbase.cpp 5 SOURCES = main.cpp ntp.cpp settime.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include 6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include 7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe -lopie 8LIBS += -lqpe -lopie
9 INTERFACES= 9 INTERFACES= ntpbase.ui
10DESTDIR = $(OPIEDIR)/bin 10DESTDIR = $(OPIEDIR)/bin
11 TARGET = systemtime 11 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 )
47 ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) ); 47 ComboNtpSrv->setCurrentItem( cfg.readNumEntry("ntpServer", 0) );
48 48
49 //make tab order
50
51 TabWidgetMain->removePage( tabMain );
52 TabWidgetMain->removePage( tabManualSetTime );
53 TabWidgetMain->removePage( TabSettings );
54 TabWidgetMain->removePage( tabPredict );
55 TabWidgetMain->removePage( tabNtp );
56
57 TabWidgetMain->insertTab( tabMain, tr( "Main" ) );
58 TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) );
59 TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) );
60 TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) );
61 TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) );
62 NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 );
63
64
65
49 bool advMode = cfg.readBoolEntry("advancedFeatures", false ); 66 bool advMode = cfg.readBoolEntry("advancedFeatures", false );
50 showAdvancedFeatures(advMode); 67 showAdvancedFeatures(advMode);
@@ -113,5 +130,5 @@ QString Ntp::getNtpServer()
113void Ntp::slotRunNtp() 130void Ntp::slotRunNtp()
114{ 131{
115 if ( !ntpDelayElapsed() ) 132 if ( !ntpDelayElapsed() && CheckBoxAdvSettings->isChecked() )
116 { 133 {
117 switch ( 134 switch (
@@ -134,4 +151,6 @@ void Ntp::slotRunNtp()
134 bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); 151 bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput);
135 if ( !ret ) { 152 if ( !ret ) {
153 QMessageBox::critical(this, tr("ntp error"),
154 tr("Error while getting time form network!"));
136 qDebug("Error while executing ntpdate"); 155 qDebug("Error while executing ntpdate");
137 ntpOutPut( tr("Error while executing ntpdate")); 156 ntpOutPut( tr("Error while executing ntpdate"));
@@ -141,4 +160,5 @@ void Ntp::slotRunNtp()
141void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) 160void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen)
142{ 161{
162 if (! proc ) qDebug("Ntp::getNtpOutput OProcess is null");
143 QString lineStr, lineStrOld; 163 QString lineStr, lineStrOld;
144 lineStr = buffer; 164 lineStr = buffer;
@@ -154,8 +174,14 @@ void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen)
154void Ntp::ntpFinished(OProcess *p) 174void Ntp::ntpFinished(OProcess *p)
155{ 175{
156 //qDebug("p->exitStatus() %i",p->exitStatus()); 176 qDebug("p->exitStatus() %i",p->exitStatus());
157 if (p->exitStatus()!=0 || !p->normalExit()) 177 if (p->exitStatus()!=0 || !p->normalExit())
158 { 178 {
159 slotProbeNtpServer(); 179 QMessageBox::critical(this, tr("ntp error"),
180 tr("Error while getting time form\n server")+
181 getNtpServer()+"\n"+
182 _ntpOutput );
183 // TabWidgetMain->setCurrentPage( 1 );
184 TabWidgetMain->showPage( tabManualSetTime );
185
160 return; 186 return;
161 } 187 }
@@ -308,4 +334,5 @@ void Ntp::slotNtpDelayChanged(int delay)
308void Ntp::ntpOutPut(QString out) 334void Ntp::ntpOutPut(QString out)
309{ 335{
336
310 MultiLineEditntpOutPut->append(out); 337 MultiLineEditntpOutPut->append(out);
311 MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE); 338 MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE);
@@ -339,5 +366,5 @@ void Ntp::receive(const QCString &msg, const QByteArray &arg)
339void Ntp::setDocument(const QString &fileName) 366void Ntp::setDocument(const QString &fileName)
340{ 367{
341 368 qDebug("Ntp::setDocument( %s )",fileName.latin1());
342} 369}
343 370
@@ -345,4 +372,5 @@ void Ntp::showAdvancedFeatures(bool advMode)
345{ 372{
346 if (advMode) { 373 if (advMode) {
374
347 TabWidgetMain->addTab( tabPredict, tr( "Predict" ) ); 375 TabWidgetMain->addTab( tabPredict, tr( "Predict" ) );
348 TabWidgetMain->addTab( tabNtp, tr( "NTP" ) ); 376 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
16public: 16public:
17 Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 17 Ntp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
18 ~Ntp(); 18 ~Ntp();
19 19
20public slots: 20public slots:
21 void setDocument (const QString &); 21 void setDocument (const QString &);
22protected: 22protected:
23 QDateTime predictedTime; 23 QDateTime predictedTime;
24 void makeChannel(); 24 void makeChannel();
25protected slots: 25protected slots:
26 void receive(const QCString &msg, const QByteArray &arg); 26 void receive(const QCString &msg, const QByteArray &arg);
27private: 27private:
28 QString _ntpOutput; 28 QString _ntpOutput;
29 float _shiftPerSec; 29 float _shiftPerSec;
30 int _lookupDiff; 30 int _lookupDiff;
31 OProcess *ntpProcess; 31 OProcess *ntpProcess;
32 QTimer *ntpTimer; 32 QTimer *ntpTimer;
33 QSocket *ntpSock; 33 QSocket *ntpSock;
34 QCopChannel *channel; 34 QCopChannel *channel;
35 35
36 float getTimeShift(); 36 float getTimeShift();
37 void readLookups(); 37 void readLookups();
38 void ntpOutPut(QString); 38 void ntpOutPut(QString);
39 bool ntpDelayElapsed(); 39 bool ntpDelayElapsed();
40 QString getNtpServer(); 40 QString getNtpServer();
41private slots: 41private slots:
42 void slotRunNtp(); 42 void slotRunNtp();
43 void getNtpOutput(OProcess *proc, char *buffer, int buflen); 43 void getNtpOutput(OProcess *proc, char *buffer, int buflen);
44 void ntpFinished(OProcess*); 44 void ntpFinished(OProcess*);
45 void preditctTime(); 45 void preditctTime();
46 void slotCheckNtp(int); 46 void slotCheckNtp(int);
47 void setPredictTime(); 47 void setPredictTime();
48 void showAdvancedFeatures(bool); 48 void showAdvancedFeatures(bool);
49 void slotProbeNtpServer(); 49 void slotProbeNtpServer();
50 void slotNtpDelayChanged(int); 50 void slotNtpDelayChanged(int);
51}; 51};
52 52
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 @@
2** Form implementation generated from reading ui file 'ntpbase.ui' 2** Form implementation generated from reading ui file 'ntpbase.ui'
3** 3**
4** Created: Mon Oct 21 21:32:47 2002 4** Created: Sun Nov 10 17:59:14 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
@@ -32,5 +32,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
32 if ( !name ) 32 if ( !name )
33 setName( "NtpBase" ); 33 setName( "NtpBase" );
34 resize( 320, 411 ); 34 resize( 317, 411 );
35 setCaption( tr( "Network Time" ) ); 35 setCaption( tr( "Network Time" ) );
36 NtpBaseLayout = new QGridLayout( this ); 36 NtpBaseLayout = new QGridLayout( this );
@@ -45,9 +45,8 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
45 tabMainLayout->setMargin( 2 ); 45 tabMainLayout->setMargin( 2 );
46 46
47 FrameSystemTime = new QWidget( tabMain, "FrameSystemTime" ); 47 FrameSystemTime = new QFrame( tabMain, "FrameSystemTime" );
48 // FrameSystemTime->setFrameShape( QFrame::StyledPanel );
49 //FrameSystemTime->setFrameShadow( QFrame::Raised );
50 48
51 tabMainLayout->addWidget( FrameSystemTime, 0, 0 ); 49 tabMainLayout->addWidget( FrameSystemTime, 0, 0 );
50 TabWidgetMain->insertTab( tabMain, tr( "Main" ) );
52 51
53 tabNtp = new QWidget( TabWidgetMain, "tabNtp" ); 52 tabNtp = new QWidget( TabWidgetMain, "tabNtp" );
@@ -62,6 +61,4 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
62 61
63 FrameNtp = new QWidget( tabNtp, "FrameNtp" ); 62 FrameNtp = new QWidget( tabNtp, "FrameNtp" );
64 // FrameNtp->setFrameShape( QFrame::StyledPanel );
65 // FrameNtp->setFrameShadow( QFrame::Raised );
66 FrameNtpLayout = new QGridLayout( FrameNtp ); 63 FrameNtpLayout = new QGridLayout( FrameNtp );
67 FrameNtpLayout->setSpacing( 2 ); 64 FrameNtpLayout->setSpacing( 2 );
@@ -111,4 +108,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
111 108
112 tabNtpLayout->addWidget( FrameNtp, 0, 0 ); 109 tabNtpLayout->addWidget( FrameNtp, 0, 0 );
110 TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) );
113 111
114 tabPredict = new QWidget( TabWidgetMain, "tabPredict" ); 112 tabPredict = new QWidget( TabWidgetMain, "tabPredict" );
@@ -175,4 +173,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
175 173
176 tabPredictLayout->addLayout( Layout11, 2, 0 ); 174 tabPredictLayout->addLayout( Layout11, 2, 0 );
175 TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) );
177 176
178 TabSettings = new QWidget( TabWidgetMain, "TabSettings" ); 177 TabSettings = new QWidget( TabWidgetMain, "TabSettings" );
@@ -182,6 +181,4 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
182 181
183 FrameSettings = new QWidget( TabSettings, "FrameSettings" ); 182 FrameSettings = new QWidget( TabSettings, "FrameSettings" );
184 // FrameSettings->setFrameShape( QFrame::StyledPanel );
185 // FrameSettings->setFrameShadow( QFrame::Raised );
186 FrameSettingsLayout = new QVBoxLayout( FrameSettings ); 183 FrameSettingsLayout = new QVBoxLayout( FrameSettings );
187 FrameSettingsLayout->setSpacing( 6 ); 184 FrameSettingsLayout->setSpacing( 6 );
@@ -217,5 +214,5 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
217 214
218 CheckBoxAdvSettings = new QCheckBox( FrameSettings, "CheckBoxAdvSettings" ); 215 CheckBoxAdvSettings = new QCheckBox( FrameSettings, "CheckBoxAdvSettings" );
219 CheckBoxAdvSettings->setText( tr( "Advanced features" ) ); 216 CheckBoxAdvSettings->setText( tr( "Advanced settings" ) );
220 FrameSettingsLayout->addWidget( CheckBoxAdvSettings ); 217 FrameSettingsLayout->addWidget( CheckBoxAdvSettings );
221 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 218 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
@@ -286,13 +283,13 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
286 283
287 TabSettingsLayout->addWidget( FrameSettings, 0, 0 ); 284 TabSettingsLayout->addWidget( FrameSettings, 0, 0 );
285 TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) );
288 286
289 tabManualSetTime = new QWidget( TabWidgetMain, "tabManualSetTime" ); 287 tabManualSetTime = new QWidget( TabWidgetMain, "tabManualSetTime" );
290 tabManualSetTimeLayout = new QVBoxLayout( tabManualSetTime ); 288 tabManualSetTimeLayout = new QVBoxLayout( tabManualSetTime );
291 tabManualSetTimeLayout->setSpacing( 2 ); 289 tabManualSetTimeLayout->setSpacing( 6 );
292 tabManualSetTimeLayout->setMargin( 2 ); 290 tabManualSetTimeLayout->setMargin( 11 );
293 291
294 FrameSetTime = new QWidget( tabManualSetTime, "FrameSetTime" ); 292 FrameSetTime = new QWidget( tabManualSetTime, "FrameSetTime" );
295 // FrameSetTime->setFrameShape( QFrame::StyledPanel ); 293 FrameSetTime->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, FrameSetTime->sizePolicy().hasHeightForWidth() ) );
296 // FrameSetTime->setFrameShadow( QFrame::Raised );
297 tabManualSetTimeLayout->addWidget( FrameSetTime ); 294 tabManualSetTimeLayout->addWidget( FrameSetTime );
298 295
@@ -300,11 +297,7 @@ NtpBase::NtpBase( QWidget* parent, const char* name, WFlags fl )
300 PushButtonSetManualTime->setText( tr( "Set time" ) ); 297 PushButtonSetManualTime->setText( tr( "Set time" ) );
301 tabManualSetTimeLayout->addWidget( PushButtonSetManualTime ); 298 tabManualSetTimeLayout->addWidget( PushButtonSetManualTime );
302 299 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
303 300 tabManualSetTimeLayout->addItem( spacer_4 );
304 TabWidgetMain->insertTab( tabMain, tr( "Main" ) );
305 TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) ); 301 TabWidgetMain->insertTab( tabManualSetTime, tr( "Manual" ) );
306 TabWidgetMain->insertTab( TabSettings, tr( "Settings" ) );
307 TabWidgetMain->insertTab( tabPredict, tr( "Predict" ) );
308 TabWidgetMain->insertTab( tabNtp, tr( "NTP" ) );
309 302
310 NtpBaseLayout->addWidget( TabWidgetMain, 0, 0 ); 303 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 @@
2** Form interface generated from reading ui file 'ntpbase.ui' 2** Form interface generated from reading ui file 'ntpbase.ui'
3** 3**
4** Created: Mon Oct 21 21:32:43 2002 4** Created: Sun Nov 10 17:58:48 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
@@ -35,5 +35,5 @@ public:
35 QTabWidget* TabWidgetMain; 35 QTabWidget* TabWidgetMain;
36 QWidget* tabMain; 36 QWidget* tabMain;
37 QWidget* FrameSystemTime; 37 QFrame* FrameSystemTime;
38 QWidget* tabNtp; 38 QWidget* tabNtp;
39 QPushButton* runNtp; 39 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 @@
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>320</width> 14 <width>317</width>
15 <height>411</height> 15 <height>411</height>
16 </rect> 16 </rect>
@@ -72,12 +72,4 @@
72 <cstring>FrameSystemTime</cstring> 72 <cstring>FrameSystemTime</cstring>
73 </property> 73 </property>
74 <property stdset="1">
75 <name>frameShape</name>
76 <enum>StyledPanel</enum>
77 </property>
78 <property stdset="1">
79 <name>frameShadow</name>
80 <enum>Raised</enum>
81 </property>
82 </widget> 74 </widget>
83 </grid> 75 </grid>
@@ -119,12 +111,4 @@
119 <cstring>FrameNtp</cstring> 111 <cstring>FrameNtp</cstring>
120 </property> 112 </property>
121 <property stdset="1">
122 <name>frameShape</name>
123 <enum>StyledPanel</enum>
124 </property>
125 <property stdset="1">
126 <name>frameShadow</name>
127 <enum>Raised</enum>
128 </property>
129 <property> 113 <property>
130 <name>layoutMargin</name> 114 <name>layoutMargin</name>
@@ -464,12 +448,4 @@
464 <cstring>FrameSettings</cstring> 448 <cstring>FrameSettings</cstring>
465 </property> 449 </property>
466 <property stdset="1">
467 <name>frameShape</name>
468 <enum>StyledPanel</enum>
469 </property>
470 <property stdset="1">
471 <name>frameShadow</name>
472 <enum>Raised</enum>
473 </property>
474 <property> 450 <property>
475 <name>layoutMargin</name> 451 <name>layoutMargin</name>
@@ -803,9 +779,9 @@
803 <property stdset="1"> 779 <property stdset="1">
804 <name>margin</name> 780 <name>margin</name>
805 <number>2</number> 781 <number>11</number>
806 </property> 782 </property>
807 <property stdset="1"> 783 <property stdset="1">
808 <name>spacing</name> 784 <name>spacing</name>
809 <number>2</number> 785 <number>6</number>
810 </property> 786 </property>
811 <widget> 787 <widget>
@@ -816,10 +792,9 @@
816 </property> 792 </property>
817 <property stdset="1"> 793 <property stdset="1">
818 <name>frameShape</name> 794 <name>sizePolicy</name>
819 <enum>StyledPanel</enum> 795 <sizepolicy>
820 </property> 796 <hsizetype>5</hsizetype>
821 <property stdset="1"> 797 <vsizetype>3</vsizetype>
822 <name>frameShadow</name> 798 </sizepolicy>
823 <enum>Raised</enum>
824 </property> 799 </property>
825 </widget> 800 </widget>
@@ -835,4 +810,25 @@
835 </property> 810 </property>
836 </widget> 811 </widget>
812 <spacer>
813 <property>
814 <name>name</name>
815 <cstring>Spacer4_2</cstring>
816 </property>
817 <property stdset="1">
818 <name>orientation</name>
819 <enum>Vertical</enum>
820 </property>
821 <property stdset="1">
822 <name>sizeType</name>
823 <enum>Expanding</enum>
824 </property>
825 <property>
826 <name>sizeHint</name>
827 <size>
828 <width>20</width>
829 <height>20</height>
830 </size>
831 </property>
832 </spacer>
837 </vbox> 833 </vbox>
838 </widget> 834 </widget>