-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.cpp | 6 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.h | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 35 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 7 |
4 files changed, 41 insertions, 11 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp index 9532a01..189a12d 100644 --- a/noncore/net/wellenreiter/gui/scanlistitem.cpp +++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp @@ -55,11 +55,15 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, if ( wep ) setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap! // set channel and signal text + + if ( signal != -1 ) setText( col_sig, QString::number( signal ) ); + if ( channel != -1 ) setText( col_channel, QString::number( channel ) ); - //setText listView()->triggerUpdate(); + this->type = type; + } diff --git a/noncore/net/wellenreiter/gui/scanlistitem.h b/noncore/net/wellenreiter/gui/scanlistitem.h index dd8219a..cd9d883 100644 --- a/noncore/net/wellenreiter/gui/scanlistitem.h +++ b/noncore/net/wellenreiter/gui/scanlistitem.h @@ -44,8 +44,12 @@ class MScanListItem: public QListViewItem protected: virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); + public: + + QString type; + }; #endif diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index d1ace46..9c8630f 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -153,27 +153,39 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo // FIXME: this code belongs in customized QListView, not into this class // search, if we had an item with this essid once before - QListViewItem* item = netview->firstChild(); + //MScanListItem* item = dynamic_cast<MScanListItem*>( netview->firstChild() ); + MScanListItem* item = static_cast<MScanListItem*>( netview->firstChild() ); while ( item && ( item->text( 0 ) != essid ) ) { qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); - item = item->itemBelow(); + item = dynamic_cast<MScanListItem*>( item->itemBelow() ); } if ( item ) { qDebug( "found!" ); - if ( macaddr != item->text( 2 ) ) + // check, if it is the same item (based on MACaddr) + + if ( macaddr == item->text( 2 ) ) + { + qDebug( "already had item with mac %s", (const char*) item->text( 2 ) ); + return; + } + + // another item belonging to the same net, so: insert the new item as child + new MScanListItem( item, type, essid, macaddr, wep, channel, signal ); - else - qDebug( "already there. ignoring..." ); } + else { - new MScanListItem( netview, type, essid, macaddr, wep, channel, signal ); + qDebug( "inserting new network" ); + MScanListItem* network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 ); + + new MScanListItem( network, type, essid, macaddr, wep, channel, signal ); } } void Wellenreiter::buttonClicked() @@ -182,14 +194,17 @@ void Wellenreiter::buttonClicked() // FIXME: communicate with daemon and set button text according to state button->setText( "Stop Scanning" ); - // add some icons, so that we can see if this works + // add some test stations, so that we can see if the GUI part works - addNewItem( "managed", "DummyNet", "04:00:20:EF:A6:43", true, 6, 80 ); - addNewItem( "adhoc", "DummyNet", "40:03:A3:E7:56:22", false, 11, 30 ); + addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); + addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); + addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); + addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); + addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); QString command ("98"); - sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); + //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); } diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index 9b6424d..b1845b9 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp @@ -59,13 +59,20 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f //--------- NETVIEW TAB -------------- netview = new QListView( ap, "netview" ); netview->addColumn( tr( "SSID" ) ); + netview->setColumnAlignment( 0, AlignLeft || AlignVCenter ); netview->addColumn( tr( "Sig" ) ); + netview->setColumnAlignment( 1, AlignCenter ); netview->addColumn( tr( "AP" ) ); + netview->setColumnAlignment( 2, AlignCenter ); netview->addColumn( tr( "Chn" ) ); + netview->setColumnAlignment( 3, AlignCenter ); netview->addColumn( tr( "W" ) ); + netview->setColumnAlignment( 4, AlignCenter ); netview->addColumn( tr( "T" ) ); + netview->setColumnAlignment( 5, AlignCenter ); + netview->setFrameShape( QListView::StyledPanel ); netview->setFrameShadow( QListView::Sunken ); netview->setRootIsDecorated( TRUE ); apLayout->addWidget( netview ); |