summaryrefslogtreecommitdiff
path: root/noncore/applets/wirelessapplet
authoralwin <alwin>2004-03-02 12:21:11 (UTC)
committer alwin <alwin>2004-03-02 12:21:11 (UTC)
commitb6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (side-by-side diff)
treed3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/applets/wirelessapplet
parent0d59c780513da78033f4d9040475dee9db0256d4 (diff)
downloadopie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/applets/wirelessapplet') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/wireless.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp
index 9ce6618..6ef2e44 100644
--- a/noncore/applets/wirelessapplet/wireless.cpp
+++ b/noncore/applets/wirelessapplet/wireless.cpp
@@ -28,203 +28,203 @@
#include <qpe/config.h>
/* QT */
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qpainter.h>
#include <qlabel.h>
#include <qslider.h>
#include <qbuttongroup.h>
#include <qlayout.h>
#include <qfile.h>
#include <qtextstream.h>
/* STD */
#include <sys/types.h>
#include <signal.h>
#define STYLE_BARS 0
#define STYLE_ANTENNA 1
//#define MDEBUG
#undef MDEBUG
WirelessControl::WirelessControl( WirelessApplet *applet, QWidget *parent, const char *name )
: QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet )
{
readConfig();
writeConfigEntry( "UpdateFrequency", updateFrequency );
writeConfigEntry( "DisplayStyle", displayStyle );
setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
QGridLayout *grid = new QGridLayout( this, 3, 2, 6, 2, "top layout" );
/* status label */
statusLabel = new QLabel( this, "statuslabel" );
QString text( "Wireless Status:<br>"
"*** Unknown ***<br>"
"Card not inserted ?<br>"
"Or Sharp ROM ?<br>"
"CELL: 00:00:00:00:00:00" );
/* QString text( "Station: Unknown<br>"
"ESSID: Unknown<br>"
"MODE: Unknown<br>"
"FREQ: Unknown<br>"
"CELL: AA:BB:CC:DD:EE:FF" ); */
statusLabel->setText( text );
statusLabel->setFixedSize( statusLabel->sizeHint() );
grid->addWidget( statusLabel, 0, 0 );
/* visualization group box */
QButtonGroup* group = new QButtonGroup( 1, Qt::Horizontal, "Visualization", this );
QRadioButton* r1 = new QRadioButton( "Color Bars", group );
QRadioButton* r2 = new QRadioButton( "Antenna", group );
r1->setFocusPolicy( QWidget::NoFocus );
r2->setFocusPolicy( QWidget::NoFocus );
group->setFocusPolicy( QWidget::NoFocus );
group->setButton( displayStyle );
grid->addWidget( group, 0, 1 );
/* quality graph */
mgraph = new MGraph( this );
mgraph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
mgraph->setMin( 0 );
mgraph->setMax( 92 );
grid->addWidget( mgraph, 1, 0 );
mgraph->setFocusPolicy( QWidget::NoFocus );
/* advanced configuration Button */
QPushButton* advanced = new QPushButton( "Advanced...", this );
advanced->setFocusPolicy( QWidget::NoFocus );
grid->addWidget( advanced, 2, 0, Qt::AlignCenter );
connect( advanced, SIGNAL( clicked() ),
this, SLOT( advancedConfigClicked() ) );
/* update Frequency Label */
updateLabel = new QLabel( this );
text.sprintf( "Update every %d s", updateFrequency );
updateLabel->setText( text );
grid->addWidget( updateLabel, 2, 1 );
/* update Frequency Slider */
QSlider* updateSlider = new QSlider( QSlider::Horizontal, this );
updateSlider->setRange( 0, 9 );
updateSlider->setValue( updateFrequency );
updateSlider->setTickmarks( QSlider::Both );
updateSlider->setTickInterval( 1 );
updateSlider->setSteps( 1, 1 );
updateSlider->setFocusPolicy( QWidget::NoFocus );
grid->addWidget( updateSlider, 1, 1 );
- connect( updateSlider, SIGNAL( valueChanged( int ) ),
- this, SLOT( updateDelayChange( int ) ) );
+ connect( updateSlider, SIGNAL( valueChanged(int) ),
+ this, SLOT( updateDelayChange(int) ) );
setFixedSize( sizeHint() );
setFocusPolicy( QWidget::NoFocus );
applet->displayStyleChange( displayStyle );
applet->updateDelayChange( updateFrequency );
- connect( group, SIGNAL( clicked( int ) ),
- this, SLOT( displayStyleChange( int ) ) );
+ connect( group, SIGNAL( clicked(int) ),
+ this, SLOT( displayStyleChange(int) ) );
applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE );
}
void WirelessControl::advancedConfigClicked()
{
AdvancedConfig * a = new AdvancedConfig( this, "dialog", TRUE );
int result = a->exec();
a->hide();
delete a;
if ( result == QDialog::Accepted )
{
readConfig();
applet->updateDHCPConfig( rocESSID, rocFREQ, rocAP, rocMODE );
}
}
void WirelessControl::updateDelayChange( int delay )
{
QString text;
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 );
}
void WirelessControl::show ( bool )
{
QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) );
int w = sizeHint().width();
int x = curPos.x() - ( w / 2 );
if ( ( x + w ) > QPEApplication::desktop() ->width() )
x = QPEApplication::desktop ( ) -> width ( ) - w;
move( x, curPos.y () - sizeHint().height () );
QFrame::show();
}
void WirelessControl::readConfig()
{
Config cfg( "qpe" );
cfg.setGroup( "Wireless" );
updateFrequency = cfg.readNumEntry( "UpdateFrequency", 2 );
displayStyle = cfg.readNumEntry( "DisplayStyle", STYLE_ANTENNA );
rocESSID = cfg.readBoolEntry( "renew_dhcp_on_essid_change", false );
rocFREQ = cfg.readBoolEntry( "renew_dhcp_on_freq_change", false );
rocAP = cfg.readBoolEntry( "renew_dhcp_on_ap_change", false );
rocMODE = cfg.readBoolEntry( "renew_dhcp_on_mode_change", false );
}
void WirelessControl::writeConfigEntry( const char *entry, int val )
{
Config cfg( "qpe" );
cfg.setGroup( "Wireless" );
cfg.writeEntry( entry, val );
}
//===========================================================================
WirelessApplet::WirelessApplet( QWidget *parent, const char *name )
: QWidget( parent, name ), visualStyle( STYLE_ANTENNA ),
timer( 0 ), interface( 0 ), oldiface( 0 ),
rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false )
{
setFixedHeight( 18 );
setFixedWidth( 14 );
status = new WirelessControl( this, this, "wireless status" );
}
void WirelessApplet::checkInterface()
{
interface = 0L;
ONetwork* net = ONetwork::instance();
net->synchronize();
ONetwork::InterfaceIterator it = net->iterator();
while ( it.current() && !it.current()->isWireless() ) ++it;
if ( it.current() && it.current()->isWireless() )
interface = static_cast<OWirelessNetworkInterface*>( it.current() );
if ( interface )
{
#ifdef MDEBUG
qDebug( "WIFIAPPLET: using interface '%s'", ( const char* ) interface->name() );
#endif