summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-08-15 21:47:53 (UTC)
committer mickeyl <mickeyl>2002-08-15 21:47:53 (UTC)
commit596a6985c33b825462b8da70a9dc390306589f4b (patch) (side-by-side diff)
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 @@
#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
@@ -51,2 +52,6 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
+ readConfig();
+ writeConfigEntry( "UpdateFrequency", updateFrequency );
+ writeConfigEntry( "DisplayStyle", displayStyle );
+
setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
@@ -79,3 +84,3 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
group->setFocusPolicy( QWidget::NoFocus );
- group->setButton( STYLE_ANTENNA );
+ group->setButton( displayStyle );
grid->addWidget( group, 0, 1 );
@@ -101,3 +106,4 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
updateLabel = new QLabel( this );
- updateLabel->setText( "Update every 500 ms" );
+ text.sprintf( "Update every %d s", updateFrequency );
+ updateLabel->setText( text );
grid->addWidget( updateLabel, 2, 1 );
@@ -107,7 +113,7 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
QSlider* updateSlider = new QSlider( QSlider::Horizontal, this );
- updateSlider->setRange( 50, 999 );
- updateSlider->setValue( 500 );
+ updateSlider->setRange( 0, 9 );
+ updateSlider->setValue( updateFrequency );
updateSlider->setTickmarks( QSlider::Both );
- updateSlider->setTickInterval( 100 );
- updateSlider->setSteps( 50, 50 );
+ updateSlider->setTickInterval( 1 );
+ updateSlider->setSteps( 1, 1 );
updateSlider->setFocusPolicy( QWidget::NoFocus );
@@ -120,5 +126,7 @@ WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const
+ applet->displayStyleChange( displayStyle );
+ applet->updateDelayChange( updateFrequency );
+
connect( group, SIGNAL( clicked( int ) ),
- applet, SLOT( styleChange( int ) ) );
-
+ this, SLOT( displayStyleChange( int ) ) );
}
@@ -128,5 +136,12 @@ void WirelessControl::updateDelayChange( int delay )
QString text;
- text.sprintf( "Update every %3d ms", delay );
+ text.sprintf( "Update every %d s", delay );
updateLabel->setText( text );
applet->updateDelayChange( delay );
+ writeConfigEntry( "UpdateFrequency", delay );
+}
+
+void WirelessControl::displayStyleChange( int style )
+{
+ applet->displayStyleChange( style );
+ writeConfigEntry( "DisplayStyle", style );
}
@@ -147,3 +162,18 @@ void WirelessControl::show ( bool )
+void WirelessControl::readConfig()
+{
+ Config cfg( "qpe" );
+ cfg.setGroup( "Wireless" );
+
+ updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 );
+ displayStyle = cfg. readNumEntry( "DisplayStyle", STYLE_ANTENNA );
+}
+void WirelessControl::writeConfigEntry( const char *entry, int val )
+{
+ Config cfg( "qpe" );
+ cfg.setGroup( "Wireless" );
+ cfg.writeEntry( entry, val );
+}
+
//===========================================================================
@@ -151,3 +181,4 @@ void WirelessControl::show ( bool )
WirelessApplet::WirelessApplet( QWidget *parent, const char *name )
- : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), interface( 0 )
+ : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ),
+ timer( 0 ), interface( 0 )
{
@@ -155,7 +186,4 @@ WirelessApplet::WirelessApplet( QWidget *parent, const char *name )
setFixedWidth( 14 );
- status = new WirelessControl( this, 0, "wireless status" );
-
network = new MWirelessNetwork();
-
- timer = startTimer( 500 );
+ status = new WirelessControl( this, 0, "wireless status" );
}
@@ -178,3 +206,7 @@ void WirelessApplet::updateDelayChange( int delay )
{
- killTimer( timer );
+ if ( timer )
+ killTimer( timer );
+ delay *= 1000;
+ if ( delay == 0 )
+ delay = 50;
timer = startTimer( delay );
@@ -182,10 +214,10 @@ void WirelessApplet::updateDelayChange( int delay )
-WirelessApplet::~WirelessApplet()
+void WirelessApplet::displayStyleChange( int style )
{
+ visualStyle = style;
+ repaint();
}
-void WirelessApplet::styleChange( int style )
+WirelessApplet::~WirelessApplet()
{
- visualStyle = style;
- repaint();
}
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:
void show( bool );
+
+ void readConfig();
+ void writeConfigEntry( const char* entry, int val );
@@ -43,2 +46,3 @@ public slots:
void updateDelayChange( int );
+ void displayStyleChange( int );
@@ -46,2 +50,6 @@ private:
WirelessApplet* applet;
+
+ int displayStyle;
+ int updateFrequency;
+
};
@@ -58,5 +66,3 @@ public:
void updateDelayChange( int delay );
-
-public slots:
- void styleChange( int );
+ void displayStyleChange( int style );