-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.cpp | 14 | ||||
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.h | 26 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 33 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 26 |
4 files changed, 68 insertions, 31 deletions
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.cpp b/noncore/net/wellenreiter/cornucopia/olistview.cpp index f2d3730..c292eb9 100644 --- a/noncore/net/wellenreiter/cornucopia/olistview.cpp +++ b/noncore/net/wellenreiter/cornucopia/olistview.cpp @@ -125,2 +125,7 @@ void OListView::setColumnSeparator( const QPen& p ) +OListViewItem* OListView::childFactory() +{ + return new OListViewItem( this ); +} + #ifndef QT_NO_DATASTREAM @@ -182,3 +187,3 @@ void OListView::serializeFrom( QDataStream& s ) { - OListViewItem* item = new OListViewItem( this ); + OListViewItem* item = childFactory(); s >> *item; @@ -339,2 +344,7 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in +OListViewItem* OListViewItem::childFactory() +{ + return new OListViewItem( this ); +} + #ifndef QT_NO_DATASTREAM @@ -390,3 +400,3 @@ void OListViewItem::serializeFrom( QDataStream& s ) { - OListViewItem* item = new OListViewItem( this ); + OListViewItem* item = childFactory(); s >> (*item); diff --git a/noncore/net/wellenreiter/cornucopia/olistview.h b/noncore/net/wellenreiter/cornucopia/olistview.h index 9df5500..8911e22 100644 --- a/noncore/net/wellenreiter/cornucopia/olistview.h +++ b/noncore/net/wellenreiter/cornucopia/olistview.h @@ -40,3 +40,3 @@ -class OListViewFactory; +class OListViewItem; @@ -117,2 +117,8 @@ class OListViewFactory; + /** + * create a list view item as child of this object + * @return the new object + */ + virtual OListViewItem* childFactory(); + #ifndef QT_NO_DATASTREAM @@ -131,11 +137,2 @@ class OListViewFactory; - /** - * returns a factory for OListView classes - * creates one on the fly if it doesn't exist - * @return the XML Factory - */ - #ifndef QT_NO_XML - //OListViewFactory* Factory(); - #endif - private: @@ -144,5 +141,2 @@ class OListViewFactory; QPen m_columnSeparator; - #ifndef QT_NO_XML - //OListViewFactory* m_Factory; - #endif }; @@ -203,2 +197,8 @@ class OListViewItem: public QListViewItem + /** + * create a list view item as child of this object + * @return the new object + */ + virtual OListViewItem* childFactory(); + #ifndef QT_NO_DATASTREAM 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 @@ -55,2 +55,7 @@ MScanListView::~MScanListView() +OListViewItem* MScanListView::childFactory() +{ + return new MScanListItem( this ); +} + void MScanListView::serializeTo( QDataStream& s) const @@ -98,3 +103,3 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo /* - + const QPixmap* pixmap = item->pixmap( 0 ); @@ -114,8 +119,8 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo // we have already seen this net, check all childs if MAC exists - + network = item; - + item = static_cast<MScanListItem*> ( item->firstChild() ); assert( item ); // this shouldn't fail - + while ( item && ( item->text( 2 ) != macaddr ) ) @@ -200,5 +205,14 @@ 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; } @@ -207,3 +221,14 @@ 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 @@ -35,2 +35,3 @@ class MScanListView: public OListView + virtual OListViewItem* childFactory(); virtual void serializeTo( QDataStream& s ) const; @@ -52,16 +53,16 @@ class MScanListItem: public OListViewItem 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 ); @@ -88,2 +89,3 @@ class MScanListItem: public OListViewItem + virtual OListViewItem* childFactory(); virtual void serializeTo( QDataStream& s ) const; |