summaryrefslogtreecommitdiff
path: root/noncore/net/opiestumbler/stationviewitem.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opiestumbler/stationviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opiestumbler/stationviewitem.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/noncore/net/opiestumbler/stationviewitem.cpp b/noncore/net/opiestumbler/stationviewitem.cpp
new file mode 100644
index 0000000..64223d7
--- a/dev/null
+++ b/noncore/net/opiestumbler/stationviewitem.cpp
@@ -0,0 +1,52 @@
+#include <qpalette.h>
+#include <qcolor.h>
+
+
+#include "stationviewitem.h"
+#include "opiestumbler.h"
+
+StationViewItem::StationViewItem( QListView *parent, const QString &ssid,
+ const QString &channel, const QString &level, const QString &enc,
+ const QString &mac )
+ : QListViewItem( parent, ssid, channel, level, enc, mac )
+{
+}
+
+StationViewItem::StationViewItem( QListView *parent, const QString &ssid,
+ const QString &channel, const QString &level, const QString &enc,
+ const QString &vendor, const QString &mac )
+
+: QListViewItem( parent, ssid, channel, level, enc, vendor, mac )
+{
+}
+
+void StationViewItem::paintCell( QPainter *p, const QColorGroup &cg,
+ int column, int width, int alignment )
+{
+ QColor c;
+ QColorGroup ch(cg);
+
+ if ( column == OpieStumbler::CURSIGNAL ) {
+ int value = text(column).toInt();
+ if ( value < 20 )
+ c.setRgb(255, 0, 0);
+ else if ( value < 35 )
+ c.setRgb(255, 255, 0);
+ else if ( value < 60 )
+ c.setRgb(0, 255, 0);
+ else
+ c.setRgb(0, 0, 255);
+ ch.setColor( QColorGroup::Text, c );
+ }
+
+ if ( column == OpieStumbler::CURSSID ) {
+ if ( text(OpieStumbler::CURENC) == "Y" )
+ c.setRgb(255, 0, 0);
+ else
+ c.setRgb(0, 255, 0);
+ ch.setColor( QColorGroup::Text, c );
+ }
+
+ QListViewItem::paintCell( p, ch, column, width, alignment );
+}
+