summaryrefslogtreecommitdiff
path: root/noncore/net/opiestumbler/stationviewitem.cpp
Unidiff
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 @@
1#include <qpalette.h>
2#include <qcolor.h>
3
4
5#include "stationviewitem.h"
6#include "opiestumbler.h"
7
8StationViewItem::StationViewItem( QListView *parent, const QString &ssid,
9 const QString &channel, const QString &level, const QString &enc,
10 const QString &mac )
11 : QListViewItem( parent, ssid, channel, level, enc, mac )
12{
13}
14
15StationViewItem::StationViewItem( QListView *parent, const QString &ssid,
16 const QString &channel, const QString &level, const QString &enc,
17 const QString &vendor, const QString &mac )
18
19: QListViewItem( parent, ssid, channel, level, enc, vendor, mac )
20{
21}
22
23void StationViewItem::paintCell( QPainter *p, const QColorGroup &cg,
24 int column, int width, int alignment )
25{
26 QColor c;
27 QColorGroup ch(cg);
28
29 if ( column == OpieStumbler::CURSIGNAL ) {
30 int value = text(column).toInt();
31 if ( value < 20 )
32 c.setRgb(255, 0, 0);
33 else if ( value < 35 )
34 c.setRgb(255, 255, 0);
35 else if ( value < 60 )
36 c.setRgb(0, 255, 0);
37 else
38 c.setRgb(0, 0, 255);
39 ch.setColor( QColorGroup::Text, c );
40 }
41
42 if ( column == OpieStumbler::CURSSID ) {
43 if ( text(OpieStumbler::CURENC) == "Y" )
44 c.setRgb(255, 0, 0);
45 else
46 c.setRgb(0, 255, 0);
47 ch.setColor( QColorGroup::Text, c );
48 }
49
50 QListViewItem::paintCell( p, ch, column, width, alignment );
51}
52