summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-08-15 21:47:53 (UTC)
committer mickeyl <mickeyl>2002-08-15 21:47:53 (UTC)
commit596a6985c33b825462b8da70a9dc390306589f4b (patch) (unidiff)
treecabccedf268f19317fd67a8321a54786cdcb2062
parenta7f51d623fd3419cb70c8911e54405c978836330 (diff)
downloadopie-596a6985c33b825462b8da70a9dc390306589f4b.zip
opie-596a6985c33b825462b8da70a9dc390306589f4b.tar.gz
opie-596a6985c33b825462b8da70a9dc390306589f4b.tar.bz2
Changed update scale from milliseconds to seconds. Defaulting now to 2 seconds. All settings are saved via Config.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp70
-rw-r--r--noncore/applets/wirelessapplet/wireless.h12
2 files changed, 60 insertions, 22 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index 15ccc58..183aab8 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -19,2 +19,3 @@
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qpe/config.h>
20 21
@@ -51,2 +52,6 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
51 52
53 readConfig();
54 writeConfigEntry( "UpdateFrequency", updateFrequency );
55 writeConfigEntry( "DisplayStyle", displayStyle );
56
52 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 57 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
@@ -79,3 +84,3 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
79 group->setFocusPolicy( QWidget::NoFocus ); 84 group->setFocusPolicy( QWidget::NoFocus );
80 group->setButton( STYLE_ANTENNA ); 85 group->setButton( displayStyle );
81 grid->addWidget( group, 0, 1 ); 86 grid->addWidget( group, 0, 1 );
@@ -101,3 +106,4 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
101 updateLabel = new QLabel( this ); 106 updateLabel = new QLabel( this );
102 updateLabel->setText( "Update every 500 ms" ); 107 text.sprintf( "Update every %d s", updateFrequency );
108 updateLabel->setText( text );
103 grid->addWidget( updateLabel, 2, 1 ); 109 grid->addWidget( updateLabel, 2, 1 );
@@ -107,7 +113,7 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
107 QSlider* updateSlider = new QSlider( QSlider::Horizontal, this ); 113 QSlider* updateSlider = new QSlider( QSlider::Horizontal, this );
108 updateSlider->setRange( 50, 999 ); 114 updateSlider->setRange( 0, 9 );
109 updateSlider->setValue( 500 ); 115 updateSlider->setValue( updateFrequency );
110 updateSlider->setTickmarks( QSlider::Both ); 116 updateSlider->setTickmarks( QSlider::Both );
111 updateSlider->setTickInterval( 100 ); 117 updateSlider->setTickInterval( 1 );
112 updateSlider->setSteps( 50, 50 ); 118 updateSlider->setSteps( 1, 1 );
113 updateSlider->setFocusPolicy( QWidget::NoFocus ); 119 updateSlider->setFocusPolicy( QWidget::NoFocus );
@@ -120,5 +126,7 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
120 126
127 applet->displayStyleChange( displayStyle );
128 applet->updateDelayChange( updateFrequency );
129
121 connect( group, SIGNAL( clicked( int ) ), 130 connect( group, SIGNAL( clicked( int ) ),
122 applet, SLOT( styleChange( int ) ) ); 131 this, SLOT( displayStyleChange( int ) ) );
123
124} 132}
@@ -128,5 +136,12 @@ void WirelessControl::updateDelayChange( int delay )
128 QString text; 136 QString text;
129 text.sprintf( "Update every %3d ms", delay ); 137 text.sprintf( "Update every %d s", delay );
130 updateLabel->setText( text ); 138 updateLabel->setText( text );
131 applet->updateDelayChange( delay ); 139 applet->updateDelayChange( delay );
140 writeConfigEntry( "UpdateFrequency", delay );
141}
142
143void WirelessControl::displayStyleChange( int style )
144{
145 applet->displayStyleChange( style );
146 writeConfigEntry( "DisplayStyle", style );
132} 147}
@@ -147,3 +162,18 @@ void WirelessControl::show ( bool )
147 162
163void WirelessControl::readConfig()
164{
165 Config cfg( "qpe" );
166 cfg.setGroup( "Wireless" );
167
168 updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 );
169 displayStyle = cfg. readNumEntry( "DisplayStyle", STYLE_ANTENNA );
170}
148 171
172void WirelessControl::writeConfigEntry( const char *entry, int val )
173{
174 Config cfg( "qpe" );
175 cfg.setGroup( "Wireless" );
176 cfg.writeEntry( entry, val );
177}
178
149//=========================================================================== 179//===========================================================================
@@ -151,3 +181,4 @@ void WirelessControl::show ( bool )
151WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) 181WirelessApplet::WirelessApplet( QWidget *parent, const char *name )
152 : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), interface( 0 ) 182 : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ),
183 timer( 0 ), interface( 0 )
153{ 184{
@@ -155,7 +186,4 @@ WirelessApplet::WirelessApplet( QWidget *parent, const char *name )
155 setFixedWidth( 14 ); 186 setFixedWidth( 14 );
156 status = new WirelessControl( this, 0, "wireless status" );
157
158 network = new MWirelessNetwork(); 187 network = new MWirelessNetwork();
159 188 status = new WirelessControl( this, 0, "wireless status" );
160 timer = startTimer( 500 );
161} 189}
@@ -178,3 +206,7 @@ void WirelessApplet::updateDelayChange( int delay )
178{ 206{
179 killTimer( timer ); 207 if ( timer )
208 killTimer( timer );
209 delay *= 1000;
210 if ( delay == 0 )
211 delay = 50;
180 timer = startTimer( delay ); 212 timer = startTimer( delay );
@@ -182,10 +214,10 @@ void WirelessApplet::updateDelayChange( int delay )
182 214
183WirelessApplet::~WirelessApplet() 215void WirelessApplet::displayStyleChange( int style )
184{ 216{
217 visualStyle = style;
218 repaint();
185} 219}
186 220
187void WirelessApplet::styleChange( int style ) 221WirelessApplet::~WirelessApplet()
188{ 222{
189 visualStyle = style;
190 repaint();
191} 223}
diff --git a/noncore/applets/wirelessapplet/wireless.h b/noncore/applets/wirelessapplet/wireless.h
index d45ac68..45c519d 100644
--- a/noncore/applets/wirelessapplet/wireless.h
+++ b/noncore/applets/wirelessapplet/wireless.h
@@ -36,2 +36,5 @@ public:
36 void show( bool ); 36 void show( bool );
37
38 void readConfig();
39 void writeConfigEntry( const char* entry, int val );
37 40
@@ -43,2 +46,3 @@ public slots:
43 void updateDelayChange( int ); 46 void updateDelayChange( int );
47 void displayStyleChange( int );
44 48
@@ -46,2 +50,6 @@ private:
46 WirelessApplet* applet; 50 WirelessApplet* applet;
51
52 int displayStyle;
53 int updateFrequency;
54
47}; 55};
@@ -58,5 +66,3 @@ public:
58 void updateDelayChange( int delay ); 66 void updateDelayChange( int delay );
59 67 void displayStyleChange( int style );
60public slots:
61 void styleChange( int );
62 68