00001 #include <qpalette.h>
00002 #include <qcolor.h>
00003
00004
00005 #include "stationviewitem.h"
00006 #include "opiestumbler.h"
00007
00008 StationViewItem::StationViewItem( QListView *parent, const QString &ssid,
00009 const QString &channel, const QString &level, const QString &enc,
00010 const QString &mac )
00011 : QListViewItem( parent, ssid, channel, level, enc, mac )
00012 {
00013 }
00014
00015 StationViewItem::StationViewItem( QListView *parent, const QString &ssid,
00016 const QString &channel, const QString &level, const QString &enc,
00017 const QString &vendor, const QString &mac )
00018
00019 : QListViewItem( parent, ssid, channel, level, enc, vendor, mac )
00020 {
00021 }
00022
00023 void StationViewItem::paintCell( QPainter *p, const QColorGroup &cg,
00024 int column, int width, int alignment )
00025 {
00026 QColor c;
00027 QColorGroup ch(cg);
00028
00029 if ( column == OpieStumbler::CURSIGNAL ) {
00030 int value = text(column).toInt();
00031 if ( value < 20 )
00032 c.setRgb(255, 0, 0);
00033 else if ( value < 35 )
00034 c.setRgb(255, 255, 0);
00035 else if ( value < 60 )
00036 c.setRgb(0, 255, 0);
00037 else
00038 c.setRgb(0, 0, 255);
00039 ch.setColor( QColorGroup::Text, c );
00040 }
00041
00042 if ( column == OpieStumbler::CURSSID ) {
00043 if ( text(OpieStumbler::CURENC) == "Y" )
00044 c.setRgb(255, 0, 0);
00045 else
00046 c.setRgb(0, 255, 0);
00047 ch.setColor( QColorGroup::Text, c );
00048 }
00049
00050 QListViewItem::paintCell( p, ch, column, width, alignment );
00051 }
00052