summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp10
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.h4
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp39
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp7
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
@@ -47,19 +47,23 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
qDebug( "decorating scanlist item" );
// set icon for managed or adhoc mode
QString name;
name.sprintf( "wellenreiter/%s", (const char*) type );
setPixmap( col_type, Resource::loadPixmap( name ) );
// set icon for wep (wireless encryption protocol)
if ( wep )
setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap!
// 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
@@ -36,16 +36,20 @@ class MScanListItem: public QListViewItem
QString type,
QString essid,
QString macaddr,
bool wep,
int channel,
int signal );
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
@@ -145,51 +145,66 @@ void Wellenreiter::timerEvent( QTimerEvent* e )
else
{
qDebug( "no message :(" );
}
}
void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
{
// 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 ) )
- 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 );
}
}
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
-
- 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
@@ -51,29 +51,36 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
ap = new QWidget( TabWidget, "ap" );
apLayout = new QVBoxLayout( ap );
apLayout->setSpacing( 2 );
apLayout->setMargin( 2 );
//--------- 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 );
TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
//--------- LOG TAB --------------
logwindow = new MLogWindow( TabWidget, "Log" );
TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
//--------- HEX TAB --------------