-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.cpp | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.h | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 39 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 7 |
4 files changed, 45 insertions, 15 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 @@ -58,7 +58,11 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, // set channel and signal text - setText( col_sig, QString::number( signal ) ); - setText( col_channel, QString::number( channel ) ); - //setText + + if ( signal != -1 ) + setText( col_sig, QString::number( signal ) ); + if ( channel != -1 ) + setText( col_channel, QString::number( channel ) ); 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 @@ -47,2 +47,6 @@ class MScanListItem: public QListViewItem + public: + + QString type; + }; 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 @@ -156,3 +156,4 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo - QListViewItem* item = netview->firstChild(); + //MScanListItem* item = dynamic_cast<MScanListItem*>( netview->firstChild() ); + MScanListItem* item = static_cast<MScanListItem*>( netview->firstChild() ); @@ -161,3 +162,3 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); - item = item->itemBelow(); + item = dynamic_cast<MScanListItem*>( item->itemBelow() ); } @@ -167,10 +168,21 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo - if ( macaddr != item->text( 2 ) ) - new MScanListItem( item, type, essid, macaddr, wep, channel, signal ); - else - qDebug( "already there. ignoring..." ); + // 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 { - 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 ); } @@ -185,10 +197,13 @@ void Wellenreiter::buttonClicked() - // add some icons, so that we can see if this 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 ); + // add some test stations, so that we can see if the GUI part works + 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 @@ -62,7 +62,14 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f 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 ); |