-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 25 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 26 |
2 files changed, 39 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 58a04fb..be1245e 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -54,4 +54,9 @@ MScanListView::~MScanListView() }; +OListViewItem* MScanListView::childFactory() +{ + return new MScanListItem( this ); +} + void MScanListView::serializeTo( QDataStream& s) const { @@ -199,12 +204,32 @@ MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid } +OListViewItem* MScanListItem::childFactory() +{ + return new MScanListItem( this ); +} + void MScanListItem::serializeTo( QDataStream& s ) const { + qDebug( "serializing MScanListItem" ); OListViewItem::serializeTo( s ); + + s << _type; + s << (Q_UINT8) _wep; } void MScanListItem::serializeFrom( QDataStream& s ) { + qDebug( "serializing MScanListItem" ); OListViewItem::serializeFrom( s ); + + s >> _type; + s >> (Q_UINT8) _wep; + + QString name; + name.sprintf( "wellenreiter/%s", (const char*) _type ); + setPixmap( col_type, Resource::loadPixmap( name ) ); + if ( _wep ) + setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! + listView()->triggerUpdate(); } diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index 66c701b..222217c 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h @@ -34,4 +34,5 @@ class MScanListView: public OListView void setManufacturerDB( ManufacturerDB* manufacturerdb ); + virtual OListViewItem* childFactory(); virtual void serializeTo( QDataStream& s ) const; virtual void serializeFrom( QDataStream& s ); @@ -51,18 +52,18 @@ class MScanListItem: public OListViewItem public: MScanListItem::MScanListItem( QListView* parent, - QString type, - QString essid, - QString macaddr, - bool wep, - int channel, - int signal ); + QString type = "unknown", + QString essid = "unknown", + QString macaddr = "unknown", + bool wep = false, + int channel = 0, + int signal = 0 ); MScanListItem::MScanListItem( QListViewItem* parent, - QString type, - QString essid, - QString macaddr, - bool wep, - int channel, - int signal ); + QString type = "unknown", + QString essid = "unknown", + QString macaddr = "unknown", + bool wep = false, + int channel = 0, + int signal = 0 ); @@ -87,4 +88,5 @@ class MScanListItem: public OListViewItem void setManufacturer( const QString& manufacturer ); + virtual OListViewItem* childFactory(); virtual void serializeTo( QDataStream& s ) const; virtual void serializeFrom( QDataStream& s ); |